Commit Graph

66 Commits

Author SHA1 Message Date
Scott Taylor
fe6b5983df In PHP 5.0.0, is_a() became deprecated in favour of the instanceof operator. Calling is_a() would result in an E_STRICT warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

Built from https://develop.svn.wordpress.org/trunk@31188


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Sergey Biryukov
e24b443f50 Correct @return value for WP_Theme::load_textdomain() after [30681].
see #30224.
Built from https://develop.svn.wordpress.org/trunk@31108


git-svn-id: http://core.svn.wordpress.org/trunk@31089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-09 04:54:24 +00:00
Scott Taylor
e619abda6e Improve various @param docs for src/wp-includes/*.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30681


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

Built from https://develop.svn.wordpress.org/trunk@30105


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Andrew Nacin
be7825789d Set Twenty Fifteen as the new default theme. see #29799.
Built from https://develop.svn.wordpress.org/trunk@29895


git-svn-id: http://core.svn.wordpress.org/trunk@29650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-14 19:58:19 +00:00
Sergey Biryukov
26d0ad5e12 Remove redundant 'Visit author homepage' title attributes for plugins and themes.
props joedolson.
fixes #26554.
Built from https://develop.svn.wordpress.org/trunk@28673


git-svn-id: http://core.svn.wordpress.org/trunk@28491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 04:52:16 +00:00
Scott Taylor
c5ba45a11b break is unreachable in WP_Theme::translate_header().
See #27882.

Built from https://develop.svn.wordpress.org/trunk@28547


git-svn-id: http://core.svn.wordpress.org/trunk@28373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-22 19:05:14 +00:00
Drew Jaynes
35fb93858a Use suggested language conventions in the hook docs description for the theme_page_templates filter.
See #27700.

Built from https://develop.svn.wordpress.org/trunk@28000


git-svn-id: http://core.svn.wordpress.org/trunk@27830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 20:18:14 +00:00
Andrew Nacin
bf5447f435 WP_Theme: Return false from the display() method when get() fails.
Fixes a potential warning on the themes page when the active theme is deleted.

fixes #26873.

Built from https://develop.svn.wordpress.org/trunk@27745


git-svn-id: http://core.svn.wordpress.org/trunk@27582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 18:22:13 +00:00
Andrew Nacin
a4a88aeceb I am having a bad day. see #13265.
Built from https://develop.svn.wordpress.org/trunk@27471


git-svn-id: http://core.svn.wordpress.org/trunk@27316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 04:20:14 +00:00
Andrew Nacin
17ccbc86c9 Rename the new page_templates filter to theme_page_templates, and pass it a post object for proper context.
see #13265.

Built from https://develop.svn.wordpress.org/trunk@27470


git-svn-id: http://core.svn.wordpress.org/trunk@27315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 04:19:16 +00:00
Andrew Nacin
044ab93430 Add a filter to remove or rename page templates for a theme. This does not yet handle adding page templates. see #13265.
Built from https://develop.svn.wordpress.org/trunk@27297


git-svn-id: http://core.svn.wordpress.org/trunk@27152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 20:31:15 +00:00
Drew Jaynes
870b415dbd Inline documentation for hooks in wp-includes/class-wp-theme.php.
Props richard2222, kpdesign.
Fixes #26217.

Built from https://develop.svn.wordpress.org/trunk@26891


git-svn-id: http://core.svn.wordpress.org/trunk@26774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-02 01:54:10 +00:00
Andrew Nacin
9ecfa135d8 Map old -width theme tags to new -layout tags for the purposes of translation in the admin.
see #21442.

Built from https://develop.svn.wordpress.org/trunk@26725


git-svn-id: http://core.svn.wordpress.org/trunk@26614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-06 14:37:10 +00:00
Sergey Biryukov
72d4b140fb Make Twenty Fourteen the default theme. props markmcwilliams. fixes #25702.
Built from https://develop.svn.wordpress.org/trunk@26024


git-svn-id: http://core.svn.wordpress.org/trunk@25955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-06 20:02:09 +00:00
Andrew Nacin
7de2054ece Show a proper error message on the dashboard when the current theme is broken.
Clean up Appearance -> Themes when we don't have enough information to show for a broken theme.

Clean up broken/ugly "alt" row styling when we are displaying broken themes.

props johnbillion for initial patch.
fixes #21670.

Built from https://develop.svn.wordpress.org/trunk@25666


git-svn-id: http://core.svn.wordpress.org/trunk@25582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 20:50:09 +00:00
Andrew Nacin
55b3c67413 Revert [23394] until there is a consensus on target="_blank" (or not) for these external links. see #20839.
git-svn-id: http://core.svn.wordpress.org/trunk@24583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 13:04:07 +00:00
Sergey Biryukov
74638ccb5a Fix typos in phpdoc. props TheLastCicada. fixes #24302.
git-svn-id: http://core.svn.wordpress.org/trunk@24229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-10 01:39:30 +00:00
Andrew Nacin
afd9cbced9 Make Twenty Thirteen the default theme.
Has the added benefit of ensuring the WordPress Beta Tester plugin allows updates of Twenty Thirteen.

props JustinSainton.
fixes #23573.



git-svn-id: http://core.svn.wordpress.org/trunk@23529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-28 19:01:07 +00:00
Helen Hou-Sandí
1c816c795b Open external links to plugin homepages, plugin author homepages, and theme author homepages in a new window/tab. props SergeyBiryukov. fixes #20839.
git-svn-id: http://core.svn.wordpress.org/trunk@23394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-08 16:20:01 +00:00
Ryan Boren
54ac1d939b Make current_user_can_for_blog() safe to run single site.
Props nacin, MarkJaquith
fixes #22803


git-svn-id: http://core.svn.wordpress.org/trunk@23117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-07 09:53:27 +00:00
Andrew Nacin
5da775fe3b WP_Theme: If the parent theme is missing, instantiate a WP_Theme object anyway, so it can hold errors.
Fixes the installation of parent themes when installing a child theme from WordPress.org.

see #22515.



git-svn-id: http://core.svn.wordpress.org/trunk@22784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 18:58:19 +00:00
Andrew Nacin
582d46c937 Make Twenty Twelve the default theme for new installs. props markoheijnen, SergeyBiryukov. see #21789.
git-svn-id: http://core.svn.wordpress.org/trunk@22054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 07:47:51 +00:00
Andrew Nacin
e03640b121 URL encode the stylesheet directory values passed to WP_Theme's get_stylesheet_directory_uri() and get_template_directory_uri(). props SergeyBiryukov, see #21749.
git-svn-id: http://core.svn.wordpress.org/trunk@21712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-03 23:57:43 +00:00
Andrew Nacin
5f2f385087 Restore the 'allowed_themes' filter.
This filter has wrapped the network-wide themes, outside of the network-wide
allowed function (dating back to MU), hence the unusual placement. This restores
previous behavior; we will introduce new filters to enable greater flexibility.

see #21099.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@21686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 17:05:18 +00:00
Andrew Nacin
4d014c4f40 Fix WP_Theme's get_template_directory_uri() method. props batmoo. see #21549 for trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@21503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-14 18:38:26 +00:00
ryan
5ca54e7d2f Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option().
Use the regular option functions wrapped in switch_to_blog() and restore_current_blog() instead.

Group multiple operations within a single switch where possible.

fixes #21432


git-svn-id: http://core.svn.wordpress.org/trunk@21414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 17:51:42 +00:00
nacin
6c62701b8f Revert detection of page templates to 3.3 functionality.
WP_Theme in 3.4.0 used get_file_data(), which is far too strict when
compared to  the original regular expression in get_page_templates().
This causes missing templates when, for example, the PHP comment
starts on the same line as the header.

see #20955 for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@21117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-25 21:07:07 +00:00
westi
cd8c0e74ab Restore the 'extra_theme_headers' filter in the deprecated get_theme_data function so that plugins/themes using this function can still access their extra headers.
Fixes #20897 props nacin, georgestephanis, SergeyBiryukov.


git-svn-id: http://core.svn.wordpress.org/trunk@21050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-11 17:30:57 +00:00
nacin
9355ae1abe WP_Theme: If no 'Domain Path' header is specified, default to looking in the /languages directory. see #20103, see #20448.
git-svn-id: http://core.svn.wordpress.org/trunk@20945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-27 16:42:38 +00:00
ryan
8c114f0c54 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@20715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 16:41:59 +00:00
nacin
81861e8cf8 Don't try to translate tags in WP_Theme::translate_header() if we are not in the admin and get_theme_feature_list() isn't defined. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-01 18:02:40 +00:00
nacin
69e0af9e3c Remove support from WP_Theme for multiple screenshots until we bring it to the UI. fixes #20546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 17:40:43 +00:00
nacin
1e500bd76a Remove WP_Theme::is_child_theme() in favor of WP_Theme::parent(). see #20546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 17:34:19 +00:00
nacin
efcaf98c41 Make WP_Theme::get_files() a general method for retrieving any file types, at any depth, optionally to include parent files. see #20546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 17:31:39 +00:00
nacin
c1e2962573 Documentation and visibility cleanups in WP_Theme.
* Declare `__toString()` as public.
 * Use parent() and error() internally, rather than the properties.
 * Add and correct inline documentation throughout.
 * Attempt to clarify that display() is superior to get().
see #20546, see #20103.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 16:37:49 +00:00
nacin
bd7ad45234 Add arrays together in WP_Theme::get_allowed() to preserve keys (theme names could be numeric). props ocean90, fixes #15306.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 18:37:57 +00:00
nacin
aee5f09ca2 Child theme files need to override parent theme files. The array_merge() arguments are swapped. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 20:36:34 +00:00
nacin
70aa7f9607 Clear theme cache after editing. Reduce default cache persistence to 1800. (Could go lower.) see #20331.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-30 14:39:05 +00:00
nacin
9305155baf Set WP_Theme::scandir()'s default depth to 0 (flat), as intended. Cache untranslated page template names. Properly merge in a parent theme's templates when dealing with cached values. Always look one level deep for WP_Theme->get_files() regardless of file type. see #20103. see #11216.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-30 14:06:33 +00:00
nacin
07c5c0784e Correct docs for WP_Theme scandir(), _name_sort(), and _name_sort_i18n() methods. All of them are private. see #11216, #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 18:49:50 +00:00
nacin
7ddbabb3db Support page templates located in a subdirectory of the theme. fixes #11216.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 05:39:26 +00:00
nacin
7c8c385a3c Use new scandir() return value (key is path relative to theme, value is absolute path) in WP_Theme->get_page_templates(). Use parent()->get_page_templates() and merge in a parent's page templates, rather than extra logic. see [20312], see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 05:37:37 +00:00
nacin
02979900ea Correct the values for theme_root and stylesheet when the values passed to the WP_Theme constructor have a directory appended to the theme root when it should actually be prepended to the stylesheet (when the theme is in a directory of themes inside a theme root). see #20313.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 04:29:58 +00:00
nacin
5b8037afe6 Always set WP_Theme->template even when there is an error and we have no idea what the template is. (Assume it is the stylesheet.) Prevents a number of issues including WP_Theme->is_child_theme() lying. Tidy the theme editor for broken themes and themes with no templates (PHP files), or no template (parent), or are broken. Allow broken themes to be edited. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 04:16:17 +00:00
nacin
bb4cca4c55 Introduce WP_Theme->exists() to check if the queried theme actually exists. WP_Theme->exists() is a subset of errors() -- a theme with errors may still exist, but a theme that does not exist has an error of theme_not_found. wp_get_theme() now returns false if the theme does not exist. Improve scandir() and get_files() logic. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 02:59:48 +00:00
nacin
dc0d6805be Sanitize Theme URI and Author URI in WP_Theme with esc_url_raw. Escape with esc_url on display. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 14:51:10 +00:00
nacin
962fae26f4 Updates to WP_Theme, wp_get_themes(), and related deprecated functions, after [UT570] [UT578] [UT579]. see #20103.
* ['Template Files'] and ['Stylesheet Files'] need to return files from the parent theme as well.
 * Don't strip links from the Author header. Some themes rely on the previous behavior, such as to link multiple authors (Sandbox, for example.) Don't restore links to the Name, that's just a bad idea.
 * Ensure we are always passing around arrays in get_files/scandir.
 * Better inline doc for wp_get_themes() arguments.
 * Introduce a 'force' flag for search_theme_directories() to re-scan, rather than return the cache. We will use this to re-build the theme_roots transient in get_theme_roots(), but it is more helpful for unit tests. Since search_theme_directories() is cached, don't cache again in wp_get_themes(). (Again benefits testing.)
 * Handle duplicate theme names in the old get_themes() when two themes match (and neither are a default theme, which is already handled). wp_get_themes() will consider both names to be the same; this is just for back compat since get_themes() is keyed by name.
 * Include an old array key in wp_broken_themes().



git-svn-id: http://svn.automattic.com/wordpress/trunk@20193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 15:39:21 +00:00
nacin
24cbb5d9c6 Hash WP_Theme cache keys to ensure long file paths don't overflow in object backends. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-14 22:49:36 +00:00
nacin
feb1697b7a The default value of a theme's Status header is 'publish', not 'public'. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-14 13:37:49 +00:00