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