Commit f877846d authored by Erick Hitter's avatar Erick Hitter

Ignore coding standards for all borrowed code

parent b69215ea
......@@ -79,7 +79,7 @@ function parse_request() {
*
* References to $wp_rewrite->index were replaced with $rewrite_index, and whitespace updated, but otherwise, this is directly from WP::parse_request()
*/
// @codingStandardsIgnoreStart
// Borrowed from Core. @codingStandardsIgnoreStart
$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
list( $pathinfo ) = explode( '?', $pathinfo );
$pathinfo = str_replace( "%", "%25", $pathinfo );
......@@ -118,7 +118,7 @@ function parse_request() {
}
$requested_file = $req_uri;
// @codingStandardsIgnoreEnd
// Borrowed from Core. @codingStandardsIgnoreEnd
/**
* End what's borrowed from Core
*/
......
......@@ -323,14 +323,14 @@ class Events extends \WP_CLI_Command {
* @return string
*/
private function calculate_interval( $since ) {
// Borrowed from WP-CLI. @codingStandardsIgnoreStart
if ( $since <= 0 ) {
return 'now';
}
$since = absint( $since );
// array of time period chunks.
// @codingStandardsIgnoreStart
// array of time period chunks
$chunks = array(
array( 60 * 60 * 24 * 365 , \_n_noop( '%s year', '%s years' ) ),
array( 60 * 60 * 24 * 30 , \_n_noop( '%s month', '%s months' ) ),
......@@ -340,44 +340,39 @@ class Events extends \WP_CLI_Command {
array( 60 , \_n_noop( '%s minute', '%s minutes' ) ),
array( 1 , \_n_noop( '%s second', '%s seconds' ) ),
);
// @codingStandardsIgnoreEnd
/**
* We only want to output two chunks of time here, eg:
* x years, xx months
* x days, xx hours
* so there's only two bits of calculation below:
*/
// step one: the first chunk.
$j = count( $chunks );
for ( $i = 0; $i < $j; $i++ ) {
$seconds = $chunks[ $i ][0];
$name = $chunks[ $i ][1];
// finding the biggest chunk (if the chunk fits, break).
$count = floor( $since / $seconds );
if ( 0 !== $count ) {
// we only want to output two chunks of time here, eg:
// x years, xx months
// x days, xx hours
// so there's only two bits of calculation below:
// step one: the first chunk
for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
// finding the biggest chunk (if the chunk fits, break)
if ( ( $count = floor( $since / $seconds ) ) != 0 ){
break;
}
}
// set output var.
$output = sprintf( \_n( $name[0], $name[1], $count ), $count ); // @codingStandardsIgnoreLine
// set output var
$output = sprintf( \_n( $name[0], $name[1], $count ), $count );
// step two: the second chunk.
// step two: the second chunk
if ( $i + 1 < $j ) {
$seconds2 = $chunks[ $i + 1 ][0];
$name2 = $chunks[ $i + 1 ][1];
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
$count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 );
if ( 0 !== $count2 ) {
// add to output var.
$output .= ' ' . sprintf( \_n( $name2[0], $name2[1], $count2 ), $count2 ); // @codingStandardsIgnoreLine
if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
// add to output var
$output .= ' ' . sprintf( \_n( $name2[0], $name2[1], $count2 ), $count2 );
}
}
return $output;
// Borrowed from WP-CLI. @codingStandardsIgnoreEnd
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment