]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/theme.php
WordPress 3.7.2
[autoinstalls/wordpress.git] / wp-admin / includes / theme.php
index af1960e478d2e05cddd8c8dbfc399257c04ea925..9ea69f2faa909a89becb783f49a516f1e96902bf 100644 (file)
@@ -23,7 +23,7 @@ function delete_theme($stylesheet, $redirect = '') {
 
        ob_start();
        if ( empty( $redirect ) )
-               $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . $stylesheet, 'delete-theme_' . $stylesheet);
+               $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
        if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
                $data = ob_get_contents();
                ob_end_clean();
@@ -37,7 +37,7 @@ function delete_theme($stylesheet, $redirect = '') {
        }
 
        if ( ! WP_Filesystem($credentials) ) {
-               request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again
+               request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again
                $data = ob_get_contents();
                ob_end_clean();
                if ( ! empty($data) ) {
@@ -151,7 +151,7 @@ function theme_update_available( $theme ) {
 function get_theme_feature_list( $api = true ) {
        // Hard-coded list is used if api not accessible.
        $features = array(
-                       __('Colors') => array(
+                       __( 'Colors' ) => array(
                                'black'   => __( 'Black' ),
                                'blue'    => __( 'Blue' ),
                                'brown'   => __( 'Brown' ),
@@ -169,7 +169,7 @@ function get_theme_feature_list( $api = true ) {
                                'light'   => __( 'Light' ),
                        ),
 
-               __('Columns') => array(
+               __( 'Columns' ) => array(
                        'one-column'    => __( 'One Column' ),
                        'two-columns'   => __( 'Two Columns' ),
                        'three-columns' => __( 'Three Columns' ),
@@ -178,7 +178,7 @@ function get_theme_feature_list( $api = true ) {
                        'right-sidebar' => __( 'Right Sidebar' ),
                ),
 
-               __('Width') => array(
+               __( 'Width' ) => array(
                        'fixed-width'    => __( 'Fixed Width' ),
                        'flexible-width' => __( 'Flexible Width' ),
                ),
@@ -193,6 +193,7 @@ function get_theme_feature_list( $api = true ) {
                        'editor-style'          => __( 'Editor Style' ),
                        'featured-image-header' => __( 'Featured Image Header' ),
                        'featured-images'       => __( 'Featured Images' ),
+                       'flexible-header'       => __( 'Flexible Header' ),
                        'front-page-post-form'  => __( 'Front Page Posting' ),
                        'full-width-template'   => __( 'Full Width Template' ),
                        'microformats'          => __( 'Microformats' ),
@@ -215,10 +216,10 @@ function get_theme_feature_list( $api = true ) {
                return $features;
 
        if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) )
-               set_site_transient( 'wporg_theme_feature_list', array( ), 10800);
+               set_site_transient( 'wporg_theme_feature_list', array(), 10800);
 
        if ( !$feature_list ) {
-               $feature_list = themes_api( 'feature_list', array( ) );
+               $feature_list = themes_api( 'feature_list', array() );
                if ( is_wp_error( $feature_list ) )
                        return $features;
        }
@@ -281,7 +282,23 @@ function themes_api($action, $args = null) {
        $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
 
        if ( ! $res ) {
-               $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
+               $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
+               if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+                       $url = set_url_scheme( $url, 'https' );
+
+               $args = array(
+                       'body' => array(
+                               'action' => $action,
+                               'request' => serialize( $args )
+                       )
+               );
+               $request = wp_remote_post( $url, $args );
+
+               if ( $ssl && is_wp_error( $request ) ) {
+                       trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+                       $request = wp_remote_post( $http_url, $args );
+               }
+
                if ( is_wp_error($request) ) {
                        $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
                } else {