Skip to content
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

Closed
wants to merge 1 commit into from
Closed

No Org In URI #60

wants to merge 1 commit into from

Conversation

khacoder
Copy link
Contributor

No Org In URI
Checks that WordPress.org is not part of Theme URI.
Requires WordPress_AbstractThemeSniff class

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' );
Copy link
Member

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.

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 ) ) {
Copy link
Member

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 ) ) {

Copy link
Member

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?

@grappler grappler force-pushed the feature/theme-review-sniffs branch 2 times, most recently from 563cd1d to 6671823 Compare September 27, 2016 12:28
@jrfnl
Copy link
Contributor

jrfnl commented May 31, 2018

Closing for now, we may revisit this in another form in the future.

@jrfnl jrfnl closed this May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants