@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | 'nonce' => 'options', |
19 | 19 | )); |
20 | 20 | |
21 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
21 | + wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
22 | 22 | |
23 | 23 | ?> |
24 | 24 | |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | <!-- Update --> |
46 | 46 | <div id="submitdiv" class="postbox"> |
47 | 47 | |
48 | - <h3 class="hndle" style="border-bottom:none;"><span><?php _e("Publish",'acf'); ?></span></h3> |
|
48 | + <h3 class="hndle" style="border-bottom:none;"><span><?php _e("Publish", 'acf'); ?></span></h3> |
|
49 | 49 | |
50 | 50 | <div id="major-publishing-actions"> |
51 | 51 | |
52 | 52 | <div id="publishing-action"> |
53 | 53 | <span class="spinner"></span> |
54 | - <input type="submit" accesskey="p" value="<?php _e("Save Options",'acf'); ?>" class="button button-primary button-large" id="publish" name="publish"> |
|
54 | + <input type="submit" accesskey="p" value="<?php _e("Save Options", 'acf'); ?>" class="button button-primary button-large" id="publish" name="publish"> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class="clear"></div> |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | <div class="acf-box"> |
20 | 20 | <div class="title"> |
21 | - <h3><?php echo acf_get_setting('name'); ?> <?php _e('License','acf') ?></h3> |
|
21 | + <h3><?php echo acf_get_setting('name'); ?> <?php _e('License', 'acf') ?></h3> |
|
22 | 22 | </div> |
23 | 23 | <div class="inner"> |
24 | - <p><?php _e("To unlock updates, please enter your license key below. If you don't have a licence key, please see",'acf'); ?> <a href="http://www.advancedcustomfields.com/pro" target="_blank"><?php _e('details & pricing', 'acf'); ?></a></p> |
|
24 | + <p><?php _e("To unlock updates, please enter your license key below. If you don't have a licence key, please see", 'acf'); ?> <a href="http://www.advancedcustomfields.com/pro" target="_blank"><?php _e('details & pricing', 'acf'); ?></a></p> |
|
25 | 25 | <form action="" method="post"> |
26 | 26 | <div class="acf-hidden"> |
27 | - <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( $nonce ); ?>" /> |
|
27 | + <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce($nonce); ?>" /> |
|
28 | 28 | </div> |
29 | 29 | <table class="form-table"> |
30 | 30 | <tbody> |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | <label><?php _e('Update Available', 'acf'); ?></label> |
89 | 89 | </th> |
90 | 90 | <td> |
91 | - <?php if( $update_available ): ?> |
|
91 | + <?php if ($update_available): ?> |
|
92 | 92 | |
93 | 93 | <span style="margin-right: 5px;"><?php _e('Yes', 'acf'); ?></span> |
94 | 94 | |
95 | - <?php if( $active ): ?> |
|
95 | + <?php if ($active): ?> |
|
96 | 96 | <a class="acf-button blue" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a> |
97 | 97 | <?php else: ?> |
98 | 98 | <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | <?php endif; ?> |
106 | 106 | </td> |
107 | 107 | </tr> |
108 | - <?php if( $changelog ): ?> |
|
108 | + <?php if ($changelog): ?> |
|
109 | 109 | <tr> |
110 | 110 | <th> |
111 | 111 | <label><?php _e('Changelog', 'acf'); ?></label> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | </td> |
116 | 116 | </tr> |
117 | 117 | <?php endif; ?> |
118 | - <?php if( $upgrade_notice ): ?> |
|
118 | + <?php if ($upgrade_notice): ?> |
|
119 | 119 | <tr> |
120 | 120 | <th> |
121 | 121 | <label><?php _e('Upgrade Notice', 'acf'); ?></label> |
@@ -94,13 +94,19 @@ |
||
94 | 94 | |
95 | 95 | <?php if( $active ): ?> |
96 | 96 | <a class="acf-button blue" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a> |
97 | - <?php else: ?> |
|
98 | - <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a> |
|
97 | + <?php else { |
|
98 | + : ?> |
|
99 | + <a class="acf-button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); |
|
100 | +} |
|
101 | +?></a> |
|
99 | 102 | <?php endif; ?> |
100 | 103 | |
101 | - <?php else: ?> |
|
104 | + <?php else { |
|
105 | + : ?> |
|
102 | 106 | |
103 | - <span style="margin-right: 5px;"><?php _e('No', 'acf'); ?></span> |
|
107 | + <span style="margin-right: 5px;"><?php _e('No', 'acf'); |
|
108 | +} |
|
109 | +?></span> |
|
104 | 110 | <a class="acf-button" href="<?php echo add_query_arg('force-check', 1); ?>"><?php _e('Check Again', 'acf'); ?></a> |
105 | 111 | <?php endif; ?> |
106 | 112 | </td> |
@@ -13,18 +13,18 @@ discard block |
||
13 | 13 | * @return $post_id (int) |
14 | 14 | */ |
15 | 15 | |
16 | -function acf_get_valid_options_page( $page = '' ) { |
|
16 | +function acf_get_valid_options_page($page = '') { |
|
17 | 17 | |
18 | 18 | // allow for string |
19 | - if( empty($page) ) { |
|
19 | + if (empty($page)) { |
|
20 | 20 | |
21 | 21 | $page = array( |
22 | - 'page_title' => __('Options','acf'), |
|
23 | - 'menu_title' => __('Options','acf'), |
|
22 | + 'page_title' => __('Options', 'acf'), |
|
23 | + 'menu_title' => __('Options', 'acf'), |
|
24 | 24 | 'menu_slug' => 'acf-options', |
25 | 25 | ); |
26 | 26 | |
27 | - } elseif( is_string($page) ) { |
|
27 | + } elseif (is_string($page)) { |
|
28 | 28 | |
29 | 29 | $page_title = $page; |
30 | 30 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | 'parent' => 'parent_slug' |
59 | 59 | ); |
60 | 60 | |
61 | - foreach( $migrate as $old => $new ) { |
|
61 | + foreach ($migrate as $old => $new) { |
|
62 | 62 | |
63 | - if( !empty($page[ $old ]) ) { |
|
63 | + if ( ! empty($page[$old])) { |
|
64 | 64 | |
65 | - $page[ $new ] = acf_extract_var( $page, $old ); |
|
65 | + $page[$new] = acf_extract_var($page, $old); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // page_title (allows user to define page with just page_title or title) |
73 | - if( empty($page['menu_title']) ) { |
|
73 | + if (empty($page['menu_title'])) { |
|
74 | 74 | |
75 | 75 | $page['menu_title'] = $page['page_title']; |
76 | 76 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | |
80 | 80 | // menu_slug |
81 | - if( empty($page['menu_slug']) ) { |
|
81 | + if (empty($page['menu_slug'])) { |
|
82 | 82 | |
83 | - $page['menu_slug'] = 'acf-options-' . sanitize_title( $page['menu_title'] ); |
|
83 | + $page['menu_slug'] = 'acf-options-'.sanitize_title($page['menu_title']); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | * @return $post_id (int) |
105 | 105 | */ |
106 | 106 | |
107 | -function acf_get_options_page( $slug ) { |
|
107 | +function acf_get_options_page($slug) { |
|
108 | 108 | |
109 | 109 | // bail early if page doens't exist |
110 | - if( empty($GLOBALS['acf_options_pages'][ $slug ]) ) { |
|
110 | + if (empty($GLOBALS['acf_options_pages'][$slug])) { |
|
111 | 111 | |
112 | 112 | return false; |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | |
117 | 117 | // vars |
118 | - $page = $GLOBALS['acf_options_pages'][ $slug ]; |
|
118 | + $page = $GLOBALS['acf_options_pages'][$slug]; |
|
119 | 119 | |
120 | 120 | |
121 | 121 | // filter for 3rd party customization |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | |
150 | 150 | // bail early if empty |
151 | - if( empty($GLOBALS['acf_options_pages']) ) { |
|
151 | + if (empty($GLOBALS['acf_options_pages'])) { |
|
152 | 152 | |
153 | 153 | return false; |
154 | 154 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | // get pages |
165 | - foreach( $slugs as $slug ) { |
|
165 | + foreach ($slugs as $slug) { |
|
166 | 166 | |
167 | 167 | // append |
168 | - $pages[] = acf_get_options_page( $slug ); |
|
168 | + $pages[] = acf_get_options_page($slug); |
|
169 | 169 | |
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | - foreach( $pages as $i => $page ) { |
|
173 | + foreach ($pages as $i => $page) { |
|
174 | 174 | |
175 | 175 | // bail early if is child |
176 | - if( !empty($page['parent_slug']) ) { |
|
176 | + if ( ! empty($page['parent_slug'])) { |
|
177 | 177 | |
178 | 178 | continue; |
179 | 179 | |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | // add missing position |
184 | - if( !$page['position']) { |
|
184 | + if ( ! $page['position']) { |
|
185 | 185 | |
186 | 186 | $_wp_last_utility_menu++; |
187 | 187 | |
188 | - $pages[ $i ]['position'] = $_wp_last_utility_menu; |
|
188 | + $pages[$i]['position'] = $_wp_last_utility_menu; |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | 193 | // bail early if no redirect |
194 | - if( empty($page['redirect']) ) { |
|
194 | + if (empty($page['redirect'])) { |
|
195 | 195 | |
196 | 196 | continue; |
197 | 197 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | // update children |
207 | - foreach( $pages as $j => $sub_page ) { |
|
207 | + foreach ($pages as $j => $sub_page) { |
|
208 | 208 | |
209 | 209 | // bail early if not child |
210 | - if( $sub_page['parent_slug'] !== $parent ) { |
|
210 | + if ($sub_page['parent_slug'] !== $parent) { |
|
211 | 211 | |
212 | 212 | continue; |
213 | 213 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | |
217 | 217 | // update $child if empt |
218 | - if( empty($child) ) { |
|
218 | + if (empty($child)) { |
|
219 | 219 | |
220 | 220 | $child = $sub_page['menu_slug']; |
221 | 221 | |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | |
224 | 224 | |
225 | 225 | // update parent_slug |
226 | - $pages[ $j ]['parent_slug'] = $child; |
|
226 | + $pages[$j]['parent_slug'] = $child; |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | 231 | // finally update parent menu_slug |
232 | - if( $child ) { |
|
232 | + if ($child) { |
|
233 | 233 | |
234 | - $pages[ $i ]['menu_slug'] = $child; |
|
234 | + $pages[$i]['menu_slug'] = $child; |
|
235 | 235 | |
236 | 236 | } |
237 | 237 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * @return $post_id (int) |
258 | 258 | */ |
259 | 259 | |
260 | -function acf_update_options_page( $data ) { |
|
260 | +function acf_update_options_page($data) { |
|
261 | 261 | |
262 | 262 | // bail early if no menu_slug |
263 | - if( empty($data['menu_slug']) ) { |
|
263 | + if (empty($data['menu_slug'])) { |
|
264 | 264 | |
265 | 265 | return false; |
266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | |
273 | 273 | // bail early if no page found |
274 | - if( empty($GLOBALS['acf_options_pages'][ $slug ]) ) { |
|
274 | + if (empty($GLOBALS['acf_options_pages'][$slug])) { |
|
275 | 275 | |
276 | 276 | return false; |
277 | 277 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | |
281 | 281 | // vars |
282 | - $page = $GLOBALS['acf_options_pages'][ $slug ]; |
|
282 | + $page = $GLOBALS['acf_options_pages'][$slug]; |
|
283 | 283 | |
284 | 284 | |
285 | 285 | // merge in data |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | |
289 | 289 | // update |
290 | - $GLOBALS['acf_options_pages'][ $slug ] = $page; |
|
290 | + $GLOBALS['acf_options_pages'][$slug] = $page; |
|
291 | 291 | |
292 | 292 | |
293 | 293 | // return |
@@ -309,16 +309,16 @@ discard block |
||
309 | 309 | * @return $post_id (int) |
310 | 310 | */ |
311 | 311 | |
312 | -if( ! function_exists('acf_add_options_page') ): |
|
312 | +if ( ! function_exists('acf_add_options_page')): |
|
313 | 313 | |
314 | -function acf_add_options_page( $page = '' ) { |
|
314 | +function acf_add_options_page($page = '') { |
|
315 | 315 | |
316 | 316 | // validate |
317 | - $page = acf_get_valid_options_page( $page ); |
|
317 | + $page = acf_get_valid_options_page($page); |
|
318 | 318 | |
319 | 319 | |
320 | 320 | // instantiate globals |
321 | - if( empty($GLOBALS['acf_options_pages']) ) { |
|
321 | + if (empty($GLOBALS['acf_options_pages'])) { |
|
322 | 322 | |
323 | 323 | $GLOBALS['acf_options_pages'] = array(); |
324 | 324 | |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | |
327 | 327 | |
328 | 328 | // update if already exists |
329 | - if( acf_get_options_page($page['menu_slug']) ) { |
|
329 | + if (acf_get_options_page($page['menu_slug'])) { |
|
330 | 330 | |
331 | - return acf_update_options_page( $page ); |
|
331 | + return acf_update_options_page($page); |
|
332 | 332 | |
333 | 333 | } |
334 | 334 | |
335 | 335 | |
336 | 336 | // append |
337 | - $GLOBALS['acf_options_pages'][ $page['menu_slug'] ] = $page; |
|
337 | + $GLOBALS['acf_options_pages'][$page['menu_slug']] = $page; |
|
338 | 338 | |
339 | 339 | |
340 | 340 | // return |
@@ -358,16 +358,16 @@ discard block |
||
358 | 358 | * @return $post_id (int) |
359 | 359 | */ |
360 | 360 | |
361 | -if( ! function_exists('acf_add_options_sub_page') ): |
|
361 | +if ( ! function_exists('acf_add_options_sub_page')): |
|
362 | 362 | |
363 | -function acf_add_options_sub_page( $page = '' ) { |
|
363 | +function acf_add_options_sub_page($page = '') { |
|
364 | 364 | |
365 | 365 | // validate |
366 | - $page = acf_get_valid_options_page( $page ); |
|
366 | + $page = acf_get_valid_options_page($page); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | // parent |
370 | - if( !$page['parent_slug'] ) { |
|
370 | + if ( ! $page['parent_slug']) { |
|
371 | 371 | |
372 | 372 | // set parent slug |
373 | 373 | $page['parent_slug'] = 'acf-options'; |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | |
377 | 377 | |
378 | 378 | // create default parent if not yet exists |
379 | - if( $page['parent_slug'] === 'acf-options' ) { |
|
379 | + if ($page['parent_slug'] === 'acf-options') { |
|
380 | 380 | |
381 | - if( !acf_get_options_page('acf-options') ) { |
|
381 | + if ( ! acf_get_options_page('acf-options')) { |
|
382 | 382 | |
383 | 383 | acf_add_options_page(); |
384 | 384 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | |
390 | 390 | // return |
391 | - return acf_add_options_page( $page ); |
|
391 | + return acf_add_options_page($page); |
|
392 | 392 | |
393 | 393 | } |
394 | 394 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @return n/a |
409 | 409 | */ |
410 | 410 | |
411 | -if( ! function_exists('acf_set_options_page_title') ): |
|
411 | +if ( ! function_exists('acf_set_options_page_title')): |
|
412 | 412 | |
413 | -function acf_set_options_page_title( $title = 'Options' ) { |
|
413 | +function acf_set_options_page_title($title = 'Options') { |
|
414 | 414 | |
415 | 415 | acf_update_options_page(array( |
416 | 416 | 'menu_slug' => 'acf-options', |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | * @return n/a |
437 | 437 | */ |
438 | 438 | |
439 | -if( ! function_exists('acf_set_options_page_menu') ): |
|
439 | +if ( ! function_exists('acf_set_options_page_menu')): |
|
440 | 440 | |
441 | -function acf_set_options_page_menu( $title = 'Options' ) { |
|
441 | +function acf_set_options_page_menu($title = 'Options') { |
|
442 | 442 | |
443 | 443 | acf_update_options_page(array( |
444 | 444 | 'menu_slug' => 'acf-options', |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | * @return n/a |
464 | 464 | */ |
465 | 465 | |
466 | -if( ! function_exists('acf_set_options_page_capability') ): |
|
466 | +if ( ! function_exists('acf_set_options_page_capability')): |
|
467 | 467 | |
468 | -function acf_set_options_page_capability( $capability = 'edit_posts' ) { |
|
468 | +function acf_set_options_page_capability($capability = 'edit_posts') { |
|
469 | 469 | |
470 | 470 | acf_update_options_page(array( |
471 | 471 | 'menu_slug' => 'acf-options', |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | * @return N/A |
491 | 491 | */ |
492 | 492 | |
493 | -if( ! function_exists('register_options_page') ): |
|
493 | +if ( ! function_exists('register_options_page')): |
|
494 | 494 | |
495 | -function register_options_page( $title = false ) { |
|
495 | +function register_options_page($title = false) { |
|
496 | 496 | |
497 | - acf_add_options_sub_page( $title ); |
|
497 | + acf_add_options_sub_page($title); |
|
498 | 498 | |
499 | 499 | } |
500 | 500 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // append plugin information |
26 | 26 | // Note: is_admin() was used previously, however this prevents jetpack manage & ManageWP from working |
27 | - add_filter('plugins_api', array($this, 'inject_info'), 20, 3); |
|
27 | + add_filter('plugins_api', array($this, 'inject_info'), 20, 3); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | // append update information |
@@ -59,33 +59,33 @@ discard block |
||
59 | 59 | |
60 | 60 | |
61 | 61 | // validate |
62 | - if( isset($args->slug) && $args->slug == $slug ) { |
|
62 | + if( isset($args->slug) && $args->slug == $slug ) { |
|
63 | 63 | |
64 | - $info = acf_pro_get_remote_info(); |
|
65 | - $sections = acf_extract_vars($info, array( |
|
66 | - 'description', |
|
67 | - 'installation', |
|
68 | - 'changelog', |
|
69 | - 'upgrade_notice', |
|
70 | - )); |
|
64 | + $info = acf_pro_get_remote_info(); |
|
65 | + $sections = acf_extract_vars($info, array( |
|
66 | + 'description', |
|
67 | + 'installation', |
|
68 | + 'changelog', |
|
69 | + 'upgrade_notice', |
|
70 | + )); |
|
71 | 71 | |
72 | - $obj = new stdClass(); |
|
72 | + $obj = new stdClass(); |
|
73 | 73 | |
74 | - foreach( $info as $k => $v ) { |
|
74 | + foreach( $info as $k => $v ) { |
|
75 | 75 | |
76 | - $obj->$k = $v; |
|
76 | + $obj->$k = $v; |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - $obj->sections = $sections; |
|
80 | + $obj->sections = $sections; |
|
81 | 81 | |
82 | - return $obj; |
|
82 | + return $obj; |
|
83 | 83 | |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | - // return |
|
88 | - return $result; |
|
87 | + // return |
|
88 | + return $result; |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | - // vars |
|
136 | + // vars |
|
137 | 137 | $info = acf_pro_get_remote_info(); |
138 | 138 | $basename = acf_get_setting('basename'); |
139 | 139 | $slug = acf_get_setting('slug'); |
140 | 140 | |
141 | 141 | |
142 | - // create new object for update |
|
143 | - $obj = new stdClass(); |
|
144 | - $obj->slug = $slug; |
|
145 | - $obj->plugin = $basename; |
|
146 | - $obj->new_version = $info['version']; |
|
147 | - $obj->url = $info['homepage']; |
|
148 | - $obj->package = ''; |
|
142 | + // create new object for update |
|
143 | + $obj = new stdClass(); |
|
144 | + $obj->slug = $slug; |
|
145 | + $obj->plugin = $basename; |
|
146 | + $obj->new_version = $info['version']; |
|
147 | + $obj->url = $info['homepage']; |
|
148 | + $obj->package = ''; |
|
149 | 149 | |
150 | 150 | |
151 | - // license |
|
151 | + // license |
|
152 | 152 | if( acf_pro_is_license_active() ) { |
153 | 153 | |
154 | 154 | $obj->package = acf_pro_get_remote_url('download', array( |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | - // add to transient |
|
165 | - $transient->response[ $basename ] = $obj; |
|
164 | + // add to transient |
|
165 | + $transient->response[ $basename ] = $obj; |
|
166 | 166 | |
167 | 167 | |
168 | 168 | // return |
169 | - return $transient; |
|
169 | + return $transient; |
|
170 | 170 | |
171 | 171 | } |
172 | 172 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
4 | 4 | |
5 | -if( ! class_exists('acf_pro_updates') ) : |
|
5 | +if ( ! class_exists('acf_pro_updates')) : |
|
6 | 6 | |
7 | 7 | class acf_pro_updates { |
8 | 8 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | // add custom message when PRO not activated but update available |
35 | - add_action('in_plugin_update_message-' . acf_get_setting('basename'), array($this, 'in_plugin_update_message'), 10, 2 ); |
|
35 | + add_action('in_plugin_update_message-'.acf_get_setting('basename'), array($this, 'in_plugin_update_message'), 10, 2); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | * @return $result |
53 | 53 | */ |
54 | 54 | |
55 | - function inject_info( $result, $action = null, $args = null ) { |
|
55 | + function inject_info($result, $action = null, $args = null) { |
|
56 | 56 | |
57 | 57 | // vars |
58 | 58 | $slug = acf_get_setting('slug'); |
59 | 59 | |
60 | 60 | |
61 | 61 | // validate |
62 | - if( isset($args->slug) && $args->slug == $slug ) { |
|
62 | + if (isset($args->slug) && $args->slug == $slug) { |
|
63 | 63 | |
64 | 64 | $info = acf_pro_get_remote_info(); |
65 | 65 | $sections = acf_extract_vars($info, array( |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $obj = new stdClass(); |
73 | 73 | |
74 | - foreach( $info as $k => $v ) { |
|
74 | + foreach ($info as $k => $v) { |
|
75 | 75 | |
76 | 76 | $obj->$k = $v; |
77 | 77 | |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * @return $transient |
104 | 104 | */ |
105 | 105 | |
106 | - function inject_update( $transient ) { |
|
106 | + function inject_update($transient) { |
|
107 | 107 | |
108 | 108 | // vars |
109 | 109 | $basename = acf_get_setting('basename'); |
110 | 110 | |
111 | 111 | |
112 | 112 | // bail early if no show_updates |
113 | - if( !acf_get_setting('show_updates') ) { |
|
113 | + if ( ! acf_get_setting('show_updates')) { |
|
114 | 114 | |
115 | 115 | return $transient; |
116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | |
120 | 120 | // bail early if not a plugin (included in theme) |
121 | - if( !is_plugin_active($basename) ) { |
|
121 | + if ( ! is_plugin_active($basename)) { |
|
122 | 122 | |
123 | 123 | return; |
124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // bail early if no update available |
129 | - if( !acf_pro_is_update_available() ) { |
|
129 | + if ( ! acf_pro_is_update_available()) { |
|
130 | 130 | |
131 | 131 | return $transient; |
132 | 132 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | |
151 | 151 | // license |
152 | - if( acf_pro_is_license_active() ) { |
|
152 | + if (acf_pro_is_license_active()) { |
|
153 | 153 | |
154 | 154 | $obj->package = acf_pro_get_remote_url('download', array( |
155 | 155 | 'k' => acf_pro_get_license(), |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | // add to transient |
165 | - $transient->response[ $basename ] = $obj; |
|
165 | + $transient->response[$basename] = $obj; |
|
166 | 166 | |
167 | 167 | |
168 | 168 | // return |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | * @param {object} $r |
185 | 185 | */ |
186 | 186 | |
187 | - function in_plugin_update_message( $plugin_data, $r ) { |
|
187 | + function in_plugin_update_message($plugin_data, $r) { |
|
188 | 188 | |
189 | 189 | // validate |
190 | - if( acf_pro_is_license_active() ) { |
|
190 | + if (acf_pro_is_license_active()) { |
|
191 | 191 | |
192 | 192 | return; |
193 | 193 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | // show message |
202 | - echo '<br />' . sprintf( $m, admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'http://www.advancedcustomfields.com/pro'); |
|
202 | + echo '<br />'.sprintf($m, admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'http://www.advancedcustomfields.com/pro'); |
|
203 | 203 | |
204 | 204 | } |
205 | 205 |
@@ -1,6 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
3 | +if( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
6 | +// Exit if accessed directly |
|
4 | 7 | |
5 | 8 | if( ! class_exists('acf_pro_updates') ) : |
6 | 9 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_flexible_content') ) : |
|
14 | +if ( ! class_exists('acf_field_flexible_content')) : |
|
15 | 15 | |
16 | 16 | class acf_field_flexible_content extends acf_field { |
17 | 17 | |
@@ -33,24 +33,24 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'flexible_content'; |
36 | - $this->label = __("Flexible Content",'acf'); |
|
36 | + $this->label = __("Flexible Content", 'acf'); |
|
37 | 37 | $this->category = 'layout'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'layouts' => array(), |
40 | 40 | 'min' => '', |
41 | 41 | 'max' => '', |
42 | - 'button_label' => __("Add Row",'acf'), |
|
42 | + 'button_label' => __("Add Row", 'acf'), |
|
43 | 43 | ); |
44 | 44 | $this->l10n = array( |
45 | 45 | 'layout' => __("layout", 'acf'), |
46 | 46 | 'layouts' => __("layouts", 'acf'), |
47 | 47 | 'remove' => __("remove {layout}?", 'acf'), |
48 | - 'min' => __("This field requires at least {min} {identifier}",'acf'), |
|
49 | - 'max' => __("This field has a limit of {max} {identifier}",'acf'), |
|
50 | - 'min_layout' => __("This field requires at least {min} {label} {identifier}",'acf'), |
|
51 | - 'max_layout' => __("Maximum {label} limit reached ({max} {identifier})",'acf'), |
|
52 | - 'available' => __("{available} {label} {identifier} available (max {max})",'acf'), |
|
53 | - 'required' => __("{required} {label} {identifier} required (min {min})",'acf'), |
|
48 | + 'min' => __("This field requires at least {min} {identifier}", 'acf'), |
|
49 | + 'max' => __("This field has a limit of {max} {identifier}", 'acf'), |
|
50 | + 'min_layout' => __("This field requires at least {min} {label} {identifier}", 'acf'), |
|
51 | + 'max_layout' => __("Maximum {label} limit reached ({max} {identifier})", 'acf'), |
|
52 | + 'available' => __("{available} {label} {identifier} available (max {max})", 'acf'), |
|
53 | + 'required' => __("{required} {label} {identifier} required (min {min})", 'acf'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return $layout (array) |
74 | 74 | */ |
75 | 75 | |
76 | - function get_valid_layout( $layout = array() ) { |
|
76 | + function get_valid_layout($layout = array()) { |
|
77 | 77 | |
78 | 78 | // parse |
79 | 79 | $layout = wp_parse_args($layout, array( |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * @return $field - the field array holding all the field options |
107 | 107 | */ |
108 | 108 | |
109 | - function load_field( $field ) { |
|
109 | + function load_field($field) { |
|
110 | 110 | |
111 | 111 | // bail early if no field layouts |
112 | - if( empty($field['layouts']) ) { |
|
112 | + if (empty($field['layouts'])) { |
|
113 | 113 | |
114 | 114 | return $field; |
115 | 115 | |
@@ -121,34 +121,34 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // loop through layouts, sub fields and swap out the field key with the real field |
124 | - foreach( array_keys($field['layouts']) as $i ) { |
|
124 | + foreach (array_keys($field['layouts']) as $i) { |
|
125 | 125 | |
126 | 126 | // extract layout |
127 | - $layout = acf_extract_var( $field['layouts'], $i ); |
|
127 | + $layout = acf_extract_var($field['layouts'], $i); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | // validate layout |
131 | - $layout = $this->get_valid_layout( $layout ); |
|
131 | + $layout = $this->get_valid_layout($layout); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | // append sub fields |
135 | - if( !empty($sub_fields) ) { |
|
135 | + if ( ! empty($sub_fields)) { |
|
136 | 136 | |
137 | - foreach( array_keys($sub_fields) as $k ) { |
|
137 | + foreach (array_keys($sub_fields) as $k) { |
|
138 | 138 | |
139 | 139 | // check if 'parent_layout' is empty |
140 | - if( empty($sub_fields[ $k ]['parent_layout']) ) { |
|
140 | + if (empty($sub_fields[$k]['parent_layout'])) { |
|
141 | 141 | |
142 | 142 | // parent_layout did not save for this field, default it to first layout |
143 | - $sub_fields[ $k ]['parent_layout'] = $layout['key']; |
|
143 | + $sub_fields[$k]['parent_layout'] = $layout['key']; |
|
144 | 144 | |
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | 148 | // append sub field to layout, |
149 | - if( $sub_fields[ $k ]['parent_layout'] == $layout['key'] ) { |
|
149 | + if ($sub_fields[$k]['parent_layout'] == $layout['key']) { |
|
150 | 150 | |
151 | - $layout['sub_fields'][] = acf_extract_var( $sub_fields, $k ); |
|
151 | + $layout['sub_fields'][] = acf_extract_var($sub_fields, $k); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | |
160 | 160 | // append back to layouts |
161 | - $field['layouts'][ $i ] = $layout; |
|
161 | + $field['layouts'][$i] = $layout; |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | * @date 23/01/13 |
181 | 181 | */ |
182 | 182 | |
183 | - function render_field( $field ) { |
|
183 | + function render_field($field) { |
|
184 | 184 | |
185 | 185 | // defaults |
186 | - if( empty($field['button_label']) ) { |
|
186 | + if (empty($field['button_label'])) { |
|
187 | 187 | |
188 | 188 | $field['button_label'] = $this->defaults['button_label']; |
189 | 189 | |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | // sort layouts into names |
194 | 194 | $layouts = array(); |
195 | 195 | |
196 | - foreach( $field['layouts'] as $k => $layout ) { |
|
196 | + foreach ($field['layouts'] as $k => $layout) { |
|
197 | 197 | |
198 | - $layouts[ $layout['name'] ] = acf_extract_var( $field['layouts'], $k ); |
|
198 | + $layouts[$layout['name']] = acf_extract_var($field['layouts'], $k); |
|
199 | 199 | |
200 | 200 | } |
201 | 201 | |
@@ -208,34 +208,34 @@ discard block |
||
208 | 208 | |
209 | 209 | |
210 | 210 | // no value message |
211 | - $no_value_message = __('Click the "%s" button below to start creating your layout','acf'); |
|
211 | + $no_value_message = __('Click the "%s" button below to start creating your layout', 'acf'); |
|
212 | 212 | $no_value_message = apply_filters('acf/fields/flexible_content/no_value_message', $no_value_message, $field); |
213 | 213 | |
214 | 214 | ?> |
215 | -<div <?php acf_esc_attr_e(array( 'class' => 'acf-flexible-content', 'data-min' => $field['min'], 'data-max' => $field['max'] )); ?>> |
|
215 | +<div <?php acf_esc_attr_e(array('class' => 'acf-flexible-content', 'data-min' => $field['min'], 'data-max' => $field['max'])); ?>> |
|
216 | 216 | |
217 | - <div class="no-value-message" <?php if( $field['value'] ){ echo 'style="display:none;"'; } ?>> |
|
218 | - <?php printf( $no_value_message, $field['button_label'] ); ?> |
|
217 | + <div class="no-value-message" <?php if ($field['value']) { echo 'style="display:none;"'; } ?>> |
|
218 | + <?php printf($no_value_message, $field['button_label']); ?> |
|
219 | 219 | </div> |
220 | 220 | |
221 | 221 | <div class="clones"> |
222 | - <?php foreach( $layouts as $layout ): ?> |
|
223 | - <?php $this->render_layout( $field, $layout, 'acfcloneindex', array() ); ?> |
|
222 | + <?php foreach ($layouts as $layout): ?> |
|
223 | + <?php $this->render_layout($field, $layout, 'acfcloneindex', array()); ?> |
|
224 | 224 | <?php endforeach; ?> |
225 | 225 | </div> |
226 | 226 | <div class="values"> |
227 | - <?php if( !empty($field['value']) ): ?> |
|
228 | - <?php foreach( $field['value'] as $i => $value ): ?> |
|
227 | + <?php if ( ! empty($field['value'])): ?> |
|
228 | + <?php foreach ($field['value'] as $i => $value): ?> |
|
229 | 229 | <?php |
230 | 230 | |
231 | 231 | // validate |
232 | - if( empty($layouts[ $value['acf_fc_layout'] ]) ) { |
|
232 | + if (empty($layouts[$value['acf_fc_layout']])) { |
|
233 | 233 | |
234 | 234 | continue; |
235 | 235 | |
236 | 236 | } |
237 | 237 | |
238 | - $this->render_layout( $field, $layouts[ $value['acf_fc_layout'] ], $i, $value ); |
|
238 | + $this->render_layout($field, $layouts[$value['acf_fc_layout']], $i, $value); |
|
239 | 239 | |
240 | 240 | ?> |
241 | 241 | <?php endforeach; ?> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | <script type="text-html" class="tmpl-popup"><?php |
252 | 252 | ?><div class="acf-fc-popup"> |
253 | 253 | <ul> |
254 | - <?php foreach( $layouts as $layout ): |
|
254 | + <?php foreach ($layouts as $layout): |
|
255 | 255 | |
256 | 256 | $atts = array( |
257 | 257 | 'data-layout' => $layout['name'], |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | ?> |
263 | 263 | <li> |
264 | - <a href="#" <?php acf_esc_attr_e( $atts ); ?>><?php echo $layout['label']; ?><span class="status"></span></a> |
|
264 | + <a href="#" <?php acf_esc_attr_e($atts); ?>><?php echo $layout['label']; ?><span class="status"></span></a> |
|
265 | 265 | </li> |
266 | 266 | <?php endforeach; ?> |
267 | 267 | </ul> |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @return $post_id (int) |
289 | 289 | */ |
290 | 290 | |
291 | - function render_layout( $field, $layout, $i, $value ) { |
|
291 | + function render_layout($field, $layout, $i, $value) { |
|
292 | 292 | |
293 | 293 | // vars |
294 | 294 | $order = 0; |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | // collapsed |
304 | - $collapsed = acf_get_user_setting('collapsed_' . $field['key'], ''); |
|
304 | + $collapsed = acf_get_user_setting('collapsed_'.$field['key'], ''); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | // cookie fallback ( version < 5.3.2 ) |
308 | - if( $collapsed === '' ) { |
|
308 | + if ($collapsed === '') { |
|
309 | 309 | |
310 | 310 | $collapsed = acf_extract_var($_COOKIE, "acf_collapsed_{$field['key']}", ''); |
311 | 311 | $collapsed = str_replace('|', ',', $collapsed); |
312 | 312 | |
313 | - acf_update_user_setting( 'collapsed_' . $field['key'], $collapsed ); |
|
313 | + acf_update_user_setting('collapsed_'.$field['key'], $collapsed); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | |
323 | 323 | // collapsed class |
324 | - if( in_array($i, $collapsed) ) { |
|
324 | + if (in_array($i, $collapsed)) { |
|
325 | 325 | |
326 | 326 | $div['class'] .= ' -collapsed'; |
327 | 327 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | |
331 | 331 | // clone |
332 | - if( is_numeric($i) ) { |
|
332 | + if (is_numeric($i)) { |
|
333 | 333 | |
334 | 334 | $order = $i + 1; |
335 | 335 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | <div <?php acf_esc_attr_e($div); ?>> |
345 | 345 | |
346 | 346 | <div class="acf-hidden"> |
347 | - <?php acf_hidden_input(array( 'name' => "{$field['name']}[{$i}][acf_fc_layout]", 'value' => $layout['name'] )); ?> |
|
347 | + <?php acf_hidden_input(array('name' => "{$field['name']}[{$i}][acf_fc_layout]", 'value' => $layout['name'])); ?> |
|
348 | 348 | </div> |
349 | 349 | |
350 | 350 | <div class="acf-fc-layout-handle"> |
@@ -353,19 +353,19 @@ discard block |
||
353 | 353 | |
354 | 354 | <ul class="acf-fc-layout-controlls acf-hl"> |
355 | 355 | <li class="acf-fc-show-on-hover"> |
356 | - <a class="acf-icon -plus small" href="#" data-event="add-layout" title="<?php _e('Add layout','acf'); ?>"></a> |
|
356 | + <a class="acf-icon -plus small" href="#" data-event="add-layout" title="<?php _e('Add layout', 'acf'); ?>"></a> |
|
357 | 357 | </li> |
358 | 358 | <li class="acf-fc-show-on-hover"> |
359 | - <a class="acf-icon -minus small" href="#" data-event="remove-layout" title="<?php _e('Remove layout','acf'); ?>"></a> |
|
359 | + <a class="acf-icon -minus small" href="#" data-event="remove-layout" title="<?php _e('Remove layout', 'acf'); ?>"></a> |
|
360 | 360 | </li> |
361 | 361 | <li> |
362 | - <a class="acf-icon -collapse small" href="#" data-event="collapse-layout" title="<?php _e('Click to toggle','acf'); ?>"></a> |
|
362 | + <a class="acf-icon -collapse small" href="#" data-event="collapse-layout" title="<?php _e('Click to toggle', 'acf'); ?>"></a> |
|
363 | 363 | </li> |
364 | 364 | </ul> |
365 | 365 | |
366 | -<?php if( !empty($layout['sub_fields']) ): ?> |
|
366 | +<?php if ( ! empty($layout['sub_fields'])): ?> |
|
367 | 367 | |
368 | - <?php if( $layout['display'] == 'table' ): |
|
368 | + <?php if ($layout['display'] == 'table'): |
|
369 | 369 | |
370 | 370 | // update vars |
371 | 371 | $el = 'td'; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | <thead> |
377 | 377 | <tr> |
378 | - <?php foreach( $layout['sub_fields'] as $sub_field ): |
|
378 | + <?php foreach ($layout['sub_fields'] as $sub_field): |
|
379 | 379 | |
380 | 380 | $atts = array( |
381 | 381 | 'class' => "acf-th acf-th-{$sub_field['name']}", |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | |
385 | 385 | |
386 | 386 | // Add custom width |
387 | - if( $sub_field['wrapper']['width'] ) { |
|
387 | + if ($sub_field['wrapper']['width']) { |
|
388 | 388 | |
389 | 389 | $atts['data-width'] = $sub_field['wrapper']['width']; |
390 | 390 | |
391 | 391 | } |
392 | 392 | |
393 | 393 | ?> |
394 | - <th <?php acf_esc_attr_e( $atts ); ?>> |
|
395 | - <?php echo acf_get_field_label( $sub_field ); ?> |
|
396 | - <?php if( $sub_field['instructions'] ): ?> |
|
394 | + <th <?php acf_esc_attr_e($atts); ?>> |
|
395 | + <?php echo acf_get_field_label($sub_field); ?> |
|
396 | + <?php if ($sub_field['instructions']): ?> |
|
397 | 397 | <p class="description"><?php echo $sub_field['instructions']; ?></p> |
398 | 398 | <?php endif; ?> |
399 | 399 | </th> |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | |
405 | 405 | <tbody> |
406 | 406 | <?php else: ?> |
407 | - <div class="acf-fields <?php if($layout['display'] == 'row'): ?>-left<?php endif; ?>"> |
|
407 | + <div class="acf-fields <?php if ($layout['display'] == 'row'): ?>-left<?php endif; ?>"> |
|
408 | 408 | <?php endif; ?> |
409 | 409 | |
410 | 410 | <?php |
411 | 411 | |
412 | 412 | // loop though sub fields |
413 | - foreach( $layout['sub_fields'] as $sub_field ) { |
|
413 | + foreach ($layout['sub_fields'] as $sub_field) { |
|
414 | 414 | |
415 | 415 | // prevent repeater field from creating multiple conditional logic items for each row |
416 | - if( $i !== 'acfcloneindex' ) { |
|
416 | + if ($i !== 'acfcloneindex') { |
|
417 | 417 | |
418 | 418 | $sub_field['conditional_logic'] = 0; |
419 | 419 | |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | |
422 | 422 | |
423 | 423 | // add value |
424 | - if( isset($value[ $sub_field['key'] ]) ) { |
|
424 | + if (isset($value[$sub_field['key']])) { |
|
425 | 425 | |
426 | 426 | // this is a normal value |
427 | - $sub_field['value'] = $value[ $sub_field['key'] ]; |
|
427 | + $sub_field['value'] = $value[$sub_field['key']]; |
|
428 | 428 | |
429 | - } elseif( isset($sub_field['default_value']) ) { |
|
429 | + } elseif (isset($sub_field['default_value'])) { |
|
430 | 430 | |
431 | 431 | // no value, but this sub field has a default value |
432 | 432 | $sub_field['value'] = $sub_field['default_value']; |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | |
440 | 440 | |
441 | 441 | // render input |
442 | - acf_render_field_wrap( $sub_field, $el ); |
|
442 | + acf_render_field_wrap($sub_field, $el); |
|
443 | 443 | |
444 | 444 | } |
445 | 445 | |
446 | 446 | ?> |
447 | 447 | |
448 | - <?php if( $layout['display'] == 'table' ): ?> |
|
448 | + <?php if ($layout['display'] == 'table'): ?> |
|
449 | 449 | </tbody> |
450 | 450 | </table> |
451 | 451 | <?php else: ?> |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | * @param $field - an array holding all the field's data |
474 | 474 | */ |
475 | 475 | |
476 | - function render_field_settings( $field ) { |
|
476 | + function render_field_settings($field) { |
|
477 | 477 | |
478 | 478 | // load default layout |
479 | - if( empty($field['layouts']) ) { |
|
479 | + if (empty($field['layouts'])) { |
|
480 | 480 | |
481 | 481 | $field['layouts'] = array(); |
482 | 482 | $field['layouts'][] = $this->get_valid_layout(); |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | |
486 | 486 | |
487 | 487 | // loop through layouts |
488 | - foreach( $field['layouts'] as $layout ) { |
|
488 | + foreach ($field['layouts'] as $layout) { |
|
489 | 489 | |
490 | 490 | // get valid layout |
491 | - $layout = $this->get_valid_layout( $layout ); |
|
491 | + $layout = $this->get_valid_layout($layout); |
|
492 | 492 | |
493 | 493 | |
494 | 494 | // vars |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | |
498 | 498 | ?><tr class="acf-field" data-name="fc_layout" data-setting="flexible_content" data-id="<?php echo $layout['key']; ?>"> |
499 | 499 | <td class="acf-label"> |
500 | - <label><?php _e("Layout",'acf'); ?></label> |
|
500 | + <label><?php _e("Layout", 'acf'); ?></label> |
|
501 | 501 | <p class="description acf-fl-actions"> |
502 | - <a data-name="acf-fc-reorder" title="<?php _e("Reorder Layout",'acf'); ?>" ><?php _e("Reorder",'acf'); ?></a> |
|
503 | - <a data-name="acf-fc-delete" title="<?php _e("Delete Layout",'acf'); ?>" href="#"><?php _e("Delete",'acf'); ?></a> |
|
504 | - <a data-name="acf-fc-duplicate" title="<?php _e("Duplicate Layout",'acf'); ?>" href="#"><?php _e("Duplicate",'acf'); ?></a> |
|
505 | - <a data-name="acf-fc-add" title="<?php _e("Add New Layout",'acf'); ?>" href="#"><?php _e("Add New",'acf'); ?></a> |
|
502 | + <a data-name="acf-fc-reorder" title="<?php _e("Reorder Layout", 'acf'); ?>" ><?php _e("Reorder", 'acf'); ?></a> |
|
503 | + <a data-name="acf-fc-delete" title="<?php _e("Delete Layout", 'acf'); ?>" href="#"><?php _e("Delete", 'acf'); ?></a> |
|
504 | + <a data-name="acf-fc-duplicate" title="<?php _e("Duplicate Layout", 'acf'); ?>" href="#"><?php _e("Duplicate", 'acf'); ?></a> |
|
505 | + <a data-name="acf-fc-add" title="<?php _e("Add New Layout", 'acf'); ?>" href="#"><?php _e("Add New", 'acf'); ?></a> |
|
506 | 506 | </p> |
507 | 507 | </td> |
508 | 508 | <td class="acf-input"> |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | 'name' => 'label', |
528 | 528 | 'prefix' => $layout_prefix, |
529 | 529 | 'value' => $layout['label'], |
530 | - 'prepend' => __('Label','acf') |
|
530 | + 'prepend' => __('Label', 'acf') |
|
531 | 531 | )); |
532 | 532 | |
533 | 533 | ?> |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | 'name' => 'name', |
541 | 541 | 'prefix' => $layout_prefix, |
542 | 542 | 'value' => $layout['name'], |
543 | - 'prepend' => __('Name','acf') |
|
543 | + 'prepend' => __('Name', 'acf') |
|
544 | 544 | )); |
545 | 545 | |
546 | 546 | ?> |
547 | 547 | </li> |
548 | 548 | <li class="acf-fc-meta-display"> |
549 | - <div class="acf-input-prepend"><?php _e('Layout','acf'); ?></div> |
|
549 | + <div class="acf-input-prepend"><?php _e('Layout', 'acf'); ?></div> |
|
550 | 550 | <div class="acf-input-wrap select"> |
551 | 551 | <?php |
552 | 552 | |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | 'prefix' => $layout_prefix, |
557 | 557 | 'value' => $layout['display'], |
558 | 558 | 'choices' => array( |
559 | - 'table' => __('Table','acf'), |
|
560 | - 'block' => __('Block','acf'), |
|
561 | - 'row' => __('Row','acf') |
|
559 | + 'table' => __('Table', 'acf'), |
|
560 | + 'block' => __('Block', 'acf'), |
|
561 | + 'row' => __('Row', 'acf') |
|
562 | 562 | ), |
563 | 563 | )); |
564 | 564 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | 'name' => 'min', |
574 | 574 | 'prefix' => $layout_prefix, |
575 | 575 | 'value' => $layout['min'], |
576 | - 'prepend' => __('Min','acf') |
|
576 | + 'prepend' => __('Min', 'acf') |
|
577 | 577 | )); |
578 | 578 | |
579 | 579 | ?> |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | 'name' => 'max', |
587 | 587 | 'prefix' => $layout_prefix, |
588 | 588 | 'value' => $layout['max'], |
589 | - 'prepend' => __('Max','acf') |
|
589 | + 'prepend' => __('Max', 'acf') |
|
590 | 590 | )); |
591 | 591 | |
592 | 592 | ?> |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | |
614 | 614 | |
615 | 615 | // min |
616 | - acf_render_field_setting( $field, array( |
|
617 | - 'label' => __('Button Label','acf'), |
|
616 | + acf_render_field_setting($field, array( |
|
617 | + 'label' => __('Button Label', 'acf'), |
|
618 | 618 | 'instructions' => '', |
619 | 619 | 'type' => 'text', |
620 | 620 | 'name' => 'button_label', |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | |
623 | 623 | |
624 | 624 | // min |
625 | - acf_render_field_setting( $field, array( |
|
626 | - 'label' => __('Minimum Layouts','acf'), |
|
625 | + acf_render_field_setting($field, array( |
|
626 | + 'label' => __('Minimum Layouts', 'acf'), |
|
627 | 627 | 'instructions' => '', |
628 | 628 | 'type' => 'number', |
629 | 629 | 'name' => 'min', |
@@ -631,8 +631,8 @@ discard block |
||
631 | 631 | |
632 | 632 | |
633 | 633 | // max |
634 | - acf_render_field_setting( $field, array( |
|
635 | - 'label' => __('Maximum Layouts','acf'), |
|
634 | + acf_render_field_setting($field, array( |
|
635 | + 'label' => __('Maximum Layouts', 'acf'), |
|
636 | 636 | 'instructions' => '', |
637 | 637 | 'type' => 'number', |
638 | 638 | 'name' => 'max', |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @return $value |
657 | 657 | */ |
658 | 658 | |
659 | - function load_value( $value, $post_id, $field ) { |
|
659 | + function load_value($value, $post_id, $field) { |
|
660 | 660 | |
661 | 661 | // bail early if no value |
662 | - if( empty($value) || empty($field['layouts']) ) { |
|
662 | + if (empty($value) || empty($field['layouts'])) { |
|
663 | 663 | |
664 | 664 | return $value; |
665 | 665 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | |
669 | 669 | // value must be an array |
670 | - $value = acf_get_array( $value ); |
|
670 | + $value = acf_get_array($value); |
|
671 | 671 | |
672 | 672 | |
673 | 673 | // vars |
@@ -677,28 +677,28 @@ discard block |
||
677 | 677 | // populate $layouts |
678 | 678 | $layouts = array(); |
679 | 679 | |
680 | - foreach( array_keys($field['layouts']) as $i ) { |
|
680 | + foreach (array_keys($field['layouts']) as $i) { |
|
681 | 681 | |
682 | 682 | // get layout |
683 | - $layout = $field['layouts'][ $i ]; |
|
683 | + $layout = $field['layouts'][$i]; |
|
684 | 684 | |
685 | 685 | |
686 | 686 | // append to $layouts |
687 | - $layouts[ $layout['name'] ] = $layout['sub_fields']; |
|
687 | + $layouts[$layout['name']] = $layout['sub_fields']; |
|
688 | 688 | |
689 | 689 | } |
690 | 690 | |
691 | 691 | |
692 | 692 | // loop through rows |
693 | - foreach( $value as $i => $l ) { |
|
693 | + foreach ($value as $i => $l) { |
|
694 | 694 | |
695 | 695 | // append to $values |
696 | - $rows[ $i ] = array(); |
|
697 | - $rows[ $i ]['acf_fc_layout'] = $l; |
|
696 | + $rows[$i] = array(); |
|
697 | + $rows[$i]['acf_fc_layout'] = $l; |
|
698 | 698 | |
699 | 699 | |
700 | 700 | // bail early if layout deosnt contain sub fields |
701 | - if( empty($layouts[ $l ]) ) { |
|
701 | + if (empty($layouts[$l])) { |
|
702 | 702 | |
703 | 703 | continue; |
704 | 704 | |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | |
707 | 707 | |
708 | 708 | // get layout |
709 | - $layout = $layouts[ $l ]; |
|
709 | + $layout = $layouts[$l]; |
|
710 | 710 | |
711 | 711 | |
712 | 712 | // loop through sub fields |
713 | - foreach( array_keys($layout) as $j ) { |
|
713 | + foreach (array_keys($layout) as $j) { |
|
714 | 714 | |
715 | 715 | // get sub field |
716 | - $sub_field = $layout[ $j ]; |
|
716 | + $sub_field = $layout[$j]; |
|
717 | 717 | |
718 | 718 | |
719 | 719 | // update full name |
@@ -721,11 +721,11 @@ discard block |
||
721 | 721 | |
722 | 722 | |
723 | 723 | // get value |
724 | - $sub_value = acf_get_value( $post_id, $sub_field ); |
|
724 | + $sub_value = acf_get_value($post_id, $sub_field); |
|
725 | 725 | |
726 | 726 | |
727 | 727 | // add value |
728 | - $rows[ $i ][ $sub_field['key'] ] = $sub_value; |
|
728 | + $rows[$i][$sub_field['key']] = $sub_value; |
|
729 | 729 | |
730 | 730 | } |
731 | 731 | // foreach |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | * @return $value (mixed) the modified value |
758 | 758 | */ |
759 | 759 | |
760 | - function format_value( $value, $post_id, $field ) { |
|
760 | + function format_value($value, $post_id, $field) { |
|
761 | 761 | |
762 | 762 | // bail early if no value |
763 | - if( empty($value) || empty($field['layouts']) ) { |
|
763 | + if (empty($value) || empty($field['layouts'])) { |
|
764 | 764 | |
765 | 765 | return false; |
766 | 766 | |
@@ -770,27 +770,27 @@ discard block |
||
770 | 770 | // populate $layouts |
771 | 771 | $layouts = array(); |
772 | 772 | |
773 | - foreach( array_keys($field['layouts']) as $i ) { |
|
773 | + foreach (array_keys($field['layouts']) as $i) { |
|
774 | 774 | |
775 | 775 | // get layout |
776 | - $layout = $field['layouts'][ $i ]; |
|
776 | + $layout = $field['layouts'][$i]; |
|
777 | 777 | |
778 | 778 | |
779 | 779 | // append to $layouts |
780 | - $layouts[ $layout['name'] ] = $layout['sub_fields']; |
|
780 | + $layouts[$layout['name']] = $layout['sub_fields']; |
|
781 | 781 | |
782 | 782 | } |
783 | 783 | |
784 | 784 | |
785 | 785 | // loop over rows |
786 | - foreach( array_keys($value) as $i ) { |
|
786 | + foreach (array_keys($value) as $i) { |
|
787 | 787 | |
788 | 788 | // get layout name |
789 | - $l = $value[ $i ]['acf_fc_layout']; |
|
789 | + $l = $value[$i]['acf_fc_layout']; |
|
790 | 790 | |
791 | 791 | |
792 | 792 | // bail early if layout deosnt exist |
793 | - if( empty($layouts[ $l ]) ) { |
|
793 | + if (empty($layouts[$l])) { |
|
794 | 794 | |
795 | 795 | continue; |
796 | 796 | |
@@ -798,26 +798,26 @@ discard block |
||
798 | 798 | |
799 | 799 | |
800 | 800 | // get layout |
801 | - $layout = $layouts[ $l ]; |
|
801 | + $layout = $layouts[$l]; |
|
802 | 802 | |
803 | 803 | |
804 | 804 | // loop through sub fields |
805 | - foreach( array_keys($layout) as $j ) { |
|
805 | + foreach (array_keys($layout) as $j) { |
|
806 | 806 | |
807 | 807 | // get sub field |
808 | - $sub_field = $layout[ $j ]; |
|
808 | + $sub_field = $layout[$j]; |
|
809 | 809 | |
810 | 810 | |
811 | 811 | // extract value |
812 | - $sub_value = acf_extract_var( $value[ $i ], $sub_field['key'] ); |
|
812 | + $sub_value = acf_extract_var($value[$i], $sub_field['key']); |
|
813 | 813 | |
814 | 814 | |
815 | 815 | // format value |
816 | - $sub_value = acf_format_value( $sub_value, $post_id, $sub_field ); |
|
816 | + $sub_value = acf_format_value($sub_value, $post_id, $sub_field); |
|
817 | 817 | |
818 | 818 | |
819 | 819 | // append to $row |
820 | - $value[ $i ][ $sub_field['name'] ] = $sub_value; |
|
820 | + $value[$i][$sub_field['name']] = $sub_value; |
|
821 | 821 | |
822 | 822 | } |
823 | 823 | |
@@ -842,10 +842,10 @@ discard block |
||
842 | 842 | * @return $post_id (int) |
843 | 843 | */ |
844 | 844 | |
845 | - function validate_value( $valid, $value, $field, $input ){ |
|
845 | + function validate_value($valid, $value, $field, $input) { |
|
846 | 846 | |
847 | 847 | // remove acfcloneindex |
848 | - if( isset($value['acfcloneindex']) ) { |
|
848 | + if (isset($value['acfcloneindex'])) { |
|
849 | 849 | |
850 | 850 | unset($value['acfcloneindex']); |
851 | 851 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | |
854 | 854 | |
855 | 855 | // valid |
856 | - if( $field['required'] && empty($value) ) { |
|
856 | + if ($field['required'] && empty($value)) { |
|
857 | 857 | |
858 | 858 | $valid = false; |
859 | 859 | |
@@ -863,37 +863,37 @@ discard block |
||
863 | 863 | // populate $layouts |
864 | 864 | $layouts = array(); |
865 | 865 | |
866 | - foreach( array_keys($field['layouts']) as $i ) { |
|
866 | + foreach (array_keys($field['layouts']) as $i) { |
|
867 | 867 | |
868 | 868 | $layout = acf_extract_var($field['layouts'], $i); |
869 | 869 | |
870 | 870 | // append to $layouts |
871 | - $layouts[ $layout['name'] ] = $layout['sub_fields']; |
|
871 | + $layouts[$layout['name']] = $layout['sub_fields']; |
|
872 | 872 | |
873 | 873 | } |
874 | 874 | |
875 | 875 | |
876 | 876 | // check sub fields |
877 | - if( !empty($value) ) { |
|
877 | + if ( ! empty($value)) { |
|
878 | 878 | |
879 | 879 | // loop through rows |
880 | - foreach( $value as $i => $row ) { |
|
880 | + foreach ($value as $i => $row) { |
|
881 | 881 | |
882 | 882 | // get layout |
883 | 883 | $l = $row['acf_fc_layout']; |
884 | 884 | |
885 | 885 | |
886 | 886 | // loop through sub fields |
887 | - if( !empty($layouts[ $l ]) ) { |
|
887 | + if ( ! empty($layouts[$l])) { |
|
888 | 888 | |
889 | - foreach( $layouts[ $l ] as $sub_field ) { |
|
889 | + foreach ($layouts[$l] as $sub_field) { |
|
890 | 890 | |
891 | 891 | // get sub field key |
892 | 892 | $k = $sub_field['key']; |
893 | 893 | |
894 | 894 | |
895 | 895 | // exists? |
896 | - if( ! isset($value[ $i ][ $k ]) ) { |
|
896 | + if ( ! isset($value[$i][$k])) { |
|
897 | 897 | |
898 | 898 | continue; |
899 | 899 | |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | |
902 | 902 | |
903 | 903 | // validate |
904 | - acf_validate_value( $value[ $i ][ $k ], $sub_field, "{$input}[{$i}][{$k}]" ); |
|
904 | + acf_validate_value($value[$i][$k], $sub_field, "{$input}[{$i}][{$k}]"); |
|
905 | 905 | |
906 | 906 | } |
907 | 907 | // foreach |
@@ -938,10 +938,10 @@ discard block |
||
938 | 938 | * @return $value - the modified value |
939 | 939 | */ |
940 | 940 | |
941 | - function update_value( $value, $post_id, $field ) { |
|
941 | + function update_value($value, $post_id, $field) { |
|
942 | 942 | |
943 | 943 | // remove acfcloneindex |
944 | - if( isset($value['acfcloneindex']) ) { |
|
944 | + if (isset($value['acfcloneindex'])) { |
|
945 | 945 | |
946 | 946 | unset($value['acfcloneindex']); |
947 | 947 | |
@@ -954,22 +954,22 @@ discard block |
||
954 | 954 | |
955 | 955 | |
956 | 956 | // populate $layouts |
957 | - foreach( $field['layouts'] as $layout ) { |
|
957 | + foreach ($field['layouts'] as $layout) { |
|
958 | 958 | |
959 | - $layouts[ $layout['name'] ] = $layout['sub_fields']; |
|
959 | + $layouts[$layout['name']] = $layout['sub_fields']; |
|
960 | 960 | |
961 | 961 | } |
962 | 962 | |
963 | 963 | |
964 | 964 | // update sub fields |
965 | - if( !empty($value) ) { |
|
965 | + if ( ! empty($value)) { |
|
966 | 966 | |
967 | 967 | // $i |
968 | 968 | $i = -1; |
969 | 969 | |
970 | 970 | |
971 | 971 | // loop through rows |
972 | - foreach( $value as $row ) { |
|
972 | + foreach ($value as $row) { |
|
973 | 973 | |
974 | 974 | // $i |
975 | 975 | $i++; |
@@ -984,22 +984,22 @@ discard block |
||
984 | 984 | |
985 | 985 | |
986 | 986 | // loop through sub fields |
987 | - if( !empty($layouts[ $l ]) ) { |
|
987 | + if ( ! empty($layouts[$l])) { |
|
988 | 988 | |
989 | - foreach( $layouts[ $l ] as $sub_field ) { |
|
989 | + foreach ($layouts[$l] as $sub_field) { |
|
990 | 990 | |
991 | 991 | // value |
992 | 992 | $v = false; |
993 | 993 | |
994 | 994 | |
995 | 995 | // key (backend) |
996 | - if( isset($row[ $sub_field['key'] ]) ) { |
|
996 | + if (isset($row[$sub_field['key']])) { |
|
997 | 997 | |
998 | - $v = $row[ $sub_field['key'] ]; |
|
998 | + $v = $row[$sub_field['key']]; |
|
999 | 999 | |
1000 | - } elseif( isset($row[ $sub_field['name'] ]) ) { |
|
1000 | + } elseif (isset($row[$sub_field['name']])) { |
|
1001 | 1001 | |
1002 | - $v = $row[ $sub_field['name'] ]; |
|
1002 | + $v = $row[$sub_field['name']]; |
|
1003 | 1003 | |
1004 | 1004 | } else { |
1005 | 1005 | |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | |
1015 | 1015 | |
1016 | 1016 | // update field |
1017 | - acf_update_value( $v, $post_id, $sub_field ); |
|
1017 | + acf_update_value($v, $post_id, $sub_field); |
|
1018 | 1018 | |
1019 | 1019 | } |
1020 | 1020 | // foreach |
@@ -1030,30 +1030,30 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | |
1032 | 1032 | // remove old data |
1033 | - $old_order = acf_get_metadata( $post_id, $field['name'] ); |
|
1033 | + $old_order = acf_get_metadata($post_id, $field['name']); |
|
1034 | 1034 | $old_count = empty($old_order) ? 0 : count($old_order); |
1035 | 1035 | $new_count = empty($order) ? 0 : count($order); |
1036 | 1036 | |
1037 | 1037 | |
1038 | - if( $old_count > $new_count ) { |
|
1038 | + if ($old_count > $new_count) { |
|
1039 | 1039 | |
1040 | - for( $i = $new_count; $i < $old_count; $i++ ) { |
|
1040 | + for ($i = $new_count; $i < $old_count; $i++) { |
|
1041 | 1041 | |
1042 | 1042 | // get layout |
1043 | - $l = $old_order[ $i ]; |
|
1043 | + $l = $old_order[$i]; |
|
1044 | 1044 | |
1045 | 1045 | |
1046 | 1046 | // loop through sub fields |
1047 | - if( !empty($layouts[ $l ]) ) { |
|
1047 | + if ( ! empty($layouts[$l])) { |
|
1048 | 1048 | |
1049 | - foreach( $layouts[ $l ] as $sub_field ) { |
|
1049 | + foreach ($layouts[$l] as $sub_field) { |
|
1050 | 1050 | |
1051 | 1051 | // modify name for delete |
1052 | 1052 | $sub_field['name'] = "{$field['name']}_{$i}_{$sub_field['name']}"; |
1053 | 1053 | |
1054 | 1054 | |
1055 | 1055 | // delete value |
1056 | - acf_delete_value( $post_id, $sub_field ); |
|
1056 | + acf_delete_value($post_id, $sub_field); |
|
1057 | 1057 | |
1058 | 1058 | } |
1059 | 1059 | |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | |
1067 | 1067 | // save false for empty value |
1068 | - if( empty($order) ) { |
|
1068 | + if (empty($order)) { |
|
1069 | 1069 | |
1070 | 1070 | $order = false; |
1071 | 1071 | |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | * @return $field - the modified field |
1093 | 1093 | */ |
1094 | 1094 | |
1095 | - function update_field( $field ) { |
|
1095 | + function update_field($field) { |
|
1096 | 1096 | |
1097 | 1097 | // vars |
1098 | 1098 | $layouts = acf_extract_var($field, 'layouts'); |
@@ -1103,9 +1103,9 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | |
1105 | 1105 | // loop through sub fields |
1106 | - if( !empty($layouts) ) { |
|
1106 | + if ( ! empty($layouts)) { |
|
1107 | 1107 | |
1108 | - foreach( $layouts as $layout ) { |
|
1108 | + foreach ($layouts as $layout) { |
|
1109 | 1109 | |
1110 | 1110 | // remove sub fields |
1111 | 1111 | unset($layout['sub_fields']); |
@@ -1137,19 +1137,19 @@ discard block |
||
1137 | 1137 | * @return $post_id (int) |
1138 | 1138 | */ |
1139 | 1139 | |
1140 | - function delete_field( $field ) { |
|
1140 | + function delete_field($field) { |
|
1141 | 1141 | |
1142 | - if( !empty($field['layouts']) ) { |
|
1142 | + if ( ! empty($field['layouts'])) { |
|
1143 | 1143 | |
1144 | 1144 | // loop through layouts |
1145 | - foreach( $field['layouts'] as $layout ) { |
|
1145 | + foreach ($field['layouts'] as $layout) { |
|
1146 | 1146 | |
1147 | 1147 | // loop through sub fields |
1148 | - if( !empty($layout['sub_fields']) ) { |
|
1148 | + if ( ! empty($layout['sub_fields'])) { |
|
1149 | 1149 | |
1150 | - foreach( $layout['sub_fields'] as $sub_field ) { |
|
1150 | + foreach ($layout['sub_fields'] as $sub_field) { |
|
1151 | 1151 | |
1152 | - acf_delete_field( $sub_field['ID'] ); |
|
1152 | + acf_delete_field($sub_field['ID']); |
|
1153 | 1153 | |
1154 | 1154 | } |
1155 | 1155 | // foreach |
@@ -1180,23 +1180,23 @@ discard block |
||
1180 | 1180 | * @return $field - the modified field |
1181 | 1181 | */ |
1182 | 1182 | |
1183 | - function duplicate_field( $field ) { |
|
1183 | + function duplicate_field($field) { |
|
1184 | 1184 | |
1185 | 1185 | // vars |
1186 | 1186 | $sub_fields = array(); |
1187 | 1187 | |
1188 | 1188 | |
1189 | - if( !empty($field['layouts']) ) { |
|
1189 | + if ( ! empty($field['layouts'])) { |
|
1190 | 1190 | |
1191 | 1191 | // loop through layouts |
1192 | - foreach( $field['layouts'] as $layout ) { |
|
1192 | + foreach ($field['layouts'] as $layout) { |
|
1193 | 1193 | |
1194 | 1194 | // extract sub fields |
1195 | - $extra = acf_extract_var( $layout, 'sub_fields' ); |
|
1195 | + $extra = acf_extract_var($layout, 'sub_fields'); |
|
1196 | 1196 | |
1197 | 1197 | |
1198 | 1198 | // merge |
1199 | - if( !empty($extra) ) { |
|
1199 | + if ( ! empty($extra)) { |
|
1200 | 1200 | |
1201 | 1201 | $sub_fields = array_merge($sub_fields, $extra); |
1202 | 1202 | |
@@ -1210,11 +1210,11 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | |
1212 | 1212 | // save field to get ID |
1213 | - $field = acf_update_field( $field ); |
|
1213 | + $field = acf_update_field($field); |
|
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | // duplicate sub fields |
1217 | - acf_duplicate_fields( $sub_fields, $field['ID'] ); |
|
1217 | + acf_duplicate_fields($sub_fields, $field['ID']); |
|
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | // return |
@@ -403,8 +403,11 @@ discard block |
||
403 | 403 | </thead> |
404 | 404 | |
405 | 405 | <tbody> |
406 | - <?php else: ?> |
|
407 | - <div class="acf-fields <?php if($layout['display'] == 'row'): ?>-left<?php endif; ?>"> |
|
406 | + <?php else { |
|
407 | + : ?> |
|
408 | + <div class="acf-fields <?php if($layout['display'] == 'row'): ?>-left<?php endif; |
|
409 | +} |
|
410 | +?>"> |
|
408 | 411 | <?php endif; ?> |
409 | 412 | |
410 | 413 | <?php |
@@ -448,9 +451,12 @@ discard block |
||
448 | 451 | <?php if( $layout['display'] == 'table' ): ?> |
449 | 452 | </tbody> |
450 | 453 | </table> |
451 | - <?php else: ?> |
|
454 | + <?php else { |
|
455 | + : ?> |
|
452 | 456 | </div> |
453 | - <?php endif; ?> |
|
457 | + <?php endif; |
|
458 | +} |
|
459 | +?> |
|
454 | 460 | |
455 | 461 | <?php endif; ?> |
456 | 462 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | |
46 | 46 | // do not delete! |
47 | - parent::__construct(); |
|
47 | + parent::__construct(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_gallery') ) : |
|
14 | +if ( ! class_exists('acf_field_gallery')) : |
|
15 | 15 | |
16 | 16 | class acf_field_gallery extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'gallery'; |
36 | - $this->label = __("Gallery",'acf'); |
|
36 | + $this->label = __("Gallery", 'acf'); |
|
37 | 37 | $this->category = 'content'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'preview_size' => 'thumbnail', |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | 'mime_types' => '' |
50 | 50 | ); |
51 | 51 | $this->l10n = array( |
52 | - 'select' => __("Add Image to Gallery",'acf'), |
|
53 | - 'edit' => __("Edit Image",'acf'), |
|
54 | - 'update' => __("Update Image",'acf'), |
|
55 | - 'uploadedTo' => __("uploaded to this post",'acf'), |
|
56 | - 'max' => __("Maximum selection reached",'acf') |
|
52 | + 'select' => __("Add Image to Gallery", 'acf'), |
|
53 | + 'edit' => __("Edit Image", 'acf'), |
|
54 | + 'update' => __("Update Image", 'acf'), |
|
55 | + 'uploadedTo' => __("uploaded to this post", 'acf'), |
|
56 | + 'max' => __("Maximum selection reached", 'acf') |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | |
60 | 60 | // actions |
61 | - add_action('wp_ajax_acf/fields/gallery/get_attachment', array($this, 'ajax_get_attachment')); |
|
62 | - add_action('wp_ajax_nopriv_acf/fields/gallery/get_attachment', array($this, 'ajax_get_attachment')); |
|
61 | + add_action('wp_ajax_acf/fields/gallery/get_attachment', array($this, 'ajax_get_attachment')); |
|
62 | + add_action('wp_ajax_nopriv_acf/fields/gallery/get_attachment', array($this, 'ajax_get_attachment')); |
|
63 | 63 | |
64 | - add_action('wp_ajax_acf/fields/gallery/update_attachment', array($this, 'ajax_update_attachment')); |
|
65 | - add_action('wp_ajax_nopriv_acf/fields/gallery/update_attachment', array($this, 'ajax_update_attachment')); |
|
64 | + add_action('wp_ajax_acf/fields/gallery/update_attachment', array($this, 'ajax_update_attachment')); |
|
65 | + add_action('wp_ajax_nopriv_acf/fields/gallery/update_attachment', array($this, 'ajax_update_attachment')); |
|
66 | 66 | |
67 | - add_action('wp_ajax_acf/fields/gallery/get_sort_order', array($this, 'ajax_get_sort_order')); |
|
68 | - add_action('wp_ajax_nopriv_acf/fields/gallery/get_sort_order', array($this, 'ajax_get_sort_order')); |
|
67 | + add_action('wp_ajax_acf/fields/gallery/get_sort_order', array($this, 'ajax_get_sort_order')); |
|
68 | + add_action('wp_ajax_nopriv_acf/fields/gallery/get_sort_order', array($this, 'ajax_get_sort_order')); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | function ajax_get_attachment() { |
91 | 91 | |
92 | 92 | // options |
93 | - $options = acf_parse_args( $_POST, array( |
|
93 | + $options = acf_parse_args($_POST, array( |
|
94 | 94 | 'post_id' => 0, |
95 | 95 | 'id' => 0, |
96 | 96 | 'field_key' => '', |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | |
100 | 100 | |
101 | 101 | // validate |
102 | - if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') ) { |
|
102 | + if ( ! wp_verify_nonce($options['nonce'], 'acf_nonce')) { |
|
103 | 103 | |
104 | 104 | die(); |
105 | 105 | |
106 | 106 | } |
107 | 107 | |
108 | - if( empty($options['id']) ) { |
|
108 | + if (empty($options['id'])) { |
|
109 | 109 | |
110 | 110 | die(); |
111 | 111 | |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | |
114 | 114 | |
115 | 115 | // load field |
116 | - $field = acf_get_field( $options['field_key'] ); |
|
116 | + $field = acf_get_field($options['field_key']); |
|
117 | 117 | |
118 | - if( !$field ) { |
|
118 | + if ( ! $field) { |
|
119 | 119 | |
120 | 120 | die(); |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | |
125 | 125 | // render |
126 | - $this->render_attachment( $options['id'], $field ); |
|
126 | + $this->render_attachment($options['id'], $field); |
|
127 | 127 | die; |
128 | 128 | |
129 | 129 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | function ajax_update_attachment() { |
146 | 146 | |
147 | 147 | // validate nonce |
148 | - if( !wp_verify_nonce($_POST['nonce'], 'acf_nonce') ) { |
|
148 | + if ( ! wp_verify_nonce($_POST['nonce'], 'acf_nonce')) { |
|
149 | 149 | |
150 | 150 | wp_send_json_error(); |
151 | 151 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | |
155 | 155 | // bail early if no attachments |
156 | - if( empty($_POST['attachments']) ) { |
|
156 | + if (empty($_POST['attachments'])) { |
|
157 | 157 | |
158 | 158 | wp_send_json_error(); |
159 | 159 | |
@@ -161,47 +161,47 @@ discard block |
||
161 | 161 | |
162 | 162 | |
163 | 163 | // loop over attachments |
164 | - foreach( $_POST['attachments'] as $id => $changes ) { |
|
164 | + foreach ($_POST['attachments'] as $id => $changes) { |
|
165 | 165 | |
166 | - if ( !current_user_can( 'edit_post', $id ) ) |
|
166 | + if ( ! current_user_can('edit_post', $id)) |
|
167 | 167 | wp_send_json_error(); |
168 | 168 | |
169 | - $post = get_post( $id, ARRAY_A ); |
|
169 | + $post = get_post($id, ARRAY_A); |
|
170 | 170 | |
171 | - if ( 'attachment' != $post['post_type'] ) |
|
171 | + if ('attachment' != $post['post_type']) |
|
172 | 172 | wp_send_json_error(); |
173 | 173 | |
174 | - if ( isset( $changes['title'] ) ) |
|
174 | + if (isset($changes['title'])) |
|
175 | 175 | $post['post_title'] = $changes['title']; |
176 | 176 | |
177 | - if ( isset( $changes['caption'] ) ) |
|
177 | + if (isset($changes['caption'])) |
|
178 | 178 | $post['post_excerpt'] = $changes['caption']; |
179 | 179 | |
180 | - if ( isset( $changes['description'] ) ) |
|
180 | + if (isset($changes['description'])) |
|
181 | 181 | $post['post_content'] = $changes['description']; |
182 | 182 | |
183 | - if ( isset( $changes['alt'] ) ) { |
|
184 | - $alt = wp_unslash( $changes['alt'] ); |
|
185 | - if ( $alt != get_post_meta( $id, '_wp_attachment_image_alt', true ) ) { |
|
186 | - $alt = wp_strip_all_tags( $alt, true ); |
|
187 | - update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); |
|
183 | + if (isset($changes['alt'])) { |
|
184 | + $alt = wp_unslash($changes['alt']); |
|
185 | + if ($alt != get_post_meta($id, '_wp_attachment_image_alt', true)) { |
|
186 | + $alt = wp_strip_all_tags($alt, true); |
|
187 | + update_post_meta($id, '_wp_attachment_image_alt', wp_slash($alt)); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | 191 | |
192 | 192 | // save post |
193 | - wp_update_post( $post ); |
|
193 | + wp_update_post($post); |
|
194 | 194 | |
195 | 195 | |
196 | 196 | /** This filter is documented in wp-admin/includes/media.php */ |
197 | 197 | // - seems off to run this filter AFTER the update_post function, but there is a reason |
198 | 198 | // - when placed BEFORE, an empty post_title will be populated by WP |
199 | 199 | // - this filter will still allow 3rd party to save extra image data! |
200 | - $post = apply_filters( 'attachment_fields_to_save', $post, $changes ); |
|
200 | + $post = apply_filters('attachment_fields_to_save', $post, $changes); |
|
201 | 201 | |
202 | 202 | |
203 | 203 | // save meta |
204 | - acf_save_post( $id ); |
|
204 | + acf_save_post($id); |
|
205 | 205 | |
206 | 206 | } |
207 | 207 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // vars |
231 | 231 | $r = array(); |
232 | 232 | $order = 'DESC'; |
233 | - $args = acf_parse_args( $_POST, array( |
|
233 | + $args = acf_parse_args($_POST, array( |
|
234 | 234 | 'ids' => 0, |
235 | 235 | 'sort' => 'date', |
236 | 236 | 'field_key' => '', |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | |
241 | 241 | // validate |
242 | - if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) { |
|
242 | + if ( ! wp_verify_nonce($args['nonce'], 'acf_nonce')) { |
|
243 | 243 | |
244 | 244 | wp_send_json_error(); |
245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | |
249 | 249 | // reverse |
250 | - if( $args['sort'] == 'reverse' ) { |
|
250 | + if ($args['sort'] == 'reverse') { |
|
251 | 251 | |
252 | 252 | $ids = array_reverse($args['ids']); |
253 | 253 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | - if( $args['sort'] == 'title' ) { |
|
259 | + if ($args['sort'] == 'title') { |
|
260 | 260 | |
261 | 261 | $order = 'ASC'; |
262 | 262 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | |
278 | 278 | // success |
279 | - if( !empty($ids) ) { |
|
279 | + if ( ! empty($ids)) { |
|
280 | 280 | |
281 | 281 | wp_send_json_success($ids); |
282 | 282 | |
@@ -302,28 +302,28 @@ discard block |
||
302 | 302 | * @return $post_id (int) |
303 | 303 | */ |
304 | 304 | |
305 | - function render_attachment( $id = 0, $field ) { |
|
305 | + function render_attachment($id = 0, $field) { |
|
306 | 306 | |
307 | 307 | // vars |
308 | - $attachment = wp_prepare_attachment_for_js( $id ); |
|
308 | + $attachment = wp_prepare_attachment_for_js($id); |
|
309 | 309 | $thumb = ''; |
310 | 310 | $prefix = "attachments[{$id}]"; |
311 | - $compat = get_compat_media_markup( $id ); |
|
311 | + $compat = get_compat_media_markup($id); |
|
312 | 312 | $dimentions = ''; |
313 | 313 | |
314 | 314 | |
315 | 315 | // thumb |
316 | - if( isset($attachment['thumb']['src']) ) { |
|
316 | + if (isset($attachment['thumb']['src'])) { |
|
317 | 317 | |
318 | 318 | // video |
319 | 319 | $thumb = $attachment['thumb']['src']; |
320 | 320 | |
321 | - } elseif( isset($attachment['sizes']['thumbnail']['url']) ) { |
|
321 | + } elseif (isset($attachment['sizes']['thumbnail']['url'])) { |
|
322 | 322 | |
323 | 323 | // image |
324 | 324 | $thumb = $attachment['sizes']['thumbnail']['url']; |
325 | 325 | |
326 | - } elseif( $attachment['type'] === 'image' ) { |
|
326 | + } elseif ($attachment['type'] === 'image') { |
|
327 | 327 | |
328 | 328 | // svg |
329 | 329 | $thumb = $attachment['url']; |
@@ -338,19 +338,19 @@ discard block |
||
338 | 338 | |
339 | 339 | |
340 | 340 | // dimentions |
341 | - if( $attachment['type'] === 'audio' ) { |
|
341 | + if ($attachment['type'] === 'audio') { |
|
342 | 342 | |
343 | - $dimentions = __('Length', 'acf') . ': ' . $attachment['fileLength']; |
|
343 | + $dimentions = __('Length', 'acf').': '.$attachment['fileLength']; |
|
344 | 344 | |
345 | - } elseif( !empty($attachment['width']) ) { |
|
345 | + } elseif ( ! empty($attachment['width'])) { |
|
346 | 346 | |
347 | - $dimentions = $attachment['width'] . ' x ' . $attachment['height']; |
|
347 | + $dimentions = $attachment['width'].' x '.$attachment['height']; |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | - if( $attachment['filesizeHumanReadable'] ) { |
|
351 | + if ($attachment['filesizeHumanReadable']) { |
|
352 | 352 | |
353 | - $dimentions .= ' (' . $attachment['filesizeHumanReadable'] . ')'; |
|
353 | + $dimentions .= ' ('.$attachment['filesizeHumanReadable'].')'; |
|
354 | 354 | |
355 | 355 | } |
356 | 356 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @date 23/01/13 |
425 | 425 | */ |
426 | 426 | |
427 | - function render_field( $field ) { |
|
427 | + function render_field($field) { |
|
428 | 428 | |
429 | 429 | // enqueue |
430 | 430 | acf_enqueue_uploader(); |
@@ -445,12 +445,12 @@ discard block |
||
445 | 445 | |
446 | 446 | // set gallery height |
447 | 447 | $height = acf_get_user_setting('gallery_height', 400); |
448 | - $height = max( $height, 200 ); // minimum height is 200 |
|
448 | + $height = max($height, 200); // minimum height is 200 |
|
449 | 449 | $atts['style'] = "height:{$height}px"; |
450 | 450 | |
451 | 451 | |
452 | 452 | // load posts |
453 | - if( !empty($field['value']) ) { |
|
453 | + if ( ! empty($field['value'])) { |
|
454 | 454 | |
455 | 455 | $posts = acf_get_posts(array( |
456 | 456 | 'post_type' => 'attachment', |
@@ -464,16 +464,16 @@ discard block |
||
464 | 464 | <div <?php acf_esc_attr_e($atts); ?>> |
465 | 465 | |
466 | 466 | <div class="acf-hidden"> |
467 | - <input type="hidden" <?php acf_esc_attr_e(array( 'name' => $field['name'], 'value' => '', 'data-name' => 'ids' )); ?> /> |
|
467 | + <input type="hidden" <?php acf_esc_attr_e(array('name' => $field['name'], 'value' => '', 'data-name' => 'ids')); ?> /> |
|
468 | 468 | </div> |
469 | 469 | |
470 | 470 | <div class="acf-gallery-main"> |
471 | 471 | |
472 | 472 | <div class="acf-gallery-attachments"> |
473 | 473 | |
474 | - <?php if( !empty($posts) ): ?> |
|
474 | + <?php if ( ! empty($posts)): ?> |
|
475 | 475 | |
476 | - <?php foreach( $posts as $post ): |
|
476 | + <?php foreach ($posts as $post): |
|
477 | 477 | |
478 | 478 | // vars |
479 | 479 | $type = acf_maybe_get(explode('/', $post->post_mime_type), 0); |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | |
485 | 485 | |
486 | 486 | // thumb |
487 | - if( $type === 'image' || $type === 'audio' || $type === 'video' ) { |
|
487 | + if ($type === 'image' || $type === 'audio' || $type === 'video') { |
|
488 | 488 | |
489 | 489 | // change $thumb_id |
490 | - if( $type === 'audio' || $type === 'video' ) { |
|
490 | + if ($type === 'audio' || $type === 'video') { |
|
491 | 491 | |
492 | - $thumb_id = get_post_thumbnail_id( $post->ID ); |
|
492 | + $thumb_id = get_post_thumbnail_id($post->ID); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | 496 | |
497 | 497 | // get attachment |
498 | - if( $thumb_id ) { |
|
498 | + if ($thumb_id) { |
|
499 | 499 | |
500 | - $thumb_url = wp_get_attachment_image_src( $thumb_id, $field['preview_size'] ); |
|
501 | - $thumb_url = acf_maybe_get( $thumb_url, 0 ); |
|
500 | + $thumb_url = wp_get_attachment_image_src($thumb_id, $field['preview_size']); |
|
501 | + $thumb_url = acf_maybe_get($thumb_url, 0); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
@@ -506,9 +506,9 @@ discard block |
||
506 | 506 | |
507 | 507 | |
508 | 508 | // fallback |
509 | - if( !$thumb_url ) { |
|
509 | + if ( ! $thumb_url) { |
|
510 | 510 | |
511 | - $thumb_url = wp_mime_type_icon( $post->ID ); |
|
511 | + $thumb_url = wp_mime_type_icon($post->ID); |
|
512 | 512 | $thumb_class .= ' is-mime-icon'; |
513 | 513 | |
514 | 514 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | <div class="thumbnail"> |
521 | 521 | <img src="<?php echo $thumb_url; ?>"/> |
522 | 522 | </div> |
523 | - <?php if( $type !== 'image' ): ?> |
|
523 | + <?php if ($type !== 'image'): ?> |
|
524 | 524 | <div class="filename"><?php echo acf_get_truncated($filename, 18); ?></div> |
525 | 525 | <?php endif; ?> |
526 | 526 | </div> |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param $field - an array holding all the field's data |
598 | 598 | */ |
599 | 599 | |
600 | - function render_field_settings( $field ) { |
|
600 | + function render_field_settings($field) { |
|
601 | 601 | |
602 | 602 | // clear numeric settings |
603 | 603 | $clear = array( |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | 'max_size' |
612 | 612 | ); |
613 | 613 | |
614 | - foreach( $clear as $k ) { |
|
614 | + foreach ($clear as $k) { |
|
615 | 615 | |
616 | - if( empty($field[$k]) ) { |
|
616 | + if (empty($field[$k])) { |
|
617 | 617 | |
618 | 618 | $field[$k] = ''; |
619 | 619 | |
@@ -623,8 +623,8 @@ discard block |
||
623 | 623 | |
624 | 624 | |
625 | 625 | // min |
626 | - acf_render_field_setting( $field, array( |
|
627 | - 'label' => __('Minimum Selection','acf'), |
|
626 | + acf_render_field_setting($field, array( |
|
627 | + 'label' => __('Minimum Selection', 'acf'), |
|
628 | 628 | 'instructions' => '', |
629 | 629 | 'type' => 'number', |
630 | 630 | 'name' => 'min' |
@@ -632,8 +632,8 @@ discard block |
||
632 | 632 | |
633 | 633 | |
634 | 634 | // max |
635 | - acf_render_field_setting( $field, array( |
|
636 | - 'label' => __('Maximum Selection','acf'), |
|
635 | + acf_render_field_setting($field, array( |
|
636 | + 'label' => __('Maximum Selection', 'acf'), |
|
637 | 637 | 'instructions' => '', |
638 | 638 | 'type' => 'number', |
639 | 639 | 'name' => 'max' |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | |
642 | 642 | |
643 | 643 | // preview_size |
644 | - acf_render_field_setting( $field, array( |
|
645 | - 'label' => __('Preview Size','acf'), |
|
646 | - 'instructions' => __('Shown when entering data','acf'), |
|
644 | + acf_render_field_setting($field, array( |
|
645 | + 'label' => __('Preview Size', 'acf'), |
|
646 | + 'instructions' => __('Shown when entering data', 'acf'), |
|
647 | 647 | 'type' => 'select', |
648 | 648 | 'name' => 'preview_size', |
649 | 649 | 'choices' => acf_get_image_sizes() |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | |
652 | 652 | |
653 | 653 | // library |
654 | - acf_render_field_setting( $field, array( |
|
655 | - 'label' => __('Library','acf'), |
|
656 | - 'instructions' => __('Limit the media library choice','acf'), |
|
654 | + acf_render_field_setting($field, array( |
|
655 | + 'label' => __('Library', 'acf'), |
|
656 | + 'instructions' => __('Limit the media library choice', 'acf'), |
|
657 | 657 | 'type' => 'radio', |
658 | 658 | 'name' => 'library', |
659 | 659 | 'layout' => 'horizontal', |
@@ -665,16 +665,16 @@ discard block |
||
665 | 665 | |
666 | 666 | |
667 | 667 | // min |
668 | - acf_render_field_setting( $field, array( |
|
669 | - 'label' => __('Minimum','acf'), |
|
670 | - 'instructions' => __('Restrict which images can be uploaded','acf'), |
|
668 | + acf_render_field_setting($field, array( |
|
669 | + 'label' => __('Minimum', 'acf'), |
|
670 | + 'instructions' => __('Restrict which images can be uploaded', 'acf'), |
|
671 | 671 | 'type' => 'text', |
672 | 672 | 'name' => 'min_width', |
673 | 673 | 'prepend' => __('Width', 'acf'), |
674 | 674 | 'append' => 'px', |
675 | 675 | )); |
676 | 676 | |
677 | - acf_render_field_setting( $field, array( |
|
677 | + acf_render_field_setting($field, array( |
|
678 | 678 | 'label' => '', |
679 | 679 | 'type' => 'text', |
680 | 680 | 'name' => 'min_height', |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ) |
686 | 686 | )); |
687 | 687 | |
688 | - acf_render_field_setting( $field, array( |
|
688 | + acf_render_field_setting($field, array( |
|
689 | 689 | 'label' => '', |
690 | 690 | 'type' => 'text', |
691 | 691 | 'name' => 'min_size', |
@@ -698,16 +698,16 @@ discard block |
||
698 | 698 | |
699 | 699 | |
700 | 700 | // max |
701 | - acf_render_field_setting( $field, array( |
|
702 | - 'label' => __('Maximum','acf'), |
|
703 | - 'instructions' => __('Restrict which images can be uploaded','acf'), |
|
701 | + acf_render_field_setting($field, array( |
|
702 | + 'label' => __('Maximum', 'acf'), |
|
703 | + 'instructions' => __('Restrict which images can be uploaded', 'acf'), |
|
704 | 704 | 'type' => 'text', |
705 | 705 | 'name' => 'max_width', |
706 | 706 | 'prepend' => __('Width', 'acf'), |
707 | 707 | 'append' => 'px', |
708 | 708 | )); |
709 | 709 | |
710 | - acf_render_field_setting( $field, array( |
|
710 | + acf_render_field_setting($field, array( |
|
711 | 711 | 'label' => '', |
712 | 712 | 'type' => 'text', |
713 | 713 | 'name' => 'max_height', |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | ) |
719 | 719 | )); |
720 | 720 | |
721 | - acf_render_field_setting( $field, array( |
|
721 | + acf_render_field_setting($field, array( |
|
722 | 722 | 'label' => '', |
723 | 723 | 'type' => 'text', |
724 | 724 | 'name' => 'max_size', |
@@ -731,9 +731,9 @@ discard block |
||
731 | 731 | |
732 | 732 | |
733 | 733 | // allowed type |
734 | - acf_render_field_setting( $field, array( |
|
735 | - 'label' => __('Allowed file types','acf'), |
|
736 | - 'instructions' => __('Comma separated list. Leave blank for all types','acf'), |
|
734 | + acf_render_field_setting($field, array( |
|
735 | + 'label' => __('Allowed file types', 'acf'), |
|
736 | + 'instructions' => __('Comma separated list. Leave blank for all types', 'acf'), |
|
737 | 737 | 'type' => 'text', |
738 | 738 | 'name' => 'mime_types', |
739 | 739 | )); |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | * @return $value (mixed) the modified value |
758 | 758 | */ |
759 | 759 | |
760 | - function format_value( $value, $post_id, $field ) { |
|
760 | + function format_value($value, $post_id, $field) { |
|
761 | 761 | |
762 | 762 | // bail early if no value |
763 | - if( empty($value) ) { |
|
763 | + if (empty($value)) { |
|
764 | 764 | |
765 | 765 | // return false as $value may be '' (from DB) which doesn't make much sense |
766 | 766 | return false; |
@@ -777,9 +777,9 @@ discard block |
||
777 | 777 | |
778 | 778 | |
779 | 779 | // update value to include $post |
780 | - foreach( array_keys($posts) as $i ) { |
|
780 | + foreach (array_keys($posts) as $i) { |
|
781 | 781 | |
782 | - $posts[ $i ] = acf_get_attachment( $posts[ $i ] ); |
|
782 | + $posts[$i] = acf_get_attachment($posts[$i]); |
|
783 | 783 | |
784 | 784 | } |
785 | 785 | |
@@ -803,19 +803,19 @@ discard block |
||
803 | 803 | * @return $post_id (int) |
804 | 804 | */ |
805 | 805 | |
806 | - function validate_value( $valid, $value, $field, $input ){ |
|
806 | + function validate_value($valid, $value, $field, $input) { |
|
807 | 807 | |
808 | - if( empty($value) || !is_array($value) ) { |
|
808 | + if (empty($value) || ! is_array($value)) { |
|
809 | 809 | |
810 | 810 | $value = array(); |
811 | 811 | |
812 | 812 | } |
813 | 813 | |
814 | 814 | |
815 | - if( count($value) < $field['min'] ) { |
|
815 | + if (count($value) < $field['min']) { |
|
816 | 816 | |
817 | - $valid = _n( '%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf' ); |
|
818 | - $valid = sprintf( $valid, $field['label'], $field['min'] ); |
|
817 | + $valid = _n('%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf'); |
|
818 | + $valid = sprintf($valid, $field['label'], $field['min']); |
|
819 | 819 | |
820 | 820 | } |
821 | 821 |
@@ -163,22 +163,27 @@ |
||
163 | 163 | // loop over attachments |
164 | 164 | foreach( $_POST['attachments'] as $id => $changes ) { |
165 | 165 | |
166 | - if ( !current_user_can( 'edit_post', $id ) ) |
|
167 | - wp_send_json_error(); |
|
166 | + if ( !current_user_can( 'edit_post', $id ) ) { |
|
167 | + wp_send_json_error(); |
|
168 | + } |
|
168 | 169 | |
169 | 170 | $post = get_post( $id, ARRAY_A ); |
170 | 171 | |
171 | - if ( 'attachment' != $post['post_type'] ) |
|
172 | - wp_send_json_error(); |
|
172 | + if ( 'attachment' != $post['post_type'] ) { |
|
173 | + wp_send_json_error(); |
|
174 | + } |
|
173 | 175 | |
174 | - if ( isset( $changes['title'] ) ) |
|
175 | - $post['post_title'] = $changes['title']; |
|
176 | + if ( isset( $changes['title'] ) ) { |
|
177 | + $post['post_title'] = $changes['title']; |
|
178 | + } |
|
176 | 179 | |
177 | - if ( isset( $changes['caption'] ) ) |
|
178 | - $post['post_excerpt'] = $changes['caption']; |
|
180 | + if ( isset( $changes['caption'] ) ) { |
|
181 | + $post['post_excerpt'] = $changes['caption']; |
|
182 | + } |
|
179 | 183 | |
180 | - if ( isset( $changes['description'] ) ) |
|
181 | - $post['post_content'] = $changes['description']; |
|
184 | + if ( isset( $changes['description'] ) ) { |
|
185 | + $post['post_content'] = $changes['description']; |
|
186 | + } |
|
182 | 187 | |
183 | 188 | if ( isset( $changes['alt'] ) ) { |
184 | 189 | $alt = wp_unslash( $changes['alt'] ); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | |
46 | 46 | // do not delete! |
47 | - parent::__construct(); |
|
47 | + parent::__construct(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_repeater') ) : |
|
14 | +if ( ! class_exists('acf_field_repeater')) : |
|
15 | 15 | |
16 | 16 | class acf_field_repeater extends acf_field { |
17 | 17 | |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'repeater'; |
36 | - $this->label = __("Repeater",'acf'); |
|
36 | + $this->label = __("Repeater", 'acf'); |
|
37 | 37 | $this->category = 'layout'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'sub_fields' => array(), |
40 | 40 | 'min' => 0, |
41 | 41 | 'max' => 0, |
42 | 42 | 'layout' => 'table', |
43 | - 'button_label' => __("Add Row",'acf'), |
|
43 | + 'button_label' => __("Add Row", 'acf'), |
|
44 | 44 | 'collapsed' => '' |
45 | 45 | ); |
46 | 46 | $this->l10n = array( |
47 | - 'min' => __("Minimum rows reached ({min} rows)",'acf'), |
|
48 | - 'max' => __("Maximum rows reached ({max} rows)",'acf'), |
|
47 | + 'min' => __("Minimum rows reached ({min} rows)", 'acf'), |
|
48 | + 'max' => __("Maximum rows reached ({max} rows)", 'acf'), |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return $field - the field array holding all the field options |
69 | 69 | */ |
70 | 70 | |
71 | - function load_field( $field ) { |
|
71 | + function load_field($field) { |
|
72 | 72 | |
73 | - $field['sub_fields'] = acf_get_fields( $field ); |
|
73 | + $field['sub_fields'] = acf_get_fields($field); |
|
74 | 74 | |
75 | 75 | |
76 | 76 | // return |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @date 23/01/13 |
92 | 92 | */ |
93 | 93 | |
94 | - function render_field( $field ) { |
|
94 | + function render_field($field) { |
|
95 | 95 | |
96 | 96 | // vars |
97 | 97 | $div = array( |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | |
104 | 104 | // ensure value is an array |
105 | - if( empty($field['value']) ) { |
|
105 | + if (empty($field['value'])) { |
|
106 | 106 | |
107 | 107 | $field['value'] = array(); |
108 | 108 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // If there are less values than min, populate the extra values |
124 | - if( $field['min'] ) { |
|
124 | + if ($field['min']) { |
|
125 | 125 | |
126 | - for( $i = 0; $i < $field['min']; $i++ ) { |
|
126 | + for ($i = 0; $i < $field['min']; $i++) { |
|
127 | 127 | |
128 | 128 | // continue if already have a value |
129 | - if( array_key_exists($i, $field['value']) ) { |
|
129 | + if (array_key_exists($i, $field['value'])) { |
|
130 | 130 | |
131 | 131 | continue; |
132 | 132 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | // populate values |
137 | - $field['value'][ $i ] = $empty_row; |
|
137 | + $field['value'][$i] = $empty_row; |
|
138 | 138 | |
139 | 139 | } |
140 | 140 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | |
143 | 143 | |
144 | 144 | // If there are more values than man, remove some values |
145 | - if( $field['max'] ) { |
|
145 | + if ($field['max']) { |
|
146 | 146 | |
147 | - for( $i = 0; $i < count($field['value']); $i++ ) { |
|
147 | + for ($i = 0; $i < count($field['value']); $i++) { |
|
148 | 148 | |
149 | - if( $i >= $field['max'] ) { |
|
149 | + if ($i >= $field['max']) { |
|
150 | 150 | |
151 | - unset( $field['value'][ $i ] ); |
|
151 | + unset($field['value'][$i]); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | $show_remove = true; |
168 | 168 | |
169 | 169 | |
170 | - if( $field['max'] ) { |
|
170 | + if ($field['max']) { |
|
171 | 171 | |
172 | - if( $field['max'] == 1 ) { |
|
172 | + if ($field['max'] == 1) { |
|
173 | 173 | |
174 | 174 | $show_order = false; |
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - if( $field['max'] <= $field['min'] ) { |
|
178 | + if ($field['max'] <= $field['min']) { |
|
179 | 179 | |
180 | 180 | $show_remove = false; |
181 | 181 | $show_add = false; |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | $before_fields = ''; |
191 | 191 | $after_fields = ''; |
192 | 192 | |
193 | - if( $field['layout'] == 'row' ) { |
|
193 | + if ($field['layout'] == 'row') { |
|
194 | 194 | |
195 | 195 | $el = 'div'; |
196 | 196 | $before_fields = '<td class="acf-fields -left">'; |
197 | 197 | $after_fields = '</td>'; |
198 | 198 | |
199 | - } elseif( $field['layout'] == 'block' ) { |
|
199 | + } elseif ($field['layout'] == 'block') { |
|
200 | 200 | |
201 | 201 | $el = 'div'; |
202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | |
209 | 209 | // layout |
210 | - $div['class'] .= ' -' . $field['layout']; |
|
210 | + $div['class'] .= ' -'.$field['layout']; |
|
211 | 211 | |
212 | 212 | |
213 | 213 | // hidden input |
@@ -220,20 +220,20 @@ discard block |
||
220 | 220 | // collapsed |
221 | 221 | $collapsed = array(); |
222 | 222 | |
223 | - if( $field['collapsed'] ) { |
|
223 | + if ($field['collapsed']) { |
|
224 | 224 | |
225 | 225 | // get user setting |
226 | - $collapsed = acf_get_user_setting('collapsed_' . $field['key'], ''); |
|
226 | + $collapsed = acf_get_user_setting('collapsed_'.$field['key'], ''); |
|
227 | 227 | $collapsed = explode(',', $collapsed); |
228 | 228 | $collapsed = array_filter($collapsed, 'is_numeric'); |
229 | 229 | |
230 | 230 | |
231 | 231 | // add target class |
232 | - foreach( array_keys($field['sub_fields']) as $i ) { |
|
232 | + foreach (array_keys($field['sub_fields']) as $i) { |
|
233 | 233 | |
234 | - if( $field['sub_fields'][ $i ]['key'] === $field['collapsed'] ) { |
|
234 | + if ($field['sub_fields'][$i]['key'] === $field['collapsed']) { |
|
235 | 235 | |
236 | - $field['sub_fields'][ $i ]['wrapper']['class'] .= ' -collapsed-target'; |
|
236 | + $field['sub_fields'][$i]['wrapper']['class'] .= ' -collapsed-target'; |
|
237 | 237 | |
238 | 238 | } |
239 | 239 | |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | <div <?php acf_esc_attr_e($div); ?>> |
246 | 246 | <table class="acf-table"> |
247 | 247 | |
248 | - <?php if( $field['layout'] == 'table' ): ?> |
|
248 | + <?php if ($field['layout'] == 'table'): ?> |
|
249 | 249 | <thead> |
250 | 250 | <tr> |
251 | - <?php if( $show_order ): ?> |
|
251 | + <?php if ($show_order): ?> |
|
252 | 252 | <th class="acf-row-handle"><span></span></th> |
253 | 253 | <?php endif; ?> |
254 | 254 | |
255 | - <?php foreach( $field['sub_fields'] as $sub_field ): |
|
255 | + <?php foreach ($field['sub_fields'] as $sub_field): |
|
256 | 256 | |
257 | 257 | $atts = array( |
258 | 258 | 'class' => 'acf-th', |
@@ -261,27 +261,27 @@ discard block |
||
261 | 261 | |
262 | 262 | |
263 | 263 | // add type |
264 | - $atts['class'] .= ' acf-th-' . $sub_field['type']; |
|
264 | + $atts['class'] .= ' acf-th-'.$sub_field['type']; |
|
265 | 265 | |
266 | 266 | |
267 | 267 | // Add custom width |
268 | - if( $sub_field['wrapper']['width'] ) { |
|
268 | + if ($sub_field['wrapper']['width']) { |
|
269 | 269 | |
270 | 270 | $atts['data-width'] = $sub_field['wrapper']['width']; |
271 | 271 | |
272 | 272 | } |
273 | 273 | |
274 | 274 | ?> |
275 | - <th <?php acf_esc_attr_e( $atts ); ?>> |
|
276 | - <?php echo acf_get_field_label( $sub_field ); ?> |
|
277 | - <?php if( $sub_field['instructions'] ): ?> |
|
275 | + <th <?php acf_esc_attr_e($atts); ?>> |
|
276 | + <?php echo acf_get_field_label($sub_field); ?> |
|
277 | + <?php if ($sub_field['instructions']): ?> |
|
278 | 278 | <p class="description"><?php echo $sub_field['instructions']; ?></p> |
279 | 279 | <?php endif; ?> |
280 | 280 | </th> |
281 | 281 | |
282 | 282 | <?php endforeach; ?> |
283 | 283 | |
284 | - <?php if( $show_remove ): ?> |
|
284 | + <?php if ($show_remove): ?> |
|
285 | 285 | <th class="acf-row-handle"><span></span></th> |
286 | 286 | <?php endif; ?> |
287 | 287 | </tr> |
@@ -289,15 +289,15 @@ discard block |
||
289 | 289 | <?php endif; ?> |
290 | 290 | |
291 | 291 | <tbody> |
292 | - <?php foreach( $field['value'] as $i => $row ): |
|
292 | + <?php foreach ($field['value'] as $i => $row): |
|
293 | 293 | |
294 | 294 | $row_class = 'acf-row'; |
295 | 295 | |
296 | - if( $i === 'acfcloneindex' ) { |
|
296 | + if ($i === 'acfcloneindex') { |
|
297 | 297 | |
298 | 298 | $row_class .= ' acf-clone'; |
299 | 299 | |
300 | - } elseif( in_array($i, $collapsed) ) { |
|
300 | + } elseif (in_array($i, $collapsed)) { |
|
301 | 301 | |
302 | 302 | $row_class .= ' -collapsed'; |
303 | 303 | |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | ?> |
307 | 307 | <tr class="<?php echo $row_class; ?>" data-id="<?php echo $i; ?>"> |
308 | 308 | |
309 | - <?php if( $show_order ): ?> |
|
310 | - <td class="acf-row-handle order" title="<?php _e('Drag to reorder','acf'); ?>"> |
|
311 | - <?php if( $field['collapsed'] ): ?> |
|
312 | - <a class="acf-icon -collapse small" href="#" data-event="collapse-row" title="<?php _e('Click to toggle','acf'); ?>"></a> |
|
309 | + <?php if ($show_order): ?> |
|
310 | + <td class="acf-row-handle order" title="<?php _e('Drag to reorder', 'acf'); ?>"> |
|
311 | + <?php if ($field['collapsed']): ?> |
|
312 | + <a class="acf-icon -collapse small" href="#" data-event="collapse-row" title="<?php _e('Click to toggle', 'acf'); ?>"></a> |
|
313 | 313 | <?php endif; ?> |
314 | 314 | <span><?php echo intval($i) + 1; ?></span> |
315 | 315 | </td> |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | |
318 | 318 | <?php echo $before_fields; ?> |
319 | 319 | |
320 | - <?php foreach( $field['sub_fields'] as $sub_field ): |
|
320 | + <?php foreach ($field['sub_fields'] as $sub_field): |
|
321 | 321 | |
322 | 322 | // prevent repeater field from creating multiple conditional logic items for each row |
323 | - if( $i !== 'acfcloneindex' ) { |
|
323 | + if ($i !== 'acfcloneindex') { |
|
324 | 324 | |
325 | 325 | $sub_field['conditional_logic'] = 0; |
326 | 326 | |
@@ -328,12 +328,12 @@ discard block |
||
328 | 328 | |
329 | 329 | |
330 | 330 | // add value |
331 | - if( isset($row[ $sub_field['key'] ]) ) { |
|
331 | + if (isset($row[$sub_field['key']])) { |
|
332 | 332 | |
333 | 333 | // this is a normal value |
334 | - $sub_field['value'] = $row[ $sub_field['key'] ]; |
|
334 | + $sub_field['value'] = $row[$sub_field['key']]; |
|
335 | 335 | |
336 | - } elseif( isset($sub_field['default_value']) ) { |
|
336 | + } elseif (isset($sub_field['default_value'])) { |
|
337 | 337 | |
338 | 338 | // no value, but this sub field has a default value |
339 | 339 | $sub_field['value'] = $sub_field['default_value']; |
@@ -346,16 +346,16 @@ discard block |
||
346 | 346 | |
347 | 347 | |
348 | 348 | // render input |
349 | - acf_render_field_wrap( $sub_field, $el ); ?> |
|
349 | + acf_render_field_wrap($sub_field, $el); ?> |
|
350 | 350 | |
351 | 351 | <?php endforeach; ?> |
352 | 352 | |
353 | 353 | <?php echo $after_fields; ?> |
354 | 354 | |
355 | - <?php if( $show_remove ): ?> |
|
355 | + <?php if ($show_remove): ?> |
|
356 | 356 | <td class="acf-row-handle remove"> |
357 | - <a class="acf-icon -plus small" href="#" data-event="add-row" title="<?php _e('Add row','acf'); ?>"></a> |
|
358 | - <a class="acf-icon -minus small" href="#" data-event="remove-row" title="<?php _e('Remove row','acf'); ?>"></a> |
|
357 | + <a class="acf-icon -plus small" href="#" data-event="add-row" title="<?php _e('Add row', 'acf'); ?>"></a> |
|
358 | + <a class="acf-icon -minus small" href="#" data-event="remove-row" title="<?php _e('Remove row', 'acf'); ?>"></a> |
|
359 | 359 | </td> |
360 | 360 | <?php endif; ?> |
361 | 361 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | <?php endforeach; ?> |
364 | 364 | </tbody> |
365 | 365 | </table> |
366 | -<?php if( $show_add ): ?> |
|
366 | +<?php if ($show_add): ?> |
|
367 | 367 | |
368 | 368 | <ul class="acf-hl"> |
369 | 369 | <li class="acf-fr"> |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param $field - an array holding all the field's data |
392 | 392 | */ |
393 | 393 | |
394 | - function render_field_settings( $field ) { |
|
394 | + function render_field_settings($field) { |
|
395 | 395 | |
396 | 396 | // vars |
397 | 397 | $args = array( |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | ?><tr class="acf-field" data-setting="repeater" data-name="sub_fields"> |
405 | 405 | <td class="acf-label"> |
406 | - <label><?php _e("Sub Fields",'acf'); ?></label> |
|
406 | + <label><?php _e("Sub Fields", 'acf'); ?></label> |
|
407 | 407 | <p class="description"></p> |
408 | 408 | </td> |
409 | 409 | <td class="acf-input"> |
@@ -425,16 +425,16 @@ discard block |
||
425 | 425 | // preview |
426 | 426 | $choices = array(); |
427 | 427 | |
428 | - if( $field['collapsed'] ) { |
|
428 | + if ($field['collapsed']) { |
|
429 | 429 | |
430 | - $choices[ $field['collapsed'] ] = $field['collapsed']; |
|
430 | + $choices[$field['collapsed']] = $field['collapsed']; |
|
431 | 431 | |
432 | 432 | } |
433 | 433 | |
434 | 434 | |
435 | - acf_render_field_setting( $field, array( |
|
436 | - 'label' => __('Collapsed','acf'), |
|
437 | - 'instructions' => __('Select a sub field to show when row is collapsed','acf'), |
|
435 | + acf_render_field_setting($field, array( |
|
436 | + 'label' => __('Collapsed', 'acf'), |
|
437 | + 'instructions' => __('Select a sub field to show when row is collapsed', 'acf'), |
|
438 | 438 | 'type' => 'select', |
439 | 439 | 'name' => 'collapsed', |
440 | 440 | 'allow_null' => 1, |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | |
444 | 444 | |
445 | 445 | // min |
446 | - acf_render_field_setting( $field, array( |
|
447 | - 'label' => __('Minimum Rows','acf'), |
|
446 | + acf_render_field_setting($field, array( |
|
447 | + 'label' => __('Minimum Rows', 'acf'), |
|
448 | 448 | 'instructions' => '', |
449 | 449 | 'type' => 'number', |
450 | 450 | 'name' => 'min', |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | |
454 | 454 | |
455 | 455 | // max |
456 | - acf_render_field_setting( $field, array( |
|
457 | - 'label' => __('Maximum Rows','acf'), |
|
456 | + acf_render_field_setting($field, array( |
|
457 | + 'label' => __('Maximum Rows', 'acf'), |
|
458 | 458 | 'instructions' => '', |
459 | 459 | 'type' => 'number', |
460 | 460 | 'name' => 'max', |
@@ -463,24 +463,24 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | // layout |
466 | - acf_render_field_setting( $field, array( |
|
467 | - 'label' => __('Layout','acf'), |
|
466 | + acf_render_field_setting($field, array( |
|
467 | + 'label' => __('Layout', 'acf'), |
|
468 | 468 | 'instructions' => '', |
469 | 469 | 'class' => 'acf-repeater-layout', |
470 | 470 | 'type' => 'radio', |
471 | 471 | 'name' => 'layout', |
472 | 472 | 'layout' => 'horizontal', |
473 | 473 | 'choices' => array( |
474 | - 'table' => __('Table','acf'), |
|
475 | - 'block' => __('Block','acf'), |
|
476 | - 'row' => __('Row','acf') |
|
474 | + 'table' => __('Table', 'acf'), |
|
475 | + 'block' => __('Block', 'acf'), |
|
476 | + 'row' => __('Row', 'acf') |
|
477 | 477 | ) |
478 | 478 | )); |
479 | 479 | |
480 | 480 | |
481 | 481 | // button_label |
482 | - acf_render_field_setting( $field, array( |
|
483 | - 'label' => __('Button Label','acf'), |
|
482 | + acf_render_field_setting($field, array( |
|
483 | + 'label' => __('Button Label', 'acf'), |
|
484 | 484 | 'instructions' => '', |
485 | 485 | 'type' => 'text', |
486 | 486 | 'name' => 'button_label', |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | * @return $value |
505 | 505 | */ |
506 | 506 | |
507 | - function load_value( $value, $post_id, $field ) { |
|
507 | + function load_value($value, $post_id, $field) { |
|
508 | 508 | |
509 | 509 | // bail early if no value |
510 | - if( empty($value) || empty($field['sub_fields']) ) { |
|
510 | + if (empty($value) || empty($field['sub_fields'])) { |
|
511 | 511 | |
512 | 512 | return $value; |
513 | 513 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | |
517 | 517 | // convert to int |
518 | - $value = intval( $value ); |
|
518 | + $value = intval($value); |
|
519 | 519 | |
520 | 520 | |
521 | 521 | // vars |
@@ -523,20 +523,20 @@ discard block |
||
523 | 523 | |
524 | 524 | |
525 | 525 | // check number of rows |
526 | - if( $value > 0 ) { |
|
526 | + if ($value > 0) { |
|
527 | 527 | |
528 | 528 | // loop through rows |
529 | - for( $i = 0; $i < $value; $i++ ) { |
|
529 | + for ($i = 0; $i < $value; $i++) { |
|
530 | 530 | |
531 | 531 | // create empty array |
532 | - $rows[ $i ] = array(); |
|
532 | + $rows[$i] = array(); |
|
533 | 533 | |
534 | 534 | |
535 | 535 | // loop through sub fields |
536 | - foreach( array_keys($field['sub_fields']) as $j ) { |
|
536 | + foreach (array_keys($field['sub_fields']) as $j) { |
|
537 | 537 | |
538 | 538 | // get sub field |
539 | - $sub_field = $field['sub_fields'][ $j ]; |
|
539 | + $sub_field = $field['sub_fields'][$j]; |
|
540 | 540 | |
541 | 541 | |
542 | 542 | // update $sub_field name |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | |
545 | 545 | |
546 | 546 | // get value |
547 | - $sub_value = acf_get_value( $post_id, $sub_field ); |
|
547 | + $sub_value = acf_get_value($post_id, $sub_field); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | // add value |
551 | - $rows[ $i ][ $sub_field['key'] ] = $sub_value; |
|
551 | + $rows[$i][$sub_field['key']] = $sub_value; |
|
552 | 552 | |
553 | 553 | } |
554 | 554 | // foreach |
@@ -582,10 +582,10 @@ discard block |
||
582 | 582 | * @return $value (mixed) the modified value |
583 | 583 | */ |
584 | 584 | |
585 | - function format_value( $value, $post_id, $field ) { |
|
585 | + function format_value($value, $post_id, $field) { |
|
586 | 586 | |
587 | 587 | // bail early if no value |
588 | - if( empty($value) || empty($field['sub_fields']) ) { |
|
588 | + if (empty($value) || empty($field['sub_fields'])) { |
|
589 | 589 | |
590 | 590 | return false; |
591 | 591 | |
@@ -593,25 +593,25 @@ discard block |
||
593 | 593 | |
594 | 594 | |
595 | 595 | // loop over rows |
596 | - foreach( array_keys($value) as $i ) { |
|
596 | + foreach (array_keys($value) as $i) { |
|
597 | 597 | |
598 | 598 | // loop through sub fields |
599 | - foreach( array_keys($field['sub_fields']) as $j ) { |
|
599 | + foreach (array_keys($field['sub_fields']) as $j) { |
|
600 | 600 | |
601 | 601 | // get sub field |
602 | - $sub_field = $field['sub_fields'][ $j ]; |
|
602 | + $sub_field = $field['sub_fields'][$j]; |
|
603 | 603 | |
604 | 604 | |
605 | 605 | // extract value |
606 | - $sub_value = acf_extract_var( $value[ $i ], $sub_field['key'] ); |
|
606 | + $sub_value = acf_extract_var($value[$i], $sub_field['key']); |
|
607 | 607 | |
608 | 608 | |
609 | 609 | // format value |
610 | - $sub_value = acf_format_value( $sub_value, $post_id, $sub_field ); |
|
610 | + $sub_value = acf_format_value($sub_value, $post_id, $sub_field); |
|
611 | 611 | |
612 | 612 | |
613 | 613 | // append to $row |
614 | - $value[ $i ][ $sub_field['name'] ] = $sub_value; |
|
614 | + $value[$i][$sub_field['name']] = $sub_value; |
|
615 | 615 | |
616 | 616 | } |
617 | 617 | |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | * @return $post_id (int) |
638 | 638 | */ |
639 | 639 | |
640 | - function validate_value( $valid, $value, $field, $input ){ |
|
640 | + function validate_value($valid, $value, $field, $input) { |
|
641 | 641 | |
642 | 642 | // remove acfcloneindex |
643 | - if( isset($value['acfcloneindex']) ) { |
|
643 | + if (isset($value['acfcloneindex'])) { |
|
644 | 644 | |
645 | 645 | unset($value['acfcloneindex']); |
646 | 646 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | |
649 | 649 | |
650 | 650 | // valid |
651 | - if( $field['required'] && empty($value) ) { |
|
651 | + if ($field['required'] && empty($value)) { |
|
652 | 652 | |
653 | 653 | $valid = false; |
654 | 654 | |
@@ -656,20 +656,20 @@ discard block |
||
656 | 656 | |
657 | 657 | |
658 | 658 | // check sub fields |
659 | - if( !empty($field['sub_fields']) && !empty($value) ) { |
|
659 | + if ( ! empty($field['sub_fields']) && ! empty($value)) { |
|
660 | 660 | |
661 | 661 | $keys = array_keys($value); |
662 | 662 | |
663 | - foreach( $keys as $i ) { |
|
663 | + foreach ($keys as $i) { |
|
664 | 664 | |
665 | - foreach( $field['sub_fields'] as $sub_field ) { |
|
665 | + foreach ($field['sub_fields'] as $sub_field) { |
|
666 | 666 | |
667 | 667 | // vars |
668 | 668 | $k = $sub_field['key']; |
669 | 669 | |
670 | 670 | |
671 | 671 | // test sub field exists |
672 | - if( !isset($value[ $i ][ $k ]) ) { |
|
672 | + if ( ! isset($value[$i][$k])) { |
|
673 | 673 | |
674 | 674 | continue; |
675 | 675 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | |
678 | 678 | |
679 | 679 | // validate |
680 | - acf_validate_value( $value[ $i ][ $k ], $sub_field, "{$input}[{$i}][{$k}]" ); |
|
680 | + acf_validate_value($value[$i][$k], $sub_field, "{$input}[{$i}][{$k}]"); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | } |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * @return $value - the modified value |
706 | 706 | */ |
707 | 707 | |
708 | - function update_value( $value, $post_id, $field ) { |
|
708 | + function update_value($value, $post_id, $field) { |
|
709 | 709 | |
710 | 710 | // vars |
711 | 711 | $total = 0; |
712 | 712 | |
713 | 713 | |
714 | 714 | // remove acfcloneindex |
715 | - if( isset($value['acfcloneindex']) ) { |
|
715 | + if (isset($value['acfcloneindex'])) { |
|
716 | 716 | |
717 | 717 | unset($value['acfcloneindex']); |
718 | 718 | |
@@ -720,14 +720,14 @@ discard block |
||
720 | 720 | |
721 | 721 | |
722 | 722 | // update sub fields |
723 | - if( !empty($value) ) { |
|
723 | + if ( ! empty($value)) { |
|
724 | 724 | |
725 | 725 | // $i |
726 | 726 | $i = -1; |
727 | 727 | |
728 | 728 | |
729 | 729 | // loop through rows |
730 | - foreach( $value as $row ) { |
|
730 | + foreach ($value as $row) { |
|
731 | 731 | |
732 | 732 | // $i |
733 | 733 | $i++; |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | |
740 | 740 | // continue if no sub fields |
741 | - if( !$field['sub_fields'] ) { |
|
741 | + if ( ! $field['sub_fields']) { |
|
742 | 742 | |
743 | 743 | continue; |
744 | 744 | |
@@ -746,20 +746,20 @@ discard block |
||
746 | 746 | |
747 | 747 | |
748 | 748 | // loop through sub fields |
749 | - foreach( $field['sub_fields'] as $sub_field ) { |
|
749 | + foreach ($field['sub_fields'] as $sub_field) { |
|
750 | 750 | |
751 | 751 | // value |
752 | 752 | $v = false; |
753 | 753 | |
754 | 754 | |
755 | 755 | // key (backend) |
756 | - if( isset($row[ $sub_field['key'] ]) ) { |
|
756 | + if (isset($row[$sub_field['key']])) { |
|
757 | 757 | |
758 | - $v = $row[ $sub_field['key'] ]; |
|
758 | + $v = $row[$sub_field['key']]; |
|
759 | 759 | |
760 | - } elseif( isset($row[ $sub_field['name'] ]) ) { |
|
760 | + } elseif (isset($row[$sub_field['name']])) { |
|
761 | 761 | |
762 | - $v = $row[ $sub_field['name'] ]; |
|
762 | + $v = $row[$sub_field['name']]; |
|
763 | 763 | |
764 | 764 | } else { |
765 | 765 | |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | |
775 | 775 | |
776 | 776 | // update value |
777 | - acf_update_value( $v, $post_id, $sub_field ); |
|
777 | + acf_update_value($v, $post_id, $sub_field); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | // foreach |
@@ -787,20 +787,20 @@ discard block |
||
787 | 787 | |
788 | 788 | |
789 | 789 | // get old value (db only) |
790 | - $old_total = (int) acf_get_metadata( $post_id, $field['name'] ); |
|
790 | + $old_total = (int) acf_get_metadata($post_id, $field['name']); |
|
791 | 791 | |
792 | - if( $old_total > $total ) { |
|
792 | + if ($old_total > $total) { |
|
793 | 793 | |
794 | - for( $i = $total; $i < $old_total; $i++ ) { |
|
794 | + for ($i = $total; $i < $old_total; $i++) { |
|
795 | 795 | |
796 | - foreach( $field['sub_fields'] as $sub_field ) { |
|
796 | + foreach ($field['sub_fields'] as $sub_field) { |
|
797 | 797 | |
798 | 798 | // modify name for delete |
799 | 799 | $sub_field['name'] = "{$field['name']}_{$i}_{$sub_field['name']}"; |
800 | 800 | |
801 | 801 | |
802 | 802 | // delete value |
803 | - acf_delete_value( $post_id, $sub_field ); |
|
803 | + acf_delete_value($post_id, $sub_field); |
|
804 | 804 | |
805 | 805 | } |
806 | 806 | // foreach |
@@ -834,30 +834,30 @@ discard block |
||
834 | 834 | * @return $post_id (int) |
835 | 835 | */ |
836 | 836 | |
837 | - function delete_value( $post_id, $key, $field ) { |
|
837 | + function delete_value($post_id, $key, $field) { |
|
838 | 838 | |
839 | 839 | // get old value (db only) |
840 | - $old_total = (int) acf_get_metadata( $post_id, $field['name'] ); |
|
840 | + $old_total = (int) acf_get_metadata($post_id, $field['name']); |
|
841 | 841 | |
842 | 842 | |
843 | 843 | // bail early if no rows or no sub fields |
844 | - if( !$old_total || !$field['sub_fields'] ) { |
|
844 | + if ( ! $old_total || ! $field['sub_fields']) { |
|
845 | 845 | |
846 | 846 | return; |
847 | 847 | |
848 | 848 | } |
849 | 849 | |
850 | 850 | |
851 | - for( $i = 0; $i < $old_total; $i++ ) { |
|
851 | + for ($i = 0; $i < $old_total; $i++) { |
|
852 | 852 | |
853 | - foreach( $field['sub_fields'] as $sub_field ) { |
|
853 | + foreach ($field['sub_fields'] as $sub_field) { |
|
854 | 854 | |
855 | 855 | // modify name for delete |
856 | 856 | $sub_field['name'] = "{$key}_{$i}_{$sub_field['name']}"; |
857 | 857 | |
858 | 858 | |
859 | 859 | // delete value |
860 | - acf_delete_value( $post_id, $sub_field ); |
|
860 | + acf_delete_value($post_id, $sub_field); |
|
861 | 861 | |
862 | 862 | } |
863 | 863 | // foreach |
@@ -880,14 +880,14 @@ discard block |
||
880 | 880 | * @return $post_id (int) |
881 | 881 | */ |
882 | 882 | |
883 | - function delete_field( $field ) { |
|
883 | + function delete_field($field) { |
|
884 | 884 | |
885 | 885 | // loop through sub fields |
886 | - if( !empty($field['sub_fields']) ) { |
|
886 | + if ( ! empty($field['sub_fields'])) { |
|
887 | 887 | |
888 | - foreach( $field['sub_fields'] as $sub_field ) { |
|
888 | + foreach ($field['sub_fields'] as $sub_field) { |
|
889 | 889 | |
890 | - acf_delete_field( $sub_field['ID'] ); |
|
890 | + acf_delete_field($sub_field['ID']); |
|
891 | 891 | |
892 | 892 | } |
893 | 893 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * @return $field - the modified field |
912 | 912 | */ |
913 | 913 | |
914 | - function update_field( $field ) { |
|
914 | + function update_field($field) { |
|
915 | 915 | |
916 | 916 | // remove sub fields |
917 | 917 | unset($field['sub_fields']); |
@@ -936,18 +936,18 @@ discard block |
||
936 | 936 | * @return $field - the modified field |
937 | 937 | */ |
938 | 938 | |
939 | - function duplicate_field( $field ) { |
|
939 | + function duplicate_field($field) { |
|
940 | 940 | |
941 | 941 | // get sub fields |
942 | - $sub_fields = acf_extract_var( $field, 'sub_fields' ); |
|
942 | + $sub_fields = acf_extract_var($field, 'sub_fields'); |
|
943 | 943 | |
944 | 944 | |
945 | 945 | // save field to get ID |
946 | - $field = acf_update_field( $field ); |
|
946 | + $field = acf_update_field($field); |
|
947 | 947 | |
948 | 948 | |
949 | 949 | // duplicate sub fields |
950 | - acf_duplicate_fields( $sub_fields, $field['ID'] ); |
|
950 | + acf_duplicate_fields($sub_fields, $field['ID']); |
|
951 | 951 | |
952 | 952 | |
953 | 953 | // return |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | |
46 | 46 | // do not delete! |
47 | - parent::__construct(); |
|
47 | + parent::__construct(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | function lighthouse_menus() { |
8 | - register_nav_menus( |
|
9 | - array( |
|
10 | - 'header-menu-left' => __( 'Header menu left', 'nav menu location', 'lighthouse' ), |
|
11 | - 'header-menu-right' => __( 'Header menu right' , 'nav menu location', 'lighthouse'), |
|
12 | - 'footer-menu' => __( 'Footer menu' , 'nav menu location', 'lighthouse'), |
|
13 | - 'footer-menu-bottom' => __( 'Footer menu bottom' , 'nav menu location', 'lighthouse') |
|
14 | - ) |
|
15 | - ); |
|
8 | + register_nav_menus( |
|
9 | + array( |
|
10 | + 'header-menu-left' => __( 'Header menu left', 'nav menu location', 'lighthouse' ), |
|
11 | + 'header-menu-right' => __( 'Header menu right' , 'nav menu location', 'lighthouse'), |
|
12 | + 'footer-menu' => __( 'Footer menu' , 'nav menu location', 'lighthouse'), |
|
13 | + 'footer-menu-bottom' => __( 'Footer menu bottom' , 'nav menu location', 'lighthouse') |
|
14 | + ) |
|
15 | + ); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | add_action( 'init', 'lighthouse_menus' ); |
@@ -25,104 +25,104 @@ discard block |
||
25 | 25 | |
26 | 26 | //Left menu |
27 | 27 | function lighthouse_header_menu_left() { |
28 | - if ( has_nav_menu( 'header-menu-left' ) ) { |
|
29 | - wp_nav_menu( |
|
30 | - array( |
|
31 | - 'theme_location' => 'header-menu-left', |
|
32 | - 'menu' => '', |
|
33 | - 'container' => 'div', |
|
34 | - 'container_id' => 'header-menu-left-id', |
|
35 | - 'container_class' => 'header-menu-left-cl', |
|
36 | - 'menu_id' => 'header-menu-id', |
|
37 | - 'menu_class' => 'header-menu-cl', |
|
38 | - 'echo' => true, |
|
39 | - 'fallback_cb' => '', |
|
40 | - 'before' => '', |
|
41 | - 'after' => '', |
|
42 | - 'link_before' => '<span>', |
|
43 | - 'link_after' => '</span>', |
|
44 | - 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
45 | - 'depth' => 0, |
|
46 | - 'walker' => '' |
|
47 | - ) |
|
48 | - ); |
|
49 | - } |
|
28 | + if ( has_nav_menu( 'header-menu-left' ) ) { |
|
29 | + wp_nav_menu( |
|
30 | + array( |
|
31 | + 'theme_location' => 'header-menu-left', |
|
32 | + 'menu' => '', |
|
33 | + 'container' => 'div', |
|
34 | + 'container_id' => 'header-menu-left-id', |
|
35 | + 'container_class' => 'header-menu-left-cl', |
|
36 | + 'menu_id' => 'header-menu-id', |
|
37 | + 'menu_class' => 'header-menu-cl', |
|
38 | + 'echo' => true, |
|
39 | + 'fallback_cb' => '', |
|
40 | + 'before' => '', |
|
41 | + 'after' => '', |
|
42 | + 'link_before' => '<span>', |
|
43 | + 'link_after' => '</span>', |
|
44 | + 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
45 | + 'depth' => 0, |
|
46 | + 'walker' => '' |
|
47 | + ) |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | //Right menu |
53 | 53 | function lighthouse_header_menu_right() { |
54 | - if ( has_nav_menu( 'header-menu-right' ) ) { |
|
55 | - wp_nav_menu( |
|
56 | - array( |
|
57 | - 'theme_location' => 'header-menu-right', |
|
58 | - 'menu' => '', |
|
59 | - 'container' => 'div', |
|
60 | - 'container_id' => 'header-menu-right-id', |
|
61 | - 'container_class' => 'header-menu-right-cl', |
|
62 | - 'menu_id' => 'header-menu-id', |
|
63 | - 'menu_class' => 'header-menu-cl', |
|
64 | - 'echo' => true, |
|
65 | - 'fallback_cb' => '', |
|
66 | - 'before' => '', |
|
67 | - 'after' => '', |
|
68 | - 'link_before' => '<span>', |
|
69 | - 'link_after' => '</span>', |
|
70 | - 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
71 | - 'depth' => 0, |
|
72 | - 'walker' => '' |
|
73 | - ) |
|
74 | - ); |
|
75 | - } |
|
54 | + if ( has_nav_menu( 'header-menu-right' ) ) { |
|
55 | + wp_nav_menu( |
|
56 | + array( |
|
57 | + 'theme_location' => 'header-menu-right', |
|
58 | + 'menu' => '', |
|
59 | + 'container' => 'div', |
|
60 | + 'container_id' => 'header-menu-right-id', |
|
61 | + 'container_class' => 'header-menu-right-cl', |
|
62 | + 'menu_id' => 'header-menu-id', |
|
63 | + 'menu_class' => 'header-menu-cl', |
|
64 | + 'echo' => true, |
|
65 | + 'fallback_cb' => '', |
|
66 | + 'before' => '', |
|
67 | + 'after' => '', |
|
68 | + 'link_before' => '<span>', |
|
69 | + 'link_after' => '</span>', |
|
70 | + 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
71 | + 'depth' => 0, |
|
72 | + 'walker' => '' |
|
73 | + ) |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | //Fotter menu |
79 | 79 | function lighthouse_footer_menu() { |
80 | - if ( has_nav_menu( 'footer-menu' ) ) { |
|
81 | - wp_nav_menu( |
|
82 | - array( |
|
83 | - 'theme_location' => 'footer-menu', |
|
84 | - 'menu' => '', |
|
85 | - 'container' => 'div', |
|
86 | - 'container_id' => 'footer-menu-id', |
|
87 | - 'container_class' => 'footer-menu-cl', |
|
88 | - 'menu_id' => 'footer-menu-id', |
|
89 | - 'menu_class' => 'footer-menu-cl', |
|
90 | - 'echo' => true, |
|
91 | - 'fallback_cb' => '', |
|
92 | - 'before' => '', |
|
93 | - 'after' => '', |
|
94 | - 'link_before' => '', |
|
95 | - 'link_after' => '', |
|
96 | - 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
97 | - 'depth' => 0, |
|
98 | - 'walker' => '' |
|
99 | - ) |
|
100 | - ); |
|
101 | - } |
|
80 | + if ( has_nav_menu( 'footer-menu' ) ) { |
|
81 | + wp_nav_menu( |
|
82 | + array( |
|
83 | + 'theme_location' => 'footer-menu', |
|
84 | + 'menu' => '', |
|
85 | + 'container' => 'div', |
|
86 | + 'container_id' => 'footer-menu-id', |
|
87 | + 'container_class' => 'footer-menu-cl', |
|
88 | + 'menu_id' => 'footer-menu-id', |
|
89 | + 'menu_class' => 'footer-menu-cl', |
|
90 | + 'echo' => true, |
|
91 | + 'fallback_cb' => '', |
|
92 | + 'before' => '', |
|
93 | + 'after' => '', |
|
94 | + 'link_before' => '', |
|
95 | + 'link_after' => '', |
|
96 | + 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
97 | + 'depth' => 0, |
|
98 | + 'walker' => '' |
|
99 | + ) |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | //Menu footer-bottom |
105 | 105 | function lighthouse_footer_menu_bottom() { |
106 | - if ( has_nav_menu( 'footer-menu-bottom' ) ) { |
|
107 | - wp_nav_menu( |
|
108 | - array( |
|
109 | - 'theme_location' => 'footer-menu-bottom', |
|
110 | - 'menu' => '', |
|
111 | - 'container' => 'div', |
|
112 | - 'container_id' => 'footer-menu-bottom-id', |
|
113 | - 'container_class' => 'footer-menu-bottom-cl', |
|
114 | - 'menu_id' => 'footer-menu-id', |
|
115 | - 'menu_class' => 'footer-menu-cl', |
|
116 | - 'echo' => true, |
|
117 | - 'fallback_cb' => '', |
|
118 | - 'before' => '', |
|
119 | - 'after' => '', |
|
120 | - 'link_before' => '', |
|
121 | - 'link_after' => '', |
|
122 | - 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
123 | - 'depth' => 0, |
|
124 | - 'walker' => '' |
|
125 | - ) |
|
126 | - ); |
|
127 | - } |
|
106 | + if ( has_nav_menu( 'footer-menu-bottom' ) ) { |
|
107 | + wp_nav_menu( |
|
108 | + array( |
|
109 | + 'theme_location' => 'footer-menu-bottom', |
|
110 | + 'menu' => '', |
|
111 | + 'container' => 'div', |
|
112 | + 'container_id' => 'footer-menu-bottom-id', |
|
113 | + 'container_class' => 'footer-menu-bottom-cl', |
|
114 | + 'menu_id' => 'footer-menu-id', |
|
115 | + 'menu_class' => 'footer-menu-cl', |
|
116 | + 'echo' => true, |
|
117 | + 'fallback_cb' => '', |
|
118 | + 'before' => '', |
|
119 | + 'after' => '', |
|
120 | + 'link_before' => '', |
|
121 | + 'link_after' => '', |
|
122 | + 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
|
123 | + 'depth' => 0, |
|
124 | + 'walker' => '' |
|
125 | + ) |
|
126 | + ); |
|
127 | + } |
|
128 | 128 | } |
129 | 129 | \ No newline at end of file |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | function lighthouse_menus() { |
8 | 8 | register_nav_menus( |
9 | 9 | array( |
10 | - 'header-menu-left' => __( 'Header menu left', 'nav menu location', 'lighthouse' ), |
|
11 | - 'header-menu-right' => __( 'Header menu right' , 'nav menu location', 'lighthouse'), |
|
12 | - 'footer-menu' => __( 'Footer menu' , 'nav menu location', 'lighthouse'), |
|
13 | - 'footer-menu-bottom' => __( 'Footer menu bottom' , 'nav menu location', 'lighthouse') |
|
10 | + 'header-menu-left' => __('Header menu left', 'nav menu location', 'lighthouse'), |
|
11 | + 'header-menu-right' => __('Header menu right', 'nav menu location', 'lighthouse'), |
|
12 | + 'footer-menu' => __('Footer menu', 'nav menu location', 'lighthouse'), |
|
13 | + 'footer-menu-bottom' => __('Footer menu bottom', 'nav menu location', 'lighthouse') |
|
14 | 14 | ) |
15 | 15 | ); |
16 | 16 | } |
17 | 17 | |
18 | -add_action( 'init', 'lighthouse_menus' ); |
|
18 | +add_action('init', 'lighthouse_menus'); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /* |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | //Left menu |
27 | 27 | function lighthouse_header_menu_left() { |
28 | - if ( has_nav_menu( 'header-menu-left' ) ) { |
|
28 | + if (has_nav_menu('header-menu-left')) { |
|
29 | 29 | wp_nav_menu( |
30 | 30 | array( |
31 | 31 | 'theme_location' => 'header-menu-left', |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | //Right menu |
53 | 53 | function lighthouse_header_menu_right() { |
54 | - if ( has_nav_menu( 'header-menu-right' ) ) { |
|
54 | + if (has_nav_menu('header-menu-right')) { |
|
55 | 55 | wp_nav_menu( |
56 | 56 | array( |
57 | 57 | 'theme_location' => 'header-menu-right', |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | //Fotter menu |
79 | 79 | function lighthouse_footer_menu() { |
80 | - if ( has_nav_menu( 'footer-menu' ) ) { |
|
80 | + if (has_nav_menu('footer-menu')) { |
|
81 | 81 | wp_nav_menu( |
82 | 82 | array( |
83 | 83 | 'theme_location' => 'footer-menu', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | //Menu footer-bottom |
105 | 105 | function lighthouse_footer_menu_bottom() { |
106 | - if ( has_nav_menu( 'footer-menu-bottom' ) ) { |
|
106 | + if (has_nav_menu('footer-menu-bottom')) { |
|
107 | 107 | wp_nav_menu( |
108 | 108 | array( |
109 | 109 | 'theme_location' => 'footer-menu-bottom', |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Read More button in excerpt |
5 | 5 | */ |
6 | -function new_excerpt_more( $more ) { |
|
7 | - return '... <a class="readmore" href="' . get_permalink() . ' ">Read more <i class="fa fa-external-link"></i></a>'; |
|
6 | +function new_excerpt_more($more) { |
|
7 | + return '... <a class="readmore" href="'.get_permalink().' ">Read more <i class="fa fa-external-link"></i></a>'; |
|
8 | 8 | } |
9 | 9 | |
10 | -add_filter( 'excerpt_more', 'new_excerpt_more' ); |
|
10 | +add_filter('excerpt_more', 'new_excerpt_more'); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Custome Lenght of excerpt |
@@ -23,37 +23,37 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function pagination($pages = '', $range = 4) |
25 | 25 | { |
26 | - $showitems = ($range * 2)+1; |
|
26 | + $showitems = ($range * 2) + 1; |
|
27 | 27 | |
28 | 28 | global $paged; |
29 | - if(empty($paged)) $paged = 1; |
|
29 | + if (empty($paged)) $paged = 1; |
|
30 | 30 | |
31 | - if($pages == '') |
|
31 | + if ($pages == '') |
|
32 | 32 | { |
33 | 33 | global $wp_query; |
34 | 34 | $pages = $wp_query->max_num_pages; |
35 | - if(!$pages) |
|
35 | + if ( ! $pages) |
|
36 | 36 | { |
37 | 37 | $pages = 1; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | - if(1 != $pages) |
|
41 | + if (1 != $pages) |
|
42 | 42 | { |
43 | 43 | echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>"; |
44 | - if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>"; |
|
45 | - if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>"; |
|
44 | + if ($paged > 2 && $paged > $range + 1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>"; |
|
45 | + if ($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>"; |
|
46 | 46 | |
47 | - for ($i=1; $i <= $pages; $i++) |
|
47 | + for ($i = 1; $i <= $pages; $i++) |
|
48 | 48 | { |
49 | - if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) |
|
49 | + if (1 != $pages && ( ! ($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) |
|
50 | 50 | { |
51 | - echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>"; |
|
51 | + echo ($paged == $i) ? "<span class=\"current\">".$i."</span>" : "<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | 55 | if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a>"; |
56 | - if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>"; |
|
56 | + if ($paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>"; |
|
57 | 57 | echo "</div>\n"; |
58 | 58 | } |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * stop wp removing div tags |
64 | 64 | */ |
65 | -function tinymce_settings( $settings ) { |
|
65 | +function tinymce_settings($settings) { |
|
66 | 66 | |
67 | 67 | // html elements being stripped |
68 | 68 | $settings['extended_valid_elements'] = 'div[*],article[*]'; |
@@ -93,4 +93,4 @@ discard block |
||
93 | 93 | return $settings; |
94 | 94 | } |
95 | 95 | |
96 | -add_filter( 'tiny_mce_before_init', 'tinymce_settings' ); |
|
97 | 96 | \ No newline at end of file |
97 | +add_filter('tiny_mce_before_init', 'tinymce_settings'); |
|
98 | 98 | \ No newline at end of file |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | $showitems = ($range * 2)+1; |
27 | 27 | |
28 | 28 | global $paged; |
29 | - if(empty($paged)) $paged = 1; |
|
29 | + if(empty($paged)) { |
|
30 | + $paged = 1; |
|
31 | + } |
|
30 | 32 | |
31 | 33 | if($pages == '') |
32 | 34 | { |
@@ -41,8 +43,12 @@ discard block |
||
41 | 43 | if(1 != $pages) |
42 | 44 | { |
43 | 45 | echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>"; |
44 | - if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>"; |
|
45 | - if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>"; |
|
46 | + if($paged > 2 && $paged > $range+1 && $showitems < $pages) { |
|
47 | + echo "<a href='".get_pagenum_link(1)."'>« First</a>"; |
|
48 | + } |
|
49 | + if($paged > 1 && $showitems < $pages) { |
|
50 | + echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>"; |
|
51 | + } |
|
46 | 52 | |
47 | 53 | for ($i=1; $i <= $pages; $i++) |
48 | 54 | { |
@@ -52,8 +58,12 @@ discard block |
||
52 | 58 | } |
53 | 59 | } |
54 | 60 | |
55 | - if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a>"; |
|
56 | - if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>"; |
|
61 | + if ($paged < $pages && $showitems < $pages) { |
|
62 | + echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a>"; |
|
63 | + } |
|
64 | + if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) { |
|
65 | + echo "<a href='".get_pagenum_link($pages)."'>Last »</a>"; |
|
66 | + } |
|
57 | 67 | echo "</div>\n"; |
58 | 68 | } |
59 | 69 | } |
@@ -64,31 +64,31 @@ |
||
64 | 64 | */ |
65 | 65 | function tinymce_settings( $settings ) { |
66 | 66 | |
67 | - // html elements being stripped |
|
67 | + // html elements being stripped |
|
68 | 68 | $settings['extended_valid_elements'] = 'div[*],article[*]'; |
69 | 69 | |
70 | - // only html elements to keep |
|
71 | - //$settings['valid_elements'] = 'a,strong/b,div,h1,h2,h3,section'; |
|
70 | + // only html elements to keep |
|
71 | + //$settings['valid_elements'] = 'a,strong/b,div,h1,h2,h3,section'; |
|
72 | 72 | |
73 | 73 | // paste elements to keep |
74 | 74 | //$opts = '*[*]'; |
75 | 75 | //$settings['paste_word_valid_elements'] = $opts; |
76 | 76 | |
77 | - // don't remove line breaks |
|
77 | + // don't remove line breaks |
|
78 | 78 | //$settings['remove_linebreaks'] = false; |
79 | 79 | |
80 | 80 | $settings['allow_html_in_named_anchor'] = true; |
81 | 81 | |
82 | - // convert newline characters to BR |
|
82 | + // convert newline characters to BR |
|
83 | 83 | //$settings['convert_newlines_to_brs'] = true; |
84 | 84 | |
85 | - // don't remove redundant BR |
|
85 | + // don't remove redundant BR |
|
86 | 86 | //$settings['remove_redundant_brs'] = false; |
87 | 87 | |
88 | 88 | // only html elements to keep |
89 | 89 | //$settings['wpautop'] = false; |
90 | 90 | |
91 | - // pass back to wordpress |
|
91 | + // pass back to wordpress |
|
92 | 92 | |
93 | 93 | return $settings; |
94 | 94 | } |