]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-themes-list-table.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-themes-list-table.php
index de34581d8a0fefef215c34ce0ae3fc131ed4c3ae..e01e3d463686d88c0fe4fc8b651e0405c4e2e453 100644 (file)
@@ -29,11 +29,18 @@ class WP_Themes_List_Table extends WP_List_Table {
                ) );
        }
 
+       /**
+        *
+        * @return bool
+        */
        public function ajax_user_can() {
                // Do not check edit_theme_options here. AJAX calls for available themes require switch_themes.
                return current_user_can( 'switch_themes' );
        }
 
+       /**
+        * @access public
+        */
        public function prepare_items() {
                $themes = wp_get_themes( array( 'allowed' => true ) );
 
@@ -67,6 +74,9 @@ class WP_Themes_List_Table extends WP_List_Table {
                ) );
        }
 
+       /**
+        * @access public
+        */
        public function no_items() {
                if ( $this->search_terms || $this->features ) {
                        _e( 'No items found.' );
@@ -95,6 +105,9 @@ class WP_Themes_List_Table extends WP_List_Table {
                printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) );
        }
 
+       /**
+        * @param string $which
+        */
        public function tablenav( $which = 'top' ) {
                if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
                        return;
@@ -107,6 +120,9 @@ class WP_Themes_List_Table extends WP_List_Table {
                <?php
        }
 
+       /**
+        * @access public
+        */
        public function display() {
                wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
 ?>
@@ -120,10 +136,17 @@ class WP_Themes_List_Table extends WP_List_Table {
 <?php
        }
 
+       /**
+        *
+        * @return array
+        */
        public function get_columns() {
                return array();
        }
 
+       /**
+        * @access public
+        */
        public function display_rows_or_placeholder() {
                if ( $this->has_items() ) {
                        $this->display_rows();
@@ -134,6 +157,9 @@ class WP_Themes_List_Table extends WP_List_Table {
                }
        }
 
+       /**
+        * @access public
+        */
        public function display_rows() {
                $themes = $this->items;
 
@@ -148,17 +174,10 @@ class WP_Themes_List_Table extends WP_List_Table {
 
                        $activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
 
-                       $preview_link = esc_url( add_query_arg(
-                               array( 'preview' => 1, 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), 'preview_iframe' => true, 'TB_iframe' => 'true' ),
-                               home_url( '/' ) ) );
-
                        $actions = array();
                        $actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="'
                                . esc_attr( sprintf( __( 'Activate &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Activate' ) . '</a>';
 
-                       $actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
-                               . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
-
                        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
                                $actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
                                        . __( 'Live Preview' ) . '</a>';
@@ -179,11 +198,11 @@ class WP_Themes_List_Table extends WP_List_Table {
 
                        ?>
 
-                       <a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize">
+                       <span class="screenshot hide-if-customize">
                                <?php if ( $screenshot = $theme->get_screenshot() ) : ?>
                                        <img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
                                <?php endif; ?>
-                       </a>
+                       </span>
                        <a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
                                <?php if ( $screenshot = $theme->get_screenshot() ) : ?>
                                        <img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
@@ -205,11 +224,11 @@ class WP_Themes_List_Table extends WP_List_Table {
                        </div>
 
                        <div class="themedetaildiv hide-if-js">
-                               <p><strong><?php _e('Version: '); ?></strong><?php echo $version; ?></p>
+                               <p><strong><?php _e('Version:'); ?></strong> <?php echo $version; ?></p>
                                <p><?php echo $theme->display('Description'); ?></p>
                                <?php if ( $theme->parent() ) {
                                        printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
-                                               __( 'http://codex.wordpress.org/Child_Themes' ),
+                                               __( 'https://codex.wordpress.org/Child_Themes' ),
                                                $theme->parent()->display( 'Name' ) );
                                } ?>
                        </div>
@@ -219,6 +238,10 @@ class WP_Themes_List_Table extends WP_List_Table {
                endforeach;
        }
 
+       /**
+        * @param WP_Theme $theme
+        * @return bool
+        */
        public function search_theme( $theme ) {
                // Search the features
                foreach ( $this->features as $word ) {
@@ -256,9 +279,7 @@ class WP_Themes_List_Table extends WP_List_Table {
         * @since 3.4.0
         * @access public
         *
-        * @uses $this->features Array of all feature search terms.
-        * @uses get_pagenum()
-        * @uses _pagination_args['total_pages']
+        * @param array $extra_args
         */
        public function _js_vars( $extra_args = array() ) {
                $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
@@ -273,7 +294,7 @@ class WP_Themes_List_Table extends WP_List_Table {
                if ( is_array( $extra_args ) )
                        $args = array_merge( $args, $extra_args );
 
-               printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", json_encode( $args ) );
+               printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) );
                parent::_js_vars();
        }
 }