@@ -2,8 +2,11 @@ |
||
2 | 2 | |
3 | 3 | if (! isset($wp_did_header)): |
4 | 4 | if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
5 | - if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
|
6 | - else $path = 'wp-admin/'; |
|
5 | + if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) { |
|
6 | + $path = ''; |
|
7 | + } else { |
|
8 | + $path = 'wp-admin/'; |
|
9 | + } |
|
7 | 10 | |
8 | 11 | require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
9 | 12 | require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! isset($wp_did_header)): |
|
4 | -if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
|
3 | +if ( ! isset($wp_did_header)): |
|
4 | +if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) { |
|
5 | 5 | if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
6 | 6 | else $path = 'wp-admin/'; |
7 | 7 | |
8 | - require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
|
9 | - require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
|
10 | - require_once( dirname(__FILE__) . '/wp-includes/plugin.php'); |
|
11 | - wp_die( sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'https://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
8 | + require_once(dirname(__FILE__).'/wp-includes/classes.php'); |
|
9 | + require_once(dirname(__FILE__).'/wp-includes/functions.php'); |
|
10 | + require_once(dirname(__FILE__).'/wp-includes/plugin.php'); |
|
11 | + wp_die(sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'https://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $wp_did_header = true; |
15 | 15 | |
16 | -require_once( dirname(__FILE__) . '/wp-config.php'); |
|
16 | +require_once(dirname(__FILE__).'/wp-config.php'); |
|
17 | 17 | |
18 | 18 | wp(); |
19 | 19 | |
20 | -require_once(ABSPATH . WPINC . '/template-loader.php'); |
|
20 | +require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
21 | 21 | |
22 | 22 | endif; |
23 | 23 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * If you want to overload this in a child theme then include a file |
24 | 24 | * called loop-page.php and that will be used instead. |
25 | 25 | */ |
26 | - get_template_part( 'loop', 'page' ); |
|
26 | + get_template_part('loop', 'page'); |
|
27 | 27 | ?> |
28 | 28 | |
29 | 29 | </div><!-- #content --> |
@@ -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 |
@@ -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 --> |
@@ -14,73 +14,73 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param WP_Customize_Manager $wp_customize Customizer object. |
16 | 16 | */ |
17 | -function twentyfifteen_customize_register( $wp_customize ) { |
|
17 | +function twentyfifteen_customize_register($wp_customize) { |
|
18 | 18 | $color_scheme = twentyfifteen_get_color_scheme(); |
19 | 19 | |
20 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
21 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
20 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
21 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
22 | 22 | |
23 | - if ( isset( $wp_customize->selective_refresh ) ) { |
|
24 | - $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
23 | + if (isset($wp_customize->selective_refresh)) { |
|
24 | + $wp_customize->selective_refresh->add_partial('blogname', array( |
|
25 | 25 | 'selector' => '.site-title a', |
26 | 26 | 'container_inclusive' => false, |
27 | 27 | 'render_callback' => 'twentyfifteen_customize_partial_blogname', |
28 | - ) ); |
|
29 | - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
28 | + )); |
|
29 | + $wp_customize->selective_refresh->add_partial('blogdescription', array( |
|
30 | 30 | 'selector' => '.site-description', |
31 | 31 | 'container_inclusive' => false, |
32 | 32 | 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', |
33 | - ) ); |
|
33 | + )); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Add color scheme setting and control. |
37 | - $wp_customize->add_setting( 'color_scheme', array( |
|
37 | + $wp_customize->add_setting('color_scheme', array( |
|
38 | 38 | 'default' => 'default', |
39 | 39 | 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', |
40 | 40 | 'transport' => 'postMessage', |
41 | - ) ); |
|
41 | + )); |
|
42 | 42 | |
43 | - $wp_customize->add_control( 'color_scheme', array( |
|
44 | - 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), |
|
43 | + $wp_customize->add_control('color_scheme', array( |
|
44 | + 'label' => __('Base Color Scheme', 'twentyfifteen'), |
|
45 | 45 | 'section' => 'colors', |
46 | 46 | 'type' => 'select', |
47 | 47 | 'choices' => twentyfifteen_get_color_scheme_choices(), |
48 | 48 | 'priority' => 1, |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | // Add custom header and sidebar text color setting and control. |
52 | - $wp_customize->add_setting( 'sidebar_textcolor', array( |
|
52 | + $wp_customize->add_setting('sidebar_textcolor', array( |
|
53 | 53 | 'default' => $color_scheme[4], |
54 | 54 | 'sanitize_callback' => 'sanitize_hex_color', |
55 | 55 | 'transport' => 'postMessage', |
56 | - ) ); |
|
56 | + )); |
|
57 | 57 | |
58 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( |
|
59 | - 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), |
|
60 | - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), |
|
58 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array( |
|
59 | + 'label' => __('Header and Sidebar Text Color', 'twentyfifteen'), |
|
60 | + 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'), |
|
61 | 61 | 'section' => 'colors', |
62 | - ) ) ); |
|
62 | + ))); |
|
63 | 63 | |
64 | 64 | // Remove the core header textcolor control, as it shares the sidebar text color. |
65 | - $wp_customize->remove_control( 'header_textcolor' ); |
|
65 | + $wp_customize->remove_control('header_textcolor'); |
|
66 | 66 | |
67 | 67 | // Add custom header and sidebar background color setting and control. |
68 | - $wp_customize->add_setting( 'header_background_color', array( |
|
68 | + $wp_customize->add_setting('header_background_color', array( |
|
69 | 69 | 'default' => $color_scheme[1], |
70 | 70 | 'sanitize_callback' => 'sanitize_hex_color', |
71 | 71 | 'transport' => 'postMessage', |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( |
|
75 | - 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), |
|
76 | - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), |
|
74 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array( |
|
75 | + 'label' => __('Header and Sidebar Background Color', 'twentyfifteen'), |
|
76 | + 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'), |
|
77 | 77 | 'section' => 'colors', |
78 | - ) ) ); |
|
78 | + ))); |
|
79 | 79 | |
80 | 80 | // Add an additional description to the header image section. |
81 | - $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); |
|
81 | + $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'); |
|
82 | 82 | } |
83 | -add_action( 'customize_register', 'twentyfifteen_customize_register', 11 ); |
|
83 | +add_action('customize_register', 'twentyfifteen_customize_register', 11); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Render the site title for the selective refresh partial. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | function twentyfifteen_customize_partial_blogname() { |
94 | - bloginfo( 'name' ); |
|
94 | + bloginfo('name'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return void |
104 | 104 | */ |
105 | 105 | function twentyfifteen_customize_partial_blogdescription() { |
106 | - bloginfo( 'description' ); |
|
106 | + bloginfo('description'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * } |
146 | 146 | * } |
147 | 147 | */ |
148 | - return apply_filters( 'twentyfifteen_color_schemes', array( |
|
148 | + return apply_filters('twentyfifteen_color_schemes', array( |
|
149 | 149 | 'default' => array( |
150 | - 'label' => __( 'Default', 'twentyfifteen' ), |
|
150 | + 'label' => __('Default', 'twentyfifteen'), |
|
151 | 151 | 'colors' => array( |
152 | 152 | '#f1f1f1', |
153 | 153 | '#ffffff', |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ), |
159 | 159 | ), |
160 | 160 | 'dark' => array( |
161 | - 'label' => __( 'Dark', 'twentyfifteen' ), |
|
161 | + 'label' => __('Dark', 'twentyfifteen'), |
|
162 | 162 | 'colors' => array( |
163 | 163 | '#111111', |
164 | 164 | '#202020', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ), |
170 | 170 | ), |
171 | 171 | 'yellow' => array( |
172 | - 'label' => __( 'Yellow', 'twentyfifteen' ), |
|
172 | + 'label' => __('Yellow', 'twentyfifteen'), |
|
173 | 173 | 'colors' => array( |
174 | 174 | '#f4ca16', |
175 | 175 | '#ffdf00', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | ), |
181 | 181 | ), |
182 | 182 | 'pink' => array( |
183 | - 'label' => __( 'Pink', 'twentyfifteen' ), |
|
183 | + 'label' => __('Pink', 'twentyfifteen'), |
|
184 | 184 | 'colors' => array( |
185 | 185 | '#ffe5d1', |
186 | 186 | '#e53b51', |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ), |
192 | 192 | ), |
193 | 193 | 'purple' => array( |
194 | - 'label' => __( 'Purple', 'twentyfifteen' ), |
|
194 | + 'label' => __('Purple', 'twentyfifteen'), |
|
195 | 195 | 'colors' => array( |
196 | 196 | '#674970', |
197 | 197 | '#2e2256', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ), |
203 | 203 | ), |
204 | 204 | 'blue' => array( |
205 | - 'label' => __( 'Blue', 'twentyfifteen' ), |
|
205 | + 'label' => __('Blue', 'twentyfifteen'), |
|
206 | 206 | 'colors' => array( |
207 | 207 | '#e9f2f9', |
208 | 208 | '#55c3dc', |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | '#f1f1f1', |
213 | 213 | ), |
214 | 214 | ), |
215 | - ) ); |
|
215 | + )); |
|
216 | 216 | } |
217 | 217 | |
218 | -if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) : |
|
218 | +if ( ! function_exists('twentyfifteen_get_color_scheme')) : |
|
219 | 219 | /** |
220 | 220 | * Get the current Twenty Fifteen color scheme. |
221 | 221 | * |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | * @return array An associative array of either the current or default color scheme hex values. |
225 | 225 | */ |
226 | 226 | function twentyfifteen_get_color_scheme() { |
227 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
227 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
228 | 228 | $color_schemes = twentyfifteen_get_color_schemes(); |
229 | 229 | |
230 | - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
231 | - return $color_schemes[ $color_scheme_option ]['colors']; |
|
230 | + if (array_key_exists($color_scheme_option, $color_schemes)) { |
|
231 | + return $color_schemes[$color_scheme_option]['colors']; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $color_schemes['default']['colors']; |
235 | 235 | } |
236 | 236 | endif; // twentyfifteen_get_color_scheme |
237 | 237 | |
238 | -if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) : |
|
238 | +if ( ! function_exists('twentyfifteen_get_color_scheme_choices')) : |
|
239 | 239 | /** |
240 | 240 | * Returns an array of color scheme choices registered for Twenty Fifteen. |
241 | 241 | * |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | $color_schemes = twentyfifteen_get_color_schemes(); |
248 | 248 | $color_scheme_control_options = array(); |
249 | 249 | |
250 | - foreach ( $color_schemes as $color_scheme => $value ) { |
|
251 | - $color_scheme_control_options[ $color_scheme ] = $value['label']; |
|
250 | + foreach ($color_schemes as $color_scheme => $value) { |
|
251 | + $color_scheme_control_options[$color_scheme] = $value['label']; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | return $color_scheme_control_options; |
255 | 255 | } |
256 | 256 | endif; // twentyfifteen_get_color_scheme_choices |
257 | 257 | |
258 | -if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) : |
|
258 | +if ( ! function_exists('twentyfifteen_sanitize_color_scheme')) : |
|
259 | 259 | /** |
260 | 260 | * Sanitization callback for color schemes. |
261 | 261 | * |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | * @param string $value Color scheme name value. |
265 | 265 | * @return string Color scheme name. |
266 | 266 | */ |
267 | -function twentyfifteen_sanitize_color_scheme( $value ) { |
|
267 | +function twentyfifteen_sanitize_color_scheme($value) { |
|
268 | 268 | $color_schemes = twentyfifteen_get_color_scheme_choices(); |
269 | 269 | |
270 | - if ( ! array_key_exists( $value, $color_schemes ) ) { |
|
270 | + if ( ! array_key_exists($value, $color_schemes)) { |
|
271 | 271 | $value = 'default'; |
272 | 272 | } |
273 | 273 | |
@@ -283,38 +283,38 @@ discard block |
||
283 | 283 | * @see wp_add_inline_style() |
284 | 284 | */ |
285 | 285 | function twentyfifteen_color_scheme_css() { |
286 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
286 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
287 | 287 | |
288 | 288 | // Don't do anything if the default color scheme is selected. |
289 | - if ( 'default' === $color_scheme_option ) { |
|
289 | + if ('default' === $color_scheme_option) { |
|
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $color_scheme = twentyfifteen_get_color_scheme(); |
294 | 294 | |
295 | 295 | // Convert main and sidebar text hex color to rgba. |
296 | - $color_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[3] ); |
|
297 | - $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] ); |
|
296 | + $color_textcolor_rgb = twentyfifteen_hex2rgb($color_scheme[3]); |
|
297 | + $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb($color_scheme[4]); |
|
298 | 298 | $colors = array( |
299 | 299 | 'background_color' => $color_scheme[0], |
300 | 300 | 'header_background_color' => $color_scheme[1], |
301 | 301 | 'box_background_color' => $color_scheme[2], |
302 | 302 | 'textcolor' => $color_scheme[3], |
303 | - 'secondary_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ), |
|
304 | - 'border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ), |
|
305 | - 'border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ), |
|
303 | + 'secondary_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb), |
|
304 | + 'border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb), |
|
305 | + 'border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb), |
|
306 | 306 | 'sidebar_textcolor' => $color_scheme[4], |
307 | - 'sidebar_border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ), |
|
308 | - 'sidebar_border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ), |
|
309 | - 'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ), |
|
307 | + 'sidebar_border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb), |
|
308 | + 'sidebar_border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb), |
|
309 | + 'secondary_sidebar_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb), |
|
310 | 310 | 'meta_box_background_color' => $color_scheme[5], |
311 | 311 | ); |
312 | 312 | |
313 | - $color_scheme_css = twentyfifteen_get_color_scheme_css( $colors ); |
|
313 | + $color_scheme_css = twentyfifteen_get_color_scheme_css($colors); |
|
314 | 314 | |
315 | - wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css ); |
|
315 | + wp_add_inline_style('twentyfifteen-style', $color_scheme_css); |
|
316 | 316 | } |
317 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_color_scheme_css' ); |
|
317 | +add_action('wp_enqueue_scripts', 'twentyfifteen_color_scheme_css'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Binds JS listener to make Customizer color_scheme control. |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * @since Twenty Fifteen 1.0 |
325 | 325 | */ |
326 | 326 | function twentyfifteen_customize_control_js() { |
327 | - wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true ); |
|
328 | - wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() ); |
|
327 | + wp_enqueue_script('color-scheme-control', get_template_directory_uri().'/js/color-scheme-control.js', array('customize-controls', 'iris', 'underscore', 'wp-util'), '20141216', true); |
|
328 | + wp_localize_script('color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes()); |
|
329 | 329 | } |
330 | -add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' ); |
|
330 | +add_action('customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js'); |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Binds JS handlers to make the Customizer preview reload changes asynchronously. |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @since Twenty Fifteen 1.0 |
336 | 336 | */ |
337 | 337 | function twentyfifteen_customize_preview_js() { |
338 | - wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true ); |
|
338 | + wp_enqueue_script('twentyfifteen-customize-preview', get_template_directory_uri().'/js/customize-preview.js', array('customize-preview'), '20141216', true); |
|
339 | 339 | } |
340 | -add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' ); |
|
340 | +add_action('customize_preview_init', 'twentyfifteen_customize_preview_js'); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Returns CSS for the color schemes. |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @param array $colors Color scheme colors. |
348 | 348 | * @return string Color scheme CSS. |
349 | 349 | */ |
350 | -function twentyfifteen_get_color_scheme_css( $colors ) { |
|
351 | - $colors = wp_parse_args( $colors, array( |
|
350 | +function twentyfifteen_get_color_scheme_css($colors) { |
|
351 | + $colors = wp_parse_args($colors, array( |
|
352 | 352 | 'background_color' => '', |
353 | 353 | 'header_background_color' => '', |
354 | 354 | 'box_background_color' => '', |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | 'sidebar_border_focus_color' => '', |
362 | 362 | 'secondary_sidebar_textcolor' => '', |
363 | 363 | 'meta_box_background_color' => '', |
364 | - ) ); |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | $css = <<<CSS |
367 | 367 | /* Color Scheme */ |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | ); |
767 | 767 | ?> |
768 | 768 | <script type="text/html" id="tmpl-twentyfifteen-color-scheme"> |
769 | - <?php echo twentyfifteen_get_color_scheme_css( $colors ); ?> |
|
769 | + <?php echo twentyfifteen_get_color_scheme_css($colors); ?> |
|
770 | 770 | </script> |
771 | 771 | <?php |
772 | 772 | } |
773 | -add_action( 'customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template' ); |
|
773 | +add_action('customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template'); |
@@ -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 --> |
@@ -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 | ?> |
@@ -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>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
|
17 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
18 | + '<p>'.__('Sorry, 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">Documentation on Widgets</a>') . '</p>' . |
|
75 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
73 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
74 | + '<p>'.__('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen">Documentation on Widgets</a>').'</p>'. |
|
75 | + '<p>'.__('<a href="https://wordpress.org/support/">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' ), 'alignleft', 'removewidget', false ); |
|
318 | + submit_button(__('Delete'), 'alignleft', 'removewidget', false); |
|
319 | 319 | } |
320 | - submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false ); ?> |
|
320 | + submit_button(__('Save Widget'), '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,35 +341,35 @@ 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 class="wp-heading-inline"><?php |
348 | -echo esc_html( $title ); |
|
348 | +echo esc_html($title); |
|
349 | 349 | ?></h1> |
350 | 350 | |
351 | 351 | <?php |
352 | -if ( current_user_can( 'customize' ) ) { |
|
352 | +if (current_user_can('customize')) { |
|
353 | 353 | printf( |
354 | 354 | ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>', |
355 | - esc_url( add_query_arg( |
|
355 | + esc_url(add_query_arg( |
|
356 | 356 | array( |
357 | - array( 'autofocus' => array( 'panel' => 'widgets' ) ), |
|
358 | - 'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) |
|
357 | + array('autofocus' => array('panel' => 'widgets')), |
|
358 | + 'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI'])) |
|
359 | 359 | ), |
360 | - admin_url( 'customize.php' ) |
|
361 | - ) ), |
|
362 | - __( 'Manage with Live Preview' ) |
|
360 | + admin_url('customize.php') |
|
361 | + )), |
|
362 | + __('Manage with Live Preview') |
|
363 | 363 | ); |
364 | 364 | } |
365 | 365 | ?> |
366 | 366 | |
367 | 367 | <hr class="wp-header-end"> |
368 | 368 | |
369 | -<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?> |
|
369 | +<?php if (isset($_GET['message']) && isset($messages[$_GET['message']])) { ?> |
|
370 | 370 | <div id="message" class="updated notice is-dismissible"><p><?php echo $messages[$_GET['message']]; ?></p></div> |
371 | 371 | <?php } ?> |
372 | -<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?> |
|
372 | +<?php if (isset($_GET['error']) && isset($errors[$_GET['error']])) { ?> |
|
373 | 373 | <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div> |
374 | 374 | <?php } ?> |
375 | 375 | |
@@ -379,14 +379,14 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @since 3.0.0 |
381 | 381 | */ |
382 | -do_action( 'widgets_admin_page' ); ?> |
|
382 | +do_action('widgets_admin_page'); ?> |
|
383 | 383 | |
384 | 384 | <div class="widget-liquid-left"> |
385 | 385 | <div id="widgets-left"> |
386 | 386 | <div id="available-widgets" class="widgets-holder-wrap"> |
387 | 387 | <div class="sidebar-name"> |
388 | 388 | <div class="sidebar-name-arrow"><br /></div> |
389 | - <h2><?php _e( 'Available Widgets' ); ?> <span id="removing-widget"><?php _ex( 'Deactivate', 'removing-widget' ); ?> <span></span></span></h2> |
|
389 | + <h2><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h2> |
|
390 | 390 | </div> |
391 | 391 | <div class="widget-holder"> |
392 | 392 | <div class="sidebar-description"> |
@@ -403,40 +403,40 @@ discard block |
||
403 | 403 | <?php |
404 | 404 | |
405 | 405 | $theme_sidebars = array(); |
406 | -foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) { |
|
407 | - if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) { |
|
406 | +foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) { |
|
407 | + if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) { |
|
408 | 408 | $wrap_class = 'widgets-holder-wrap'; |
409 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
410 | - $wrap_class .= ' ' . $registered_sidebar['class']; |
|
409 | + if ( ! empty($registered_sidebar['class'])) |
|
410 | + $wrap_class .= ' '.$registered_sidebar['class']; |
|
411 | 411 | |
412 | 412 | $is_inactive_widgets = 'wp_inactive_widgets' == $registered_sidebar['id']; |
413 | 413 | ?> |
414 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
414 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
415 | 415 | <div class="widget-holder inactive"> |
416 | - <?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?> |
|
416 | + <?php wp_list_widget_controls($registered_sidebar['id'], $registered_sidebar['name']); ?> |
|
417 | 417 | |
418 | - <?php if ( $is_inactive_widgets ) { ?> |
|
418 | + <?php if ($is_inactive_widgets) { ?> |
|
419 | 419 | <div class="remove-inactive-widgets"> |
420 | 420 | <form action="" method="post"> |
421 | 421 | <p> |
422 | 422 | <?php |
423 | - $attributes = array( 'id' => 'inactive-widgets-control-remove' ); |
|
423 | + $attributes = array('id' => 'inactive-widgets-control-remove'); |
|
424 | 424 | |
425 | - if ( empty($sidebars_widgets['wp_inactive_widgets']) ) { |
|
425 | + if (empty($sidebars_widgets['wp_inactive_widgets'])) { |
|
426 | 426 | $attributes['disabled'] = ''; |
427 | 427 | } |
428 | 428 | |
429 | - submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, $attributes ); |
|
429 | + submit_button(__('Clear Inactive Widgets'), 'delete', 'removeinactivewidgets', false, $attributes); |
|
430 | 430 | ?> |
431 | 431 | <span class="spinner"></span> |
432 | 432 | </p> |
433 | - <?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?> |
|
433 | + <?php wp_nonce_field('remove-inactive-widgets', '_wpnonce_remove_inactive_widgets'); ?> |
|
434 | 434 | </form> |
435 | 435 | </div> |
436 | 436 | <?php } ?> |
437 | 437 | </div> |
438 | - <?php if ( $is_inactive_widgets ) { ?> |
|
439 | - <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> |
|
438 | + <?php if ($is_inactive_widgets) { ?> |
|
439 | + <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> |
|
440 | 440 | <?php } ?> |
441 | 441 | </div> |
442 | 442 | <?php |
@@ -453,10 +453,10 @@ discard block |
||
453 | 453 | |
454 | 454 | $i = $split = 0; |
455 | 455 | $single_sidebar_class = ''; |
456 | -$sidebars_count = count( $theme_sidebars ); |
|
456 | +$sidebars_count = count($theme_sidebars); |
|
457 | 457 | |
458 | -if ( $sidebars_count > 1 ) { |
|
459 | - $split = ceil( $sidebars_count / 2 ); |
|
458 | +if ($sidebars_count > 1) { |
|
459 | + $split = ceil($sidebars_count / 2); |
|
460 | 460 | } else { |
461 | 461 | $single_sidebar_class = ' single-sidebar'; |
462 | 462 | } |
@@ -467,23 +467,23 @@ discard block |
||
467 | 467 | <div class="sidebars-column-1"> |
468 | 468 | <?php |
469 | 469 | |
470 | -foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) { |
|
470 | +foreach ($theme_sidebars as $sidebar => $registered_sidebar) { |
|
471 | 471 | $wrap_class = 'widgets-holder-wrap'; |
472 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
473 | - $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
472 | + if ( ! empty($registered_sidebar['class'])) |
|
473 | + $wrap_class .= ' sidebar-'.$registered_sidebar['class']; |
|
474 | 474 | |
475 | - if ( $i > 0 ) |
|
475 | + if ($i > 0) |
|
476 | 476 | $wrap_class .= ' closed'; |
477 | 477 | |
478 | - if ( $split && $i == $split ) { |
|
478 | + if ($split && $i == $split) { |
|
479 | 479 | ?> |
480 | 480 | </div><div class="sidebars-column-2"> |
481 | 481 | <?php |
482 | 482 | } |
483 | 483 | |
484 | 484 | ?> |
485 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
486 | - <?php wp_list_widget_controls( $sidebar, $registered_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?> |
|
485 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
486 | + <?php wp_list_widget_controls($sidebar, $registered_sidebar['name']); // Show the control forms for each of the widgets in this sidebar ?> |
|
487 | 487 | </div> |
488 | 488 | <?php |
489 | 489 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | </div> |
496 | 496 | </div> |
497 | 497 | <form method="post"> |
498 | -<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?> |
|
498 | +<?php wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false); ?> |
|
499 | 499 | </form> |
500 | 500 | <br class="clear" /> |
501 | 501 | </div> |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | <div class="widgets-chooser"> |
504 | 504 | <ul class="widgets-chooser-sidebars"></ul> |
505 | 505 | <div class="widgets-chooser-actions"> |
506 | - <button class="button widgets-chooser-cancel"><?php _e( 'Cancel' ); ?></button> |
|
507 | - <button class="button button-primary widgets-chooser-add"><?php _e( 'Add Widget' ); ?></button> |
|
506 | + <button class="button widgets-chooser-cancel"><?php _e('Cancel'); ?></button> |
|
507 | + <button class="button button-primary widgets-chooser-add"><?php _e('Add Widget'); ?></button> |
|
508 | 508 | </div> |
509 | 509 | </div> |
510 | 510 | |
@@ -515,5 +515,5 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @since 2.2.0 |
517 | 517 | */ |
518 | -do_action( 'sidebar_admin_page' ); |
|
519 | -require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
518 | +do_action('sidebar_admin_page'); |
|
519 | +require_once(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load ); |
23 | 23 | $load = array_unique( explode( ',', $load ) ); |
24 | 24 | |
25 | -if ( empty($load) ) |
|
25 | +if ( empty($load) ) { |
|
26 | 26 | exit; |
27 | +} |
|
27 | 28 | |
28 | 29 | $compress = ( isset($_GET['c']) && $_GET['c'] ); |
29 | 30 | $force_gzip = ( $compress && 'gzip' == $_GET['c'] ); |
@@ -44,8 +45,9 @@ discard block |
||
44 | 45 | } |
45 | 46 | |
46 | 47 | foreach ( $load as $handle ) { |
47 | - if ( !array_key_exists($handle, $wp_styles->registered) ) |
|
48 | - continue; |
|
48 | + if ( !array_key_exists($handle, $wp_styles->registered) ) { |
|
49 | + continue; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $style = $wp_styles->registered[$handle]; |
51 | 53 |
@@ -8,86 +8,86 @@ |
||
8 | 8 | error_reporting(0); |
9 | 9 | |
10 | 10 | /** Set ABSPATH for execution */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | - define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | + define('ABSPATH', dirname(dirname(__FILE__)).'/'); |
|
13 | 13 | } |
14 | 14 | |
15 | -define( 'WPINC', 'wp-includes' ); |
|
15 | +define('WPINC', 'wp-includes'); |
|
16 | 16 | |
17 | -require( ABSPATH . 'wp-admin/includes/noop.php' ); |
|
18 | -require( ABSPATH . WPINC . '/script-loader.php' ); |
|
19 | -require( ABSPATH . WPINC . '/version.php' ); |
|
17 | +require(ABSPATH.'wp-admin/includes/noop.php'); |
|
18 | +require(ABSPATH.WPINC.'/script-loader.php'); |
|
19 | +require(ABSPATH.WPINC.'/version.php'); |
|
20 | 20 | |
21 | 21 | $load = $_GET['load']; |
22 | -if ( is_array( $load ) ) { |
|
23 | - $load = implode( '', $load ); |
|
22 | +if (is_array($load)) { |
|
23 | + $load = implode('', $load); |
|
24 | 24 | } |
25 | -$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load ); |
|
26 | -$load = array_unique( explode( ',', $load ) ); |
|
25 | +$load = preg_replace('/[^a-z0-9,_-]+/i', '', $load); |
|
26 | +$load = array_unique(explode(',', $load)); |
|
27 | 27 | |
28 | -if ( empty($load) ) |
|
28 | +if (empty($load)) |
|
29 | 29 | exit; |
30 | 30 | |
31 | -$compress = ( isset($_GET['c']) && $_GET['c'] ); |
|
32 | -$force_gzip = ( $compress && 'gzip' == $_GET['c'] ); |
|
33 | -$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] ); |
|
31 | +$compress = (isset($_GET['c']) && $_GET['c']); |
|
32 | +$force_gzip = ($compress && 'gzip' == $_GET['c']); |
|
33 | +$rtl = (isset($_GET['dir']) && 'rtl' == $_GET['dir']); |
|
34 | 34 | $expires_offset = 31536000; // 1 year |
35 | 35 | $out = ''; |
36 | 36 | |
37 | 37 | $wp_styles = new WP_Styles(); |
38 | 38 | wp_default_styles($wp_styles); |
39 | 39 | |
40 | -if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) { |
|
40 | +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) === $wp_version) { |
|
41 | 41 | $protocol = $_SERVER['SERVER_PROTOCOL']; |
42 | - if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { |
|
42 | + if ( ! in_array($protocol, array('HTTP/1.1', 'HTTP/2', 'HTTP/2.0'))) { |
|
43 | 43 | $protocol = 'HTTP/1.0'; |
44 | 44 | } |
45 | - header( "$protocol 304 Not Modified" ); |
|
45 | + header("$protocol 304 Not Modified"); |
|
46 | 46 | exit(); |
47 | 47 | } |
48 | 48 | |
49 | -foreach ( $load as $handle ) { |
|
50 | - if ( !array_key_exists($handle, $wp_styles->registered) ) |
|
49 | +foreach ($load as $handle) { |
|
50 | + if ( ! array_key_exists($handle, $wp_styles->registered)) |
|
51 | 51 | continue; |
52 | 52 | |
53 | 53 | $style = $wp_styles->registered[$handle]; |
54 | 54 | |
55 | - if ( empty( $style->src ) ) { |
|
55 | + if (empty($style->src)) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
59 | - $path = ABSPATH . $style->src; |
|
59 | + $path = ABSPATH.$style->src; |
|
60 | 60 | |
61 | - if ( $rtl && ! empty( $style->extra['rtl'] ) ) { |
|
61 | + if ($rtl && ! empty($style->extra['rtl'])) { |
|
62 | 62 | // All default styles have fully independent RTL files. |
63 | - $path = str_replace( '.min.css', '-rtl.min.css', $path ); |
|
63 | + $path = str_replace('.min.css', '-rtl.min.css', $path); |
|
64 | 64 | } |
65 | 65 | |
66 | - $content = get_file( $path ) . "\n"; |
|
66 | + $content = get_file($path)."\n"; |
|
67 | 67 | |
68 | - if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) { |
|
69 | - $content = str_replace( '../images/', '../' . WPINC . '/images/', $content ); |
|
70 | - $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content ); |
|
71 | - $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content ); |
|
68 | + if (strpos($style->src, '/'.WPINC.'/css/') === 0) { |
|
69 | + $content = str_replace('../images/', '../'.WPINC.'/images/', $content); |
|
70 | + $content = str_replace('../js/tinymce/', '../'.WPINC.'/js/tinymce/', $content); |
|
71 | + $content = str_replace('../fonts/', '../'.WPINC.'/fonts/', $content); |
|
72 | 72 | $out .= $content; |
73 | 73 | } else { |
74 | - $out .= str_replace( '../images/', 'images/', $content ); |
|
74 | + $out .= str_replace('../images/', 'images/', $content); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | 78 | header("Etag: $wp_version"); |
79 | 79 | header('Content-Type: text/css; charset=UTF-8'); |
80 | -header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); |
|
80 | +header('Expires: '.gmdate("D, d M Y H:i:s", time() + $expires_offset).' GMT'); |
|
81 | 81 | header("Cache-Control: public, max-age=$expires_offset"); |
82 | 82 | |
83 | -if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { |
|
83 | +if ($compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { |
|
84 | 84 | header('Vary: Accept-Encoding'); // Handle proxies |
85 | - if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { |
|
85 | + if (false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip) { |
|
86 | 86 | header('Content-Encoding: deflate'); |
87 | - $out = gzdeflate( $out, 3 ); |
|
88 | - } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) { |
|
87 | + $out = gzdeflate($out, 3); |
|
88 | + } elseif (false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode')) { |
|
89 | 89 | header('Content-Encoding: gzip'); |
90 | - $out = gzencode( $out, 3 ); |
|
90 | + $out = gzencode($out, 3); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |