mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Remove lingering instances of call time pass-by-reference, limited to instances of callable - use $this instead of &$this.
Props jdgrimes. See #25160. git-svn-id: https://develop.svn.wordpress.org/trunk@25254 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -237,7 +237,7 @@ class MakePOT {
|
||||
return $this->wp_generic( $dir, array(
|
||||
'project' => 'wp-core', 'output' => $output,
|
||||
'extract_not_gettexted' => true,
|
||||
'not_gettexted_files_filter' => array( &$this, 'is_not_ms_file' ),
|
||||
'not_gettexted_files_filter' => array( $this, 'is_not_ms_file' ),
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ class MakePOT {
|
||||
'includes' => $this->ms_files, 'excludes' => array(),
|
||||
'default_output' => 'wordpress-ms.pot',
|
||||
'extract_not_gettexted' => true,
|
||||
'not_gettexted_files_filter' => array( &$this, 'is_ms_file' ),
|
||||
'not_gettexted_files_filter' => array( $this, 'is_ms_file' ),
|
||||
) );
|
||||
if ( !$ms_result ) {
|
||||
return false;
|
||||
@@ -557,7 +557,7 @@ $included_files = get_included_files();
|
||||
if ($included_files[0] == __FILE__) {
|
||||
$makepot = new MakePOT;
|
||||
if ((3 == count($argv) || 4 == count($argv)) && in_array($method = str_replace('-', '_', $argv[1]), get_class_methods($makepot))) {
|
||||
$res = call_user_func(array(&$makepot, $method), realpath($argv[2]), isset($argv[3])? $argv[3] : null);
|
||||
$res = call_user_func(array($makepot, $method), realpath($argv[2]), isset($argv[3])? $argv[3] : null);
|
||||
if (false === $res) {
|
||||
fwrite(STDERR, "Couldn't generate POT file!\n");
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class NotGettexted {
|
||||
if ('.' == $item || '..' == $item)
|
||||
continue;
|
||||
if ('.php' == substr($item, -4))
|
||||
$files[] = $full_item;
|
||||
$files[] = $full_item;
|
||||
if (is_dir($full_item))
|
||||
$files += array_merge($files, NotGettexted::list_php_files($full_item, $files));
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class NotGettexted {
|
||||
continue;
|
||||
}
|
||||
if ($this->STAGE_START_COMMENT <= $stage && $stage <= $this->STAGE_WHITESPACE_AFTER && '/'.$current_comment_id == $matches[1]) {
|
||||
$stage = $this->STAGE_END_COMMENT;
|
||||
$stage = $this->STAGE_END_COMMENT;
|
||||
$this->logmsg('end comment', $current_comment_id);
|
||||
$result .= call_user_func($other_action, $token);
|
||||
if (!is_null($register_action)) call_user_func($register_action, $current_string, $current_comment_id, $current_string_line);
|
||||
@@ -152,7 +152,7 @@ class NotGettexted {
|
||||
foreach($filenames as $filename) {
|
||||
$tokens = token_get_all(file_get_contents($filename));
|
||||
$aggregator = $this->make_string_aggregator($global_name, $filename);
|
||||
$this->walk_tokens($tokens, array(&$this, 'ignore_token'), array(&$this, 'ignore_token'), $aggregator);
|
||||
$this->walk_tokens($tokens, array($this, 'ignore_token'), array($this, 'ignore_token'), $aggregator);
|
||||
}
|
||||
|
||||
$potf = '-' == $pot_filename? STDOUT : @fopen($pot_filename, 'a');
|
||||
@@ -196,7 +196,7 @@ class NotGettexted {
|
||||
$source = file_get_contents($filename);
|
||||
if ( strlen($source) > 150000 ) continue;
|
||||
$tokens = token_get_all($source);
|
||||
$new_file = $this->walk_tokens($tokens, $replacer, array(&$this, 'unchanged_token'));
|
||||
$new_file = $this->walk_tokens($tokens, $replacer, array($this, 'unchanged_token'));
|
||||
$f = fopen($filename, 'w');
|
||||
fwrite($f, $new_file);
|
||||
fclose($f);
|
||||
@@ -218,7 +218,7 @@ class NotGettexted {
|
||||
$this->usage();
|
||||
exit(1);
|
||||
}
|
||||
call_user_func_array(array(&$this, $this->commands[$argv[1]]), array_slice($argv, 2));
|
||||
call_user_func_array(array($this, $this->commands[$argv[1]]), array_slice($argv, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class PotExtMeta {
|
||||
if ( $headers )
|
||||
$this->headers = (array) $headers;
|
||||
if ( is_dir( $ext_filename ) ) {
|
||||
$pot = implode('', array_map(array(&$this, 'load_from_file'), glob("$ext_filename/*.php")));
|
||||
$pot = implode('', array_map(array($this, 'load_from_file'), glob("$ext_filename/*.php")));
|
||||
} else {
|
||||
$pot = $this->load_from_file($ext_filename);
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ error_reporting( E_ALL );
|
||||
require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php';
|
||||
|
||||
class NotGettextedTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
|
||||
function __construct() {
|
||||
$this->ng = new NotGettexted;
|
||||
}
|
||||
|
||||
|
||||
function test_make_string_aggregator() {
|
||||
global $baba;
|
||||
$f = $this->ng->make_string_aggregator( 'baba', 'baba.php' );
|
||||
@@ -29,11 +29,11 @@ class NotGettextedTest extends PHPUnit_Framework_TestCase {
|
||||
echo /* WP_I18N_GUGU*/ "yes" /* /WP_I18N_UGU */;
|
||||
if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); }
|
||||
?>';
|
||||
$tokens = token_get_all($code);
|
||||
$this->assertEquals( '', $this->ng->walk_tokens( $tokens, array(&$this->ng, 'ignore_token'), array(&$this->ng, 'ignore_token') ) );
|
||||
$this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'ignore_token') ) );
|
||||
$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );
|
||||
$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );
|
||||
$tokens = token_get_all($code);
|
||||
$this->assertEquals( '', $this->ng->walk_tokens( $tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token') ) );
|
||||
$this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token') ) );
|
||||
$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) );
|
||||
$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) );
|
||||
}
|
||||
|
||||
function test_replace() {
|
||||
@@ -43,4 +43,4 @@ echo /* WP_I18N_GUGU*/ "yes" /* /WP_I18N_UGU */;
|
||||
$this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) );
|
||||
unlink( 'data/not-gettexted-0-work.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user