@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | function call_some_i18n_methods() { |
3 | - __( 'Hello World' ); |
|
4 | - _e( 'Hello World' ); |
|
5 | - _n( 'Single', 'Plural', 1 ); |
|
6 | - _n_noop( 'Single Noop', 'Plural Noop', 1 ); |
|
7 | - _x( 'Hello World', 'Testing' ); |
|
8 | - _ex( 'Hello World', 'Testing' ); |
|
9 | - _nx( 'Hello World', 'Testing' ); |
|
10 | - _nx_noop( 'Hello World Noop', 'Testing' ); |
|
11 | - esc_attr__( 'Attribute' ); |
|
12 | - esc_html__( 'HTML' ); |
|
13 | - esc_attr_e( 'Attribute' ); |
|
14 | - esc_html_e( 'HTML' ); |
|
15 | - esc_attr_x( 'Attribute', 'Testing' ); |
|
16 | - esc_html_x( 'HTML', 'Testing' ); |
|
17 | - translate_nooped_plural( 'Plural Noop', 2 ); |
|
3 | + __('Hello World'); |
|
4 | + _e('Hello World'); |
|
5 | + _n('Single', 'Plural', 1); |
|
6 | + _n_noop('Single Noop', 'Plural Noop', 1); |
|
7 | + _x('Hello World', 'Testing'); |
|
8 | + _ex('Hello World', 'Testing'); |
|
9 | + _nx('Hello World', 'Testing'); |
|
10 | + _nx_noop('Hello World Noop', 'Testing'); |
|
11 | + esc_attr__('Attribute'); |
|
12 | + esc_html__('HTML'); |
|
13 | + esc_attr_e('Attribute'); |
|
14 | + esc_html_e('HTML'); |
|
15 | + esc_attr_x('Attribute', 'Testing'); |
|
16 | + esc_html_x('HTML', 'Testing'); |
|
17 | + translate_nooped_plural('Plural Noop', 2); |
|
18 | 18 | } |
@@ -17,11 +17,11 @@ |
||
17 | 17 | <div id="primary"> |
18 | 18 | <div id="content" role="main"> |
19 | 19 | |
20 | - <?php while ( have_posts() ) : the_post(); ?> |
|
20 | + <?php while (have_posts()) : the_post(); ?> |
|
21 | 21 | |
22 | - <?php get_template_part( 'content', 'page' ); ?> |
|
22 | + <?php get_template_part('content', 'page'); ?> |
|
23 | 23 | |
24 | - <?php comments_template( '', true ); ?> |
|
24 | + <?php comments_template('', true); ?> |
|
25 | 25 | |
26 | 26 | <?php endwhile; // end of the loop. ?> |
27 | 27 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The template for displaying the footer |
|
4 | - * |
|
5 | - * Contains footer content and the closing of the #main and #page div elements. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Twenty_Thirteen |
|
9 | - * @since Twenty Thirteen 1.0 |
|
10 | - */ |
|
3 | + * The template for displaying the footer |
|
4 | + * |
|
5 | + * Contains footer content and the closing of the #main and #page div elements. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Twenty_Thirteen |
|
9 | + * @since Twenty Thirteen 1.0 |
|
10 | + */ |
|
11 | 11 | ?> |
12 | 12 | |
13 | 13 | </div><!-- #main --> |
@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | </div><!-- #main --> |
14 | 14 | <footer id="colophon" class="site-footer" role="contentinfo"> |
15 | - <?php get_sidebar( 'main' ); ?> |
|
15 | + <?php get_sidebar('main'); ?> |
|
16 | 16 | |
17 | 17 | <div class="site-info"> |
18 | - <?php do_action( 'twentythirteen_credits' ); ?> |
|
19 | - <a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentythirteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a> |
|
18 | + <?php do_action('twentythirteen_credits'); ?> |
|
19 | + <a href="<?php echo esc_url(__('https://wordpress.org/', 'twentythirteen')); ?>"><?php printf(__('Proudly powered by %s', 'twentythirteen'), 'WordPress'); ?></a> |
|
20 | 20 | </div><!-- .site-info --> |
21 | 21 | </footer><!-- #colophon --> |
22 | 22 | </div><!-- #page --> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
12 | 12 | <header class="entry-header"> |
13 | - <?php if ( is_single() ) : ?> |
|
13 | + <?php if (is_single()) : ?> |
|
14 | 14 | <h1 class="entry-title"><?php the_title(); ?></h1> |
15 | 15 | <?php else : ?> |
16 | 16 | <h1 class="entry-title"> |
@@ -22,27 +22,27 @@ discard block |
||
22 | 22 | <div class="entry-content"> |
23 | 23 | <?php |
24 | 24 | /* translators: %s: Name of current post */ |
25 | - the_content( sprintf( |
|
26 | - __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen' ), |
|
27 | - the_title( '<span class="screen-reader-text">', '</span>', false ) |
|
28 | - ) ); |
|
25 | + the_content(sprintf( |
|
26 | + __('Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen'), |
|
27 | + the_title('<span class="screen-reader-text">', '</span>', false) |
|
28 | + )); |
|
29 | 29 | |
30 | - wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); |
|
30 | + wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">'.__('Pages:', 'twentythirteen').'</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); |
|
31 | 31 | ?> |
32 | 32 | </div><!-- .entry-content --> |
33 | 33 | |
34 | 34 | <footer class="entry-meta"> |
35 | 35 | <?php twentythirteen_entry_meta(); ?> |
36 | 36 | |
37 | - <?php if ( comments_open() && ! is_single() ) : ?> |
|
37 | + <?php if (comments_open() && ! is_single()) : ?> |
|
38 | 38 | <span class="comments-link"> |
39 | - <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?> |
|
39 | + <?php comments_popup_link('<span class="leave-reply">'.__('Leave a comment', 'twentythirteen').'</span>', __('One comment so far', 'twentythirteen'), __('View all % comments', 'twentythirteen')); ?> |
|
40 | 40 | </span><!-- .comments-link --> |
41 | 41 | <?php endif; // comments_open() ?> |
42 | - <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?> |
|
42 | + <?php edit_post_link(__('Edit', 'twentythirteen'), '<span class="edit-link">', '</span>'); ?> |
|
43 | 43 | |
44 | - <?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?> |
|
45 | - <?php get_template_part( 'author-bio' ); ?> |
|
44 | + <?php if (is_single() && get_the_author_meta('description') && is_multi_author()) : ?> |
|
45 | + <?php get_template_part('author-bio'); ?> |
|
46 | 46 | <?php endif; ?> |
47 | 47 | </footer><!-- .entry-meta --> |
48 | 48 | </article><!-- #post --> |
@@ -12,9 +12,12 @@ |
||
12 | 12 | <header class="entry-header"> |
13 | 13 | <?php if ( is_single() ) : ?> |
14 | 14 | <h1 class="entry-title"><?php the_title(); ?></h1> |
15 | - <?php else : ?> |
|
15 | + <?php else { |
|
16 | + : ?> |
|
16 | 17 | <h1 class="entry-title"> |
17 | - <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
|
18 | + <a href="<?php the_permalink(); |
|
19 | +} |
|
20 | +?>" rel="bookmark"><?php the_title(); ?></a> |
|
18 | 21 | </h1> |
19 | 22 | <?php endif; // is_single() ?> |
20 | 23 | </header><!-- .entry-header --> |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since Twenty Fifteen 1.0 |
32 | 32 | */ |
33 | -if ( ! isset( $content_width ) ) { |
|
33 | +if ( ! isset($content_width)) { |
|
34 | 34 | $content_width = 660; |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Twenty Fifteen only works in WordPress 4.1 or later. |
39 | 39 | */ |
40 | -if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) { |
|
41 | - require get_template_directory() . '/inc/back-compat.php'; |
|
40 | +if (version_compare($GLOBALS['wp_version'], '4.1-alpha', '<')) { |
|
41 | + require get_template_directory().'/inc/back-compat.php'; |
|
42 | 42 | } |
43 | 43 | |
44 | -if ( ! function_exists( 'twentyfifteen_setup' ) ) : |
|
44 | +if ( ! function_exists('twentyfifteen_setup')) : |
|
45 | 45 | /** |
46 | 46 | * Sets up theme defaults and registers support for various WordPress features. |
47 | 47 | * |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * If you're building a theme based on twentyfifteen, use a find and replace |
60 | 60 | * to change 'twentyfifteen' to the name of your theme in all the template files |
61 | 61 | */ |
62 | - load_theme_textdomain( 'twentyfifteen', get_template_directory() . '/languages' ); |
|
62 | + load_theme_textdomain('twentyfifteen', get_template_directory().'/languages'); |
|
63 | 63 | |
64 | 64 | // Add default posts and comments RSS feed links to head. |
65 | - add_theme_support( 'automatic-feed-links' ); |
|
65 | + add_theme_support('automatic-feed-links'); |
|
66 | 66 | |
67 | 67 | /* |
68 | 68 | * Let WordPress manage the document title. |
@@ -70,64 +70,64 @@ discard block |
||
70 | 70 | * hard-coded <title> tag in the document head, and expect WordPress to |
71 | 71 | * provide it for us. |
72 | 72 | */ |
73 | - add_theme_support( 'title-tag' ); |
|
73 | + add_theme_support('title-tag'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * Enable support for Post Thumbnails on posts and pages. |
77 | 77 | * |
78 | 78 | * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
79 | 79 | */ |
80 | - add_theme_support( 'post-thumbnails' ); |
|
81 | - set_post_thumbnail_size( 825, 510, true ); |
|
80 | + add_theme_support('post-thumbnails'); |
|
81 | + set_post_thumbnail_size(825, 510, true); |
|
82 | 82 | |
83 | 83 | // This theme uses wp_nav_menu() in two locations. |
84 | - register_nav_menus( array( |
|
85 | - 'primary' => __( 'Primary Menu', 'twentyfifteen' ), |
|
86 | - 'social' => __( 'Social Links Menu', 'twentyfifteen' ), |
|
87 | - ) ); |
|
84 | + register_nav_menus(array( |
|
85 | + 'primary' => __('Primary Menu', 'twentyfifteen'), |
|
86 | + 'social' => __('Social Links Menu', 'twentyfifteen'), |
|
87 | + )); |
|
88 | 88 | |
89 | 89 | /* |
90 | 90 | * Switch default core markup for search form, comment form, and comments |
91 | 91 | * to output valid HTML5. |
92 | 92 | */ |
93 | - add_theme_support( 'html5', array( |
|
93 | + add_theme_support('html5', array( |
|
94 | 94 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | |
97 | 97 | /* |
98 | 98 | * Enable support for Post Formats. |
99 | 99 | * |
100 | 100 | * See: https://codex.wordpress.org/Post_Formats |
101 | 101 | */ |
102 | - add_theme_support( 'post-formats', array( |
|
102 | + add_theme_support('post-formats', array( |
|
103 | 103 | 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' |
104 | - ) ); |
|
104 | + )); |
|
105 | 105 | |
106 | 106 | /* |
107 | 107 | * Enable support for custom logo. |
108 | 108 | * |
109 | 109 | * @since Twenty Fifteen 1.5 |
110 | 110 | */ |
111 | - add_image_size( 'twentyfifteen-logo', 248, 248 ); |
|
112 | - add_theme_support( 'custom-logo', array( 'size' => 'twentyfifteen-logo' ) ); |
|
111 | + add_image_size('twentyfifteen-logo', 248, 248); |
|
112 | + add_theme_support('custom-logo', array('size' => 'twentyfifteen-logo')); |
|
113 | 113 | |
114 | 114 | $color_scheme = twentyfifteen_get_color_scheme(); |
115 | - $default_color = trim( $color_scheme[0], '#' ); |
|
115 | + $default_color = trim($color_scheme[0], '#'); |
|
116 | 116 | |
117 | 117 | // Setup the WordPress core custom background feature. |
118 | - add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array( |
|
118 | + add_theme_support('custom-background', apply_filters('twentyfifteen_custom_background_args', array( |
|
119 | 119 | 'default-color' => $default_color, |
120 | 120 | 'default-attachment' => 'fixed', |
121 | - ) ) ); |
|
121 | + ))); |
|
122 | 122 | |
123 | 123 | /* |
124 | 124 | * This theme styles the visual editor to resemble the theme style, |
125 | 125 | * specifically font, colors, icons, and column width. |
126 | 126 | */ |
127 | - add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); |
|
127 | + add_editor_style(array('css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url())); |
|
128 | 128 | } |
129 | 129 | endif; // twentyfifteen_setup |
130 | -add_action( 'after_setup_theme', 'twentyfifteen_setup' ); |
|
130 | +add_action('after_setup_theme', 'twentyfifteen_setup'); |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * Register widget area. |
@@ -137,19 +137,19 @@ discard block |
||
137 | 137 | * @link https://codex.wordpress.org/Function_Reference/register_sidebar |
138 | 138 | */ |
139 | 139 | function twentyfifteen_widgets_init() { |
140 | - register_sidebar( array( |
|
141 | - 'name' => __( 'Widget Area', 'twentyfifteen' ), |
|
140 | + register_sidebar(array( |
|
141 | + 'name' => __('Widget Area', 'twentyfifteen'), |
|
142 | 142 | 'id' => 'sidebar-1', |
143 | - 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ), |
|
143 | + 'description' => __('Add widgets here to appear in your sidebar.', 'twentyfifteen'), |
|
144 | 144 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
145 | 145 | 'after_widget' => '</aside>', |
146 | 146 | 'before_title' => '<h2 class="widget-title">', |
147 | 147 | 'after_title' => '</h2>', |
148 | - ) ); |
|
148 | + )); |
|
149 | 149 | } |
150 | -add_action( 'widgets_init', 'twentyfifteen_widgets_init' ); |
|
150 | +add_action('widgets_init', 'twentyfifteen_widgets_init'); |
|
151 | 151 | |
152 | -if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : |
|
152 | +if ( ! function_exists('twentyfifteen_fonts_url')) : |
|
153 | 153 | /** |
154 | 154 | * Register Google fonts for Twenty Fifteen. |
155 | 155 | * |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * Translators: If there are characters in your language that are not supported |
167 | 167 | * by Noto Sans, translate this to 'off'. Do not translate into your own language. |
168 | 168 | */ |
169 | - if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { |
|
169 | + if ('off' !== _x('on', 'Noto Sans font: on or off', 'twentyfifteen')) { |
|
170 | 170 | $fonts[] = 'Noto Sans:400italic,700italic,400,700'; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Translators: If there are characters in your language that are not supported |
175 | 175 | * by Noto Serif, translate this to 'off'. Do not translate into your own language. |
176 | 176 | */ |
177 | - if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { |
|
177 | + if ('off' !== _x('on', 'Noto Serif font: on or off', 'twentyfifteen')) { |
|
178 | 178 | $fonts[] = 'Noto Serif:400italic,700italic,400,700'; |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Translators: If there are characters in your language that are not supported |
183 | 183 | * by Inconsolata, translate this to 'off'. Do not translate into your own language. |
184 | 184 | */ |
185 | - if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { |
|
185 | + if ('off' !== _x('on', 'Inconsolata font: on or off', 'twentyfifteen')) { |
|
186 | 186 | $fonts[] = 'Inconsolata:400,700'; |
187 | 187 | } |
188 | 188 | |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | * Translators: To add an additional character subset specific to your language, |
191 | 191 | * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. |
192 | 192 | */ |
193 | - $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); |
|
193 | + $subset = _x('no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen'); |
|
194 | 194 | |
195 | - if ( 'cyrillic' == $subset ) { |
|
195 | + if ('cyrillic' == $subset) { |
|
196 | 196 | $subsets .= ',cyrillic,cyrillic-ext'; |
197 | - } elseif ( 'greek' == $subset ) { |
|
197 | + } elseif ('greek' == $subset) { |
|
198 | 198 | $subsets .= ',greek,greek-ext'; |
199 | - } elseif ( 'devanagari' == $subset ) { |
|
199 | + } elseif ('devanagari' == $subset) { |
|
200 | 200 | $subsets .= ',devanagari'; |
201 | - } elseif ( 'vietnamese' == $subset ) { |
|
201 | + } elseif ('vietnamese' == $subset) { |
|
202 | 202 | $subsets .= ',vietnamese'; |
203 | 203 | } |
204 | 204 | |
205 | - if ( $fonts ) { |
|
206 | - $fonts_url = add_query_arg( array( |
|
207 | - 'family' => urlencode( implode( '|', $fonts ) ), |
|
208 | - 'subset' => urlencode( $subsets ), |
|
209 | - ), 'https://fonts.googleapis.com/css' ); |
|
205 | + if ($fonts) { |
|
206 | + $fonts_url = add_query_arg(array( |
|
207 | + 'family' => urlencode(implode('|', $fonts)), |
|
208 | + 'subset' => urlencode($subsets), |
|
209 | + ), 'https://fonts.googleapis.com/css'); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | return $fonts_url; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | function twentyfifteen_javascript_detection() { |
224 | 224 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
225 | 225 | } |
226 | -add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 ); |
|
226 | +add_action('wp_head', 'twentyfifteen_javascript_detection', 0); |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Enqueue scripts and styles. |
@@ -232,39 +232,39 @@ discard block |
||
232 | 232 | */ |
233 | 233 | function twentyfifteen_scripts() { |
234 | 234 | // Add custom fonts, used in the main stylesheet. |
235 | - wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); |
|
235 | + wp_enqueue_style('twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null); |
|
236 | 236 | |
237 | 237 | // Add Genericons, used in the main stylesheet. |
238 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' ); |
|
238 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.2'); |
|
239 | 239 | |
240 | 240 | // Load our main stylesheet. |
241 | - wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() ); |
|
241 | + wp_enqueue_style('twentyfifteen-style', get_stylesheet_uri()); |
|
242 | 242 | |
243 | 243 | // Load the Internet Explorer specific stylesheet. |
244 | - wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
245 | - wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' ); |
|
244 | + wp_enqueue_style('twentyfifteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfifteen-style'), '20141010'); |
|
245 | + wp_style_add_data('twentyfifteen-ie', 'conditional', 'lt IE 9'); |
|
246 | 246 | |
247 | 247 | // Load the Internet Explorer 7 specific stylesheet. |
248 | - wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
249 | - wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' ); |
|
248 | + wp_enqueue_style('twentyfifteen-ie7', get_template_directory_uri().'/css/ie7.css', array('twentyfifteen-style'), '20141010'); |
|
249 | + wp_style_add_data('twentyfifteen-ie7', 'conditional', 'lt IE 8'); |
|
250 | 250 | |
251 | - wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true ); |
|
251 | + wp_enqueue_script('twentyfifteen-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20141010', true); |
|
252 | 252 | |
253 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
254 | - wp_enqueue_script( 'comment-reply' ); |
|
253 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
254 | + wp_enqueue_script('comment-reply'); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( is_singular() && wp_attachment_is_image() ) { |
|
258 | - wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' ); |
|
257 | + if (is_singular() && wp_attachment_is_image()) { |
|
258 | + wp_enqueue_script('twentyfifteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20141010'); |
|
259 | 259 | } |
260 | 260 | |
261 | - wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); |
|
262 | - wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array( |
|
263 | - 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', |
|
264 | - 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', |
|
265 | - ) ); |
|
261 | + wp_enqueue_script('twentyfifteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150330', true); |
|
262 | + wp_localize_script('twentyfifteen-script', 'screenReaderText', array( |
|
263 | + 'expand' => '<span class="screen-reader-text">'.__('expand child menu', 'twentyfifteen').'</span>', |
|
264 | + 'collapse' => '<span class="screen-reader-text">'.__('collapse child menu', 'twentyfifteen').'</span>', |
|
265 | + )); |
|
266 | 266 | } |
267 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); |
|
267 | +add_action('wp_enqueue_scripts', 'twentyfifteen_scripts'); |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Add featured image as background image to post navigation elements. |
@@ -274,39 +274,39 @@ discard block |
||
274 | 274 | * @see wp_add_inline_style() |
275 | 275 | */ |
276 | 276 | function twentyfifteen_post_nav_background() { |
277 | - if ( ! is_single() ) { |
|
277 | + if ( ! is_single()) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
282 | - $next = get_adjacent_post( false, '', false ); |
|
281 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
282 | + $next = get_adjacent_post(false, '', false); |
|
283 | 283 | $css = ''; |
284 | 284 | |
285 | - if ( is_attachment() && 'attachment' == $previous->post_type ) { |
|
285 | + if (is_attachment() && 'attachment' == $previous->post_type) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | 288 | |
289 | - if ( $previous && has_post_thumbnail( $previous->ID ) ) { |
|
290 | - $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' ); |
|
289 | + if ($previous && has_post_thumbnail($previous->ID)) { |
|
290 | + $prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail'); |
|
291 | 291 | $css .= ' |
292 | - .post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); } |
|
292 | + .post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]).'); } |
|
293 | 293 | .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; } |
294 | 294 | .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); } |
295 | 295 | '; |
296 | 296 | } |
297 | 297 | |
298 | - if ( $next && has_post_thumbnail( $next->ID ) ) { |
|
299 | - $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' ); |
|
298 | + if ($next && has_post_thumbnail($next->ID)) { |
|
299 | + $nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail'); |
|
300 | 300 | $css .= ' |
301 | - .post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; } |
|
301 | + .post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]).'); border-top: 0; } |
|
302 | 302 | .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; } |
303 | 303 | .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); } |
304 | 304 | '; |
305 | 305 | } |
306 | 306 | |
307 | - wp_add_inline_style( 'twentyfifteen-style', $css ); |
|
307 | + wp_add_inline_style('twentyfifteen-style', $css); |
|
308 | 308 | } |
309 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' ); |
|
309 | +add_action('wp_enqueue_scripts', 'twentyfifteen_post_nav_background'); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Display descriptions in main navigation. |
@@ -319,14 +319,14 @@ discard block |
||
319 | 319 | * @param array $args wp_nav_menu() arguments. |
320 | 320 | * @return string Menu item with possible description. |
321 | 321 | */ |
322 | -function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) { |
|
323 | - if ( 'primary' == $args->theme_location && $item->description ) { |
|
324 | - $item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output ); |
|
322 | +function twentyfifteen_nav_description($item_output, $item, $depth, $args) { |
|
323 | + if ('primary' == $args->theme_location && $item->description) { |
|
324 | + $item_output = str_replace($args->link_after.'</a>', '<div class="menu-item-description">'.$item->description.'</div>'.$args->link_after.'</a>', $item_output); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | return $item_output; |
328 | 328 | } |
329 | -add_filter( 'walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4 ); |
|
329 | +add_filter('walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Add a `screen-reader-text` class to the search form's submit button. |
@@ -336,28 +336,28 @@ discard block |
||
336 | 336 | * @param string $html Search form HTML. |
337 | 337 | * @return string Modified search form HTML. |
338 | 338 | */ |
339 | -function twentyfifteen_search_form_modify( $html ) { |
|
340 | - return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html ); |
|
339 | +function twentyfifteen_search_form_modify($html) { |
|
340 | + return str_replace('class="search-submit"', 'class="search-submit screen-reader-text"', $html); |
|
341 | 341 | } |
342 | -add_filter( 'get_search_form', 'twentyfifteen_search_form_modify' ); |
|
342 | +add_filter('get_search_form', 'twentyfifteen_search_form_modify'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Implement the Custom Header feature. |
346 | 346 | * |
347 | 347 | * @since Twenty Fifteen 1.0 |
348 | 348 | */ |
349 | -require get_template_directory() . '/inc/custom-header.php'; |
|
349 | +require get_template_directory().'/inc/custom-header.php'; |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Custom template tags for this theme. |
353 | 353 | * |
354 | 354 | * @since Twenty Fifteen 1.0 |
355 | 355 | */ |
356 | -require get_template_directory() . '/inc/template-tags.php'; |
|
356 | +require get_template_directory().'/inc/template-tags.php'; |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Customizer additions. |
360 | 360 | * |
361 | 361 | * @since Twenty Fifteen 1.0 |
362 | 362 | */ |
363 | -require get_template_directory() . '/inc/customizer.php'; |
|
363 | +require get_template_directory().'/inc/customizer.php'; |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Template Name: Full-width Page Template, No Sidebar |
|
4 | - * |
|
5 | - * Description: Twenty Twelve loves the no-sidebar look as much as |
|
6 | - * you do. Use this page template to remove the sidebar from any page. |
|
7 | - * |
|
8 | - * Tip: to remove the sidebar from all posts and pages simply remove |
|
9 | - * any active widgets from the Main Sidebar area, and the sidebar will |
|
10 | - * disappear everywhere. |
|
11 | - * |
|
12 | - * @package WordPress |
|
13 | - * @subpackage Twenty_Twelve |
|
14 | - * @since Twenty Twelve 1.0 |
|
15 | - */ |
|
3 | + * Template Name: Full-width Page Template, No Sidebar |
|
4 | + * |
|
5 | + * Description: Twenty Twelve loves the no-sidebar look as much as |
|
6 | + * you do. Use this page template to remove the sidebar from any page. |
|
7 | + * |
|
8 | + * Tip: to remove the sidebar from all posts and pages simply remove |
|
9 | + * any active widgets from the Main Sidebar area, and the sidebar will |
|
10 | + * disappear everywhere. |
|
11 | + * |
|
12 | + * @package WordPress |
|
13 | + * @subpackage Twenty_Twelve |
|
14 | + * @since Twenty Twelve 1.0 |
|
15 | + */ |
|
16 | 16 | |
17 | 17 | get_header(); ?> |
18 | 18 |
@@ -17,9 +17,9 @@ |
||
17 | 17 | <div id="primary" class="site-content"> |
18 | 18 | <div id="content" role="main"> |
19 | 19 | |
20 | - <?php while ( have_posts() ) : the_post(); ?> |
|
21 | - <?php get_template_part( 'content', 'page' ); ?> |
|
22 | - <?php comments_template( '', true ); ?> |
|
20 | + <?php while (have_posts()) : the_post(); ?> |
|
21 | + <?php get_template_part('content', 'page'); ?> |
|
22 | + <?php comments_template('', true); ?> |
|
23 | 23 | <?php endwhile; // end of the loop. ?> |
24 | 24 | |
25 | 25 | </div><!-- #content --> |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | |
21 | 21 | /** Define ABSPATH as this file's directory */ |
22 | -define( 'ABSPATH', dirname(__FILE__) . '/' ); |
|
22 | +define('ABSPATH', dirname(__FILE__).'/'); |
|
23 | 23 | |
24 | -error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|
24 | +error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|
25 | 25 | |
26 | 26 | /* |
27 | 27 | * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php |
@@ -31,63 +31,63 @@ discard block |
||
31 | 31 | * |
32 | 32 | * If neither set of conditions is true, initiate loading the setup process. |
33 | 33 | */ |
34 | -if ( file_exists( ABSPATH . 'wp-config.php') ) { |
|
34 | +if (file_exists(ABSPATH.'wp-config.php')) { |
|
35 | 35 | |
36 | 36 | /** The config file resides in ABSPATH */ |
37 | - require_once( ABSPATH . 'wp-config.php' ); |
|
37 | + require_once(ABSPATH.'wp-config.php'); |
|
38 | 38 | |
39 | -} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) { |
|
39 | +} elseif (@file_exists(dirname(ABSPATH).'/wp-config.php') && ! @file_exists(dirname(ABSPATH).'/wp-settings.php')) { |
|
40 | 40 | |
41 | 41 | /** The config file resides one level above ABSPATH but is not part of another install */ |
42 | - require_once( dirname( ABSPATH ) . '/wp-config.php' ); |
|
42 | + require_once(dirname(ABSPATH).'/wp-config.php'); |
|
43 | 43 | |
44 | 44 | } else { |
45 | 45 | |
46 | 46 | // A config file doesn't exist |
47 | 47 | |
48 | - define( 'WPINC', 'wp-includes' ); |
|
49 | - require_once( ABSPATH . WPINC . '/load.php' ); |
|
48 | + define('WPINC', 'wp-includes'); |
|
49 | + require_once(ABSPATH.WPINC.'/load.php'); |
|
50 | 50 | |
51 | 51 | // Standardize $_SERVER variables across setups. |
52 | 52 | wp_fix_server_vars(); |
53 | 53 | |
54 | - require_once( ABSPATH . WPINC . '/functions.php' ); |
|
54 | + require_once(ABSPATH.WPINC.'/functions.php'); |
|
55 | 55 | |
56 | - $path = wp_guess_url() . '/wp-admin/setup-config.php'; |
|
56 | + $path = wp_guess_url().'/wp-admin/setup-config.php'; |
|
57 | 57 | |
58 | 58 | /* |
59 | 59 | * We're going to redirect to setup-config.php. While this shouldn't result |
60 | 60 | * in an infinite loop, that's a silly thing to assume, don't you think? If |
61 | 61 | * we're traveling in circles, our last-ditch effort is "Need more help?" |
62 | 62 | */ |
63 | - if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) { |
|
64 | - header( 'Location: ' . $path ); |
|
63 | + if (false === strpos($_SERVER['REQUEST_URI'], 'setup-config')) { |
|
64 | + header('Location: '.$path); |
|
65 | 65 | exit; |
66 | 66 | } |
67 | 67 | |
68 | - define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); |
|
69 | - require_once( ABSPATH . WPINC . '/version.php' ); |
|
68 | + define('WP_CONTENT_DIR', ABSPATH.'wp-content'); |
|
69 | + require_once(ABSPATH.WPINC.'/version.php'); |
|
70 | 70 | |
71 | 71 | wp_check_php_mysql_versions(); |
72 | 72 | wp_load_translations_early(); |
73 | 73 | |
74 | 74 | // Die with an error message |
75 | - $die = sprintf( |
|
75 | + $die = sprintf( |
|
76 | 76 | /* translators: %s: wp-config.php */ |
77 | - __( "There doesn't seem to be a %s file. I need this before we can get started." ), |
|
77 | + __("There doesn't seem to be a %s file. I need this before we can get started."), |
|
78 | 78 | '<code>wp-config.php</code>' |
79 | - ) . '</p>'; |
|
80 | - $die .= '<p>' . sprintf( |
|
79 | + ).'</p>'; |
|
80 | + $die .= '<p>'.sprintf( |
|
81 | 81 | /* translators: %s: Codex URL */ |
82 | - __( "Need more help? <a href='%s'>We got it</a>." ), |
|
83 | - __( 'https://codex.wordpress.org/Editing_wp-config.php' ) |
|
84 | - ) . '</p>'; |
|
85 | - $die .= '<p>' . sprintf( |
|
82 | + __("Need more help? <a href='%s'>We got it</a>."), |
|
83 | + __('https://codex.wordpress.org/Editing_wp-config.php') |
|
84 | + ).'</p>'; |
|
85 | + $die .= '<p>'.sprintf( |
|
86 | 86 | /* translators: %s: wp-config.php */ |
87 | - __( "You can create a %s file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ), |
|
87 | + __("You can create a %s file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file."), |
|
88 | 88 | '<code>wp-config.php</code>' |
89 | - ) . '</p>'; |
|
90 | - $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>'; |
|
89 | + ).'</p>'; |
|
90 | + $die .= '<p><a href="'.$path.'" class="button button-large">'.__("Create a Configuration File").'</a>'; |
|
91 | 91 | |
92 | - wp_die( $die, __( 'WordPress › Error' ) ); |
|
92 | + wp_die($die, __('WordPress › Error')); |
|
93 | 93 | } |
@@ -7,90 +7,90 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( !current_user_can('upload_files') ) |
|
13 | - wp_die( __( 'You do not have permission to upload files.' ) ); |
|
12 | +if ( ! current_user_can('upload_files')) |
|
13 | + wp_die(__('You do not have permission to upload files.')); |
|
14 | 14 | |
15 | -$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid'; |
|
16 | -$modes = array( 'grid', 'list' ); |
|
15 | +$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid'; |
|
16 | +$modes = array('grid', 'list'); |
|
17 | 17 | |
18 | -if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) { |
|
18 | +if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) { |
|
19 | 19 | $mode = $_GET['mode']; |
20 | - update_user_option( get_current_user_id(), 'media_library_mode', $mode ); |
|
20 | + update_user_option(get_current_user_id(), 'media_library_mode', $mode); |
|
21 | 21 | } |
22 | 22 | |
23 | -if ( 'grid' === $mode ) { |
|
23 | +if ('grid' === $mode) { |
|
24 | 24 | wp_enqueue_media(); |
25 | - wp_enqueue_script( 'media-grid' ); |
|
26 | - wp_enqueue_script( 'media' ); |
|
25 | + wp_enqueue_script('media-grid'); |
|
26 | + wp_enqueue_script('media'); |
|
27 | 27 | |
28 | - remove_action( 'admin_head', 'wp_admin_canonical_url' ); |
|
28 | + remove_action('admin_head', 'wp_admin_canonical_url'); |
|
29 | 29 | |
30 | 30 | $q = $_GET; |
31 | 31 | // let JS handle this |
32 | - unset( $q['s'] ); |
|
33 | - $vars = wp_edit_attachments_query_vars( $q ); |
|
34 | - $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); |
|
35 | - foreach ( $vars as $key => $value ) { |
|
36 | - if ( ! $value || in_array( $key, $ignore ) ) { |
|
37 | - unset( $vars[ $key ] ); |
|
32 | + unset($q['s']); |
|
33 | + $vars = wp_edit_attachments_query_vars($q); |
|
34 | + $ignore = array('mode', 'post_type', 'post_status', 'posts_per_page'); |
|
35 | + foreach ($vars as $key => $value) { |
|
36 | + if ( ! $value || in_array($key, $ignore)) { |
|
37 | + unset($vars[$key]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | - wp_localize_script( 'media-grid', '_wpMediaGridSettings', array( |
|
42 | - 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
|
41 | + wp_localize_script('media-grid', '_wpMediaGridSettings', array( |
|
42 | + 'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH), |
|
43 | 43 | 'queryVars' => (object) $vars |
44 | - ) ); |
|
44 | + )); |
|
45 | 45 | |
46 | - get_current_screen()->add_help_tab( array( |
|
46 | + get_current_screen()->add_help_tab(array( |
|
47 | 47 | 'id' => 'overview', |
48 | - 'title' => __( 'Overview' ), |
|
48 | + 'title' => __('Overview'), |
|
49 | 49 | 'content' => |
50 | - '<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' . |
|
51 | - '<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' . |
|
52 | - '<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>' |
|
53 | - ) ); |
|
50 | + '<p>'.__('All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.').'</p>'. |
|
51 | + '<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'. |
|
52 | + '<p>'.__('To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.').'</p>' |
|
53 | + )); |
|
54 | 54 | |
55 | - get_current_screen()->add_help_tab( array( |
|
55 | + get_current_screen()->add_help_tab(array( |
|
56 | 56 | 'id' => 'attachment-details', |
57 | - 'title' => __( 'Attachment Details' ), |
|
57 | + 'title' => __('Attachment Details'), |
|
58 | 58 | 'content' => |
59 | - '<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' . |
|
60 | - '<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' . |
|
61 | - '<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>' |
|
62 | - ) ); |
|
59 | + '<p>'.__('Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.').'</p>'. |
|
60 | + '<p>'.__('Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.').'</p>'. |
|
61 | + '<p>'.__('You can also delete individual items and access the extended edit screen from the details dialog.').'</p>' |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | get_current_screen()->set_help_sidebar( |
65 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
66 | - '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' . |
|
67 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
65 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
66 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'. |
|
67 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | $title = __('Media Library'); |
71 | 71 | $parent_file = 'upload.php'; |
72 | 72 | |
73 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
73 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
74 | 74 | ?> |
75 | 75 | <div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>"> |
76 | 76 | <h1> |
77 | 77 | <?php |
78 | - echo esc_html( $title ); |
|
79 | - if ( current_user_can( 'upload_files' ) ) { ?> |
|
80 | - <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php |
|
78 | + echo esc_html($title); |
|
79 | + if (current_user_can('upload_files')) { ?> |
|
80 | + <a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php |
|
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | </h1> |
84 | 84 | <div class="error hide-if-js"> |
85 | 85 | <p><?php printf( |
86 | 86 | /* translators: %s: list view URL */ |
87 | - __( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ), |
|
87 | + __('The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.'), |
|
88 | 88 | 'upload.php?mode=list' |
89 | 89 | ); ?></p> |
90 | 90 | </div> |
91 | 91 | </div> |
92 | 92 | <?php |
93 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
93 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
94 | 94 | exit; |
95 | 95 | } |
96 | 96 | |
@@ -100,75 +100,75 @@ discard block |
||
100 | 100 | // Handle bulk actions |
101 | 101 | $doaction = $wp_list_table->current_action(); |
102 | 102 | |
103 | -if ( $doaction ) { |
|
103 | +if ($doaction) { |
|
104 | 104 | check_admin_referer('bulk-media'); |
105 | 105 | |
106 | - if ( 'delete_all' == $doaction ) { |
|
107 | - $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); |
|
106 | + if ('delete_all' == $doaction) { |
|
107 | + $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'"); |
|
108 | 108 | $doaction = 'delete'; |
109 | - } elseif ( isset( $_REQUEST['media'] ) ) { |
|
109 | + } elseif (isset($_REQUEST['media'])) { |
|
110 | 110 | $post_ids = $_REQUEST['media']; |
111 | - } elseif ( isset( $_REQUEST['ids'] ) ) { |
|
112 | - $post_ids = explode( ',', $_REQUEST['ids'] ); |
|
111 | + } elseif (isset($_REQUEST['ids'])) { |
|
112 | + $post_ids = explode(',', $_REQUEST['ids']); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $location = 'upload.php'; |
116 | - if ( $referer = wp_get_referer() ) { |
|
117 | - if ( false !== strpos( $referer, 'upload.php' ) ) |
|
118 | - $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); |
|
116 | + if ($referer = wp_get_referer()) { |
|
117 | + if (false !== strpos($referer, 'upload.php')) |
|
118 | + $location = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer); |
|
119 | 119 | } |
120 | 120 | |
121 | - switch ( $doaction ) { |
|
121 | + switch ($doaction) { |
|
122 | 122 | case 'detach': |
123 | - wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' ); |
|
123 | + wp_media_attach_action($_REQUEST['parent_post_id'], 'detach'); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case 'attach': |
127 | - wp_media_attach_action( $_REQUEST['found_post_id'] ); |
|
127 | + wp_media_attach_action($_REQUEST['found_post_id']); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | case 'trash': |
131 | - if ( !isset( $post_ids ) ) |
|
131 | + if ( ! isset($post_ids)) |
|
132 | 132 | break; |
133 | - foreach ( (array) $post_ids as $post_id ) { |
|
134 | - if ( !current_user_can( 'delete_post', $post_id ) ) |
|
135 | - wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
133 | + foreach ((array) $post_ids as $post_id) { |
|
134 | + if ( ! current_user_can('delete_post', $post_id)) |
|
135 | + wp_die(__('You are not allowed to move this item to the Trash.')); |
|
136 | 136 | |
137 | - if ( !wp_trash_post( $post_id ) ) |
|
138 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
137 | + if ( ! wp_trash_post($post_id)) |
|
138 | + wp_die(__('Error in moving to Trash.')); |
|
139 | 139 | } |
140 | - $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); |
|
140 | + $location = add_query_arg(array('trashed' => count($post_ids), 'ids' => join(',', $post_ids)), $location); |
|
141 | 141 | break; |
142 | 142 | case 'untrash': |
143 | - if ( !isset( $post_ids ) ) |
|
143 | + if ( ! isset($post_ids)) |
|
144 | 144 | break; |
145 | - foreach ( (array) $post_ids as $post_id ) { |
|
146 | - if ( !current_user_can( 'delete_post', $post_id ) ) |
|
147 | - wp_die( __( 'You are not allowed to move this item out of the Trash.' ) ); |
|
145 | + foreach ((array) $post_ids as $post_id) { |
|
146 | + if ( ! current_user_can('delete_post', $post_id)) |
|
147 | + wp_die(__('You are not allowed to move this item out of the Trash.')); |
|
148 | 148 | |
149 | - if ( !wp_untrash_post( $post_id ) ) |
|
150 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
149 | + if ( ! wp_untrash_post($post_id)) |
|
150 | + wp_die(__('Error in restoring from Trash.')); |
|
151 | 151 | } |
152 | - $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
|
152 | + $location = add_query_arg('untrashed', count($post_ids), $location); |
|
153 | 153 | break; |
154 | 154 | case 'delete': |
155 | - if ( !isset( $post_ids ) ) |
|
155 | + if ( ! isset($post_ids)) |
|
156 | 156 | break; |
157 | - foreach ( (array) $post_ids as $post_id_del ) { |
|
158 | - if ( !current_user_can( 'delete_post', $post_id_del ) ) |
|
159 | - wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
157 | + foreach ((array) $post_ids as $post_id_del) { |
|
158 | + if ( ! current_user_can('delete_post', $post_id_del)) |
|
159 | + wp_die(__('You are not allowed to delete this item.')); |
|
160 | 160 | |
161 | - if ( !wp_delete_attachment( $post_id_del ) ) |
|
162 | - wp_die( __( 'Error in deleting.' ) ); |
|
161 | + if ( ! wp_delete_attachment($post_id_del)) |
|
162 | + wp_die(__('Error in deleting.')); |
|
163 | 163 | } |
164 | - $location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
|
164 | + $location = add_query_arg('deleted', count($post_ids), $location); |
|
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - wp_redirect( $location ); |
|
168 | + wp_redirect($location); |
|
169 | 169 | exit; |
170 | -} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
171 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
170 | +} elseif ( ! empty($_GET['_wp_http_referer'])) { |
|
171 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
172 | 172 | exit; |
173 | 173 | } |
174 | 174 | |
@@ -177,135 +177,135 @@ discard block |
||
177 | 177 | $title = __('Media Library'); |
178 | 178 | $parent_file = 'upload.php'; |
179 | 179 | |
180 | -wp_enqueue_script( 'media' ); |
|
180 | +wp_enqueue_script('media'); |
|
181 | 181 | |
182 | -add_screen_option( 'per_page' ); |
|
182 | +add_screen_option('per_page'); |
|
183 | 183 | |
184 | -get_current_screen()->add_help_tab( array( |
|
184 | +get_current_screen()->add_help_tab(array( |
|
185 | 185 | 'id' => 'overview', |
186 | 186 | 'title' => __('Overview'), |
187 | 187 | 'content' => |
188 | - '<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' . |
|
189 | - '<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' . |
|
190 | - '<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' |
|
191 | -) ); |
|
192 | -get_current_screen()->add_help_tab( array( |
|
188 | + '<p>'.__('All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.').'</p>'. |
|
189 | + '<p>'.__('You can narrow the list by file type/status or by date using the dropdown menus above the media table.').'</p>'. |
|
190 | + '<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>' |
|
191 | +)); |
|
192 | +get_current_screen()->add_help_tab(array( |
|
193 | 193 | 'id' => 'actions-links', |
194 | 194 | 'title' => __('Available Actions'), |
195 | 195 | 'content' => |
196 | - '<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>' |
|
197 | -) ); |
|
198 | -get_current_screen()->add_help_tab( array( |
|
196 | + '<p>'.__('Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.').'</p>' |
|
197 | +)); |
|
198 | +get_current_screen()->add_help_tab(array( |
|
199 | 199 | 'id' => 'attaching-files', |
200 | 200 | 'title' => __('Attaching Files'), |
201 | 201 | 'content' => |
202 | - '<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>' |
|
203 | -) ); |
|
202 | + '<p>'.__('If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.').'</p>' |
|
203 | +)); |
|
204 | 204 | |
205 | 205 | get_current_screen()->set_help_sidebar( |
206 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
207 | - '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' . |
|
208 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
206 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
207 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'. |
|
208 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
209 | 209 | ); |
210 | 210 | |
211 | -get_current_screen()->set_screen_reader_content( array( |
|
212 | - 'heading_views' => __( 'Filter media items list' ), |
|
213 | - 'heading_pagination' => __( 'Media items list navigation' ), |
|
214 | - 'heading_list' => __( 'Media items list' ), |
|
215 | -) ); |
|
211 | +get_current_screen()->set_screen_reader_content(array( |
|
212 | + 'heading_views' => __('Filter media items list'), |
|
213 | + 'heading_pagination' => __('Media items list navigation'), |
|
214 | + 'heading_list' => __('Media items list'), |
|
215 | +)); |
|
216 | 216 | |
217 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
217 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
218 | 218 | ?> |
219 | 219 | |
220 | 220 | <div class="wrap"> |
221 | 221 | <h1> |
222 | 222 | <?php |
223 | -echo esc_html( $title ); |
|
224 | -if ( current_user_can( 'upload_files' ) ) { ?> |
|
225 | - <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php |
|
223 | +echo esc_html($title); |
|
224 | +if (current_user_can('upload_files')) { ?> |
|
225 | + <a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php |
|
226 | 226 | } |
227 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
227 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
228 | 228 | /* translators: %s: search keywords */ |
229 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', get_search_query() ); |
|
229 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', get_search_query()); |
|
230 | 230 | } |
231 | 231 | ?> |
232 | 232 | </h1> |
233 | 233 | |
234 | 234 | <?php |
235 | 235 | $message = ''; |
236 | -if ( ! empty( $_GET['posted'] ) ) { |
|
237 | - $message = __( 'Media file updated.' ); |
|
236 | +if ( ! empty($_GET['posted'])) { |
|
237 | + $message = __('Media file updated.'); |
|
238 | 238 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); |
239 | 239 | } |
240 | 240 | |
241 | -if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { |
|
242 | - if ( 1 == $attached ) { |
|
243 | - $message = __( 'Media file attached.' ); |
|
241 | +if ( ! empty($_GET['attached']) && $attached = absint($_GET['attached'])) { |
|
242 | + if (1 == $attached) { |
|
243 | + $message = __('Media file attached.'); |
|
244 | 244 | } else { |
245 | 245 | /* translators: %s: number of media files */ |
246 | - $message = _n( '%s media file attached.', '%s media files attached.', $attached ); |
|
246 | + $message = _n('%s media file attached.', '%s media files attached.', $attached); |
|
247 | 247 | } |
248 | - $message = sprintf( $message, number_format_i18n( $attached ) ); |
|
249 | - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
|
248 | + $message = sprintf($message, number_format_i18n($attached)); |
|
249 | + $_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']); |
|
250 | 250 | } |
251 | 251 | |
252 | -if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { |
|
253 | - if ( 1 == $detached ) { |
|
254 | - $message = __( 'Media file detached.' ); |
|
252 | +if ( ! empty($_GET['detach']) && $detached = absint($_GET['detach'])) { |
|
253 | + if (1 == $detached) { |
|
254 | + $message = __('Media file detached.'); |
|
255 | 255 | } else { |
256 | 256 | /* translators: %s: number of media files */ |
257 | - $message = _n( '%s media file detached.', '%s media files detached.', $detached ); |
|
257 | + $message = _n('%s media file detached.', '%s media files detached.', $detached); |
|
258 | 258 | } |
259 | - $message = sprintf( $message, number_format_i18n( $detached ) ); |
|
260 | - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
|
259 | + $message = sprintf($message, number_format_i18n($detached)); |
|
260 | + $_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']); |
|
261 | 261 | } |
262 | 262 | |
263 | -if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { |
|
264 | - if ( 1 == $deleted ) { |
|
265 | - $message = __( 'Media file permanently deleted.' ); |
|
263 | +if ( ! empty($_GET['deleted']) && $deleted = absint($_GET['deleted'])) { |
|
264 | + if (1 == $deleted) { |
|
265 | + $message = __('Media file permanently deleted.'); |
|
266 | 266 | } else { |
267 | 267 | /* translators: %s: number of media files */ |
268 | - $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); |
|
268 | + $message = _n('%s media file permanently deleted.', '%s media files permanently deleted.', $deleted); |
|
269 | 269 | } |
270 | - $message = sprintf( $message, number_format_i18n( $deleted ) ); |
|
270 | + $message = sprintf($message, number_format_i18n($deleted)); |
|
271 | 271 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); |
272 | 272 | } |
273 | 273 | |
274 | -if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { |
|
275 | - if ( 1 == $trashed ) { |
|
276 | - $message = __( 'Media file moved to the trash.' ); |
|
274 | +if ( ! empty($_GET['trashed']) && $trashed = absint($_GET['trashed'])) { |
|
275 | + if (1 == $trashed) { |
|
276 | + $message = __('Media file moved to the trash.'); |
|
277 | 277 | } else { |
278 | 278 | /* translators: %s: number of media files */ |
279 | - $message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed ); |
|
279 | + $message = _n('%s media file moved to the trash.', '%s media files moved to the trash.', $trashed); |
|
280 | 280 | } |
281 | - $message = sprintf( $message, number_format_i18n( $trashed ) ); |
|
282 | - $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; |
|
281 | + $message = sprintf($message, number_format_i18n($trashed)); |
|
282 | + $message .= ' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>'; |
|
283 | 283 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); |
284 | 284 | } |
285 | 285 | |
286 | -if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { |
|
287 | - if ( 1 == $untrashed ) { |
|
288 | - $message = __( 'Media file restored from the trash.' ); |
|
286 | +if ( ! empty($_GET['untrashed']) && $untrashed = absint($_GET['untrashed'])) { |
|
287 | + if (1 == $untrashed) { |
|
288 | + $message = __('Media file restored from the trash.'); |
|
289 | 289 | } else { |
290 | 290 | /* translators: %s: number of media files */ |
291 | - $message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed ); |
|
291 | + $message = _n('%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed); |
|
292 | 292 | } |
293 | - $message = sprintf( $message, number_format_i18n( $untrashed ) ); |
|
293 | + $message = sprintf($message, number_format_i18n($untrashed)); |
|
294 | 294 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); |
295 | 295 | } |
296 | 296 | |
297 | -$messages[1] = __( 'Media file updated.' ); |
|
298 | -$messages[2] = __( 'Media file permanently deleted.' ); |
|
299 | -$messages[3] = __( 'Error saving media file.' ); |
|
300 | -$messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>'; |
|
301 | -$messages[5] = __( 'Media file restored from the trash.' ); |
|
297 | +$messages[1] = __('Media file updated.'); |
|
298 | +$messages[2] = __('Media file permanently deleted.'); |
|
299 | +$messages[3] = __('Error saving media file.'); |
|
300 | +$messages[4] = __('Media file moved to the trash.').' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>'; |
|
301 | +$messages[5] = __('Media file restored from the trash.'); |
|
302 | 302 | |
303 | -if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { |
|
304 | - $message = $messages[ $_GET['message'] ]; |
|
303 | +if ( ! empty($_GET['message']) && isset($messages[$_GET['message']])) { |
|
304 | + $message = $messages[$_GET['message']]; |
|
305 | 305 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); |
306 | 306 | } |
307 | 307 | |
308 | -if ( !empty($message) ) { ?> |
|
308 | +if ( ! empty($message)) { ?> |
|
309 | 309 | <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> |
310 | 310 | <?php } ?> |
311 | 311 | |
@@ -321,4 +321,4 @@ discard block |
||
321 | 321 | </div> |
322 | 322 | |
323 | 323 | <?php |
324 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
324 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( !current_user_can('upload_files') ) |
|
12 | +if ( !current_user_can('upload_files') ) { |
|
13 | 13 | wp_die( __( 'You do not have permission to upload files.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid'; |
16 | 17 | $modes = array( 'grid', 'list' ); |
@@ -114,8 +115,9 @@ discard block |
||
114 | 115 | |
115 | 116 | $location = 'upload.php'; |
116 | 117 | if ( $referer = wp_get_referer() ) { |
117 | - if ( false !== strpos( $referer, 'upload.php' ) ) |
|
118 | - $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); |
|
118 | + if ( false !== strpos( $referer, 'upload.php' ) ) { |
|
119 | + $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); |
|
120 | + } |
|
119 | 121 | } |
120 | 122 | |
121 | 123 | switch ( $doaction ) { |
@@ -128,38 +130,47 @@ discard block |
||
128 | 130 | break; |
129 | 131 | |
130 | 132 | case 'trash': |
131 | - if ( !isset( $post_ids ) ) |
|
132 | - break; |
|
133 | + if ( !isset( $post_ids ) ) { |
|
134 | + break; |
|
135 | + } |
|
133 | 136 | foreach ( (array) $post_ids as $post_id ) { |
134 | - if ( !current_user_can( 'delete_post', $post_id ) ) |
|
135 | - wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
137 | + if ( !current_user_can( 'delete_post', $post_id ) ) { |
|
138 | + wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
139 | + } |
|
136 | 140 | |
137 | - if ( !wp_trash_post( $post_id ) ) |
|
138 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
141 | + if ( !wp_trash_post( $post_id ) ) { |
|
142 | + wp_die( __( 'Error in moving to Trash.' ) ); |
|
143 | + } |
|
139 | 144 | } |
140 | 145 | $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); |
141 | 146 | break; |
142 | 147 | case 'untrash': |
143 | - if ( !isset( $post_ids ) ) |
|
144 | - break; |
|
148 | + if ( !isset( $post_ids ) ) { |
|
149 | + break; |
|
150 | + } |
|
145 | 151 | foreach ( (array) $post_ids as $post_id ) { |
146 | - if ( !current_user_can( 'delete_post', $post_id ) ) |
|
147 | - wp_die( __( 'You are not allowed to move this item out of the Trash.' ) ); |
|
152 | + if ( !current_user_can( 'delete_post', $post_id ) ) { |
|
153 | + wp_die( __( 'You are not allowed to move this item out of the Trash.' ) ); |
|
154 | + } |
|
148 | 155 | |
149 | - if ( !wp_untrash_post( $post_id ) ) |
|
150 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
156 | + if ( !wp_untrash_post( $post_id ) ) { |
|
157 | + wp_die( __( 'Error in restoring from Trash.' ) ); |
|
158 | + } |
|
151 | 159 | } |
152 | 160 | $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
153 | 161 | break; |
154 | 162 | case 'delete': |
155 | - if ( !isset( $post_ids ) ) |
|
156 | - break; |
|
163 | + if ( !isset( $post_ids ) ) { |
|
164 | + break; |
|
165 | + } |
|
157 | 166 | foreach ( (array) $post_ids as $post_id_del ) { |
158 | - if ( !current_user_can( 'delete_post', $post_id_del ) ) |
|
159 | - wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
167 | + if ( !current_user_can( 'delete_post', $post_id_del ) ) { |
|
168 | + wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
169 | + } |
|
160 | 170 | |
161 | - if ( !wp_delete_attachment( $post_id_del ) ) |
|
162 | - wp_die( __( 'Error in deleting.' ) ); |
|
171 | + if ( !wp_delete_attachment( $post_id_del ) ) { |
|
172 | + wp_die( __( 'Error in deleting.' ) ); |
|
173 | + } |
|
163 | 174 | } |
164 | 175 | $location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
165 | 176 | break; |
@@ -372,10 +372,10 @@ |
||
372 | 372 | |
373 | 373 | <?php |
374 | 374 | /** |
375 | - * Fires before the Widgets administration page content loads. |
|
376 | - * |
|
377 | - * @since 3.0.0 |
|
378 | - */ |
|
375 | + * Fires before the Widgets administration page content loads. |
|
376 | + * |
|
377 | + * @since 3.0.0 |
|
378 | + */ |
|
379 | 379 | do_action( 'widgets_admin_page' ); ?> |
380 | 380 | |
381 | 381 | <div class="widget-liquid-left"> |
@@ -7,32 +7,32 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | /** WordPress Administration Widgets API */ |
13 | -require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/widgets.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'edit_theme_options' ) ) { |
|
15 | +if ( ! current_user_can('edit_theme_options')) { |
|
16 | 16 | wp_die( |
17 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
18 | - '<p>' . __( 'You are not allowed to edit theme options on this site.' ) . '</p>', |
|
17 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
18 | + '<p>'.__('You are not allowed to edit theme options on this site.').'</p>', |
|
19 | 19 | 403 |
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -$widgets_access = get_user_setting( 'widgets_access' ); |
|
24 | -if ( isset($_GET['widgets-access']) ) { |
|
23 | +$widgets_access = get_user_setting('widgets_access'); |
|
24 | +if (isset($_GET['widgets-access'])) { |
|
25 | 25 | $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off'; |
26 | - set_user_setting( 'widgets_access', $widgets_access ); |
|
26 | + set_user_setting('widgets_access', $widgets_access); |
|
27 | 27 | } |
28 | 28 | |
29 | -if ( 'on' == $widgets_access ) { |
|
30 | - add_filter( 'admin_body_class', 'wp_widgets_access_body_class' ); |
|
29 | +if ('on' == $widgets_access) { |
|
30 | + add_filter('admin_body_class', 'wp_widgets_access_body_class'); |
|
31 | 31 | } else { |
32 | 32 | wp_enqueue_script('admin-widgets'); |
33 | 33 | |
34 | - if ( wp_is_mobile() ) |
|
35 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
34 | + if (wp_is_mobile()) |
|
35 | + wp_enqueue_script('jquery-touch-punch'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,68 +41,68 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 2.2.0 |
43 | 43 | */ |
44 | -do_action( 'sidebar_admin_setup' ); |
|
44 | +do_action('sidebar_admin_setup'); |
|
45 | 45 | |
46 | -$title = __( 'Widgets' ); |
|
46 | +$title = __('Widgets'); |
|
47 | 47 | $parent_file = 'themes.php'; |
48 | 48 | |
49 | -get_current_screen()->add_help_tab( array( |
|
49 | +get_current_screen()->add_help_tab(array( |
|
50 | 50 | 'id' => 'overview', |
51 | 51 | 'title' => __('Overview'), |
52 | 52 | 'content' => |
53 | - '<p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p> |
|
54 | - <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>' |
|
55 | -) ); |
|
56 | -get_current_screen()->add_help_tab( array( |
|
53 | + '<p>'.__('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.').'</p> |
|
54 | + <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.').'</p>' |
|
55 | +)); |
|
56 | +get_current_screen()->add_help_tab(array( |
|
57 | 57 | 'id' => 'removing-reusing', |
58 | 58 | 'title' => __('Removing and Reusing'), |
59 | 59 | 'content' => |
60 | - '<p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p> |
|
61 | - <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.') . '</p> |
|
62 | - <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>' |
|
63 | -) ); |
|
64 | -get_current_screen()->add_help_tab( array( |
|
60 | + '<p>'.__('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.').'</p> |
|
61 | + <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.').'</p> |
|
62 | + <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.').'</p>' |
|
63 | +)); |
|
64 | +get_current_screen()->add_help_tab(array( |
|
65 | 65 | 'id' => 'missing-widgets', |
66 | 66 | 'title' => __('Missing Widgets'), |
67 | 67 | 'content' => |
68 | - '<p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>' . |
|
69 | - '<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.') . '</p>' |
|
70 | -) ); |
|
68 | + '<p>'.__('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.').'</p>'. |
|
69 | + '<p>'.__('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.').'</p>' |
|
70 | +)); |
|
71 | 71 | |
72 | 72 | get_current_screen()->set_help_sidebar( |
73 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
74 | - '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>' . |
|
75 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
73 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
74 | + '<p>'.__('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>').'</p>'. |
|
75 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
76 | 76 | ); |
77 | 77 | |
78 | -if ( ! current_theme_supports( 'widgets' ) ) { |
|
79 | - wp_die( __( 'The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) ); |
|
78 | +if ( ! current_theme_supports('widgets')) { |
|
79 | + wp_die(__('The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // These are the widgets grouped by sidebar |
83 | 83 | $sidebars_widgets = wp_get_sidebars_widgets(); |
84 | 84 | |
85 | -if ( empty( $sidebars_widgets ) ) |
|
85 | +if (empty($sidebars_widgets)) |
|
86 | 86 | $sidebars_widgets = wp_get_widget_defaults(); |
87 | 87 | |
88 | -foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { |
|
89 | - if ( 'wp_inactive_widgets' == $sidebar_id ) |
|
88 | +foreach ($sidebars_widgets as $sidebar_id => $widgets) { |
|
89 | + if ('wp_inactive_widgets' == $sidebar_id) |
|
90 | 90 | continue; |
91 | 91 | |
92 | - if ( ! is_registered_sidebar( $sidebar_id ) ) { |
|
93 | - if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar |
|
92 | + if ( ! is_registered_sidebar($sidebar_id)) { |
|
93 | + if ( ! empty($widgets)) { // register the inactive_widgets area as sidebar |
|
94 | 94 | register_sidebar(array( |
95 | - 'name' => __( 'Inactive Sidebar (not used)' ), |
|
95 | + 'name' => __('Inactive Sidebar (not used)'), |
|
96 | 96 | 'id' => $sidebar_id, |
97 | 97 | 'class' => 'inactive-sidebar orphan-sidebar', |
98 | - 'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ), |
|
98 | + 'description' => __('This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.'), |
|
99 | 99 | 'before_widget' => '', |
100 | 100 | 'after_widget' => '', |
101 | 101 | 'before_title' => '', |
102 | 102 | 'after_title' => '', |
103 | 103 | )); |
104 | 104 | } else { |
105 | - unset( $sidebars_widgets[ $sidebar_id ] ); |
|
105 | + unset($sidebars_widgets[$sidebar_id]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'name' => __('Inactive Widgets'), |
113 | 113 | 'id' => 'wp_inactive_widgets', |
114 | 114 | 'class' => 'inactive-sidebar', |
115 | - 'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ), |
|
115 | + 'description' => __('Drag widgets here to remove them from the sidebar but keep their settings.'), |
|
116 | 116 | 'before_widget' => '', |
117 | 117 | 'after_widget' => '', |
118 | 118 | 'before_title' => '', |
@@ -122,36 +122,36 @@ discard block |
||
122 | 122 | retrieve_widgets(); |
123 | 123 | |
124 | 124 | // We're saving a widget without js |
125 | -if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) { |
|
125 | +if (isset($_POST['savewidget']) || isset($_POST['removewidget'])) { |
|
126 | 126 | $widget_id = $_POST['widget-id']; |
127 | 127 | check_admin_referer("save-delete-widget-$widget_id"); |
128 | 128 | |
129 | 129 | $number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : ''; |
130 | - if ( $number ) { |
|
131 | - foreach ( $_POST as $key => $val ) { |
|
132 | - if ( is_array($val) && preg_match('/__i__|%i%/', key($val)) ) { |
|
133 | - $_POST[$key] = array( $number => array_shift($val) ); |
|
130 | + if ($number) { |
|
131 | + foreach ($_POST as $key => $val) { |
|
132 | + if (is_array($val) && preg_match('/__i__|%i%/', key($val))) { |
|
133 | + $_POST[$key] = array($number => array_shift($val)); |
|
134 | 134 | break; |
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | $sidebar_id = $_POST['sidebar']; |
140 | - $position = isset($_POST[$sidebar_id . '_position']) ? (int) $_POST[$sidebar_id . '_position'] - 1 : 0; |
|
140 | + $position = isset($_POST[$sidebar_id.'_position']) ? (int) $_POST[$sidebar_id.'_position'] - 1 : 0; |
|
141 | 141 | |
142 | 142 | $id_base = $_POST['id_base']; |
143 | 143 | $sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array(); |
144 | 144 | |
145 | 145 | // Delete. |
146 | - if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) { |
|
146 | + if (isset($_POST['removewidget']) && $_POST['removewidget']) { |
|
147 | 147 | |
148 | - if ( !in_array($widget_id, $sidebar, true) ) { |
|
149 | - wp_redirect( admin_url('widgets.php?error=0') ); |
|
148 | + if ( ! in_array($widget_id, $sidebar, true)) { |
|
149 | + wp_redirect(admin_url('widgets.php?error=0')); |
|
150 | 150 | exit; |
151 | 151 | } |
152 | 152 | |
153 | - $sidebar = array_diff( $sidebar, array($widget_id) ); |
|
154 | - $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); |
|
153 | + $sidebar = array_diff($sidebar, array($widget_id)); |
|
154 | + $_POST = array('sidebar' => $sidebar_id, 'widget-'.$id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Fires immediately after a widget has been marked for deletion. |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | * @param string $sidebar_id ID of the sidebar the widget was deleted from. |
163 | 163 | * @param string $id_base ID base for the widget. |
164 | 164 | */ |
165 | - do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base ); |
|
165 | + do_action('delete_widget', $widget_id, $sidebar_id, $id_base); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $_POST['widget-id'] = $sidebar; |
169 | 169 | |
170 | - foreach ( (array) $wp_registered_widget_updates as $name => $control ) { |
|
171 | - if ( $name != $id_base || !is_callable($control['callback']) ) |
|
170 | + foreach ((array) $wp_registered_widget_updates as $name => $control) { |
|
171 | + if ($name != $id_base || ! is_callable($control['callback'])) |
|
172 | 172 | continue; |
173 | 173 | |
174 | 174 | ob_start(); |
175 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
175 | + call_user_func_array($control['callback'], $control['params']); |
|
176 | 176 | ob_end_clean(); |
177 | 177 | |
178 | 178 | break; |
@@ -181,58 +181,58 @@ discard block |
||
181 | 181 | $sidebars_widgets[$sidebar_id] = $sidebar; |
182 | 182 | |
183 | 183 | // Remove old position. |
184 | - if ( !isset($_POST['delete_widget']) ) { |
|
185 | - foreach ( $sidebars_widgets as $key => $sb ) { |
|
186 | - if ( is_array($sb) ) |
|
187 | - $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
184 | + if ( ! isset($_POST['delete_widget'])) { |
|
185 | + foreach ($sidebars_widgets as $key => $sb) { |
|
186 | + if (is_array($sb)) |
|
187 | + $sidebars_widgets[$key] = array_diff($sb, array($widget_id)); |
|
188 | 188 | } |
189 | - array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id ); |
|
189 | + array_splice($sidebars_widgets[$sidebar_id], $position, 0, $widget_id); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | wp_set_sidebars_widgets($sidebars_widgets); |
193 | - wp_redirect( admin_url('widgets.php?message=0') ); |
|
193 | + wp_redirect(admin_url('widgets.php?message=0')); |
|
194 | 194 | exit; |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Remove inactive widgets without js |
198 | -if ( isset( $_POST['removeinactivewidgets'] ) ) { |
|
199 | - check_admin_referer( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); |
|
200 | - |
|
201 | - if ( $_POST['removeinactivewidgets'] ) { |
|
202 | - foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) { |
|
203 | - $pieces = explode( '-', $widget_id ); |
|
204 | - $multi_number = array_pop( $pieces ); |
|
205 | - $id_base = implode( '-', $pieces ); |
|
206 | - $widget = get_option( 'widget_' . $id_base ); |
|
207 | - unset( $widget[$multi_number] ); |
|
208 | - update_option( 'widget_' . $id_base, $widget ); |
|
209 | - unset( $sidebars_widgets['wp_inactive_widgets'][$key] ); |
|
198 | +if (isset($_POST['removeinactivewidgets'])) { |
|
199 | + check_admin_referer('remove-inactive-widgets', '_wpnonce_remove_inactive_widgets'); |
|
200 | + |
|
201 | + if ($_POST['removeinactivewidgets']) { |
|
202 | + foreach ($sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id) { |
|
203 | + $pieces = explode('-', $widget_id); |
|
204 | + $multi_number = array_pop($pieces); |
|
205 | + $id_base = implode('-', $pieces); |
|
206 | + $widget = get_option('widget_'.$id_base); |
|
207 | + unset($widget[$multi_number]); |
|
208 | + update_option('widget_'.$id_base, $widget); |
|
209 | + unset($sidebars_widgets['wp_inactive_widgets'][$key]); |
|
210 | 210 | } |
211 | 211 | |
212 | - wp_set_sidebars_widgets( $sidebars_widgets ); |
|
212 | + wp_set_sidebars_widgets($sidebars_widgets); |
|
213 | 213 | } |
214 | 214 | |
215 | - wp_redirect( admin_url( 'widgets.php?message=0' ) ); |
|
215 | + wp_redirect(admin_url('widgets.php?message=0')); |
|
216 | 216 | exit; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // Output the widget form without js |
220 | -if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) { |
|
220 | +if (isset($_GET['editwidget']) && $_GET['editwidget']) { |
|
221 | 221 | $widget_id = $_GET['editwidget']; |
222 | 222 | |
223 | - if ( isset($_GET['addnew']) ) { |
|
223 | + if (isset($_GET['addnew'])) { |
|
224 | 224 | // Default to the first sidebar |
225 | - $keys = array_keys( $wp_registered_sidebars ); |
|
226 | - $sidebar = reset( $keys ); |
|
225 | + $keys = array_keys($wp_registered_sidebars); |
|
226 | + $sidebar = reset($keys); |
|
227 | 227 | |
228 | - if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget |
|
228 | + if (isset($_GET['base']) && isset($_GET['num'])) { // multi-widget |
|
229 | 229 | // Copy minimal info from an existing instance of this widget to a new instance |
230 | - foreach ( $wp_registered_widget_controls as $control ) { |
|
231 | - if ( $_GET['base'] === $control['id_base'] ) { |
|
230 | + foreach ($wp_registered_widget_controls as $control) { |
|
231 | + if ($_GET['base'] === $control['id_base']) { |
|
232 | 232 | $control_callback = $control['callback']; |
233 | 233 | $multi_number = (int) $_GET['num']; |
234 | 234 | $control['params'][0]['number'] = -1; |
235 | - $widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number; |
|
235 | + $widget_id = $control['id'] = $control['id_base'].'-'.$multi_number; |
|
236 | 236 | $wp_registered_widget_controls[$control['id']] = $control; |
237 | 237 | break; |
238 | 238 | } |
@@ -240,66 +240,66 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - if ( isset($wp_registered_widget_controls[$widget_id]) && !isset($control) ) { |
|
243 | + if (isset($wp_registered_widget_controls[$widget_id]) && ! isset($control)) { |
|
244 | 244 | $control = $wp_registered_widget_controls[$widget_id]; |
245 | 245 | $control_callback = $control['callback']; |
246 | - } elseif ( !isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id]) ) { |
|
247 | - $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) ); |
|
246 | + } elseif ( ! isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id])) { |
|
247 | + $name = esc_html(strip_tags($wp_registered_widgets[$widget_id]['name'])); |
|
248 | 248 | } |
249 | 249 | |
250 | - if ( !isset($name) ) |
|
251 | - $name = esc_html( strip_tags($control['name']) ); |
|
250 | + if ( ! isset($name)) |
|
251 | + $name = esc_html(strip_tags($control['name'])); |
|
252 | 252 | |
253 | - if ( !isset($sidebar) ) |
|
253 | + if ( ! isset($sidebar)) |
|
254 | 254 | $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
255 | 255 | |
256 | - if ( !isset($multi_number) ) |
|
256 | + if ( ! isset($multi_number)) |
|
257 | 257 | $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
258 | 258 | |
259 | 259 | $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; |
260 | 260 | |
261 | 261 | // Show the widget form. |
262 | - $width = ' style="width:' . max($control['width'], 350) . 'px"'; |
|
262 | + $width = ' style="width:'.max($control['width'], 350).'px"'; |
|
263 | 263 | $key = isset($_GET['key']) ? (int) $_GET['key'] : 0; |
264 | 264 | |
265 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
265 | + require_once(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
266 | 266 | <div class="wrap"> |
267 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
267 | + <h1><?php echo esc_html($title); ?></h1> |
|
268 | 268 | <div class="editwidget"<?php echo $width; ?>> |
269 | - <h2><?php printf( __( 'Widget %s' ), $name ); ?></h2> |
|
269 | + <h2><?php printf(__('Widget %s'), $name); ?></h2> |
|
270 | 270 | |
271 | 271 | <form action="widgets.php" method="post"> |
272 | 272 | <div class="widget-inside"> |
273 | 273 | <?php |
274 | - if ( is_callable( $control_callback ) ) |
|
275 | - call_user_func_array( $control_callback, $control['params'] ); |
|
274 | + if (is_callable($control_callback)) |
|
275 | + call_user_func_array($control_callback, $control['params']); |
|
276 | 276 | else |
277 | - echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?> |
|
277 | + echo '<p>'.__('There are no options for this widget.')."</p>\n"; ?> |
|
278 | 278 | </div> |
279 | 279 | |
280 | 280 | <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p> |
281 | 281 | <div class="widget-position"> |
282 | 282 | <table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody> |
283 | 283 | <?php |
284 | - foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) { |
|
285 | - echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>"; |
|
286 | - if ( 'wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr( $sbname, 0, 16 ) ) { |
|
284 | + foreach ($wp_registered_sidebars as $sbname => $sbvalue) { |
|
285 | + echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='".esc_attr($sbname)."'".checked($sbname, $sidebar, false)." /> $sbvalue[name]</label></td><td>"; |
|
286 | + if ('wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr($sbname, 0, 16)) { |
|
287 | 287 | echo ' '; |
288 | 288 | } else { |
289 | - if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) { |
|
289 | + if ( ! isset($sidebars_widgets[$sbname]) || ! is_array($sidebars_widgets[$sbname])) { |
|
290 | 290 | $j = 1; |
291 | 291 | $sidebars_widgets[$sbname] = array(); |
292 | 292 | } else { |
293 | 293 | $j = count($sidebars_widgets[$sbname]); |
294 | - if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
294 | + if (isset($_GET['addnew']) || ! in_array($widget_id, $sidebars_widgets[$sbname], true)) |
|
295 | 295 | $j++; |
296 | 296 | } |
297 | 297 | $selected = ''; |
298 | 298 | echo "\t\t<select name='{$sbname}_position'>\n"; |
299 | - echo "\t\t<option value=''>" . __('— Select —') . "</option>\n"; |
|
300 | - for ( $i = 1; $i <= $j; $i++ ) { |
|
301 | - if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
302 | - $selected = selected( $i, $key + 1, false ); |
|
299 | + echo "\t\t<option value=''>".__('— Select —')."</option>\n"; |
|
300 | + for ($i = 1; $i <= $j; $i++) { |
|
301 | + if (in_array($widget_id, $sidebars_widgets[$sbname], true)) |
|
302 | + $selected = selected($i, $key + 1, false); |
|
303 | 303 | echo "\t\t<option value='$i'$selected> $i </option>\n"; |
304 | 304 | } |
305 | 305 | echo "\t\t</select>\n"; |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | |
312 | 312 | <div class="widget-control-actions"> |
313 | 313 | <?php |
314 | - if ( isset($_GET['addnew']) ) { ?> |
|
314 | + if (isset($_GET['addnew'])) { ?> |
|
315 | 315 | <a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a> |
316 | 316 | <?php |
317 | 317 | } else { |
318 | - submit_button( __( 'Delete' ), 'button alignleft', 'removewidget', false ); |
|
318 | + submit_button(__('Delete'), 'button alignleft', 'removewidget', false); |
|
319 | 319 | } |
320 | - submit_button( __( 'Save Widget' ), 'button-primary alignright', 'savewidget', false ); ?> |
|
320 | + submit_button(__('Save Widget'), 'button-primary alignright', 'savewidget', false); ?> |
|
321 | 321 | <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" /> |
322 | 322 | <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" /> |
323 | 323 | <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" /> |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | </div> |
329 | 329 | </div> |
330 | 330 | <?php |
331 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
331 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
332 | 332 | exit; |
333 | 333 | } |
334 | 334 | |
@@ -341,32 +341,32 @@ discard block |
||
341 | 341 | __('Error in displaying the widget settings form.') |
342 | 342 | ); |
343 | 343 | |
344 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
344 | +require_once(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
345 | 345 | |
346 | 346 | <div class="wrap"> |
347 | 347 | <h1> |
348 | 348 | <?php |
349 | - echo esc_html( $title ); |
|
350 | - if ( current_user_can( 'customize' ) ) { |
|
349 | + echo esc_html($title); |
|
350 | + if (current_user_can('customize')) { |
|
351 | 351 | printf( |
352 | 352 | ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>', |
353 | - esc_url( add_query_arg( |
|
353 | + esc_url(add_query_arg( |
|
354 | 354 | array( |
355 | - array( 'autofocus' => array( 'panel' => 'widgets' ) ), |
|
356 | - 'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) |
|
355 | + array('autofocus' => array('panel' => 'widgets')), |
|
356 | + 'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI'])) |
|
357 | 357 | ), |
358 | - admin_url( 'customize.php' ) |
|
359 | - ) ), |
|
360 | - __( 'Manage in Customizer' ) |
|
358 | + admin_url('customize.php') |
|
359 | + )), |
|
360 | + __('Manage in Customizer') |
|
361 | 361 | ); |
362 | 362 | } |
363 | 363 | ?> |
364 | 364 | </h1> |
365 | 365 | |
366 | -<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?> |
|
366 | +<?php if (isset($_GET['message']) && isset($messages[$_GET['message']])) { ?> |
|
367 | 367 | <div id="message" class="updated notice is-dismissible"><p><?php echo $messages[$_GET['message']]; ?></p></div> |
368 | 368 | <?php } ?> |
369 | -<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?> |
|
369 | +<?php if (isset($_GET['error']) && isset($errors[$_GET['error']])) { ?> |
|
370 | 370 | <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div> |
371 | 371 | <?php } ?> |
372 | 372 | |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @since 3.0.0 |
378 | 378 | */ |
379 | -do_action( 'widgets_admin_page' ); ?> |
|
379 | +do_action('widgets_admin_page'); ?> |
|
380 | 380 | |
381 | 381 | <div class="widget-liquid-left"> |
382 | 382 | <div id="widgets-left"> |
383 | 383 | <div id="available-widgets" class="widgets-holder-wrap"> |
384 | 384 | <div class="sidebar-name"> |
385 | 385 | <div class="sidebar-name-arrow"><br /></div> |
386 | - <h2><?php _e( 'Available Widgets' ); ?> <span id="removing-widget"><?php _ex( 'Deactivate', 'removing-widget' ); ?> <span></span></span></h2> |
|
386 | + <h2><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h2> |
|
387 | 387 | </div> |
388 | 388 | <div class="widget-holder"> |
389 | 389 | <div class="sidebar-description"> |
@@ -400,40 +400,40 @@ discard block |
||
400 | 400 | <?php |
401 | 401 | |
402 | 402 | $theme_sidebars = array(); |
403 | -foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) { |
|
404 | - if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) { |
|
403 | +foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) { |
|
404 | + if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) { |
|
405 | 405 | $wrap_class = 'widgets-holder-wrap'; |
406 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
407 | - $wrap_class .= ' ' . $registered_sidebar['class']; |
|
406 | + if ( ! empty($registered_sidebar['class'])) |
|
407 | + $wrap_class .= ' '.$registered_sidebar['class']; |
|
408 | 408 | |
409 | 409 | $is_inactive_widgets = 'wp_inactive_widgets' == $registered_sidebar['id']; |
410 | 410 | ?> |
411 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
411 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
412 | 412 | <div class="widget-holder inactive"> |
413 | - <?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?> |
|
413 | + <?php wp_list_widget_controls($registered_sidebar['id'], $registered_sidebar['name']); ?> |
|
414 | 414 | |
415 | - <?php if ( $is_inactive_widgets ) { ?> |
|
415 | + <?php if ($is_inactive_widgets) { ?> |
|
416 | 416 | <div class="remove-inactive-widgets"> |
417 | 417 | <form action="" method="post"> |
418 | 418 | <p> |
419 | 419 | <?php |
420 | - $attributes = array( 'id' => 'inactive-widgets-control-remove' ); |
|
420 | + $attributes = array('id' => 'inactive-widgets-control-remove'); |
|
421 | 421 | |
422 | - if ( empty($sidebars_widgets['wp_inactive_widgets']) ) { |
|
422 | + if (empty($sidebars_widgets['wp_inactive_widgets'])) { |
|
423 | 423 | $attributes['disabled'] = ''; |
424 | 424 | } |
425 | 425 | |
426 | - submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, $attributes ); |
|
426 | + submit_button(__('Clear Inactive Widgets'), 'delete', 'removeinactivewidgets', false, $attributes); |
|
427 | 427 | ?> |
428 | 428 | <span class="spinner"></span> |
429 | 429 | </p> |
430 | - <?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?> |
|
430 | + <?php wp_nonce_field('remove-inactive-widgets', '_wpnonce_remove_inactive_widgets'); ?> |
|
431 | 431 | </form> |
432 | 432 | </div> |
433 | 433 | <?php } ?> |
434 | 434 | </div> |
435 | - <?php if ( $is_inactive_widgets ) { ?> |
|
436 | - <p class="description"><?php _e( 'This will clear all items from the inactive widgets list. You will not be able to restore any customizations.' ); ?></p> |
|
435 | + <?php if ($is_inactive_widgets) { ?> |
|
436 | + <p class="description"><?php _e('This will clear all items from the inactive widgets list. You will not be able to restore any customizations.'); ?></p> |
|
437 | 437 | <?php } ?> |
438 | 438 | </div> |
439 | 439 | <?php |
@@ -450,10 +450,10 @@ discard block |
||
450 | 450 | |
451 | 451 | $i = $split = 0; |
452 | 452 | $single_sidebar_class = ''; |
453 | -$sidebars_count = count( $theme_sidebars ); |
|
453 | +$sidebars_count = count($theme_sidebars); |
|
454 | 454 | |
455 | -if ( $sidebars_count > 1 ) { |
|
456 | - $split = ceil( $sidebars_count / 2 ); |
|
455 | +if ($sidebars_count > 1) { |
|
456 | + $split = ceil($sidebars_count / 2); |
|
457 | 457 | } else { |
458 | 458 | $single_sidebar_class = ' single-sidebar'; |
459 | 459 | } |
@@ -464,23 +464,23 @@ discard block |
||
464 | 464 | <div class="sidebars-column-1"> |
465 | 465 | <?php |
466 | 466 | |
467 | -foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) { |
|
467 | +foreach ($theme_sidebars as $sidebar => $registered_sidebar) { |
|
468 | 468 | $wrap_class = 'widgets-holder-wrap'; |
469 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
470 | - $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
469 | + if ( ! empty($registered_sidebar['class'])) |
|
470 | + $wrap_class .= ' sidebar-'.$registered_sidebar['class']; |
|
471 | 471 | |
472 | - if ( $i > 0 ) |
|
472 | + if ($i > 0) |
|
473 | 473 | $wrap_class .= ' closed'; |
474 | 474 | |
475 | - if ( $split && $i == $split ) { |
|
475 | + if ($split && $i == $split) { |
|
476 | 476 | ?> |
477 | 477 | </div><div class="sidebars-column-2"> |
478 | 478 | <?php |
479 | 479 | } |
480 | 480 | |
481 | 481 | ?> |
482 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
483 | - <?php wp_list_widget_controls( $sidebar, $registered_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?> |
|
482 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
483 | + <?php wp_list_widget_controls($sidebar, $registered_sidebar['name']); // Show the control forms for each of the widgets in this sidebar ?> |
|
484 | 484 | </div> |
485 | 485 | <?php |
486 | 486 | |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | </div> |
493 | 493 | </div> |
494 | 494 | <form method="post"> |
495 | -<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?> |
|
495 | +<?php wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false); ?> |
|
496 | 496 | </form> |
497 | 497 | <br class="clear" /> |
498 | 498 | </div> |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | <div class="widgets-chooser"> |
501 | 501 | <ul class="widgets-chooser-sidebars"></ul> |
502 | 502 | <div class="widgets-chooser-actions"> |
503 | - <button class="button-secondary"><?php _e( 'Cancel' ); ?></button> |
|
504 | - <button class="button-primary"><?php _e( 'Add Widget' ); ?></button> |
|
503 | + <button class="button-secondary"><?php _e('Cancel'); ?></button> |
|
504 | + <button class="button-primary"><?php _e('Add Widget'); ?></button> |
|
505 | 505 | </div> |
506 | 506 | </div> |
507 | 507 | |
@@ -512,5 +512,5 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @since 2.2.0 |
514 | 514 | */ |
515 | -do_action( 'sidebar_admin_page' ); |
|
516 | -require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
515 | +do_action('sidebar_admin_page'); |
|
516 | +require_once(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -31,9 +31,10 @@ discard block |
||
31 | 31 | } else { |
32 | 32 | wp_enqueue_script('admin-widgets'); |
33 | 33 | |
34 | - if ( wp_is_mobile() ) |
|
35 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
36 | -} |
|
34 | + if ( wp_is_mobile() ) { |
|
35 | + wp_enqueue_script( 'jquery-touch-punch' ); |
|
36 | + } |
|
37 | + } |
|
37 | 38 | |
38 | 39 | /** |
39 | 40 | * Fires early before the Widgets administration screen loads, |
@@ -82,12 +83,14 @@ discard block |
||
82 | 83 | // These are the widgets grouped by sidebar |
83 | 84 | $sidebars_widgets = wp_get_sidebars_widgets(); |
84 | 85 | |
85 | -if ( empty( $sidebars_widgets ) ) |
|
86 | +if ( empty( $sidebars_widgets ) ) { |
|
86 | 87 | $sidebars_widgets = wp_get_widget_defaults(); |
88 | +} |
|
87 | 89 | |
88 | 90 | foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { |
89 | - if ( 'wp_inactive_widgets' == $sidebar_id ) |
|
90 | - continue; |
|
91 | + if ( 'wp_inactive_widgets' == $sidebar_id ) { |
|
92 | + continue; |
|
93 | + } |
|
91 | 94 | |
92 | 95 | if ( ! is_registered_sidebar( $sidebar_id ) ) { |
93 | 96 | if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar |
@@ -168,8 +171,9 @@ discard block |
||
168 | 171 | $_POST['widget-id'] = $sidebar; |
169 | 172 | |
170 | 173 | foreach ( (array) $wp_registered_widget_updates as $name => $control ) { |
171 | - if ( $name != $id_base || !is_callable($control['callback']) ) |
|
172 | - continue; |
|
174 | + if ( $name != $id_base || !is_callable($control['callback']) ) { |
|
175 | + continue; |
|
176 | + } |
|
173 | 177 | |
174 | 178 | ob_start(); |
175 | 179 | call_user_func_array( $control['callback'], $control['params'] ); |
@@ -183,8 +187,9 @@ discard block |
||
183 | 187 | // Remove old position. |
184 | 188 | if ( !isset($_POST['delete_widget']) ) { |
185 | 189 | foreach ( $sidebars_widgets as $key => $sb ) { |
186 | - if ( is_array($sb) ) |
|
187 | - $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
190 | + if ( is_array($sb) ) { |
|
191 | + $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
192 | + } |
|
188 | 193 | } |
189 | 194 | array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id ); |
190 | 195 | } |
@@ -247,14 +252,17 @@ discard block |
||
247 | 252 | $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) ); |
248 | 253 | } |
249 | 254 | |
250 | - if ( !isset($name) ) |
|
251 | - $name = esc_html( strip_tags($control['name']) ); |
|
255 | + if ( !isset($name) ) { |
|
256 | + $name = esc_html( strip_tags($control['name']) ); |
|
257 | + } |
|
252 | 258 | |
253 | - if ( !isset($sidebar) ) |
|
254 | - $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
|
259 | + if ( !isset($sidebar) ) { |
|
260 | + $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
|
261 | + } |
|
255 | 262 | |
256 | - if ( !isset($multi_number) ) |
|
257 | - $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
|
263 | + if ( !isset($multi_number) ) { |
|
264 | + $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
|
265 | + } |
|
258 | 266 | |
259 | 267 | $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; |
260 | 268 | |
@@ -271,10 +279,12 @@ discard block |
||
271 | 279 | <form action="widgets.php" method="post"> |
272 | 280 | <div class="widget-inside"> |
273 | 281 | <?php |
274 | - if ( is_callable( $control_callback ) ) |
|
275 | - call_user_func_array( $control_callback, $control['params'] ); |
|
276 | - else |
|
277 | - echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?> |
|
282 | + if ( is_callable( $control_callback ) ) { |
|
283 | + call_user_func_array( $control_callback, $control['params'] ); |
|
284 | + } else { |
|
285 | + echo '<p>' . __('There are no options for this widget.') . "</p>\n"; |
|
286 | + } |
|
287 | + ?> |
|
278 | 288 | </div> |
279 | 289 | |
280 | 290 | <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p> |
@@ -291,15 +301,17 @@ discard block |
||
291 | 301 | $sidebars_widgets[$sbname] = array(); |
292 | 302 | } else { |
293 | 303 | $j = count($sidebars_widgets[$sbname]); |
294 | - if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
295 | - $j++; |
|
304 | + if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) { |
|
305 | + $j++; |
|
306 | + } |
|
296 | 307 | } |
297 | 308 | $selected = ''; |
298 | 309 | echo "\t\t<select name='{$sbname}_position'>\n"; |
299 | 310 | echo "\t\t<option value=''>" . __('— Select —') . "</option>\n"; |
300 | 311 | for ( $i = 1; $i <= $j; $i++ ) { |
301 | - if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
302 | - $selected = selected( $i, $key + 1, false ); |
|
312 | + if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) { |
|
313 | + $selected = selected( $i, $key + 1, false ); |
|
314 | + } |
|
303 | 315 | echo "\t\t<option value='$i'$selected> $i </option>\n"; |
304 | 316 | } |
305 | 317 | echo "\t\t</select>\n"; |
@@ -403,8 +415,9 @@ discard block |
||
403 | 415 | foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) { |
404 | 416 | if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) { |
405 | 417 | $wrap_class = 'widgets-holder-wrap'; |
406 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
407 | - $wrap_class .= ' ' . $registered_sidebar['class']; |
|
418 | + if ( !empty( $registered_sidebar['class'] ) ) { |
|
419 | + $wrap_class .= ' ' . $registered_sidebar['class']; |
|
420 | + } |
|
408 | 421 | |
409 | 422 | $is_inactive_widgets = 'wp_inactive_widgets' == $registered_sidebar['id']; |
410 | 423 | ?> |
@@ -466,11 +479,13 @@ discard block |
||
466 | 479 | |
467 | 480 | foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) { |
468 | 481 | $wrap_class = 'widgets-holder-wrap'; |
469 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
470 | - $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
482 | + if ( !empty( $registered_sidebar['class'] ) ) { |
|
483 | + $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
484 | + } |
|
471 | 485 | |
472 | - if ( $i > 0 ) |
|
473 | - $wrap_class .= ' closed'; |
|
486 | + if ( $i > 0 ) { |
|
487 | + $wrap_class .= ' closed'; |
|
488 | + } |
|
474 | 489 | |
475 | 490 | if ( $split && $i == $split ) { |
476 | 491 | ?> |