~ubuntu-branches/debian/sid/wordpress/sid

« back to all changes in this revision

Viewing changes to wp-admin/includes/class-wp-themes-list-table.php

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-09-05 20:58:06 UTC
  • mfrom: (1.2.38)
  • Revision ID: package-import@ubuntu.com-20140905205806-e4h6dkg4190n0svf
Tags: 4.0+dfsg-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
class WP_Themes_List_Table extends WP_List_Table {
11
11
 
12
12
        protected $search_terms = array();
13
 
        var $features = array();
 
13
        public $features = array();
14
14
 
15
 
        function __construct( $args = array() ) {
 
15
        /**
 
16
         * Constructor.
 
17
         *
 
18
         * @since 3.1.0
 
19
         * @access public
 
20
         *
 
21
         * @see WP_List_Table::__construct() for more information on default arguments.
 
22
         *
 
23
         * @param array $args An associative array of arguments.
 
24
         */
 
25
        public function __construct( $args = array() ) {
16
26
                parent::__construct( array(
17
27
                        'ajax' => true,
18
28
                        'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
19
29
                ) );
20
30
        }
21
31
 
22
 
        function ajax_user_can() {
 
32
        public function ajax_user_can() {
23
33
                // Do not check edit_theme_options here. AJAX calls for available themes require switch_themes.
24
34
                return current_user_can( 'switch_themes' );
25
35
        }
26
36
 
27
 
        function prepare_items() {
 
37
        public function prepare_items() {
28
38
                $themes = wp_get_themes( array( 'allowed' => true ) );
29
39
 
30
40
                if ( ! empty( $_REQUEST['s'] ) )
57
67
                ) );
58
68
        }
59
69
 
60
 
        function no_items() {
 
70
        public function no_items() {
61
71
                if ( $this->search_terms || $this->features ) {
62
72
                        _e( 'No items found.' );
63
73
                        return;
73
83
 
74
84
                                return;
75
85
                        }
76
 
                        // else, fallthrough. install_themes doesn't help if you can't enable it.
 
86
                        // Else, fallthrough. install_themes doesn't help if you can't enable it.
77
87
                } else {
78
88
                        if ( current_user_can( 'install_themes' ) ) {
79
89
                                printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.' ), admin_url( 'theme-install.php' ) );
85
95
                printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) );
86
96
        }
87
97
 
88
 
        function tablenav( $which = 'top' ) {
 
98
        public function tablenav( $which = 'top' ) {
89
99
                if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
90
100
                        return;
91
101
                ?>
97
107
                <?php
98
108
        }
99
109
 
100
 
        function display() {
 
110
        public function display() {
101
111
                wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
102
112
?>
103
113
                <?php $this->tablenav( 'top' ); ?>
110
120
<?php
111
121
        }
112
122
 
113
 
        function get_columns() {
 
123
        public function get_columns() {
114
124
                return array();
115
125
        }
116
126
 
117
 
        function display_rows_or_placeholder() {
 
127
        public function display_rows_or_placeholder() {
118
128
                if ( $this->has_items() ) {
119
129
                        $this->display_rows();
120
130
                } else {
124
134
                }
125
135
        }
126
136
 
127
 
        function display_rows() {
 
137
        public function display_rows() {
128
138
                $themes = $this->items;
129
139
 
130
140
                foreach ( $themes as $theme ):
149
159
                        $actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
150
160
                                . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
151
161
 
152
 
                        if ( current_user_can( 'edit_theme_options' ) )
 
162
                        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
153
163
                                $actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
154
164
                                        . __( 'Live Preview' ) . '</a>';
 
165
                        }
155
166
 
156
167
                        if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
157
168
                                $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
208
219
                endforeach;
209
220
        }
210
221
 
211
 
        function search_theme( $theme ) {
 
222
        public function search_theme( $theme ) {
212
223
                // Search the features
213
224
                foreach ( $this->features as $word ) {
214
225
                        if ( ! in_array( $word, $theme->get('Tags') ) )
243
254
         * Send required variables to JavaScript land
244
255
         *
245
256
         * @since 3.4.0
246
 
         * @access private
 
257
         * @access public
247
258
         *
248
259
         * @uses $this->features Array of all feature search terms.
249
260
         * @uses get_pagenum()
250
261
         * @uses _pagination_args['total_pages']
251
262
         */
252
 
         function _js_vars( $extra_args = array() ) {
 
263
        public function _js_vars( $extra_args = array() ) {
253
264
                $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
254
265
 
255
266
                $args = array(