Skip to content

Commit f2bf94c

Browse files
committed
Modify the TEC Standard to extend StellarWP and include the redirect there
1 parent 8928be7 commit f2bf94c

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

StellarWP/ruleset.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
1616
</rule>
1717

18-
<!-- Override the ExitAfterRedirect rule with our custom implementation -->
19-
<rule ref="WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit">
20-
<severity>0</severity>
21-
</rule>
22-
<rule ref="StellarWP.Security.ExitAfterRedirect"/>
23-
2418
<!-- Warns about missing short descriptions in docblocks. -->
2519
<rule ref="Generic.Commenting.DocComment">
2620
<exclude name="Generic.Commenting.DocComment.MissingShort" />

TEC

Lines changed: 0 additions & 1 deletion
This file was deleted.

StellarWP/Sniffs/Security/ExitAfterRedirectSniff.php renamed to TEC/Sniffs/Security/ExitAfterRedirectSniff.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @since TBD
77
*/
88

9-
namespace StellarWP\Sniffs\Security;
9+
namespace TEC\Sniffs\Security;
1010

1111
use PHP_CodeSniffer\Files\File;
1212
use PHP_CodeSniffer\Sniffs\Sniff;
@@ -100,9 +100,11 @@ public function process( File $phpcsFile, $stackPtr ) {
100100
$token_content = isset( $tokens[ $i ]['content'] ) ? strtolower( $tokens[ $i ]['content'] ) : '';
101101

102102
// Check for exit, die, or return statements
103-
if ( $token_code === T_EXIT ||
104-
( $token_code === T_STRING && in_array( $token_content, [ 'die', 'tribe_exit', 'tec_exit' ], true ) ) ||
105-
$token_code === T_RETURN ) {
103+
if (
104+
$token_code === T_EXIT
105+
|| ( $token_code === T_STRING && in_array( $token_content, [ 'die', 'tribe_exit', 'tec_exit' ], true ) )
106+
|| $token_code === T_RETURN
107+
) {
106108
$exit_found = true;
107109
break;
108110
}

TEC/ruleset.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="TEC" namespace="TEC" >
3+
<description>The Events Calendar Brand coding standards.</description>
4+
5+
<rule ref="StellarWP"/>
6+
7+
<!-- Override the ExitAfterRedirect rule with our custom implementation -->
8+
<rule ref="WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit">
9+
<severity>0</severity>
10+
</rule>
11+
<rule ref="TEC.Security.ExitAfterRedirect"/>
12+
</ruleset>

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
"name": "Matthew Batchelder",
1818
"email": "borkweb@gmail.com"
19+
},
20+
{
21+
"name": "Gustavo Bordoni",
22+
"email": "bordoni.dev@gmail.com"
1923
}
2024
],
2125
"require": {

0 commit comments

Comments
 (0)