Commit Graph

48 Commits

Author SHA1 Message Date
Andrew Nacin 94a0410530 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: https://develop.svn.wordpress.org/trunk@23529 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-28 19:01:07 +00:00
Helen Hou-Sandi efda431bc2 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: https://develop.svn.wordpress.org/trunk@23394 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-08 16:20:01 +00:00
Ryan Boren 9575d68a6a Make current_user_can_for_blog() safe to run single site.
Props nacin, MarkJaquith
fixes #22803


git-svn-id: https://develop.svn.wordpress.org/trunk@23117 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-07 09:53:27 +00:00
Andrew Nacin cb17ed8006 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: https://develop.svn.wordpress.org/trunk@22784 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-21 18:58:19 +00:00
Andrew Nacin 6a54459a18 Make Twenty Twelve the default theme for new installs. props markoheijnen, SergeyBiryukov. see #21789.
git-svn-id: https://develop.svn.wordpress.org/trunk@22054 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 07:47:51 +00:00
Andrew Nacin 80f60bd348 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: https://develop.svn.wordpress.org/trunk@21712 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-03 23:57:43 +00:00
Andrew Nacin cb60d4a2fa 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: https://develop.svn.wordpress.org/trunk@21686 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 17:05:18 +00:00
Andrew Nacin 665ad96636 Fix WP_Theme's get_template_directory_uri() method. props batmoo. see #21549 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@21503 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-14 18:38:26 +00:00
Ryan Boren ce960f67a0 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: https://develop.svn.wordpress.org/trunk@21414 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 17:51:42 +00:00
Andrew Nacin 4d33587bdc 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: https://develop.svn.wordpress.org/trunk@21117 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-25 21:07:07 +00:00
Peter Westwood 0ec0c40c0a 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: https://develop.svn.wordpress.org/trunk@21050 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-11 17:30:57 +00:00
Andrew Nacin 165e855510 WP_Theme: If no 'Domain Path' header is specified, default to looking in the /languages directory. see #20103, see #20448.
git-svn-id: https://develop.svn.wordpress.org/trunk@20945 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-27 16:42:38 +00:00
Ryan Boren 8c50f982ea Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@20715 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-03 16:41:59 +00:00
Andrew Nacin 5fd3048d0a 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: https://develop.svn.wordpress.org/trunk@20668 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-01 18:02:40 +00:00
Andrew Nacin fca5a81af2 Remove support from WP_Theme for multiple screenshots until we bring it to the UI. fixes #20546.
git-svn-id: https://develop.svn.wordpress.org/trunk@20590 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-25 17:40:43 +00:00
Andrew Nacin b7101b038f Remove WP_Theme::is_child_theme() in favor of WP_Theme::parent(). see #20546.
git-svn-id: https://develop.svn.wordpress.org/trunk@20589 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-25 17:34:19 +00:00
Andrew Nacin ac64d57b03 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: https://develop.svn.wordpress.org/trunk@20588 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-25 17:31:39 +00:00
Andrew Nacin 1b233e27af 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: https://develop.svn.wordpress.org/trunk@20586 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-25 16:37:49 +00:00
Andrew Nacin aa450a1d3a Add arrays together in WP_Theme::get_allowed() to preserve keys (theme names could be numeric). props ocean90, fixes #15306.
git-svn-id: https://develop.svn.wordpress.org/trunk@20481 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-16 18:37:57 +00:00
Andrew Nacin 596c72cafa Child theme files need to override parent theme files. The array_merge() arguments are swapped. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20374 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-05 20:36:34 +00:00
Andrew Nacin 09f946105d Clear theme cache after editing. Reduce default cache persistence to 1800. (Could go lower.) see #20331.
git-svn-id: https://develop.svn.wordpress.org/trunk@20328 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-30 14:39:05 +00:00
Andrew Nacin e9c7faff7c 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: https://develop.svn.wordpress.org/trunk@20327 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-30 14:06:33 +00:00
Andrew Nacin a5585e4b61 Correct docs for WP_Theme scandir(), _name_sort(), and _name_sort_i18n() methods. All of them are private. see #11216, #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20324 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 18:49:50 +00:00
Andrew Nacin f73f48301c Support page templates located in a subdirectory of the theme. fixes #11216.
git-svn-id: https://develop.svn.wordpress.org/trunk@20318 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 05:39:26 +00:00
Andrew Nacin 78d11eedea 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: https://develop.svn.wordpress.org/trunk@20317 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 05:37:37 +00:00
Andrew Nacin 822e0eda46 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: https://develop.svn.wordpress.org/trunk@20316 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 04:29:58 +00:00
Andrew Nacin 50346e7955 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: https://develop.svn.wordpress.org/trunk@20315 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 04:16:17 +00:00
Andrew Nacin ef6be74a33 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: https://develop.svn.wordpress.org/trunk@20312 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-29 02:59:48 +00:00
Andrew Nacin cfb4179f87 Sanitize Theme URI and Author URI in WP_Theme with esc_url_raw. Escape with esc_url on display. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20233 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-21 14:51:10 +00:00
Andrew Nacin e71167bbee 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: https://develop.svn.wordpress.org/trunk@20193 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-15 15:39:21 +00:00
Andrew Nacin fe96ac4e95 Hash WP_Theme cache keys to ensure long file paths don't overflow in object backends. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20176 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-14 22:49:36 +00:00
Andrew Nacin ae895a30c9 The default value of a theme's Status header is 'publish', not 'public'. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20173 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-14 13:37:49 +00:00
Andrew Nacin 9a484c5f35 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: https://develop.svn.wordpress.org/trunk@20162 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-08 18:18:10 +00:00
Andrew Nacin f9d7952855 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: https://develop.svn.wordpress.org/trunk@20148 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-08 03:22:39 +00:00
Andrew Nacin 22eed35901 On display, replace an empty Theme Name with the theme's directory. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20146 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-07 23:56:35 +00:00
Andrew Nacin f7bd4afbeb Only update the old allowed_themes network option from the main site admin or in the network admin. see #20103, #20146.
git-svn-id: https://develop.svn.wordpress.org/trunk@20145 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-07 23:39:56 +00:00
Andrew Nacin 68bc832f61 Provide back compat for allowed_themes option keys, which were from the early days of WordPress MU. see #20103. Curses.
git-svn-id: https://develop.svn.wordpress.org/trunk@20144 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-07 23:32:06 +00:00
Andrew Nacin 3f11180883 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: https://develop.svn.wordpress.org/trunk@20132 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-07 00:24:23 +00:00
Andrew Nacin e711e72c40 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: https://develop.svn.wordpress.org/trunk@20126 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-06 22:28:53 +00:00
Andrew Nacin 8d389bac17 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: https://develop.svn.wordpress.org/trunk@20119 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-06 01:59:50 +00:00
Andrew Nacin 37fe51da66 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: https://develop.svn.wordpress.org/trunk@20112 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-04 12:58:41 +00:00
Andrew Nacin 3ec423dc93 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: https://develop.svn.wordpress.org/trunk@20105 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-04 01:16:32 +00:00
Andrew Nacin 5bab3555d7 Use correct variable; return correct value for get_screenshot() when value is uncached. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20045 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-29 20:46:41 +00:00
Andrew Nacin f6299042c0 Remove debug cruft. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20044 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-29 20:41:01 +00:00
Andrew Nacin 47db4344b9 Have WP_Theme::get_screenshot() default to an absolute URI. Allow 'relative' to be requested. see #20103, see #19816.
git-svn-id: https://develop.svn.wordpress.org/trunk@20043 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-29 20:31:56 +00:00
Andrew Nacin cdaee9042d 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: https://develop.svn.wordpress.org/trunk@20041 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-29 20:18:53 +00:00
Andrew Nacin 43913e382c (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: https://develop.svn.wordpress.org/trunk@20039 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-29 19:27:54 +00:00
Andrew Nacin 53a209a4ee Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
 * Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
 * Error Handling: Broken themes have a WP_Error object attached to them.
 * Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
 * Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
 * i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
 * PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.

Functions deprecated:
 * get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
 * get_theme() and current_theme_info() -- use wp_get_theme()
 * get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
 * wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()

see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.

see #20103.



git-svn-id: https://develop.svn.wordpress.org/trunk@20029 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-28 21:24:44 +00:00