@@ -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 | |
@@ -121,13 +120,13 @@ discard block |
||
121 | 120 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
122 | 121 | if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
123 | 122 | $button_args['update_url'] = "https://wpinvoicing.com"; |
124 | - }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
123 | + } elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
125 | 124 | if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
126 | 125 | $button_args['installed'] = self::is_theme_installed($addon); |
127 | 126 | if(!in_array($button_args['slug'],$wp_org_themes)){ |
128 | 127 | $button_args['update_url'] = "https://wpinvoicing.com"; |
129 | 128 | } |
130 | - }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
129 | + } elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
131 | 130 | include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
132 | 131 | $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
133 | 132 | $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
@@ -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) ){ |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | if(!class_exists('Ayecode_Addons')) { |
5 | 7 | |
6 | 8 | abstract class Ayecode_Addons |
@@ -159,8 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | // Setup possible parts |
161 | 161 | $templates = array(); |
162 | - if ( isset( $name ) ) |
|
163 | - $templates[] = $slug . '-' . $name . '.php'; |
|
162 | + if ( isset( $name ) ) { |
|
163 | + $templates[] = $slug . '-' . $name . '.php'; |
|
164 | + } |
|
164 | 165 | $templates[] = $slug . '.php'; |
165 | 166 | |
166 | 167 | // Allow template parts to be filtered |
@@ -178,8 +179,9 @@ discard block |
||
178 | 179 | foreach ( (array)$template_names as $template_name ) { |
179 | 180 | |
180 | 181 | // Continue if template is empty |
181 | - if ( empty( $template_name ) ) |
|
182 | - continue; |
|
182 | + if ( empty( $template_name ) ) { |
|
183 | + continue; |
|
184 | + } |
|
183 | 185 | |
184 | 186 | // Trim off any slashes from the template name |
185 | 187 | $template_name = ltrim( $template_name, '/' ); |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | } |
199 | 201 | } |
200 | 202 | |
201 | - if ( ( true == $load ) && ! empty( $located ) ) |
|
202 | - load_template( $located, $require_once ); |
|
203 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
204 | + load_template( $located, $require_once ); |
|
205 | + } |
|
203 | 206 | |
204 | 207 | return $located; |
205 | 208 | } |
@@ -281,8 +284,9 @@ discard block |
||
281 | 284 | function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) { |
282 | 285 | $args = array( 'nopaging' => true ); |
283 | 286 | |
284 | - if ( ! empty( $status ) ) |
|
285 | - $args['post_status'] = $status; |
|
287 | + if ( ! empty( $status ) ) { |
|
288 | + $args['post_status'] = $status; |
|
289 | + } |
|
286 | 290 | |
287 | 291 | $discounts = wpinv_get_discounts( $args ); |
288 | 292 | $options = array(); |
@@ -1424,9 +1428,10 @@ discard block |
||
1424 | 1428 | add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' ); |
1425 | 1429 | |
1426 | 1430 | function wpinv_update_cart_button() { |
1427 | - if ( !wpinv_item_quantities_enabled() ) |
|
1428 | - return; |
|
1429 | -?> |
|
1431 | + if ( !wpinv_item_quantities_enabled() ) { |
|
1432 | + return; |
|
1433 | + } |
|
1434 | + ?> |
|
1430 | 1435 | <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/> |
1431 | 1436 | <input type="hidden" name="wpi_action" value="update_cart"/> |
1432 | 1437 | <?php |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | </div> |
127 | 127 | </div> |
128 | 128 | <?php |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | $installed_plugins = get_plugins(); |
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | 132 | if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
152 | 152 | echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
153 | 153 | echo '</a>'; |
154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
154 | + } elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
155 | 155 | if(defined('WP_EASY_UPDATES_ACTIVE')){ |
156 | 156 | $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
157 | - }else{ |
|
157 | + } else{ |
|
158 | 158 | // if installed show activation link |
159 | 159 | if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
160 | 160 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
161 | - }else{ |
|
161 | + } else{ |
|
162 | 162 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
163 | 163 | } |
164 | 164 | } |
@@ -974,8 +974,9 @@ |
||
974 | 974 | return false; |
975 | 975 | } |
976 | 976 | |
977 | - if ( empty( $this->ID ) ) |
|
978 | - return false; |
|
977 | + if ( empty( $this->ID ) ) { |
|
978 | + return false; |
|
979 | + } |
|
979 | 980 | |
980 | 981 | if ( ( ( is_user_logged_in() && wpinv_current_user_can_manage_invoicing() ) || $added_by_user ) && !$system ) { |
981 | 982 | $user = get_user_by( 'id', get_current_user_id() ); |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | function wpinv_get_item_by_id( $id ) { |
6 | 8 | return wpinv_get_item_by( 'id', $id ); |
@@ -80,8 +82,9 @@ discard block |
||
80 | 82 | function wpinv_get_item( $item = 0 ) { |
81 | 83 | if ( is_numeric( $item ) ) { |
82 | 84 | $item = get_post( $item ); |
83 | - if ( ! $item || 'wpi_item' !== $item->post_type ) |
|
84 | - return null; |
|
85 | + if ( ! $item || 'wpi_item' !== $item->post_type ) { |
|
86 | + return null; |
|
87 | + } |
|
85 | 88 | return $item; |
86 | 89 | } |
87 | 90 | |
@@ -331,8 +334,9 @@ discard block |
||
331 | 334 | } |
332 | 335 | |
333 | 336 | function wpinv_remove_item_logs_on_delete( $item_id = 0 ) { |
334 | - if ( 'wpi_item' !== get_post_type( $item_id ) ) |
|
335 | - return; |
|
337 | + if ( 'wpi_item' !== get_post_type( $item_id ) ) { |
|
338 | + return; |
|
339 | + } |
|
336 | 340 | |
337 | 341 | global $wpinv_logs; |
338 | 342 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly. |
3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | class WPInv_EUVat { |
6 | 8 | private static $is_ajax = false; |
@@ -672,7 +674,7 @@ discard block |
||
672 | 674 | if ( !empty( $load_xml ) && !empty( $load_xml->geoplugin_countryCode ) ) { |
673 | 675 | $wpinv_ip_address_country = (string)$load_xml->geoplugin_countryCode; |
674 | 676 | } |
675 | - }elseif(!empty( $ip )){ |
|
677 | + } elseif(!empty( $ip )){ |
|
676 | 678 | $url = 'http://ip-api.com/json/' . $ip; |
677 | 679 | $response = wp_remote_get($url); |
678 | 680 | |
@@ -1468,16 +1470,18 @@ discard block |
||
1468 | 1470 | |
1469 | 1471 | if ( !empty( $tax_rates ) ) { |
1470 | 1472 | foreach ( $tax_rates as $key => $tax_rate ) { |
1471 | - if ( $country != $tax_rate['country'] ) |
|
1472 | - continue; |
|
1473 | + if ( $country != $tax_rate['country'] ) { |
|
1474 | + continue; |
|
1475 | + } |
|
1473 | 1476 | |
1474 | 1477 | if ( !empty( $tax_rate['global'] ) ) { |
1475 | 1478 | if ( 0 !== $tax_rate['rate'] || !empty( $tax_rate['rate'] ) ) { |
1476 | 1479 | $rate = number_format( $tax_rate['rate'], 4 ); |
1477 | 1480 | } |
1478 | 1481 | } else { |
1479 | - if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) |
|
1480 | - continue; |
|
1482 | + if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) { |
|
1483 | + continue; |
|
1484 | + } |
|
1481 | 1485 | |
1482 | 1486 | $state_rate = $tax_rate['rate']; |
1483 | 1487 | if ( 0 !== $state_rate || !empty( $state_rate ) ) { |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | unset($param['default']); |
181 | 181 | } |
182 | 182 | $param['value'] = array(''=>__("No"),'1'=>__("Yes")); |
183 | - }elseif($param['type'] == 'select'){ |
|
183 | + } elseif($param['type'] == 'select'){ |
|
184 | 184 | $param['value'] = isset($val['options']) ? $val['options'] : array(); |
185 | - }else{ |
|
185 | + } else{ |
|
186 | 186 | $param['value'] = isset($val['default']) ? $val['default'] : ''; |
187 | 187 | } |
188 | 188 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | <?php |
641 | 641 | if(! empty( $insert_shortcode_function )){ |
642 | 642 | echo $insert_shortcode_function; |
643 | - }else{ |
|
643 | + } else{ |
|
644 | 644 | |
645 | 645 | /** |
646 | 646 | * Function for super duper insert shortcode. |
@@ -1412,8 +1412,7 @@ discard block |
||
1412 | 1412 | $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
1413 | 1413 | if($args['type']=='checkbox' && $argument_values[ $key ] == ''){ |
1414 | 1414 | // don't set default for an empty checkbox |
1415 | - } |
|
1416 | - elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1415 | + } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1417 | 1416 | $argument_values[ $key ] = $args['default']; |
1418 | 1417 | } |
1419 | 1418 | } |
@@ -1542,11 +1541,11 @@ discard block |
||
1542 | 1541 | $fa_type = ''; |
1543 | 1542 | if(substr( $icon, 0, 7 ) === "fas fa-"){ |
1544 | 1543 | $fa_type = 'solid'; |
1545 | - }elseif(substr( $icon, 0, 7 ) === "far fa-"){ |
|
1544 | + } elseif(substr( $icon, 0, 7 ) === "far fa-"){ |
|
1546 | 1545 | $fa_type = 'regular'; |
1547 | - }elseif(substr( $icon, 0, 7 ) === "fab fa-"){ |
|
1546 | + } elseif(substr( $icon, 0, 7 ) === "fab fa-"){ |
|
1548 | 1547 | $fa_type = 'brands'; |
1549 | - }else{ |
|
1548 | + } else{ |
|
1550 | 1549 | $icon = "'".$icon."'"; |
1551 | 1550 | } |
1552 | 1551 | |
@@ -1569,7 +1568,7 @@ discard block |
||
1569 | 1568 | if(isset($args['group'])){ |
1570 | 1569 | $temp_arguments[$args['group']][$key] = $args; |
1571 | 1570 | $add_sections = true; |
1572 | - }else{ |
|
1571 | + } else{ |
|
1573 | 1572 | $temp_arguments[$general][$key] = $args; |
1574 | 1573 | } |
1575 | 1574 | } |
@@ -1816,7 +1815,7 @@ discard block |
||
1816 | 1815 | ?> |
1817 | 1816 | el(wp.components.PanelBody, { |
1818 | 1817 | title: '<?php esc_attr_e($key); ?>', |
1819 | - initialOpen: <?php if($panel_count){echo "false";}else{echo "true";}?> |
|
1818 | + initialOpen: <?php if($panel_count){echo "false";} else{echo "true";}?> |
|
1820 | 1819 | }, |
1821 | 1820 | <?php |
1822 | 1821 | |
@@ -1829,7 +1828,7 @@ discard block |
||
1829 | 1828 | $panel_count++; |
1830 | 1829 | |
1831 | 1830 | } |
1832 | - }else{ |
|
1831 | + } else{ |
|
1833 | 1832 | foreach($this->arguments as $key => $args){ |
1834 | 1833 | $this->build_block_arguments($key, $args); |
1835 | 1834 | } |
@@ -1846,7 +1845,7 @@ discard block |
||
1846 | 1845 | // If the user sets block-output array then build it |
1847 | 1846 | if ( ! empty( $this->options['block-output'] ) ) { |
1848 | 1847 | $this->block_element( $this->options['block-output'] ); |
1849 | - }else{ |
|
1848 | + } else{ |
|
1850 | 1849 | // if no block-output is set then we try and get the shortcode html output via ajax. |
1851 | 1850 | ?> |
1852 | 1851 | el('div', { |
@@ -1916,7 +1915,7 @@ discard block |
||
1916 | 1915 | ?> |
1917 | 1916 | return content; |
1918 | 1917 | <?php |
1919 | - }else{ |
|
1918 | + } else{ |
|
1920 | 1919 | ?> |
1921 | 1920 | var block_wrap = 'div'; |
1922 | 1921 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -1971,7 +1970,7 @@ discard block |
||
1971 | 1970 | $type = 'CheckboxControl'; |
1972 | 1971 | $extra .= "checked: props.attributes.$key,"; |
1973 | 1972 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
1974 | - }elseif ( $args['type'] == 'textarea' ) { |
|
1973 | + } elseif ( $args['type'] == 'textarea' ) { |
|
1975 | 1974 | $type = 'TextareaControl'; |
1976 | 1975 | } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
1977 | 1976 | $type = 'SelectControl'; |
@@ -2415,7 +2414,7 @@ discard block |
||
2415 | 2414 | $panel_count++; |
2416 | 2415 | |
2417 | 2416 | } |
2418 | - }else{ |
|
2417 | + } else{ |
|
2419 | 2418 | foreach ( $arguments as $key => $args ) { |
2420 | 2419 | $this->widget_inputs( $args, $instance ); |
2421 | 2420 | } |
@@ -132,11 +132,13 @@ |
||
132 | 132 | if ( 'id' == strtolower( $field ) ) { |
133 | 133 | // Make sure the value is numeric to avoid casting objects, for example, |
134 | 134 | // to int 1. |
135 | - if ( ! is_numeric( $value ) ) |
|
136 | - return false; |
|
135 | + if ( ! is_numeric( $value ) ) { |
|
136 | + return false; |
|
137 | + } |
|
137 | 138 | $value = intval( $value ); |
138 | - if ( $value < 1 ) |
|
139 | - return false; |
|
139 | + if ( $value < 1 ) { |
|
140 | + return false; |
|
141 | + } |
|
140 | 142 | } |
141 | 143 | |
142 | 144 | if ( ! $value || ! is_string( $field ) ) { |