/var/www/wordpress/wp-admin/includes/admin.php
/var/www/wordpress/wp-admin/includes/bookmark.php
/var/www/wordpress/wp-admin/includes/class-ftp-pure.php
/var/www/wordpress/wp-admin/includes/class-ftp-sockets.php
/var/www/wordpress/wp-admin/includes/class-ftp.php
/var/www/wordpress/wp-admin/includes/class-pclzip.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-base.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
/var/www/wordpress/wp-admin/includes/class-wp-importer.php
/var/www/wordpress/wp-admin/includes/class-wp-upgrader.php
/var/www/wordpress/wp-admin/includes/comment.php
/var/www/wordpress/wp-admin/includes/continents-cities.php
/var/www/wordpress/wp-admin/includes/dashboard.php
/var/www/wordpress/wp-admin/includes/deprecated.php
/var/www/wordpress/wp-admin/includes/export.php
/var/www/wordpress/wp-admin/includes/file.php
/var/www/wordpress/wp-admin/includes/image-edit.php
/var/www/wordpress/wp-admin/includes/image.php
/var/www/wordpress/wp-admin/includes/import.php
/var/www/wordpress/wp-admin/includes/manifest.php
/var/www/wordpress/wp-admin/includes/media.php
/var/www/wordpress/wp-admin/includes/meta-boxes.php
/var/www/wordpress/wp-admin/includes/misc.php
/var/www/wordpress/wp-admin/includes/ms-deprecated.php
/var/www/wordpress/wp-admin/includes/ms.php
/var/www/wordpress/wp-admin/includes/nav-menu.php
/var/www/wordpress/wp-admin/includes/plugin-install.php
/var/www/wordpress/wp-admin/includes/plugin.php
/var/www/wordpress/wp-admin/includes/post.php
/var/www/wordpress/wp-admin/includes/schema.php
/var/www/wordpress/wp-admin/includes/taxonomy.php
/var/www/wordpress/wp-admin/includes/template.php
/var/www/wordpress/wp-admin/includes/theme-install.php
/var/www/wordpress/wp-admin/includes/theme.php
/var/www/wordpress/wp-admin/includes/update-core.php
/var/www/wordpress/wp-admin/includes/update.php
/var/www/wordpress/wp-admin/includes/upgrade.php
/var/www/wordpress/wp-admin/includes/user.php
/var/www/wordpress/wp-admin/includes/widgets.php
/var/www/wordpress/wp-admin/js/revisions-js.php
/var/www/wordpress/wp-admin/maint/repair.php
/var/www/wordpress/wp-admin/admin-ajax.php
/var/www/wordpress/wp-admin/admin-footer.php
/var/www/wordpress/wp-admin/admin-functions.php
/var/www/wordpress/wp-admin/admin-header.php
/var/www/wordpress/wp-admin/admin-post.php
/var/www/wordpress/wp-admin/admin.php
/var/www/wordpress/wp-admin/async-upload.php
/var/www/wordpress/wp-admin/comment.php
/var/www/wordpress/wp-admin/custom-background.php
/var/www/wordpress/wp-admin/custom-header.php
/var/www/wordpress/wp-admin/edit-attachment-rows.php
/var/www/wordpress/wp-admin/edit-comments.php
/var/www/wordpress/wp-admin/edit-form-advanced.php
/var/www/wordpress/wp-admin/edit-form-comment.php
/var/www/wordpress/wp-admin/edit-link-categories.php
/var/www/wordpress/wp-admin/edit-link-category-form.php
/var/www/wordpress/wp-admin/edit-link-form.php
/var/www/wordpress/wp-admin/edit-post-rows.php
/var/www/wordpress/wp-admin/edit-tag-form.php
/var/www/wordpress/wp-admin/edit-tags.php
/var/www/wordpress/wp-admin/edit.php
/var/www/wordpress/wp-admin/export.php
/var/www/wordpress/wp-admin/gears-manifest.php
/var/www/wordpress/wp-admin/import.php
/var/www/wordpress/wp-admin/index-extra.php
/var/www/wordpress/wp-admin/index.php
/var/www/wordpress/wp-admin/install-helper.php
/var/www/wordpress/wp-admin/install.php
/var/www/wordpress/wp-admin/link-add.php
/var/www/wordpress/wp-admin/link-category.php
/var/www/wordpress/wp-admin/link-manager.php
/var/www/wordpress/wp-admin/link-parse-opml.php
/var/www/wordpress/wp-admin/link.php
/var/www/wordpress/wp-admin/load-scripts.php
/var/www/wordpress/wp-admin/load-styles.php
/var/www/wordpress/wp-admin/media-new.php
/var/www/wordpress/wp-admin/media-upload.php
/var/www/wordpress/wp-admin/media.php
/var/www/wordpress/wp-admin/menu-header.php
/var/www/wordpress/wp-admin/menu.php
/var/www/wordpress/wp-admin/moderation.php
/var/www/wordpress/wp-admin/ms-admin.php
/var/www/wordpress/wp-admin/ms-delete-site.php
/var/www/wordpress/wp-admin/ms-edit.php
/var/www/wordpress/wp-admin/ms-options.php
/var/www/wordpress/wp-admin/ms-sites.php
/var/www/wordpress/wp-admin/ms-themes.php
/var/www/wordpress/wp-admin/ms-upgrade-network.php
/var/www/wordpress/wp-admin/ms-users.php
/var/www/wordpress/wp-admin/my-sites.php
/var/www/wordpress/wp-admin/nav-menus.php
/var/www/wordpress/wp-admin/network.php
/var/www/wordpress/wp-admin/options-discussion.php
/var/www/wordpress/wp-admin/options-general.php
/var/www/wordpress/wp-admin/options-head.php
/var/www/wordpress/wp-admin/options-media.php
/var/www/wordpress/wp-admin/options-permalink.php
/var/www/wordpress/wp-admin/options-privacy.php
/var/www/wordpress/wp-admin/options-reading.php
/var/www/wordpress/wp-admin/options-writing.php
/var/www/wordpress/wp-admin/options.php
/var/www/wordpress/wp-admin/plugin-editor.php
/var/www/wordpress/wp-admin/plugin-install.php
/var/www/wordpress/wp-admin/plugins.php
/var/www/wordpress/wp-admin/post-new.php
/var/www/wordpress/wp-admin/post.php
/var/www/wordpress/wp-admin/press-this.php
/var/www/wordpress/wp-admin/profile.php
/var/www/wordpress/wp-admin/revision.php
/var/www/wordpress/wp-admin/setup-config.php
/var/www/wordpress/wp-admin/sidebar.php
/var/www/wordpress/wp-admin/theme-editor.php
/var/www/wordpress/wp-admin/theme-install.php
/var/www/wordpress/wp-admin/themes.php
/var/www/wordpress/wp-admin/tools.php
/var/www/wordpress/wp-admin/update-core.php
/var/www/wordpress/wp-admin/update.php
/var/www/wordpress/wp-admin/upgrade-functions.php
/var/www/wordpress/wp-admin/upgrade.php
/var/www/wordpress/wp-admin/upload.php
/var/www/wordpress/wp-admin/user-edit.php
/var/www/wordpress/wp-admin/user-new.php
/var/www/wordpress/wp-admin/users.php
/var/www/wordpress/wp-admin/widgets.php
/var/www/wordpress/wp-content/languages/ru_RU.php
/var/www/wordpress/wp-content/plugins/akismet/akismet.php
/var/www/wordpress/wp-content/plugins/rh/rh.php
/var/www/wordpress/wp-content/plugins/hello.php
/var/www/wordpress/wp-content/plugins/index.php
/var/www/wordpress/wp-content/themes/twentyten/404.php
/var/www/wordpress/wp-content/themes/twentyten/archive.php
/var/www/wordpress/wp-content/themes/twentyten/attachment.php
/var/www/wordpress/wp-content/themes/twentyten/author.php
/var/www/wordpress/wp-content/themes/twentyten/category.php
/var/www/wordpress/wp-content/themes/twentyten/comments.php
/var/www/wordpress/wp-content/themes/twentyten/footer.php
/var/www/wordpress/wp-content/themes/twentyten/functions.php
/var/www/wordpress/wp-content/themes/twentyten/header.php
/var/www/wordpress/wp-content/themes/twentyten/index.php
/var/www/wordpress/wp-content/themes/twentyten/loop.php
/var/www/wordpress/wp-content/themes/twentyten/onecolumn-page.php
/var/www/wordpress/wp-content/themes/twentyten/page.php
/var/www/wordpress/wp-content/themes/twentyten/search.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar-footer.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar.php
/var/www/wordpress/wp-content/themes/twentyten/single.php
/var/www/wordpress/wp-content/themes/twentyten/tag.php
/var/www/wordpress/wp-content/themes/index.php
/var/www/wordpress/wp-content/index.php
/var/www/wordpress/wp-includes/js/tinymce/langs/wp-langs.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
/var/www/wordpress/wp-includes/js/tinymce/wp-mce-help.php
/var/www/wordpress/wp-includes/js/tinymce/wp-tinymce.php
/var/www/wordpress/wp-includes/pomo/entry.php
/var/www/wordpress/wp-includes/pomo/mo.php
/var/www/wordpress/wp-includes/pomo/po.php
/var/www/wordpress/wp-includes/pomo/streams.php
/var/www/wordpress/wp-includes/pomo/translations.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/native.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/shell.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/string.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/xdiff.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer/inline.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer.php
/var/www/wordpress/wp-includes/Text/Diff.php
/var/www/wordpress/wp-includes/theme-compat/comments-popup.php
/var/www/wordpress/wp-includes/theme-compat/comments.php
/var/www/wordpress/wp-includes/theme-compat/footer.php
/var/www/wordpress/wp-includes/theme-compat/header.php
/var/www/wordpress/wp-includes/theme-compat/sidebar.php
/var/www/wordpress/wp-includes/atomlib.php
/var/www/wordpress/wp-includes/author-template.php
/var/www/wordpress/wp-includes/bookmark-template.php
/var/www/wordpress/wp-includes/bookmark.php
/var/www/wordpress/wp-includes/cache.php
/var/www/wordpress/wp-includes/canonical.php
/var/www/wordpress/wp-includes/capabilities.php
/var/www/wordpress/wp-includes/category-template.php
/var/www/wordpress/wp-includes/category.php
/var/www/wordpress/wp-includes/class-feed.php
/var/www/wordpress/wp-includes/class-http.php
/var/www/wordpress/wp-includes/class-IXR.php
/var/www/wordpress/wp-includes/class-json.php
/var/www/wordpress/wp-includes/class-oembed.php
/var/www/wordpress/wp-includes/class-phpass.php
/var/www/wordpress/wp-includes/class-phpmailer.php
/var/www/wordpress/wp-includes/class-pop3.php
/var/www/wordpress/wp-includes/class-simplepie.php
/var/www/wordpress/wp-includes/class-smtp.php
/var/www/wordpress/wp-includes/class-snoopy.php
/var/www/wordpress/wp-includes/class.wp-dependencies.php
/var/www/wordpress/wp-includes/class.wp-scripts.php
/var/www/wordpress/wp-includes/class.wp-styles.php
/var/www/wordpress/wp-includes/classes.php
/var/www/wordpress/wp-includes/comment-template.php
/var/www/wordpress/wp-includes/comment.php
/var/www/wordpress/wp-includes/compat.php
/var/www/wordpress/wp-includes/cron.php
/var/www/wordpress/wp-includes/default-constants.php
/var/www/wordpress/wp-includes/default-embeds.php
/var/www/wordpress/wp-includes/default-filters.php
/var/www/wordpress/wp-includes/default-widgets.php
/var/www/wordpress/wp-includes/deprecated.php
/var/www/wordpress/wp-includes/feed-atom-comments.php
/var/www/wordpress/wp-includes/feed-atom.php
/var/www/wordpress/wp-includes/feed-rdf.php
/var/www/wordpress/wp-includes/feed-rss.php
/var/www/wordpress/wp-includes/feed-rss2-comments.php
/var/www/wordpress/wp-includes/feed-rss2.php
/var/www/wordpress/wp-includes/feed.php
/var/www/wordpress/wp-includes/formatting.php
/var/www/wordpress/wp-includes/functions.php
/var/www/wordpress/wp-includes/functions.wp-scripts.php
/var/www/wordpress/wp-includes/functions.wp-styles.php
/var/www/wordpress/wp-includes/general-template.php
/var/www/wordpress/wp-includes/http.php
/var/www/wordpress/wp-includes/kses.php
/var/www/wordpress/wp-includes/l10n.php
/var/www/wordpress/wp-includes/link-template.php
/var/www/wordpress/wp-includes/load.php
/var/www/wordpress/wp-includes/locale.php
/var/www/wordpress/wp-includes/media.php
/var/www/wordpress/wp-includes/meta.php
/var/www/wordpress/wp-includes/ms-blogs.php
/var/www/wordpress/wp-includes/ms-default-constants.php
/var/www/wordpress/wp-includes/ms-default-filters.php
/var/www/wordpress/wp-includes/ms-deprecated.php
/var/www/wordpress/wp-includes/ms-files.php
/var/www/wordpress/wp-includes/ms-functions.php
/var/www/wordpress/wp-includes/ms-load.php
/var/www/wordpress/wp-includes/ms-settings.php
/var/www/wordpress/wp-includes/nav-menu-template.php
/var/www/wordpress/wp-includes/nav-menu.php
/var/www/wordpress/wp-includes/pluggable-deprecated.php
/var/www/wordpress/wp-includes/pluggable.php
/var/www/wordpress/wp-includes/plugin.php
/var/www/wordpress/wp-includes/post-template.php
/var/www/wordpress/wp-includes/post-thumbnail-template.php
/var/www/wordpress/wp-includes/post.php
/var/www/wordpress/wp-includes/query.php
/var/www/wordpress/wp-includes/registration-functions.php
/var/www/wordpress/wp-includes/registration.php
/var/www/wordpress/wp-includes/rewrite.php
/var/www/wordpress/wp-includes/rss-functions.php
/var/www/wordpress/wp-includes/rss.php
/var/www/wordpress/wp-includes/script-loader.php
/var/www/wordpress/wp-includes/shortcodes.php
/var/www/wordpress/wp-includes/taxonomy.php
/var/www/wordpress/wp-includes/template-loader.php
/var/www/wordpress/wp-includes/theme.php
#CodeDescriptions
1<?php
2/**
3 * Theme, template, and stylesheet functions.
4 *
5 * @package WordPress
6 * @subpackage Template
7 */
8
9/**
10 * Whether a child theme is in use.
11 *
12 * @since 3.0.0
13 *
14 * @return bool true if a child theme is in use, false otherwise.
15 **/
16function is_child_theme() {
17 return ( TEMPLATEPATH !== STYLESHEETPATH );
18}
19
20/**
21 * Retrieve name of the current stylesheet.
22 *
23 * The theme name that the administrator has currently set the front end theme
24 * as.
25 *
26 * For all extensive purposes, the template name and the stylesheet name are
27 * going to be the same for most cases.
28 *
29 * @since 1.5.0
30 * @uses apply_filters() Calls 'stylesheet' filter on stylesheet name.
31 *
32 * @return string Stylesheet name.
33 */
34function get_stylesheet() {
35 return apply_filters('stylesheet', get_option('stylesheet'));
36}
37
38/**
39 * Retrieve stylesheet directory path for current theme.
40 *
41 * @since 1.5.0
42 * @uses apply_filters() Calls 'stylesheet_directory' filter on stylesheet directory and theme name.
43 *
44 * @return string Path to current theme directory.
45 */
46function get_stylesheet_directory() {
47 $stylesheet = get_stylesheet();
48 $theme_root = get_theme_root( $stylesheet );
49 $stylesheet_dir = "$theme_root/$stylesheet";
50
51 return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
52}
53
54/**
55 * Retrieve stylesheet directory URI.
56 *
57 * @since 1.5.0
58 *
59 * @return string
60 */
61function get_stylesheet_directory_uri() {
62 $stylesheet = get_stylesheet();
63 $theme_root_uri = get_theme_root_uri( $stylesheet );
64 $stylesheet_dir_uri = "$theme_root_uri/$stylesheet";
65
66 return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri );
67}
68
69/**
70 * Retrieve URI of current theme stylesheet.
71 *
72 * The stylesheet file name is 'style.css' which is appended to {@link
73 * get_stylesheet_directory_uri() stylesheet directory URI} path.
74 *
75 * @since 1.5.0
76 * @uses apply_filters() Calls 'stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
77 *
78 * @return string
79 */
80function get_stylesheet_uri() {
81 $stylesheet_dir_uri = get_stylesheet_directory_uri();
82 $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
83 return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
84}
85
86/**
87 * Retrieve localized stylesheet URI.
88 *
89 * The stylesheet directory for the localized stylesheet files are located, by
90 * default, in the base theme directory. The name of the locale file will be the
91 * locale followed by '.css'. If that does not exist, then the text direction
92 * stylesheet will be checked for existence, for example 'ltr.css'.
93 *
94 * The theme may change the location of the stylesheet directory by either using
95 * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
96 * If you want to change the location of the stylesheet files for the entire
97 * WordPress workflow, then change the former. If you just have the locale in a
98 * separate folder, then change the latter.
99 *
100 * @since 2.1.0
101 * @uses apply_filters() Calls 'locale_stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
102 *
103 * @return string
104 */
105function get_locale_stylesheet_uri() {
106 global $wp_locale;
107 $stylesheet_dir_uri = get_stylesheet_directory_uri();
108 $dir = get_stylesheet_directory();
109 $locale = get_locale();
110 if ( file_exists("$dir/$locale.css") )
111 $stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
112 elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") )
113 $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
114 else
115 $stylesheet_uri = '';
116 return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
117}
118
119/**
120 * Retrieve name of the current theme.
121 *
122 * @since 1.5.0
123 * @uses apply_filters() Calls 'template' filter on template option.
124 *
125 * @return string Template name.
126 */
127function get_template() {
128 return apply_filters('template', get_option('template'));
129}
130
131/**
132 * Retrieve current theme directory.
133 *
134 * @since 1.5.0
135 * @uses apply_filters() Calls 'template_directory' filter on template directory path and template name.
136 *
137 * @return string Template directory path.
138 */
139function get_template_directory() {
140 $template = get_template();
141 $theme_root = get_theme_root( $template );
142 $template_dir = "$theme_root/$template";
143
144 return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
145}
146
147/**
148 * Retrieve theme directory URI.
149 *
150 * @since 1.5.0
151 * @uses apply_filters() Calls 'template_directory_uri' filter on template directory URI path and template name.
152 *
153 * @return string Template directory URI.
154 */
155function get_template_directory_uri() {
156 $template = get_template();
157 $theme_root_uri = get_theme_root_uri( $template );
158 $template_dir_uri = "$theme_root_uri/$template";
159
160 return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
161}
162
163/**
164 * Retrieve theme data from parsed theme file.
165 *
166 * The description will have the tags filtered with the following HTML elements
167 * whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
168 * attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
169 * <b>acronym<b> element with the <em>title</em> attribute allowed. The
170 * <b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.
171 *
172 * The style.css file must contain theme name, theme URI, and description. The
173 * data can also contain author URI, author, template (parent template),
174 * version, status, and finally tags. Some of these are not used by WordPress
175 * administration panels, but are used by theme directory web sites which list
176 * the theme.
177 *
178 * @since 1.5.0
179 *
180 * @param string $theme_file Theme file path.
181 * @return array Theme data.
182 */
183function get_theme_data( $theme_file ) {
184 $default_headers = array(
185 'Name' => 'Theme Name',
186 'URI' => 'Theme URI',
187 'Description' => 'Description',
188 'Author' => 'Author',
189 'AuthorURI' => 'Author URI',
190 'Version' => 'Version',
191 'Template' => 'Template',
192 'Status' => 'Status',
193 'Tags' => 'Tags'
194 );
195
196 $themes_allowed_tags = array(
197 'a' => array(
198 'href' => array(),'title' => array()
199 ),
200 'abbr' => array(
201 'title' => array()
202 ),
203 'acronym' => array(
204 'title' => array()
205 ),
206 'code' => array(),
207 'em' => array(),
208 'strong' => array()
209 );
210
211 $theme_data = get_file_data( $theme_file, $default_headers, 'theme' );//Arbitrary file disclosing
212
213 $theme_data['Name'] = $theme_data['Title'] = wp_kses( $theme_data['Name'], $themes_allowed_tags );
214
215 $theme_data['URI'] = esc_url( $theme_data['URI'] );
216
217 $theme_data['Description'] = wptexturize( wp_kses( $theme_data['Description'], $themes_allowed_tags ) );
218
219 $theme_data['AuthorURI'] = esc_url( $theme_data['AuthorURI'] );
220
221 $theme_data['Template'] = wp_kses( $theme_data['Template'], $themes_allowed_tags );
222
223 $theme_data['Version'] = wp_kses( $theme_data['Version'], $themes_allowed_tags );
224
225 if ( $theme_data['Status'] == '' )
226 $theme_data['Status'] = 'publish';
227 else
228 $theme_data['Status'] = wp_kses( $theme_data['Status'], $themes_allowed_tags );
229
230 if ( $theme_data['Tags'] == '' )
231 $theme_data['Tags'] = array();
232 else
233 $theme_data['Tags'] = array_map( 'trim', explode( ',', wp_kses( $theme_data['Tags'], array() ) ) );
234
235 if ( $theme_data['Author'] == '' ) {
236 $theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous');
237 } else {
238 $theme_data['AuthorName'] = wp_kses( $theme_data['Author'], $themes_allowed_tags );
239 if ( empty( $theme_data['AuthorURI'] ) ) {
240 $theme_data['Author'] = $theme_data['AuthorName'];
241 } else {
242 $theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], __( 'Visit author homepage' ), $theme_data['AuthorName'] );
243 }
244 }
245
246 return $theme_data;
247}
248
249/**
250 * Retrieve list of themes with theme data in theme directory.
251 *
252 * The theme is broken, if it doesn't have a parent theme and is missing either
253 * style.css and, or index.php. If the theme has a parent theme then it is
254 * broken, if it is missing style.css; index.php is optional. The broken theme
255 * list is saved in the {@link $wp_broken_themes} global, which is displayed on
256 * the theme list in the administration panels.
257 *
258 * @since 1.5.0
259 * @global array $wp_broken_themes Stores the broken themes.
260 * @global array $wp_themes Stores the working themes.
261 *
262 * @return array Theme list with theme data.
263 */
264function get_themes() {
265 global $wp_themes, $wp_broken_themes;
266
267 if ( isset($wp_themes) )
268 return $wp_themes;
269
270 /* Register the default root as a theme directory */
271 register_theme_directory( get_theme_root() );
272
273 if ( !$theme_files = search_theme_directories() )
274 return false;
275
276 asort( $theme_files );
277
278 $wp_themes = array();
279
280 foreach ( (array) $theme_files as $theme_file ) {
281 $theme_root = $theme_file['theme_root'];
282 $theme_file = $theme_file['theme_file'];//Arbitrary file disclosing
283
284 if ( !is_readable("$theme_root/$theme_file") ) {
285 $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.'));
286 continue;
287 }
288
289 $theme_data = get_theme_data("$theme_root/$theme_file");
290
291 $name = $theme_data['Name'];
292 $title = $theme_data['Title'];
293 $description = wptexturize($theme_data['Description']);
294 $version = $theme_data['Version'];
295 $author = $theme_data['Author'];
296 $template = $theme_data['Template'];
297 $stylesheet = dirname($theme_file);
298
299 $screenshot = false;
300 foreach ( array('png', 'gif', 'jpg', 'jpeg') as $ext ) {
301 if (file_exists("$theme_root/$stylesheet/screenshot.$ext")) {
302 $screenshot = "screenshot.$ext";
303 break;
304 }
305 }
306
307 if ( empty($name) ) {
308 $name = dirname($theme_file);
309 $title = $name;
310 }
311
312 $parent_template = $template;
313
314 if ( empty($template) ) {
315 if ( file_exists("$theme_root/$stylesheet/index.php") )
316 $template = $stylesheet;
317 else
318 continue;
319 }
320
321 $template = trim( $template );
322
323 if ( !file_exists("$theme_root/$template/index.php") ) {
324 $parent_dir = dirname(dirname($theme_file));
325 if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) {
326 $template = "$parent_dir/$template";
327 $template_directory = "$theme_root/$template";
328 } else {
329 /**
330 * The parent theme doesn't exist in the current theme's folder or sub folder
331 * so lets use the theme root for the parent template.
332 */
333 if ( isset($theme_files[$template]) && file_exists( $theme_files[$template]['theme_root'] . "/$template/index.php" ) ) {
334 $template_directory = $theme_files[$template]['theme_root'] . "/$template";
335 } else {
336 if ( empty( $parent_template) )
337 $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template');
338 else
339 $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf( __('The parent theme is missing. Please install the "%s" parent theme.'), $parent_template ), 'error' => 'no_parent', 'parent' => $parent_template );
340 continue;
341 }
342
343 }
344 } else {
345 $template_directory = trim( $theme_root . '/' . $template );
346 }
347
348 $stylesheet_files = array();
349 $template_files = array();
350
351 $stylesheet_dir = @ dir("$theme_root/$stylesheet");
352 if ( $stylesheet_dir ) {
353 while ( ($file = $stylesheet_dir->read()) !== false ) {
354 if ( !preg_match('|^\.+$|', $file) ) {
355 if ( preg_match('|\.css$|', $file) )
356 $stylesheet_files[] = "$theme_root/$stylesheet/$file";
357 elseif ( preg_match('|\.php$|', $file) )
358 $template_files[] = "$theme_root/$stylesheet/$file";
359 }
360 }
361 @ $stylesheet_dir->close();
362 }
363
364 $template_dir = @ dir("$template_directory");
365 if ( $template_dir ) {
366 while ( ($file = $template_dir->read()) !== false ) {
367 if ( preg_match('|^\.+$|', $file) )
368 continue;
369 if ( preg_match('|\.php$|', $file) ) {
370 $template_files[] = "$template_directory/$file";
371 } elseif ( is_dir("$template_directory/$file") ) {
372 $template_subdir = @ dir("$template_directory/$file");
373 if ( !$template_subdir )
374 continue;
375 while ( ($subfile = $template_subdir->read()) !== false ) {
376 if ( preg_match('|^\.+$|', $subfile) )
377 continue;
378 if ( preg_match('|\.php$|', $subfile) )
379 $template_files[] = "$template_directory/$file/$subfile";//Arbitrary file disclosing
380 }
381 @ $template_subdir->close();
382 }
383 }
384 @ $template_dir->close();
385 }
386
387 //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes
388 $template_files = array_unique($template_files);
389 $stylesheet_files = array_unique($stylesheet_files);
390
391 $template_dir = dirname($template_files[0]);
392 $stylesheet_dir = dirname($stylesheet_files[0]);
393
394 if ( empty($template_dir) )
395 $template_dir = '/';
396 if ( empty($stylesheet_dir) )
397 $stylesheet_dir = '/';
398
399 // Check for theme name collision. This occurs if a theme is copied to
400 // a new theme directory and the theme header is not updated. Whichever
401 // theme is first keeps the name. Subsequent themes get a suffix applied.
402 // The Default and Classic themes always trump their pretenders.
403 if ( isset($wp_themes[$name]) ) {
404 if ( ('WordPress Default' == $name || 'WordPress Classic' == $name) &&
405 ('default' == $stylesheet || 'classic' == $stylesheet) ) {
406 // If another theme has claimed to be one of our default themes, move
407 // them aside.
408 $suffix = $wp_themes[$name]['Stylesheet'];
409 $new_name = "$name/$suffix";
410 $wp_themes[$new_name] = $wp_themes[$name];
411 $wp_themes[$new_name]['Name'] = $new_name;
412 } else {
413 $name = "$name/$stylesheet";
414 }
415 }
416
417 $theme_roots[$stylesheet] = str_replace( WP_CONTENT_DIR, '', $theme_root );
418 $wp_themes[$name] = array(
419 'Name' => $name,
420 'Title' => $title,
421 'Description' => $description,
422 'Author' => $author,
423 'Author Name' => $theme_data['AuthorName'],
424 'Author URI' => $theme_data['AuthorURI'],
425 'Version' => $version,
426 'Template' => $template,
427 'Stylesheet' => $stylesheet,
428 'Template Files' => $template_files,
429 'Stylesheet Files' => $stylesheet_files,
430 'Template Dir' => $template_dir,
431 'Stylesheet Dir' => $stylesheet_dir,
432 'Status' => $theme_data['Status'],
433 'Screenshot' => $screenshot,
434 'Tags' => $theme_data['Tags'],
435 'Theme Root' => $theme_root,
436 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ),
437 );
438 }
439
440 unset($theme_files);
441
442 /* Store theme roots in the DB */
443 if ( get_site_transient( 'theme_roots' ) != $theme_roots )
444 set_site_transient( 'theme_roots', $theme_roots, 7200 ); // cache for two hours
445 unset($theme_roots);
446
447 /* Resolve theme dependencies. */
448 $theme_names = array_keys( $wp_themes );
449 foreach ( (array) $theme_names as $theme_name ) {
450 $wp_themes[$theme_name]['Parent Theme'] = '';
451 if ( $wp_themes[$theme_name]['Stylesheet'] != $wp_themes[$theme_name]['Template'] ) {
452 foreach ( (array) $theme_names as $parent_theme_name ) {
453 if ( ($wp_themes[$parent_theme_name]['Stylesheet'] == $wp_themes[$parent_theme_name]['Template']) && ($wp_themes[$parent_theme_name]['Template'] == $wp_themes[$theme_name]['Template']) ) {
454 $wp_themes[$theme_name]['Parent Theme'] = $wp_themes[$parent_theme_name]['Name'];
455 break;
456 }
457 }
458 }
459 }
460
461 return $wp_themes;
462}
463
464/**
465 * Retrieve theme roots.
466 *
467 * @since 2.9.0
468 *
469 * @return array Theme roots
470 */
471function get_theme_roots() {
472 $theme_roots = get_site_transient( 'theme_roots' );
473 if ( false === $theme_roots ) {
474 get_themes();
475 $theme_roots = get_site_transient( 'theme_roots' ); // this is set in get_theme()
476 }
477 return $theme_roots;
478}
479
480/**
481 * Retrieve theme data.
482 *
483 * @since 1.5.0
484 *
485 * @param string $theme Theme name.
486 * @return array|null Null, if theme name does not exist. Theme data, if exists.
487 */
488function get_theme($theme) {
489 $themes = get_themes();
490
491 if ( array_key_exists($theme, $themes) )
492 return $themes[$theme];
493
494 return null;
495}
496
497/**
498 * Retrieve current theme display name.
499 *
500 * If the 'current_theme' option has already been set, then it will be returned
501 * instead. If it is not set, then each theme will be iterated over until both
502 * the current stylesheet and current template name.
503 *
504 * @since 1.5.0
505 *
506 * @return string
507 */
508function get_current_theme() {
509 if ( $theme = get_option('current_theme') )
510 return $theme;
511
512 $themes = get_themes();
513 $theme_names = array_keys($themes);
514 $current_template = get_option('template');
515 $current_stylesheet = get_option('stylesheet');
516 $current_theme = 'WordPress Default';
517
518 if ( $themes ) {
519 foreach ( (array) $theme_names as $theme_name ) {
520 if ( $themes[$theme_name]['Stylesheet'] == $current_stylesheet &&
521 $themes[$theme_name]['Template'] == $current_template ) {
522 $current_theme = $themes[$theme_name]['Name'];
523 break;
524 }
525 }
526 }
527
528 update_option('current_theme', $current_theme);
529
530 return $current_theme;
531}
532
533/**
534 * Register a directory that contains themes.
535 *
536 * @since 2.9.0
537 *
538 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
539 * @return bool
540 */
541function register_theme_directory( $directory) {
542 global $wp_theme_directories;
543
544 /* If this folder does not exist, return and do not register */
545 if ( !file_exists( $directory ) )
546 /* Try prepending as the theme directory could be relative to the content directory */
547 $registered_directory = WP_CONTENT_DIR . '/' . $directory;
548 else
549 $registered_directory = $directory;
550
551 /* If this folder does not exist, return and do not register */
552 if ( !file_exists( $registered_directory ) )
553 return false;
554
555 $wp_theme_directories[] = $registered_directory;
556
557 return true;
558}
559
560/**
561 * Search all registered theme directories for complete and valid themes.
562 *
563 * @since 2.9.0
564 *
565 * @return array Valid themes found
566 */
567function search_theme_directories() {
568 global $wp_theme_directories, $wp_broken_themes;
569 if ( empty( $wp_theme_directories ) )
570 return false;
571
572 $theme_files = array();
573 $wp_broken_themes = array();
574
575 /* Loop the registered theme directories and extract all themes */
576 foreach ( (array) $wp_theme_directories as $theme_root ) {
577 $theme_loc = $theme_root;
578
579 /* We don't want to replace all forward slashes, see Trac #4541 */
580 if ( '/' != WP_CONTENT_DIR )
581 $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root);
582
583 /* Files in the root of the current theme directory and one subdir down */
584 $themes_dir = @ opendir($theme_root);//Arbitrary file disclosing
585
586 if ( !$themes_dir )
587 return false;
588
589 while ( ($theme_dir = readdir($themes_dir)) !== false ) {
590 if ( is_dir($theme_root . '/' . $theme_dir) && is_readable($theme_root . '/' . $theme_dir) ) {
591 if ( $theme_dir{0} == '.' || $theme_dir == 'CVS' )
592 continue;
593
594 $stylish_dir = @opendir($theme_root . '/' . $theme_dir);//Arbitrary file disclosing
595 $found_stylesheet = false;
596
597 while ( ($theme_file = readdir($stylish_dir)) !== false ) {
598 if ( $theme_file == 'style.css' ) {
599 $theme_files[$theme_dir] = array( 'theme_file' => $theme_dir . '/' . $theme_file, 'theme_root' => $theme_root );//Arbitrary file disclosing
600 $found_stylesheet = true;
601 break;
602 }
603 }
604 @closedir($stylish_dir);
605
606 if ( !$found_stylesheet ) { // look for themes in that dir
607 $subdir = "$theme_root/$theme_dir";
608 $subdir_name = $theme_dir;
609 $theme_subdirs = @opendir( $subdir );//Arbitrary file disclosing
610
611 $found_subdir_themes = false;
612 while ( ($theme_subdir = readdir($theme_subdirs)) !== false ) {
613 if ( is_dir( $subdir . '/' . $theme_subdir) && is_readable($subdir . '/' . $theme_subdir) ) {
614 if ( $theme_subdir{0} == '.' || $theme_subdir == 'CVS' )
615 continue;
616
617 $stylish_dir = @opendir($subdir . '/' . $theme_subdir);//Arbitrary file disclosing
618 $found_stylesheet = false;
619
620 while ( ($theme_file = readdir($stylish_dir)) !== false ) {
621 if ( $theme_file == 'style.css' ) {
622 $theme_files["$theme_dir/$theme_subdir"] = array( 'theme_file' => $subdir_name . '/' . $theme_subdir . '/' . $theme_file, 'theme_root' => $theme_root );//Arbitrary file disclosing
623 $found_stylesheet = true;
624 $found_subdir_themes = true;
625 break;
626 }
627 }
628 @closedir($stylish_dir);
629 }
630 }
631 @closedir($theme_subdirs);
632 if ( !$found_subdir_themes )
633 $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.'));
634 }
635 }
636 }
637 @closedir( $themes_dir );
638 }
639 return $theme_files;
640}
641
642/**
643 * Retrieve path to themes directory.
644 *
645 * Does not have trailing slash.
646 *
647 * @since 1.5.0
648 * @param $stylesheet_or_template The stylesheet or template name of the theme
649 * @uses apply_filters() Calls 'theme_root' filter on path.
650 *
651 * @return string Theme path.
652 */
653function get_theme_root( $stylesheet_or_template = false ) {
654 if ($stylesheet_or_template) {
655 $theme_roots = get_theme_roots();
656
657 if ( ! empty( $theme_roots[$stylesheet_or_template] ) )
658 $theme_root = WP_CONTENT_DIR . $theme_roots[$stylesheet_or_template];
659 else
660 $theme_root = WP_CONTENT_DIR . '/themes';
661 } else {
662 $theme_root = WP_CONTENT_DIR . '/themes';
663 }
664
665 return apply_filters( 'theme_root', $theme_root );
666}
667
668/**
669 * Retrieve URI for themes directory.
670 *
671 * Does not have trailing slash.
672 *
673 * @since 1.5.0
674 * @param $stylesheet_or_template The stylesheet or template name of the theme
675 *
676 * @return string Themes URI.
677 */
678function get_theme_root_uri( $stylesheet_or_template = false ) {
679 $theme_roots = get_theme_roots();
680
681 if ( isset( $theme_roots[$stylesheet_or_template] ) && $theme_roots[$stylesheet_or_template] )
682 $theme_root_uri = content_url( $theme_roots[$stylesheet_or_template] );
683 else
684 $theme_root_uri = content_url( 'themes' );
685
686 return apply_filters( 'theme_root_uri', $theme_root_uri, get_option('siteurl'), $stylesheet_or_template );
687}
688
689/**
690 * Retrieve path to file without the use of extension.
691 *
692 * Used to quickly retrieve the path of file without including the file
693 * extension. It will also check the parent template, if the file exists, with
694 * the use of {@link locate_template()}. Allows for more generic file location
695 * without the use of the other get_*_template() functions.
696 *
697 * Can be used with include() or require() to retrieve path.
698 * <code>
699 * if( '' != get_query_template( '404' ) )
700 * include( get_query_template( '404' ) );
701 * </code>
702 * or the same can be accomplished with
703 * <code>
704 * if( '' != get_404_template() )
705 * include( get_404_template() );
706 * </code>
707 *
708 * @since 1.5.0
709 *
710 * @param string $type Filename without extension.
711 * @return string Full path to file.
712 */
713function get_query_template($type) {
714 $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
715 return apply_filters("{$type}_template", locate_template(array("{$type}.php")));
716}
717
718/**
719 * Retrieve path of index template in current or parent template.
720 *
721 * @since 3.0.0
722 *
723 * @return string
724 */
725function get_index_template() {
726 return get_query_template('index');
727}
728
729/**
730 * Retrieve path of 404 template in current or parent template.
731 *
732 * @since 1.5.0
733 *
734 * @return string
735 */
736function get_404_template() {
737 return get_query_template('404');
738}
739
740/**
741 * Retrieve path of archive template in current or parent template.
742 *
743 * @since 1.5.0
744 *
745 * @return string
746 */
747function get_archive_template() {
748 return get_query_template('archive');
749}
750
751/**
752 * Retrieve path of author template in current or parent template.
753 *
754 * @since 1.5.0
755 *
756 * @return string
757 */
758function get_author_template() {
759 $author_id = absint( get_query_var( 'author' ) );
760 $author = get_user_by( 'id', $author_id );
761 $author = $author->user_nicename;
762
763 $templates = array();
764
765 if ( $author )
766 $templates[] = "author-{$author}.php";
767 if ( $author_id )
768 $templates[] = "author-{$author_id}.php";
769 $templates[] = 'author.php';
770
771 $template = locate_template( $templates );
772 return apply_filters( 'author_template', $template );
773}
774
775/**
776 * Retrieve path of category template in current or parent template.
777 *
778 * Works by first retrieving the current slug for example 'category-default.php' and then
779 * trying category ID, for example 'category-1.php' and will finally fallback to category.php
780 * template, if those files don't exist.
781 *
782 * @since 1.5.0
783 * @uses apply_filters() Calls 'category_template' on file path of category template.
784 *
785 * @return string
786 */
787function get_category_template() {
788 $cat_ID = absint( get_query_var('cat') );
789 $category = get_category( $cat_ID );
790
791 $templates = array();
792
793 if ( !is_wp_error($category) )
794 $templates[] = "category-{$category->slug}.php";
795
796 $templates[] = "category-$cat_ID.php";
797 $templates[] = "category.php";
798
799 $template = locate_template($templates);
800 return apply_filters('category_template', $template);
801}
802
803/**
804 * Retrieve path of tag template in current or parent template.
805 *
806 * Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then
807 * trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php
808 * template, if those files don't exist.
809 *
810 * @since 2.3.0
811 * @uses apply_filters() Calls 'tag_template' on file path of tag template.
812 *
813 * @return string
814 */
815function get_tag_template() {
816 $tag_id = absint( get_query_var('tag_id') );
817 $tag_name = get_query_var('tag');
818
819 $templates = array();
820
821 if ( $tag_name )
822 $templates[] = "tag-$tag_name.php";
823 if ( $tag_id )
824 $templates[] = "tag-$tag_id.php";
825 $templates[] = "tag.php";
826
827 $template = locate_template($templates);
828 return apply_filters('tag_template', $template);
829}
830
831/**
832 * Retrieve path of taxonomy template in current or parent template.
833 *
834 * Retrieves the taxonomy and term, if term is available. The template is
835 * prepended with 'taxonomy-' and followed by both the taxonomy string and
836 * the taxonomy string followed by a dash and then followed by the term.
837 *
838 * The taxonomy and term template is checked and used first, if it exists.
839 * Second, just the taxonomy template is checked, and then finally, taxonomy.php
840 * template is used. If none of the files exist, then it will fall back on to
841 * index.php.
842 *
843 * @since unknown (2.6.0 most likely)
844 * @uses apply_filters() Calls 'taxonomy_template' filter on found path.
845 *
846 * @return string
847 */
848function get_taxonomy_template() {
849 $taxonomy = get_query_var('taxonomy');
850 $term = get_query_var('term');
851
852 $templates = array();
853 if ( $taxonomy && $term )
854 $templates[] = "taxonomy-$taxonomy-$term.php";
855 if ( $taxonomy )
856 $templates[] = "taxonomy-$taxonomy.php";
857
858 $templates[] = "taxonomy.php";
859
860 $template = locate_template($templates);
861 return apply_filters('taxonomy_template', $template);
862}
863
864/**
865 * Retrieve path of date template in current or parent template.
866 *
867 * @since 1.5.0
868 *
869 * @return string
870 */
871function get_date_template() {
872 return get_query_template('date');
873}
874
875/**
876 * Retrieve path of home template in current or parent template.
877 *
878 * This is the template used for the page containing the blog posts
879 *
880 * Attempts to locate 'home.php' first before falling back to 'index.php'.
881 *
882 * @since 1.5.0
883 * @uses apply_filters() Calls 'home_template' on file path of home template.
884 *
885 * @return string
886 */
887function get_home_template() {
888 $template = locate_template(array('home.php', 'index.php'));
889 return apply_filters('home_template', $template);
890}
891
892/**
893 * Retrieve path of front-page template in current or parent template.
894 *
895 * Looks for 'front-page.php'.
896 *
897 * @since 3.0.0
898 * @uses apply_filters() Calls 'front_page_template' on file path of template.
899 *
900 * @return string
901 */
902function get_front_page_template() {
903 return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) );
904}
905
906/**
907 * Retrieve path of page template in current or parent template.
908 *
909 * Will first look for the specifically assigned page template
910 * The will search for 'page-{slug}.php' followed by 'page-id.php'
911 * and finally 'page.php'
912 *
913 * @since 1.5.0
914 *
915 * @return string
916 */
917function get_page_template() {
918 global $wp_query;
919
920 $id = (int) $wp_query->get_queried_object_id();
921 $template = get_post_meta($id, '_wp_page_template', true);
922 $pagename = get_query_var('pagename');
923
924 if ( !$pagename && $id > 0 ) {
925 // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
926 $post = $wp_query->get_queried_object();
927 $pagename = $post->post_name;
928 }
929
930 if ( 'default' == $template )
931 $template = '';
932
933 $templates = array();
934 if ( !empty($template) && !validate_file($template) )
935 $templates[] = $template;
936 if ( $pagename )
937 $templates[] = "page-$pagename.php";
938 if ( $id )
939 $templates[] = "page-$id.php";
940 $templates[] = "page.php";
941
942 return apply_filters('page_template', locate_template($templates));
943}
944
945/**
946 * Retrieve path of paged template in current or parent template.
947 *
948 * @since 1.5.0
949 *
950 * @return string
951 */
952function get_paged_template() {
953 return get_query_template('paged');
954}
955
956/**
957 * Retrieve path of search template in current or parent template.
958 *
959 * @since 1.5.0
960 *
961 * @return string
962 */
963function get_search_template() {
964 return get_query_template('search');
965}
966
967/**
968 * Retrieve path of single template in current or parent template.
969 *
970 * @since 1.5.0
971 *
972 * @return string
973 */
974function get_single_template() {
975 global $wp_query;
976
977 $object = $wp_query->get_queried_object();
978 $templates = array('single-' . $object->post_type . '.php', 'single.php');
979 return apply_filters('single_template', locate_template($templates));
980}
981
982/**
983 * Retrieve path of attachment template in current or parent template.
984 *
985 * The attachment path first checks if the first part of the mime type exists.
986 * The second check is for the second part of the mime type. The last check is
987 * for both types separated by an underscore. If neither are found then the file
988 * 'attachment.php' is checked and returned.
989 *
990 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
991 * finally 'text_plain.php'.
992 *
993 * @since 2.0.0
994 *
995 * @return string
996 */
997function get_attachment_template() {
998 global $posts;
999 $type = explode('/', $posts[0]->post_mime_type);
1000 if ( $template = get_query_template($type[0]) )
/var/www/wordpress/wp-includes/update.php
/var/www/wordpress/wp-includes/user.php
/var/www/wordpress/wp-includes/vars.php
/var/www/wordpress/wp-includes/version.php
/var/www/wordpress/wp-includes/widgets.php
/var/www/wordpress/wp-includes/wp-db.php
/var/www/wordpress/wp-includes/wp-diff.php
/var/www/wordpress/index.php
/var/www/wordpress/wp-activate.php
/var/www/wordpress/wp-app.php
/var/www/wordpress/wp-atom.php
/var/www/wordpress/wp-blog-header.php
/var/www/wordpress/wp-comments-post.php
/var/www/wordpress/wp-commentsrss2.php
/var/www/wordpress/wp-config-sample.php
/var/www/wordpress/wp-cron.php
/var/www/wordpress/wp-feed.php
/var/www/wordpress/wp-links-opml.php
/var/www/wordpress/wp-load.php
/var/www/wordpress/wp-login.php
/var/www/wordpress/wp-mail.php
/var/www/wordpress/wp-pass.php
/var/www/wordpress/wp-rdf.php
/var/www/wordpress/wp-register.php
/var/www/wordpress/wp-rss.php
/var/www/wordpress/wp-rss2.php
/var/www/wordpress/wp-settings.php
/var/www/wordpress/wp-signup.php
/var/www/wordpress/wp-trackback.php
/var/www/wordpress/xmlrpc.php