Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
Cron-Control
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
WP Plugins
Cron-Control
Commits
f877846d
Commit
f877846d
authored
Sep 10, 2017
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore coding standards for all borrowed code
parent
b69215ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
31 deletions
+26
-31
includes/utils.php
includes/utils.php
+2
-2
includes/wp-cli/class-events.php
includes/wp-cli/class-events.php
+24
-29
No files found.
includes/utils.php
View file @
f877846d
...
...
@@ -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
*/
...
...
includes/wp-cli/class-events.php
View file @
f877846d
...
...
@@ -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
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment