-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Org In URI #60
No Org In URI #60
Conversation
Issue #51 Checks that WordPress.org is not part of Theme URI. Requires WordPress_AbstractThemeSniff class
if ( '' !== $theme_uri && false !== strpos( $token['content'], 'Theme URI' ) ) { | ||
if ( false !== strpos( strtolower( $theme_uri ), 'wordpress.org' ) && 'the wordpress team' !== strtolower( $theme_author ) | ||
|| false !== strpos( strtolower( $theme_uri ), 'w.org' ) && 'the wordpress team' !== strtolower( $theme_author ) ) { | ||
$phpcsFile->addError( 'Using a WordPress.org Theme URI is reserved for official themes.' , $stackPtr, 'NoOrgInThemeUri' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about?
Using the WordPress.org Theme URI is reserved for the default themes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links starting with w.org ( like http://www.organicthemes.com) will result in a false positive.
if ( 'style.css' === $fileName ) { | ||
if ( '' !== $theme_uri && false !== strpos( $token['content'], 'Theme URI' ) ) { | ||
if ( false !== strpos( strtolower( $theme_uri ), 'wordpress.org' ) && 'the wordpress team' !== strtolower( $theme_author ) | ||
|| false !== strpos( strtolower( $theme_uri ), 'w.org' ) && 'the wordpress team' !== strtolower( $theme_author ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could reduce the code with
if ( ( false !== strpos( strtolower( $theme_uri ), 'wordpress.org' ) || false !== strpos( strtolower( $theme_uri ), 'w.org' ) ) && 'the wordpress team' !== strtolower( $theme_author ) ) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent what @carolinan mentioned we could check against //w.org
instead. Is there are reason why you included the short url? Is it used in the default themes?
563cd1d
to
6671823
Compare
Closing for now, we may revisit this in another form in the future. |
No Org In URI
Checks that WordPress.org is not part of Theme URI.
Requires WordPress_AbstractThemeSniff class