Changeset 41807 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 10/10/2017 07:08:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r41802 r41807 4416 4416 'title' => __( 'WordPress.org themes' ), 4417 4417 'action' => 'wporg', 4418 'filter_type' => 'remote', 4418 4419 'capability' => 'install_themes', 4419 4420 'panel' => 'themes', … … 4948 4949 $theme_action = sanitize_key( $_POST['theme_action'] ); 4949 4950 $themes = array(); 4951 $args = array(); 4952 4953 // Define query filters based on user input. 4954 if ( ! array_key_exists( 'search', $_POST ) ) { 4955 $args['search'] = ''; 4956 } else { 4957 $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) ); 4958 } 4959 4960 if ( ! array_key_exists( 'tags', $_POST ) ) { 4961 $args['tag'] = ''; 4962 } else { 4963 $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) ); 4964 } 4965 4966 if ( ! array_key_exists( 'page', $_POST ) ) { 4967 $args['page'] = 1; 4968 } else { 4969 $args['page'] = absint( $_POST['page'] ); 4970 } 4950 4971 4951 4972 require_once ABSPATH . 'wp-admin/includes/theme.php'; 4973 4952 4974 if ( 'installed' === $theme_action ) { 4975 4976 // Load all installed themes from wp_prepare_themes_for_js(). 4953 4977 $themes = array( 'themes' => wp_prepare_themes_for_js() ); 4954 4978 foreach ( $themes['themes'] as &$theme ) { … … 4956 4980 $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] ); 4957 4981 } 4982 4958 4983 } elseif ( 'wporg' === $theme_action ) { 4984 4985 // Load WordPress.org themes from the .org API and normalize data to match installed theme objects. 4959 4986 if ( ! current_user_can( 'install_themes' ) ) { 4960 4987 wp_die( -1 ); … … 4962 4989 4963 4990 // Arguments for all queries. 4964 $ args = array(4991 $wporg_args = array( 4965 4992 'per_page' => 100, 4966 'page' => isset( $_POST['page'] ) ? absint( $_POST['page'] ) : 1,4967 4993 'fields' => array( 4968 4994 'screenshot_url' => true, … … 4980 5006 ); 4981 5007 4982 // Define query filters based on user input. 4983 if ( ! array_key_exists( 'search', $_POST ) ) { 4984 $args['search'] = ''; 4985 } else { 4986 $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) ); 4987 } 4988 4989 if ( ! array_key_exists( 'tags', $_POST ) ) { 4990 $args['tag'] = ''; 4991 } else { 4992 $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) ); 4993 } 5008 $args = array_merge( $wporg_args, $args ); 4994 5009 4995 5010 if ( '' === $args['search'] && '' === $args['tag'] ) { … … 5062 5077 } // End foreach(). 5063 5078 } // End if(). 5079 5080 /** 5081 * Filters the theme data loaded in the customizer. 5082 * 5083 * This allows theme data to be loading from an external source, 5084 * or modification of data loaded from `wp_prepare_themes_for_js()` 5085 * or WordPress.org via `themes_api()`. 5086 * 5087 * @since 4.9.0 5088 * 5089 * @see wp_prepare_themes_for_js() 5090 * @see themes_api() 5091 * @see WP_Customize_Manager::__construct() 5092 * 5093 * @param array $themes Nested array of theme data. 5094 * @param array $args List of arguments, such as page, search term, and tags to query for. 5095 * @param WP_Customize_Manager $manager Instance of Customize manager. 5096 */ 5097 $themes = apply_filters( 'customize_load_themes', $themes, $args, $this ); 5098 5064 5099 wp_send_json_success( $themes ); 5065 5100 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)