Passed
Push — master ( 51c804...1c8cf7 )
by Brian
05:30
created
vendor/ayecode/wp-super-duper/wp-super-duper.php 1 patch
Braces   +48 added lines, -50 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             if(!empty($this->options['nested-block'])){
61 61
                 if(empty($this->options['output_types'])){
62 62
                     $this->options['output_types'] = array('shortcode','block');
63
-                }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
63
+                } elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64 64
                     unset($this->options['output_types'][$key]);
65 65
                 }
66 66
             }
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 				<?php
700 700
 				if(! empty( $insert_shortcode_function )){
701 701
 					echo $insert_shortcode_function;
702
-				}else{
702
+				} else{
703 703
 
704 704
 				/**
705 705
 				 * Function for super duper insert shortcode.
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
                     var InnerBlocks = blockEditor.InnerBlocks;
2133 2133
 
2134 2134
 					var term_query_type = '';
2135
-					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>;
2135
+					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";} else{echo "[]";} ?>;
2136 2136
 					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2137 2137
 					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
2138 2138
                     const MediaUpload = wp.blockEditor.MediaUpload;
@@ -2251,8 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 
2252 2252
 								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253 2253
 									continue;
2254
-								}
2255
-								elseif ( $args['type'] == 'checkbox' ) {
2254
+								} elseif ( $args['type'] == 'checkbox' ) {
2256 2255
 									$type    = 'boolean';
2257 2256
 									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258 2257
 								} elseif ( $args['type'] == 'number' ) {
@@ -2380,7 +2379,7 @@  discard block
 block discarded – undo
2380 2379
                             <?php
2381 2380
                             if(!empty($this->options['block-edit-raw'])) {
2382 2381
                                 echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2383
-                            }else{
2382
+                            } else{
2384 2383
                             ?>
2385 2384
 
2386 2385
 function hasSelectedInnerBlock(props) {
@@ -2421,7 +2420,7 @@  discard block
 block discarded – undo
2421 2420
 
2422 2421
 								// taxonomies
2423 2422
 								if( $value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run ){
2424
-									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];}else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
2423
+									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];} else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
2425 2424
 										while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
2426 2425
 										taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
2427 2426
 									}
@@ -2470,7 +2469,7 @@  discard block
 block discarded – undo
2470 2469
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2471 2470
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2472 2471
 	echo 'const { deviceType } = "";';
2473
-}else{
2472
+} else{
2474 2473
 ?>
2475 2474
 /** Get device type const. */
2476 2475
 const { deviceType } = wp.data.useSelect != 'undefined' ?  wp.data.useSelect(select => {
@@ -2504,7 +2503,7 @@  discard block
 block discarded – undo
2504 2503
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2505 2504
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2506 2505
 										echo $post->ID;
2507
-									}else{echo '0';}?>,
2506
+									} else{echo '0';}?>,
2508 2507
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2509 2508
 									};
2510 2509
 
@@ -2524,7 +2523,7 @@  discard block
 block discarded – undo
2524 2523
 										is_fetching = false;
2525 2524
 										prev_attributes[props.clientId] = props.attributes;
2526 2525
                                              <?php
2527
-                                        }else{
2526
+                                        } else{
2528 2527
                                         ?>
2529 2528
                                        props.setAttributes({content: env});
2530 2529
 										is_fetching = false;
@@ -2703,7 +2702,7 @@  discard block
 block discarded – undo
2703 2702
 //
2704 2703
 
2705 2704
 									}
