~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/theme-install.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
wp_reset_vars( array( 'tab' ) );
14
14
 
15
15
if ( ! current_user_can('install_themes') )
16
 
        wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
 
16
        wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
17
17
 
18
18
if ( is_multisite() && ! is_network_admin() ) {
19
19
        wp_redirect( network_admin_url( 'theme-install.php' ) );
58
58
) );
59
59
 
60
60
wp_enqueue_script( 'theme' );
 
61
wp_enqueue_script( 'updates' );
61
62
 
62
63
if ( $tab ) {
63
64
        /**
75
76
$help_overview =
76
77
        '<p>' . sprintf(
77
78
                        /* translators: %s: Theme Directory URL */
78
 
                        __( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
 
79
                        __( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
79
80
                        __( 'https://wordpress.org/themes/' )
80
81
                ) . '</p>' .
81
82
        '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
116
117
        echo esc_html( $title );
117
118
 
118
119
        /**
119
 
         * Filter the tabs shown on the Add Themes screen.
 
120
         * Filters the tabs shown on the Add Themes screen.
120
121
         *
121
 
         * This filter is for backwards compatibility only, for the suppression
122
 
         * of the upload tab.
 
122
         * This filter is for backward compatibility only, for the suppression of the upload tab.
123
123
         *
124
124
         * @since 2.8.0
125
125
         *
127
127
         */
128
128
        $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
129
129
        if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
130
 
                echo ' <a href="#" class="upload page-title-action">' . __( 'Upload Theme' ) . '</a>';
131
 
                echo ' <a href="#" class="browse-themes page-title-action">' . _x( 'Browse', 'themes' ) . '</a>';
 
130
                echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>';
132
131
        }
133
132
        ?></h1>
 
133
        <div class="error hide-if-js">
 
134
                <p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
 
135
        </div>
134
136
 
135
137
        <div class="upload-theme">
136
138
        <?php install_themes_upload(); ?>
137
139
        </div>
138
140
 
139
 
        <h2 class="screen-reader-text"><?php _e( 'Filter themes list' ); ?></h2>
 
141
        <h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2>
140
142
 
141
 
        <div class="wp-filter">
 
143
        <div class="wp-filter hide-if-no-js">
142
144
                <div class="filter-count">
143
145
                        <span class="count theme-count"></span>
144
146
                </div>
202
204
                        </div>
203
205
                </div>
204
206
        </div>
205
 
        <h2 class="screen-reader-text"><?php _e( 'Themes list' ); ?></h2>
 
207
        <h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2>
206
208
        <div class="theme-browser content-filterable"></div>
207
209
        <div class="theme-install-overlay wp-full-overlay expanded"></div>
208
210
 
236
238
                <div class="theme-screenshot blank"></div>
237
239
        <# } #>
238
240
        <span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
239
 
        <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div>
 
241
        <div class="theme-author">
 
242
                <?php
 
243
                /* translators: %s: Theme author name */
 
244
                printf( __( 'By %s' ), '{{ data.author }}' );
 
245
                ?>
 
246
        </div>
240
247
        <h3 class="theme-name">{{ data.name }}</h3>
241
248
 
242
249
        <div class="theme-actions">
243
 
                <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
244
 
                <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
 
250
                <# if ( data.installed ) { #>
 
251
                        <?php
 
252
                        /* translators: %s: Theme name */
 
253
                        $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 
254
                        ?>
 
255
                        <# if ( data.activate_url ) { #>
 
256
                                <a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 
257
                        <# } #>
 
258
                        <# if ( data.customize_url ) { #>
 
259
                                <a class="button button-secondary load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
 
260
                        <# } else { #>
 
261
                                <button class="button-secondary preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
 
262
                        <# } #>
 
263
                <# } else { #>
 
264
                        <?php
 
265
                        /* translators: %s: Theme name */
 
266
                        $aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
 
267
                        ?>
 
268
                        <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
 
269
                        <button class="button-secondary preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
 
270
                <# } #>
245
271
        </div>
246
272
 
247
273
        <# if ( data.installed ) { #>
248
 
                <div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div>
 
274
                <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
249
275
        <# } #>
250
276
</script>
251
277
 
252
278
<script id="tmpl-theme-preview" type="text/template">
253
279
        <div class="wp-full-overlay-sidebar">
254
280
                <div class="wp-full-overlay-header">
255
 
                        <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a>
256
 
                        <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a>
257
 
                        <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a>
258
 
                <# if ( data.installed ) { #>
259
 
                        <a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a>
260
 
                <# } else { #>
261
 
                        <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
262
 
                <# } #>
 
281
                        <button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
 
282
                        <button class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></button>
 
283
                        <button class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></button>
 
284
                        <# if ( data.installed ) { #>
 
285
                                <a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
 
286
                        <# } else { #>
 
287
                                <a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
 
288
                        <# } #>
263
289
                </div>
264
290
                <div class="wp-full-overlay-sidebar-content">
265
291
                        <div class="install-theme-info">
266
292
                                <h3 class="theme-name">{{ data.name }}</h3>
267
 
                                <span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span>
268
 
 
269
 
                                <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
270
 
 
271
 
                                <div class="theme-details">
272
 
                                        <# if ( data.rating ) { #>
273
 
                                                <div class="theme-rating">
274
 
                                                        {{{ data.stars }}}
275
 
                                                        <span class="num-ratings" aria-hidden="true">({{ data.num_ratings }})</span>
 
293
                                        <span class="theme-by">
 
294
                                                <?php
 
295
                                                /* translators: %s: Theme author name */
 
296
                                                printf( __( 'By %s' ), '{{ data.author }}' );
 
297
                                                ?>
 
298
                                        </span>
 
299
 
 
300
                                        <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
 
301
 
 
302
                                        <div class="theme-details">
 
303
                                                <# if ( data.rating ) { #>
 
304
                                                        <div class="theme-rating">
 
305
                                                                {{{ data.stars }}}
 
306
                                                                <span class="num-ratings">({{ data.num_ratings }})</span>
 
307
                                                        </div>
 
308
                                                <# } else { #>
 
309
                                                        <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
 
310
                                                <# } #>
 
311
                                                <div class="theme-version">
 
312
                                                        <?php
 
313
                                                        /* translators: %s: Theme version */
 
314
                                                        printf( __( 'Version: %s' ), '{{ data.version }}' );
 
315
                                                        ?>
276
316
                                                </div>
277
 
                                        <# } else { #>
278
 
                                                <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
279
 
                                        <# } #>
280
 
                                        <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
281
 
                                        <div class="theme-description">{{{ data.description }}}</div>
 
317
                                                <div class="theme-description">{{{ data.description }}}</div>
 
318
                                        </div>
282
319
                                </div>
283
320
                        </div>
284
 
                </div>
285
 
                <div class="wp-full-overlay-footer">
286
 
                        <div class="devices">
287
 
                                <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop"><span class="screen-reader-text"><?php _e( 'Enter desktop preview mode' ); ?></span></button>
288
 
                                <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet"><span class="screen-reader-text"><?php _e( 'Enter tablet preview mode' ); ?></span></button>
289
 
                                <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile"><span class="screen-reader-text"><?php _e( 'Enter mobile preview mode' ); ?></span></button>
 
321
                        <div class="wp-full-overlay-footer">
 
322
                                <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
 
323
                                        <span class="collapse-sidebar-arrow"></span>
 
324
                                        <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
 
325
                                </button>
290
326
                        </div>
291
 
                        <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
292
 
                                <span class="collapse-sidebar-arrow"></span>
293
 
                                <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
294
 
                        </button>
295
327
                </div>
296
 
        </div>
297
 
        <div class="wp-full-overlay-main">
298
 
                <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>" />
 
328
                <div class="wp-full-overlay-main">
 
329
                <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>"></iframe>
299
330
        </div>
300
331
</script>
301
332
 
302
333
<?php
 
334
wp_print_request_filesystem_credentials_modal();
 
335
wp_print_admin_notice_templates();
 
336
 
303
337
include(ABSPATH . 'wp-admin/admin-footer.php');