Changeset 1034 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
- Timestamp:
- 12/11/2014 07:39:05 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
r1021 r1034 1 1 <?php 2 2 3 /** 3 4 * WP.org Themes' functions and definitions. … … 15 16 16 17 function wporg_themes_setup() { 18 global $themes_allowedtags, $theme_field_defaults; 19 17 20 // load_theme_textdomain( 'wporg-themes', get_template_directory() . '/languages' ); 18 21 add_theme_support( 'automatic-feed-links' ); … … 22 25 'primary' => __( 'Primary Menu', 'wporg-themes' ), 23 26 ) ); 24 27 25 28 add_theme_support( 'html5', array( 26 29 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' 27 30 ) ); 31 32 $themes_allowedtags = array( 33 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ), 34 'abbr' => array( 'title' => array() ), 35 'acronym' => array( 'title' => array() ), 36 'code' => array(), 37 'pre' => array(), 38 'em' => array(), 39 'strong' => array(), 40 'div' => array(), 41 'p' => array(), 42 'ul' => array(), 43 'ol' => array(), 44 'li' => array(), 45 'h1' => array(), 46 'h2' => array(), 47 'h3' => array(), 48 'h4' => array(), 49 'h5' => array(), 50 'h6' => array(), 51 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array() ), 52 ); 53 54 $theme_field_defaults = array( 55 'description' => true, 56 'sections' => false, 57 'tested' => true, 58 'requires' => true, 59 'rating' => true, 60 'downloaded' => true, 61 'downloadlink' => true, 62 'last_updated' => true, 63 'homepage' => true, 64 'tags' => true, 65 'num_ratings' => true, 66 ); 28 67 } 29 68 add_action( 'after_setup_theme', 'wporg_themes_setup' ); … … 47 86 'themes' => false, 48 87 'settings' => array( 88 'isMobile' => wp_is_mobile(), 49 89 'isInstall' => true, 50 90 'canInstall' => false, … … 70 110 71 111 /** 112 * @param object $args 113 * @param string $action 114 * 115 * @return array 116 */ 117 function wporg_themes_api_args( $args, $action ) { 118 if ( 'query_themes' == $action ) { 119 $args->per_page = 30; 120 $args->fields['parent'] = true; 121 $args->fields['tags'] = true; 122 } 123 124 return $args; 125 } 126 add_filter( 'themes_api_args', 'wporg_themes_api_args', 10, 2 ); 127 128 /** 72 129 * Removes Core's built-in query-themes handler, so we can safely add ours later on. 73 130 */ … … 113 170 add_action( 'wp_ajax_nopriv_query-themes', 'wporg_themes_query_themes' ); 114 171 172 function wporg_themes_theme_info() { 173 global $themes_allowedtags; 174 175 $args = wp_unslash( $_REQUEST ); 176 $theme = themes_api( 'theme_information', array( 'slug' => $args['slug'] ) ); 177 178 if ( is_wp_error( $theme ) ) { 179 wp_send_json_error(); 180 } 181 182 $theme->name = wp_kses( $theme->name, $themes_allowedtags ); 183 $theme->author = wp_kses( $theme->author, $themes_allowedtags ); 184 $theme->version = wp_kses( $theme->version, $themes_allowedtags ); 185 $theme->description = wp_kses( $theme->description, $themes_allowedtags ); 186 $theme->num_ratings = number_format_i18n( $theme->num_ratings ); 187 $theme->preview_url = set_url_scheme( $theme->preview_url ); 188 189 wp_send_json_success( $theme ); 190 } 191 add_action( 'wp_ajax_theme-info', 'wporg_themes_theme_info' ); 192 add_action( 'wp_ajax_nopriv_theme-info', 'wporg_themes_theme_info' ); 193 115 194 /** 116 195 * Include view templates in the footer.
Note: See TracChangeset
for help on using the changeset viewer.