2706
-									}else {
2705
+									} else {
2707 2706
 									?>
2708 2707
 									el(wp.components.PanelBody, {
2709 2708
 											title: '<?php esc_attr_e( "Settings" ); ?>',
@@ -2729,9 +2728,9 @@  discard block
 block discarded – undo
2729 2728
 								// If the user sets block-output array then build it
2730 2729
 								if ( ! empty( $this->options['block-output'] ) ) {
2731 2730
 								$this->block_element( $this->options['block-output'] );
2732
-							}elseif(!empty($this->options['block-edit-return'])){
2731
+							} elseif(!empty($this->options['block-edit-return'])){
2733 2732
                                    echo $this->options['block-edit-return'];
2734
-							}else{
2733
+							} else{
2735 2734
 								// if no block-output is set then we try and get the shortcode html output via ajax.
2736 2735
 								?>
2737 2736
 								el('div', wp.blockEditor.useBlockProps({
@@ -2835,9 +2834,9 @@  discard block
 block discarded – undo
2835 2834
                                );
2836 2835
                                 <?php
2837 2836
 
2838
-							}elseif(!empty($this->options['block-save-return'])){
2837
+							} elseif(!empty($this->options['block-save-return'])){
2839 2838
                                    echo 'return ' . $this->options['block-save-return'];
2840
-							}elseif(!empty($this->options['nested-block'])){
2839
+							} elseif(!empty($this->options['nested-block'])){
2841 2840
                                 ?>
2842 2841
                               return el(
2843 2842
                                    '',
@@ -2847,13 +2846,13 @@  discard block
 block discarded – undo
2847 2846
                                    el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2848 2847
                                );
2849 2848
                                 <?php
2850
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2849
+							} elseif(!empty( $this->options['block-save-return'] ) ){
2851 2850
                                 echo "return ". $this->options['block-edit-return'].";";
2852
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2851
+							} elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853 2852
 							?>
2854 2853
 							return content;
2855 2854
 							<?php
2856
-							}else{
2855
+							} else{
2857 2856
 							?>
2858 2857
 							var block_wrap = 'div';
2859 2858
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -2904,9 +2903,9 @@  discard block
 block discarded – undo
2904 2903
                 $device_type_icon = '';
2905 2904
                 if($device_type=='Desktop'){
2906 2905
                     $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;"></span>';
2907
-                }elseif($device_type=='Tablet'){
2906
+                } elseif($device_type=='Tablet'){
2908 2907
                     $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;"></span>';
2909
-                }elseif($device_type=='Mobile'){
2908
+                } elseif($device_type=='Mobile'){
2910 2909
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;"></span>';
2911 2910
                 }
2912 2911
 				echo $element_require;
@@ -2951,7 +2950,7 @@  discard block
 block discarded – undo
2951 2950
 
2952 2951
 					<?php
2953 2952
 					if(false){?></script><?php }
2954
-				}elseif(!empty($args['row']['close'])){
2953
+				} elseif(!empty($args['row']['close'])){
2955 2954
 					if(false){?><script><?php }?>
2956 2955
 						el(
2957 2956
 							'div',
@@ -2960,7 +2959,7 @@  discard block
 block discarded – undo
2960 2959
 							},
2961 2960
 					<?php
2962 2961
 					if(false){?></script><?php }
2963
-				}else{
2962
+				} else{
2964 2963
 					if(false){?><script><?php }?>
2965 2964
 						el(
2966 2965
 							'div',
@@ -3068,9 +3067,9 @@  discard block
 block discarded – undo
3068 3067
             $device_type_icon = '';
3069 3068
             if($device_type=='Desktop'){
3070 3069
                 $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3071
-            }elseif($device_type=='Tablet'){
3070
+            } elseif($device_type=='Tablet'){
3072 3071
                 $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3073
-            }elseif($device_type=='Mobile'){
3072
+            } elseif($device_type=='Mobile'){
3074 3073
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3075 3074
             }
3076 3075
 
@@ -3104,12 +3103,12 @@  discard block
 block discarded – undo
3104 3103
 				if ( $args['type'] == 'number' ) {
3105 3104
 					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3106 3105
 				}
3107
-			}else if ( $args['type'] == 'styleid' ) {
3106
+			} else if ( $args['type'] == 'styleid' ) {
3108 3107
 				$type = 'TextControl';
3109 3108
 				$args['type'] == 'text';
3110 3109
 				// Save numbers as numbers and not strings
3111 3110
 				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3112
-			}else if ( $args['type'] == 'notice' ) {
3111
+			} else if ( $args['type'] == 'notice' ) {
3113 3112
 
3114 3113
 				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3115 3114
 				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
@@ -3184,10 +3183,10 @@  discard block
 block discarded – undo
3184 3183
                             $key: value
3185 3184
                         });
3186 3185
                     },";
3187
-			}elseif ( $args['type'] == 'gradient' ) {
3186
+			} elseif ( $args['type'] == 'gradient' ) {
3188 3187
 				$type = 'GradientPicker';
3189 3188
 
3190
-			}elseif ( $args['type'] == 'image' ) {
3189
+			} elseif ( $args['type'] == 'image' ) {
3191 3190
 //                print_r($args);
3192 3191
 
3193 3192
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3249,7 +3248,7 @@  discard block
 block discarded – undo
3249 3248
                 $onchange = "";
3250 3249
 
3251 3250
                 //$inside_elements = ",el('div',{},'file upload')";
3252
-			}elseif ( $args['type'] == 'images' ) {
3251
+			} elseif ( $args['type'] == 'images' ) {
3253 3252
 				//                print_r($args);
3254 3253
 
3255 3254
                 $img_preview = "props.attributes.$key && (function() {
@@ -3334,8 +3333,7 @@  discard block
 block discarded – undo
3334 3333
                 $onchange = "";
3335 3334
 
3336 3335
                 //$inside_elements = ",el('div',{},'file upload')";
3337
-			}
3338
-			elseif ( $args['type'] == 'checkbox' ) {
3336
+			} elseif ( $args['type'] == 'checkbox' ) {
3339 3337
 				$type = 'CheckboxControl';
3340 3338
 				$extra .= "checked: props.attributes.$key,";
3341 3339
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
@@ -3346,9 +3344,9 @@  discard block
 block discarded – undo
3346 3344
 
3347 3345
 				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3348 3346
 					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3349
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3347
+				} elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3350 3348
 					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3351
-				}else {
3349
+				} else {
3352 3350
 
3353 3351
 					if ( ! empty( $args['options'] ) ) {
3354 3352
 						$options .= "options: [";
@@ -3398,7 +3396,7 @@  discard block
 block discarded – undo
3398 3396
 
3399 3397
 			} elseif ( $args['type'] == 'alignment' ) {
3400 3398
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3401
-			}elseif ( $args['type'] == 'margins' ) {
3399
+			} elseif ( $args['type'] == 'margins' ) {
3402 3400
 
3403 3401
 			} else {
3404 3402
 				return;// if we have not implemented the control then don't break the JS.
@@ -3428,7 +3426,7 @@  discard block
 block discarded – undo
3428 3426
 			label: <?php
3429 3427
 			if(empty($args['title'])){
3430 3428
                 echo "''";
3431
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3429
+			} elseif(empty($args['row']) && !empty($args['device_type'])){
3432 3430
                 ?>el('label', {
3433 3431
 									className: 'components-base-control__label',
3434 3432
 									style: {width:"100%"}
@@ -3443,7 +3441,7 @@  discard block
 block discarded – undo
3443 3441
 
3444 3442
 							)<?php
3445 3443
 
3446
-			}else{
3444
+			} else{
3447 3445
                  ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3448 3446
 
3449 3447
 			}
@@ -3451,7 +3449,7 @@  discard block
 block discarded – undo
3451 3449
 			?>,
3452 3450
 			help: <?php if ( isset( $args['desc'] ) ) {
3453 3451
 				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3454
-			}else{ echo "''"; } ?>,
3452
+			} else{ echo "''"; } ?>,
3455 3453
 			value: <?php echo $value; ?>,
3456 3454
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3457 3455
 				echo "type: '" . addslashes( $args['type'] ) . "',";
@@ -3491,7 +3489,7 @@  discard block
 block discarded – undo
3491 3489
 				foreach ( $custom_attributes as $key => $val ) {
3492 3490
 					if(is_array($val)){
3493 3491
 						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3494
-					}else{
3492
+					} else{
3495 3493
 						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3496 3494
 					}
3497 3495
 				}
@@ -3531,7 +3529,7 @@  discard block
 block discarded – undo
3531 3529
 
3532 3530
                             if($new_args['element']=='InnerBlocks'){
3533 3531
                                 echo "\n el( InnerBlocks, {";
3534
-                            }elseif($new_args['element']=='innerBlocksProps'){
3532
+                            } elseif($new_args['element']=='innerBlocksProps'){
3535 3533
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3536 3534
                               //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3537 3535
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
@@ -3544,11 +3542,11 @@  discard block
 block discarded – undo
3544 3542
                             //    echo '###';
3545 3543
 
3546 3544
                               //  echo '###';
3547
-                            }elseif($new_args['element']=='BlocksProps'){
3545
+                            } elseif($new_args['element']=='BlocksProps'){
3548 3546
 
3549 3547
 								if ( isset($new_args['if_inner_element']) ) {
3550 3548
 									$element = $new_args['if_inner_element'];
3551
-								}else {
3549
+								} else {
3552 3550
 									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3553 3551
 								}
3554 3552
 
@@ -3559,7 +3557,7 @@  discard block
 block discarded – undo
3559 3557
 
3560 3558
                                // echo "} ),";
3561 3559
 
3562
-                            }else{
3560
+                            } else{
3563 3561
                                 echo "\n el( '" . $new_args['element'] . "', {";
3564 3562
                             }
3565 3563
 
@@ -3584,7 +3582,7 @@  discard block
 block discarded – undo
3584 3582
 
3585 3583
 									if ( $new_key === 'content' ) {
3586 3584
 										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3587
-									}else if ( $new_key === 'if_content' ) {
3585
+									} else if ( $new_key === 'if_content' ) {
3588 3586
 										echo  $this->block_props_replace(  $new_value  );
3589 3587
 									}
3590 3588
 
@@ -3614,7 +3612,7 @@  discard block
 block discarded – undo
3614 3612
 
3615 3613
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3616 3614
                                 echo "))";// end content
3617
-                            }else{
3615
+                            } else{
3618 3616
                                 echo ")";// end content
3619 3617
                             }
3620 3618
 
@@ -3900,7 +3898,7 @@  discard block
 block discarded – undo
3900 3898
 
3901 3899
 				if(empty($instance['widget_title_tag'])){
3902 3900
 					$output = $args['before_title'] . $title . $args['after_title'];
3903
-				}else{
3901
+				} else{
3904 3902
 					$title_tag = esc_attr( $instance['widget_title_tag'] );
3905 3903
 
3906 3904
 					// classes
@@ -4005,9 +4003,9 @@  discard block
 block discarded – undo
4005 4003
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4006 4004
 					<div class='col pr-2'>
4007 4005
 					<?php
4008
-				}elseif(!empty($args['row']['close'])){
4006
+				} elseif(!empty($args['row']['close'])){
4009 4007
 					echo "<div class='col pl-0'>";
4010
-				}else{
4008
+				} else{
4011 4009
 					echo "<div class='col pl-0 pr-2'>";
4012 4010
 				}
4013 4011
 			}
@@ -4225,11 +4223,11 @@  discard block
 block discarded – undo
4225 4223
 		public function get_widget_icon($icon = 'box-top', $title = ''){
4226 4224
 			if($icon=='box-top'){
4227 4225
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4228
-			}elseif($icon=='box-right'){
4226
+			} elseif($icon=='box-right'){
4229 4227
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4230
-			}elseif($icon=='box-bottom'){
4228
+			} elseif($icon=='box-bottom'){
4231 4229
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4232
-			}elseif($icon=='box-left'){
4230
+			} elseif($icon=='box-left'){
4233 4231
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4234 4232
 			}
4235 4233
 		}
Please login to merge, or discard this patch.