@@ -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 | |
| 5 | 7 | function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) { |
| 6 | 8 | if ( empty( $user ) ) { |
@@ -180,8 +180,11 @@ discard block |
||
| 180 | 180 | <label for="tablecell"> |
| 181 | 181 | <?php if( 'trialling' == $sub->status ) : ?> |
| 182 | 182 | <?php _e( 'Trialling Until:', 'invoicing' ); ?> |
| 183 | - <?php else: ?> |
|
| 184 | - <?php _e( 'Expiration Date:', 'invoicing' ); ?> |
|
| 183 | + <?php else { |
|
| 184 | + : ?> |
|
| 185 | + <?php _e( 'Expiration Date:', 'invoicing' ); |
|
| 186 | +} |
|
| 187 | +?> |
|
| 185 | 188 | <?php endif; ?> |
| 186 | 189 | </label> |
| 187 | 190 | </td> |
@@ -251,7 +254,10 @@ discard block |
||
| 251 | 254 | </thead> |
| 252 | 255 | <tbody> |
| 253 | 256 | <?php if ( ! empty( $payments ) ) : ?> |
| 254 | - <?php foreach ( $payments as $payment ) : $invoice = wpinv_get_invoice( $payment->ID ); if ( empty( $invoice->ID ) ) continue; ?> |
|
| 257 | + <?php foreach ( $payments as $payment ) : $invoice = wpinv_get_invoice( $payment->ID ); if ( empty( $invoice->ID ) ) { |
|
| 258 | + continue; |
|
| 259 | +} |
|
| 260 | +?> |
|
| 255 | 261 | <tr> |
| 256 | 262 | <td><?php echo $payment->ID; ?></td> |
| 257 | 263 | <td><?php echo $invoice->get_total( true ); ?></td> |
@@ -268,9 +274,12 @@ discard block |
||
| 268 | 274 | </td> |
| 269 | 275 | </tr> |
| 270 | 276 | <?php endforeach; ?> |
| 271 | - <?php else: ?> |
|
| 277 | + <?php else { |
|
| 278 | + : ?> |
|
| 272 | 279 | <tr> |
| 273 | - <td colspan="5"><?php _e( 'No Invoices Found.', 'invoicing' ); ?></td> |
|
| 280 | + <td colspan="5"><?php _e( 'No Invoices Found.', 'invoicing' ); |
|
| 281 | +} |
|
| 282 | +?></td> |
|
| 274 | 283 | </tr> |
| 275 | 284 | <?php endif; ?> |
| 276 | 285 | </tbody> |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | if(empty($count)){ |
| 81 | 81 | $output .= __('No Invoice(s)','invoicing'); |
| 82 | - }else{ |
|
| 82 | + } else{ |
|
| 83 | 83 | $link_url = admin_url( "edit.php?post_type=wpi_invoice&author=".absint($user_id) ); |
| 84 | 84 | $link_text = sprintf( __('Invoices ( %d )', 'invoicing'), $count ); |
| 85 | 85 | $output .= "<a href='$link_url' >$link_text</a>"; |
@@ -1100,10 +1100,11 @@ discard block |
||
| 1100 | 1100 | |
| 1101 | 1101 | $checked = false; |
| 1102 | 1102 | |
| 1103 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
| 1104 | - $checked = true; |
|
| 1105 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
| 1106 | - $checked = true; |
|
| 1103 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) { |
|
| 1104 | + $checked = true; |
|
| 1105 | + } elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1106 | + $checked = true; |
|
| 1107 | + } |
|
| 1107 | 1108 | |
| 1108 | 1109 | echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
| 1109 | 1110 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
@@ -1120,10 +1121,11 @@ discard block |
||
| 1120 | 1121 | foreach ( $args['options'] as $key => $option ) : |
| 1121 | 1122 | $sanitize_key = wpinv_sanitize_key( $key ); |
| 1122 | 1123 | |
| 1123 | - if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
| 1124 | - $enabled = '1'; |
|
| 1125 | - else |
|
| 1126 | - $enabled = null; |
|
| 1124 | + if ( isset( $wpinv_options['gateways'][ $key ] ) ) { |
|
| 1125 | + $enabled = '1'; |
|
| 1126 | + } else { |
|
| 1127 | + $enabled = null; |
|
| 1128 | + } |
|
| 1127 | 1129 | |
| 1128 | 1130 | echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
| 1129 | 1131 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
@@ -1487,7 +1489,8 @@ discard block |
||
| 1487 | 1489 | <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
| 1488 | 1490 | </tr> |
| 1489 | 1491 | <?php endforeach; ?> |
| 1490 | - <?php else : ?> |
|
| 1492 | + <?php else { |
|
| 1493 | + : ?> |
|
| 1491 | 1494 | <tr> |
| 1492 | 1495 | <td class="wpinv_tax_country"> |
| 1493 | 1496 | <?php |
@@ -1498,7 +1501,9 @@ discard block |
||
| 1498 | 1501 | 'show_option_none' => false, |
| 1499 | 1502 | 'class' => 'wpinv-tax-country wpi_select2', |
| 1500 | 1503 | 'placeholder' => __( 'Choose a country', 'invoicing' ) |
| 1501 | - ) ); ?> |
|
| 1504 | + ) ); |
|
| 1505 | +} |
|
| 1506 | +?> |
|
| 1502 | 1507 | </td> |
| 1503 | 1508 | <td class="wpinv_tax_state"> |
| 1504 | 1509 | <?php echo wpinv_html_text( array( |
@@ -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 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | unset($param['default']); |
| 199 | 199 | } |
| 200 | 200 | $param['value'] = array(''=>__("No"),'1'=>__("Yes")); |
| 201 | - }elseif($param['type'] == 'select'){ |
|
| 201 | + } elseif($param['type'] == 'select'){ |
|
| 202 | 202 | $param['value'] = isset($val['options']) ? $val['options'] : array(); |
| 203 | - }else{ |
|
| 203 | + } else{ |
|
| 204 | 204 | $param['value'] = isset($val['default']) ? $val['default'] : ''; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | <?php |
| 659 | 659 | if(! empty( $insert_shortcode_function )){ |
| 660 | 660 | echo $insert_shortcode_function; |
| 661 | - }else{ |
|
| 661 | + } else{ |
|
| 662 | 662 | |
| 663 | 663 | /** |
| 664 | 664 | * Function for super duper insert shortcode. |
@@ -1414,8 +1414,7 @@ discard block |
||
| 1414 | 1414 | $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
| 1415 | 1415 | if($args['type']=='checkbox' && $argument_values[ $key ] == ''){ |
| 1416 | 1416 | // don't set default for an empty checkbox |
| 1417 | - } |
|
| 1418 | - elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
| 1417 | + } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
| 1419 | 1418 | $argument_values[ $key ] = $args['default']; |
| 1420 | 1419 | } |
| 1421 | 1420 | } |
@@ -1544,11 +1543,11 @@ discard block |
||
| 1544 | 1543 | $fa_type = ''; |
| 1545 | 1544 | if(substr( $icon, 0, 7 ) === "fas fa-"){ |
| 1546 | 1545 | $fa_type = 'solid'; |
| 1547 | - }elseif(substr( $icon, 0, 7 ) === "far fa-"){ |
|
| 1546 | + } elseif(substr( $icon, 0, 7 ) === "far fa-"){ |
|
| 1548 | 1547 | $fa_type = 'regular'; |
| 1549 | - }elseif(substr( $icon, 0, 7 ) === "fab fa-"){ |
|
| 1548 | + } elseif(substr( $icon, 0, 7 ) === "fab fa-"){ |
|
| 1550 | 1549 | $fa_type = 'brands'; |
| 1551 | - }else{ |
|
| 1550 | + } else{ |
|
| 1552 | 1551 | $icon = "'".$icon."'"; |
| 1553 | 1552 | } |
| 1554 | 1553 | |
@@ -1571,7 +1570,7 @@ discard block |
||
| 1571 | 1570 | if(isset($args['group'])){ |
| 1572 | 1571 | $temp_arguments[$args['group']][$key] = $args; |
| 1573 | 1572 | $add_sections = true; |
| 1574 | - }else{ |
|
| 1573 | + } else{ |
|
| 1575 | 1574 | $temp_arguments[$general][$key] = $args; |
| 1576 | 1575 | } |
| 1577 | 1576 | } |
@@ -1813,7 +1812,7 @@ discard block |
||
| 1813 | 1812 | ?> |
| 1814 | 1813 | el(wp.components.PanelBody, { |
| 1815 | 1814 | title: '<?php esc_attr_e($key); ?>', |
| 1816 | - initialOpen: <?php if($panel_count){echo "false";}else{echo "true";}?> |
|
| 1815 | + initialOpen: <?php if($panel_count){echo "false";} else{echo "true";}?> |
|
| 1817 | 1816 | }, |
| 1818 | 1817 | <?php |
| 1819 | 1818 | |
@@ -1826,7 +1825,7 @@ discard block |
||
| 1826 | 1825 | $panel_count++; |
| 1827 | 1826 | |
| 1828 | 1827 | } |
| 1829 | - }else{ |
|
| 1828 | + } else{ |
|
| 1830 | 1829 | foreach($this->arguments as $key => $args){ |
| 1831 | 1830 | $this->build_block_arguments($key, $args); |
| 1832 | 1831 | } |
@@ -1843,7 +1842,7 @@ discard block |
||
| 1843 | 1842 | // If the user sets block-output array then build it |
| 1844 | 1843 | if ( ! empty( $this->options['block-output'] ) ) { |
| 1845 | 1844 | $this->block_element( $this->options['block-output'] ); |
| 1846 | - }else{ |
|
| 1845 | + } else{ |
|
| 1847 | 1846 | // if no block-output is set then we try and get the shortcode html output via ajax. |
| 1848 | 1847 | ?> |
| 1849 | 1848 | el('div', { |
@@ -2380,7 +2379,7 @@ discard block |
||
| 2380 | 2379 | $panel_count++; |
| 2381 | 2380 | |
| 2382 | 2381 | } |
| 2383 | - }else{ |
|
| 2382 | + } else{ |
|
| 2384 | 2383 | foreach ( $arguments as $key => $args ) { |
| 2385 | 2384 | $this->widget_inputs( $args, $instance ); |
| 2386 | 2385 | } |