WordPress.org

Making WordPress.org

Changeset 1020


Ignore:
Timestamp:
12/02/2014 11:01:57 PM (6 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Remove "Default is XXX." and "Default XXX." from parameter descriptions when possible

In the display of parameters, the default value (as declared in the method signature) is already known and displayed as "Default value: XXX" immediately following the parameter description. Leaving the default value statement in the description is thus redundant, especially given this close proximity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r1019 r1020  
    610610                if ( ! empty( $arg['name'] ) && ! empty( $params[ $arg['name'] ] ) ) {
    611611                    $params[ $arg['name'] ]['default'] = $arg['default'];
     612                    // If a known default is stated in the parameter's description, try to remove it
     613                    // since the actual default value is displayed immediately following description.
     614                    if ( $arg['default'] ) {
     615                        $default = htmlentities( $arg['default'] );
     616                        $params[ $arg['name'] ]['content'] = str_replace( "default is {$default}.", '', $params[ $arg['name'] ]['content'] );
     617                        $params[ $arg['name'] ]['content'] = str_replace( "Default {$default}.", '', $params[ $arg['name'] ]['content'] );
     618                    }
    612619                }
    613620
Note: See TracChangeset for help on using the changeset viewer.