@@ -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' ); |
@@ -491,19 +491,19 @@ discard block |
||
491 | 491 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
492 | 492 | } |
493 | 493 | |
494 | - /** |
|
495 | - * Register widgets |
|
496 | - * |
|
497 | - */ |
|
498 | - public function register_widgets() { |
|
499 | - register_widget( "WPInv_Checkout_Widget" ); |
|
500 | - register_widget( "WPInv_History_Widget" ); |
|
501 | - register_widget( "WPInv_Receipt_Widget" ); |
|
502 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
503 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
494 | + /** |
|
495 | + * Register widgets |
|
496 | + * |
|
497 | + */ |
|
498 | + public function register_widgets() { |
|
499 | + register_widget( "WPInv_Checkout_Widget" ); |
|
500 | + register_widget( "WPInv_History_Widget" ); |
|
501 | + register_widget( "WPInv_Receipt_Widget" ); |
|
502 | + register_widget( "WPInv_Subscriptions_Widget" ); |
|
503 | + register_widget( "WPInv_Buy_Item_Widget" ); |
|
504 | 504 | register_widget( "WPInv_Messages_Widget" ); |
505 | 505 | register_widget( 'WPInv_Payment_Form_Widget' ); |
506 | - } |
|
506 | + } |
|
507 | 507 | |
508 | 508 | /** |
509 | 509 | * 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,237 +112,237 @@ 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'] = __( 'Complete', 'invoicing' ); |
|
281 | + $localize['txtComplete'] = __('Complete', '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' ), $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'), $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' ); |
|
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 | 324 | } |
325 | 325 | |
326 | - wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
|
327 | - wp_enqueue_style( 'wpinv_meta_box_style' ); |
|
326 | + wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION); |
|
327 | + wp_enqueue_style('wpinv_meta_box_style'); |
|
328 | 328 | |
329 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' ); |
|
330 | - wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version ); |
|
331 | - wp_enqueue_style( 'wpinv_admin_style' ); |
|
329 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css'); |
|
330 | + wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version); |
|
331 | + wp_enqueue_style('wpinv_admin_style'); |
|
332 | 332 | |
333 | - $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ); |
|
334 | - if ( $page == 'wpinv-subscriptions' ) { |
|
335 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
333 | + $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')); |
|
334 | + if ($page == 'wpinv-subscriptions') { |
|
335 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
336 | 336 | } |
337 | 337 | |
338 | - if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) { |
|
339 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
338 | + if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) { |
|
339 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
340 | 340 | } |
341 | 341 | |
342 | - wp_enqueue_style( 'wp-color-picker' ); |
|
343 | - wp_enqueue_script( 'wp-color-picker' ); |
|
342 | + wp_enqueue_style('wp-color-picker'); |
|
343 | + wp_enqueue_script('wp-color-picker'); |
|
344 | 344 | |
345 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
345 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
346 | 346 | |
347 | 347 | if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
348 | 348 | $autofill_api = wpinv_get_option('address_autofill_api'); |
@@ -353,21 +353,21 @@ discard block |
||
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | - wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
357 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
356 | + wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all'); |
|
357 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION); |
|
358 | 358 | |
359 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' ); |
|
360 | - wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ), $version ); |
|
361 | - wp_enqueue_script( 'wpinv-admin-script' ); |
|
359 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js'); |
|
360 | + wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), $version); |
|
361 | + wp_enqueue_script('wpinv-admin-script'); |
|
362 | 362 | |
363 | 363 | $localize = array(); |
364 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
365 | - $localize['post_ID'] = isset( $post->ID ) ? $post->ID : ''; |
|
366 | - $localize['wpinv_nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
367 | - $localize['add_invoice_note_nonce'] = wp_create_nonce( 'add-invoice-note' ); |
|
368 | - $localize['delete_invoice_note_nonce'] = wp_create_nonce( 'delete-invoice-note' ); |
|
369 | - $localize['invoice_item_nonce'] = wp_create_nonce( 'invoice-item' ); |
|
370 | - $localize['billing_details_nonce'] = wp_create_nonce( 'get-billing-details' ); |
|
364 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
365 | + $localize['post_ID'] = isset($post->ID) ? $post->ID : ''; |
|
366 | + $localize['wpinv_nonce'] = wp_create_nonce('wpinv-nonce'); |
|
367 | + $localize['add_invoice_note_nonce'] = wp_create_nonce('add-invoice-note'); |
|
368 | + $localize['delete_invoice_note_nonce'] = wp_create_nonce('delete-invoice-note'); |
|
369 | + $localize['invoice_item_nonce'] = wp_create_nonce('invoice-item'); |
|
370 | + $localize['billing_details_nonce'] = wp_create_nonce('get-billing-details'); |
|
371 | 371 | $localize['tax'] = wpinv_tax_amount(); |
372 | 372 | $localize['discount'] = wpinv_discount_amount(); |
373 | 373 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
@@ -375,95 +375,95 @@ discard block |
||
375 | 375 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
376 | 376 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
377 | 377 | $localize['decimals'] = wpinv_decimals(); |
378 | - $localize['save_invoice'] = __( 'Save Invoice', 'invoicing' ); |
|
379 | - $localize['status_publish'] = wpinv_status_nicename( 'publish' ); |
|
380 | - $localize['status_pending'] = wpinv_status_nicename( 'wpi-pending' ); |
|
381 | - $localize['delete_tax_rate'] = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ); |
|
382 | - $localize['OneItemMin'] = __( 'Invoice must contain at least one item', 'invoicing' ); |
|
383 | - $localize['DeleteInvoiceItem'] = __( 'Are you sure you wish to delete this item?', 'invoicing' ); |
|
384 | - $localize['FillBillingDetails'] = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ); |
|
385 | - $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' ); |
|
386 | - $localize['AreYouSure'] = __( 'Are you sure?', 'invoicing' ); |
|
387 | - $localize['emptyInvoice'] = __( 'Add at least one item to save invoice!', 'invoicing' ); |
|
388 | - $localize['errDeleteItem'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
|
389 | - $localize['delete_subscription'] = __( 'Are you sure you want to delete this subscription?', 'invoicing' ); |
|
390 | - $localize['action_edit'] = __( 'Edit', 'invoicing' ); |
|
391 | - $localize['action_cancel'] = __( 'Cancel', 'invoicing' ); |
|
392 | - |
|
393 | - $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
394 | - |
|
395 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
|
378 | + $localize['save_invoice'] = __('Save Invoice', 'invoicing'); |
|
379 | + $localize['status_publish'] = wpinv_status_nicename('publish'); |
|
380 | + $localize['status_pending'] = wpinv_status_nicename('wpi-pending'); |
|
381 | + $localize['delete_tax_rate'] = __('Are you sure you wish to delete this tax rate?', 'invoicing'); |
|
382 | + $localize['OneItemMin'] = __('Invoice must contain at least one item', 'invoicing'); |
|
383 | + $localize['DeleteInvoiceItem'] = __('Are you sure you wish to delete this item?', 'invoicing'); |
|
384 | + $localize['FillBillingDetails'] = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'); |
|
385 | + $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'); |
|
386 | + $localize['AreYouSure'] = __('Are you sure?', 'invoicing'); |
|
387 | + $localize['emptyInvoice'] = __('Add at least one item to save invoice!', 'invoicing'); |
|
388 | + $localize['errDeleteItem'] = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'); |
|
389 | + $localize['delete_subscription'] = __('Are you sure you want to delete this subscription?', 'invoicing'); |
|
390 | + $localize['action_edit'] = __('Edit', 'invoicing'); |
|
391 | + $localize['action_cancel'] = __('Cancel', 'invoicing'); |
|
392 | + |
|
393 | + $localize = apply_filters('wpinv_admin_js_localize', $localize); |
|
394 | + |
|
395 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize); |
|
396 | 396 | |
397 | 397 | // Load payment form scripts on our admin pages only. |
398 | - if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) { |
|
398 | + if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) { |
|
399 | 399 | |
400 | - wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION ); |
|
401 | - wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
402 | - wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
400 | + wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION); |
|
401 | + wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION); |
|
402 | + wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION); |
|
403 | 403 | |
404 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
405 | - wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
404 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js'); |
|
405 | + wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version); |
|
406 | 406 | |
407 | - wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array( |
|
407 | + wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array( |
|
408 | 408 | 'elements' => $this->form_elements->get_elements(), |
409 | - 'form_elements' => $this->form_elements->get_form_elements( $post->ID ), |
|
409 | + 'form_elements' => $this->form_elements->get_form_elements($post->ID), |
|
410 | 410 | 'all_items' => $this->form_elements->get_published_items(), |
411 | 411 | 'currency' => wpinv_currency_symbol(), |
412 | 412 | 'position' => wpinv_currency_position(), |
413 | 413 | 'decimals' => (int) wpinv_decimals(), |
414 | 414 | 'thousands_sep' => wpinv_thousands_separator(), |
415 | 415 | 'decimals_sep' => wpinv_decimal_separator(), |
416 | - 'form_items' => $this->form_elements->get_form_items( $post->ID ), |
|
417 | - ) ); |
|
416 | + 'form_items' => $this->form_elements->get_form_items($post->ID), |
|
417 | + )); |
|
418 | 418 | |
419 | - wp_enqueue_script( 'wpinv-admin-payment-form-script' ); |
|
419 | + wp_enqueue_script('wpinv-admin-payment-form-script'); |
|
420 | 420 | } |
421 | 421 | |
422 | - if ( $page == 'wpinv-subscriptions' ) { |
|
423 | - wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ), WPINV_VERSION ); |
|
424 | - wp_enqueue_script( 'wpinv-sub-admin-script' ); |
|
422 | + if ($page == 'wpinv-subscriptions') { |
|
423 | + wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION); |
|
424 | + wp_enqueue_script('wpinv-sub-admin-script'); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | } |
428 | 428 | |
429 | - public function admin_body_class( $classes ) { |
|
429 | + public function admin_body_class($classes) { |
|
430 | 430 | global $pagenow, $post, $current_screen; |
431 | 431 | |
432 | - 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' ) ) { |
|
432 | + 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')) { |
|
433 | 433 | $classes .= ' wpinv-cpt'; |
434 | 434 | } |
435 | 435 | |
436 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
436 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
437 | 437 | |
438 | - $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false; |
|
439 | - if ( $add_class ) { |
|
440 | - $classes .= ' wpi-' . wpinv_sanitize_key( $page ); |
|
438 | + $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false; |
|
439 | + if ($add_class) { |
|
440 | + $classes .= ' wpi-' . wpinv_sanitize_key($page); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | $settings_class = array(); |
444 | - if ( $page == 'wpinv-settings' ) { |
|
445 | - if ( !empty( $_REQUEST['tab'] ) ) { |
|
446 | - $settings_class[] = sanitize_text_field( $_REQUEST['tab'] ); |
|
444 | + if ($page == 'wpinv-settings') { |
|
445 | + if (!empty($_REQUEST['tab'])) { |
|
446 | + $settings_class[] = sanitize_text_field($_REQUEST['tab']); |
|
447 | 447 | } |
448 | 448 | |
449 | - if ( !empty( $_REQUEST['section'] ) ) { |
|
450 | - $settings_class[] = sanitize_text_field( $_REQUEST['section'] ); |
|
449 | + if (!empty($_REQUEST['section'])) { |
|
450 | + $settings_class[] = sanitize_text_field($_REQUEST['section']); |
|
451 | 451 | } |
452 | 452 | |
453 | - $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main'; |
|
453 | + $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main'; |
|
454 | 454 | } |
455 | 455 | |
456 | - if ( !empty( $settings_class ) ) { |
|
457 | - $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) ); |
|
456 | + if (!empty($settings_class)) { |
|
457 | + $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-')); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | $post_type = wpinv_admin_post_type(); |
461 | 461 | |
462 | - if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) { |
|
462 | + if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) { |
|
463 | 463 | return $classes .= ' wpinv'; |
464 | 464 | } |
465 | 465 | |
466 | - if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) { |
|
466 | + if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) { |
|
467 | 467 | $classes .= ' wpi-editable-n'; |
468 | 468 | } |
469 | 469 | |
@@ -475,21 +475,21 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | public function wpinv_actions() { |
478 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
479 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
478 | + if (isset($_REQUEST['wpi_action'])) { |
|
479 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | - public function pre_get_posts( $wp_query ) { |
|
484 | - 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() ) { |
|
485 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
483 | + public function pre_get_posts($wp_query) { |
|
484 | + 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()) { |
|
485 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | return $wp_query; |
489 | 489 | } |
490 | 490 | |
491 | 491 | public function bp_invoicing_init() { |
492 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
492 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | * |
498 | 498 | */ |
499 | 499 | public function register_widgets() { |
500 | - register_widget( "WPInv_Checkout_Widget" ); |
|
501 | - register_widget( "WPInv_History_Widget" ); |
|
502 | - register_widget( "WPInv_Receipt_Widget" ); |
|
503 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
504 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
505 | - register_widget( "WPInv_Messages_Widget" ); |
|
506 | - register_widget( 'WPInv_Payment_Form_Widget' ); |
|
500 | + register_widget("WPInv_Checkout_Widget"); |
|
501 | + register_widget("WPInv_History_Widget"); |
|
502 | + register_widget("WPInv_Receipt_Widget"); |
|
503 | + register_widget("WPInv_Subscriptions_Widget"); |
|
504 | + register_widget("WPInv_Buy_Item_Widget"); |
|
505 | + register_widget("WPInv_Messages_Widget"); |
|
506 | + register_widget('WPInv_Payment_Form_Widget'); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | * @since 1.0.19 |
513 | 513 | * @param int[] $excluded_posts_ids |
514 | 514 | */ |
515 | - function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
515 | + function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) { |
|
516 | 516 | |
517 | 517 | // Ensure that we have an array. |
518 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
518 | + if (!is_array($excluded_posts_ids)) { |
|
519 | 519 | $excluded_posts_ids = array(); |
520 | 520 | } |
521 | 521 | |
@@ -523,24 +523,24 @@ discard block |
||
523 | 523 | $our_pages = array(); |
524 | 524 | |
525 | 525 | // Checkout page. |
526 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
526 | + $our_pages[] = wpinv_get_option('checkout_page', false); |
|
527 | 527 | |
528 | 528 | // Success page. |
529 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
529 | + $our_pages[] = wpinv_get_option('success_page', false); |
|
530 | 530 | |
531 | 531 | // Failure page. |
532 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
532 | + $our_pages[] = wpinv_get_option('failure_page', false); |
|
533 | 533 | |
534 | 534 | // History page. |
535 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
535 | + $our_pages[] = wpinv_get_option('invoice_history_page', false); |
|
536 | 536 | |
537 | 537 | // Subscriptions page. |
538 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
538 | + $our_pages[] = wpinv_get_option('invoice_subscription_page', false); |
|
539 | 539 | |
540 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
540 | + $our_pages = array_map('intval', array_filter($our_pages)); |
|
541 | 541 | |
542 | 542 | $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
543 | - return array_unique( $excluded_posts_ids ); |
|
543 | + return array_unique($excluded_posts_ids); |
|
544 | 544 | |
545 | 545 | } |
546 | 546 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high' ); |
37 | 37 | } |
38 | 38 | |
39 | - remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
39 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
40 | 40 | } |
41 | 41 | add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 ); |
42 | 42 |
@@ -1,74 +1,74 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | -function wpinv_add_meta_boxes( $post_type, $post ) { |
|
7 | +function wpinv_add_meta_boxes($post_type, $post) { |
|
8 | 8 | global $wpi_mb_invoice; |
9 | - if ( $post_type == 'wpi_invoice' && !empty( $post->ID ) ) { |
|
10 | - $wpi_mb_invoice = wpinv_get_invoice( $post->ID ); |
|
9 | + if ($post_type == 'wpi_invoice' && !empty($post->ID)) { |
|
10 | + $wpi_mb_invoice = wpinv_get_invoice($post->ID); |
|
11 | 11 | } |
12 | 12 | |
13 | - if ( !empty( $wpi_mb_invoice ) && !$wpi_mb_invoice->has_status( array( 'draft', 'auto-draft' ) ) ) { |
|
14 | - add_meta_box( 'wpinv-mb-resend-invoice', __( 'Resend Invoice', 'invoicing' ), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high' ); |
|
13 | + if (!empty($wpi_mb_invoice) && !$wpi_mb_invoice->has_status(array('draft', 'auto-draft'))) { |
|
14 | + add_meta_box('wpinv-mb-resend-invoice', __('Resend Invoice', 'invoicing'), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high'); |
|
15 | 15 | } |
16 | 16 | |
17 | - if ( !empty( $wpi_mb_invoice ) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent() ) { |
|
18 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscriptions', 'invoicing' ), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high' ); |
|
17 | + if (!empty($wpi_mb_invoice) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent()) { |
|
18 | + add_meta_box('wpinv-mb-subscriptions', __('Subscriptions', 'invoicing'), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high'); |
|
19 | 19 | } |
20 | 20 | |
21 | - if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) { |
|
22 | - add_meta_box( 'wpinv-mb-renewals', __( 'Renewal Payment', 'invoicing' ), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high' ); |
|
21 | + if (wpinv_is_subscription_payment($wpi_mb_invoice)) { |
|
22 | + add_meta_box('wpinv-mb-renewals', __('Renewal Payment', 'invoicing'), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high'); |
|
23 | 23 | } |
24 | 24 | |
25 | - add_meta_box( 'wpinv-details', __( 'Invoice Details', 'invoicing' ), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default' ); |
|
26 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default' ); |
|
25 | + add_meta_box('wpinv-details', __('Invoice Details', 'invoicing'), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default'); |
|
26 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default'); |
|
27 | 27 | |
28 | - add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' ); |
|
29 | - add_meta_box( 'wpinv-payment-form-shortcode', __( 'Shortcode', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_shortcode', 'wpi_payment_form', 'side' ); |
|
28 | + add_meta_box('wpinv-payment-form-design', __('Payment Form', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal'); |
|
29 | + add_meta_box('wpinv-payment-form-shortcode', __('Shortcode', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_shortcode', 'wpi_payment_form', 'side'); |
|
30 | 30 | |
31 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high' ); |
|
32 | - add_meta_box( 'wpinv-items', __( 'Invoice Items', 'invoicing' ), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high' ); |
|
33 | - add_meta_box( 'wpinv-notes', __( 'Invoice Notes', 'invoicing' ), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high' ); |
|
31 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high'); |
|
32 | + add_meta_box('wpinv-items', __('Invoice Items', 'invoicing'), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high'); |
|
33 | + add_meta_box('wpinv-notes', __('Invoice Notes', 'invoicing'), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high'); |
|
34 | 34 | |
35 | - if ( ! empty( $post->ID ) && get_post_meta( $post->ID, 'payment_form_data', true ) ) { |
|
36 | - add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high' ); |
|
35 | + if (!empty($post->ID) && get_post_meta($post->ID, 'payment_form_data', true)) { |
|
36 | + add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
40 | 40 | } |
41 | -add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 ); |
|
41 | +add_action('add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2); |
|
42 | 42 | |
43 | -function wpinv_save_meta_boxes( $post_id, $post, $update = false ) { |
|
44 | - remove_action( 'save_post', __FUNCTION__ ); |
|
43 | +function wpinv_save_meta_boxes($post_id, $post, $update = false) { |
|
44 | + remove_action('save_post', __FUNCTION__); |
|
45 | 45 | |
46 | 46 | // $post_id and $post are required |
47 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
47 | + if (empty($post_id) || empty($post)) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
51 | - if ( !current_user_can( 'edit_post', $post_id ) || empty( $post->post_type ) ) { |
|
51 | + if (!current_user_can('edit_post', $post_id) || empty($post->post_type)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Dont' save meta boxes for revisions or autosaves |
56 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
56 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | - if ( $post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote' ) { |
|
61 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
60 | + if ($post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote') { |
|
61 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - if ( isset( $_POST['wpinv_save_invoice'] ) && wp_verify_nonce( $_POST['wpinv_save_invoice'], 'wpinv_save_invoice' ) ) { |
|
66 | - WPInv_Meta_Box_Items::save( $post_id, $_POST, $post ); |
|
65 | + if (isset($_POST['wpinv_save_invoice']) && wp_verify_nonce($_POST['wpinv_save_invoice'], 'wpinv_save_invoice')) { |
|
66 | + WPInv_Meta_Box_Items::save($post_id, $_POST, $post); |
|
67 | 67 | } |
68 | - } else if ( $post->post_type == 'wpi_item' ) { |
|
68 | + } else if ($post->post_type == 'wpi_item') { |
|
69 | 69 | // verify nonce |
70 | - if ( isset( $_POST['wpinv_vat_meta_box_nonce'] ) && wp_verify_nonce( $_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save' ) ) { |
|
71 | - $fields = array(); |
|
70 | + if (isset($_POST['wpinv_vat_meta_box_nonce']) && wp_verify_nonce($_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save')) { |
|
71 | + $fields = array(); |
|
72 | 72 | $fields['_wpinv_price'] = 'wpinv_item_price'; |
73 | 73 | $fields['_wpinv_vat_class'] = 'wpinv_vat_class'; |
74 | 74 | $fields['_wpinv_vat_rule'] = 'wpinv_vat_rules'; |
@@ -83,96 +83,96 @@ discard block |
||
83 | 83 | $fields['_wpinv_dynamic_pricing'] = 'wpinv_name_your_price'; |
84 | 84 | $fields['_minimum_price'] = 'wpinv_minimum_price'; |
85 | 85 | |
86 | - if ( !isset( $_POST['wpinv_is_recurring'] ) ) { |
|
86 | + if (!isset($_POST['wpinv_is_recurring'])) { |
|
87 | 87 | $_POST['wpinv_is_recurring'] = 0; |
88 | 88 | } |
89 | 89 | |
90 | - if ( !isset( $_POST['wpinv_name_your_price'] ) ) { |
|
90 | + if (!isset($_POST['wpinv_name_your_price'])) { |
|
91 | 91 | $_POST['wpinv_name_your_price'] = 0; |
92 | 92 | } |
93 | 93 | |
94 | - if ( !isset( $_POST['wpinv_free_trial'] ) || empty( $_POST['wpinv_is_recurring'] ) ) { |
|
94 | + if (!isset($_POST['wpinv_free_trial']) || empty($_POST['wpinv_is_recurring'])) { |
|
95 | 95 | $_POST['wpinv_free_trial'] = 0; |
96 | 96 | } |
97 | 97 | |
98 | - foreach ( $fields as $field => $name ) { |
|
99 | - if ( isset( $_POST[ $name ] ) ) { |
|
100 | - $allowed = apply_filters( 'wpinv_item_allowed_save_meta_value', true, $field, $post_id ); |
|
98 | + foreach ($fields as $field => $name) { |
|
99 | + if (isset($_POST[$name])) { |
|
100 | + $allowed = apply_filters('wpinv_item_allowed_save_meta_value', true, $field, $post_id); |
|
101 | 101 | |
102 | - if ( !$allowed ) { |
|
102 | + if (!$allowed) { |
|
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | |
106 | - if ( $field == '_wpinv_price' ) { |
|
107 | - $value = wpinv_sanitize_amount( $_POST[ $name ] ); |
|
106 | + if ($field == '_wpinv_price') { |
|
107 | + $value = wpinv_sanitize_amount($_POST[$name]); |
|
108 | 108 | } else { |
109 | - $value = is_string( $_POST[ $name ] ) ? sanitize_text_field( $_POST[ $name ] ) : $_POST[ $name ]; |
|
109 | + $value = is_string($_POST[$name]) ? sanitize_text_field($_POST[$name]) : $_POST[$name]; |
|
110 | 110 | } |
111 | 111 | |
112 | - $value = apply_filters( 'wpinv_item_metabox_save_' . $field, $value, $name ); |
|
113 | - update_post_meta( $post_id, $field, $value ); |
|
112 | + $value = apply_filters('wpinv_item_metabox_save_' . $field, $value, $name); |
|
113 | + update_post_meta($post_id, $field, $value); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - if ( !get_post_meta( $post_id, '_wpinv_custom_id', true ) ) { |
|
118 | - update_post_meta( $post_id, '_wpinv_custom_id', $post_id ); |
|
117 | + if (!get_post_meta($post_id, '_wpinv_custom_id', true)) { |
|
118 | + update_post_meta($post_id, '_wpinv_custom_id', $post_id); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
123 | -add_action( 'save_post', 'wpinv_save_meta_boxes', 10, 3 ); |
|
123 | +add_action('save_post', 'wpinv_save_meta_boxes', 10, 3); |
|
124 | 124 | |
125 | 125 | function wpinv_register_item_meta_boxes() { |
126 | 126 | global $wpinv_euvat; |
127 | 127 | |
128 | - add_meta_box( 'wpinv_field_prices', __( 'Item Price', 'invoicing' ), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high' ); |
|
128 | + add_meta_box('wpinv_field_prices', __('Item Price', 'invoicing'), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high'); |
|
129 | 129 | |
130 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
131 | - add_meta_box( 'wpinv_field_vat_rules', __( 'VAT rules type to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high' ); |
|
130 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
131 | + add_meta_box('wpinv_field_vat_rules', __('VAT rules type to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high'); |
|
132 | 132 | } |
133 | 133 | |
134 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
135 | - add_meta_box( 'wpinv_field_vat_classes', __( 'VAT rates class to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high' ); |
|
134 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
135 | + add_meta_box('wpinv_field_vat_classes', __('VAT rates class to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high'); |
|
136 | 136 | } |
137 | 137 | |
138 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core' ); |
|
139 | - add_meta_box( 'wpinv_field_meta_values', __( 'Item Meta Values', 'invoicing' ), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core' ); |
|
138 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core'); |
|
139 | + add_meta_box('wpinv_field_meta_values', __('Item Meta Values', 'invoicing'), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | function wpinv_register_discount_meta_boxes() { |
143 | - add_meta_box( 'wpinv_discount_fields', __( 'Discount Details', 'invoicing' ), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high' ); |
|
143 | + add_meta_box('wpinv_discount_fields', __('Discount Details', 'invoicing'), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high'); |
|
144 | 144 | } |
145 | 145 | |
146 | -function wpinv_discount_metabox_details( $post ) { |
|
146 | +function wpinv_discount_metabox_details($post) { |
|
147 | 147 | $discount_id = $post->ID; |
148 | - $discount = wpinv_get_discount( $discount_id ); |
|
148 | + $discount = wpinv_get_discount($discount_id); |
|
149 | 149 | |
150 | - $type = wpinv_get_discount_type( $discount_id ); |
|
151 | - $item_reqs = wpinv_get_discount_item_reqs( $discount_id ); |
|
152 | - $excluded_items = wpinv_get_discount_excluded_items( $discount_id ); |
|
153 | - $min_total = wpinv_get_discount_min_total( $discount_id ); |
|
154 | - $max_total = wpinv_get_discount_max_total( $discount_id ); |
|
155 | - $max_uses = wpinv_get_discount_max_uses( $discount_id ); |
|
156 | - $single_use = wpinv_discount_is_single_use( $discount_id ); |
|
157 | - $recurring = (bool)wpinv_discount_is_recurring( $discount_id ); |
|
158 | - $start_date = wpinv_get_discount_start_date( $discount_id ); |
|
159 | - $expiration_date = wpinv_get_discount_expiration( $discount_id ); |
|
150 | + $type = wpinv_get_discount_type($discount_id); |
|
151 | + $item_reqs = wpinv_get_discount_item_reqs($discount_id); |
|
152 | + $excluded_items = wpinv_get_discount_excluded_items($discount_id); |
|
153 | + $min_total = wpinv_get_discount_min_total($discount_id); |
|
154 | + $max_total = wpinv_get_discount_max_total($discount_id); |
|
155 | + $max_uses = wpinv_get_discount_max_uses($discount_id); |
|
156 | + $single_use = wpinv_discount_is_single_use($discount_id); |
|
157 | + $recurring = (bool) wpinv_discount_is_recurring($discount_id); |
|
158 | + $start_date = wpinv_get_discount_start_date($discount_id); |
|
159 | + $expiration_date = wpinv_get_discount_expiration($discount_id); |
|
160 | 160 | |
161 | - if ( ! empty( $start_date ) && strpos( $start_date, '0000' ) === false ) { |
|
162 | - $start_time = strtotime( $start_date ); |
|
163 | - $start_h = date_i18n( 'H', $start_time ); |
|
164 | - $start_m = date_i18n( 'i', $start_time ); |
|
165 | - $start_date = date_i18n( 'Y-m-d', $start_time ); |
|
161 | + if (!empty($start_date) && strpos($start_date, '0000') === false) { |
|
162 | + $start_time = strtotime($start_date); |
|
163 | + $start_h = date_i18n('H', $start_time); |
|
164 | + $start_m = date_i18n('i', $start_time); |
|
165 | + $start_date = date_i18n('Y-m-d', $start_time); |
|
166 | 166 | } else { |
167 | 167 | $start_h = '00'; |
168 | 168 | $start_m = '00'; |
169 | 169 | } |
170 | 170 | |
171 | - if ( ! empty( $expiration_date ) && strpos( $expiration_date, '0000' ) === false ) { |
|
172 | - $expiration_time = strtotime( $expiration_date ); |
|
173 | - $expiration_h = date_i18n( 'H', $expiration_time ); |
|
174 | - $expiration_m = date_i18n( 'i', $expiration_time ); |
|
175 | - $expiration_date = date_i18n( 'Y-m-d', $expiration_time ); |
|
171 | + if (!empty($expiration_date) && strpos($expiration_date, '0000') === false) { |
|
172 | + $expiration_time = strtotime($expiration_date); |
|
173 | + $expiration_h = date_i18n('H', $expiration_time); |
|
174 | + $expiration_m = date_i18n('i', $expiration_time); |
|
175 | + $expiration_date = date_i18n('Y-m-d', $expiration_time); |
|
176 | 176 | } else { |
177 | 177 | $expiration_h = '23'; |
178 | 178 | $expiration_m = '59'; |
@@ -182,207 +182,207 @@ discard block |
||
182 | 182 | $max_total = $max_total > 0 ? $max_total : ''; |
183 | 183 | $max_uses = $max_uses > 0 ? $max_uses : ''; |
184 | 184 | ?> |
185 | -<?php do_action( 'wpinv_discount_form_top', $post ); ?> |
|
186 | -<?php wp_nonce_field( 'wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce' ); ;?> |
|
185 | +<?php do_action('wpinv_discount_form_top', $post); ?> |
|
186 | +<?php wp_nonce_field('wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce'); ;?> |
|
187 | 187 | <table class="form-table wpi-form-table"> |
188 | 188 | <tbody> |
189 | - <?php do_action( 'wpinv_discount_form_first', $post ); ?> |
|
190 | - <?php do_action( 'wpinv_discount_form_before_code', $post ); ?> |
|
189 | + <?php do_action('wpinv_discount_form_first', $post); ?> |
|
190 | + <?php do_action('wpinv_discount_form_before_code', $post); ?> |
|
191 | 191 | <tr> |
192 | 192 | <th valign="top" scope="row"> |
193 | - <label for="wpinv_discount_code"><?php _e( 'Discount Code', 'invoicing' ); ?></label> |
|
193 | + <label for="wpinv_discount_code"><?php _e('Discount Code', 'invoicing'); ?></label> |
|
194 | 194 | </th> |
195 | 195 | <td> |
196 | - <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr( wpinv_get_discount_code( $discount_id ) ); ?>" required> |
|
197 | - <p class="description"><?php _e( 'Enter a code for this discount, such as 10OFF', 'invoicing' ); ?></p> |
|
196 | + <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr(wpinv_get_discount_code($discount_id)); ?>" required> |
|
197 | + <p class="description"><?php _e('Enter a code for this discount, such as 10OFF', 'invoicing'); ?></p> |
|
198 | 198 | </td> |
199 | 199 | </tr> |
200 | - <?php do_action( 'wpinv_discount_form_before_type', $post ); ?> |
|
200 | + <?php do_action('wpinv_discount_form_before_type', $post); ?> |
|
201 | 201 | <tr> |
202 | 202 | <th valign="top" scope="row"> |
203 | - <label for="wpinv_discount_type"><?php _e( 'Discount Type', 'invoicing' ); ?></label> |
|
203 | + <label for="wpinv_discount_type"><?php _e('Discount Type', 'invoicing'); ?></label> |
|
204 | 204 | </th> |
205 | 205 | <td> |
206 | 206 | <select id="wpinv_discount_type" name="type" class="medium-text wpi_select2"> |
207 | - <?php foreach ( wpinv_get_discount_types() as $value => $label ) { ?> |
|
208 | - <option value="<?php echo $value ;?>" <?php selected( $type, $value ); ?>><?php echo $label; ?></option> |
|
207 | + <?php foreach (wpinv_get_discount_types() as $value => $label) { ?> |
|
208 | + <option value="<?php echo $value; ?>" <?php selected($type, $value); ?>><?php echo $label; ?></option> |
|
209 | 209 | <?php } ?> |
210 | 210 | </select> |
211 | - <p class="description"><?php _e( 'The kind of discount to apply for this discount.', 'invoicing' ); ?></p> |
|
211 | + <p class="description"><?php _e('The kind of discount to apply for this discount.', 'invoicing'); ?></p> |
|
212 | 212 | </td> |
213 | 213 | </tr> |
214 | - <?php do_action( 'wpinv_discount_form_before_amount', $post ); ?> |
|
214 | + <?php do_action('wpinv_discount_form_before_amount', $post); ?> |
|
215 | 215 | <tr> |
216 | 216 | <th valign="top" scope="row"> |
217 | - <label for="wpinv_discount_amount"><?php _e( 'Amount', 'invoicing' ); ?></label> |
|
217 | + <label for="wpinv_discount_amount"><?php _e('Amount', 'invoicing'); ?></label> |
|
218 | 218 | </th> |
219 | 219 | <td> |
220 | - <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr( wpinv_get_discount_amount( $discount_id ) ); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol() ;?></font> |
|
221 | - <p style="display:none;" class="description"><?php _e( 'Enter the discount amount in USD', 'invoicing' ); ?></p> |
|
222 | - <p class="description"><?php _e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?></p> |
|
220 | + <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr(wpinv_get_discount_amount($discount_id)); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol(); ?></font> |
|
221 | + <p style="display:none;" class="description"><?php _e('Enter the discount amount in USD', 'invoicing'); ?></p> |
|
222 | + <p class="description"><?php _e('Enter the discount value. Ex: 10', 'invoicing'); ?></p> |
|
223 | 223 | </td> |
224 | 224 | </tr> |
225 | - <?php do_action( 'wpinv_discount_form_before_items', $post ); ?> |
|
225 | + <?php do_action('wpinv_discount_form_before_items', $post); ?> |
|
226 | 226 | <tr> |
227 | 227 | <th valign="top" scope="row"> |
228 | - <label for="wpinv_discount_items"><?php _e( 'Items', 'invoicing' ); ?></label> |
|
228 | + <label for="wpinv_discount_items"><?php _e('Items', 'invoicing'); ?></label> |
|
229 | 229 | </th> |
230 | 230 | <td> |
231 | - <p><?php echo wpinv_item_dropdown( array( |
|
231 | + <p><?php echo wpinv_item_dropdown(array( |
|
232 | 232 | 'name' => 'items[]', |
233 | 233 | 'id' => 'items', |
234 | 234 | 'selected' => $item_reqs, |
235 | 235 | 'multiple' => true, |
236 | 236 | 'class' => 'medium-text wpi_select2', |
237 | - 'placeholder' => __( 'Select one or more Items', 'invoicing' ), |
|
237 | + 'placeholder' => __('Select one or more Items', 'invoicing'), |
|
238 | 238 | 'show_recurring' => true, |
239 | - ) ); ?> |
|
239 | + )); ?> |
|
240 | 240 | </p> |
241 | - <p class="description"><?php _e( 'Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing' ); ?></p> |
|
241 | + <p class="description"><?php _e('Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing'); ?></p> |
|
242 | 242 | </td> |
243 | 243 | </tr> |
244 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $post ); ?> |
|
244 | + <?php do_action('wpinv_discount_form_before_excluded_items', $post); ?> |
|
245 | 245 | <tr> |
246 | 246 | <th valign="top" scope="row"> |
247 | - <label for="wpinv_discount_excluded_items"><?php _e( 'Excluded Items', 'invoicing' ); ?></label> |
|
247 | + <label for="wpinv_discount_excluded_items"><?php _e('Excluded Items', 'invoicing'); ?></label> |
|
248 | 248 | </th> |
249 | 249 | <td> |
250 | - <p><?php echo wpinv_item_dropdown( array( |
|
250 | + <p><?php echo wpinv_item_dropdown(array( |
|
251 | 251 | 'name' => 'excluded_items[]', |
252 | 252 | 'id' => 'excluded_items', |
253 | 253 | 'selected' => $excluded_items, |
254 | 254 | 'multiple' => true, |
255 | 255 | 'class' => 'medium-text wpi_select2', |
256 | - 'placeholder' => __( 'Select one or more Items', 'invoicing' ), |
|
256 | + 'placeholder' => __('Select one or more Items', 'invoicing'), |
|
257 | 257 | 'show_recurring' => true, |
258 | - ) ); ?> |
|
258 | + )); ?> |
|
259 | 259 | </p> |
260 | - <p class="description"><?php _e( 'Items which are NOT allowed to use this discount.', 'invoicing' ); ?></p> |
|
260 | + <p class="description"><?php _e('Items which are NOT allowed to use this discount.', 'invoicing'); ?></p> |
|
261 | 261 | </td> |
262 | 262 | </tr> |
263 | - <?php do_action( 'wpinv_discount_form_before_start', $post ); ?> |
|
263 | + <?php do_action('wpinv_discount_form_before_start', $post); ?> |
|
264 | 264 | <tr> |
265 | 265 | <th valign="top" scope="row"> |
266 | - <label for="wpinv_discount_start"><?php _e( 'Start Date', 'invoicing' ); ?></label> |
|
266 | + <label for="wpinv_discount_start"><?php _e('Start Date', 'invoicing'); ?></label> |
|
267 | 267 | </th> |
268 | 268 | <td> |
269 | - <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr( $start_date ); ?>"> @ <select id="wpinv_discount_start_h" name="start_h"> |
|
270 | - <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
271 | - <option value="<?php echo $value;?>" <?php selected( $value, $start_h ); ?>><?php echo $value;?></option> |
|
269 | + <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr($start_date); ?>"> @ <select id="wpinv_discount_start_h" name="start_h"> |
|
270 | + <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
271 | + <option value="<?php echo $value; ?>" <?php selected($value, $start_h); ?>><?php echo $value; ?></option> |
|
272 | 272 | <?php } ?> |
273 | 273 | </select> : <select id="wpinv_discount_start_m" name="start_m"> |
274 | - <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
275 | - <option value="<?php echo $value;?>" <?php selected( $value, $start_m ); ?>><?php echo $value;?></option> |
|
274 | + <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
275 | + <option value="<?php echo $value; ?>" <?php selected($value, $start_m); ?>><?php echo $value; ?></option> |
|
276 | 276 | <?php } ?> |
277 | 277 | </select> |
278 | - <p class="description"><?php _e( 'Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?></p> |
|
278 | + <p class="description"><?php _e('Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?></p> |
|
279 | 279 | </td> |
280 | 280 | </tr> |
281 | - <?php do_action( 'wpinv_discount_form_before_expiration', $post ); ?> |
|
281 | + <?php do_action('wpinv_discount_form_before_expiration', $post); ?> |
|
282 | 282 | <tr> |
283 | 283 | <th valign="top" scope="row"> |
284 | - <label for="wpinv_discount_expiration"><?php _e( 'Expiration Date', 'invoicing' ); ?></label> |
|
284 | + <label for="wpinv_discount_expiration"><?php _e('Expiration Date', 'invoicing'); ?></label> |
|
285 | 285 | </th> |
286 | 286 | <td> |
287 | - <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr( $expiration_date ); ?>"> @ <select id="wpinv_discount_expiration_h" name="expiration_h"> |
|
288 | - <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
289 | - <option value="<?php echo $value;?>" <?php selected( $value, $expiration_h ); ?>><?php echo $value;?></option> |
|
287 | + <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr($expiration_date); ?>"> @ <select id="wpinv_discount_expiration_h" name="expiration_h"> |
|
288 | + <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
289 | + <option value="<?php echo $value; ?>" <?php selected($value, $expiration_h); ?>><?php echo $value; ?></option> |
|
290 | 290 | <?php } ?> |
291 | 291 | </select> : <select id="wpinv_discount_expiration_m" name="expiration_m"> |
292 | - <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
293 | - <option value="<?php echo $value;?>" <?php selected( $value, $expiration_m ); ?>><?php echo $value;?></option> |
|
292 | + <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
293 | + <option value="<?php echo $value; ?>" <?php selected($value, $expiration_m); ?>><?php echo $value; ?></option> |
|
294 | 294 | <?php } ?> |
295 | 295 | </select> |
296 | - <p class="description"><?php _e( 'Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing' ); ?></p> |
|
296 | + <p class="description"><?php _e('Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing'); ?></p> |
|
297 | 297 | </td> |
298 | 298 | </tr> |
299 | - <?php do_action( 'wpinv_discount_form_before_min_total', $post ); ?> |
|
299 | + <?php do_action('wpinv_discount_form_before_min_total', $post); ?> |
|
300 | 300 | <tr> |
301 | 301 | <th valign="top" scope="row"> |
302 | - <label for="wpinv_discount_min_total"><?php _e( 'Minimum Amount', 'invoicing' ); ?></label> |
|
302 | + <label for="wpinv_discount_min_total"><?php _e('Minimum Amount', 'invoicing'); ?></label> |
|
303 | 303 | </th> |
304 | 304 | <td> |
305 | 305 | <input type="text" name="min_total" id="wpinv_discount_min_total" class="wpi-field-price wpi-price" value="<?php echo $min_total; ?>"> |
306 | - <p class="description"><?php _e( 'This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p> |
|
306 | + <p class="description"><?php _e('This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p> |
|
307 | 307 | </td> |
308 | 308 | </tr> |
309 | - <?php do_action( 'wpinv_discount_form_before_max_total', $post ); ?> |
|
309 | + <?php do_action('wpinv_discount_form_before_max_total', $post); ?> |
|
310 | 310 | <tr> |
311 | 311 | <th valign="top" scope="row"> |
312 | - <label for="wpinv_discount_max_total"><?php _e( 'Maximum Amount', 'invoicing' ); ?></label> |
|
312 | + <label for="wpinv_discount_max_total"><?php _e('Maximum Amount', 'invoicing'); ?></label> |
|
313 | 313 | </th> |
314 | 314 | <td> |
315 | 315 | <input type="text" name="max_total" id="wpinv_discount_max_total" class="wpi-field-price wpi-price" value="<?php echo $max_total; ?>"> |
316 | - <p class="description"><?php _e( 'This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p> |
|
316 | + <p class="description"><?php _e('This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p> |
|
317 | 317 | </td> |
318 | 318 | </tr> |
319 | - <?php do_action( 'wpinv_discount_form_before_recurring', $post ); ?> |
|
319 | + <?php do_action('wpinv_discount_form_before_recurring', $post); ?> |
|
320 | 320 | <tr> |
321 | 321 | <th valign="top" scope="row"> |
322 | - <label for="wpinv_discount_recurring"><?php _e( 'For recurring apply to', 'invoicing' ); ?></label> |
|
322 | + <label for="wpinv_discount_recurring"><?php _e('For recurring apply to', 'invoicing'); ?></label> |
|
323 | 323 | </th> |
324 | 324 | <td> |
325 | 325 | <select id="wpinv_discount_recurring" name="recurring" class="medium-text wpi_select2"> |
326 | - <option value="0" <?php selected( false, $recurring ); ?>><?php _e( 'First payment only', 'invoicing' ); ?></option> |
|
327 | - <option value="1" <?php selected( true, $recurring ); ?>><?php _e( 'All payments', 'invoicing' ); ?></option> |
|
326 | + <option value="0" <?php selected(false, $recurring); ?>><?php _e('First payment only', 'invoicing'); ?></option> |
|
327 | + <option value="1" <?php selected(true, $recurring); ?>><?php _e('All payments', 'invoicing'); ?></option> |
|
328 | 328 | </select> |
329 | - <p class="description"><?php _e( '<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing' ); ?></p> |
|
329 | + <p class="description"><?php _e('<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing'); ?></p> |
|
330 | 330 | </td> |
331 | 331 | </tr> |
332 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $post ); ?> |
|
332 | + <?php do_action('wpinv_discount_form_before_max_uses', $post); ?> |
|
333 | 333 | <tr> |
334 | 334 | <th valign="top" scope="row"> |
335 | - <label for="wpinv_discount_max_uses"><?php _e( 'Max Uses', 'invoicing' ); ?></label> |
|
335 | + <label for="wpinv_discount_max_uses"><?php _e('Max Uses', 'invoicing'); ?></label> |
|
336 | 336 | </th> |
337 | 337 | <td> |
338 | 338 | <input type="number" min="0" step="1" id="wpinv_discount_max_uses" name="max_uses" class="medium-text" value="<?php echo $max_uses; ?>"> |
339 | - <p class="description"><?php _e( 'The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing' ); ?></p> |
|
339 | + <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing'); ?></p> |
|
340 | 340 | </td> |
341 | 341 | </tr> |
342 | - <?php do_action( 'wpinv_discount_form_before_single_use', $post ); ?> |
|
342 | + <?php do_action('wpinv_discount_form_before_single_use', $post); ?> |
|
343 | 343 | <tr> |
344 | 344 | <th valign="top" scope="row"> |
345 | - <label for="wpinv_discount_single_use"><?php _e( 'Use Once Per User', 'invoicing' ); ?></label> |
|
345 | + <label for="wpinv_discount_single_use"><?php _e('Use Once Per User', 'invoicing'); ?></label> |
|
346 | 346 | </th> |
347 | 347 | <td> |
348 | - <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked( true, $single_use ); ?>> |
|
349 | - <span class="description"><?php _e( 'Limit this discount to a single use per user?', 'invoicing' ); ?></span> |
|
348 | + <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked(true, $single_use); ?>> |
|
349 | + <span class="description"><?php _e('Limit this discount to a single use per user?', 'invoicing'); ?></span> |
|
350 | 350 | </td> |
351 | 351 | </tr> |
352 | - <?php do_action( 'wpinv_discount_form_last', $post ); ?> |
|
352 | + <?php do_action('wpinv_discount_form_last', $post); ?> |
|
353 | 353 | </tbody> |
354 | 354 | </table> |
355 | -<?php do_action( 'wpinv_discount_form_bottom', $post ); ?> |
|
355 | +<?php do_action('wpinv_discount_form_bottom', $post); ?> |
|
356 | 356 | <?php |
357 | 357 | } |
358 | 358 | |
359 | -function wpinv_discount_metabox_save( $post_id, $post, $update = false ) { |
|
360 | - $post_type = !empty( $post ) ? $post->post_type : ''; |
|
359 | +function wpinv_discount_metabox_save($post_id, $post, $update = false) { |
|
360 | + $post_type = !empty($post) ? $post->post_type : ''; |
|
361 | 361 | |
362 | - if ( $post_type != 'wpi_discount' ) { |
|
362 | + if ($post_type != 'wpi_discount') { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - if ( !isset( $_POST['wpinv_discount_metabox_nonce'] ) || ( isset( $_POST['wpinv_discount_metabox_nonce'] ) && !wp_verify_nonce( $_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce' ) ) ) { |
|
366 | + if (!isset($_POST['wpinv_discount_metabox_nonce']) || (isset($_POST['wpinv_discount_metabox_nonce']) && !wp_verify_nonce($_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce'))) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
370 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
371 | 371 | return; |
372 | 372 | } |
373 | 373 | |
374 | - if ( !current_user_can( wpinv_get_capability(), $post_id ) ) { |
|
374 | + if (!current_user_can(wpinv_get_capability(), $post_id)) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - if ( !empty( $_POST['start'] ) && isset( $_POST['start_h'] ) && isset( $_POST['start_m'] ) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '' ) { |
|
378 | + if (!empty($_POST['start']) && isset($_POST['start_h']) && isset($_POST['start_m']) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '') { |
|
379 | 379 | $_POST['start'] = $_POST['start'] . ' ' . $_POST['start_h'] . ':' . $_POST['start_m']; |
380 | 380 | } |
381 | 381 | |
382 | - if ( !empty( $_POST['expiration'] ) && isset( $_POST['expiration_h'] ) && isset( $_POST['expiration_m'] ) ) { |
|
382 | + if (!empty($_POST['expiration']) && isset($_POST['expiration_h']) && isset($_POST['expiration_m'])) { |
|
383 | 383 | $_POST['expiration'] = $_POST['expiration'] . ' ' . $_POST['expiration_h'] . ':' . $_POST['expiration_m']; |
384 | 384 | } |
385 | 385 | |
386 | - return /** @scrutinizer ignore-call */ wpinv_store_discount( $post_id, $_POST, $post, $update ); |
|
386 | + return /** @scrutinizer ignore-call */ wpinv_store_discount($post_id, $_POST, $post, $update); |
|
387 | 387 | } |
388 | -add_action( 'save_post', 'wpinv_discount_metabox_save', 10, 3 ); |
|
389 | 388 | \ No newline at end of file |
389 | +add_action('save_post', 'wpinv_discount_metabox_save', 10, 3); |
|
390 | 390 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Payment_Form { |
@@ -11,23 +11,23 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @param WP_Post $post |
13 | 13 | */ |
14 | - public static function output_details( $post ) { |
|
15 | - $details = get_post_meta( $post->ID, 'payment_form_data', true ); |
|
14 | + public static function output_details($post) { |
|
15 | + $details = get_post_meta($post->ID, 'payment_form_data', true); |
|
16 | 16 | |
17 | - if ( ! is_array( $details ) ) { |
|
17 | + if (!is_array($details)) { |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | 21 | echo '<div class="gdmbx2-wrap form-table"> <div class="gdmbx2-metabox gdmbx-field-list">'; |
22 | 22 | |
23 | - foreach ( $details as $key => $value ) { |
|
24 | - $key = sanitize_text_field( $key ); |
|
23 | + foreach ($details as $key => $value) { |
|
24 | + $key = sanitize_text_field($key); |
|
25 | 25 | |
26 | - if ( is_array( $value ) ) { |
|
27 | - $value = implode( ',', $value ); |
|
26 | + if (is_array($value)) { |
|
27 | + $value = implode(',', $value); |
|
28 | 28 | } |
29 | 29 | |
30 | - $value = esc_html( $value ); |
|
30 | + $value = esc_html($value); |
|
31 | 31 | |
32 | 32 | echo "<div class='gdmbx-row gdmbx-type-select'>"; |
33 | 33 | echo "<div class='gdmbx-th'><label>$key:</label></div>"; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param WP_Post $post |
45 | 45 | */ |
46 | - public static function output_shortcode( $post ) { |
|
46 | + public static function output_shortcode($post) { |
|
47 | 47 | |
48 | - if ( ! is_numeric( $post ) ) { |
|
48 | + if (!is_numeric($post)) { |
|
49 | 49 | $post = $post->ID; |
50 | 50 | } |
51 | 51 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param WP_Post $post |
59 | 59 | */ |
60 | - public static function output ( $post ) { |
|
61 | - $success_page = get_post_meta( $post->ID, 'wpinv_success_page', true ); |
|
62 | - $success_page = empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page |
|
60 | + public static function output($post) { |
|
61 | + $success_page = get_post_meta($post->ID, 'wpinv_success_page', true); |
|
62 | + $success_page = empty($success_page) ? wpinv_get_success_page_uri() : $success_page |
|
63 | 63 | ?> |
64 | 64 | |
65 | 65 | <div id="wpinv-form-builder" style="display: flex; flex-flow: wrap;"> |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | <div class="wpinv-form-builder-left bsui" style="flex: 0 0 320px;"> |
68 | 68 | <ul class="wpinv-form-builder-tabs nav nav-tabs"> |
69 | 69 | <li class='nav-item' v-if="active_tab!='new_item'"> |
70 | - <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e( 'Add new element', 'invoicing' ); ?></a> |
|
70 | + <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e('Add new element', 'invoicing'); ?></a> |
|
71 | 71 | </li> |
72 | 72 | <li class='nav-item' v-if='false'> |
73 | - <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e( 'Edit element', 'invoicing' ); ?></a> |
|
73 | + <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e('Edit element', 'invoicing'); ?></a> |
|
74 | 74 | </li> |
75 | 75 | <li class='nav-item' v-if='false'> |
76 | - <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e( 'Settings', 'invoicing' ); ?></a> |
|
76 | + <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e('Settings', 'invoicing'); ?></a> |
|
77 | 77 | </li> |
78 | 78 | </ul> |
79 | 79 | |
80 | 80 | <div class="wpinv-form-builder-tab-content bsui" style="margin-top: 16px;"> |
81 | 81 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'"> |
82 | 82 | <div class="wpinv-form-builder-add-field-types"> |
83 | - <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small> |
|
83 | + <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small> |
|
84 | 84 | <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable"> |
85 | 85 | <li v-for="element in elements" style="width: 49%; background-color: #fafafa; margin-bottom: 9px; cursor: move; border: 1px solid #eeeeee;" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }"> |
86 | 86 | <button class="button btn" style="width: 100%; cursor: move;"> |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | |
96 | 96 | <div class="wpinv-form-builder-tab-pane bsui" v-if="active_tab=='edit_item'" style="font-size: 16px;"> |
97 | 97 | <div class="wpinv-form-builder-edit-field-wrapper"> |
98 | - <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?> |
|
98 | + <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?> |
|
99 | 99 | <div> |
100 | - <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e( 'Delete Field', 'invoicing' ); ?></button> |
|
100 | + <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e('Delete Field', 'invoicing'); ?></button> |
|
101 | 101 | </div> |
102 | 102 | </div> |
103 | 103 | </div> |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | <div class="wpinv-form-builder-settings-wrapper"> |
107 | 107 | |
108 | 108 | <div class='form-group'> |
109 | - <label for="wpi-success-page"><?php _e( 'Success Page', 'invoicing' ); ?></label> |
|
110 | - <input placeholder="https://" id='wpi-success-page' value="<?php echo esc_url( $success_page ); ?>" class='form-control' type='text'> |
|
111 | - <small class='form-text text-muted'><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></small> |
|
109 | + <label for="wpi-success-page"><?php _e('Success Page', 'invoicing'); ?></label> |
|
110 | + <input placeholder="https://" id='wpi-success-page' value="<?php echo esc_url($success_page); ?>" class='form-control' type='text'> |
|
111 | + <small class='form-text text-muted'><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></small> |
|
112 | 112 | </div> |
113 | 113 | |
114 | 114 | </div> |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | <div class="wpinv-form-builder-right" style="flex: 1; padding-top: 40px;border-left: 1px solid #ddd;padding-left: 20px;min-height: 520px;margin-left: 10px;"> |
121 | 121 | |
122 | - <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small> |
|
123 | - <p class='form-text text-muted' v-if='! form_elements.length'><?php _e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p> |
|
122 | + <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small> |
|
123 | + <p class='form-text text-muted' v-if='! form_elements.length'><?php _e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p> |
|
124 | 124 | |
125 | 125 | <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 16px;"> |
126 | 126 | <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="{ active: active_form_element==form_element && active_tab=='edit_item' }" @click="active_tab = 'edit_item'; active_form_element = form_element"> |
127 | - <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?> |
|
127 | + <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?> |
|
128 | 128 | </div> |
129 | 129 | </draggable> |
130 | 130 | </div> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <textarea style="display:none;" name="wpinv_form_items" v-model="itemString"></textarea> |
134 | 134 | </div> |
135 | 135 | |
136 | - <?php wp_nonce_field( 'wpinv_save_payment_form', 'wpinv_save_payment_form' ) ;?> |
|
136 | + <?php wp_nonce_field('wpinv_save_payment_form', 'wpinv_save_payment_form'); ?> |
|
137 | 137 | |
138 | 138 | <?php |
139 | 139 | } |
@@ -141,83 +141,83 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * Saves our payment forms. |
143 | 143 | */ |
144 | - public static function save( $post_id, $post ) { |
|
144 | + public static function save($post_id, $post) { |
|
145 | 145 | |
146 | - remove_action( 'save_post', 'WPInv_Meta_Box_Payment_Form::save' ); |
|
146 | + remove_action('save_post', 'WPInv_Meta_Box_Payment_Form::save'); |
|
147 | 147 | |
148 | 148 | // $post_id and $post are required. |
149 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
149 | + if (empty($post_id) || empty($post)) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | 153 | // Ensure that this user can edit the post. |
154 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
154 | + if (!current_user_can('edit_post', $post_id)) { |
|
155 | 155 | return; |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Dont' save meta boxes for revisions or autosaves |
159 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
159 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Do not save for ajax requests. |
164 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
164 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Confirm the security nonce. |
169 | - if ( empty( $_POST['wpinv_save_payment_form'] ) || ! wp_verify_nonce( $_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form' ) ) { |
|
169 | + if (empty($_POST['wpinv_save_payment_form']) || !wp_verify_nonce($_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form')) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | 173 | // Save form items. |
174 | - $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true ); |
|
174 | + $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true); |
|
175 | 175 | |
176 | - if ( empty( $form_items ) ) { |
|
176 | + if (empty($form_items)) { |
|
177 | 177 | $form_items = array(); |
178 | 178 | } |
179 | 179 | |
180 | - update_post_meta( $post_id, 'wpinv_form_items', self::maybe_save_items( $form_items ) ); |
|
180 | + update_post_meta($post_id, 'wpinv_form_items', self::maybe_save_items($form_items)); |
|
181 | 181 | |
182 | 182 | // Save form elements. |
183 | - $wpinv_form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true ); |
|
184 | - if ( empty( $wpinv_form_elements ) ) { |
|
183 | + $wpinv_form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true); |
|
184 | + if (empty($wpinv_form_elements)) { |
|
185 | 185 | $wpinv_form_elements = array(); |
186 | 186 | } |
187 | 187 | |
188 | - update_post_meta( $post_id, 'wpinv_form_elements', $wpinv_form_elements ); |
|
188 | + update_post_meta($post_id, 'wpinv_form_elements', $wpinv_form_elements); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Saves unsaved form items. |
193 | 193 | */ |
194 | - public static function maybe_save_items( $items ) { |
|
194 | + public static function maybe_save_items($items) { |
|
195 | 195 | |
196 | 196 | $saved = array(); |
197 | 197 | |
198 | - foreach( $items as $item ) { |
|
198 | + foreach ($items as $item) { |
|
199 | 199 | |
200 | - if ( is_numeric( $item['id'] ) ) { |
|
200 | + if (is_numeric($item['id'])) { |
|
201 | 201 | $saved[] = $item; |
202 | 202 | continue; |
203 | 203 | } |
204 | 204 | |
205 | 205 | $data = array( |
206 | - 'post_title' => sanitize_text_field( $item['title'] ), |
|
207 | - 'post_excerpt' => wp_kses_post( $item['description'] ), |
|
206 | + 'post_title' => sanitize_text_field($item['title']), |
|
207 | + 'post_excerpt' => wp_kses_post($item['description']), |
|
208 | 208 | 'post_status' => 'publish', |
209 | 209 | 'meta' => array( |
210 | 210 | 'type' => 'custom', |
211 | - 'price' => wpinv_sanitize_amount( $item['price'] ), |
|
211 | + 'price' => wpinv_sanitize_amount($item['price']), |
|
212 | 212 | 'vat_rule' => 'digital', |
213 | 213 | 'vat_class' => '_standard', |
214 | 214 | ) |
215 | 215 | ); |
216 | 216 | |
217 | - $new_item = new WPInv_Item(); |
|
218 | - $new_item->create( $data ); |
|
217 | + $new_item = new WPInv_Item(); |
|
218 | + $new_item->create($data); |
|
219 | 219 | |
220 | - if ( ! empty( $new_item ) ) { |
|
220 | + if (!empty($new_item)) { |
|
221 | 221 | $item['id'] = $new_item->ID; |
222 | 222 | $saved[] = $item; |
223 | 223 | } |
@@ -230,5 +230,5 @@ discard block |
||
230 | 230 | |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2 ); |
|
233 | +add_action('save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2); |
|
234 | 234 |
@@ -1,32 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Details { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat; |
10 | 10 | |
11 | 11 | $currency_symbol = wpinv_currency_symbol(); |
12 | - $statuses = wpinv_get_invoice_statuses( true ); |
|
12 | + $statuses = wpinv_get_invoice_statuses(true); |
|
13 | 13 | |
14 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
15 | - $invoice = new WPInv_Invoice( $post_id ); |
|
16 | - $status = $invoice->get_status( false ); // Current status |
|
14 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
15 | + $invoice = new WPInv_Invoice($post_id); |
|
16 | + $status = $invoice->get_status(false); // Current status |
|
17 | 17 | $discount = $invoice->get_discount(); |
18 | 18 | $discount_code = $discount > 0 ? $invoice->get_discount_code() : ''; |
19 | 19 | $invoice_number = $invoice->get_number(); |
20 | 20 | $taxable = $invoice->is_taxable(); |
21 | 21 | |
22 | 22 | $date_created = $invoice->get_created_date(); |
23 | - $datetime_created = strtotime( $date_created ); |
|
24 | - $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : ''; |
|
23 | + $datetime_created = strtotime($date_created); |
|
24 | + $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : ''; |
|
25 | 25 | $date_completed = $invoice->get_completed_date(); |
26 | - $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a'; |
|
27 | - $title['status'] = __( 'Invoice Status:', 'invoicing' ); |
|
28 | - $title['number'] = __( 'Invoice Number:', 'invoicing' ); |
|
29 | - $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user’s email address.', 'invoicing' ); |
|
26 | + $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a'; |
|
27 | + $title['status'] = __('Invoice Status:', 'invoicing'); |
|
28 | + $title['number'] = __('Invoice Number:', 'invoicing'); |
|
29 | + $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user’s email address.', 'invoicing'); |
|
30 | 30 | |
31 | 31 | $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice); |
32 | 32 | $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice); |
@@ -36,36 +36,36 @@ discard block |
||
36 | 36 | <div class="gdmbx2-wrap form-table"> |
37 | 37 | <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details"> |
38 | 38 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created"> |
39 | - <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div> |
|
40 | - <div class="gdmbx-td"><?php echo $date_created;?></div> |
|
39 | + <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div> |
|
40 | + <div class="gdmbx-td"><?php echo $date_created; ?></div> |
|
41 | 41 | </div> |
42 | - <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?> |
|
42 | + <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?> |
|
43 | 43 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue"> |
44 | - <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div> |
|
44 | + <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div> |
|
45 | 45 | <div class="gdmbx-td"> |
46 | - <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd"> |
|
47 | - <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p> |
|
46 | + <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd"> |
|
47 | + <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p> |
|
48 | 48 | </div> |
49 | 49 | </div> |
50 | 50 | <?php } ?> |
51 | - <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?> |
|
52 | - <?php if ( $date_completed && $date_completed != 'n/a' ) { ?> |
|
51 | + <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?> |
|
52 | + <?php if ($date_completed && $date_completed != 'n/a') { ?> |
|
53 | 53 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed"> |
54 | - <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div> |
|
55 | - <div class="gdmbx-td"><?php echo $date_completed;?></div> |
|
54 | + <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div> |
|
55 | + <div class="gdmbx-td"><?php echo $date_completed; ?></div> |
|
56 | 56 | </div> |
57 | 57 | <?php } ?> |
58 | - <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?> |
|
58 | + <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?> |
|
59 | 59 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed"> |
60 | - <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div> |
|
61 | - <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div> |
|
60 | + <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div> |
|
61 | + <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div> |
|
62 | 62 | </div> |
63 | 63 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status"> |
64 | 64 | <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div> |
65 | 65 | <div class="gdmbx-td"> |
66 | 66 | <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2"> |
67 | - <?php foreach ( $statuses as $value => $label ) { ?> |
|
68 | - <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option> |
|
67 | + <?php foreach ($statuses as $value => $label) { ?> |
|
68 | + <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option> |
|
69 | 69 | <?php } ?> |
70 | 70 | </select> |
71 | 71 | </div> |
@@ -74,129 +74,129 @@ discard block |
||
74 | 74 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout"> |
75 | 75 | <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div> |
76 | 76 | <div class="gdmbx-td"> |
77 | - <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
77 | + <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
78 | 78 | </div> |
79 | 79 | </div> |
80 | - <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); |
|
80 | + <?php do_action('wpinv_meta_box_details_inner', $post_id); |
|
81 | 81 | $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id); |
82 | 82 | ?> |
83 | 83 | |
84 | - <?php if ( $wpinv_euvat->allow_vat_rules() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?> |
|
84 | + <?php if ($wpinv_euvat->allow_vat_rules() && !($invoice->is_paid() || $invoice->is_refunded())) { ?> |
|
85 | 85 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-taxable"> |
86 | 86 | <div class="gdmbx-th"> |
87 | 87 | <label for="wpinv_taxable"> |
88 | - <input type="checkbox" name="disable_taxes" value="1" <?php checked( $taxable, false ); ?> id="wpinv_taxable"> |
|
89 | - <?php _e( 'Disable taxes', 'invoicing' ); ?> |
|
88 | + <input type="checkbox" name="disable_taxes" value="1" <?php checked($taxable, false); ?> id="wpinv_taxable"> |
|
89 | + <?php _e('Disable taxes', 'invoicing'); ?> |
|
90 | 90 | </label> |
91 | 91 | </div> |
92 | 92 | </div> |
93 | 93 | <?php } ?> |
94 | 94 | |
95 | - <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?> |
|
95 | + <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?> |
|
96 | 96 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout"> |
97 | - <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div> |
|
97 | + <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div> |
|
98 | 98 | <div class="gdmbx-td"> |
99 | - <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid && !$disable_discount ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
99 | + <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid && !$disable_discount) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | <?php } ?> |
103 | 103 | </div> |
104 | 104 | </div> |
105 | 105 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout"> |
106 | - <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label> |
|
106 | + <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label> |
|
107 | 107 | <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2"> |
108 | - <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option> |
|
109 | - <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option> |
|
108 | + <option value="1"><?php _e('Yes', 'invoicing'); ?></option> |
|
109 | + <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option> |
|
110 | 110 | </select> |
111 | 111 | </p> |
112 | 112 | <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p> |
113 | 113 | </div> |
114 | -<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?> |
|
114 | +<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?> |
|
115 | 115 | <?php |
116 | 116 | } |
117 | 117 | |
118 | - public static function resend_invoice( $post ) { |
|
118 | + public static function resend_invoice($post) { |
|
119 | 119 | global $wpi_mb_invoice; |
120 | 120 | |
121 | - if ( empty( $wpi_mb_invoice ) ) { |
|
121 | + if (empty($wpi_mb_invoice)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | 125 | $text = array( |
126 | - 'message' => esc_attr__( 'This will send a copy of the invoice to the customer’s email address.', 'invoicing' ), |
|
127 | - 'button_text' => __( 'Resend Invoice', 'invoicing' ), |
|
126 | + 'message' => esc_attr__('This will send a copy of the invoice to the customer’s email address.', 'invoicing'), |
|
127 | + 'button_text' => __('Resend Invoice', 'invoicing'), |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | $text = apply_filters('wpinv_resend_invoice_metabox_text', $text); |
131 | - do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice ); |
|
131 | + do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice); |
|
132 | 132 | |
133 | - if ( $email = $wpi_mb_invoice->get_email() ) { |
|
133 | + if ($email = $wpi_mb_invoice->get_email()) { |
|
134 | 134 | $email_actions = array(); |
135 | - $email_actions['email_url'] = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) ); |
|
136 | - $email_actions['reminder_url'] = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) ); |
|
135 | + $email_actions['email_url'] = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID))); |
|
136 | + $email_actions['reminder_url'] = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID)); |
|
137 | 137 | |
138 | - $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions ); |
|
138 | + $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions); |
|
139 | 139 | ?> |
140 | 140 | <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p> |
141 | - <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
142 | - <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?> |
|
143 | - <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p> |
|
141 | + <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
142 | + <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?> |
|
143 | + <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p> |
|
144 | 144 | <?php } ?> |
145 | 145 | <?php |
146 | 146 | } |
147 | 147 | |
148 | - do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice ); |
|
148 | + do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice); |
|
149 | 149 | } |
150 | 150 | |
151 | - public static function subscriptions( $post ) { |
|
152 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
151 | + public static function subscriptions($post) { |
|
152 | + $invoice = wpinv_get_invoice($post->ID); |
|
153 | 153 | |
154 | - if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) { |
|
155 | - $subscription = wpinv_get_subscription( $invoice ); |
|
154 | + if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) { |
|
155 | + $subscription = wpinv_get_subscription($invoice); |
|
156 | 156 | |
157 | - if ( empty( $subscription ) ) { |
|
157 | + if (empty($subscription)) { |
|
158 | 158 | ?> |
159 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( 'New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing' ), '<a href="' . admin_url( 'admin.php?page=wpinv-subscriptions' ).'">', '</a>' ); ?></p> |
|
159 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing'), '<a href="' . admin_url('admin.php?page=wpinv-subscriptions') . '">', '</a>'); ?></p> |
|
160 | 160 | <?php |
161 | 161 | return; |
162 | 162 | } |
163 | - $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency ); |
|
164 | - $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency; |
|
165 | - $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ); |
|
163 | + $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency); |
|
164 | + $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency; |
|
165 | + $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)); |
|
166 | 166 | $payments = $subscription->get_child_payments(); |
167 | 167 | ?> |
168 | 168 | <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p> |
169 | - <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?> |
|
169 | + <?php if (!empty($subscription) && !empty($subscription->id)) { ?> |
|
170 | 170 | <p class="wpi-meta-row wpi-sub-id"> |
171 | - <label><?php _e( 'Subscription ID:', 'invoicing' ); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p> |
|
171 | + <label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p> |
|
172 | 172 | <?php } ?> |
173 | 173 | <p class="wpi-meta-row wpi-bill-cycle"> |
174 | - <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?> |
|
174 | + <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?> |
|
175 | 175 | </p> |
176 | 176 | <p class="wpi-meta-row wpi-billed-times"> |
177 | - <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?> |
|
177 | + <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?> |
|
178 | 178 | </p> |
179 | 179 | <p class="wpi-meta-row wpi-start-date"> |
180 | - <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?> |
|
180 | + <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?> |
|
181 | 181 | </p> |
182 | 182 | <p class="wpi-meta-row wpi-end-date"> |
183 | - <label><?php echo ( 'trialling' == $subscription->status ? __( 'Trialling Until:', 'invoicing' ) : __( 'Expiration Date:', 'invoicing' ) ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration, current_time( 'timestamp' ) ) ); ?> |
|
183 | + <label><?php echo ('trialling' == $subscription->status ? __('Trialling Until:', 'invoicing') : __('Expiration Date:', 'invoicing')); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->expiration, current_time('timestamp'))); ?> |
|
184 | 184 | </p> |
185 | - <?php if ( $subscription->status ) { ?> |
|
185 | + <?php if ($subscription->status) { ?> |
|
186 | 186 | <p class="wpi-meta-row wpi-sub-status"> |
187 | - <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
187 | + <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
188 | 188 | </p> |
189 | 189 | <?php } ?> |
190 | - <?php if ( !empty( $payments ) ) { ?> |
|
191 | - <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p> |
|
190 | + <?php if (!empty($payments)) { ?> |
|
191 | + <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p> |
|
192 | 192 | <ul id="wpi-sub-payments"> |
193 | - <?php foreach ( $payments as $payment ) { |
|
193 | + <?php foreach ($payments as $payment) { |
|
194 | 194 | $invoice_id = $payment->ID; |
195 | 195 | ?> |
196 | 196 | <li> |
197 | - <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a> – |
|
198 | - <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?> – </span> |
|
199 | - <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span> |
|
197 | + <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a> – |
|
198 | + <span><?php echo wpinv_get_invoice_date($invoice_id); ?> – </span> |
|
199 | + <span><?php echo wpinv_payment_total($invoice_id, true); ?></span> |
|
200 | 200 | </li> |
201 | 201 | <?php } ?> |
202 | 202 | </ul> |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - public static function renewals( $post ) { |
|
208 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
207 | + public static function renewals($post) { |
|
208 | + $invoice = wpinv_get_invoice($post->ID); |
|
209 | 209 | |
210 | - if ( wpinv_is_subscription_payment( $invoice ) ) { |
|
211 | - $parent_url = get_edit_post_link( $invoice->parent_invoice ); |
|
212 | - $parent_id = wpinv_get_invoice_number( $invoice->parent_invoice ); |
|
213 | - $subscription = wpinv_get_subscription( $invoice ); |
|
210 | + if (wpinv_is_subscription_payment($invoice)) { |
|
211 | + $parent_url = get_edit_post_link($invoice->parent_invoice); |
|
212 | + $parent_id = wpinv_get_invoice_number($invoice->parent_invoice); |
|
213 | + $subscription = wpinv_get_subscription($invoice); |
|
214 | 214 | ?> |
215 | - <?php if ( ! empty( $subscription ) ) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?> |
|
216 | - <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p> |
|
215 | + <?php if (!empty($subscription)) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?> |
|
216 | + <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p> |
|
217 | 217 | <?php |
218 | 218 | } |
219 | 219 | } |
@@ -221,47 +221,47 @@ discard block |
||
221 | 221 | /** |
222 | 222 | * Renders a metabox to edit a payment form. |
223 | 223 | */ |
224 | - public static function payment_form( $post ) { |
|
225 | - WPInv_Meta_Box_Form_Items::output_options( $post ); |
|
224 | + public static function payment_form($post) { |
|
225 | + WPInv_Meta_Box_Form_Items::output_options($post); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Renders a metabox to select items. |
230 | 230 | */ |
231 | - public static function payment_form_items( $post ) { |
|
232 | - WPInv_Meta_Box_Form_Items::output( $post ); |
|
231 | + public static function payment_form_items($post) { |
|
232 | + WPInv_Meta_Box_Form_Items::output($post); |
|
233 | 233 | } |
234 | 234 | |
235 | - public static function payment_meta( $post ) { |
|
235 | + public static function payment_meta($post) { |
|
236 | 236 | global $wpi_mb_invoice; |
237 | 237 | |
238 | - $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false; |
|
239 | - if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) { |
|
238 | + $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false; |
|
239 | + if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) { |
|
240 | 240 | $set_dateway = true; |
241 | 241 | } |
242 | 242 | |
243 | 243 | ?> |
244 | 244 | <p class="wpi-meta-row"> |
245 | - <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?> |
|
246 | - <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label> |
|
245 | + <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?> |
|
246 | + <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label> |
|
247 | 247 | <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway"> |
248 | - <?php foreach ( $gateways as $name => $gateway ) { |
|
249 | - if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) { |
|
248 | + <?php foreach ($gateways as $name => $gateway) { |
|
249 | + if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | ?> |
253 | - <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
253 | + <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
254 | 254 | <?php } ?> |
255 | 255 | </select> |
256 | 256 | <?php } else { |
257 | - echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) ); |
|
257 | + echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway)); |
|
258 | 258 | } ?> |
259 | 259 | </p> |
260 | - <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?> |
|
261 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p> |
|
260 | + <?php if ($key = $wpi_mb_invoice->get_key()) { ?> |
|
261 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p> |
|
262 | 262 | <?php } ?> |
263 | - <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?> |
|
264 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p> |
|
263 | + <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?> |
|
264 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p> |
|
265 | 265 | <?php } ?> |
266 | 266 | <?php |
267 | 267 | } |
@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Items { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat, $ajax_cart_details; |
10 | 10 | |
11 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
12 | - $invoice = new WPInv_Invoice( $post_id ); |
|
11 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
12 | + $invoice = new WPInv_Invoice($post_id); |
|
13 | 13 | $ajax_cart_details = $invoice->get_cart_details(); |
14 | - $subtotal = $invoice->get_subtotal( true ); |
|
14 | + $subtotal = $invoice->get_subtotal(true); |
|
15 | 15 | $discount_raw = $invoice->get_discount(); |
16 | - $discount = wpinv_price( $discount_raw, $invoice->get_currency() ); |
|
16 | + $discount = wpinv_price($discount_raw, $invoice->get_currency()); |
|
17 | 17 | $discounts = $discount_raw > 0 ? $invoice->get_discounts() : ''; |
18 | - $tax = $invoice->get_tax( true ); |
|
19 | - $total = $invoice->get_total( true ); |
|
18 | + $tax = $invoice->get_tax(true); |
|
19 | + $total = $invoice->get_total(true); |
|
20 | 20 | $item_quantities = wpinv_item_quantities_enabled(); |
21 | 21 | $use_taxes = wpinv_use_taxes(); |
22 | - if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) { |
|
22 | + if (!$use_taxes && (float) $invoice->get_tax() > 0) { |
|
23 | 23 | $use_taxes = true; |
24 | 24 | } |
25 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
25 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
26 | 26 | $is_recurring = $invoice->is_recurring(); |
27 | 27 | $post_type_object = get_post_type_object($invoice->post_type); |
28 | 28 | $type_title = $post_type_object->labels->singular_name; |
29 | 29 | |
30 | 30 | $cols = 5; |
31 | - if ( $item_quantities ) { |
|
31 | + if ($item_quantities) { |
|
32 | 32 | $cols++; |
33 | 33 | } |
34 | - if ( $use_taxes ) { |
|
34 | + if ($use_taxes) { |
|
35 | 35 | $cols++; |
36 | 36 | } |
37 | 37 | $class = ''; |
38 | - if ( $invoice->is_paid() ) { |
|
38 | + if ($invoice->is_paid()) { |
|
39 | 39 | $class .= ' wpinv-paid'; |
40 | 40 | } |
41 | - if ( $invoice->is_refunded() ) { |
|
41 | + if ($invoice->is_refunded()) { |
|
42 | 42 | $class .= ' wpinv-refunded'; |
43 | 43 | } |
44 | - if ( $is_recurring ) { |
|
44 | + if ($is_recurring) { |
|
45 | 45 | $class .= ' wpi-recurring'; |
46 | 46 | } |
47 | 47 | ?> |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
50 | 50 | <thead> |
51 | 51 | <tr> |
52 | - <th class="id"><?php _e( 'ID', 'invoicing' );?></th> |
|
53 | - <th class="title"><?php _e( 'Item', 'invoicing' );?></th> |
|
54 | - <th class="price"><?php _e( 'Price', 'invoicing' );?></th> |
|
55 | - <?php if ( $item_quantities ) { ?> |
|
56 | - <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th> |
|
52 | + <th class="id"><?php _e('ID', 'invoicing'); ?></th> |
|
53 | + <th class="title"><?php _e('Item', 'invoicing'); ?></th> |
|
54 | + <th class="price"><?php _e('Price', 'invoicing'); ?></th> |
|
55 | + <?php if ($item_quantities) { ?> |
|
56 | + <th class="qty"><?php _e('Qty', 'invoicing'); ?></th> |
|
57 | 57 | <?php } ?> |
58 | - <th class="total"><?php _e( 'Total', 'invoicing' );?></th> |
|
59 | - <?php if ( $use_taxes ) { ?> |
|
60 | - <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th> |
|
58 | + <th class="total"><?php _e('Total', 'invoicing'); ?></th> |
|
59 | + <?php if ($use_taxes) { ?> |
|
60 | + <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th> |
|
61 | 61 | <?php } ?> |
62 | 62 | <th class="action"></th> |
63 | 63 | </tr> |
64 | 64 | </thead> |
65 | 65 | <tbody class="wpinv-line-items"> |
66 | - <?php echo wpinv_admin_get_line_items( $invoice ); ?> |
|
66 | + <?php echo wpinv_admin_get_line_items($invoice); ?> |
|
67 | 67 | </tbody> |
68 | 68 | <tfoot class="wpinv-totals"> |
69 | 69 | <tr> |
@@ -74,45 +74,45 @@ discard block |
||
74 | 74 | <td class="id"> |
75 | 75 | </td> |
76 | 76 | <td class="title"> |
77 | - <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | - <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?> |
|
77 | + <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | + <?php if ($wpinv_euvat->allow_vat_rules()) { ?> |
|
79 | 79 | <div class="wp-clearfix"> |
80 | 80 | <label class="wpi-vat-rule"> |
81 | - <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span> |
|
81 | + <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span> |
|
82 | 82 | <span class="input-text-wrap"> |
83 | - <?php echo wpinv_html_select( array( |
|
83 | + <?php echo wpinv_html_select(array( |
|
84 | 84 | 'options' => $wpinv_euvat->get_rules(), |
85 | 85 | 'name' => '_wpinv_quick[vat_rule]', |
86 | 86 | 'id' => '_wpinv_quick_vat_rule', |
87 | 87 | 'show_option_all' => false, |
88 | 88 | 'show_option_none' => false, |
89 | 89 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule wpi_select2', |
90 | - ) ); ?> |
|
90 | + )); ?> |
|
91 | 91 | </span> |
92 | 92 | </label> |
93 | 93 | </div> |
94 | - <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?> |
|
94 | + <?php } if ($wpinv_euvat->allow_vat_classes()) { ?> |
|
95 | 95 | <div class="wp-clearfix"> |
96 | 96 | <label class="wpi-vat-class"> |
97 | - <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span> |
|
97 | + <span class="title"><?php _e('VAT class', 'invoicing'); ?></span> |
|
98 | 98 | <span class="input-text-wrap"> |
99 | - <?php echo wpinv_html_select( array( |
|
99 | + <?php echo wpinv_html_select(array( |
|
100 | 100 | 'options' => $wpinv_euvat->get_all_classes(), |
101 | 101 | 'name' => '_wpinv_quick[vat_class]', |
102 | 102 | 'id' => '_wpinv_quick_vat_class', |
103 | 103 | 'show_option_all' => false, |
104 | 104 | 'show_option_none' => false, |
105 | 105 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class wpi_select2', |
106 | - ) ); ?> |
|
106 | + )); ?> |
|
107 | 107 | </span> |
108 | 108 | </label> |
109 | 109 | </div> |
110 | 110 | <?php } ?> |
111 | 111 | <div class="wp-clearfix"> |
112 | 112 | <label class="wpi-item-type"> |
113 | - <span class="title"><?php _e( 'Item type', 'invoicing' );?></span> |
|
113 | + <span class="title"><?php _e('Item type', 'invoicing'); ?></span> |
|
114 | 114 | <span class="input-text-wrap"> |
115 | - <?php echo wpinv_html_select( array( |
|
115 | + <?php echo wpinv_html_select(array( |
|
116 | 116 | 'options' => $item_types, |
117 | 117 | 'name' => '_wpinv_quick[type]', |
118 | 118 | 'id' => '_wpinv_quick_type', |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | 'show_option_all' => false, |
121 | 121 | 'show_option_none' => false, |
122 | 122 | 'class' => 'gdmbx2-text-medium wpinv-quick-type wpi_select2', |
123 | - ) ); ?> |
|
123 | + )); ?> |
|
124 | 124 | </span> |
125 | 125 | </label> |
126 | 126 | </div> |
127 | 127 | |
128 | 128 | <div class="wp-clearfix"> |
129 | 129 | <?php |
130 | - echo wpinv_html_textarea( array( |
|
130 | + echo wpinv_html_textarea(array( |
|
131 | 131 | 'name' => '_wpinv_quick[excerpt]', |
132 | 132 | 'id' => '_wpinv_quick_excerpt', |
133 | 133 | 'value' => '', |
134 | 134 | 'class' => 'large-text', |
135 | - 'label' => __( 'Item description', 'invoicing' ), |
|
136 | - ) ); |
|
135 | + 'label' => __('Item description', 'invoicing'), |
|
136 | + )); |
|
137 | 137 | ?> |
138 | 138 | </div> |
139 | 139 | |
140 | 140 | <div class="wp-clearfix"> |
141 | 141 | <label class="wpi-item-actions"> |
142 | 142 | <span class="input-text-wrap"> |
143 | - <input type="button" value="<?php esc_attr_e( 'Add', 'invoicing' ); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
143 | + <input type="button" value="<?php esc_attr_e('Add', 'invoicing'); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
144 | 144 | </span> |
145 | 145 | </label> |
146 | 146 | </div> |
147 | 147 | </td> |
148 | 148 | <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td> |
149 | - <?php if ( $item_quantities ) { ?> |
|
149 | + <?php if ($item_quantities) { ?> |
|
150 | 150 | <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td> |
151 | 151 | <?php } ?> |
152 | 152 | <td class="total"></td> |
153 | - <?php if ( $use_taxes ) { ?> |
|
153 | + <?php if ($use_taxes) { ?> |
|
154 | 154 | <td class="tax"></td> |
155 | 155 | <?php } ?> |
156 | 156 | <td class="action"></td> |
@@ -163,29 +163,29 @@ discard block |
||
163 | 163 | <td colspan="<?php echo $cols; ?>"></td> |
164 | 164 | </tr> |
165 | 165 | <tr class="totals"> |
166 | - <td colspan="<?php echo ( $cols - 4 ); ?>"></td> |
|
166 | + <td colspan="<?php echo ($cols - 4); ?>"></td> |
|
167 | 167 | <td colspan="4"> |
168 | 168 | <table cellspacing="0" cellpadding="0"> |
169 | 169 | <tr class="subtotal"> |
170 | - <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td> |
|
171 | - <td class="total"><?php echo $subtotal;?></td> |
|
170 | + <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td> |
|
171 | + <td class="total"><?php echo $subtotal; ?></td> |
|
172 | 172 | <td class="action"></td> |
173 | 173 | </tr> |
174 | 174 | <tr class="discount"> |
175 | - <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td> |
|
176 | - <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td> |
|
175 | + <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td> |
|
176 | + <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td> |
|
177 | 177 | <td class="action"></td> |
178 | 178 | </tr> |
179 | - <?php if ( $use_taxes ) { ?> |
|
179 | + <?php if ($use_taxes) { ?> |
|
180 | 180 | <tr class="tax"> |
181 | - <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td> |
|
182 | - <td class="total"><?php echo $tax;?></td> |
|
181 | + <td class="name"><?php _e('Tax:', 'invoicing'); ?></td> |
|
182 | + <td class="total"><?php echo $tax; ?></td> |
|
183 | 183 | <td class="action"></td> |
184 | 184 | </tr> |
185 | 185 | <?php } ?> |
186 | 186 | <tr class="total"> |
187 | - <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td> |
|
188 | - <td class="total"><?php echo $total;?></td> |
|
187 | + <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td> |
|
188 | + <td class="total"><?php echo $total; ?></td> |
|
189 | 189 | <td class="action"></td> |
190 | 190 | </tr> |
191 | 191 | </table> |
@@ -196,90 +196,90 @@ discard block |
||
196 | 196 | <div class="wpinv-actions"> |
197 | 197 | <?php ob_start(); ?> |
198 | 198 | <?php |
199 | - if ( !$invoice->is_paid() && !$invoice->is_refunded() ) { |
|
200 | - if ( !$invoice->is_recurring() ) { |
|
201 | - echo wpinv_item_dropdown( array( |
|
199 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
200 | + if (!$invoice->is_recurring()) { |
|
201 | + echo wpinv_item_dropdown(array( |
|
202 | 202 | 'name' => 'wpinv_invoice_item', |
203 | 203 | 'id' => 'wpinv_invoice_item', |
204 | 204 | 'show_recurring' => true, |
205 | 205 | 'class' => 'wpi_select2', |
206 | - ) ); |
|
206 | + )); |
|
207 | 207 | ?> |
208 | - <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
208 | + <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
209 | 209 | <?php } ?> |
210 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
211 | - <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?> |
|
210 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
211 | + <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?> |
|
212 | 212 | </div> |
213 | 213 | </div> |
214 | 214 | <?php |
215 | 215 | } |
216 | 216 | |
217 | - public static function prices( $post ) { |
|
217 | + public static function prices($post) { |
|
218 | 218 | $symbol = wpinv_currency_symbol(); |
219 | 219 | $position = wpinv_currency_position(); |
220 | - $item = new WPInv_Item( $post->ID ); |
|
220 | + $item = new WPInv_Item($post->ID); |
|
221 | 221 | |
222 | 222 | $price = $item->get_price(); |
223 | 223 | $is_dynamic_pricing = $item->get_is_dynamic_pricing(); |
224 | 224 | $minimum_price = $item->get_minimum_price(); |
225 | 225 | $is_recurring = $item->is_recurring(); |
226 | 226 | $period = $item->get_recurring_period(); |
227 | - $interval = absint( $item->get_recurring_interval() ); |
|
228 | - $times = absint( $item->get_recurring_limit() ); |
|
227 | + $interval = absint($item->get_recurring_interval()); |
|
228 | + $times = absint($item->get_recurring_limit()); |
|
229 | 229 | $free_trial = $item->has_free_trial(); |
230 | 230 | $trial_interval = $item->get_trial_interval(); |
231 | 231 | $trial_period = $item->get_trial_period(); |
232 | 232 | |
233 | 233 | $intervals = array(); |
234 | - for ( $i = 1; $i <= 90; $i++ ) { |
|
234 | + for ($i = 1; $i <= 90; $i++) { |
|
235 | 235 | $intervals[$i] = $i; |
236 | 236 | } |
237 | 237 | |
238 | - $interval = $interval > 0 ? $interval : 1; |
|
238 | + $interval = $interval > 0 ? $interval : 1; |
|
239 | 239 | |
240 | 240 | $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n'; |
241 | 241 | |
242 | 242 | $minimum_price_style = 'margin-left: 24px;'; |
243 | - if(! $is_dynamic_pricing ) { |
|
243 | + if (!$is_dynamic_pricing) { |
|
244 | 244 | $minimum_price_style .= 'display: none;'; |
245 | 245 | } |
246 | 246 | |
247 | 247 | ?> |
248 | - <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" /> |
|
249 | - <?php do_action( 'wpinv_prices_metabox_price', $item ); ?> |
|
248 | + <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" /> |
|
249 | + <?php do_action('wpinv_prices_metabox_price', $item); ?> |
|
250 | 250 | </p> |
251 | 251 | |
252 | - <?php if( $item->supports_dynamic_pricing() ) { ?> |
|
252 | + <?php if ($item->supports_dynamic_pricing()) { ?> |
|
253 | 253 | |
254 | 254 | <p class="wpinv-row-name-your-price"> |
255 | 255 | <label> |
256 | - <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked( 1, $is_dynamic_pricing ); ?> /> |
|
257 | - <?php echo apply_filters( 'wpinv_name_your_price_toggle_text', __( 'User can set a custom price', 'invoicing' ) ); ?> |
|
256 | + <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked(1, $is_dynamic_pricing); ?> /> |
|
257 | + <?php echo apply_filters('wpinv_name_your_price_toggle_text', __('User can set a custom price', 'invoicing')); ?> |
|
258 | 258 | </label> |
259 | - <?php do_action( 'wpinv_prices_metabox_name_your_price_field', $item ); ?> |
|
259 | + <?php do_action('wpinv_prices_metabox_name_your_price_field', $item); ?> |
|
260 | 260 | </p> |
261 | 261 | |
262 | 262 | <p class="wpinv-row-minimum-price" style="<?php echo $minimum_price_style; ?>"> |
263 | 263 | <label> |
264 | - <?php _e( 'Minimum Price', 'invoicing' ); ?> |
|
265 | - <?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $minimum_price;?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?> |
|
264 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
265 | + <?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $minimum_price; ?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?> |
|
266 | 266 | </label> |
267 | 267 | |
268 | - <?php do_action( 'wpinv_prices_metabox_minimum_price_field', $item ); ?> |
|
268 | + <?php do_action('wpinv_prices_metabox_minimum_price_field', $item); ?> |
|
269 | 269 | </p> |
270 | 270 | |
271 | 271 | <?php } ?> |
272 | 272 | |
273 | 273 | <p class="wpinv-row-is-recurring"> |
274 | 274 | <label for="wpinv_is_recurring"> |
275 | - <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> /> |
|
276 | - <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?> |
|
275 | + <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> /> |
|
276 | + <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?> |
|
277 | 277 | </label> |
278 | - <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?> |
|
278 | + <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?> |
|
279 | 279 | </p> |
280 | - <p class="wpinv-row-recurring-fields <?php echo $class;?>"> |
|
281 | - <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label> |
|
282 | - <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array( |
|
280 | + <p class="wpinv-row-recurring-fields <?php echo $class; ?>"> |
|
281 | + <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label> |
|
282 | + <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array( |
|
283 | 283 | 'options' => $intervals, |
284 | 284 | 'name' => 'wpinv_recurring_interval', |
285 | 285 | 'id' => 'wpinv_recurring_interval', |
@@ -287,30 +287,30 @@ discard block |
||
287 | 287 | 'show_option_all' => false, |
288 | 288 | 'show_option_none' => false, |
289 | 289 | 'class' => 'wpi_select2', |
290 | - ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label> |
|
291 | - <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label> |
|
290 | + )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label> |
|
291 | + <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label> |
|
292 | 292 | <span class="clear wpi-trial-clr"></span> |
293 | 293 | <label class="wpinv-free-trial" for="wpinv_free_trial"> |
294 | - <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> |
|
295 | - <?php echo __( 'Offer free trial for', 'invoicing' ); ?> |
|
294 | + <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool) $free_trial); ?> /> |
|
295 | + <?php echo __('Offer free trial for', 'invoicing'); ?> |
|
296 | 296 | </label> |
297 | 297 | <label class="wpinv-trial-interval" for="wpinv_trial_interval"> |
298 | - <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select> |
|
298 | + <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select> |
|
299 | 299 | </label> |
300 | - <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?> |
|
300 | + <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?> |
|
301 | 301 | </p> |
302 | - <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" /> |
|
303 | - <?php do_action( 'wpinv_item_price_field', $post->ID ); ?> |
|
302 | + <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" /> |
|
303 | + <?php do_action('wpinv_item_price_field', $post->ID); ?> |
|
304 | 304 | <?php |
305 | 305 | } |
306 | 306 | |
307 | - public static function vat_rules( $post ) { |
|
307 | + public static function vat_rules($post) { |
|
308 | 308 | global $wpinv_euvat; |
309 | 309 | |
310 | - $rule_type = $wpinv_euvat->get_item_rule( $post->ID ); |
|
310 | + $rule_type = $wpinv_euvat->get_item_rule($post->ID); |
|
311 | 311 | ?> |
312 | - <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label> |
|
313 | - <?php echo wpinv_html_select( array( |
|
312 | + <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label> |
|
313 | + <?php echo wpinv_html_select(array( |
|
314 | 314 | 'options' => $wpinv_euvat->get_rules(), |
315 | 315 | 'name' => 'wpinv_vat_rules', |
316 | 316 | 'id' => 'wpinv_vat_rules', |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | 'show_option_all' => false, |
319 | 319 | 'show_option_none' => false, |
320 | 320 | 'class' => 'gdmbx2-text-medium wpinv-vat-rules wpi_select2', |
321 | - ) ); ?> |
|
321 | + )); ?> |
|
322 | 322 | </p> |
323 | - <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p> |
|
324 | - <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p> |
|
325 | - <p class="wpi-m0"><?php _e( 'Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing' ); ?></p> |
|
323 | + <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing'); ?></p> |
|
324 | + <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing'); ?></p> |
|
325 | + <p class="wpi-m0"><?php _e('Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing'); ?></p> |
|
326 | 326 | <?php |
327 | 327 | } |
328 | 328 | |
329 | - public static function vat_classes( $post ) { |
|
329 | + public static function vat_classes($post) { |
|
330 | 330 | global $wpinv_euvat; |
331 | 331 | |
332 | - $vat_class = $wpinv_euvat->get_item_class( $post->ID ); |
|
332 | + $vat_class = $wpinv_euvat->get_item_class($post->ID); |
|
333 | 333 | ?> |
334 | - <p><?php echo wpinv_html_select( array( |
|
334 | + <p><?php echo wpinv_html_select(array( |
|
335 | 335 | 'options' => $wpinv_euvat->get_all_classes(), |
336 | 336 | 'name' => 'wpinv_vat_class', |
337 | 337 | 'id' => 'wpinv_vat_class', |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | 'show_option_all' => false, |
340 | 340 | 'show_option_none' => false, |
341 | 341 | 'class' => 'gdmbx2-text-medium wpinv-vat-class wpi_select2', |
342 | - ) ); ?> |
|
342 | + )); ?> |
|
343 | 343 | </p> |
344 | - <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p> |
|
344 | + <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p> |
|
345 | 345 | <?php |
346 | 346 | } |
347 | 347 | |
348 | - public static function item_info( $post ) { |
|
349 | - $item_type = wpinv_get_item_type( $post->ID ); |
|
350 | - do_action( 'wpinv_item_info_metabox_before', $post ); |
|
348 | + public static function item_info($post) { |
|
349 | + $item_type = wpinv_get_item_type($post->ID); |
|
350 | + do_action('wpinv_item_info_metabox_before', $post); |
|
351 | 351 | ?> |
352 | - <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label> |
|
353 | - <?php echo wpinv_html_select( array( |
|
352 | + <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label> |
|
353 | + <?php echo wpinv_html_select(array( |
|
354 | 354 | 'options' => wpinv_get_item_types(), |
355 | 355 | 'name' => 'wpinv_item_type', |
356 | 356 | 'id' => 'wpinv_item_type', |
@@ -358,135 +358,135 @@ discard block |
||
358 | 358 | 'show_option_all' => false, |
359 | 359 | 'show_option_none' => false, |
360 | 360 | 'class' => 'gdmbx2-text-medium wpinv-item-type', |
361 | - ) ); ?> |
|
361 | + )); ?> |
|
362 | 362 | </p> |
363 | - <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p> |
|
363 | + <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p> |
|
364 | 364 | <?php |
365 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
365 | + do_action('wpinv_item_info_metabox_after', $post); |
|
366 | 366 | } |
367 | 367 | |
368 | - public static function meta_values( $post ) { |
|
369 | - $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array( |
|
368 | + public static function meta_values($post) { |
|
369 | + $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array( |
|
370 | 370 | 'type', |
371 | 371 | 'custom_id' |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | |
374 | - if ( empty( $meta_keys ) ) { |
|
374 | + if (empty($meta_keys)) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - do_action( 'wpinv_meta_values_metabox_before', $post ); |
|
378 | + do_action('wpinv_meta_values_metabox_before', $post); |
|
379 | 379 | |
380 | - foreach ( $meta_keys as $meta_key ) { |
|
380 | + foreach ($meta_keys as $meta_key) { |
|
381 | 381 | ?> |
382 | - <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p> |
|
382 | + <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p> |
|
383 | 383 | <?php |
384 | 384 | } |
385 | 385 | |
386 | - do_action( 'wpinv_meta_values_metabox_after', $post ); |
|
386 | + do_action('wpinv_meta_values_metabox_after', $post); |
|
387 | 387 | } |
388 | 388 | |
389 | - public static function save( $post_id, $data, $post ) { |
|
390 | - $invoice = new WPInv_Invoice( $post_id ); |
|
389 | + public static function save($post_id, $data, $post) { |
|
390 | + $invoice = new WPInv_Invoice($post_id); |
|
391 | 391 | |
392 | 392 | // Billing |
393 | - $first_name = sanitize_text_field( $data['wpinv_first_name'] ); |
|
394 | - $last_name = sanitize_text_field( $data['wpinv_last_name'] ); |
|
395 | - $company = sanitize_text_field( $data['wpinv_company'] ); |
|
396 | - $vat_number = sanitize_text_field( $data['wpinv_vat_number'] ); |
|
397 | - $phone = sanitize_text_field( $data['wpinv_phone'] ); |
|
398 | - $address = sanitize_text_field( $data['wpinv_address'] ); |
|
399 | - $city = sanitize_text_field( $data['wpinv_city'] ); |
|
400 | - $zip = sanitize_text_field( $data['wpinv_zip'] ); |
|
401 | - $country = sanitize_text_field( $data['wpinv_country'] ); |
|
402 | - $state = sanitize_text_field( $data['wpinv_state'] ); |
|
393 | + $first_name = sanitize_text_field($data['wpinv_first_name']); |
|
394 | + $last_name = sanitize_text_field($data['wpinv_last_name']); |
|
395 | + $company = sanitize_text_field($data['wpinv_company']); |
|
396 | + $vat_number = sanitize_text_field($data['wpinv_vat_number']); |
|
397 | + $phone = sanitize_text_field($data['wpinv_phone']); |
|
398 | + $address = sanitize_text_field($data['wpinv_address']); |
|
399 | + $city = sanitize_text_field($data['wpinv_city']); |
|
400 | + $zip = sanitize_text_field($data['wpinv_zip']); |
|
401 | + $country = sanitize_text_field($data['wpinv_country']); |
|
402 | + $state = sanitize_text_field($data['wpinv_state']); |
|
403 | 403 | |
404 | 404 | // Details |
405 | - $status = sanitize_text_field( $data['wpinv_status'] ); |
|
406 | - $old_status = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status; |
|
407 | - $number = sanitize_text_field( $data['wpinv_number'] ); |
|
408 | - $due_date = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : ''; |
|
405 | + $status = sanitize_text_field($data['wpinv_status']); |
|
406 | + $old_status = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status; |
|
407 | + $number = sanitize_text_field($data['wpinv_number']); |
|
408 | + $due_date = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : ''; |
|
409 | 409 | //$discounts = sanitize_text_field( $data['wpinv_discounts'] ); |
410 | 410 | //$discount = sanitize_text_field( $data['wpinv_discount'] ); |
411 | 411 | |
412 | 412 | $disable_taxes = 0; |
413 | 413 | |
414 | - if ( ! empty( $data['disable_taxes'] ) ) { |
|
414 | + if (!empty($data['disable_taxes'])) { |
|
415 | 415 | $disable_taxes = 1; |
416 | 416 | } |
417 | 417 | |
418 | - $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
419 | - |
|
420 | - $invoice->set( 'due_date', $due_date ); |
|
421 | - $invoice->set( 'first_name', $first_name ); |
|
422 | - $invoice->set( 'last_name', $last_name ); |
|
423 | - $invoice->set( 'company', $company ); |
|
424 | - $invoice->set( 'vat_number', $vat_number ); |
|
425 | - $invoice->set( 'phone', $phone ); |
|
426 | - $invoice->set( 'address', $address ); |
|
427 | - $invoice->set( 'city', $city ); |
|
428 | - $invoice->set( 'zip', $zip ); |
|
429 | - $invoice->set( 'country', $country ); |
|
430 | - $invoice->set( 'state', $state ); |
|
431 | - $invoice->set( 'status', $status ); |
|
432 | - $invoice->set( 'set', $status ); |
|
418 | + $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
419 | + |
|
420 | + $invoice->set('due_date', $due_date); |
|
421 | + $invoice->set('first_name', $first_name); |
|
422 | + $invoice->set('last_name', $last_name); |
|
423 | + $invoice->set('company', $company); |
|
424 | + $invoice->set('vat_number', $vat_number); |
|
425 | + $invoice->set('phone', $phone); |
|
426 | + $invoice->set('address', $address); |
|
427 | + $invoice->set('city', $city); |
|
428 | + $invoice->set('zip', $zip); |
|
429 | + $invoice->set('country', $country); |
|
430 | + $invoice->set('state', $state); |
|
431 | + $invoice->set('status', $status); |
|
432 | + $invoice->set('set', $status); |
|
433 | 433 | //$invoice->set( 'number', $number ); |
434 | 434 | //$invoice->set( 'discounts', $discounts ); |
435 | 435 | //$invoice->set( 'discount', $discount ); |
436 | - $invoice->set( 'disable_taxes', $disable_taxes ); |
|
437 | - $invoice->set( 'ip', $ip ); |
|
436 | + $invoice->set('disable_taxes', $disable_taxes); |
|
437 | + $invoice->set('ip', $ip); |
|
438 | 438 | $invoice->old_status = $_POST['original_post_status']; |
439 | 439 | |
440 | 440 | $currency = $invoice->get_currency(); |
441 | - if ( ! empty( sanitize_text_field( $data['wpinv_currency'] ) ) ) { |
|
442 | - $currency = sanitize_text_field( $data['wpinv_currency'] ); |
|
441 | + if (!empty(sanitize_text_field($data['wpinv_currency']))) { |
|
442 | + $currency = sanitize_text_field($data['wpinv_currency']); |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( empty( $currency ) ) { |
|
445 | + if (empty($currency)) { |
|
446 | 446 | $currency = wpinv_get_currency(); |
447 | 447 | } |
448 | 448 | |
449 | - if ( ! $invoice->is_paid() ) { |
|
449 | + if (!$invoice->is_paid()) { |
|
450 | 450 | $invoice->currency = $currency; |
451 | 451 | } |
452 | 452 | |
453 | - if ( !empty( $data['wpinv_gateway'] ) ) { |
|
454 | - $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) ); |
|
453 | + if (!empty($data['wpinv_gateway'])) { |
|
454 | + $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway'])); |
|
455 | 455 | } |
456 | 456 | $saved = $invoice->save(); |
457 | 457 | |
458 | 458 | // Check for payment notes |
459 | - if ( !empty( $data['invoice_note'] ) ) { |
|
460 | - $note = wp_kses( $data['invoice_note'], array() ); |
|
461 | - $note_type = sanitize_text_field( $data['invoice_note_type'] ); |
|
459 | + if (!empty($data['invoice_note'])) { |
|
460 | + $note = wp_kses($data['invoice_note'], array()); |
|
461 | + $note_type = sanitize_text_field($data['invoice_note_type']); |
|
462 | 462 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
463 | 463 | |
464 | - wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note ); |
|
464 | + wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | // Update user address if empty. |
468 | - if ( $saved && !empty( $invoice ) ) { |
|
469 | - if ( $user_id = $invoice->get_user_id() ) { |
|
470 | - $user_address = wpinv_get_user_address( $user_id, false ); |
|
468 | + if ($saved && !empty($invoice)) { |
|
469 | + if ($user_id = $invoice->get_user_id()) { |
|
470 | + $user_address = wpinv_get_user_address($user_id, false); |
|
471 | 471 | |
472 | 472 | if (empty($user_address['first_name'])) { |
473 | - update_user_meta( $user_id, '_wpinv_first_name', $first_name ); |
|
474 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
473 | + update_user_meta($user_id, '_wpinv_first_name', $first_name); |
|
474 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
475 | 475 | } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) { |
476 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
476 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) { |
480 | - update_user_meta( $user_id, '_wpinv_address', $address ); |
|
481 | - update_user_meta( $user_id, '_wpinv_city', $city ); |
|
482 | - update_user_meta( $user_id, '_wpinv_state', $state ); |
|
483 | - update_user_meta( $user_id, '_wpinv_country', $country ); |
|
484 | - update_user_meta( $user_id, '_wpinv_zip', $zip ); |
|
485 | - update_user_meta( $user_id, '_wpinv_phone', $phone ); |
|
480 | + update_user_meta($user_id, '_wpinv_address', $address); |
|
481 | + update_user_meta($user_id, '_wpinv_city', $city); |
|
482 | + update_user_meta($user_id, '_wpinv_state', $state); |
|
483 | + update_user_meta($user_id, '_wpinv_country', $country); |
|
484 | + update_user_meta($user_id, '_wpinv_zip', $zip); |
|
485 | + update_user_meta($user_id, '_wpinv_phone', $phone); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
489 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | return $saved; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct() { |
15 | 15 | |
16 | - foreach( $this->get_elements() as $element ) { |
|
16 | + foreach ($this->get_elements() as $element) { |
|
17 | 17 | $element = $element['type']; |
18 | 18 | |
19 | - if ( method_exists( $this, "render_{$element}_template" ) ) { |
|
20 | - add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 ); |
|
19 | + if (method_exists($this, "render_{$element}_template")) { |
|
20 | + add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2); |
|
21 | 21 | } |
22 | 22 | |
23 | - if ( method_exists( $this, "edit_{$element}_template" ) ) { |
|
24 | - add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 ); |
|
23 | + if (method_exists($this, "edit_{$element}_template")) { |
|
24 | + add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2); |
|
25 | 25 | } |
26 | 26 | |
27 | - if ( method_exists( $this, "frontend_render_{$element}_template" ) ) { |
|
28 | - add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 ); |
|
27 | + if (method_exists($this, "frontend_render_{$element}_template")) { |
|
28 | + add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function get_elements() { |
39 | 39 | |
40 | - if ( ! empty( $this->elements ) ) { |
|
40 | + if (!empty($this->elements)) { |
|
41 | 41 | return $this->elements; |
42 | 42 | } |
43 | 43 | |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | |
46 | 46 | array( |
47 | 47 | 'type' => 'heading', |
48 | - 'name' => __( 'Heading', 'invoicing' ), |
|
48 | + 'name' => __('Heading', 'invoicing'), |
|
49 | 49 | 'defaults' => array( |
50 | 50 | 'level' => 'h2', |
51 | - 'text' => __( 'Heading', 'invoicing' ), |
|
51 | + 'text' => __('Heading', 'invoicing'), |
|
52 | 52 | ) |
53 | 53 | ), |
54 | 54 | |
55 | 55 | array( |
56 | 56 | 'type' => 'paragraph', |
57 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
57 | + 'name' => __('Paragraph', 'invoicing'), |
|
58 | 58 | 'defaults' => array( |
59 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
59 | + 'text' => __('Paragraph text', 'invoicing'), |
|
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | |
63 | 63 | array( |
64 | 64 | 'type' => 'alert', |
65 | - 'name' => __( 'Alert', 'invoicing' ), |
|
65 | + 'name' => __('Alert', 'invoicing'), |
|
66 | 66 | 'defaults' => array( |
67 | 67 | 'value' => '', |
68 | 68 | 'class' => 'alert-warning', |
69 | - 'text' => __( 'Alert', 'invoicing' ), |
|
69 | + 'text' => __('Alert', 'invoicing'), |
|
70 | 70 | 'dismissible' => false, |
71 | 71 | ) |
72 | 72 | ), |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | array( |
84 | 84 | 'type' => 'text', |
85 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
85 | + 'name' => __('Text Input', 'invoicing'), |
|
86 | 86 | 'defaults' => array( |
87 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
87 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
88 | 88 | 'value' => '', |
89 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
89 | + 'label' => __('Field Label', 'invoicing'), |
|
90 | 90 | 'description' => '', |
91 | 91 | 'required' => false, |
92 | 92 | ) |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | array( |
96 | 96 | 'type' => 'textarea', |
97 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
97 | + 'name' => __('Textarea', 'invoicing'), |
|
98 | 98 | 'defaults' => array( |
99 | - 'placeholder' => __( 'Enter your text hear', 'invoicing' ), |
|
99 | + 'placeholder' => __('Enter your text hear', 'invoicing'), |
|
100 | 100 | 'value' => '', |
101 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
101 | + 'label' => __('Textarea Label', 'invoicing'), |
|
102 | 102 | 'description' => '', |
103 | 103 | 'required' => false, |
104 | 104 | ) |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | |
107 | 107 | array( |
108 | 108 | 'type' => 'select', |
109 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
109 | + 'name' => __('Dropdown', 'invoicing'), |
|
110 | 110 | 'defaults' => array( |
111 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
111 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
112 | 112 | 'value' => '', |
113 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
113 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
114 | 114 | 'description' => '', |
115 | 115 | 'required' => false, |
116 | 116 | 'options' => array( |
117 | - esc_attr__( 'Option One', 'invoicing' ), |
|
118 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
119 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
117 | + esc_attr__('Option One', 'invoicing'), |
|
118 | + esc_attr__('Option Two', 'invoicing'), |
|
119 | + esc_attr__('Option Three', 'invoicing') |
|
120 | 120 | ), |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | |
124 | 124 | array( |
125 | 125 | 'type' => 'checkbox', |
126 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
126 | + 'name' => __('Checkbox', 'invoicing'), |
|
127 | 127 | 'defaults' => array( |
128 | 128 | 'value' => '', |
129 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
129 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
130 | 130 | 'description' => '', |
131 | 131 | 'required' => false, |
132 | 132 | ) |
@@ -134,24 +134,24 @@ discard block |
||
134 | 134 | |
135 | 135 | array( |
136 | 136 | 'type' => 'radio', |
137 | - 'name' => __( 'Multiple Choice', 'invoicing' ), |
|
137 | + 'name' => __('Multiple Choice', 'invoicing'), |
|
138 | 138 | 'defaults' => array( |
139 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
139 | + 'label' => __('Select one choice', 'invoicing'), |
|
140 | 140 | 'options' => array( |
141 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
142 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
143 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
141 | + esc_attr__('Choice One', 'invoicing'), |
|
142 | + esc_attr__('Choice Two', 'invoicing'), |
|
143 | + esc_attr__('Choice Three', 'invoicing') |
|
144 | 144 | ), |
145 | 145 | ) |
146 | 146 | ), |
147 | 147 | |
148 | 148 | array( |
149 | 149 | 'type' => 'date', |
150 | - 'name' => __( 'Date', 'invoicing' ), |
|
150 | + 'name' => __('Date', 'invoicing'), |
|
151 | 151 | 'defaults' => array( |
152 | 152 | 'placeholder' => '', |
153 | 153 | 'value' => '', |
154 | - 'label' => __( 'Date', 'invoicing' ), |
|
154 | + 'label' => __('Date', 'invoicing'), |
|
155 | 155 | 'description' => '', |
156 | 156 | 'required' => false, |
157 | 157 | ) |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | array( |
161 | 161 | 'type' => 'time', |
162 | - 'name' => __( 'Time', 'invoicing' ), |
|
162 | + 'name' => __('Time', 'invoicing'), |
|
163 | 163 | 'defaults' => array( |
164 | 164 | 'placeholder' => '', |
165 | 165 | 'value' => '', |
166 | - 'label' => __( 'Time', 'invoicing' ), |
|
166 | + 'label' => __('Time', 'invoicing'), |
|
167 | 167 | 'description' => '', |
168 | 168 | 'required' => false, |
169 | 169 | ) |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | |
172 | 172 | array( |
173 | 173 | 'type' => 'number', |
174 | - 'name' => __( 'Number', 'invoicing' ), |
|
174 | + 'name' => __('Number', 'invoicing'), |
|
175 | 175 | 'defaults' => array( |
176 | 176 | 'placeholder' => '', |
177 | 177 | 'value' => '', |
178 | - 'label' => __( 'Number', 'invoicing' ), |
|
178 | + 'label' => __('Number', 'invoicing'), |
|
179 | 179 | 'description' => '', |
180 | 180 | 'required' => false, |
181 | 181 | ) |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | array( |
185 | 185 | 'type' => 'website', |
186 | - 'name' => __( 'Website', 'invoicing' ), |
|
186 | + 'name' => __('Website', 'invoicing'), |
|
187 | 187 | 'defaults' => array( |
188 | 188 | 'placeholder' => 'http://example.com', |
189 | 189 | 'value' => '', |
190 | - 'label' => __( 'Website', 'invoicing' ), |
|
190 | + 'label' => __('Website', 'invoicing'), |
|
191 | 191 | 'description' => '', |
192 | 192 | 'required' => false, |
193 | 193 | ) |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | |
196 | 196 | array( |
197 | 197 | 'type' => 'email', |
198 | - 'name' => __( 'Email', 'invoicing' ), |
|
198 | + 'name' => __('Email', 'invoicing'), |
|
199 | 199 | 'defaults' => array( |
200 | 200 | 'placeholder' => '[email protected]', |
201 | 201 | 'value' => '', |
202 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
202 | + 'label' => __('Email Address', 'invoicing'), |
|
203 | 203 | 'description' => '', |
204 | 204 | 'required' => false, |
205 | 205 | ) |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | |
208 | 208 | array( |
209 | 209 | 'type' => 'address', |
210 | - 'name' => __( 'Address', 'invoicing' ), |
|
210 | + 'name' => __('Address', 'invoicing'), |
|
211 | 211 | 'defaults' => array( |
212 | 212 | |
213 | 213 | 'fields' => array( |
214 | 214 | array( |
215 | 215 | 'placeholder' => 'Jon', |
216 | 216 | 'value' => '', |
217 | - 'label' => __( 'First Name', 'invoicing' ), |
|
217 | + 'label' => __('First Name', 'invoicing'), |
|
218 | 218 | 'description' => '', |
219 | 219 | 'required' => false, |
220 | 220 | 'visible' => true, |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | array( |
225 | 225 | 'placeholder' => 'Snow', |
226 | 226 | 'value' => '', |
227 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
227 | + 'label' => __('Last Name', 'invoicing'), |
|
228 | 228 | 'description' => '', |
229 | 229 | 'required' => false, |
230 | 230 | 'visible' => true, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | array( |
235 | 235 | 'placeholder' => '', |
236 | 236 | 'value' => '', |
237 | - 'label' => __( 'Address', 'invoicing' ), |
|
237 | + 'label' => __('Address', 'invoicing'), |
|
238 | 238 | 'description' => '', |
239 | 239 | 'required' => false, |
240 | 240 | 'visible' => true, |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | array( |
245 | 245 | 'placeholder' => '', |
246 | 246 | 'value' => '', |
247 | - 'label' => __( 'City', 'invoicing' ), |
|
247 | + 'label' => __('City', 'invoicing'), |
|
248 | 248 | 'description' => '', |
249 | 249 | 'required' => false, |
250 | 250 | 'visible' => true, |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | array( |
255 | 255 | 'placeholder' => '', |
256 | 256 | 'value' => '', |
257 | - 'label' => __( 'Country', 'invoicing' ), |
|
257 | + 'label' => __('Country', 'invoicing'), |
|
258 | 258 | 'description' => '', |
259 | 259 | 'required' => false, |
260 | 260 | 'visible' => true, |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | ), |
263 | 263 | |
264 | 264 | array( |
265 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
265 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
266 | 266 | 'value' => '', |
267 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
267 | + 'label' => __('State / Province', 'invoicing'), |
|
268 | 268 | 'description' => '', |
269 | 269 | 'required' => false, |
270 | 270 | 'visible' => true, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | array( |
275 | 275 | 'placeholder' => '', |
276 | 276 | 'value' => '', |
277 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
277 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
278 | 278 | 'description' => '', |
279 | 279 | 'required' => false, |
280 | 280 | 'visible' => true, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array( |
285 | 285 | 'placeholder' => '', |
286 | 286 | 'value' => '', |
287 | - 'label' => __( 'Phone', 'invoicing' ), |
|
287 | + 'label' => __('Phone', 'invoicing'), |
|
288 | 288 | 'description' => '', |
289 | 289 | 'required' => false, |
290 | 290 | 'visible' => true, |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | |
297 | 297 | array( |
298 | 298 | 'type' => 'billing_email', |
299 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
299 | + 'name' => __('Billing Email', 'invoicing'), |
|
300 | 300 | 'defaults' => array( |
301 | 301 | 'placeholder' => '[email protected]', |
302 | 302 | 'value' => '', |
303 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
303 | + 'label' => __('Billing Email', 'invoicing'), |
|
304 | 304 | 'description' => '', |
305 | 305 | 'premade' => true, |
306 | 306 | ) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | array( |
321 | 321 | 'type' => 'items', |
322 | - 'name' => __( 'Items', 'invoicing' ), |
|
322 | + 'name' => __('Items', 'invoicing'), |
|
323 | 323 | 'defaults' => array( |
324 | 324 | 'value' => '', |
325 | 325 | 'items_type' => 'total', |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | |
331 | 331 | array( |
332 | 332 | 'type' => 'pay_button', |
333 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
333 | + 'name' => __('Payment Button', 'invoicing'), |
|
334 | 334 | 'defaults' => array( |
335 | 335 | 'value' => '', |
336 | 336 | 'class' => 'btn-primary', |
337 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
338 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
337 | + 'label' => __('Pay Now »', 'invoicing'), |
|
338 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
339 | 339 | 'premade' => true, |
340 | 340 | ) |
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | |
344 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
344 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
345 | 345 | return $this->elements; |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Returns the restrict markup. |
350 | 350 | */ |
351 | - public function get_restrict_markup( $field, $field_type ) { |
|
351 | + public function get_restrict_markup($field, $field_type) { |
|
352 | 352 | $restrict = "$field.type=='$field_type'"; |
353 | 353 | return "v-if=\"$restrict\""; |
354 | 354 | } |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Renders the title element template. |
358 | 358 | */ |
359 | - public function render_heading_template( $field ) { |
|
360 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
359 | + public function render_heading_template($field) { |
|
360 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
361 | 361 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Renders the title element on the frontend. |
366 | 366 | */ |
367 | - public function frontend_render_heading_template( $field ) { |
|
367 | + public function frontend_render_heading_template($field) { |
|
368 | 368 | $tag = $field['level']; |
369 | 369 | echo "<$tag>{$field['text']}</$tag>"; |
370 | 370 | } |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Renders the edit title element template. |
374 | 374 | */ |
375 | - public function edit_heading_template( $field ) { |
|
376 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
377 | - $label = __( 'Heading', 'invoicing' ); |
|
378 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
375 | + public function edit_heading_template($field) { |
|
376 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
377 | + $label = __('Heading', 'invoicing'); |
|
378 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
379 | 379 | $id = $field . '.id + "_edit"'; |
380 | 380 | $id2 = $field . '.id + "_edit2"'; |
381 | 381 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | /** |
408 | 408 | * Renders a paragraph element template. |
409 | 409 | */ |
410 | - public function render_paragraph_template( $field ) { |
|
411 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
410 | + public function render_paragraph_template($field) { |
|
411 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
412 | 412 | $label = "$field.text"; |
413 | 413 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
414 | 414 | } |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | /** |
417 | 417 | * Renders the paragraph element on the frontend. |
418 | 418 | */ |
419 | - public function frontend_render_paragraph_template( $field ) { |
|
419 | + public function frontend_render_paragraph_template($field) { |
|
420 | 420 | echo "<p>{$field['text']}</p>"; |
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Renders the edit paragraph element template. |
425 | 425 | */ |
426 | - public function edit_paragraph_template( $field ) { |
|
427 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
428 | - $label = __( 'Enter your text', 'invoicing' ); |
|
426 | + public function edit_paragraph_template($field) { |
|
427 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
428 | + $label = __('Enter your text', 'invoicing'); |
|
429 | 429 | $id = $field . '.id + "_edit"'; |
430 | 430 | echo " |
431 | 431 | <div $restrict> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | /** |
442 | 442 | * Renders the text element template. |
443 | 443 | */ |
444 | - public function render_text_template( $field ) { |
|
445 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
444 | + public function render_text_template($field) { |
|
445 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
446 | 446 | $label = "$field.label"; |
447 | 447 | echo " |
448 | 448 | <div $restrict> |
@@ -456,23 +456,23 @@ discard block |
||
456 | 456 | /** |
457 | 457 | * Renders the text element on the frontend. |
458 | 458 | */ |
459 | - public function frontend_render_text_template( $field ) { |
|
459 | + public function frontend_render_text_template($field) { |
|
460 | 460 | |
461 | 461 | echo "<div class='form-group'>"; |
462 | 462 | |
463 | 463 | echo aui()->input( |
464 | 464 | array( |
465 | - 'name' => esc_attr( $field['id'] ), |
|
466 | - 'id' => esc_attr( $field['id'] ), |
|
467 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
465 | + 'name' => esc_attr($field['id']), |
|
466 | + 'id' => esc_attr($field['id']), |
|
467 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
468 | 468 | 'required' => (bool) $field['required'], |
469 | - 'label' => wp_kses_post( $field['label'] ), |
|
469 | + 'label' => wp_kses_post($field['label']), |
|
470 | 470 | 'no_wrap' => true, |
471 | 471 | ) |
472 | 472 | ); |
473 | 473 | |
474 | - if ( ! empty( $field['description'] ) ) { |
|
475 | - $description = wp_kses_post( $field['description'] ); |
|
474 | + if (!empty($field['description'])) { |
|
475 | + $description = wp_kses_post($field['description']); |
|
476 | 476 | echo "<small class='form-text text-muted'>$description</small>"; |
477 | 477 | } |
478 | 478 | |
@@ -483,16 +483,16 @@ discard block |
||
483 | 483 | /** |
484 | 484 | * Renders the edit text element template. |
485 | 485 | */ |
486 | - public function edit_text_template( $field ) { |
|
487 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
488 | - $label = __( 'Field Label', 'invoicing' ); |
|
486 | + public function edit_text_template($field) { |
|
487 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
488 | + $label = __('Field Label', 'invoicing'); |
|
489 | 489 | $id = $field . '.id + "_edit"'; |
490 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
490 | + $label2 = __('Placeholder text', 'invoicing'); |
|
491 | 491 | $id2 = $field . '.id + "_edit2"'; |
492 | - $label3 = __( 'Help text', 'invoicing' ); |
|
493 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
492 | + $label3 = __('Help text', 'invoicing'); |
|
493 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
494 | 494 | $id3 = $field . '.id + "_edit3"'; |
495 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
495 | + $label5 = __('Is this field required?', 'invoicing'); |
|
496 | 496 | $id4 = $field . '.id + "_edit4"'; |
497 | 497 | echo " |
498 | 498 | <div $restrict> |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * Renders the textarea element template. |
522 | 522 | */ |
523 | - public function render_textarea_template( $field ) { |
|
524 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
523 | + public function render_textarea_template($field) { |
|
524 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
525 | 525 | $label = "$field.label"; |
526 | 526 | echo " |
527 | 527 | <div $restrict> |
@@ -535,24 +535,24 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * Renders the textarea element on the frontend. |
537 | 537 | */ |
538 | - public function frontend_render_textarea_template( $field ) { |
|
538 | + public function frontend_render_textarea_template($field) { |
|
539 | 539 | |
540 | 540 | echo "<div class='form-group'>"; |
541 | 541 | |
542 | 542 | echo aui()->textarea( |
543 | 543 | array( |
544 | - 'name' => esc_attr( $field['id'] ), |
|
545 | - 'id' => esc_attr( $field['id'] ), |
|
546 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
544 | + 'name' => esc_attr($field['id']), |
|
545 | + 'id' => esc_attr($field['id']), |
|
546 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
547 | 547 | 'required' => (bool) $field['required'], |
548 | - 'label' => wp_kses_post( $field['label'] ), |
|
548 | + 'label' => wp_kses_post($field['label']), |
|
549 | 549 | 'no_wrap' => true, |
550 | 550 | 'rows' => 3, |
551 | 551 | ) |
552 | 552 | ); |
553 | 553 | |
554 | - if ( ! empty( $field['description'] ) ) { |
|
555 | - $description = wp_kses_post( $field['description'] ); |
|
554 | + if (!empty($field['description'])) { |
|
555 | + $description = wp_kses_post($field['description']); |
|
556 | 556 | echo "<small class='form-text text-muted'>$description</small>"; |
557 | 557 | } |
558 | 558 | |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | /** |
564 | 564 | * Renders the edit textarea element template. |
565 | 565 | */ |
566 | - public function edit_textarea_template( $field ) { |
|
567 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
568 | - $label = __( 'Field Label', 'invoicing' ); |
|
566 | + public function edit_textarea_template($field) { |
|
567 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
568 | + $label = __('Field Label', 'invoicing'); |
|
569 | 569 | $id = $field . '.id + "_edit"'; |
570 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
570 | + $label2 = __('Placeholder text', 'invoicing'); |
|
571 | 571 | $id2 = $field . '.id + "_edit2"'; |
572 | - $label3 = __( 'Help text', 'invoicing' ); |
|
573 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
572 | + $label3 = __('Help text', 'invoicing'); |
|
573 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
574 | 574 | $id3 = $field . '.id + "_edit3"'; |
575 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
575 | + $label5 = __('Is this field required?', 'invoicing'); |
|
576 | 576 | $id4 = $field . '.id + "_edit4"'; |
577 | 577 | echo " |
578 | 578 | <div $restrict> |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * Renders the select element template. |
602 | 602 | */ |
603 | - public function render_select_template( $field ) { |
|
604 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
603 | + public function render_select_template($field) { |
|
604 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
605 | 605 | $label = "$field.label"; |
606 | 606 | $placeholder = "$field.placeholder"; |
607 | 607 | $id = $field . '.id'; |
@@ -620,24 +620,24 @@ discard block |
||
620 | 620 | /** |
621 | 621 | * Renders the select element on the frontend. |
622 | 622 | */ |
623 | - public function frontend_render_select_template( $field ) { |
|
623 | + public function frontend_render_select_template($field) { |
|
624 | 624 | |
625 | 625 | echo "<div class='form-group'>"; |
626 | 626 | |
627 | 627 | echo aui()->select( |
628 | 628 | array( |
629 | - 'name' => esc_attr( $field['id'] ), |
|
630 | - 'id' => esc_attr( $field['id'] ), |
|
631 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
629 | + 'name' => esc_attr($field['id']), |
|
630 | + 'id' => esc_attr($field['id']), |
|
631 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
632 | 632 | 'required' => (bool) $field['required'], |
633 | - 'label' => wp_kses_post( $field['label'] ), |
|
633 | + 'label' => wp_kses_post($field['label']), |
|
634 | 634 | 'no_wrap' => true, |
635 | - 'options' => array_combine( $field['options'], $field['options'] ), |
|
635 | + 'options' => array_combine($field['options'], $field['options']), |
|
636 | 636 | ) |
637 | 637 | ); |
638 | 638 | |
639 | - if ( ! empty( $field['description'] ) ) { |
|
640 | - $description = wp_kses_post( $field['description'] ); |
|
639 | + if (!empty($field['description'])) { |
|
640 | + $description = wp_kses_post($field['description']); |
|
641 | 641 | echo "<small class='form-text text-muted'>$description</small>"; |
642 | 642 | } |
643 | 643 | |
@@ -648,18 +648,18 @@ discard block |
||
648 | 648 | /** |
649 | 649 | * Renders the edit select element template. |
650 | 650 | */ |
651 | - public function edit_select_template( $field ) { |
|
652 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
653 | - $label = __( 'Field Label', 'invoicing' ); |
|
651 | + public function edit_select_template($field) { |
|
652 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
653 | + $label = __('Field Label', 'invoicing'); |
|
654 | 654 | $id = $field . '.id + "_edit"'; |
655 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
655 | + $label2 = __('Placeholder text', 'invoicing'); |
|
656 | 656 | $id2 = $field . '.id + "_edit2"'; |
657 | - $label3 = __( 'Help text', 'invoicing' ); |
|
658 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
657 | + $label3 = __('Help text', 'invoicing'); |
|
658 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
659 | 659 | $id3 = $field . '.id + "_edit3"'; |
660 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
660 | + $label5 = __('Is this field required?', 'invoicing'); |
|
661 | 661 | $id4 = $field . '.id + "_edit4"'; |
662 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
662 | + $label6 = __('Available Options', 'invoicing'); |
|
663 | 663 | echo " |
664 | 664 | <div $restrict> |
665 | 665 | <div class='form-group'> |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | /** |
698 | 698 | * Renders the checkbox element template. |
699 | 699 | */ |
700 | - public function render_checkbox_template( $field ) { |
|
701 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
700 | + public function render_checkbox_template($field) { |
|
701 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
702 | 702 | $label = "$field.label"; |
703 | 703 | echo " |
704 | 704 | <div class='form-check' $restrict> |
@@ -712,24 +712,24 @@ discard block |
||
712 | 712 | /** |
713 | 713 | * Renders the checkbox element on the frontend. |
714 | 714 | */ |
715 | - public function frontend_render_checkbox_template( $field ) { |
|
715 | + public function frontend_render_checkbox_template($field) { |
|
716 | 716 | |
717 | 717 | echo "<div class='form-group'>"; |
718 | 718 | |
719 | 719 | echo aui()->input( |
720 | 720 | array( |
721 | - 'name' => esc_attr( $field['id'] ), |
|
722 | - 'id' => esc_attr( $field['id'] ), |
|
721 | + 'name' => esc_attr($field['id']), |
|
722 | + 'id' => esc_attr($field['id']), |
|
723 | 723 | 'required' => (bool) $field['required'], |
724 | - 'label' => wp_kses_post( $field['label'] ), |
|
724 | + 'label' => wp_kses_post($field['label']), |
|
725 | 725 | 'no_wrap' => true, |
726 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
726 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
727 | 727 | 'type' => 'checkbox', |
728 | 728 | ) |
729 | 729 | ); |
730 | 730 | |
731 | - if ( ! empty( $field['description'] ) ) { |
|
732 | - $description = wp_kses_post( $field['description'] ); |
|
731 | + if (!empty($field['description'])) { |
|
732 | + $description = wp_kses_post($field['description']); |
|
733 | 733 | echo "<small class='form-text text-muted'>$description</small>"; |
734 | 734 | } |
735 | 735 | |
@@ -740,14 +740,14 @@ discard block |
||
740 | 740 | /** |
741 | 741 | * Renders the edit checkbox element template. |
742 | 742 | */ |
743 | - public function edit_checkbox_template( $field ) { |
|
744 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
745 | - $label = __( 'Field Label', 'invoicing' ); |
|
743 | + public function edit_checkbox_template($field) { |
|
744 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
745 | + $label = __('Field Label', 'invoicing'); |
|
746 | 746 | $id = $field . '.id + "_edit"'; |
747 | - $label2 = __( 'Help text', 'invoicing' ); |
|
748 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
747 | + $label2 = __('Help text', 'invoicing'); |
|
748 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
749 | 749 | $id2 = $field . '.id + "_edit2"'; |
750 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
750 | + $label4 = __('Is this field required?', 'invoicing'); |
|
751 | 751 | $id3 = $field . '.id + "_edit3"'; |
752 | 752 | echo " |
753 | 753 | <div $restrict> |
@@ -771,8 +771,8 @@ discard block |
||
771 | 771 | /** |
772 | 772 | * Renders the radio element template. |
773 | 773 | */ |
774 | - public function render_radio_template( $field ) { |
|
775 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
774 | + public function render_radio_template($field) { |
|
775 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
776 | 776 | $label = "$field.label"; |
777 | 777 | $id = $field . '.id'; |
778 | 778 | echo " |
@@ -790,20 +790,20 @@ discard block |
||
790 | 790 | /** |
791 | 791 | * Renders the radio element on the frontend. |
792 | 792 | */ |
793 | - public function frontend_render_radio_template( $field ) { |
|
793 | + public function frontend_render_radio_template($field) { |
|
794 | 794 | |
795 | 795 | echo "<div class='form-group'>"; |
796 | 796 | |
797 | - if ( ! empty( $field['label'] ) ) { |
|
798 | - $label = wp_kses_post( $field['label'] ); |
|
797 | + if (!empty($field['label'])) { |
|
798 | + $label = wp_kses_post($field['label']); |
|
799 | 799 | echo "<legend class='col-form-label'>$label</legend>"; |
800 | 800 | } |
801 | 801 | |
802 | - foreach( $field['options'] as $index => $option ) { |
|
802 | + foreach ($field['options'] as $index => $option) { |
|
803 | 803 | $id = $field['id'] . $index; |
804 | 804 | $name = $field['id']; |
805 | - $value = esc_attr( $option ); |
|
806 | - $label = wp_kses_post( $option ); |
|
805 | + $value = esc_attr($option); |
|
806 | + $label = wp_kses_post($option); |
|
807 | 807 | |
808 | 808 | echo " |
809 | 809 | <div class='form-check'> |
@@ -813,8 +813,8 @@ discard block |
||
813 | 813 | "; |
814 | 814 | } |
815 | 815 | |
816 | - if ( ! empty( $field['description'] ) ) { |
|
817 | - $description = wp_kses_post( $field['description'] ); |
|
816 | + if (!empty($field['description'])) { |
|
817 | + $description = wp_kses_post($field['description']); |
|
818 | 818 | echo "<small class='form-text text-muted'>$description</small>"; |
819 | 819 | } |
820 | 820 | |
@@ -825,16 +825,16 @@ discard block |
||
825 | 825 | /** |
826 | 826 | * Renders the edit radio element template. |
827 | 827 | */ |
828 | - public function edit_radio_template( $field ) { |
|
829 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
830 | - $label = __( 'Field Label', 'invoicing' ); |
|
828 | + public function edit_radio_template($field) { |
|
829 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
830 | + $label = __('Field Label', 'invoicing'); |
|
831 | 831 | $id = $field . '.id + "_edit"'; |
832 | - $label2 = __( 'Help text', 'invoicing' ); |
|
833 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
832 | + $label2 = __('Help text', 'invoicing'); |
|
833 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
834 | 834 | $id2 = $field . '.id + "_edit3"'; |
835 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
835 | + $label4 = __('Is this field required?', 'invoicing'); |
|
836 | 836 | $id3 = $field . '.id + "_edit4"'; |
837 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
837 | + $label5 = __('Available Options', 'invoicing'); |
|
838 | 838 | echo " |
839 | 839 | <div $restrict> |
840 | 840 | <div class='form-group'> |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | /** |
869 | 869 | * Renders the address element template. |
870 | 870 | */ |
871 | - public function render_address_template( $field ) { |
|
872 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
871 | + public function render_address_template($field) { |
|
872 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
873 | 873 | |
874 | 874 | echo " |
875 | 875 | <div class='wpinv-address-wrapper' $restrict> |
@@ -887,38 +887,38 @@ discard block |
||
887 | 887 | /** |
888 | 888 | * Renders the address element on the frontend. |
889 | 889 | */ |
890 | - public function frontend_render_address_template( $field ) { |
|
890 | + public function frontend_render_address_template($field) { |
|
891 | 891 | |
892 | 892 | echo "<div class='wpinv-address-fields'>"; |
893 | 893 | |
894 | - foreach( $field['fields'] as $address_field ) { |
|
894 | + foreach ($field['fields'] as $address_field) { |
|
895 | 895 | |
896 | - if ( empty( $address_field['visible'] ) ) { |
|
896 | + if (empty($address_field['visible'])) { |
|
897 | 897 | continue; |
898 | 898 | } |
899 | 899 | |
900 | - $class = esc_attr( $address_field['name'] ); |
|
900 | + $class = esc_attr($address_field['name']); |
|
901 | 901 | echo "<div class='form-group $class'>"; |
902 | 902 | |
903 | 903 | $label = $address_field['label']; |
904 | 904 | |
905 | - if ( ! empty( $address_field['required'] ) ) { |
|
905 | + if (!empty($address_field['required'])) { |
|
906 | 906 | $label .= "<span class='text-danger'> *</span>"; |
907 | 907 | } |
908 | 908 | echo aui()->input( |
909 | 909 | array( |
910 | - 'name' => esc_attr( $address_field['name'] ), |
|
911 | - 'id' => esc_attr( $address_field['name'] ), |
|
910 | + 'name' => esc_attr($address_field['name']), |
|
911 | + 'id' => esc_attr($address_field['name']), |
|
912 | 912 | 'required' => (bool) $address_field['required'], |
913 | - 'label' => wp_kses_post( $label ), |
|
913 | + 'label' => wp_kses_post($label), |
|
914 | 914 | 'no_wrap' => true, |
915 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
915 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
916 | 916 | 'type' => 'text', |
917 | 917 | ) |
918 | 918 | ); |
919 | 919 | |
920 | - if ( ! empty( $address_field['description'] ) ) { |
|
921 | - $description = wp_kses_post( $address_field['description'] ); |
|
920 | + if (!empty($address_field['description'])) { |
|
921 | + $description = wp_kses_post($address_field['description']); |
|
922 | 922 | echo "<small class='form-text text-muted'>$description</small>"; |
923 | 923 | } |
924 | 924 | |
@@ -933,13 +933,13 @@ discard block |
||
933 | 933 | /** |
934 | 934 | * Renders the edit address element template. |
935 | 935 | */ |
936 | - public function edit_address_template( $field ) { |
|
937 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
938 | - $label = __( 'Field Label', 'invoicing' ); |
|
939 | - $label2 = __( 'Placeholder', 'invoicing' ); |
|
940 | - $label3 = __( 'Description', 'invoicing' ); |
|
941 | - $label4 = __( 'Is required', 'invoicing' ); |
|
942 | - $label5 = __( 'Is visible', 'invoicing' ); |
|
936 | + public function edit_address_template($field) { |
|
937 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
938 | + $label = __('Field Label', 'invoicing'); |
|
939 | + $label2 = __('Placeholder', 'invoicing'); |
|
940 | + $label3 = __('Description', 'invoicing'); |
|
941 | + $label4 = __('Is required', 'invoicing'); |
|
942 | + $label5 = __('Is visible', 'invoicing'); |
|
943 | 943 | $id = $field . '.id + "_edit_label"'; |
944 | 944 | $id2 = $field . '.id + "_edit_placeholder"'; |
945 | 945 | $id3 = $field . '.id + "_edit_description"'; |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | /** |
1008 | 1008 | * Renders the email element template. |
1009 | 1009 | */ |
1010 | - public function render_email_template( $field ) { |
|
1011 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1010 | + public function render_email_template($field) { |
|
1011 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1012 | 1012 | $label = "$field.label"; |
1013 | 1013 | echo " |
1014 | 1014 | <div $restrict> |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | /** |
1023 | 1023 | * Renders the billing_email element template. |
1024 | 1024 | */ |
1025 | - public function render_billing_email_template( $field ) { |
|
1026 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1025 | + public function render_billing_email_template($field) { |
|
1026 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1027 | 1027 | $label = "$field.label"; |
1028 | 1028 | echo " |
1029 | 1029 | <div $restrict> |
@@ -1037,24 +1037,24 @@ discard block |
||
1037 | 1037 | /** |
1038 | 1038 | * Renders the email element on the frontend. |
1039 | 1039 | */ |
1040 | - public function frontend_render_email_template( $field ) { |
|
1040 | + public function frontend_render_email_template($field) { |
|
1041 | 1041 | |
1042 | 1042 | echo "<div class='form-group'>"; |
1043 | 1043 | |
1044 | 1044 | echo aui()->input( |
1045 | 1045 | array( |
1046 | - 'name' => esc_attr( $field['id'] ), |
|
1047 | - 'id' => esc_attr( $field['id'] ), |
|
1046 | + 'name' => esc_attr($field['id']), |
|
1047 | + 'id' => esc_attr($field['id']), |
|
1048 | 1048 | 'required' => (bool) $field['required'], |
1049 | - 'label' => wp_kses_post( $field['label'] ), |
|
1049 | + 'label' => wp_kses_post($field['label']), |
|
1050 | 1050 | 'no_wrap' => true, |
1051 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1051 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1052 | 1052 | 'type' => 'email', |
1053 | 1053 | ) |
1054 | 1054 | ); |
1055 | 1055 | |
1056 | - if ( ! empty( $field['description'] ) ) { |
|
1057 | - $description = wp_kses_post( $field['description'] ); |
|
1056 | + if (!empty($field['description'])) { |
|
1057 | + $description = wp_kses_post($field['description']); |
|
1058 | 1058 | echo "<small class='form-text text-muted'>$description</small>"; |
1059 | 1059 | } |
1060 | 1060 | |
@@ -1065,30 +1065,30 @@ discard block |
||
1065 | 1065 | /** |
1066 | 1066 | * Renders the billing email element on the frontend. |
1067 | 1067 | */ |
1068 | - public function frontend_render_billing_email_template( $field ) { |
|
1068 | + public function frontend_render_billing_email_template($field) { |
|
1069 | 1069 | |
1070 | 1070 | echo "<div class='form-group'>"; |
1071 | 1071 | $value = ''; |
1072 | 1072 | |
1073 | - if ( is_user_logged_in() ) { |
|
1073 | + if (is_user_logged_in()) { |
|
1074 | 1074 | $user = wp_get_current_user(); |
1075 | - $value = sanitize_email( $user->user_email ); |
|
1075 | + $value = sanitize_email($user->user_email); |
|
1076 | 1076 | } |
1077 | 1077 | echo aui()->input( |
1078 | 1078 | array( |
1079 | 1079 | 'name' => 'billing_email', |
1080 | 1080 | 'value' => $value, |
1081 | - 'id' => esc_attr( $field['id'] ), |
|
1081 | + 'id' => esc_attr($field['id']), |
|
1082 | 1082 | 'required' => true, |
1083 | - 'label' => wp_kses_post( $field['label'] ), |
|
1083 | + 'label' => wp_kses_post($field['label']), |
|
1084 | 1084 | 'no_wrap' => true, |
1085 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1085 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1086 | 1086 | 'type' => 'email', |
1087 | 1087 | ) |
1088 | 1088 | ); |
1089 | 1089 | |
1090 | - if ( ! empty( $field['description'] ) ) { |
|
1091 | - $description = wp_kses_post( $field['description'] ); |
|
1090 | + if (!empty($field['description'])) { |
|
1091 | + $description = wp_kses_post($field['description']); |
|
1092 | 1092 | echo "<small class='form-text text-muted'>$description</small>"; |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1099,16 +1099,16 @@ discard block |
||
1099 | 1099 | /** |
1100 | 1100 | * Renders the edit email element template. |
1101 | 1101 | */ |
1102 | - public function edit_email_template( $field ) { |
|
1103 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1104 | - $label = __( 'Field Label', 'invoicing' ); |
|
1102 | + public function edit_email_template($field) { |
|
1103 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1104 | + $label = __('Field Label', 'invoicing'); |
|
1105 | 1105 | $id = $field . '.id + "_edit"'; |
1106 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1106 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1107 | 1107 | $id2 = $field . '.id + "_edit2"'; |
1108 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1109 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1108 | + $label3 = __('Help text', 'invoicing'); |
|
1109 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1110 | 1110 | $id3 = $field . '.id + "_edit3"'; |
1111 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1111 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1112 | 1112 | $id4 = $field . '.id + "_edit4"'; |
1113 | 1113 | echo " |
1114 | 1114 | <div $restrict> |
@@ -1136,16 +1136,16 @@ discard block |
||
1136 | 1136 | /** |
1137 | 1137 | * Renders the edit billing_email element template. |
1138 | 1138 | */ |
1139 | - public function edit_billing_email_template( $field ) { |
|
1140 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1141 | - $label = __( 'Field Label', 'invoicing' ); |
|
1139 | + public function edit_billing_email_template($field) { |
|
1140 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1141 | + $label = __('Field Label', 'invoicing'); |
|
1142 | 1142 | $id = $field . '.id + "_edit"'; |
1143 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1143 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1144 | 1144 | $id2 = $field . '.id + "_edit2"'; |
1145 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1146 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1145 | + $label3 = __('Help text', 'invoicing'); |
|
1146 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1147 | 1147 | $id3 = $field . '.id + "_edit3"'; |
1148 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1148 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1149 | 1149 | $id4 = $field . '.id + "_edit4"'; |
1150 | 1150 | echo " |
1151 | 1151 | <div $restrict> |
@@ -1169,8 +1169,8 @@ discard block |
||
1169 | 1169 | /** |
1170 | 1170 | * Renders the website element template. |
1171 | 1171 | */ |
1172 | - public function render_website_template( $field ) { |
|
1173 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1172 | + public function render_website_template($field) { |
|
1173 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1174 | 1174 | $label = "$field.label"; |
1175 | 1175 | echo " |
1176 | 1176 | <div $restrict> |
@@ -1184,24 +1184,24 @@ discard block |
||
1184 | 1184 | /** |
1185 | 1185 | * Renders the website element on the frontend. |
1186 | 1186 | */ |
1187 | - public function frontend_render_website_template( $field ) { |
|
1187 | + public function frontend_render_website_template($field) { |
|
1188 | 1188 | |
1189 | 1189 | echo "<div class='form-group'>"; |
1190 | 1190 | |
1191 | 1191 | echo aui()->input( |
1192 | 1192 | array( |
1193 | - 'name' => esc_attr( $field['id'] ), |
|
1194 | - 'id' => esc_attr( $field['id'] ), |
|
1193 | + 'name' => esc_attr($field['id']), |
|
1194 | + 'id' => esc_attr($field['id']), |
|
1195 | 1195 | 'required' => (bool) $field['required'], |
1196 | - 'label' => wp_kses_post( $field['label'] ), |
|
1196 | + 'label' => wp_kses_post($field['label']), |
|
1197 | 1197 | 'no_wrap' => true, |
1198 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1198 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1199 | 1199 | 'type' => 'url', |
1200 | 1200 | ) |
1201 | 1201 | ); |
1202 | 1202 | |
1203 | - if ( ! empty( $field['description'] ) ) { |
|
1204 | - $description = wp_kses_post( $field['description'] ); |
|
1203 | + if (!empty($field['description'])) { |
|
1204 | + $description = wp_kses_post($field['description']); |
|
1205 | 1205 | echo "<small class='form-text text-muted'>$description</small>"; |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1212,16 +1212,16 @@ discard block |
||
1212 | 1212 | /** |
1213 | 1213 | * Renders the edit website element template. |
1214 | 1214 | */ |
1215 | - public function edit_website_template( $field ) { |
|
1216 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1217 | - $label = __( 'Field Label', 'invoicing' ); |
|
1215 | + public function edit_website_template($field) { |
|
1216 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1217 | + $label = __('Field Label', 'invoicing'); |
|
1218 | 1218 | $id = $field . '.id + "_edit"'; |
1219 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1219 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1220 | 1220 | $id2 = $field . '.id + "_edit2"'; |
1221 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1222 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1221 | + $label3 = __('Help text', 'invoicing'); |
|
1222 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1223 | 1223 | $id3 = $field . '.id + "_edit3"'; |
1224 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1224 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1225 | 1225 | $id4 = $field . '.id + "_edit4"'; |
1226 | 1226 | echo " |
1227 | 1227 | <div $restrict> |
@@ -1249,8 +1249,8 @@ discard block |
||
1249 | 1249 | /** |
1250 | 1250 | * Renders the date element template. |
1251 | 1251 | */ |
1252 | - public function render_date_template( $field ) { |
|
1253 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1252 | + public function render_date_template($field) { |
|
1253 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1254 | 1254 | $label = "$field.label"; |
1255 | 1255 | echo " |
1256 | 1256 | <div $restrict> |
@@ -1264,24 +1264,24 @@ discard block |
||
1264 | 1264 | /** |
1265 | 1265 | * Renders the date element on the frontend. |
1266 | 1266 | */ |
1267 | - public function frontend_render_date_template( $field ) { |
|
1267 | + public function frontend_render_date_template($field) { |
|
1268 | 1268 | |
1269 | 1269 | echo "<div class='form-group'>"; |
1270 | 1270 | |
1271 | 1271 | echo aui()->input( |
1272 | 1272 | array( |
1273 | - 'name' => esc_attr( $field['id'] ), |
|
1274 | - 'id' => esc_attr( $field['id'] ), |
|
1273 | + 'name' => esc_attr($field['id']), |
|
1274 | + 'id' => esc_attr($field['id']), |
|
1275 | 1275 | 'required' => (bool) $field['required'], |
1276 | - 'label' => wp_kses_post( $field['label'] ), |
|
1277 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1276 | + 'label' => wp_kses_post($field['label']), |
|
1277 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1278 | 1278 | 'no_wrap' => true, |
1279 | 1279 | 'type' => 'date', |
1280 | 1280 | ) |
1281 | 1281 | ); |
1282 | 1282 | |
1283 | - if ( ! empty( $field['description'] ) ) { |
|
1284 | - $description = wp_kses_post( $field['description'] ); |
|
1283 | + if (!empty($field['description'])) { |
|
1284 | + $description = wp_kses_post($field['description']); |
|
1285 | 1285 | echo "<small class='form-text text-muted'>$description</small>"; |
1286 | 1286 | } |
1287 | 1287 | |
@@ -1292,16 +1292,16 @@ discard block |
||
1292 | 1292 | /** |
1293 | 1293 | * Renders the edit date element template. |
1294 | 1294 | */ |
1295 | - public function edit_date_template( $field ) { |
|
1296 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1297 | - $label = __( 'Field Label', 'invoicing' ); |
|
1295 | + public function edit_date_template($field) { |
|
1296 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1297 | + $label = __('Field Label', 'invoicing'); |
|
1298 | 1298 | $id = $field . '.id + "_edit"'; |
1299 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1299 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1300 | 1300 | $id2 = $field . '.id + "_edit2"'; |
1301 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1302 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1301 | + $label3 = __('Help text', 'invoicing'); |
|
1302 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1303 | 1303 | $id3 = $field . '.id + "_edit3"'; |
1304 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1304 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1305 | 1305 | $id4 = $field . '.id + "_edit4"'; |
1306 | 1306 | echo " |
1307 | 1307 | <div $restrict> |
@@ -1329,8 +1329,8 @@ discard block |
||
1329 | 1329 | /** |
1330 | 1330 | * Renders the time element template. |
1331 | 1331 | */ |
1332 | - public function render_time_template( $field ) { |
|
1333 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1332 | + public function render_time_template($field) { |
|
1333 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1334 | 1334 | $label = "$field.label"; |
1335 | 1335 | echo " |
1336 | 1336 | <div $restrict> |
@@ -1344,24 +1344,24 @@ discard block |
||
1344 | 1344 | /** |
1345 | 1345 | * Renders the time element on the frontend. |
1346 | 1346 | */ |
1347 | - public function frontend_render_time_template( $field ) { |
|
1347 | + public function frontend_render_time_template($field) { |
|
1348 | 1348 | |
1349 | 1349 | echo "<div class='form-group'>"; |
1350 | 1350 | |
1351 | 1351 | echo aui()->input( |
1352 | 1352 | array( |
1353 | - 'name' => esc_attr( $field['id'] ), |
|
1354 | - 'id' => esc_attr( $field['id'] ), |
|
1353 | + 'name' => esc_attr($field['id']), |
|
1354 | + 'id' => esc_attr($field['id']), |
|
1355 | 1355 | 'required' => (bool) $field['required'], |
1356 | - 'label' => wp_kses_post( $field['label'] ), |
|
1356 | + 'label' => wp_kses_post($field['label']), |
|
1357 | 1357 | 'no_wrap' => true, |
1358 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1358 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1359 | 1359 | 'type' => 'time', |
1360 | 1360 | ) |
1361 | 1361 | ); |
1362 | 1362 | |
1363 | - if ( ! empty( $field['description'] ) ) { |
|
1364 | - $description = wp_kses_post( $field['description'] ); |
|
1363 | + if (!empty($field['description'])) { |
|
1364 | + $description = wp_kses_post($field['description']); |
|
1365 | 1365 | echo "<small class='form-text text-muted'>$description</small>"; |
1366 | 1366 | } |
1367 | 1367 | |
@@ -1372,16 +1372,16 @@ discard block |
||
1372 | 1372 | /** |
1373 | 1373 | * Renders the edit time element template. |
1374 | 1374 | */ |
1375 | - public function edit_time_template( $field ) { |
|
1376 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1377 | - $label = __( 'Field Label', 'invoicing' ); |
|
1375 | + public function edit_time_template($field) { |
|
1376 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1377 | + $label = __('Field Label', 'invoicing'); |
|
1378 | 1378 | $id = $field . '.id + "_edit"'; |
1379 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1379 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1380 | 1380 | $id2 = $field . '.id + "_edit2"'; |
1381 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1382 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1381 | + $label3 = __('Help text', 'invoicing'); |
|
1382 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1383 | 1383 | $id3 = $field . '.id + "_edit3"'; |
1384 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1384 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1385 | 1385 | $id4 = $field . '.id + "_edit4"'; |
1386 | 1386 | echo " |
1387 | 1387 | <div $restrict> |
@@ -1409,8 +1409,8 @@ discard block |
||
1409 | 1409 | /** |
1410 | 1410 | * Renders the number element template. |
1411 | 1411 | */ |
1412 | - public function render_number_template( $field ) { |
|
1413 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1412 | + public function render_number_template($field) { |
|
1413 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1414 | 1414 | $label = "$field.label"; |
1415 | 1415 | echo " |
1416 | 1416 | <div $restrict> |
@@ -1424,24 +1424,24 @@ discard block |
||
1424 | 1424 | /** |
1425 | 1425 | * Renders the number element on the frontend. |
1426 | 1426 | */ |
1427 | - public function frontend_render_number_template( $field ) { |
|
1427 | + public function frontend_render_number_template($field) { |
|
1428 | 1428 | |
1429 | 1429 | echo "<div class='form-group'>"; |
1430 | 1430 | |
1431 | 1431 | echo aui()->input( |
1432 | 1432 | array( |
1433 | - 'name' => esc_attr( $field['id'] ), |
|
1434 | - 'id' => esc_attr( $field['id'] ), |
|
1433 | + 'name' => esc_attr($field['id']), |
|
1434 | + 'id' => esc_attr($field['id']), |
|
1435 | 1435 | 'required' => (bool) $field['required'], |
1436 | - 'label' => wp_kses_post( $field['label'] ), |
|
1437 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1436 | + 'label' => wp_kses_post($field['label']), |
|
1437 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1438 | 1438 | 'no_wrap' => true, |
1439 | 1439 | 'type' => 'number', |
1440 | 1440 | ) |
1441 | 1441 | ); |
1442 | 1442 | |
1443 | - if ( ! empty( $field['description'] ) ) { |
|
1444 | - $description = wp_kses_post( $field['description'] ); |
|
1443 | + if (!empty($field['description'])) { |
|
1444 | + $description = wp_kses_post($field['description']); |
|
1445 | 1445 | echo "<small class='form-text text-muted'>$description</small>"; |
1446 | 1446 | } |
1447 | 1447 | |
@@ -1452,16 +1452,16 @@ discard block |
||
1452 | 1452 | /** |
1453 | 1453 | * Renders the edit number element template. |
1454 | 1454 | */ |
1455 | - public function edit_number_template( $field ) { |
|
1456 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1457 | - $label = __( 'Field Label', 'invoicing' ); |
|
1455 | + public function edit_number_template($field) { |
|
1456 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1457 | + $label = __('Field Label', 'invoicing'); |
|
1458 | 1458 | $id = $field . '.id + "_edit"'; |
1459 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1459 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1460 | 1460 | $id2 = $field . '.id + "_edit2"'; |
1461 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1462 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1461 | + $label3 = __('Help text', 'invoicing'); |
|
1462 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1463 | 1463 | $id3 = $field . '.id + "_edit3"'; |
1464 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1464 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1465 | 1465 | $id4 = $field . '.id + "_edit4"'; |
1466 | 1466 | echo " |
1467 | 1467 | <div $restrict> |
@@ -1489,23 +1489,23 @@ discard block |
||
1489 | 1489 | /** |
1490 | 1490 | * Renders the separator element template. |
1491 | 1491 | */ |
1492 | - public function render_separator_template( $field ) { |
|
1493 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
1492 | + public function render_separator_template($field) { |
|
1493 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
1494 | 1494 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | /** |
1498 | 1498 | * Renders the separator element on the frontend. |
1499 | 1499 | */ |
1500 | - public function frontend_render_separator_template( $field ) { |
|
1500 | + public function frontend_render_separator_template($field) { |
|
1501 | 1501 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
1505 | 1505 | * Renders the pay button element template. |
1506 | 1506 | */ |
1507 | - public function render_pay_button_template( $field ) { |
|
1508 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1507 | + public function render_pay_button_template($field) { |
|
1508 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1509 | 1509 | $label = "$field.label"; |
1510 | 1510 | echo " |
1511 | 1511 | <div $restrict> |
@@ -1518,24 +1518,24 @@ discard block |
||
1518 | 1518 | /** |
1519 | 1519 | * Renders the pay_button element on the frontend. |
1520 | 1520 | */ |
1521 | - public function frontend_render_pay_button_template( $field ) { |
|
1521 | + public function frontend_render_pay_button_template($field) { |
|
1522 | 1522 | |
1523 | 1523 | echo "<div class='form-group'>"; |
1524 | 1524 | |
1525 | - $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
1525 | + $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
1526 | 1526 | echo aui()->input( |
1527 | 1527 | array( |
1528 | - 'name' => esc_attr( $field['id'] ), |
|
1529 | - 'id' => esc_attr( $field['id'] ), |
|
1530 | - 'value' => esc_attr( $field['label'] ), |
|
1528 | + 'name' => esc_attr($field['id']), |
|
1529 | + 'id' => esc_attr($field['id']), |
|
1530 | + 'value' => esc_attr($field['label']), |
|
1531 | 1531 | 'no_wrap' => true, |
1532 | 1532 | 'type' => 'submit', |
1533 | 1533 | 'class' => $class, |
1534 | 1534 | ) |
1535 | 1535 | ); |
1536 | 1536 | |
1537 | - if ( ! empty( $field['description'] ) ) { |
|
1538 | - $description = wp_kses_post( $field['description'] ); |
|
1537 | + if (!empty($field['description'])) { |
|
1538 | + $description = wp_kses_post($field['description']); |
|
1539 | 1539 | echo "<small class='form-text text-muted'>$description</small>"; |
1540 | 1540 | } |
1541 | 1541 | |
@@ -1546,14 +1546,14 @@ discard block |
||
1546 | 1546 | /** |
1547 | 1547 | * Renders the pay button element template. |
1548 | 1548 | */ |
1549 | - public function edit_pay_button_template( $field ) { |
|
1550 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1551 | - $label = __( 'Button Text', 'invoicing' ); |
|
1549 | + public function edit_pay_button_template($field) { |
|
1550 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1551 | + $label = __('Button Text', 'invoicing'); |
|
1552 | 1552 | $id = $field . '.id + "_edit"'; |
1553 | - $label2 = __( 'Help text', 'invoicing' ); |
|
1554 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1553 | + $label2 = __('Help text', 'invoicing'); |
|
1554 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1555 | 1555 | $id2 = $field . '.id + "_edit2"'; |
1556 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
1556 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
1557 | 1557 | $id3 = $field . '.id + "_edit3"'; |
1558 | 1558 | echo " |
1559 | 1559 | <div $restrict> |
@@ -1569,15 +1569,15 @@ discard block |
||
1569 | 1569 | <label :for='$id3'>$label4</label> |
1570 | 1570 | |
1571 | 1571 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1572 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1573 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1574 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1575 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1576 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1577 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1578 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1579 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1580 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
1572 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1573 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1574 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
1575 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1576 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1577 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
1578 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
1579 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1580 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
1581 | 1581 | </select> |
1582 | 1582 | </div> |
1583 | 1583 | </div> |
@@ -1588,8 +1588,8 @@ discard block |
||
1588 | 1588 | /** |
1589 | 1589 | * Renders the alert element template. |
1590 | 1590 | */ |
1591 | - public function render_alert_template( $field ) { |
|
1592 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1591 | + public function render_alert_template($field) { |
|
1592 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1593 | 1593 | $text = "$field.text"; |
1594 | 1594 | echo " |
1595 | 1595 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1604,15 +1604,15 @@ discard block |
||
1604 | 1604 | /** |
1605 | 1605 | * Renders the alert element on the frontend. |
1606 | 1606 | */ |
1607 | - public function frontend_render_alert_template( $field ) { |
|
1607 | + public function frontend_render_alert_template($field) { |
|
1608 | 1608 | |
1609 | 1609 | echo "<div class='form-group'>"; |
1610 | 1610 | |
1611 | 1611 | echo aui()->alert( |
1612 | 1612 | array( |
1613 | - 'content' => wp_kses_post( $field['text'] ), |
|
1613 | + 'content' => wp_kses_post($field['text']), |
|
1614 | 1614 | 'dismissible' => $field['dismissible'], |
1615 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
1615 | + 'type' => str_replace('alert-', '', $field['class']), |
|
1616 | 1616 | ) |
1617 | 1617 | ); |
1618 | 1618 | |
@@ -1623,14 +1623,14 @@ discard block |
||
1623 | 1623 | /** |
1624 | 1624 | * Renders the alert element template. |
1625 | 1625 | */ |
1626 | - public function edit_alert_template( $field ) { |
|
1627 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1628 | - $label = __( 'Alert Text', 'invoicing' ); |
|
1629 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
1626 | + public function edit_alert_template($field) { |
|
1627 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1628 | + $label = __('Alert Text', 'invoicing'); |
|
1629 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
1630 | 1630 | $id = $field . '.id + "_edit"'; |
1631 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
1631 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
1632 | 1632 | $id2 = $field . '.id + "_edit2"'; |
1633 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
1633 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
1634 | 1634 | $id3 = $field . '.id + "_edit3"'; |
1635 | 1635 | echo " |
1636 | 1636 | <div $restrict> |
@@ -1646,14 +1646,14 @@ discard block |
||
1646 | 1646 | <label :for='$id3'>$label4</label> |
1647 | 1647 | |
1648 | 1648 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1649 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1650 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1651 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1652 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1653 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1654 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1655 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1656 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1649 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1650 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1651 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
1652 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1653 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1654 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
1655 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
1656 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1657 | 1657 | </select> |
1658 | 1658 | </div> |
1659 | 1659 | </div> |
@@ -1664,8 +1664,8 @@ discard block |
||
1664 | 1664 | /** |
1665 | 1665 | * Renders the discount element template. |
1666 | 1666 | */ |
1667 | - public function render_discount_template( $field ) { |
|
1668 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1667 | + public function render_discount_template($field) { |
|
1668 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1669 | 1669 | ?> |
1670 | 1670 | |
1671 | 1671 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1682,13 +1682,13 @@ discard block |
||
1682 | 1682 | /** |
1683 | 1683 | * Renders the discount element on the frontend. |
1684 | 1684 | */ |
1685 | - public function frontend_render_discount_template( $field ) { |
|
1685 | + public function frontend_render_discount_template($field) { |
|
1686 | 1686 | |
1687 | - $placeholder = esc_attr( $field['input_label'] ); |
|
1688 | - $label = sanitize_text_field( $field['button_label'] ); |
|
1687 | + $placeholder = esc_attr($field['input_label']); |
|
1688 | + $label = sanitize_text_field($field['button_label']); |
|
1689 | 1689 | $description = ''; |
1690 | 1690 | |
1691 | - if ( ! empty( $field['description'] ) ) { |
|
1691 | + if (!empty($field['description'])) { |
|
1692 | 1692 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
1693 | 1693 | } |
1694 | 1694 | ?> |
@@ -1709,12 +1709,12 @@ discard block |
||
1709 | 1709 | /** |
1710 | 1710 | * Renders the discount element template. |
1711 | 1711 | */ |
1712 | - public function edit_discount_template( $field ) { |
|
1713 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1714 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
1715 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
1716 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1717 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
1712 | + public function edit_discount_template($field) { |
|
1713 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1714 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
1715 | + $label2 = __('Help Text', 'invoicing'); |
|
1716 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1717 | + $label4 = __('Button Text', 'invoicing'); |
|
1718 | 1718 | $id = $field . '.id + "_edit"'; |
1719 | 1719 | $id2 = $field . '.id + "_edit2"'; |
1720 | 1720 | $id3 = $field . '.id + "_edit3"'; |
@@ -1743,48 +1743,48 @@ discard block |
||
1743 | 1743 | /** |
1744 | 1744 | * Renders the items element template. |
1745 | 1745 | */ |
1746 | - public function render_items_template( $field ) { |
|
1747 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1748 | - $label = __( 'Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing' ); |
|
1746 | + public function render_items_template($field) { |
|
1747 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1748 | + $label = __('Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing'); |
|
1749 | 1749 | echo "<div $restrict class='item_totals p-4 bg-warning'>$label</div>"; |
1750 | 1750 | } |
1751 | 1751 | |
1752 | 1752 | /** |
1753 | 1753 | * Renders the items element on the frontend. |
1754 | 1754 | */ |
1755 | - public function frontend_render_items_template( $field, $items ) { |
|
1755 | + public function frontend_render_items_template($field, $items) { |
|
1756 | 1756 | |
1757 | 1757 | echo "<div class='form-group item_totals'>"; |
1758 | 1758 | |
1759 | - $id = esc_attr( $field['id'] ); |
|
1760 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1759 | + $id = esc_attr($field['id']); |
|
1760 | + if ('total' == $field['items_type']) { |
|
1761 | 1761 | $total = 0; |
1762 | 1762 | |
1763 | 1763 | ?> |
1764 | 1764 | <div class="border item_totals_type_total"> |
1765 | 1765 | |
1766 | 1766 | <?php |
1767 | - foreach( $items as $item ) { |
|
1768 | - $total = $total + floatval( $item['price'] ); |
|
1767 | + foreach ($items as $item) { |
|
1768 | + $total = $total + floatval($item['price']); |
|
1769 | 1769 | |
1770 | 1770 | $class = 'col-8'; |
1771 | 1771 | $class2 = ''; |
1772 | 1772 | |
1773 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1773 | + if (!empty($item['allow_quantities'])) { |
|
1774 | 1774 | $class = 'col-6 pt-2'; |
1775 | 1775 | $class2 = 'pt-2'; |
1776 | 1776 | } |
1777 | 1777 | |
1778 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1778 | + if (!empty($item['custom_price'])) { |
|
1779 | 1779 | $class .= ' pt-2'; |
1780 | 1780 | } |
1781 | 1781 | |
1782 | 1782 | ?> |
1783 | 1783 | <div class="item_totals_item"> |
1784 | 1784 | <div class='row pl-2 pr-2 pt-2'> |
1785 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
1785 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
1786 | 1786 | |
1787 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
1787 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
1788 | 1788 | |
1789 | 1789 | <div class='col-2'> |
1790 | 1790 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -1792,11 +1792,11 @@ discard block |
||
1792 | 1792 | |
1793 | 1793 | <?php } else { ?> |
1794 | 1794 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
1795 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
1795 | + <?php } if (empty($item['custom_price'])) { ?> |
|
1796 | 1796 | |
1797 | 1797 | <div class='col-4 <?php echo $class2; ?>'> |
1798 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
1799 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
1798 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
1799 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
1800 | 1800 | </div> |
1801 | 1801 | |
1802 | 1802 | <?php } else {?> |
@@ -1804,15 +1804,15 @@ discard block |
||
1804 | 1804 | <div class='col-4'> |
1805 | 1805 | <div class='input-group'> |
1806 | 1806 | |
1807 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
1807 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
1808 | 1808 | <div class='input-group-prepend'> |
1809 | 1809 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1810 | 1810 | </div> |
1811 | 1811 | <?php } ?> |
1812 | 1812 | |
1813 | - <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
1813 | + <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
1814 | 1814 | |
1815 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
1815 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
1816 | 1816 | <div class='input-group-append'> |
1817 | 1817 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1818 | 1818 | </div> |
@@ -1823,38 +1823,38 @@ discard block |
||
1823 | 1823 | <?php } ?> |
1824 | 1824 | |
1825 | 1825 | </div> |
1826 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1827 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1826 | + <?php if (!empty($item['description'])) { ?> |
|
1827 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1828 | 1828 | <?php } ?> |
1829 | 1829 | </div> |
1830 | 1830 | <?php } ?> |
1831 | 1831 | |
1832 | 1832 | <div class='mt-4 border-top item_totals_total'> |
1833 | 1833 | <div class='row p-2'> |
1834 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1835 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1834 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1835 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1836 | 1836 | </div> |
1837 | 1837 | </div> |
1838 | 1838 | |
1839 | 1839 | </div> |
1840 | 1840 | <?php } ?> |
1841 | 1841 | |
1842 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1842 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1843 | 1843 | <div class="item_totals_type_radio"> |
1844 | 1844 | |
1845 | 1845 | <?php |
1846 | - foreach( $items as $index => $item ) { |
|
1846 | + foreach ($items as $index => $item) { |
|
1847 | 1847 | |
1848 | - if ( ! empty( $item['required'] ) ) { |
|
1848 | + if (!empty($item['required'])) { |
|
1849 | 1849 | continue; |
1850 | 1850 | } |
1851 | 1851 | ?> |
1852 | 1852 | <div class="form-check"> |
1853 | - <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1854 | - <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?> <strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); ?></strong></label> |
|
1853 | + <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1854 | + <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?> <strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label> |
|
1855 | 1855 | </div> |
1856 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1857 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1856 | + <?php if (!empty($item['description'])) { ?> |
|
1857 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1858 | 1858 | <?php } ?> |
1859 | 1859 | <?php } ?> |
1860 | 1860 | |
@@ -1864,29 +1864,29 @@ discard block |
||
1864 | 1864 | |
1865 | 1865 | $total = 0; |
1866 | 1866 | |
1867 | - foreach ( $items as $item ) { |
|
1867 | + foreach ($items as $item) { |
|
1868 | 1868 | |
1869 | 1869 | $class = 'col-8'; |
1870 | 1870 | $class2 = ''; |
1871 | 1871 | |
1872 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1872 | + if (!empty($item['allow_quantities'])) { |
|
1873 | 1873 | $class = 'col-6 pt-2'; |
1874 | 1874 | $class2 = 'pt-2'; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1877 | + if (!empty($item['custom_price'])) { |
|
1878 | 1878 | $class .= ' pt-2'; |
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | $class3 = 'd-none'; |
1882 | 1882 | $name = ''; |
1883 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
1883 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
1884 | 1884 | |
1885 | - $total = $total + floatval( $item['price'] ); |
|
1885 | + $total = $total + floatval($item['price']); |
|
1886 | 1886 | $class3 = ''; |
1887 | 1887 | $name = "wpinv-items[{$item['id']}]"; |
1888 | 1888 | |
1889 | - if ( empty( $item['required'] ) ) { |
|
1889 | + if (empty($item['required'])) { |
|
1890 | 1890 | $totals_selected_radio_item = 1; |
1891 | 1891 | } |
1892 | 1892 | |
@@ -1898,9 +1898,9 @@ discard block |
||
1898 | 1898 | |
1899 | 1899 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
1900 | 1900 | <div class='row pl-2 pr-2 pt-2'> |
1901 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
1901 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
1902 | 1902 | |
1903 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
1903 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
1904 | 1904 | |
1905 | 1905 | <div class='col-2'> |
1906 | 1906 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -1908,11 +1908,11 @@ discard block |
||
1908 | 1908 | |
1909 | 1909 | <?php } else { ?> |
1910 | 1910 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
1911 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
1911 | + <?php } if (empty($item['custom_price'])) { ?> |
|
1912 | 1912 | |
1913 | 1913 | <div class='col-4 <?php echo $class2; ?>'> |
1914 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
1915 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
1914 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
1915 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
1916 | 1916 | </div> |
1917 | 1917 | |
1918 | 1918 | <?php } else {?> |
@@ -1920,15 +1920,15 @@ discard block |
||
1920 | 1920 | <div class='col-4'> |
1921 | 1921 | <div class='input-group'> |
1922 | 1922 | |
1923 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
1923 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
1924 | 1924 | <div class='input-group-prepend'> |
1925 | 1925 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1926 | 1926 | </div> |
1927 | 1927 | <?php } ?> |
1928 | 1928 | |
1929 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
1929 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
1930 | 1930 | |
1931 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
1931 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
1932 | 1932 | <div class='input-group-append'> |
1933 | 1933 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1934 | 1934 | </div> |
@@ -1939,16 +1939,16 @@ discard block |
||
1939 | 1939 | <?php } ?> |
1940 | 1940 | |
1941 | 1941 | </div> |
1942 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1943 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1942 | + <?php if (!empty($item['description'])) { ?> |
|
1943 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1944 | 1944 | <?php } ?> |
1945 | 1945 | </div> |
1946 | 1946 | <?php } ?> |
1947 | 1947 | |
1948 | 1948 | <div class='mt-4 border-top item_totals_total'> |
1949 | 1949 | <div class='row p-2'> |
1950 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1951 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1950 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1951 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1952 | 1952 | </div> |
1953 | 1953 | </div> |
1954 | 1954 | |
@@ -1956,22 +1956,22 @@ discard block |
||
1956 | 1956 | </div> |
1957 | 1957 | <?php } ?> |
1958 | 1958 | |
1959 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
1959 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
1960 | 1960 | |
1961 | 1961 | <div class="item_totals_type_checkbox"> |
1962 | 1962 | |
1963 | 1963 | <?php |
1964 | - foreach ( $items as $index => $item ) { |
|
1964 | + foreach ($items as $index => $item) { |
|
1965 | 1965 | |
1966 | - if ( ! empty( $item['required'] ) ) { |
|
1966 | + if (!empty($item['required'])) { |
|
1967 | 1967 | continue; |
1968 | 1968 | } |
1969 | 1969 | |
1970 | - $title = sanitize_text_field( $item['title'] ); |
|
1971 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1972 | - $item_id = esc_attr( $id . "_$index" ); |
|
1973 | - $value = esc_attr( $item['id'] ); |
|
1974 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
1970 | + $title = sanitize_text_field($item['title']); |
|
1971 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1972 | + $item_id = esc_attr($id . "_$index"); |
|
1973 | + $value = esc_attr($item['id']); |
|
1974 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
1975 | 1975 | $selected_checkbox_item = 1; |
1976 | 1976 | |
1977 | 1977 | echo " |
@@ -1980,7 +1980,7 @@ discard block |
||
1980 | 1980 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
1981 | 1981 | </div>"; |
1982 | 1982 | |
1983 | - if ( ! empty( $item['description'] ) ) { |
|
1983 | + if (!empty($item['description'])) { |
|
1984 | 1984 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
1985 | 1985 | } |
1986 | 1986 | } |
@@ -1992,29 +1992,29 @@ discard block |
||
1992 | 1992 | |
1993 | 1993 | $total = 0; |
1994 | 1994 | |
1995 | - foreach ( $items as $item ) { |
|
1995 | + foreach ($items as $item) { |
|
1996 | 1996 | |
1997 | 1997 | $class = 'col-8'; |
1998 | 1998 | $class2 = ''; |
1999 | 1999 | |
2000 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2000 | + if (!empty($item['allow_quantities'])) { |
|
2001 | 2001 | $class = 'col-6 pt-2'; |
2002 | 2002 | $class2 = 'pt-2'; |
2003 | 2003 | } |
2004 | 2004 | |
2005 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2005 | + if (!empty($item['custom_price'])) { |
|
2006 | 2006 | $class .= ' pt-2'; |
2007 | 2007 | } |
2008 | 2008 | |
2009 | 2009 | $class3 = 'd-none'; |
2010 | - $name = ''; |
|
2011 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
2010 | + $name = ''; |
|
2011 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
2012 | 2012 | |
2013 | - $total = $total + floatval( $item['price'] ); |
|
2013 | + $total = $total + floatval($item['price']); |
|
2014 | 2014 | $class3 = ''; |
2015 | 2015 | $name = "wpinv-items[{$item['id']}]"; |
2016 | 2016 | |
2017 | - if ( empty( $item['required'] ) ) { |
|
2017 | + if (empty($item['required'])) { |
|
2018 | 2018 | $totals_selected_checkbox_item = 1; |
2019 | 2019 | } |
2020 | 2020 | |
@@ -2026,9 +2026,9 @@ discard block |
||
2026 | 2026 | |
2027 | 2027 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2028 | 2028 | <div class='row pl-2 pr-2 pt-2'> |
2029 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2029 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2030 | 2030 | |
2031 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2031 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2032 | 2032 | |
2033 | 2033 | <div class='col-2'> |
2034 | 2034 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2036,11 +2036,11 @@ discard block |
||
2036 | 2036 | |
2037 | 2037 | <?php } else { ?> |
2038 | 2038 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2039 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2039 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2040 | 2040 | |
2041 | 2041 | <div class='col-4 <?php echo $class2; ?>'> |
2042 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2043 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2042 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2043 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2044 | 2044 | </div> |
2045 | 2045 | |
2046 | 2046 | <?php } else {?> |
@@ -2048,15 +2048,15 @@ discard block |
||
2048 | 2048 | <div class='col-4'> |
2049 | 2049 | <div class='input-group'> |
2050 | 2050 | |
2051 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2051 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2052 | 2052 | <div class='input-group-prepend'> |
2053 | 2053 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2054 | 2054 | </div> |
2055 | 2055 | <?php } ?> |
2056 | 2056 | |
2057 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2057 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2058 | 2058 | |
2059 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2059 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2060 | 2060 | <div class='input-group-append'> |
2061 | 2061 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2062 | 2062 | </div> |
@@ -2067,23 +2067,23 @@ discard block |
||
2067 | 2067 | <?php } ?> |
2068 | 2068 | |
2069 | 2069 | </div> |
2070 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2071 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2070 | + <?php if (!empty($item['description'])) { ?> |
|
2071 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2072 | 2072 | <?php } ?> |
2073 | 2073 | </div> |
2074 | 2074 | <?php } ?> |
2075 | 2075 | |
2076 | 2076 | <div class='mt-4 border-top item_totals_total'> |
2077 | 2077 | <div class='row p-2'> |
2078 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2079 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2078 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2079 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2080 | 2080 | </div> |
2081 | 2081 | </div> |
2082 | 2082 | </div> |
2083 | 2083 | </div> |
2084 | 2084 | <?php } ?> |
2085 | 2085 | |
2086 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
2086 | + <?php if ('select' == $field['items_type']) { ?> |
|
2087 | 2087 | |
2088 | 2088 | <div class="item_totals_type_select"> |
2089 | 2089 | |
@@ -2091,17 +2091,17 @@ discard block |
||
2091 | 2091 | |
2092 | 2092 | $options = array(); |
2093 | 2093 | $selected = ''; |
2094 | - foreach ( $items as $index => $item ) { |
|
2094 | + foreach ($items as $index => $item) { |
|
2095 | 2095 | |
2096 | - if ( ! empty( $item['required'] ) ) { |
|
2096 | + if (!empty($item['required'])) { |
|
2097 | 2097 | continue; |
2098 | 2098 | } |
2099 | 2099 | |
2100 | - $title = sanitize_text_field( $item['title'] ); |
|
2101 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2102 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2100 | + $title = sanitize_text_field($item['title']); |
|
2101 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2102 | + $options[$item['id']] = "$title ($price)"; |
|
2103 | 2103 | |
2104 | - if ( ! isset( $selected_item ) ) { |
|
2104 | + if (!isset($selected_item)) { |
|
2105 | 2105 | $selected = $item['id']; |
2106 | 2106 | $selected_item = 1; |
2107 | 2107 | } |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | array( |
2113 | 2113 | 'name' => 'payment-form-items', |
2114 | 2114 | 'id' => $id, |
2115 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
2115 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
2116 | 2116 | 'no_wrap' => true, |
2117 | 2117 | 'options' => $options, |
2118 | 2118 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2127,29 +2127,29 @@ discard block |
||
2127 | 2127 | |
2128 | 2128 | $total = 0; |
2129 | 2129 | |
2130 | - foreach ( $items as $item ) { |
|
2130 | + foreach ($items as $item) { |
|
2131 | 2131 | |
2132 | 2132 | $class = 'col-8'; |
2133 | 2133 | $class2 = ''; |
2134 | 2134 | |
2135 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2135 | + if (!empty($item['allow_quantities'])) { |
|
2136 | 2136 | $class = 'col-6 pt-2'; |
2137 | 2137 | $class2 = 'pt-2'; |
2138 | 2138 | } |
2139 | 2139 | |
2140 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2140 | + if (!empty($item['custom_price'])) { |
|
2141 | 2141 | $class .= ' pt-2'; |
2142 | 2142 | } |
2143 | 2143 | |
2144 | 2144 | $class3 = 'd-none'; |
2145 | - $name = ''; |
|
2146 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2145 | + $name = ''; |
|
2146 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2147 | 2147 | |
2148 | - $total = $total + floatval( $item['price'] ); |
|
2148 | + $total = $total + floatval($item['price']); |
|
2149 | 2149 | $class3 = ''; |
2150 | 2150 | $name = "wpinv-items[{$item['id']}]"; |
2151 | 2151 | |
2152 | - if ( empty( $item['required'] ) ) { |
|
2152 | + if (empty($item['required'])) { |
|
2153 | 2153 | $totals_selected_select_item = 1; |
2154 | 2154 | } |
2155 | 2155 | |
@@ -2161,9 +2161,9 @@ discard block |
||
2161 | 2161 | |
2162 | 2162 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2163 | 2163 | <div class='row pl-2 pr-2 pt-2'> |
2164 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2164 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2165 | 2165 | |
2166 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2166 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2167 | 2167 | |
2168 | 2168 | <div class='col-2'> |
2169 | 2169 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2171,11 +2171,11 @@ discard block |
||
2171 | 2171 | |
2172 | 2172 | <?php } else { ?> |
2173 | 2173 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2174 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2174 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2175 | 2175 | |
2176 | 2176 | <div class='col-4 <?php echo $class2; ?>'> |
2177 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2178 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2177 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2178 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2179 | 2179 | </div> |
2180 | 2180 | |
2181 | 2181 | <?php } else {?> |
@@ -2183,15 +2183,15 @@ discard block |
||
2183 | 2183 | <div class='col-4'> |
2184 | 2184 | <div class='input-group'> |
2185 | 2185 | |
2186 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2186 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2187 | 2187 | <div class='input-group-prepend'> |
2188 | 2188 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2189 | 2189 | </div> |
2190 | 2190 | <?php } ?> |
2191 | 2191 | |
2192 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2192 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2193 | 2193 | |
2194 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2194 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2195 | 2195 | <div class='input-group-append'> |
2196 | 2196 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2197 | 2197 | </div> |
@@ -2202,23 +2202,23 @@ discard block |
||
2202 | 2202 | <?php } ?> |
2203 | 2203 | |
2204 | 2204 | </div> |
2205 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2206 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2205 | + <?php if (!empty($item['description'])) { ?> |
|
2206 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2207 | 2207 | <?php } ?> |
2208 | 2208 | </div> |
2209 | 2209 | <?php } ?> |
2210 | 2210 | |
2211 | 2211 | <div class='mt-4 border-top item_totals_total'> |
2212 | 2212 | <div class='row p-2'> |
2213 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2214 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2213 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2214 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2215 | 2215 | </div> |
2216 | 2216 | </div> |
2217 | 2217 | |
2218 | 2218 | </div> |
2219 | 2219 | <?php } ?> |
2220 | 2220 | |
2221 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
2221 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
2222 | 2222 | |
2223 | 2223 | <div class="item_totals_type_multi_select"> |
2224 | 2224 | |
@@ -2227,18 +2227,18 @@ discard block |
||
2227 | 2227 | $options = array(); |
2228 | 2228 | $selected = array(); |
2229 | 2229 | |
2230 | - foreach ( $items as $index => $item ) { |
|
2230 | + foreach ($items as $index => $item) { |
|
2231 | 2231 | |
2232 | - if ( ! empty( $item['required'] ) ) { |
|
2232 | + if (!empty($item['required'])) { |
|
2233 | 2233 | continue; |
2234 | 2234 | } |
2235 | 2235 | |
2236 | - $title = sanitize_text_field( $item['title'] ); |
|
2237 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2238 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2236 | + $title = sanitize_text_field($item['title']); |
|
2237 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2238 | + $options[$item['id']] = "$title ($price)"; |
|
2239 | 2239 | |
2240 | - if ( ! isset( $selected_item ) ) { |
|
2241 | - $selected = array( $item['id'] ); |
|
2240 | + if (!isset($selected_item)) { |
|
2241 | + $selected = array($item['id']); |
|
2242 | 2242 | $selected_item = 1; |
2243 | 2243 | } |
2244 | 2244 | |
@@ -2263,29 +2263,29 @@ discard block |
||
2263 | 2263 | |
2264 | 2264 | $total = 0; |
2265 | 2265 | |
2266 | - foreach ( $items as $item ) { |
|
2266 | + foreach ($items as $item) { |
|
2267 | 2267 | |
2268 | 2268 | $class = 'col-8'; |
2269 | 2269 | $class2 = ''; |
2270 | 2270 | |
2271 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2271 | + if (!empty($item['allow_quantities'])) { |
|
2272 | 2272 | $class = 'col-6 pt-2'; |
2273 | 2273 | $class2 = 'pt-2'; |
2274 | 2274 | } |
2275 | 2275 | |
2276 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2276 | + if (!empty($item['custom_price'])) { |
|
2277 | 2277 | $class .= ' pt-2'; |
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | $class3 = 'd-none'; |
2281 | - $name = ''; |
|
2282 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2281 | + $name = ''; |
|
2282 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2283 | 2283 | |
2284 | - $total = $total + floatval( $item['price'] ); |
|
2284 | + $total = $total + floatval($item['price']); |
|
2285 | 2285 | $class3 = ''; |
2286 | 2286 | $name = "wpinv-items[{$item['id']}]"; |
2287 | 2287 | |
2288 | - if ( empty( $item['required'] ) ) { |
|
2288 | + if (empty($item['required'])) { |
|
2289 | 2289 | $totals_selected_select_item = 1; |
2290 | 2290 | } |
2291 | 2291 | |
@@ -2297,9 +2297,9 @@ discard block |
||
2297 | 2297 | |
2298 | 2298 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2299 | 2299 | <div class='row pl-2 pr-2 pt-2'> |
2300 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2300 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2301 | 2301 | |
2302 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2302 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2303 | 2303 | |
2304 | 2304 | <div class='col-2'> |
2305 | 2305 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2307,11 +2307,11 @@ discard block |
||
2307 | 2307 | |
2308 | 2308 | <?php } else { ?> |
2309 | 2309 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2310 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2310 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2311 | 2311 | |
2312 | 2312 | <div class='col-4 <?php echo $class2; ?>'> |
2313 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2314 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2313 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2314 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2315 | 2315 | </div> |
2316 | 2316 | |
2317 | 2317 | <?php } else {?> |
@@ -2319,15 +2319,15 @@ discard block |
||
2319 | 2319 | <div class='col-4'> |
2320 | 2320 | <div class='input-group'> |
2321 | 2321 | |
2322 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2322 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2323 | 2323 | <div class='input-group-prepend'> |
2324 | 2324 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2325 | 2325 | </div> |
2326 | 2326 | <?php } ?> |
2327 | 2327 | |
2328 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2328 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2329 | 2329 | |
2330 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2330 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2331 | 2331 | <div class='input-group-append'> |
2332 | 2332 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2333 | 2333 | </div> |
@@ -2338,23 +2338,23 @@ discard block |
||
2338 | 2338 | <?php } ?> |
2339 | 2339 | |
2340 | 2340 | </div> |
2341 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2342 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2341 | + <?php if (!empty($item['description'])) { ?> |
|
2342 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2343 | 2343 | <?php } ?> |
2344 | 2344 | </div> |
2345 | 2345 | <?php } ?> |
2346 | 2346 | |
2347 | 2347 | <div class='mt-4 border-top item_totals_total'> |
2348 | 2348 | <div class='row p-2'> |
2349 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2350 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2349 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2350 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2351 | 2351 | </div> |
2352 | 2352 | </div> |
2353 | 2353 | |
2354 | 2354 | </div> |
2355 | 2355 | <?php } ?> |
2356 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
2357 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
2356 | + <?php if (!empty($field['description'])) { ?> |
|
2357 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
2358 | 2358 | <?php } ?> |
2359 | 2359 | </div> |
2360 | 2360 | <?php |
@@ -2363,20 +2363,20 @@ discard block |
||
2363 | 2363 | /** |
2364 | 2364 | * Renders the items element template. |
2365 | 2365 | */ |
2366 | - public function edit_items_template( $field ) { |
|
2367 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
2368 | - $label = __( 'Let customers...', 'invoicing' ); |
|
2369 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
2370 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
2366 | + public function edit_items_template($field) { |
|
2367 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
2368 | + $label = __('Let customers...', 'invoicing'); |
|
2369 | + $label2 = __('Available Items', 'invoicing'); |
|
2370 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
2371 | 2371 | $id = $field . '.id + "_edit"'; |
2372 | 2372 | $id2 = $field . '.id + "_edit2"'; |
2373 | 2373 | $id3 = $field . '.id + "_edit3"'; |
2374 | 2374 | $id4 = $field . '.id + "_edit4"'; |
2375 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
2376 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
2377 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
2378 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
2379 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
2375 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
2376 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
2377 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
2378 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
2379 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
2380 | 2380 | echo "<div $restrict> |
2381 | 2381 | |
2382 | 2382 | <label>$label2</label> |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | <div class='form-group mt-2'> |
2447 | 2447 | |
2448 | 2448 | <select class='form-control custom-select' v-model='selected_item'> |
2449 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
2449 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
2450 | 2450 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
2451 | 2451 | </select> |
2452 | 2452 | |
@@ -2461,11 +2461,11 @@ discard block |
||
2461 | 2461 | <label :for='$id2'>$label</label> |
2462 | 2462 | |
2463 | 2463 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
2464 | - <option value='total'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
2465 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
2466 | - <option value='checkbox'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
2467 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
2468 | - <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
2464 | + <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
2465 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
2466 | + <option value='checkbox'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
2467 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
2468 | + <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
2469 | 2469 | </select> |
2470 | 2470 | |
2471 | 2471 | </div> |
@@ -2490,27 +2490,27 @@ discard block |
||
2490 | 2490 | 'orderby' => 'title', |
2491 | 2491 | 'order' => 'ASC', |
2492 | 2492 | 'posts_per_page' => -1, |
2493 | - 'post_status' => array( 'publish' ), |
|
2493 | + 'post_status' => array('publish'), |
|
2494 | 2494 | ); |
2495 | 2495 | |
2496 | - $items = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) ); |
|
2496 | + $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args)); |
|
2497 | 2497 | |
2498 | - if ( empty( $items ) ) { |
|
2498 | + if (empty($items)) { |
|
2499 | 2499 | return array(); |
2500 | 2500 | } |
2501 | 2501 | |
2502 | - $options = array(); |
|
2503 | - foreach ( $items as $item ) { |
|
2504 | - $title = esc_html( $item->post_title ); |
|
2505 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
2506 | - $id = absint( $item->ID ); |
|
2507 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
2508 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
2502 | + $options = array(); |
|
2503 | + foreach ($items as $item) { |
|
2504 | + $title = esc_html($item->post_title); |
|
2505 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
2506 | + $id = absint($item->ID); |
|
2507 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
2508 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
2509 | 2509 | $description = $item->post_excerpt; |
2510 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
2511 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
2510 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
2511 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
2512 | 2512 | $allow_quantities = false; |
2513 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
2513 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
2514 | 2514 | |
2515 | 2515 | } |
2516 | 2516 | return $options; |
@@ -2520,38 +2520,38 @@ discard block |
||
2520 | 2520 | /** |
2521 | 2521 | * Returns an array of items for the currently being edited form. |
2522 | 2522 | */ |
2523 | - public function get_form_items( $id = false ) { |
|
2523 | + public function get_form_items($id = false) { |
|
2524 | 2524 | |
2525 | - if ( empty( $id ) ) { |
|
2526 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2525 | + if (empty($id)) { |
|
2526 | + return wpinv_get_data('sample-payment-form-items'); |
|
2527 | 2527 | } |
2528 | 2528 | |
2529 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
2529 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
2530 | 2530 | |
2531 | - if ( is_array( $form_elements ) ) { |
|
2531 | + if (is_array($form_elements)) { |
|
2532 | 2532 | return $form_elements; |
2533 | 2533 | } |
2534 | 2534 | |
2535 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2535 | + return wpinv_get_data('sample-payment-form-items'); |
|
2536 | 2536 | |
2537 | 2537 | } |
2538 | 2538 | |
2539 | 2539 | /** |
2540 | 2540 | * Returns an array of elements for the currently being edited form. |
2541 | 2541 | */ |
2542 | - public function get_form_elements( $id = false ) { |
|
2542 | + public function get_form_elements($id = false) { |
|
2543 | 2543 | |
2544 | - if ( empty( $id ) ) { |
|
2545 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2544 | + if (empty($id)) { |
|
2545 | + return wpinv_get_data('sample-payment-form'); |
|
2546 | 2546 | } |
2547 | 2547 | |
2548 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
2548 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
2549 | 2549 | |
2550 | - if ( is_array( $form_elements ) ) { |
|
2550 | + if (is_array($form_elements)) { |
|
2551 | 2551 | return $form_elements; |
2552 | 2552 | } |
2553 | 2553 | |
2554 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2554 | + return wpinv_get_data('sample-payment-form'); |
|
2555 | 2555 | } |
2556 | 2556 | |
2557 | 2557 | } |