@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | * @subpackage tools |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -$pomo = dirname( dirname( dirname( __FILE__ ) ) ) . '/src/wp-includes/pomo'; |
|
| 10 | +$pomo = dirname(dirname(dirname(__FILE__))).'/src/wp-includes/pomo'; |
|
| 11 | 11 | require_once "$pomo/po.php"; |
| 12 | -require_once dirname( __FILE__ ) . '/makepot.php'; |
|
| 12 | +require_once dirname(__FILE__).'/makepot.php'; |
|
| 13 | 13 | |
| 14 | 14 | class PotExtMeta { |
| 15 | 15 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | $source = $makepot->get_first_lines($ext_filename); |
| 37 | 37 | $pot = ''; |
| 38 | 38 | $po = new PO; |
| 39 | - foreach($this->headers as $header) { |
|
| 39 | + foreach ($this->headers as $header) { |
|
| 40 | 40 | $string = $makepot->get_addon_header($header, $source); |
| 41 | - if (!$string) continue; |
|
| 41 | + if ( ! $string) continue; |
|
| 42 | 42 | $args = array( |
| 43 | 43 | 'singular' => $string, |
| 44 | 44 | 'extracted_comments' => $header.' of the plugin/theme', |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | return $pot; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - function append( $ext_filename, $pot_filename, $headers = null ) { |
|
| 53 | - if ( $headers ) |
|
| 52 | + function append($ext_filename, $pot_filename, $headers = null) { |
|
| 53 | + if ($headers) |
|
| 54 | 54 | $this->headers = (array) $headers; |
| 55 | - if ( is_dir( $ext_filename ) ) { |
|
| 55 | + if (is_dir($ext_filename)) { |
|
| 56 | 56 | $pot = implode('', array_map(array($this, 'load_from_file'), glob("$ext_filename/*.php"))); |
| 57 | 57 | } else { |
| 58 | 58 | $pot = $this->load_from_file($ext_filename); |
| 59 | 59 | } |
| 60 | - $potf = '-' == $pot_filename? STDOUT : fopen($pot_filename, 'a'); |
|
| 61 | - if (!$potf) return false; |
|
| 60 | + $potf = '-' == $pot_filename ? STDOUT : fopen($pot_filename, 'a'); |
|
| 61 | + if ( ! $potf) return false; |
|
| 62 | 62 | fwrite($potf, $pot); |
| 63 | 63 | if ('-' != $pot_filename) fclose($potf); |
| 64 | 64 | return true; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | if ($included_files[0] == __FILE__) { |
| 70 | 70 | ini_set('display_errors', 1); |
| 71 | 71 | $potextmeta = new PotExtMeta; |
| 72 | - if (!isset($argv[1])) { |
|
| 72 | + if ( ! isset($argv[1])) { |
|
| 73 | 73 | $potextmeta->usage(); |
| 74 | 74 | } |
| 75 | - $potextmeta->append( $argv[1], isset( $argv[2] ) ? $argv[2] : '-', isset( $argv[3] ) ? $argv[3] : null ); |
|
| 75 | + $potextmeta->append($argv[1], isset($argv[2]) ? $argv[2] : '-', isset($argv[3]) ? $argv[3] : null); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | ?> |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | * @subpackage tools |
| 8 | 8 | */ |
| 9 | 9 | // see: http://php.net/tokenizer |
| 10 | -if ( ! defined( 'T_ML_COMMENT' ) ) |
|
| 11 | - define( 'T_ML_COMMENT', T_COMMENT ); |
|
| 10 | +if ( ! defined('T_ML_COMMENT')) |
|
| 11 | + define('T_ML_COMMENT', T_COMMENT); |
|
| 12 | 12 | else |
| 13 | - define( 'T_DOC_COMMENT', T_ML_COMMENT ); |
|
| 13 | + define('T_DOC_COMMENT', T_ML_COMMENT); |
|
| 14 | 14 | |
| 15 | -$pomo = dirname( dirname( dirname( __FILE__ ) ) ) . '/src/wp-includes/pomo'; |
|
| 15 | +$pomo = dirname(dirname(dirname(__FILE__))).'/src/wp-includes/pomo'; |
|
| 16 | 16 | require_once "$pomo/po.php"; |
| 17 | 17 | require_once "$pomo/mo.php"; |
| 18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | var $STAGE_WHITESPACE_AFTER = 4; |
| 27 | 27 | var $STAGE_END_COMMENT = 4; |
| 28 | 28 | |
| 29 | - var $commands = array('extract' => 'command_extract', 'replace' => 'command_replace' ); |
|
| 29 | + var $commands = array('extract' => 'command_extract', 'replace' => 'command_replace'); |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | function logmsg() { |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | if ($this->enable_logging) error_log(implode(' ', $args)); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - function stderr($msg, $nl=true) { |
|
| 38 | - fwrite(STDERR, $msg.($nl? "\n" : "")); |
|
| 37 | + function stderr($msg, $nl = true) { |
|
| 38 | + fwrite(STDERR, $msg.($nl ? "\n" : "")); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function cli_die($msg) { |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | exit(1); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - function unchanged_token($token, $s='') { |
|
| 47 | - return is_array($token)? $token[1] : $token; |
|
| 46 | + function unchanged_token($token, $s = '') { |
|
| 47 | + return is_array($token) ? $token[1] : $token; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - function ignore_token($token, $s='') { |
|
| 50 | + function ignore_token($token, $s = '') { |
|
| 51 | 51 | return ''; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function list_php_files($dir) { |
| 55 | 55 | $files = array(); |
| 56 | - $items = scandir( $dir ); |
|
| 57 | - foreach ( (array) $items as $item ) { |
|
| 58 | - $full_item = $dir . '/' . $item; |
|
| 56 | + $items = scandir($dir); |
|
| 57 | + foreach ((array) $items as $item) { |
|
| 58 | + $full_item = $dir.'/'.$item; |
|
| 59 | 59 | if ('.' == $item || '..' == $item) |
| 60 | 60 | continue; |
| 61 | 61 | if ('.php' == substr($item, -4)) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | return create_function('$token, $string', 'global $'.$m.'; return var_export($'.$m.'->translate($string), true);'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - function walk_tokens(&$tokens, $string_action, $other_action, $register_action=null) { |
|
| 80 | + function walk_tokens(&$tokens, $string_action, $other_action, $register_action = null) { |
|
| 81 | 81 | |
| 82 | 82 | $current_comment_id = ''; |
| 83 | 83 | $current_string = ''; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $result = ''; |
| 87 | 87 | $line = 1; |
| 88 | 88 | |
| 89 | - foreach($tokens as $token) { |
|
| 89 | + foreach ($tokens as $token) { |
|
| 90 | 90 | if (is_array($token)) { |
| 91 | 91 | list($id, $text) = $token; |
| 92 | 92 | $line += substr_count($text, "\n"); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $stage = $this->STAGE_END_COMMENT; |
| 103 | 103 | $this->logmsg('end comment', $current_comment_id); |
| 104 | 104 | $result .= call_user_func($other_action, $token); |
| 105 | - if (!is_null($register_action)) call_user_func($register_action, $current_string, $current_comment_id, $current_string_line); |
|
| 105 | + if ( ! is_null($register_action)) call_user_func($register_action, $current_string, $current_comment_id, $current_string_line); |
|
| 106 | 106 | continue; |
| 107 | 107 | } |
| 108 | 108 | } else if (T_CONSTANT_ENCAPSED_STRING == $id) { |
@@ -149,21 +149,21 @@ discard block |
||
| 149 | 149 | $global_name = '__entries_'.mt_rand(1, 1000); |
| 150 | 150 | $GLOBALS[$global_name] = array(); |
| 151 | 151 | |
| 152 | - foreach($filenames as $filename) { |
|
| 152 | + foreach ($filenames as $filename) { |
|
| 153 | 153 | $tokens = token_get_all(file_get_contents($filename)); |
| 154 | 154 | $aggregator = $this->make_string_aggregator($global_name, $filename); |
| 155 | 155 | $this->walk_tokens($tokens, array($this, 'ignore_token'), array($this, 'ignore_token'), $aggregator); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $potf = '-' == $pot_filename? STDOUT : @fopen($pot_filename, 'a'); |
|
| 158 | + $potf = '-' == $pot_filename ? STDOUT : @fopen($pot_filename, 'a'); |
|
| 159 | 159 | if (false === $potf) { |
| 160 | 160 | $this->cli_die("Couldn't open pot file: $pot_filename"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - foreach($GLOBALS[$global_name] as $item) { |
|
| 163 | + foreach ($GLOBALS[$global_name] as $item) { |
|
| 164 | 164 | @list($string, $comment_id, $filename, $line_number) = $item; |
| 165 | - $filename = isset($filename)? preg_replace('|^\./|', '', $filename) : ''; |
|
| 166 | - $ref_line_number = isset($line_number)? ":$line_number" : ''; |
|
| 165 | + $filename = isset($filename) ? preg_replace('|^\./|', '', $filename) : ''; |
|
| 166 | + $ref_line_number = isset($line_number) ? ":$line_number" : ''; |
|
| 167 | 167 | $args = array( |
| 168 | 168 | 'singular' => $string, |
| 169 | 169 | 'extracted_comments' => "Not gettexted string $comment_id", |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | if (false === $res) { |
| 193 | 193 | $this->cli_die("Couldn't read MO file '$mo_filename'!"); |
| 194 | 194 | } |
| 195 | - foreach($filenames as $filename) { |
|
| 195 | + foreach ($filenames as $filename) { |
|
| 196 | 196 | $source = file_get_contents($filename); |
| 197 | - if ( strlen($source) > 150000 ) continue; |
|
| 197 | + if (strlen($source) > 150000) continue; |
|
| 198 | 198 | $tokens = token_get_all($source); |
| 199 | 199 | $new_file = $this->walk_tokens($tokens, $replacer, array($this, 'unchanged_token')); |
| 200 | 200 | $f = fopen($filename, 'w'); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | function cli() { |
| 216 | 216 | global $argv, $commands; |
| 217 | - if (count($argv) < 4 || !in_array($argv[1], array_keys($this->commands))) { |
|
| 217 | + if (count($argv) < 4 || ! in_array($argv[1], array_keys($this->commands))) { |
|
| 218 | 218 | $this->usage(); |
| 219 | 219 | exit(1); |
| 220 | 220 | } |
@@ -1,23 +1,23 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! isset($wp_did_header)): |
|
| 4 | -if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
|
| 3 | +if ( ! isset($wp_did_header)): |
|
| 4 | +if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) { |
|
| 5 | 5 | if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
| 6 | 6 | else $path = 'wp-admin/'; |
| 7 | 7 | |
| 8 | - require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
|
| 9 | - require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
|
| 10 | - require_once( dirname(__FILE__) . '/wp-includes/plugin.php'); |
|
| 11 | - wp_die( sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
| 8 | + require_once(dirname(__FILE__).'/wp-includes/classes.php'); |
|
| 9 | + require_once(dirname(__FILE__).'/wp-includes/functions.php'); |
|
| 10 | + require_once(dirname(__FILE__).'/wp-includes/plugin.php'); |
|
| 11 | + wp_die(sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $wp_did_header = true; |
| 15 | 15 | |
| 16 | -require_once( dirname(__FILE__) . '/wp-config.php'); |
|
| 16 | +require_once(dirname(__FILE__).'/wp-config.php'); |
|
| 17 | 17 | |
| 18 | 18 | wp(); |
| 19 | 19 | |
| 20 | -require_once(ABSPATH . WPINC . '/template-loader.php'); |
|
| 20 | +require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
| 21 | 21 | |
| 22 | 22 | endif; |
| 23 | 23 | |
@@ -1,23 +1,23 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! isset($wp_did_header)): |
|
| 4 | -if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
|
| 3 | +if ( ! isset($wp_did_header)): |
|
| 4 | +if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) { |
|
| 5 | 5 | if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
| 6 | 6 | else $path = 'wp-admin/'; |
| 7 | 7 | |
| 8 | - require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
|
| 9 | - require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
|
| 10 | - require_once( dirname(__FILE__) . '/wp-includes/plugin.php'); |
|
| 11 | - wp_die( sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress › Error" /*/WP_I18N_ERROR*/); |
|
| 8 | + require_once(dirname(__FILE__).'/wp-includes/classes.php'); |
|
| 9 | + require_once(dirname(__FILE__).'/wp-includes/functions.php'); |
|
| 10 | + require_once(dirname(__FILE__).'/wp-includes/plugin.php'); |
|
| 11 | + wp_die(sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress › Error" /*/WP_I18N_ERROR*/); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $wp_did_header = true; |
| 15 | 15 | |
| 16 | -require_once( dirname(__FILE__) . '/wp-config.php'); |
|
| 16 | +require_once(dirname(__FILE__).'/wp-config.php'); |
|
| 17 | 17 | |
| 18 | 18 | wp(); |
| 19 | 19 | |
| 20 | -require_once(ABSPATH . WPINC . '/template-loader.php'); |
|
| 20 | +require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
| 21 | 21 | |
| 22 | 22 | endif; |
| 23 | 23 | |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | * @package wordpress-i18n |
| 6 | 6 | * @subpackage tools |
| 7 | 7 | */ |
| 8 | -error_reporting( E_ALL ); |
|
| 9 | -require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php'; |
|
| 8 | +error_reporting(E_ALL); |
|
| 9 | +require_once dirname(dirname(__FILE__)).'/not-gettexted.php'; |
|
| 10 | 10 | |
| 11 | 11 | class NotGettextedTest extends PHPUnit_Framework_TestCase { |
| 12 | 12 | |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | function test_make_string_aggregator() { |
| 18 | 18 | global $baba; |
| 19 | - $f = $this->ng->make_string_aggregator( 'baba', 'baba.php' ); |
|
| 20 | - call_user_func( $f, 'x', 'y', 'z' ); |
|
| 21 | - call_user_func( $f, 'a', 'b', 'c' ); |
|
| 22 | - $this->assertEquals( array( array( 'x', 'y', 'baba.php', 'z'), array( 'a', 'b', 'baba.php', 'c' ) ), $baba ); |
|
| 19 | + $f = $this->ng->make_string_aggregator('baba', 'baba.php'); |
|
| 20 | + call_user_func($f, 'x', 'y', 'z'); |
|
| 21 | + call_user_func($f, 'a', 'b', 'c'); |
|
| 22 | + $this->assertEquals(array(array('x', 'y', 'baba.php', 'z'), array('a', 'b', 'baba.php', 'c')), $baba); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function test_walk() { |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); } |
| 31 | 31 | ?>'; |
| 32 | 32 | $tokens = token_get_all($code); |
| 33 | - $this->assertEquals( '', $this->ng->walk_tokens( $tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token') ) ); |
|
| 34 | - $this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token') ) ); |
|
| 35 | - $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); |
|
| 36 | - $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); |
|
| 33 | + $this->assertEquals('', $this->ng->walk_tokens($tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token'))); |
|
| 34 | + $this->assertEquals('"yes"\'We died %d times!\'', $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token'))); |
|
| 35 | + $this->assertEquals($code, $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token'))); |
|
| 36 | + $this->assertEquals($code, $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token'))); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | function test_replace() { |
| 40 | 40 | # copy to a new file, so that we don't corrupt the old one |
| 41 | - copy( 'data/not-gettexted-0.php', 'data/not-gettexted-0-work.php' ); |
|
| 42 | - $this->ng->command_replace( 'data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php' ); |
|
| 43 | - $this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) ); |
|
| 44 | - unlink( 'data/not-gettexted-0-work.php' ); |
|
| 41 | + copy('data/not-gettexted-0.php', 'data/not-gettexted-0-work.php'); |
|
| 42 | + $this->ng->command_replace('data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php'); |
|
| 43 | + $this->assertEquals(file_get_contents('data/not-gettexted-0-result.php'), file_get_contents('data/not-gettexted-0-work.php')); |
|
| 44 | + unlink('data/not-gettexted-0-work.php'); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | * @package WordPress |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if ( !isset($wp_did_header) ) { |
|
| 8 | +if ( ! isset($wp_did_header)) { |
|
| 9 | 9 | |
| 10 | 10 | $wp_did_header = true; |
| 11 | 11 | |
| 12 | - require_once( dirname(__FILE__) . '/wp-load.php' ); |
|
| 12 | + require_once(dirname(__FILE__).'/wp-load.php'); |
|
| 13 | 13 | |
| 14 | 14 | wp(); |
| 15 | 15 | |
| 16 | - require_once( ABSPATH . WPINC . '/template-loader.php' ); |
|
| 16 | + require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
| 17 | 17 | |
| 18 | 18 | } |
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default, |
| 19 | 19 | // but we can do it ourself. |
| 20 | -if ( !isset( $HTTP_RAW_POST_DATA ) ) { |
|
| 21 | - $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); |
|
| 20 | +if ( ! isset($HTTP_RAW_POST_DATA)) { |
|
| 21 | + $HTTP_RAW_POST_DATA = file_get_contents('php://input'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // fix for mozBlog and other cases where '<?xml' isn't on the very first line |
| 25 | -if ( isset($HTTP_RAW_POST_DATA) ) |
|
| 25 | +if (isset($HTTP_RAW_POST_DATA)) |
|
| 26 | 26 | $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); |
| 27 | 27 | |
| 28 | 28 | /** Include the bootstrap for setting up WordPress environment */ |
| 29 | -include( dirname( __FILE__ ) . '/wp-load.php' ); |
|
| 29 | +include(dirname(__FILE__).'/wp-load.php'); |
|
| 30 | 30 | |
| 31 | -if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
| 32 | -header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); |
|
| 31 | +if (isset($_GET['rsd'])) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
| 32 | +header('Content-Type: text/xml; charset='.get_option('blog_charset'), true); |
|
| 33 | 33 | ?> |
| 34 | 34 | <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> |
| 35 | 35 | <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @since 3.5.0 |
| 52 | 52 | */ |
| 53 | - do_action( 'xmlrpc_rsd_apis' ); |
|
| 53 | + do_action('xmlrpc_rsd_apis'); |
|
| 54 | 54 | ?> |
| 55 | 55 | </apis> |
| 56 | 56 | </service> |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | exit; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -include_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
| 63 | -include_once(ABSPATH . WPINC . '/class-IXR.php'); |
|
| 64 | -include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); |
|
| 62 | +include_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
| 63 | +include_once(ABSPATH.WPINC.'/class-IXR.php'); |
|
| 64 | +include_once(ABSPATH.WPINC.'/class-wp-xmlrpc-server.php'); |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Posts submitted via the XML-RPC interface get that title |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @param string $class The name of the XML-RPC server class. |
| 79 | 79 | */ |
| 80 | -$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
|
| 80 | +$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server'); |
|
| 81 | 81 | $wp_xmlrpc_server = new $wp_xmlrpc_server_class; |
| 82 | 82 | |
| 83 | 83 | // Fire off the request |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | * @param string $io Whether input or output |
| 95 | 95 | * @param string $msg Information describing logging reason. |
| 96 | 96 | */ |
| 97 | -function logIO( $io, $msg ) { |
|
| 98 | - _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); |
|
| 99 | - if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) |
|
| 100 | - error_log( $io . ' - ' . $msg ); |
|
| 97 | +function logIO($io, $msg) { |
|
| 98 | + _deprecated_function(__FUNCTION__, '3.4', 'error_log()'); |
|
| 99 | + if ( ! empty($GLOBALS['xmlrpc_logging'])) |
|
| 100 | + error_log($io.' - '.$msg); |
|
| 101 | 101 | } |
| 102 | 102 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | ignore_user_abort(true); |
| 13 | 13 | |
| 14 | -if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') ) |
|
| 14 | +if ( ! empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON')) |
|
| 15 | 15 | die(); |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | define('DOING_CRON', true); |
| 23 | 23 | |
| 24 | -if ( !defined('ABSPATH') ) { |
|
| 24 | +if ( ! defined('ABSPATH')) { |
|
| 25 | 25 | /** Set up WordPress environment */ |
| 26 | - require_once( dirname( __FILE__ ) . '/wp-load.php' ); |
|
| 26 | + require_once(dirname(__FILE__).'/wp-load.php'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -40,44 +40,44 @@ discard block |
||
| 40 | 40 | global $wpdb; |
| 41 | 41 | |
| 42 | 42 | $value = 0; |
| 43 | - if ( wp_using_ext_object_cache() ) { |
|
| 43 | + if (wp_using_ext_object_cache()) { |
|
| 44 | 44 | /* |
| 45 | 45 | * Skip local cache and force re-fetch of doing_cron transient |
| 46 | 46 | * in case another process updated the cache. |
| 47 | 47 | */ |
| 48 | - $value = wp_cache_get( 'doing_cron', 'transient', true ); |
|
| 48 | + $value = wp_cache_get('doing_cron', 'transient', true); |
|
| 49 | 49 | } else { |
| 50 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); |
|
| 51 | - if ( is_object( $row ) ) |
|
| 50 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron')); |
|
| 51 | + if (is_object($row)) |
|
| 52 | 52 | $value = $row->option_value; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $value; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -if ( false === $crons = _get_cron_array() ) |
|
| 58 | +if (false === $crons = _get_cron_array()) |
|
| 59 | 59 | die(); |
| 60 | 60 | |
| 61 | -$keys = array_keys( $crons ); |
|
| 62 | -$gmt_time = microtime( true ); |
|
| 61 | +$keys = array_keys($crons); |
|
| 62 | +$gmt_time = microtime(true); |
|
| 63 | 63 | |
| 64 | -if ( isset($keys[0]) && $keys[0] > $gmt_time ) |
|
| 64 | +if (isset($keys[0]) && $keys[0] > $gmt_time) |
|
| 65 | 65 | die(); |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | // The cron lock: a unix timestamp from when the cron was spawned. |
| 69 | -$doing_cron_transient = get_transient( 'doing_cron' ); |
|
| 69 | +$doing_cron_transient = get_transient('doing_cron'); |
|
| 70 | 70 | |
| 71 | 71 | // Use global $doing_wp_cron lock otherwise use the GET lock. If no lock, trying grabbing a new lock. |
| 72 | -if ( empty( $doing_wp_cron ) ) { |
|
| 73 | - if ( empty( $_GET[ 'doing_wp_cron' ] ) ) { |
|
| 72 | +if (empty($doing_wp_cron)) { |
|
| 73 | + if (empty($_GET['doing_wp_cron'])) { |
|
| 74 | 74 | // Called from external script/job. Try setting a lock. |
| 75 | - if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) |
|
| 75 | + if ($doing_cron_transient && ($doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time)) |
|
| 76 | 76 | return; |
| 77 | - $doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); |
|
| 78 | - set_transient( 'doing_cron', $doing_wp_cron ); |
|
| 77 | + $doing_cron_transient = $doing_wp_cron = sprintf('%.22F', microtime(true)); |
|
| 78 | + set_transient('doing_cron', $doing_wp_cron); |
|
| 79 | 79 | } else { |
| 80 | - $doing_wp_cron = $_GET[ 'doing_wp_cron' ]; |
|
| 80 | + $doing_wp_cron = $_GET['doing_wp_cron']; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -85,25 +85,25 @@ discard block |
||
| 85 | 85 | * The cron lock (a unix timestamp set when the cron was spawned), |
| 86 | 86 | * must match $doing_wp_cron (the "key"). |
| 87 | 87 | */ |
| 88 | -if ( $doing_cron_transient != $doing_wp_cron ) |
|
| 88 | +if ($doing_cron_transient != $doing_wp_cron) |
|
| 89 | 89 | return; |
| 90 | 90 | |
| 91 | -foreach ( $crons as $timestamp => $cronhooks ) { |
|
| 92 | - if ( $timestamp > $gmt_time ) |
|
| 91 | +foreach ($crons as $timestamp => $cronhooks) { |
|
| 92 | + if ($timestamp > $gmt_time) |
|
| 93 | 93 | break; |
| 94 | 94 | |
| 95 | - foreach ( $cronhooks as $hook => $keys ) { |
|
| 95 | + foreach ($cronhooks as $hook => $keys) { |
|
| 96 | 96 | |
| 97 | - foreach ( $keys as $k => $v ) { |
|
| 97 | + foreach ($keys as $k => $v) { |
|
| 98 | 98 | |
| 99 | 99 | $schedule = $v['schedule']; |
| 100 | 100 | |
| 101 | - if ( $schedule != false ) { |
|
| 101 | + if ($schedule != false) { |
|
| 102 | 102 | $new_args = array($timestamp, $schedule, $hook, $v['args']); |
| 103 | 103 | call_user_func_array('wp_reschedule_event', $new_args); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - wp_unschedule_event( $timestamp, $hook, $v['args'] ); |
|
| 106 | + wp_unschedule_event($timestamp, $hook, $v['args']); |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * Fires scheduled events. |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | * @param string $hook Name of the hook that was scheduled to be fired. |
| 115 | 115 | * @param array $args The arguments to be passed to the hook. |
| 116 | 116 | */ |
| 117 | - do_action_ref_array( $hook, $v['args'] ); |
|
| 117 | + do_action_ref_array($hook, $v['args']); |
|
| 118 | 118 | |
| 119 | 119 | // If the hook ran too long and another cron process stole the lock, quit. |
| 120 | - if ( _get_cron_lock() != $doing_wp_cron ) |
|
| 120 | + if (_get_cron_lock() != $doing_wp_cron) |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | -if ( _get_cron_lock() == $doing_wp_cron ) |
|
| 127 | - delete_transient( 'doing_cron' ); |
|
| 126 | +if (_get_cron_lock() == $doing_wp_cron) |
|
| 127 | + delete_transient('doing_cron'); |
|
| 128 | 128 | |
| 129 | 129 | die(); |
@@ -14,4 +14,4 @@ |
||
| 14 | 14 | define('WP_USE_THEMES', true); |
| 15 | 15 | |
| 16 | 16 | /** Loads the WordPress Environment and Template */ |
| 17 | -require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
|
| 17 | +require(dirname(__FILE__).'/wp-blog-header.php'); |
|