diff --git a/WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php b/WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php index 173a0162..0e118687 100644 --- a/WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php +++ b/WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php @@ -46,6 +46,13 @@ public function getGroups() { 'flush_rewrite_rules', ), ), + 'attachment_url_to_postid' => array( + 'type' => 'error', + 'message' => '%s() is prohibited, please use wpcom_vip_attachment_url_to_postid() instead.', + 'functions' => array( + 'attachment_url_to_postid', + ), + ), ); return array_merge( $original_groups, $new_groups ); diff --git a/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc b/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc index d7311b23..97a23f2f 100644 --- a/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc +++ b/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc @@ -8,4 +8,8 @@ wp_cache_get_multi(); // Bad. get_super_admins(); // Bad. -flush_rewrite_rules(); // Bad. \ No newline at end of file +flush_rewrite_rules(); // Bad. + +attachment_url_to_postid(); // Bad. + +wpcom_vip_attachment_url_to_postid(); // OK. \ No newline at end of file diff --git a/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php b/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php index e68c8522..58742809 100644 --- a/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php +++ b/WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php @@ -23,6 +23,7 @@ public function getErrorList() { 7 => 1, 9 => 1, 11 => 1, + 13 => 1, ); } diff --git a/ruleset_test.inc b/ruleset_test.inc index 14821a02..f3c693c7 100644 --- a/ruleset_test.inc +++ b/ruleset_test.inc @@ -126,4 +126,6 @@ eval(); // Bad. Error. // WordPressVIPMinimum.VIP.RestrictedFunctions wpcom_vip_irc(); // Bad. Error. -get_children(); // Bad. Warning. Message. \ No newline at end of file +get_children(); // Bad. Warning. Message. + +attachment_url_to_postid(); // Bad. Error. \ No newline at end of file diff --git a/ruleset_test.php b/ruleset_test.php index dd362f32..3b251dbb 100644 --- a/ruleset_test.php +++ b/ruleset_test.php @@ -43,6 +43,7 @@ 124 => 1, 127 => 1, 129 => 1, + 131 => 1, ), 'warnings' => array( 9 => 1,