@@ -76,9 +76,13 @@ |
||
76 | 76 | |
77 | 77 | /* a helper function */ |
78 | 78 | function strpos_arr($haystack, $needle) { |
79 | - if(!is_array($needle)) $needle = array($needle); |
|
79 | + if(!is_array($needle)) { |
|
80 | + $needle = array($needle); |
|
81 | + } |
|
80 | 82 | foreach($needle as $what) { |
81 | - if(($pos = strpos($haystack, $what))!==false) return $pos; |
|
83 | + if(($pos = strpos($haystack, $what))!==false) { |
|
84 | + return $pos; |
|
85 | + } |
|
82 | 86 | } |
83 | 87 | return false; |
84 | 88 | } |
85 | 89 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | if( !function_exists('lasso_editor_get_option')): |
16 | 16 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
17 | 17 | |
18 | - if ( empty( $option ) ) |
|
19 | - return; |
|
18 | + if ( empty( $option ) ) { |
|
19 | + return; |
|
20 | + } |
|
20 | 21 | |
21 | 22 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
22 | 23 | |
@@ -44,11 +45,12 @@ discard block |
||
44 | 45 | |
45 | 46 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
46 | 47 | |
47 | - if ( $q->have_posts() ) |
|
48 | - return true; |
|
49 | - else |
|
50 | - return false; |
|
51 | -} |
|
48 | + if ( $q->have_posts() ) { |
|
49 | + return true; |
|
50 | + } else { |
|
51 | + return false; |
|
52 | + } |
|
53 | + } |
|
52 | 54 | |
53 | 55 | /** |
54 | 56 | * Return a CSS class of an automatically supported theme |
@@ -194,13 +196,15 @@ discard block |
||
194 | 196 | */ |
195 | 197 | function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
196 | 198 | |
197 | - if ( empty( $postid ) ) |
|
198 | - $postid = get_the_ID(); |
|
199 | + if ( empty( $postid ) ) { |
|
200 | + $postid = get_the_ID(); |
|
201 | + } |
|
199 | 202 | |
200 | 203 | $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
201 | 204 | |
202 | - if ( empty( $objects) ) |
|
203 | - return; |
|
205 | + if ( empty( $objects) ) { |
|
206 | + return; |
|
207 | + } |
|
204 | 208 | |
205 | 209 | $out = ''; |
206 | 210 | foreach( $objects as $object ) { |
@@ -222,8 +226,9 @@ discard block |
||
222 | 226 | |
223 | 227 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
224 | 228 | |
225 | - if ( empty( $objects) ) |
|
226 | - return; |
|
229 | + if ( empty( $objects) ) { |
|
230 | + return; |
|
231 | + } |
|
227 | 232 | |
228 | 233 | $out = ""; |
229 | 234 | foreach( $objects as $object ) { |
@@ -345,8 +350,9 @@ discard block |
||
345 | 350 | */ |
346 | 351 | function lasso_clean_string( $string = '' ) { |
347 | 352 | |
348 | - if ( empty( $string ) ) |
|
349 | - return; |
|
353 | + if ( empty( $string ) ) { |
|
354 | + return; |
|
355 | + } |
|
350 | 356 | |
351 | 357 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
352 | 358 | } |
@@ -385,11 +391,13 @@ discard block |
||
385 | 391 | if ( !function_exists( 'lasso_user_can' ) ): |
386 | 392 | function lasso_user_can( $action = '', $postid = 0 ) { |
387 | 393 | $result = false; |
388 | - if ( empty( $action ) ) |
|
389 | - $action = 'edit_posts'; |
|
394 | + if ( empty( $action ) ) { |
|
395 | + $action = 'edit_posts'; |
|
396 | + } |
|
390 | 397 | |
391 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
392 | - $postid = get_the_ID(); |
|
398 | + if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') { |
|
399 | + $postid = get_the_ID(); |
|
400 | + } |
|
393 | 401 | |
394 | 402 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
395 | 403 | // check against post types: |
@@ -63,8 +63,9 @@ |
||
63 | 63 | |
64 | 64 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
65 | 65 | |
66 | - if ( empty( $option ) ) |
|
67 | - return; |
|
66 | + if ( empty( $option ) ) { |
|
67 | + return; |
|
68 | + } |
|
68 | 69 | |
69 | 70 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
70 | 71 |
@@ -160,8 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
163 | - } |
|
164 | - else { |
|
163 | + } else { |
|
165 | 164 | //remove all terms from post |
166 | 165 | $result = wp_set_object_terms( $postid, null, $taxonomy ); |
167 | 166 | |
@@ -169,7 +168,7 @@ discard block |
||
169 | 168 | |
170 | 169 | if ( ! is_wp_error( $result ) ) { |
171 | 170 | return true; |
172 | - }else{ |
|
171 | + } else{ |
|
173 | 172 | return false; |
174 | 173 | } |
175 | 174 | } |
@@ -204,7 +203,7 @@ discard block |
||
204 | 203 | $result = wp_set_object_terms( $postid, $cats, $taxonomy ); |
205 | 204 | if ( ! is_wp_error( $result ) ) { |
206 | 205 | return true; |
207 | - }else{ |
|
206 | + } else{ |
|
208 | 207 | return false; |
209 | 208 | } |
210 | 209 | } |
@@ -119,8 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | ob_start(); |
121 | 121 | |
122 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
123 | - return; |
|
122 | + if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) { |
|
123 | + return; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
126 | 127 | $key = sprintf('_lasso_%s_settings', $name ); |
@@ -198,8 +199,9 @@ discard block |
||
198 | 199 | $before = '<div class="lasso--postsettings__option">'; |
199 | 200 | $after = '</div>'; |
200 | 201 | |
201 | - if ( empty( $name ) || empty( $options ) ) |
|
202 | - return; |
|
202 | + if ( empty( $name ) || empty( $options ) ) { |
|
203 | + return; |
|
204 | + } |
|
203 | 205 | |
204 | 206 | foreach ( (array) $options as $option ) { |
205 | 207 | |
@@ -225,8 +227,9 @@ discard block |
||
225 | 227 | */ |
226 | 228 | function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
227 | 229 | |
228 | - if ( empty( $type ) || empty( $option ) ) |
|
229 | - return; |
|
230 | + if ( empty( $type ) || empty( $option ) ) { |
|
231 | + return; |
|
232 | + } |
|
230 | 233 | |
231 | 234 | $id = isset( $option['id'] ) ? $option['id'] : false; |
232 | 235 | //$id = $id ? lasso_clean_string( $id ) : false; |
@@ -19,7 +19,9 @@ |
||
19 | 19 | { |
20 | 20 | global $post; |
21 | 21 | $pos = strpos($post->post_content, "<!--nextpage-->"); |
22 | - if (!$pos) return -1; |
|
22 | + if (!$pos) { |
|
23 | + return -1; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | global $wp; |
25 | 27 | $url = home_url( $wp->request ); |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | function process_settings() { |
46 | 46 | |
47 | 47 | // bail out if current user isn't and administrator and they are not logged in |
48 | - if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) |
|
49 | - return; |
|
48 | + if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) { |
|
49 | + return; |
|
50 | + } |
|
50 | 51 | |
51 | 52 | if ( isset( $_POST['action'] ) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer( 'nonce', 'lasso_editor_settings' ) ) { |
52 | 53 | |
@@ -95,8 +96,9 @@ discard block |
||
95 | 96 | */ |
96 | 97 | function lasso_editor_settings_form() { |
97 | 98 | |
98 | - if ( !is_user_logged_in() ) |
|
99 | - return; |
|
99 | + if ( !is_user_logged_in() ) { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | |
101 | 103 | // check for lasso story engine and add a class doniting this |
102 | 104 | $ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
@@ -176,7 +178,9 @@ discard block |
||
176 | 178 | $post_types = get_post_types( $args, 'objects' ); |
177 | 179 | |
178 | 180 | foreach ( $post_types as $post_type ) { |
179 | - if ($post_type->name == 'attachment') continue; |
|
181 | + if ($post_type->name == 'attachment') { |
|
182 | + continue; |
|
183 | + } |
|
180 | 184 | $checked =""; |
181 | 185 | if ( in_array( $post_type->name, $allowed_post_types ) ) { |
182 | 186 | $checked = 'checked="checked"'; |
@@ -280,9 +280,12 @@ discard block |
||
280 | 280 | <?php if ( class_exists ('Aesop_Events') ) { ?> |
281 | 281 | <li data-type="events" title="<?php esc_attr_e( 'Event', 'lasso' );?>" class="lasso-toolbar--component__event"></li> |
282 | 282 | <?php }?> |
283 | - <?php else: ?> |
|
283 | + <?php else { |
|
284 | + : ?> |
|
284 | 285 | <?php if ($use_wp_block_image == 'on') { ?> |
285 | - <li data-type="wpimg-block" title="<?php esc_attr_e( 'WordPress Image', 'lasso' );?>" class="image lasso-toolbar--component__image"></li> |
|
286 | + <li data-type="wpimg-block" title="<?php esc_attr_e( 'WordPress Image', 'lasso' ); |
|
287 | +} |
|
288 | +?>" class="image lasso-toolbar--component__image"></li> |
|
286 | 289 | <?php } else { ?> |
287 | 290 | <li data-type="wpimg" title="<?php esc_attr_e( 'WordPress Image', 'lasso' );?>" class="image lasso-toolbar--component__image"></li> |
288 | 291 | <?php } ?> |
@@ -868,8 +871,9 @@ discard block |
||
868 | 871 | |
869 | 872 | $blob = array(); |
870 | 873 | |
871 | - if ( empty( $codes ) ) |
|
872 | - return; |
|
874 | + if ( empty( $codes ) ) { |
|
875 | + return; |
|
876 | + } |
|
873 | 877 | |
874 | 878 | foreach ( $codes as $slug => $shortcode ) { |
875 | 879 | $return = ''; |
@@ -425,44 +425,34 @@ discard block |
||
425 | 425 | if ($code == "aesop_video") { |
426 | 426 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
427 | 427 | echo aesop_video_shortcode($atts); |
428 | - } |
|
429 | - else if ($code == "aesop_image") { |
|
428 | + } else if ($code == "aesop_image") { |
|
430 | 429 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
431 | 430 | echo aesop_image_shortcode($atts); |
432 | - } |
|
433 | - else if ($code == "aesop_quote") { |
|
431 | + } else if ($code == "aesop_quote") { |
|
434 | 432 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
435 | 433 | echo aesop_quote_shortcode($atts); |
436 | - } |
|
437 | - else if ($code == "aesop_parallax") { |
|
434 | + } else if ($code == "aesop_parallax") { |
|
438 | 435 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
439 | 436 | echo aesop_parallax_shortcode($atts); |
440 | - } |
|
441 | - else if ($code == "aesop_character") { |
|
437 | + } else if ($code == "aesop_character") { |
|
442 | 438 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
443 | 439 | echo aesop_character_shortcode($atts); |
444 | - } |
|
445 | - else if ($code == "aesop_collection") { |
|
440 | + } else if ($code == "aesop_collection") { |
|
446 | 441 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
447 | 442 | echo aesop_collection_shortcode($atts); |
448 | - } |
|
449 | - else if ($code == "aesop_chapter") { |
|
443 | + } else if ($code == "aesop_chapter") { |
|
450 | 444 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
451 | 445 | echo aesop_chapter_shortcode($atts); |
452 | - } |
|
453 | - else if ($code == "aesop_content") { |
|
446 | + } else if ($code == "aesop_content") { |
|
454 | 447 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
455 | 448 | echo aesop_content_shortcode($atts, $atts['content_data']); |
456 | - } |
|
457 | - else if ($code == "aesop_gallery") { |
|
449 | + } else if ($code == "aesop_gallery") { |
|
458 | 450 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
459 | 451 | echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
460 | - } |
|
461 | - else if ($code == "aesop_audio") { |
|
452 | + } else if ($code == "aesop_audio") { |
|
462 | 453 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
463 | 454 | echo aesop_audio_shortcode($atts); |
464 | - } |
|
465 | - else if ($code == "aesop_document") { |
|
455 | + } else if ($code == "aesop_document") { |
|
466 | 456 | require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-document.php'); |
467 | 457 | echo aesop_document_shortcode($atts); |
468 | 458 | } |
@@ -472,11 +462,9 @@ discard block |
||
472 | 462 | }*/ |
473 | 463 | else if ($code == "aesop_wpimg") { |
474 | 464 | self::wpimg($atts); |
475 | - } |
|
476 | - else if ($code == "aesop_wpimg-block") { |
|
465 | + } else if ($code == "aesop_wpimg-block") { |
|
477 | 466 | self::wpimg_block($atts); |
478 | - } |
|
479 | - else { |
|
467 | + } else { |
|
480 | 468 | $code = '['.$code.' '; |
481 | 469 | foreach ($atts as $key => $value) { |
482 | 470 | $code = ''.$key.'="'.$value.'" '; |
@@ -585,8 +573,9 @@ discard block |
||
585 | 573 | $postid = isset( $_POST['postid'] ) ? $_POST['postid'] : false; |
586 | 574 | |
587 | 575 | // bail out if the current user can't publish posts |
588 | - if ( !lasso_user_can( 'delete_post', $postid ) ) |
|
589 | - return; |
|
576 | + if ( !lasso_user_can( 'delete_post', $postid ) ) { |
|
577 | + return; |
|
578 | + } |
|
590 | 579 | |
591 | 580 | if (!wp_verify_nonce( $_POST[ 'nonce' ], 'lasso_delete_post' )) { |
592 | 581 | wp_send_json_error(); |
@@ -682,15 +671,14 @@ discard block |
||
682 | 671 | } |
683 | 672 | |
684 | 673 | $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
685 | - } |
|
686 | - else { |
|
674 | + } else { |
|
687 | 675 | //remove all terms from post |
688 | 676 | $result = wp_set_object_terms( $postid, null, $taxonomy ); |
689 | 677 | } |
690 | 678 | |
691 | 679 | if ( ! is_wp_error( $result ) ) { |
692 | 680 | return true; |
693 | - }else{ |
|
681 | + } else{ |
|
694 | 682 | return false; |
695 | 683 | } |
696 | 684 | } |
@@ -760,9 +748,9 @@ discard block |
||
760 | 748 | $gallery_ids = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false; |
761 | 749 | if ( $_POST[ 'gallery_type' ] ) { |
762 | 750 | $type = $_POST[ 'gallery_type' ]; |
763 | - }elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
751 | + } elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { |
|
764 | 752 | $type = $options[ 'galleryType' ]; |
765 | - }else{ |
|
753 | + } else{ |
|
766 | 754 | $type = false; |
767 | 755 | } |
768 | 756 | |
@@ -841,13 +829,15 @@ discard block |
||
841 | 829 | |
842 | 830 | $month_numbers = range(1,12); |
843 | 831 | |
844 | - foreach($month_numbers as $month) |
|
845 | - $english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011)); |
|
832 | + foreach($month_numbers as $month) { |
|
833 | + $english_months[] = strftime('%B',mktime(0,0,0,$month,1,2011)); |
|
834 | + } |
|
846 | 835 | |
847 | 836 | setlocale(LC_ALL, get_locale()); |
848 | 837 | |
849 | - foreach($month_numbers as $month) |
|
850 | - $foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011))); |
|
838 | + foreach($month_numbers as $month) { |
|
839 | + $foreign_months[] = utf8_encode(strftime('%B',mktime(0,0,0,$month,1,2011))); |
|
840 | + } |
|
851 | 841 | |
852 | 842 | return str_replace($foreign_months, $english_months, $foreignMonthName); |
853 | 843 | } |