Make WordPress Core

Opened 16 years ago

Closed 15 years ago

Last modified 4 years ago

#8497 closed enhancement (fixed)

support single-lined Template Name comment blocks for Templates

Reported by: dd32's profile DD32 Owned by: westi's profile westi
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Themes Keywords: has-patch needs-testing
Focuses: Cc:

Description

at present, The Template system requires that the Template Names are on their own lines, Eg:

/*
Template Name: Snarfer
*/

Using something such as:

/* Template Name: Snarfer */

or

<?php // Template Name: Snarfer ?>

will result in Snarfer */ and Snarfer ?> respectively.

The attached patch causes the template locator to ignore anything after a closing comment marker(*/) as well as end-php markers(?>)

(As promised for Anthony)

Attachments (5)

8479.diff (852 bytes) - added by DD32 16 years ago.
8497.diff (4.8 KB) - added by Denis-de-Bernardy 15 years ago.
updated and enhanced patch
8497.2.diff (5.0 KB) - added by Denis-de-Bernardy 15 years ago.
8497.3.diff (5.6 KB) - added by Denis-de-Bernardy 15 years ago.
fix potential cron job issues
8497-cron.diff (1.0 KB) - added by Denis-de-Bernardy 15 years ago.
fix both themes and plugins update cron

Download all attachments as: .zip

Change History (17)

@DD32
16 years ago

#1 @DD32
16 years ago

I transposed the minor digits in the patch name.. but rest assured, Its for this ticket.

#2 @westi
16 years ago

  • Owner set to westi
  • Status changed from new to assigned

@Denis-de-Bernardy
15 years ago

updated and enhanced patch

#3 @Denis-de-Bernardy
15 years ago

  • Keywords needs-testing added

#4 @westi
15 years ago

  • Keywords needs-patch added

Denis, I take the new patch is intending to apply this rule to all the other headers?

If so, we should create a cleanup function containing the regex call and just call that.

Named something like _cleanup_header_comment() but preferably snapier!

#5 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch removed

done

#6 @westi
15 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [11168]) Support single line Template Name comment blocks for theme Templates and apply same cleanup to all header lines. Fixes #8497 props DD32 and Denis-de-Bernardy.

@Denis-de-Bernardy
15 years ago

fix potential cron job issues

#7 @Denis-de-Bernardy
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

oh, you just committed it. I had noticed a potential potential cron job issue. new patch against current trunk arriving in a sec.

#8 @Denis-de-Bernardy
15 years ago

the cron that checks for theme updates uses get_themes(), so we need to make sure the function is defined when that gets triggered.

@Denis-de-Bernardy
15 years ago

fix both themes and plugins update cron

#9 @Denis-de-Bernardy
15 years ago

there. fixes both the theme and the plugin update check cron -- else we'd get fatal errors when they're triggered from the front end.

#10 @westi
15 years ago

I think I would prefer to move the new function to wp-includes/functions.php where it will always be available.

#11 @westi
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [11170]) Move _cleanup_header_comment() to wp-includes so it is always available. Fixes #8497 props Denis-de-Bernardy.

#12 @peterwilsoncc
4 years ago

In 47779:

Tests: Add unit tests for _cleanup_header_comment().

Props pbearne.
Fixes #38101. See #8497.

Note: See TracTickets for help on using tickets.