Make WordPress Core

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#27201 closed defect (bug) (fixed)

Any file called index.php is labeled as Main Index Template by theme editor, even if it is not the main index template.

Reported by: Shelob9 Owned by: wonderboymusic
Priority: normal Milestone: 4.4
Component: Themes Version: 1.5
Severity: normal Keywords: has-patch theme-editor
Cc: Focuses: administration

Description

In the theme editor, any file called index.php is labeled as 'Main Index Template' even if it is in a subdirectory of the theme and is not actually the main index template for the theme.

Attachments (9)

27201.diff (662 bytes ) - added by Shelob9 13 years ago.
27201.2.diff (1.3 KB ) - added by Shelob9 13 years ago.
27201-3.patch (2.2 KB ) - added by bravokeyl 13 years ago.
27201-3.2.patch (2.2 KB ) - added by bravokeyl 13 years ago.
27201.4.diff (2.5 KB ) - added by MikeHansenMe 13 years ago.
small changes and minor code cleanup
27201.patch (5.7 KB ) - added by bravokeyl 13 years ago.
different approach instead of comparing to 'themes' directory.
27201-5.patch (5.7 KB ) - added by bravokeyl 13 years ago.
Corrected Missing space after variable
27201.6.diff (5.8 KB ) - added by MikeHansenMe 11 years ago.
27201.3.diff (4.3 KB ) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (26)

@Shelob9
13 years ago

@Shelob9
13 years ago

#1 @Shelob9
13 years ago

I have attached two patches for this issue. 27201.diff fixes the issue by labeling any file called index.php that is not the main index template with its path and file name. So, for example, 'inc/index.php' will be labeled as 'inc/index.php'. This is a nice easy solution, but not the greatest. There must be a better way to label these index files, I just don't know what.

27201.2.diff does the same thing, and also adds braces to the two conditionals in the same section of the file, as is called for by WordPress coding standards. It seemed odd to have it right for one conditional, but wrong for the two right before it, but I was worried about the patch exceeding the scope of the issue, so I made two patches.

#2 @SergeyBiryukov
13 years ago

  • Component GeneralThemes
  • Version trunk1.5

#3 @SergeyBiryukov
13 years ago

Please use tabs rather than spaces for indentation (per WordPress Coding Standards).

#4 @bravokeyl
13 years ago

Not just index.php , any standard WP theme descriptive file of $wp_file_descriptions .

@bravokeyl
13 years ago

#5 @bravokeyl
13 years ago

Any comments on the patch..

#6 @SergeyBiryukov
13 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review3.9

@MikeHansenMe
13 years ago

small changes and minor code cleanup

#7 @MikeHansenMe
13 years ago

27201.4.diff removes the return ""; so that at the end of the function it returns the default and consistent filename rather than an empty string. Also converted spaces to tabs and some other minor clean up.

Last edited 13 years ago by MikeHansenMe (previous) (diff)

#8 @bravokeyl
13 years ago

It seems good to me and ready to go.

Last edited 13 years ago by bravokeyl (previous) (diff)

#9 @aaroncampbell
13 years ago

  • Keywords needs-patch added; has-patch removed

First, we prefer to use "yoda conditions" so it should be 'themes' == basename( dirname( dirname( $file ) ) )

Having said that though, we can't actually compare to 'themes' because you can specify a custom themes directory using register_theme_directory(). Take a look at get_theme_root() and get_raw_theme_root() to see what I'm talking about. They fall back to WP_CONTENT_DIR/themes/ but they allow for something custom first.

#10 @aaroncampbell
13 years ago

  • Milestone 3.9Future Release

Since this patch isn't ready, we're already in Beta, and this isn't critical or new, I'm going to move it out of the 3.9 milestone.

This ticket was mentioned in IRC in #wordpress-dev by AaronCampbell. View the logs.


13 years ago

@bravokeyl
13 years ago

different approach instead of comparing to 'themes' directory.

@bravokeyl
13 years ago

Corrected Missing space after variable

#12 @bravokeyl
13 years ago

A different approach to get file description by passing relative path and comparing using pathinfo() as whether the files are in the base level or not.

And implementing brace-style standards.

#13 @bravokeyl
13 years ago

  • Keywords has-patch added; needs-patch removed

#14 @obenland
12 years ago

  • Keywords theme-editor added

#15 @wonderboymusic
11 years ago

  • Keywords has-patch, theme-editor → has-patch theme-editor
  • Milestone Future Release4.4
  • Owner set to wonderboymusic
  • Status newassigned

#16 @wonderboymusic
11 years ago

  • Resolutionfixed
  • Status assignedclosed

In 34658:

Theme Editor: ensure that files named index.php in theme subfolders are not labeled as "Main Index Template"

Props MikeHansenMe, wonderboymusic, bravokeyl, Shelob9.
Fixes #27201.

#17 @SergeyBiryukov
11 years ago

#34828 was marked as a duplicate.

Note: See TracTickets for help on using tickets.