Coding Standards: Extract extract() from the codebase.

Of the last four instances of `extract()` occurring, three of them are removed by this commit, and the fourth is appropriately documented.

See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44569 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-01-12 03:19:23 +00:00
parent 34e3de7b7f
commit ff53bd388c
4 changed files with 24 additions and 19 deletions

View File

@@ -29,15 +29,14 @@ class Tests_Post_Output extends WP_UnitTestCase {
}
function _shortcode_paragraph( $atts, $content ) {
extract(
shortcode_atts(
array(
'class' => 'graf',
),
$atts
)
$processed_atts = shortcode_atts(
array(
'class' => 'graf',
),
$atts
);
return "<p class='$class'>$content</p>\n";
return "<p class='{$processed_atts['class']}'>$content</p>\n";
}
function test_the_content() {

View File

@@ -43,18 +43,16 @@ class Tests_Shortcode extends WP_UnitTestCase {
// [bartag foo="bar"]
function _shortcode_bartag( $atts ) {
extract(
shortcode_atts(
array(
'foo' => 'no foo',
'baz' => 'default baz',
),
$atts,
'bartag'
)
$processed_atts = shortcode_atts(
array(
'foo' => 'no foo',
'baz' => 'default baz',
),
$atts,
'bartag'
);
return "foo = {$foo}";
return "foo = {$processed_atts['foo']}";
}
// [baztag]content[/baztag]