@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
| 172 | 172 | require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
| 173 | 173 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
| 174 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 175 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 176 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 177 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 178 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 174 | + require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 175 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 176 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 177 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 178 | + require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 179 | 179 | require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
| 180 | 180 | require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' ); |
| 181 | 181 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' ); |
| 323 | 323 | wp_enqueue_style( 'jquery-ui-css' ); |
| 324 | 324 | wp_deregister_style( 'yoast-seo-select2' ); |
| 325 | - wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 325 | + wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | if ( $page == 'wpinv-subscriptions' ) { |
| 337 | 337 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 338 | 338 | wp_deregister_style( 'yoast-seo-select2' ); |
| 339 | - wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 339 | + wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) { |
@@ -500,19 +500,19 @@ discard block |
||
| 500 | 500 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - /** |
|
| 504 | - * Register widgets |
|
| 505 | - * |
|
| 506 | - */ |
|
| 507 | - public function register_widgets() { |
|
| 508 | - register_widget( "WPInv_Checkout_Widget" ); |
|
| 509 | - register_widget( "WPInv_History_Widget" ); |
|
| 510 | - register_widget( "WPInv_Receipt_Widget" ); |
|
| 511 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
| 512 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
| 503 | + /** |
|
| 504 | + * Register widgets |
|
| 505 | + * |
|
| 506 | + */ |
|
| 507 | + public function register_widgets() { |
|
| 508 | + register_widget( "WPInv_Checkout_Widget" ); |
|
| 509 | + register_widget( "WPInv_History_Widget" ); |
|
| 510 | + register_widget( "WPInv_Receipt_Widget" ); |
|
| 511 | + register_widget( "WPInv_Subscriptions_Widget" ); |
|
| 512 | + register_widget( "WPInv_Buy_Item_Widget" ); |
|
| 513 | 513 | register_widget( "WPInv_Messages_Widget" ); |
| 514 | 514 | register_widget( 'WPInv_Payment_Form_Widget' ); |
| 515 | - } |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | 517 | /** |
| 518 | 518 | * Remove our pages from yoast sitemaps. |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // MUST have WordPress. |
| 10 | -if ( !defined( 'WPINC' ) ) { |
|
| 11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 10 | +if (!defined('WPINC')) { |
|
| 11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | class WPInv_Plugin { |
| 15 | 15 | private static $instance; |
| 16 | 16 | |
| 17 | 17 | public static function run() { |
| 18 | - if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) { |
|
| 18 | + if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) { |
|
| 19 | 19 | self::$instance = new WPInv_Plugin; |
| 20 | 20 | self::$instance->includes(); |
| 21 | 21 | self::$instance->actions(); |
@@ -33,34 +33,34 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function define_constants() { |
| 36 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
| 37 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
| 36 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
| 37 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | private function actions() { |
| 41 | 41 | /* Internationalize the text strings used. */ |
| 42 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
| 42 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
| 43 | 43 | |
| 44 | 44 | /* Perform actions on admin initialization. */ |
| 45 | - add_action( 'admin_init', array( &$this, 'admin_init') ); |
|
| 46 | - add_action( 'init', array( &$this, 'init' ), 3 ); |
|
| 47 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
| 45 | + add_action('admin_init', array(&$this, 'admin_init')); |
|
| 46 | + add_action('init', array(&$this, 'init'), 3); |
|
| 47 | + add_action('init', array(&$this, 'wpinv_actions')); |
|
| 48 | 48 | |
| 49 | - if ( class_exists( 'BuddyPress' ) ) { |
|
| 50 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
| 49 | + if (class_exists('BuddyPress')) { |
|
| 50 | + add_action('bp_include', array(&$this, 'bp_invoicing_init')); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
| 54 | - add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
| 55 | - add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
| 53 | + add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); |
|
| 54 | + add_action('widgets_init', array(&$this, 'register_widgets')); |
|
| 55 | + add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids')); |
|
| 56 | 56 | |
| 57 | - if ( is_admin() ) { |
|
| 58 | - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); |
|
| 59 | - add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) ); |
|
| 60 | - add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) ); |
|
| 57 | + if (is_admin()) { |
|
| 58 | + add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); |
|
| 59 | + add_filter('admin_body_class', array(&$this, 'admin_body_class')); |
|
| 60 | + add_action('admin_init', array(&$this, 'init_ayecode_connect_helper')); |
|
| 61 | 61 | |
| 62 | 62 | } else { |
| 63 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
| 63 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,28 +70,28 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference. |
| 72 | 72 | */ |
| 73 | - do_action_ref_array( 'wpinv_actions', array( &$this ) ); |
|
| 73 | + do_action_ref_array('wpinv_actions', array(&$this)); |
|
| 74 | 74 | |
| 75 | - add_action( 'admin_init', array( &$this, 'activation_redirect') ); |
|
| 75 | + add_action('admin_init', array(&$this, 'activation_redirect')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Maybe show the AyeCode Connect Notice. |
| 80 | 80 | */ |
| 81 | - public function init_ayecode_connect_helper(){ |
|
| 81 | + public function init_ayecode_connect_helper() { |
|
| 82 | 82 | // AyeCode Connect notice |
| 83 | - if ( is_admin() ){ |
|
| 83 | + if (is_admin()) { |
|
| 84 | 84 | // set the strings so they can be translated |
| 85 | 85 | $strings = array( |
| 86 | - 'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"), |
|
| 87 | - 'connect_external' => __( "Please confirm you wish to connect your site?","invoicing" ), |
|
| 88 | - 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ), |
|
| 89 | - 'connect_button' => __("Connect Site","invoicing"), |
|
| 90 | - 'connecting_button' => __("Connecting...","invoicing"), |
|
| 91 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost.","invoicing" ), |
|
| 92 | - 'error' => __( "Something went wrong, please refresh and try again.","invoicing" ), |
|
| 86 | + 'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"), |
|
| 87 | + 'connect_external' => __("Please confirm you wish to connect your site?", "invoicing"), |
|
| 88 | + 'connect' => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"), |
|
| 89 | + 'connect_button' => __("Connect Site", "invoicing"), |
|
| 90 | + 'connecting_button' => __("Connecting...", "invoicing"), |
|
| 91 | + 'error_localhost' => __("This service will only work with a live domain, not a localhost.", "invoicing"), |
|
| 92 | + 'error' => __("Something went wrong, please refresh and try again.", "invoicing"), |
|
| 93 | 93 | ); |
| 94 | - new AyeCode_Connect_Helper($strings,array('wpi-addons')); |
|
| 94 | + new AyeCode_Connect_Helper($strings, array('wpi-addons')); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | /* Internationalize the text strings used. */ |
| 100 | 100 | $this->load_textdomain(); |
| 101 | 101 | |
| 102 | - do_action( 'wpinv_loaded' ); |
|
| 102 | + do_action('wpinv_loaded'); |
|
| 103 | 103 | |
| 104 | 104 | // Fix oxygen page builder conflict |
| 105 | - if ( function_exists( 'ct_css_output' ) ) { |
|
| 105 | + if (function_exists('ct_css_output')) { |
|
| 106 | 106 | wpinv_oxygen_fix_conflict(); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -112,241 +112,241 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @since 1.0 |
| 114 | 114 | */ |
| 115 | - public function load_textdomain( $locale = NULL ) { |
|
| 116 | - if ( empty( $locale ) ) { |
|
| 117 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
| 115 | + public function load_textdomain($locale = NULL) { |
|
| 116 | + if (empty($locale)) { |
|
| 117 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
| 120 | + $locale = apply_filters('plugin_locale', $locale, 'invoicing'); |
|
| 121 | 121 | |
| 122 | - unload_textdomain( 'invoicing' ); |
|
| 123 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
| 124 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
| 122 | + unload_textdomain('invoicing'); |
|
| 123 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
| 124 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Define language constants. |
| 128 | 128 | */ |
| 129 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
| 129 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function includes() { |
| 133 | 133 | global $wpinv_options; |
| 134 | 134 | |
| 135 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
| 135 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
| 136 | 136 | $wpinv_options = wpinv_get_settings(); |
| 137 | 137 | |
| 138 | - require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
| 139 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' ); |
|
| 140 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
| 141 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
| 142 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
| 143 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
| 144 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
| 145 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
| 146 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' ); |
|
| 147 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
| 148 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
| 149 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
| 150 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
| 151 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
| 152 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' ); |
|
| 153 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' ); |
|
| 154 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' ); |
|
| 155 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' ); |
|
| 156 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' ); |
|
| 157 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' ); |
|
| 158 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
| 159 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
| 160 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
| 161 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
| 162 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
| 163 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
| 164 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
| 165 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
| 166 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
| 167 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' ); |
|
| 168 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
| 169 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' ); |
|
| 170 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
| 171 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
| 172 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
| 173 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
| 174 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 175 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 176 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 177 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 178 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 179 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 180 | - require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' ); |
|
| 181 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
|
| 182 | - |
|
| 183 | - if ( !class_exists( 'WPInv_EUVat' ) ) { |
|
| 184 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
| 138 | + require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php'); |
|
| 139 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php'); |
|
| 140 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
| 141 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
| 142 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
| 143 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
| 144 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
| 145 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
| 146 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php'); |
|
| 147 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
| 148 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
| 149 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
| 150 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
| 151 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php'); |
|
| 152 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php'); |
|
| 153 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php'); |
|
| 154 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php'); |
|
| 155 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php'); |
|
| 156 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php'); |
|
| 157 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php'); |
|
| 158 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php'); |
|
| 159 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php'); |
|
| 160 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
| 161 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
| 162 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php'); |
|
| 163 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php'); |
|
| 164 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php'); |
|
| 165 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php'); |
|
| 166 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php'); |
|
| 167 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php'); |
|
| 168 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php'); |
|
| 169 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php'); |
|
| 170 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php'); |
|
| 171 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php'); |
|
| 172 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php'); |
|
| 173 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php'); |
|
| 174 | + require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php'); |
|
| 175 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php'); |
|
| 176 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php'); |
|
| 177 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php'); |
|
| 178 | + require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php'); |
|
| 179 | + require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php'); |
|
| 180 | + require_once(WPINV_PLUGIN_DIR . 'widgets/payment-form.php'); |
|
| 181 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php'); |
|
| 182 | + |
|
| 183 | + if (!class_exists('WPInv_EUVat')) { |
|
| 184 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php'); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 188 | - if ( !empty( $gateways ) ) { |
|
| 189 | - foreach ( $gateways as $gateway ) { |
|
| 190 | - if ( $gateway == 'manual' ) { |
|
| 187 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
| 188 | + if (!empty($gateways)) { |
|
| 189 | + foreach ($gateways as $gateway) { |
|
| 190 | + if ($gateway == 'manual') { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
| 195 | 195 | |
| 196 | - if ( file_exists( $gateway_file ) ) { |
|
| 197 | - require_once( $gateway_file ); |
|
| 196 | + if (file_exists($gateway_file)) { |
|
| 197 | + require_once($gateway_file); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | - require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' ); |
|
| 201 | + require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php'); |
|
| 202 | 202 | |
| 203 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 204 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
| 205 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
| 206 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' ); |
|
| 203 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
| 204 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php'); |
|
| 205 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
| 206 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php'); |
|
| 207 | 207 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' ); |
| 208 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' ); |
|
| 209 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' ); |
|
| 210 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
| 211 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
| 212 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' ); |
|
| 213 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
| 214 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
| 215 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
| 208 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php'); |
|
| 209 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php'); |
|
| 210 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php'); |
|
| 211 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
| 212 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php'); |
|
| 213 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
| 214 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php'); |
|
| 215 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php'); |
|
| 216 | 216 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
| 217 | 217 | // load the user class only on the users.php page |
| 218 | 218 | global $pagenow; |
| 219 | - if($pagenow=='users.php'){ |
|
| 219 | + if ($pagenow == 'users.php') { |
|
| 220 | 220 | new WPInv_Admin_Users(); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // Register cli commands |
| 225 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
| 226 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
| 227 | - WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
| 225 | + if (defined('WP_CLI') && WP_CLI) { |
|
| 226 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php'); |
|
| 227 | + WP_CLI::add_command('invoicing', 'WPInv_CLI'); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // include css inliner |
| 231 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
| 232 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
| 231 | + if (!class_exists('Emogrifier') && class_exists('DOMDocument')) { |
|
| 232 | + include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
| 235 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | public function init() { |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | public function admin_init() { |
| 242 | - add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) ); |
|
| 242 | + add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php')); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | public function activation_redirect() { |
| 246 | 246 | // Bail if no activation redirect |
| 247 | - if ( !get_transient( '_wpinv_activation_redirect' ) ) { |
|
| 247 | + if (!get_transient('_wpinv_activation_redirect')) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Delete the redirect transient |
| 252 | - delete_transient( '_wpinv_activation_redirect' ); |
|
| 252 | + delete_transient('_wpinv_activation_redirect'); |
|
| 253 | 253 | |
| 254 | 254 | // Bail if activating from network, or bulk |
| 255 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 255 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 256 | 256 | return; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
| 259 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
| 260 | 260 | exit; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | public function enqueue_scripts() { |
| 264 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 264 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
| 265 | 265 | |
| 266 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION ); |
|
| 267 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
| 266 | + wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION); |
|
| 267 | + wp_enqueue_style('wpinv_front_style'); |
|
| 268 | 268 | |
| 269 | 269 | // Register scripts |
| 270 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
| 271 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ), filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) ); |
|
| 270 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
| 271 | + wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js')); |
|
| 272 | 272 | |
| 273 | 273 | $localize = array(); |
| 274 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 275 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 274 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
| 275 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
| 276 | 276 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
| 277 | 277 | $localize['currency_pos'] = wpinv_currency_position(); |
| 278 | 278 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
| 279 | 279 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
| 280 | 280 | $localize['decimals'] = wpinv_decimals(); |
| 281 | - $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
| 281 | + $localize['txtComplete'] = __('Continue', 'invoicing'); |
|
| 282 | 282 | $localize['UseTaxes'] = wpinv_use_taxes(); |
| 283 | - $localize['checkoutNonce'] = wp_create_nonce( 'wpinv_checkout_nonce' ); |
|
| 283 | + $localize['checkoutNonce'] = wp_create_nonce('wpinv_checkout_nonce'); |
|
| 284 | 284 | |
| 285 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
| 285 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
| 286 | 286 | |
| 287 | - wp_enqueue_script( 'jquery-blockui' ); |
|
| 287 | + wp_enqueue_script('jquery-blockui'); |
|
| 288 | 288 | $autofill_api = wpinv_get_option('address_autofill_api'); |
| 289 | 289 | $autofill_active = wpinv_get_option('address_autofill_active'); |
| 290 | - if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) { |
|
| 291 | - if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) { |
|
| 292 | - wp_dequeue_script( 'google-maps-api' ); |
|
| 290 | + if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) { |
|
| 291 | + if (wp_script_is('google-maps-api', 'enqueued')) { |
|
| 292 | + wp_dequeue_script('google-maps-api'); |
|
| 293 | 293 | } |
| 294 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false ); |
|
| 295 | - wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true ); |
|
| 294 | + wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false); |
|
| 295 | + wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
| 299 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
| 298 | + wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all'); |
|
| 299 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION); |
|
| 300 | 300 | |
| 301 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
| 302 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
| 301 | + wp_enqueue_script('wpinv-front-script'); |
|
| 302 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
| 303 | 303 | |
| 304 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
| 305 | - wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ), $version, true ); |
|
| 304 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js'); |
|
| 305 | + wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script', 'wp-hooks'), $version, true); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - public function admin_enqueue_scripts( $hook ) { |
|
| 308 | + public function admin_enqueue_scripts($hook) { |
|
| 309 | 309 | global $post, $pagenow; |
| 310 | 310 | |
| 311 | 311 | $post_type = wpinv_admin_post_type(); |
| 312 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 313 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : ''; |
|
| 312 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
| 313 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : ''; |
|
| 314 | 314 | |
| 315 | 315 | $jquery_ui_css = false; |
| 316 | - if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) { |
|
| 316 | + if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
|
| 317 | 317 | $jquery_ui_css = true; |
| 318 | - } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) { |
|
| 318 | + } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') { |
|
| 319 | 319 | $jquery_ui_css = true; |
| 320 | 320 | } |
| 321 | - if ( $jquery_ui_css ) { |
|
| 322 | - wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' ); |
|
| 323 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 324 | - wp_deregister_style( 'yoast-seo-select2' ); |
|
| 325 | - wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 321 | + if ($jquery_ui_css) { |
|
| 322 | + wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16'); |
|
| 323 | + wp_enqueue_style('jquery-ui-css'); |
|
| 324 | + wp_deregister_style('yoast-seo-select2'); |
|
| 325 | + wp_deregister_style('yoast-seo-monorepo'); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
|
| 329 | - wp_enqueue_style( 'wpinv_meta_box_style' ); |
|
| 328 | + wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION); |
|
| 329 | + wp_enqueue_style('wpinv_meta_box_style'); |
|
| 330 | 330 | |
| 331 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' ); |
|
| 332 | - wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version ); |
|
| 333 | - wp_enqueue_style( 'wpinv_admin_style' ); |
|
| 334 | - |
|
| 335 | - $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ); |
|
| 336 | - if ( $page == 'wpinv-subscriptions' ) { |
|
| 337 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 338 | - wp_deregister_style( 'yoast-seo-select2' ); |
|
| 339 | - wp_deregister_style( 'yoast-seo-monorepo' ); |
|
| 331 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css'); |
|
| 332 | + wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version); |
|
| 333 | + wp_enqueue_style('wpinv_admin_style'); |
|
| 334 | + |
|
| 335 | + $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')); |
|
| 336 | + if ($page == 'wpinv-subscriptions') { |
|
| 337 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 338 | + wp_deregister_style('yoast-seo-select2'); |
|
| 339 | + wp_deregister_style('yoast-seo-monorepo'); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) { |
|
| 343 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 342 | + if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) { |
|
| 343 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 347 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 346 | + wp_enqueue_style('wp-color-picker'); |
|
| 347 | + wp_enqueue_script('wp-color-picker'); |
|
| 348 | 348 | |
| 349 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
| 349 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
| 350 | 350 | |
| 351 | 351 | if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
| 352 | 352 | $autofill_api = wpinv_get_option('address_autofill_api'); |
@@ -357,21 +357,21 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
| 361 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
| 360 | + wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all'); |
|
| 361 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION); |
|
| 362 | 362 | |
| 363 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' ); |
|
| 364 | - wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ), $version ); |
|
| 365 | - wp_enqueue_script( 'wpinv-admin-script' ); |
|
| 363 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js'); |
|
| 364 | + wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), $version); |
|
| 365 | + wp_enqueue_script('wpinv-admin-script'); |
|
| 366 | 366 | |
| 367 | 367 | $localize = array(); |
| 368 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 369 | - $localize['post_ID'] = isset( $post->ID ) ? $post->ID : ''; |
|
| 370 | - $localize['wpinv_nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 371 | - $localize['add_invoice_note_nonce'] = wp_create_nonce( 'add-invoice-note' ); |
|
| 372 | - $localize['delete_invoice_note_nonce'] = wp_create_nonce( 'delete-invoice-note' ); |
|
| 373 | - $localize['invoice_item_nonce'] = wp_create_nonce( 'invoice-item' ); |
|
| 374 | - $localize['billing_details_nonce'] = wp_create_nonce( 'get-billing-details' ); |
|
| 368 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
| 369 | + $localize['post_ID'] = isset($post->ID) ? $post->ID : ''; |
|
| 370 | + $localize['wpinv_nonce'] = wp_create_nonce('wpinv-nonce'); |
|
| 371 | + $localize['add_invoice_note_nonce'] = wp_create_nonce('add-invoice-note'); |
|
| 372 | + $localize['delete_invoice_note_nonce'] = wp_create_nonce('delete-invoice-note'); |
|
| 373 | + $localize['invoice_item_nonce'] = wp_create_nonce('invoice-item'); |
|
| 374 | + $localize['billing_details_nonce'] = wp_create_nonce('get-billing-details'); |
|
| 375 | 375 | $localize['tax'] = wpinv_tax_amount(); |
| 376 | 376 | $localize['discount'] = wpinv_discount_amount(); |
| 377 | 377 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
@@ -379,99 +379,99 @@ discard block |
||
| 379 | 379 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
| 380 | 380 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
| 381 | 381 | $localize['decimals'] = wpinv_decimals(); |
| 382 | - $localize['save_invoice'] = __( 'Save Invoice', 'invoicing' ); |
|
| 383 | - $localize['status_publish'] = wpinv_status_nicename( 'publish' ); |
|
| 384 | - $localize['status_pending'] = wpinv_status_nicename( 'wpi-pending' ); |
|
| 385 | - $localize['delete_tax_rate'] = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ); |
|
| 386 | - $localize['OneItemMin'] = __( 'Invoice must contain at least one item', 'invoicing' ); |
|
| 387 | - $localize['DeleteInvoiceItem'] = __( 'Are you sure you wish to delete this item?', 'invoicing' ); |
|
| 388 | - $localize['FillBillingDetails'] = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ); |
|
| 389 | - $localize['confirmCalcTotals'] = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ); |
|
| 390 | - $localize['AreYouSure'] = __( 'Are you sure?', 'invoicing' ); |
|
| 391 | - $localize['emptyInvoice'] = __( 'Add at least one item to save invoice!', 'invoicing' ); |
|
| 392 | - $localize['errDeleteItem'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
|
| 393 | - $localize['delete_subscription'] = __( 'Are you sure you want to delete this subscription?', 'invoicing' ); |
|
| 394 | - $localize['action_edit'] = __( 'Edit', 'invoicing' ); |
|
| 395 | - $localize['action_cancel'] = __( 'Cancel', 'invoicing' ); |
|
| 396 | - |
|
| 397 | - $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
| 398 | - |
|
| 399 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
|
| 382 | + $localize['save_invoice'] = __('Save Invoice', 'invoicing'); |
|
| 383 | + $localize['status_publish'] = wpinv_status_nicename('publish'); |
|
| 384 | + $localize['status_pending'] = wpinv_status_nicename('wpi-pending'); |
|
| 385 | + $localize['delete_tax_rate'] = __('Are you sure you wish to delete this tax rate?', 'invoicing'); |
|
| 386 | + $localize['OneItemMin'] = __('Invoice must contain at least one item', 'invoicing'); |
|
| 387 | + $localize['DeleteInvoiceItem'] = __('Are you sure you wish to delete this item?', 'invoicing'); |
|
| 388 | + $localize['FillBillingDetails'] = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'); |
|
| 389 | + $localize['confirmCalcTotals'] = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'); |
|
| 390 | + $localize['AreYouSure'] = __('Are you sure?', 'invoicing'); |
|
| 391 | + $localize['emptyInvoice'] = __('Add at least one item to save invoice!', 'invoicing'); |
|
| 392 | + $localize['errDeleteItem'] = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'); |
|
| 393 | + $localize['delete_subscription'] = __('Are you sure you want to delete this subscription?', 'invoicing'); |
|
| 394 | + $localize['action_edit'] = __('Edit', 'invoicing'); |
|
| 395 | + $localize['action_cancel'] = __('Cancel', 'invoicing'); |
|
| 396 | + |
|
| 397 | + $localize = apply_filters('wpinv_admin_js_localize', $localize); |
|
| 398 | + |
|
| 399 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize); |
|
| 400 | 400 | |
| 401 | 401 | // Load payment form scripts on our admin pages only. |
| 402 | - if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) { |
|
| 402 | + if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) { |
|
| 403 | 403 | |
| 404 | - wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION ); |
|
| 405 | - wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
| 406 | - wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
| 404 | + wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION); |
|
| 405 | + wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION); |
|
| 406 | + wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION); |
|
| 407 | 407 | |
| 408 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
| 409 | - wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
| 408 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js'); |
|
| 409 | + wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version); |
|
| 410 | 410 | |
| 411 | - wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array( |
|
| 411 | + wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array( |
|
| 412 | 412 | 'elements' => $this->form_elements->get_elements(), |
| 413 | - 'form_elements' => $this->form_elements->get_form_elements( $post->ID ), |
|
| 413 | + 'form_elements' => $this->form_elements->get_form_elements($post->ID), |
|
| 414 | 414 | 'all_items' => $this->form_elements->get_published_items(), |
| 415 | 415 | 'currency' => wpinv_currency_symbol(), |
| 416 | 416 | 'position' => wpinv_currency_position(), |
| 417 | 417 | 'decimals' => (int) wpinv_decimals(), |
| 418 | 418 | 'thousands_sep' => wpinv_thousands_separator(), |
| 419 | 419 | 'decimals_sep' => wpinv_decimal_separator(), |
| 420 | - 'form_items' => $this->form_elements->get_form_items( $post->ID ), |
|
| 421 | - ) ); |
|
| 420 | + 'form_items' => $this->form_elements->get_form_items($post->ID), |
|
| 421 | + )); |
|
| 422 | 422 | |
| 423 | - wp_enqueue_script( 'wpinv-admin-payment-form-script' ); |
|
| 423 | + wp_enqueue_script('wpinv-admin-payment-form-script'); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if ( $page == 'wpinv-subscriptions' ) { |
|
| 427 | - wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ), WPINV_VERSION ); |
|
| 428 | - wp_enqueue_script( 'wpinv-sub-admin-script' ); |
|
| 426 | + if ($page == 'wpinv-subscriptions') { |
|
| 427 | + wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION); |
|
| 428 | + wp_enqueue_script('wpinv-sub-admin-script'); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if ( $page == 'wpinv-reports' ) { |
|
| 432 | - wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' ); |
|
| 431 | + if ($page == 'wpinv-reports') { |
|
| 432 | + wp_enqueue_script('jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array('jquery'), '0.7'); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - public function admin_body_class( $classes ) { |
|
| 437 | + public function admin_body_class($classes) { |
|
| 438 | 438 | global $pagenow, $post, $current_screen; |
| 439 | 439 | |
| 440 | - if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote' ) ) { |
|
| 440 | + if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote')) { |
|
| 441 | 441 | $classes .= ' wpinv-cpt'; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 444 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 445 | 445 | |
| 446 | - $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false; |
|
| 447 | - if ( $add_class ) { |
|
| 448 | - $classes .= ' wpi-' . wpinv_sanitize_key( $page ); |
|
| 446 | + $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false; |
|
| 447 | + if ($add_class) { |
|
| 448 | + $classes .= ' wpi-' . wpinv_sanitize_key($page); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | $settings_class = array(); |
| 452 | - if ( $page == 'wpinv-settings' ) { |
|
| 453 | - if ( !empty( $_REQUEST['tab'] ) ) { |
|
| 454 | - $settings_class[] = sanitize_text_field( $_REQUEST['tab'] ); |
|
| 452 | + if ($page == 'wpinv-settings') { |
|
| 453 | + if (!empty($_REQUEST['tab'])) { |
|
| 454 | + $settings_class[] = sanitize_text_field($_REQUEST['tab']); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if ( !empty( $_REQUEST['section'] ) ) { |
|
| 458 | - $settings_class[] = sanitize_text_field( $_REQUEST['section'] ); |
|
| 457 | + if (!empty($_REQUEST['section'])) { |
|
| 458 | + $settings_class[] = sanitize_text_field($_REQUEST['section']); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main'; |
|
| 461 | + $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main'; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if ( !empty( $settings_class ) ) { |
|
| 465 | - $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) ); |
|
| 464 | + if (!empty($settings_class)) { |
|
| 465 | + $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-')); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | $post_type = wpinv_admin_post_type(); |
| 469 | 469 | |
| 470 | - if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) { |
|
| 470 | + if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) { |
|
| 471 | 471 | return $classes .= ' wpinv'; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) { |
|
| 474 | + if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) { |
|
| 475 | 475 | $classes .= ' wpi-editable-n'; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -483,21 +483,21 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | public function wpinv_actions() { |
| 486 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
| 487 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
| 486 | + if (isset($_REQUEST['wpi_action'])) { |
|
| 487 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - public function pre_get_posts( $wp_query ) { |
|
| 492 | - if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
| 493 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
| 491 | + public function pre_get_posts($wp_query) { |
|
| 492 | + if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) { |
|
| 493 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | return $wp_query; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | public function bp_invoicing_init() { |
| 500 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
| 500 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -505,13 +505,13 @@ discard block |
||
| 505 | 505 | * |
| 506 | 506 | */ |
| 507 | 507 | public function register_widgets() { |
| 508 | - register_widget( "WPInv_Checkout_Widget" ); |
|
| 509 | - register_widget( "WPInv_History_Widget" ); |
|
| 510 | - register_widget( "WPInv_Receipt_Widget" ); |
|
| 511 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
| 512 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
| 513 | - register_widget( "WPInv_Messages_Widget" ); |
|
| 514 | - register_widget( 'WPInv_Payment_Form_Widget' ); |
|
| 508 | + register_widget("WPInv_Checkout_Widget"); |
|
| 509 | + register_widget("WPInv_History_Widget"); |
|
| 510 | + register_widget("WPInv_Receipt_Widget"); |
|
| 511 | + register_widget("WPInv_Subscriptions_Widget"); |
|
| 512 | + register_widget("WPInv_Buy_Item_Widget"); |
|
| 513 | + register_widget("WPInv_Messages_Widget"); |
|
| 514 | + register_widget('WPInv_Payment_Form_Widget'); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | * @since 1.0.19 |
| 521 | 521 | * @param int[] $excluded_posts_ids |
| 522 | 522 | */ |
| 523 | - function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
| 523 | + function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) { |
|
| 524 | 524 | |
| 525 | 525 | // Ensure that we have an array. |
| 526 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
| 526 | + if (!is_array($excluded_posts_ids)) { |
|
| 527 | 527 | $excluded_posts_ids = array(); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -531,24 +531,24 @@ discard block |
||
| 531 | 531 | $our_pages = array(); |
| 532 | 532 | |
| 533 | 533 | // Checkout page. |
| 534 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
| 534 | + $our_pages[] = wpinv_get_option('checkout_page', false); |
|
| 535 | 535 | |
| 536 | 536 | // Success page. |
| 537 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
| 537 | + $our_pages[] = wpinv_get_option('success_page', false); |
|
| 538 | 538 | |
| 539 | 539 | // Failure page. |
| 540 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
| 540 | + $our_pages[] = wpinv_get_option('failure_page', false); |
|
| 541 | 541 | |
| 542 | 542 | // History page. |
| 543 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
| 543 | + $our_pages[] = wpinv_get_option('invoice_history_page', false); |
|
| 544 | 544 | |
| 545 | 545 | // Subscriptions page. |
| 546 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
| 546 | + $our_pages[] = wpinv_get_option('invoice_subscription_page', false); |
|
| 547 | 547 | |
| 548 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
| 548 | + $our_pages = array_map('intval', array_filter($our_pages)); |
|
| 549 | 549 | |
| 550 | 550 | $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
| 551 | - return array_unique( $excluded_posts_ids ); |
|
| 551 | + return array_unique($excluded_posts_ids); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | } |