Skip to content

Commit a4aa799

Browse files
authored
Merge pull request #74 from Automattic/fix-67/flag-attachment_url_to_postid
Add attachment_url_to_postid to restricted functions - wpcom_vip_atta…
2 parents d3f2fec + bf05e53 commit a4aa799

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ public function getGroups() {
4646
'flush_rewrite_rules',
4747
),
4848
),
49+
'attachment_url_to_postid' => array(
50+
'type' => 'error',
51+
'message' => '%s() is prohibited, please use wpcom_vip_attachment_url_to_postid() instead.',
52+
'functions' => array(
53+
'attachment_url_to_postid',
54+
),
55+
),
4956
);
5057

5158
return array_merge( $original_groups, $new_groups );

WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ wp_cache_get_multi(); // Bad.
88

99
get_super_admins(); // Bad.
1010

11-
flush_rewrite_rules(); // Bad.
11+
flush_rewrite_rules(); // Bad.
12+
13+
attachment_url_to_postid(); // Bad.
14+
15+
wpcom_vip_attachment_url_to_postid(); // OK.

WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function getErrorList() {
2323
7 => 1,
2424
9 => 1,
2525
11 => 1,
26+
13 => 1,
2627
);
2728
}
2829

ruleset_test.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,6 @@ eval(); // Bad. Error.
126126
// WordPressVIPMinimum.VIP.RestrictedFunctions
127127
wpcom_vip_irc(); // Bad. Error.
128128

129-
get_children(); // Bad. Warning. Message.
129+
get_children(); // Bad. Warning. Message.
130+
131+
attachment_url_to_postid(); // Bad. Error.

ruleset_test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
124 => 1,
4444
127 => 1,
4545
129 => 1,
46+
131 => 1,
4647
),
4748
'warnings' => array(
4849
9 => 1,

0 commit comments

Comments
 (0)