Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/utils.php

    r46586 r47122  
    11<?php
    22
    3 // misc help functions and utilities
     3// Misc help functions and utilities.
    44
    55function rand_str( $len = 32 ) {
    … …  
    1919}
    2020
    21 // strip leading and trailing whitespace from each line in the string
     21// Strip leading and trailing whitespace from each line in the string.
    2222function strip_ws( $txt ) {
    2323        $lines  = explode( "\n", $txt );
    … …  
    3232}
    3333
    34 // helper class for testing code that involves actions and filters
    35 // typical use:
    36 // $ma = new MockAction();
    37 // add_action('foo', array(&$ma, 'action'));
     34/*
     35 * Helper class for testing code that involves actions and filters.
     36 * Typical use:
     37 * $ma = new MockAction();
     38 * add_action( 'foo', array( &$ma, 'action' ) );
     39 */
    3840class MockAction {
    3941        var $events;
    … …  
    130132
    131133        function filterall( $tag, ...$args ) {
    132                 // this one doesn't return the result, so it's safe to use with the new 'all' filter
     134                // This one doesn't return the result, so it's safe to use with the new 'all' filter.
    133135                if ( $this->debug ) {
    134136                        dmp( __FUNCTION__, $this->current_filter() );
    … …  
    142144        }
    143145
    144         // return a list of all the actions, tags and args
     146        // Return a list of all the actions, tags and args.
    145147        function get_events() {
    146148                return $this->events;
    147149        }
    148150
    149         // return a count of the number of times the action was called since the last reset
     151        // Return a count of the number of times the action was called since the last reset.
    150152        function get_call_count( $tag = '' ) {
    151153                if ( $tag ) {
    … …  
    161163        }
    162164
    163         // return an array of the tags that triggered calls to this action
     165        // Return an array of the tags that triggered calls to this action.
    164166        function get_tags() {
    165167                $out = array();
    … …  
    170172        }
    171173
    172         // return an array of args passed in calls to this action
     174        // Return an array of args passed in calls to this action.
    173175        function get_args() {
    174176                $out = array();
    … …  
    180182}
    181183
    182 // convert valid xml to an array tree structure
    183 // kinda lame but it works with a default php 4 installation
     184// Convert valid XML to an array tree structure.
     185// Kinda lame, but it works with a default PHP 4 installation.
    184186class TestXMLParser {
    185187        var $xml;
    … …  
    313315}
    314316
    315 // recursively generate some quick assertEquals tests based on an array
     317// Recursively generate some quick assertEquals() tests based on an array.
    316318function gen_tests_array( $name, $array ) {
    317319        $out = array();
    … …  
    368370}
    369371
    370 // mask out any input fields matching the given name
     372// Mask out any input fields matching the given name.
    371373function mask_input_value( $in, $name = '_wpnonce' ) {
    372374        return preg_replace( '@<input([^>]*) name="' . preg_quote( $name ) . '"([^>]*) value="[^>]*" />@', '<input$1 name="' . preg_quote( $name ) . '"$2 value="***" />', $in );
    … …  
    396398
    397399function _cleanup_query_vars() {
    398         // clean out globals to stop them polluting wp and wp_query
     400        // Clean out globals to stop them polluting wp and wp_query.
    399401        foreach ( $GLOBALS['wp']->public_query_vars as $v ) {
    400402                unset( $GLOBALS[ $v ] );
Note: See TracChangeset for help on using the changeset viewer.