@@ -19,12 +19,18 @@ |
||
| 19 | 19 | |
| 20 | 20 | <?php if ( ! empty( $logo_width ) && ! empty( $logo_height ) ) : ?> |
| 21 | 21 | <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> |
| 22 | - <?php else: ?> |
|
| 23 | - <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> |
|
| 22 | + <?php else { |
|
| 23 | + : ?> |
|
| 24 | + <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); |
|
| 25 | +} |
|
| 26 | +?>"> |
|
| 24 | 27 | <?php endif; ?> |
| 25 | 28 | |
| 26 | - <?php else: ?> |
|
| 27 | - <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
| 29 | + <?php else { |
|
| 30 | + : ?> |
|
| 31 | + <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); |
|
| 32 | +} |
|
| 33 | +?></h1> |
|
| 28 | 34 | <?php endif; ?> |
| 29 | 35 | |
| 30 | 36 | </a> |
@@ -126,8 +126,12 @@ discard block |
||
| 126 | 126 | public function constants(){ |
| 127 | 127 | define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be"); |
| 128 | 128 | define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d'); |
| 129 | - if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
|
| 130 | - if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL); |
|
| 129 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
| 130 | + define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
|
| 131 | + } |
|
| 132 | + if (!defined('AUI_SECONDARY_COLOR')) { |
|
| 133 | + define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL); |
|
| 134 | + } |
|
| 131 | 135 | } |
| 132 | 136 | |
| 133 | 137 | /** |
@@ -233,7 +237,7 @@ discard block |
||
| 233 | 237 | |
| 234 | 238 | if( is_admin() && !$this->is_aui_screen()){ |
| 235 | 239 | // don't add wp-admin scripts if not requested to |
| 236 | - }else{ |
|
| 240 | + } else{ |
|
| 237 | 241 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
| 238 | 242 | |
| 239 | 243 | $rtl = is_rtl() ? '-rtl' : ''; |
@@ -1051,7 +1055,7 @@ discard block |
||
| 1051 | 1055 | |
| 1052 | 1056 | if( is_admin() && !$this->is_aui_screen()){ |
| 1053 | 1057 | // don't add wp-admin scripts if not requested to |
| 1054 | - }else { |
|
| 1058 | + } else { |
|
| 1055 | 1059 | |
| 1056 | 1060 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
| 1057 | 1061 | |
@@ -2093,7 +2097,9 @@ discard block |
||
| 2093 | 2097 | * @return mixed |
| 2094 | 2098 | */ |
| 2095 | 2099 | public static function minify_js($input) { |
| 2096 | - if(trim($input) === "") return $input; |
|
| 2100 | + if(trim($input) === "") { |
|
| 2101 | + return $input; |
|
| 2102 | + } |
|
| 2097 | 2103 | return preg_replace( |
| 2098 | 2104 | array( |
| 2099 | 2105 | // Remove comment(s) |
@@ -2125,7 +2131,9 @@ discard block |
||
| 2125 | 2131 | * @return mixed |
| 2126 | 2132 | */ |
| 2127 | 2133 | public static function minify_css($input) { |
| 2128 | - if(trim($input) === "") return $input; |
|
| 2134 | + if(trim($input) === "") { |
|
| 2135 | + return $input; |
|
| 2136 | + } |
|
| 2129 | 2137 | return preg_replace( |
| 2130 | 2138 | array( |
| 2131 | 2139 | // Remove comment(s) |
@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if($section_id=='recommended_plugins'){ |
| 47 | 47 | $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
| 48 | - } |
|
| 49 | - elseif ( ! empty( $section ) ) { |
|
| 48 | + } elseif ( ! empty( $section ) ) { |
|
| 50 | 49 | if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
| 51 | 50 | //if ( 1==1) { |
| 52 | 51 | |
@@ -119,14 +118,14 @@ discard block |
||
| 119 | 118 | $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
| 120 | 119 | $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
| 121 | 120 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
| 122 | - }elseif( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){ |
|
| 121 | + } elseif( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){ |
|
| 123 | 122 | include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
| 124 | 123 | if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
| 125 | 124 | $status = self::install_plugin_install_status($addon); |
| 126 | 125 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
| 127 | 126 | if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
| 128 | 127 | $button_args['update_url'] = "https://wpinvoicing.com"; |
| 129 | - }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 128 | + } elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 130 | 129 | if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
| 131 | 130 | $button_args['installed'] = self::is_theme_installed($addon); |
| 132 | 131 | if(!in_array($button_args['slug'],$wp_org_themes)){ |
@@ -139,7 +138,7 @@ discard block |
||
| 139 | 138 | if(is_object($addon->pricing)){ |
| 140 | 139 | $prices = (Array)$addon->pricing; |
| 141 | 140 | $button_args['price'] = reset($prices); |
| 142 | - }elseif(isset($addon->pricing)){ |
|
| 141 | + } elseif(isset($addon->pricing)){ |
|
| 143 | 142 | $button_args['price'] = $addon->pricing; |
| 144 | 143 | } |
| 145 | 144 | } |
@@ -160,7 +159,7 @@ discard block |
||
| 160 | 159 | if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){ |
| 161 | 160 | if($button_args['type'] != 'themes'){ |
| 162 | 161 | $button_args['active'] = is_plugin_active($button_args['file']); |
| 163 | - }else{ |
|
| 162 | + } else{ |
|
| 164 | 163 | $button_args['active'] = self::is_theme_active($addon); |
| 165 | 164 | } |
| 166 | 165 | } |
@@ -169,27 +168,27 @@ discard block |
||
| 169 | 168 | if($button_args['active']){ |
| 170 | 169 | $button_args['button_text'] = __('Active','invoicing'); |
| 171 | 170 | $button_args['class'] = ' button-secondary disabled '; |
| 172 | - }elseif($button_args['installed']){ |
|
| 171 | + } elseif($button_args['installed']){ |
|
| 173 | 172 | $button_args['button_text'] = __('Activate','invoicing'); |
| 174 | 173 | |
| 175 | 174 | if($button_args['type'] != 'themes'){ |
| 176 | 175 | if ( current_user_can( 'manage_options' ) ) { |
| 177 | 176 | $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']); |
| 178 | - }else{ |
|
| 177 | + } else{ |
|
| 179 | 178 | $button_args['url'] = '#'; |
| 180 | 179 | } |
| 181 | - }else{ |
|
| 180 | + } else{ |
|
| 182 | 181 | if ( current_user_can( 'switch_themes' ) ) { |
| 183 | 182 | $button_args['url'] = self::get_theme_activation_url($addon); |
| 184 | - }else{ |
|
| 183 | + } else{ |
|
| 185 | 184 | $button_args['url'] = '#'; |
| 186 | 185 | } |
| 187 | 186 | } |
| 188 | 187 | |
| 189 | - }else{ |
|
| 188 | + } else{ |
|
| 190 | 189 | if($button_args['type'] == 'recommended_plugins'){ |
| 191 | 190 | $button_args['button_text'] = __('Install','invoicing'); |
| 192 | - }else{ |
|
| 191 | + } else{ |
|
| 193 | 192 | $button_args['button_text'] = __('Get it','invoicing'); |
| 194 | 193 | |
| 195 | 194 | /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
@@ -55,9 +55,12 @@ |
||
| 55 | 55 | </li> |
| 56 | 56 | <?php endforeach; ?> |
| 57 | 57 | </ol> |
| 58 | - <?php else: ?> |
|
| 58 | + <?php else { |
|
| 59 | + : ?> |
|
| 59 | 60 | <div class='mb-3'> </div> |
| 60 | - <?php endif; ?> |
|
| 61 | + <?php endif; |
|
| 62 | +} |
|
| 63 | +?> |
|
| 61 | 64 | |
| 62 | 65 | <div class="text-center pb-3 mt-5"> |
| 63 | 66 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
@@ -36,8 +36,11 @@ |
||
| 36 | 36 | 'getpaid-nonce' |
| 37 | 37 | ); ?>" |
| 38 | 38 | class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a> |
| 39 | - <?php else: ?> |
|
| 40 | - <span class="btn btn-sm btn-success"><?php _e( 'Connected', 'invoicing' ); ?></span> |
|
| 39 | + <?php else { |
|
| 40 | + : ?> |
|
| 41 | + <span class="btn btn-sm btn-success"><?php _e( 'Connected', 'invoicing' ); |
|
| 42 | +} |
|
| 43 | +?></span> |
|
| 41 | 44 | <?php endif; ?> |
| 42 | 45 | </li> |
| 43 | 46 | |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | <?php |
| 662 | 662 | if(! empty( $insert_shortcode_function )){ |
| 663 | 663 | echo $insert_shortcode_function; |
| 664 | - }else{ |
|
| 664 | + } else{ |
|
| 665 | 665 | |
| 666 | 666 | /** |
| 667 | 667 | * Function for super duper insert shortcode. |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | var prev_attributes = []; |
| 1654 | 1654 | |
| 1655 | 1655 | var term_query_type = ''; |
| 1656 | - 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 "[]";} ?>; |
|
| 1656 | + 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 "[]";} ?>; |
|
| 1657 | 1657 | const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
| 1658 | 1658 | const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
| 1659 | 1659 | |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | |
| 1791 | 1791 | // taxonomies |
| 1792 | 1792 | if( $value && 'post_type' in prev_attributes[props.id] && 'category' in prev_attributes[props.id] && run ){ |
| 1793 | - 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 => { |
|
| 1793 | + 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 => { |
|
| 1794 | 1794 | while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
| 1795 | 1795 | taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
| 1796 | 1796 | } |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | 'attributes': props.attributes, |
| 1861 | 1861 | 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
| 1862 | 1862 | echo $post->ID; |
| 1863 | - }else{echo '0';}?>, |
|
| 1863 | + } else{echo '0';}?>, |
|
| 1864 | 1864 | '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
| 1865 | 1865 | }; |
| 1866 | 1866 | |
@@ -1969,7 +1969,7 @@ discard block |
||
| 1969 | 1969 | $panel_count ++; |
| 1970 | 1970 | |
| 1971 | 1971 | } |
| 1972 | - }else { |
|
| 1972 | + } else { |
|
| 1973 | 1973 | ?> |
| 1974 | 1974 | el(wp.components.PanelBody, { |
| 1975 | 1975 | title: '<?php esc_attr_e( "Settings" ); ?>', |
@@ -1995,7 +1995,7 @@ discard block |
||
| 1995 | 1995 | // If the user sets block-output array then build it |
| 1996 | 1996 | if ( ! empty( $this->options['block-output'] ) ) { |
| 1997 | 1997 | $this->block_element( $this->options['block-output'] ); |
| 1998 | - }else{ |
|
| 1998 | + } else{ |
|
| 1999 | 1999 | // if no block-output is set then we try and get the shortcode html output via ajax. |
| 2000 | 2000 | ?> |
| 2001 | 2001 | el('div', { |
@@ -2065,7 +2065,7 @@ discard block |
||
| 2065 | 2065 | ?> |
| 2066 | 2066 | return content; |
| 2067 | 2067 | <?php |
| 2068 | - }else{ |
|
| 2068 | + } else{ |
|
| 2069 | 2069 | ?> |
| 2070 | 2070 | var block_wrap = 'div'; |
| 2071 | 2071 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -2136,7 +2136,7 @@ discard block |
||
| 2136 | 2136 | |
| 2137 | 2137 | <?php |
| 2138 | 2138 | if(false){?></script><?php } |
| 2139 | - }elseif(!empty($args['row']['close'])){ |
|
| 2139 | + } elseif(!empty($args['row']['close'])){ |
|
| 2140 | 2140 | if(false){?><script><?php }?> |
| 2141 | 2141 | el( |
| 2142 | 2142 | 'div', |
@@ -2145,7 +2145,7 @@ discard block |
||
| 2145 | 2145 | }, |
| 2146 | 2146 | <?php |
| 2147 | 2147 | if(false){?></script><?php } |
| 2148 | - }else{ |
|
| 2148 | + } else{ |
|
| 2149 | 2149 | if(false){?><script><?php }?> |
| 2150 | 2150 | el( |
| 2151 | 2151 | 'div', |
@@ -2262,8 +2262,7 @@ discard block |
||
| 2262 | 2262 | $key: value |
| 2263 | 2263 | }); |
| 2264 | 2264 | },"; |
| 2265 | - } |
|
| 2266 | - elseif ( $args['type'] == 'checkbox' ) { |
|
| 2265 | + } elseif ( $args['type'] == 'checkbox' ) { |
|
| 2267 | 2266 | $type = 'CheckboxControl'; |
| 2268 | 2267 | $extra .= "checked: props.attributes.$key,"; |
| 2269 | 2268 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
@@ -2274,9 +2273,9 @@ discard block |
||
| 2274 | 2273 | |
| 2275 | 2274 | if($args['name'] == 'category' && !empty($args['post_type_linked'])){ |
| 2276 | 2275 | $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; |
| 2277 | - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
| 2276 | + } elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
| 2278 | 2277 | $options .= "options: sort_by_".str_replace("-","_", $this->id).","; |
| 2279 | - }else { |
|
| 2278 | + } else { |
|
| 2280 | 2279 | |
| 2281 | 2280 | if ( ! empty( $args['options'] ) ) { |
| 2282 | 2281 | $options .= "options: ["; |
@@ -2291,7 +2290,7 @@ discard block |
||
| 2291 | 2290 | } |
| 2292 | 2291 | } elseif ( $args['type'] == 'alignment' ) { |
| 2293 | 2292 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
| 2294 | - }elseif ( $args['type'] == 'margins' ) { |
|
| 2293 | + } elseif ( $args['type'] == 'margins' ) { |
|
| 2295 | 2294 | |
| 2296 | 2295 | } else { |
| 2297 | 2296 | return;// if we have not implemented the control then don't break the JS. |
@@ -2711,7 +2710,7 @@ discard block |
||
| 2711 | 2710 | |
| 2712 | 2711 | if(empty($instance['widget_title_tag'])){ |
| 2713 | 2712 | $output = $args['before_title'] . $title . $args['after_title']; |
| 2714 | - }else{ |
|
| 2713 | + } else{ |
|
| 2715 | 2714 | $title_tag = esc_attr( $instance['widget_title_tag'] ); |
| 2716 | 2715 | |
| 2717 | 2716 | // classes |
@@ -2816,9 +2815,9 @@ discard block |
||
| 2816 | 2815 | <div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'> |
| 2817 | 2816 | <div class='col pr-2'> |
| 2818 | 2817 | <?php |
| 2819 | - }elseif(!empty($args['row']['close'])){ |
|
| 2818 | + } elseif(!empty($args['row']['close'])){ |
|
| 2820 | 2819 | echo "<div class='col pl-0'>"; |
| 2821 | - }else{ |
|
| 2820 | + } else{ |
|
| 2822 | 2821 | echo "<div class='col pl-0 pr-2'>"; |
| 2823 | 2822 | } |
| 2824 | 2823 | } |
@@ -3036,11 +3035,11 @@ discard block |
||
| 3036 | 3035 | public function get_widget_icon($icon = 'box-top', $title = ''){ |
| 3037 | 3036 | if($icon=='box-top'){ |
| 3038 | 3037 | 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>'; |
| 3039 | - }elseif($icon=='box-right'){ |
|
| 3038 | + } elseif($icon=='box-right'){ |
|
| 3040 | 3039 | 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>'; |
| 3041 | - }elseif($icon=='box-bottom'){ |
|
| 3040 | + } elseif($icon=='box-bottom'){ |
|
| 3042 | 3041 | 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>'; |
| 3043 | - }elseif($icon=='box-left'){ |
|
| 3042 | + } elseif($icon=='box-left'){ |
|
| 3044 | 3043 | 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>'; |
| 3045 | 3044 | } |
| 3046 | 3045 | } |
@@ -436,7 +436,7 @@ |
||
| 436 | 436 | |
| 437 | 437 | if ( is_admin() && $pagenow && in_array($pagenow, $block_widget_init_screens)) { |
| 438 | 438 | // don't initiate in these conditions. |
| 439 | - }else{ |
|
| 439 | + } else{ |
|
| 440 | 440 | |
| 441 | 441 | // Only load allowed widgets. |
| 442 | 442 | $exclude = function_exists( 'sd_widget_exclude' ) ? sd_widget_exclude() : array(); |
@@ -156,7 +156,9 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | function parse($data) { |
| 158 | 158 | |
| 159 | - if ( ! $this->is_active_addon($data['import']->options['custom_type'])) return false; |
|
| 159 | + if ( ! $this->is_active_addon($data['import']->options['custom_type'])) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 160 | 162 | |
| 161 | 163 | $parsedData = $this->helper_parse($data, $this->options_array()); |
| 162 | 164 | return $parsedData; |
@@ -177,8 +179,7 @@ discard block |
||
| 177 | 179 | if ($field['type'] == 'accordion') |
| 178 | 180 | { |
| 179 | 181 | $this->fields[$value['slug']]['is_sub_field'] = true; |
| 180 | - } |
|
| 181 | - else |
|
| 182 | + } else |
|
| 182 | 183 | { |
| 183 | 184 | foreach ($value as $n => $param) { |
| 184 | 185 | if (is_array($param) and ! empty($this->fields[$param['slug']])){ |
@@ -242,7 +243,9 @@ discard block |
||
| 242 | 243 | if ( ! empty( $this->fields ) ) { |
| 243 | 244 | |
| 244 | 245 | foreach ($this->fields as $field_slug => $field_params) { |
| 245 | - if (in_array($field_params['type'], array('title', 'plain_text', 'acf'))) continue; |
|
| 246 | + if (in_array($field_params['type'], array('title', 'plain_text', 'acf'))) { |
|
| 247 | + continue; |
|
| 248 | + } |
|
| 246 | 249 | $default_value = ''; |
| 247 | 250 | if (!empty($field_params['enum_values'])){ |
| 248 | 251 | foreach ($field_params['enum_values'] as $key => $value) { |
@@ -310,8 +313,9 @@ discard block |
||
| 310 | 313 | |
| 311 | 314 | function post_saved( $importData ){ |
| 312 | 315 | |
| 313 | - if (is_callable($this->post_saved_function)) |
|
| 314 | - call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']); |
|
| 316 | + if (is_callable($this->post_saved_function)) { |
|
| 317 | + call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']); |
|
| 318 | + } |
|
| 315 | 319 | |
| 316 | 320 | } |
| 317 | 321 | |
@@ -336,7 +340,9 @@ discard block |
||
| 336 | 340 | $data = array(); |
| 337 | 341 | if (!empty($this->fields)){ |
| 338 | 342 | foreach ($this->fields as $field_slug => $field_params) { |
| 339 | - if (in_array($field_params['type'], array('title', 'plain_text'))) continue; |
|
| 343 | + if (in_array($field_params['type'], array('title', 'plain_text'))) { |
|
| 344 | + continue; |
|
| 345 | + } |
|
| 340 | 346 | switch ($field_params['type']) { |
| 341 | 347 | |
| 342 | 348 | case 'image': |
@@ -421,7 +427,9 @@ discard block |
||
| 421 | 427 | $visible_fields = 0; |
| 422 | 428 | |
| 423 | 429 | foreach ($this->fields as $field_slug => $field_params) { |
| 424 | - if ($field_params['is_sub_field']) continue; |
|
| 430 | + if ($field_params['is_sub_field']) { |
|
| 431 | + continue; |
|
| 432 | + } |
|
| 425 | 433 | $visible_fields++; |
| 426 | 434 | } |
| 427 | 435 | |
@@ -430,7 +438,9 @@ discard block |
||
| 430 | 438 | foreach ($this->fields as $field_slug => $field_params) { |
| 431 | 439 | |
| 432 | 440 | // do not render sub fields |
| 433 | - if ($field_params['is_sub_field']) continue; |
|
| 441 | + if ($field_params['is_sub_field']) { |
|
| 442 | + continue; |
|
| 443 | + } |
|
| 434 | 444 | |
| 435 | 445 | $counter++; |
| 436 | 446 | |
@@ -561,7 +571,9 @@ discard block |
||
| 561 | 571 | $fieldData['id'] = $field_params['field_obj']->ID; |
| 562 | 572 | $fieldData['label'] = $field_params['field_obj']->post_title; |
| 563 | 573 | $fieldData['key'] = $field_params['field_obj']->post_name; |
| 564 | - if (empty($fieldData['name'])) $fieldData['name'] = $field_params['field_obj']->post_excerpt; |
|
| 574 | + if (empty($fieldData['name'])) { |
|
| 575 | + $fieldData['name'] = $field_params['field_obj']->post_excerpt; |
|
| 576 | + } |
|
| 565 | 577 | if (function_exists('pmai_render_field')) { |
| 566 | 578 | echo pmai_render_field($fieldData, ( ! empty($current_values) ) ? $current_values : array() ); |
| 567 | 579 | } |
@@ -573,9 +585,12 @@ discard block |
||
| 573 | 585 | } else if($field_params['type'] == 'plain_text'){ |
| 574 | 586 | if ($field_params['is_html']): |
| 575 | 587 | echo $field_params['name']; |
| 576 | - else: |
|
| 588 | + else { |
|
| 589 | + : |
|
| 577 | 590 | ?> |
| 578 | - <p style="margin: 0 0 12px 0;"><?php echo $field_params['name'];?></p> |
|
| 591 | + <p style="margin: 0 0 12px 0;"><?php echo $field_params['name']; |
|
| 592 | + } |
|
| 593 | + ?></p> |
|
| 579 | 594 | <?php |
| 580 | 595 | endif; |
| 581 | 596 | } |
@@ -595,8 +610,7 @@ discard block |
||
| 595 | 610 | if (is_array($value)){ |
| 596 | 611 | if ($field_params['type'] == 'accordion'){ |
| 597 | 612 | $sub_fields[$key][] = $this->convert_field($value, $current_values); |
| 598 | - } |
|
| 599 | - else |
|
| 613 | + } else |
|
| 600 | 614 | { |
| 601 | 615 | foreach ($value as $k => $sub_field) { |
| 602 | 616 | if (is_array($sub_field) and ! empty($this->fields[$sub_field['slug']])) |
@@ -758,7 +772,9 @@ discard block |
||
| 758 | 772 | |
| 759 | 773 | function add_title($title = '', $tooltip = ''){ |
| 760 | 774 | |
| 761 | - if (empty($title)) return; |
|
| 775 | + if (empty($title)) { |
|
| 776 | + return; |
|
| 777 | + } |
|
| 762 | 778 | |
| 763 | 779 | return $this->add_field(sanitize_key($title) . time(), $title, 'title', null, $tooltip); |
| 764 | 780 | |
@@ -766,7 +782,9 @@ discard block |
||
| 766 | 782 | |
| 767 | 783 | function add_text($text = '', $is_html = false){ |
| 768 | 784 | |
| 769 | - if (empty($text)) return; |
|
| 785 | + if (empty($text)) { |
|
| 786 | + return; |
|
| 787 | + } |
|
| 770 | 788 | |
| 771 | 789 | $count = is_array($this->fields) ? count($this->fields) : 0; |
| 772 | 790 | |
@@ -902,7 +920,9 @@ discard block |
||
| 902 | 920 | */ |
| 903 | 921 | function import_images( $slug, $title, $type = 'images', $callback = NULL ){ |
| 904 | 922 | |
| 905 | - if ( empty($title) or empty($slug) ) return; |
|
| 923 | + if ( empty($title) or empty($slug) ) { |
|
| 924 | + return; |
|
| 925 | + } |
|
| 906 | 926 | |
| 907 | 927 | if (is_array($slug)) { |
| 908 | 928 | $section_slug = 'pmxi_' . md5(serialize($slug)); |
@@ -1005,8 +1025,7 @@ discard block |
||
| 1005 | 1025 | $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug]['xpaths'][$option_name], $file)->parse(); |
| 1006 | 1026 | $tmp_files[] = $file; |
| 1007 | 1027 | } |
| 1008 | - } |
|
| 1009 | - else { |
|
| 1028 | + } else { |
|
| 1010 | 1029 | $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug][$option_name], $file)->parse(); |
| 1011 | 1030 | $tmp_files[] = $file; |
| 1012 | 1031 | } |
@@ -1036,13 +1055,23 @@ discard block |
||
| 1036 | 1055 | |
| 1037 | 1056 | $import_options = $import_options['options']; |
| 1038 | 1057 | |
| 1039 | - if ($import_options['update_all_data'] == 'yes') return true; |
|
| 1058 | + if ($import_options['update_all_data'] == 'yes') { |
|
| 1059 | + return true; |
|
| 1060 | + } |
|
| 1040 | 1061 | |
| 1041 | - if ( ! $import_options['is_update_custom_fields'] ) return false; |
|
| 1062 | + if ( ! $import_options['is_update_custom_fields'] ) { |
|
| 1063 | + return false; |
|
| 1064 | + } |
|
| 1042 | 1065 | |
| 1043 | - if ($import_options['update_custom_fields_logic'] == "full_update") return true; |
|
| 1044 | - if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) return true; |
|
| 1045 | - if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) return true; |
|
| 1066 | + if ($import_options['update_custom_fields_logic'] == "full_update") { |
|
| 1067 | + return true; |
|
| 1068 | + } |
|
| 1069 | + if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) { |
|
| 1070 | + return true; |
|
| 1071 | + } |
|
| 1072 | + if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) { |
|
| 1073 | + return true; |
|
| 1074 | + } |
|
| 1046 | 1075 | |
| 1047 | 1076 | return false; |
| 1048 | 1077 | |
@@ -1056,13 +1085,23 @@ discard block |
||
| 1056 | 1085 | |
| 1057 | 1086 | $import_options = $import_options['options']; |
| 1058 | 1087 | |
| 1059 | - if ($import_options['update_all_data'] == 'yes') return true; |
|
| 1088 | + if ($import_options['update_all_data'] == 'yes') { |
|
| 1089 | + return true; |
|
| 1090 | + } |
|
| 1060 | 1091 | |
| 1061 | - if ( ! $import_options['is_update_categories'] ) return false; |
|
| 1092 | + if ( ! $import_options['is_update_categories'] ) { |
|
| 1093 | + return false; |
|
| 1094 | + } |
|
| 1062 | 1095 | |
| 1063 | - if ($import_options['update_categories_logic'] == "full_update") return true; |
|
| 1064 | - if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) return true; |
|
| 1065 | - if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) return true; |
|
| 1096 | + if ($import_options['update_categories_logic'] == "full_update") { |
|
| 1097 | + return true; |
|
| 1098 | + } |
|
| 1099 | + if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) { |
|
| 1100 | + return true; |
|
| 1101 | + } |
|
| 1102 | + if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) { |
|
| 1103 | + return true; |
|
| 1104 | + } |
|
| 1066 | 1105 | |
| 1067 | 1106 | return false; |
| 1068 | 1107 | |
@@ -1072,11 +1111,17 @@ discard block |
||
| 1072 | 1111 | |
| 1073 | 1112 | $import_options = $import_options['options']; |
| 1074 | 1113 | |
| 1075 | - if ($import_options['update_all_data'] == 'yes') return true; |
|
| 1114 | + if ($import_options['update_all_data'] == 'yes') { |
|
| 1115 | + return true; |
|
| 1116 | + } |
|
| 1076 | 1117 | |
| 1077 | - if (!$import_options['is_update_images']) return false; |
|
| 1118 | + if (!$import_options['is_update_images']) { |
|
| 1119 | + return false; |
|
| 1120 | + } |
|
| 1078 | 1121 | |
| 1079 | - if ($import_options['is_update_images']) return true; |
|
| 1122 | + if ($import_options['is_update_images']) { |
|
| 1123 | + return true; |
|
| 1124 | + } |
|
| 1080 | 1125 | |
| 1081 | 1126 | return false; |
| 1082 | 1127 | } |
@@ -1153,7 +1198,9 @@ discard block |
||
| 1153 | 1198 | |
| 1154 | 1199 | $requires_counter = 0; |
| 1155 | 1200 | foreach ($conditions['plugins'] as $plugin) { |
| 1156 | - if ( is_plugin_active($plugin) ) $requires_counter++; |
|
| 1201 | + if ( is_plugin_active($plugin) ) { |
|
| 1202 | + $requires_counter++; |
|
| 1203 | + } |
|
| 1157 | 1204 | } |
| 1158 | 1205 | |
| 1159 | 1206 | if ($requires_counter != count($conditions['plugins'])){ |
@@ -209,7 +209,7 @@ |
||
| 209 | 209 | $help_text = ''; |
| 210 | 210 | //$label_args['class'] .= ' d-inline '; |
| 211 | 211 | $args['wrap_class'] .= ' align-items-center '; |
| 212 | - }else{ |
|
| 212 | + } else{ |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |