Commit Graph

151 Commits

Author SHA1 Message Date
Peter Wilson
21248ce3ab Posts, Post Types: Improve sanitisation of templates' post types.
Prevents post type templates ignoring post types due to invalid characters. Each entry in the `Template Post Type` comment is run through `sanitize_key()` to match the sanitisation used by `register_post_type()`.

Fixes #38766.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 03:37:31 +00:00
Pascal Birchler
2f7f8d526b Posts, Post Types: Fix post type templates with child themes.
After [38951] added support for post type templates beyond pages, this fixes an issue where an empty meta box would be shown when using child themes.

Fixes #38696.
Built from https://develop.svn.wordpress.org/trunk@39168


git-svn-id: http://core.svn.wordpress.org/trunk@39108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 22:41:30 +00:00
Pascal Birchler
81a26f6900 Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages.
While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types.

By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility.

In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`.
When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type.

Props johnbillion, Mte90, dipesh.kakadiya, swissspidy.
Fixes #18375.
Built from https://develop.svn.wordpress.org/trunk@38951


git-svn-id: http://core.svn.wordpress.org/trunk@38894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 08:07:30 +00:00
Gary Pendergast
0e0af249be Themes: Twenty Seventeen is now the default theme.
It's party time!

Fixes #38372.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-20 09:13:29 +00:00
Pascal Birchler
4a88d55054 I18N: Introduce a user-specific language setting.
By enabling the user to select their preferred locale when editing the profile, we allow for greater personalization of the WordPress admin and therefore a better user experience.

The back end will be displayed in the user's individual locale while the locale used on the front end equals the one set for the whole site. If the user didn't specify a locale, the site's locale will be used as a fallback. The new `locale` property of the `WP_User` class can be used to retrieve the user's locale setting.

Props ocean90, ipm-frommen, swissspidy.
Fixes #29783.
Built from https://develop.svn.wordpress.org/trunk@38705


git-svn-id: http://core.svn.wordpress.org/trunk@38648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-03 07:04:29 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Dominik Schilling
720106e16d Themes: After [37287], add deprecated theme features to the tag list in WP_Theme::translate_header().
Themes which are not yet updated can still have the old tags. This makes sure that these tags are still translated.

See #33407.
Built from https://develop.svn.wordpress.org/trunk@37946


git-svn-id: http://core.svn.wordpress.org/trunk@37887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-04 09:58:28 +00:00
Drew Jaynes
fb6d8bae49 Docs: Apply inline @see tags to hooks referenced in DocBlocks for core classes.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:54:27 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Drew Jaynes
664bb85f1b Docs: Add backtick escaping for two inline code samples in docs.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-01 17:32:26 +00:00
Jeremy Felt
6279ca91de Multisite: Introduce WP_Theme methods to network enable/disable themes.
* `WP_Theme::network_enable_theme()` can be used to enable a theme or array of themes on a network.
* `WP_Theme::network_disable_theme()` can be used to disable a theme or array of themes on a network.
* Use these new methods in the network admin vs direct `update_site_option()` calls.
* Add tests.

Props igmoweb.
Fixes #30594.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-14 03:40:27 +00:00
Drew Jaynes
3f3659cd80 Docs: Fix two typos in return descriptions for WP_Theme private usort() methods.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:23:26 +00:00
Drew Jaynes
24a301e06e Docs: Add missing parameter and return notations in the DocBlock for WP_Theme::_name_sort_i18n(), a private usort() helper.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:21:25 +00:00
Drew Jaynes
3851bc0c56 Docs: Add missing parameter and return notations in the DocBlock for WP_Theme::_name_sort(), a private usort() helper.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:19:25 +00:00
Drew Jaynes
22ad478325 Docs: Add a missing description for the &$themes parameter in the DocBlock for WP_Theme::sort_by_name().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:12:26 +00:00
Drew Jaynes
c8b530f088 Docs: Add missing parameter and return descriptions to the DocBlock for WP_Theme::__isset().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:04:27 +00:00
Pascal Birchler
81e9462ca3 Themes: Improve error messages for broken themes.
Props mayukojpn for initial patch.
Fixes #35286.
Built from https://develop.svn.wordpress.org/trunk@36638


git-svn-id: http://core.svn.wordpress.org/trunk@36605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 17:20:27 +00:00
Eric Lewis
22467e840f Networks and sites: Replace "blog" usage with "site" in docs.
Multisite functions use the term "blog" to refer to what we now call a "site," e.g. `get_current_blog_id()`. These functions are here to stay because of our commitment to backwards compatibility. What we can do is set the documentation straight.

See #35417.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-28 03:35:27 +00:00
Jeremy Felt
3018d9827c Themes: Enhance filtering options for allowed themes on a network.
* Move the legacy `allowed_themes` filter to `WP_Theme::get_allowed_on_network()`, where it will continue to filter themes allowed on the network.
* Add `network_allowed_themes` filter to `WP_Theme::get_allowed()` and pass `$blog_id` to provide context.
* Add `site_allowed_themes` filter to `WP_Theme::get_allowed_on_site()` and pass `$blog_id` to provide context.

Props pauldewouters, lamosty, michalzuber, dmsnell, johnnypea, rob.
Fixes #28436.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-20 18:29:27 +00:00
John Blackbourn
a4facedfee Docs: Various docblock corrections.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-10 01:26:25 +00:00
Aaron Jorbin
7ab65139c6 Theme: Escape error messages
Built from https://develop.svn.wordpress.org/trunk@36185


git-svn-id: http://core.svn.wordpress.org/trunk@36152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-06 17:23:28 +00:00
Scott Taylor
79a2915a9b Upgrade: New themes are not automatically installed on upgrade. This can still be explicitly asked for by defining CORE_UPGRADE_SKIP_NEW_BUNDLED as false.
In `populate_options()`, if the theme specified by `WP_DEFAULT_THEME` doesn't exist, fall back to the latest core default theme. If we can't find a core default theme, `WP_DEFAULT_THEME` is the best we can do. 

Props nacin, jeremyfelt, dd32.
See #34306.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-25 21:45:25 +00:00
Drew Jaynes
1b1e18027d Template: Make it possible to both ''add'' and ''remove'' items from the page templates list using the theme_page_templates filter.
The `theme_page_templates` hook was originally added in [27297] as `page_templates`, and later renamed in [27470]. Previously, it was only possible to remove or rename page templates via this hook.

Fixes #13265. Fixes #25879.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-09 21:51:25 +00:00
Jeremy Felt
9926983b66 Revert [34778], continue using _site_option() for the current network.
The `_network_option()` parameter order will be changing to accept `$network_id` first. The `_site_option()` functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 17:11:25 +00:00
Jeremy Felt
54512d64cb MS: Use *_network_option() functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:08:26 +00:00
Drew Jaynes
4a69b4d275 Docs: Fix some syntactical issues with the DocBlock for the WP_Theme->update property, introduced in [33957].
Adds an `@since`.

See #33491. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 13:29:25 +00:00
Scott Taylor
5e9e1d14bd WP_Theme has an ad hoc property in WP_MS_Themes_List_Table, $update. This can be set to a default value on the class, as it's not obtained via __get().
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-09 01:02:24 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor
bd8fafea54 Use void instead of null where appropriate when pipe-delimiting @return types. If a @return only contains void, remove it.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor
ecf4c668b3 Upgrade the doc blocks in class-wp-xmlrpc-server.php. Rehabilitate some unfortunate use of tabbing.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 19:37:24 +00:00
Scott Taylor
1b960d56b6 Add missing doc blocks to class-wp-theme.php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 17:31:27 +00:00
Drew Jaynes
b2e442c247 Add a missing @return tag and description to the DocBlock for WP_Theme::scandir().
Props lamosty.
Fixes #31872.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 00:34:25 +00:00
Drew Jaynes
261e461f9d Properly document WP_Theme::scandir() as a static method, adjust parameter documentation for formatting and clarity.
See #31872.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 00:33:26 +00:00
Gary Pendergast
e2d3bdf615 Correctly escape theme version numbers when displaying them.
Props collinsinternet.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-20 06:27:25 +00:00
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
nacin
ead3f2f435 Pass WP_Theme->get_theme_root_uri() to get_theme_root_uri(), thereby always triggering the theme_root_uri filter. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 18:18:10 +00:00
nacin
2a6b9ea6db The allowed_themes rolling upgrade for individual sites should not add empty allowedthemes arrays. If there are no allowed themes, don't add an empty option. Move the network rolling upgrade to upgrade_network(). see #20146.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 03:22:39 +00:00
nacin
e59777059b On display, replace an empty Theme Name with the theme's directory. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-07 23:56:35 +00:00
nacin
6d7522917d Only update the old allowed_themes network option from the main site admin or in the network admin. see #20103, #20146.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-07 23:39:56 +00:00
nacin
4029d120a2 Provide back compat for allowed_themes option keys, which were from the early days of WordPress MU. see #20103. Curses.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-07 23:32:06 +00:00
nacin
19b1746cc6 Fetch the raw 'Template' header in the WP_Theme constructor. By passing sanitization routines (which are unnecessary for this header), we prevent a persistent themes cache from sanitizing the headers of every theme until/unless they actually need a real header like Name. Note that if WP_Theme was instantiated through get_themes(), this will have no effect, as get_themes() does ask for Name for the keys to return. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-07 00:24:23 +00:00
nacin
820ebbab9e Fix variable collision in WP_Theme->get() that rears its head when the themes bucket is cached persistently. Also correct the inline doc. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-06 22:28:53 +00:00
nacin
08a7de8ab1 Default themes always trump their pretenders. Even though we are no longer keying by name, it is not a good experience to see multiple 'WordPress Default' themes when one was copied and had the directory renamed. This also keeps with the behavior of get_themes() (and the deprecated return value). see #20103.
Allow a default theme within a directory of wp-content/themes (e.g. 'somedir/twentyeleven') to be identified as a default theme.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-06 01:59:50 +00:00
nacin
1b84ec82cb Provide back compat for $theme->$var where $theme was an array from get_themes() but cast to an object, as had occurred in get_theme_updaes(). see #20173. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-04 12:58:41 +00:00
nacin
c973568e76 Allow get_screenshots() to return absolute URLs. Make this the default; relative can be achieved with 'relative' as the argument. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-04 01:16:32 +00:00
nacin
a48a695ba7 Use correct variable; return correct value for get_screenshot() when value is uncached. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:46:41 +00:00
nacin
8570f2dcd2 Remove debug cruft. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:41:01 +00:00
nacin
8ba92a52f8 Have WP_Theme::get_screenshot() default to an absolute URI. Allow 'relative' to be requested. see #20103, see #19816.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:31:56 +00:00
nacin
0dc52c8043 Translate page template names! Have WP_Theme::get_page_templates() return templates keyed by filename, not by template name, as it makes more sense. Flip this in get_page_templates() to be compatible. fixes #6007.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:18:53 +00:00
nacin
bf97881f98 (string) WP_Theme is now the theme name, translated. Good replacement for get_current_theme(); better than wp_get_theme()->display('Name'). see #20103, see #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 19:27:54 +00:00