@@ -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 |
@@ -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 = ''; |
@@ -240,8 +240,7 @@ |
||
| 240 | 240 | $use_wp_block_image = lasso_editor_get_option('use_wp_block_image', 'lasso_editor','off'); |
| 241 | 241 | if ($use_wp_block_image == 'on') { |
| 242 | 242 | return '<figure class="wp-block-image size-large" data-component-type="wpimg-block"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
| 243 | - } |
|
| 244 | - else if ($use_old_wpimg != 'on') { |
|
| 243 | + } else if ($use_old_wpimg != 'on') { |
|
| 245 | 244 | return '<figure data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
| 246 | 245 | } else { |
| 247 | 246 | return '<figure data-component-type="wpimg" data-linkoption="img" class="lasso--wpimg__wrap lasso-component"><img src="'.LASSO_URL.'/public/assets/img/empty-img.png"></figure><p><br></p>'; |
@@ -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 | |
@@ -46,11 +47,12 @@ discard block |
||
| 46 | 47 | |
| 47 | 48 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
| 48 | 49 | |
| 49 | - if ( $q->have_posts() ) |
|
| 50 | - return true; |
|
| 51 | - else |
|
| 52 | - return false; |
|
| 53 | -} |
|
| 50 | + if ( $q->have_posts() ) { |
|
| 51 | + return true; |
|
| 52 | + } else { |
|
| 53 | + return false; |
|
| 54 | + } |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | /** |
| 56 | 58 | * Return a CSS class of an automatically supported theme |
@@ -196,8 +198,9 @@ discard block |
||
| 196 | 198 | */ |
| 197 | 199 | function lasso_get_post_objects( $postid, $taxonomy) { |
| 198 | 200 | |
| 199 | - if ( empty( $postid ) ) |
|
| 200 | - $postid = get_the_ID(); |
|
| 201 | + if ( empty( $postid ) ) { |
|
| 202 | + $postid = get_the_ID(); |
|
| 203 | + } |
|
| 201 | 204 | |
| 202 | 205 | if ('category' == $taxonomy) { |
| 203 | 206 | $objects = get_the_category( $postid ); |
@@ -207,8 +210,9 @@ discard block |
||
| 207 | 210 | $objects = get_the_terms( $postid, $taxonomy ); |
| 208 | 211 | } |
| 209 | 212 | |
| 210 | - if ( empty( $objects) ) |
|
| 211 | - return; |
|
| 213 | + if ( empty( $objects) ) { |
|
| 214 | + return; |
|
| 215 | + } |
|
| 212 | 216 | |
| 213 | 217 | $out = ''; |
| 214 | 218 | foreach( $objects as $object ) { |
@@ -238,8 +242,9 @@ discard block |
||
| 238 | 242 | )); |
| 239 | 243 | } |
| 240 | 244 | |
| 241 | - if ( empty( $objects) ) |
|
| 242 | - return; |
|
| 245 | + if ( empty( $objects) ) { |
|
| 246 | + return; |
|
| 247 | + } |
|
| 243 | 248 | |
| 244 | 249 | $out = ""; |
| 245 | 250 | foreach( $objects as $object ) { |
@@ -361,8 +366,9 @@ discard block |
||
| 361 | 366 | */ |
| 362 | 367 | function lasso_clean_string( $string = '' ) { |
| 363 | 368 | |
| 364 | - if ( empty( $string ) ) |
|
| 365 | - return; |
|
| 369 | + if ( empty( $string ) ) { |
|
| 370 | + return; |
|
| 371 | + } |
|
| 366 | 372 | |
| 367 | 373 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
| 368 | 374 | } |
@@ -401,11 +407,13 @@ discard block |
||
| 401 | 407 | if ( !function_exists( 'lasso_user_can' ) ): |
| 402 | 408 | function lasso_user_can( $action = '', $postid = 0 ) { |
| 403 | 409 | $result = false; |
| 404 | - if ( empty( $action ) ) |
|
| 405 | - $action = 'edit_posts'; |
|
| 410 | + if ( empty( $action ) ) { |
|
| 411 | + $action = 'edit_posts'; |
|
| 412 | + } |
|
| 406 | 413 | |
| 407 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
| 408 | - $postid = get_the_ID(); |
|
| 414 | + if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') { |
|
| 415 | + $postid = get_the_ID(); |
|
| 416 | + } |
|
| 409 | 417 | |
| 410 | 418 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
| 411 | 419 | // check against post types: |