Passed
Pull Request — master (#284)
by Brian
06:37
created
includes/class-wpinv.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171 171
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172 172
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
173
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178 178
         require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179 179
         require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180 180
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
@@ -487,17 +487,17 @@  discard block
 block discarded – undo
487 487
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
488 488
     }
489 489
 
490
-	/**
491
-	 * Register widgets
492
-	 *
493
-	 */
494
-	public function register_widgets() {
495
-		register_widget( "WPInv_Checkout_Widget" );
496
-		register_widget( "WPInv_History_Widget" );
497
-		register_widget( "WPInv_Receipt_Widget" );
498
-		register_widget( "WPInv_Subscriptions_Widget" );
499
-		register_widget( "WPInv_Buy_Item_Widget" );
490
+    /**
491
+     * Register widgets
492
+     *
493
+     */
494
+    public function register_widgets() {
495
+        register_widget( "WPInv_Checkout_Widget" );
496
+        register_widget( "WPInv_History_Widget" );
497
+        register_widget( "WPInv_Receipt_Widget" );
498
+        register_widget( "WPInv_Subscriptions_Widget" );
499
+        register_widget( "WPInv_Buy_Item_Widget" );
500 500
         register_widget( "WPInv_Messages_Widget" );
501 501
         register_widget( 'WPInv_Payment_Form_Widget' );
502
-	}
502
+    }
503 503
 }
504 504
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
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,33 +33,33 @@  discard block
 block discarded – undo
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' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('widgets_init', array(&$this, 'register_widgets'));
55 55
 
56
-        if ( is_admin() ) {
57
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
58
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
59
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
56
+        if (is_admin()) {
57
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
58
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
59
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
60 60
 
61 61
         } else {
62
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
62
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
63 63
         }
64 64
         
65 65
         /**
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
          *
70 70
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
71 71
          */
72
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
72
+        do_action_ref_array('wpinv_actions', array(&$this));
73 73
 
74
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
74
+        add_action('admin_init', array(&$this, 'activation_redirect'));
75 75
     }
76 76
 
77 77
     /**
78 78
      * Maybe show the AyeCode Connect Notice.
79 79
      */
80
-    public function init_ayecode_connect_helper(){
80
+    public function init_ayecode_connect_helper() {
81 81
         // AyeCode Connect notice
82
-        if ( is_admin() ){
82
+        if (is_admin()) {
83 83
             // set the strings so they can be translated
84 84
             $strings = array(
85
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
86
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
87
-                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
88
-                'connect_button'    => __("Connect Site","invoicing"),
89
-                'connecting_button'    => __("Connecting...","invoicing"),
90
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
91
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
85
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
86
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
87
+                'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
88
+                'connect_button'    => __("Connect Site", "invoicing"),
89
+                'connecting_button'    => __("Connecting...", "invoicing"),
90
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
91
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
92 92
             );
93
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
93
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
94 94
         }
95 95
     }
96 96
     
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
         /* Internationalize the text strings used. */
99 99
         $this->load_textdomain();
100 100
 
101
-        do_action( 'wpinv_loaded' );
101
+        do_action('wpinv_loaded');
102 102
 
103 103
         // Fix oxygen page builder conflict
104
-        if ( function_exists( 'ct_css_output' ) ) {
104
+        if (function_exists('ct_css_output')) {
105 105
             wpinv_oxygen_fix_conflict();
106 106
         }
107 107
     }
@@ -111,237 +111,237 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @since 1.0
113 113
      */
114
-    public function load_textdomain( $locale = NULL ) {
115
-        if ( empty( $locale ) ) {
116
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
114
+    public function load_textdomain($locale = NULL) {
115
+        if (empty($locale)) {
116
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
117 117
         }
118 118
 
119
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
119
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
120 120
         
121
-        unload_textdomain( 'invoicing' );
122
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
123
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
121
+        unload_textdomain('invoicing');
122
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
123
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
124 124
         
125 125
         /**
126 126
          * Define language constants.
127 127
          */
128
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
128
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
129 129
     }
130 130
         
131 131
     public function includes() {
132 132
         global $wpinv_options;
133 133
         
134
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
134
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
135 135
         $wpinv_options = wpinv_get_settings();
136 136
         
137
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
138
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
139
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
140
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
141
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
142
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
143
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
144
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
145
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
147
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
148
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
162
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
163
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
164
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
165
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
166
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
167
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
168
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
169
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
181
-
182
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
183
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
137
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
138
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
139
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
140
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
141
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
142
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
143
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
144
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
145
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
147
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
148
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
162
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
163
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
164
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
165
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
166
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
167
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
168
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
169
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
173
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
174
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
175
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
176
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
177
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
178
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'widgets/payment-form.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
181
+
182
+        if (!class_exists('WPInv_EUVat')) {
183
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
184 184
         }
185 185
         
186
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
187
-        if ( !empty( $gateways ) ) {
188
-            foreach ( $gateways as $gateway ) {
189
-                if ( $gateway == 'manual' ) {
186
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
187
+        if (!empty($gateways)) {
188
+            foreach ($gateways as $gateway) {
189
+                if ($gateway == 'manual') {
190 190
                     continue;
191 191
                 }
192 192
                 
193 193
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
194 194
                 
195
-                if ( file_exists( $gateway_file ) ) {
196
-                    require_once( $gateway_file );
195
+                if (file_exists($gateway_file)) {
196
+                    require_once($gateway_file);
197 197
                 }
198 198
             }
199 199
         }
200
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
200
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
201 201
         
202
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
203
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
204
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
205
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
202
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
203
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
204
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
205
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
206 206
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
207
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
208
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
209
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
210
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
211
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
212
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
213
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
214
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
207
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
208
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
209
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
210
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
211
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
212
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
213
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
214
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
215 215
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
216 216
             // load the user class only on the users.php page
217 217
             global $pagenow;
218
-            if($pagenow=='users.php'){
218
+            if ($pagenow == 'users.php') {
219 219
                 new WPInv_Admin_Users();
220 220
             }
221 221
         }
222 222
 
223 223
         // Register cli commands
224
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
225
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
226
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
224
+        if (defined('WP_CLI') && WP_CLI) {
225
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
226
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
227 227
         }
228 228
         
229 229
         // include css inliner
230
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
231
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
230
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
231
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
232 232
         }
233 233
         
234
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
234
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
235 235
     }
236 236
     
237 237
     public function init() {
238 238
     }
239 239
     
240 240
     public function admin_init() {
241
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
241
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
242 242
     }
243 243
 
244 244
     public function activation_redirect() {
245 245
         // Bail if no activation redirect
246
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
246
+        if (!get_transient('_wpinv_activation_redirect')) {
247 247
             return;
248 248
         }
249 249
 
250 250
         // Delete the redirect transient
251
-        delete_transient( '_wpinv_activation_redirect' );
251
+        delete_transient('_wpinv_activation_redirect');
252 252
 
253 253
         // Bail if activating from network, or bulk
254
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
254
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
255 255
             return;
256 256
         }
257 257
 
258
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
258
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
259 259
         exit;
260 260
     }
261 261
     
262 262
     public function enqueue_scripts() {
263
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
263
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
264 264
         
265
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
266
-        wp_enqueue_style( 'wpinv_front_style' );
265
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
266
+        wp_enqueue_style('wpinv_front_style');
267 267
                
268 268
         // Register scripts
269
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
270
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  WPINV_VERSION );
269
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
270
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), WPINV_VERSION);
271 271
 
272 272
         $localize                         = array();
273
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
274
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
273
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
274
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
275 275
         $localize['currency_symbol']      = wpinv_currency_symbol();
276 276
         $localize['currency_pos']         = wpinv_currency_position();
277 277
         $localize['thousand_sep']         = wpinv_thousands_separator();
278 278
         $localize['decimal_sep']          = wpinv_decimal_separator();
279 279
         $localize['decimals']             = wpinv_decimals();
280
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
280
+        $localize['txtComplete']          = __('Complete', 'invoicing');
281 281
         $localize['UseTaxes']             = wpinv_use_taxes();
282
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
282
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
283 283
 
284
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
284
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
285 285
         
286
-        wp_enqueue_script( 'jquery-blockui' );
286
+        wp_enqueue_script('jquery-blockui');
287 287
         $autofill_api = wpinv_get_option('address_autofill_api');
288 288
         $autofill_active = wpinv_get_option('address_autofill_active');
289
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
290
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
291
-                wp_dequeue_script( 'google-maps-api' );
289
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
290
+            if (wp_script_is('google-maps-api', 'enqueued')) {
291
+                wp_dequeue_script('google-maps-api');
292 292
             }
293
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
294
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
293
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
294
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
295 295
         }
296 296
 
297
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
298
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
297
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
298
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
299 299
 
300
-        wp_enqueue_script( 'wpinv-front-script' );
301
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
300
+        wp_enqueue_script('wpinv-front-script');
301
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
302 302
 
303
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
304
-        wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script' ),  $version, true );
303
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
304
+        wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script'), $version, true);
305 305
     }
306 306
 
307
-    public function admin_enqueue_scripts( $hook ) {
307
+    public function admin_enqueue_scripts($hook) {
308 308
         global $post, $pagenow;
309 309
         
310 310
         $post_type  = wpinv_admin_post_type();
311
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
312
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
311
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
312
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
313 313
 
314 314
         $jquery_ui_css = false;
315
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
315
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
316 316
             $jquery_ui_css = true;
317
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
317
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
318 318
             $jquery_ui_css = true;
319 319
         }
320
-        if ( $jquery_ui_css ) {
321
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
322
-            wp_enqueue_style( 'jquery-ui-css' );
320
+        if ($jquery_ui_css) {
321
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
322
+            wp_enqueue_style('jquery-ui-css');
323 323
         }
324 324
 
325
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
326
-        wp_enqueue_style( 'wpinv_meta_box_style' );
325
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
326
+        wp_enqueue_style('wpinv_meta_box_style');
327 327
         
328
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
329
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
330
-        wp_enqueue_style( 'wpinv_admin_style' );
328
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
329
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
330
+        wp_enqueue_style('wpinv_admin_style');
331 331
 
332
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
333
-        if ( $page == 'wpinv-subscriptions' ) {
334
-            wp_enqueue_script( 'jquery-ui-datepicker' );
332
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
333
+        if ($page == 'wpinv-subscriptions') {
334
+            wp_enqueue_script('jquery-ui-datepicker');
335 335
         }
336 336
         
337
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
338
-            wp_enqueue_script( 'jquery-ui-datepicker' );
337
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
338
+            wp_enqueue_script('jquery-ui-datepicker');
339 339
         }
340 340
 
341
-        wp_enqueue_style( 'wp-color-picker' );
342
-        wp_enqueue_script( 'wp-color-picker' );
341
+        wp_enqueue_style('wp-color-picker');
342
+        wp_enqueue_script('wp-color-picker');
343 343
         
344
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
344
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
345 345
 
346 346
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
347 347
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -352,20 +352,20 @@  discard block
 block discarded – undo
352 352
             }
353 353
         }
354 354
 
355
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
356
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
355
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
356
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
357 357
 
358
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
359
-        wp_enqueue_script( 'wpinv-admin-script' );
358
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
359
+        wp_enqueue_script('wpinv-admin-script');
360 360
         
361 361
         $localize                               = array();
362
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
363
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
364
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
365
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
366
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
367
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
368
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
362
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
363
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
364
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
365
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
366
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
367
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
368
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
369 369
         $localize['tax']                        = wpinv_tax_amount();
370 370
         $localize['discount']                   = wpinv_discount_amount();
371 371
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -373,95 +373,95 @@  discard block
 block discarded – undo
373 373
         $localize['thousand_sep']               = wpinv_thousands_separator();
374 374
         $localize['decimal_sep']                = wpinv_decimal_separator();
375 375
         $localize['decimals']                   = wpinv_decimals();
376
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
377
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
378
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
379
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
380
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
381
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
382
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
383
-        $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' );
384
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
385
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
386
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
387
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
388
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
389
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
390
-
391
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
392
-
393
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
376
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
377
+        $localize['status_publish']             = wpinv_status_nicename('publish');
378
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
379
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
380
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
381
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
382
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
383
+        $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');
384
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
385
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
386
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
387
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
388
+        $localize['action_edit']                = __('Edit', 'invoicing');
389
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
390
+
391
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
392
+
393
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
394 394
 
395 395
         // Load payment form scripts on our admin pages only.
396
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
396
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
397 397
 
398
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
399
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
400
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
398
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
399
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
400
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
401 401
 
402
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
403
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
402
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
403
+            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 404
         
405
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
405
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
406 406
                 'elements'      => $this->form_elements->get_elements(),
407
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
407
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
408 408
                 'all_items'     => $this->form_elements->get_published_items(),
409 409
                 'currency'      => wpinv_currency_symbol(),
410 410
                 'position'      => wpinv_currency_position(),
411 411
                 'decimals'      => (int) wpinv_decimals(),
412 412
                 'thousands_sep' => wpinv_thousands_separator(),
413 413
                 'decimals_sep'  => wpinv_decimal_separator(),
414
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
415
-            ) );
414
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
415
+            ));
416 416
 
417
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
417
+            wp_enqueue_script('wpinv-admin-payment-form-script');
418 418
         }
419 419
 
420
-        if ( $page == 'wpinv-subscriptions' ) {
421
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
422
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
420
+        if ($page == 'wpinv-subscriptions') {
421
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
422
+            wp_enqueue_script('wpinv-sub-admin-script');
423 423
         }
424 424
 
425 425
     }
426 426
     
427
-    public function admin_body_class( $classes ) {
427
+    public function admin_body_class($classes) {
428 428
         global $pagenow, $post, $current_screen;
429 429
         
430
-        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' ) ) {
430
+        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')) {
431 431
             $classes .= ' wpinv-cpt';
432 432
         }
433 433
         
434
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
434
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
435 435
 
436
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
437
-        if ( $add_class ) {
438
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
436
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
437
+        if ($add_class) {
438
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
439 439
         }
440 440
         
441 441
         $settings_class = array();
442
-        if ( $page == 'wpinv-settings' ) {
443
-            if ( !empty( $_REQUEST['tab'] ) ) {
444
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
442
+        if ($page == 'wpinv-settings') {
443
+            if (!empty($_REQUEST['tab'])) {
444
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
445 445
             }
446 446
             
447
-            if ( !empty( $_REQUEST['section'] ) ) {
448
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
447
+            if (!empty($_REQUEST['section'])) {
448
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
449 449
             }
450 450
             
451
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
451
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
452 452
         }
453 453
         
454
-        if ( !empty( $settings_class ) ) {
455
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
454
+        if (!empty($settings_class)) {
455
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
456 456
         }
457 457
         
458 458
         $post_type = wpinv_admin_post_type();
459 459
 
460
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
460
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
461 461
             return $classes .= ' wpinv';
462 462
         }
463 463
         
464
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
464
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
465 465
             $classes .= ' wpi-editable-n';
466 466
         }
467 467
 
@@ -473,21 +473,21 @@  discard block
 block discarded – undo
473 473
     }
474 474
     
475 475
     public function wpinv_actions() {
476
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
477
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
476
+        if (isset($_REQUEST['wpi_action'])) {
477
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
478 478
         }
479 479
     }
480 480
     
481
-    public function pre_get_posts( $wp_query ) {
482
-        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() ) {
483
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
481
+    public function pre_get_posts($wp_query) {
482
+        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()) {
483
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
484 484
         }
485 485
         
486 486
         return $wp_query;
487 487
     }
488 488
     
489 489
     public function bp_invoicing_init() {
490
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
490
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
491 491
     }
492 492
 
493 493
 	/**
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 */
497 497
 	public function register_widgets() {
498
-		register_widget( "WPInv_Checkout_Widget" );
499
-		register_widget( "WPInv_History_Widget" );
500
-		register_widget( "WPInv_Receipt_Widget" );
501
-		register_widget( "WPInv_Subscriptions_Widget" );
502
-		register_widget( "WPInv_Buy_Item_Widget" );
503
-        register_widget( "WPInv_Messages_Widget" );
504
-        register_widget( 'WPInv_Payment_Form_Widget' );
498
+		register_widget("WPInv_Checkout_Widget");
499
+		register_widget("WPInv_History_Widget");
500
+		register_widget("WPInv_Receipt_Widget");
501
+		register_widget("WPInv_Subscriptions_Widget");
502
+		register_widget("WPInv_Buy_Item_Widget");
503
+        register_widget("WPInv_Messages_Widget");
504
+        register_widget('WPInv_Payment_Form_Widget');
505 505
 	}
506 506
 }
507 507
\ No newline at end of file
Please login to merge, or discard this patch.
includes/data/sample-payment-form-items.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17
-        'title'       => __( 'My Cool Item', 'invoicing' ),
17
+        'title'       => __('My Cool Item', 'invoicing'),
18 18
         'id'          => 'fxhnagzi',
19 19
         'price'       => '999.00',
20 20
         'recurring'   => false,
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     array(
26 26
 
27
-        'title'       => __( 'Shipping Fee', 'invoicing' ),
27
+        'title'       => __('Shipping Fee', 'invoicing'),
28 28
         'id'          => 'rxnymibri',
29 29
         'price'       => '19.99',
30 30
         'recurring'   => false,
Please login to merge, or discard this patch.
includes/data/sample-payment-form.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17 17
         'level' => 'h2',
18
-        'text'  => __( 'Payment Form', 'invoicing' ),
18
+        'text'  => __('Payment Form', 'invoicing'),
19 19
         'id'    => 'uiylyczw',
20 20
         'name'  => 'uiylyczw',
21 21
         'type'  => 'heading'
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     array(
25 25
 
26
-        'text' => __( 'Fill the form below to place an order for my cool item', 'invoicing' ),
26
+        'text' => __('Fill the form below to place an order for my cool item', 'invoicing'),
27 27
         'id'   => 'pcvqjj',
28 28
         'name' => 'pcvqjj',
29 29
         'type' => 'paragraph'
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
         'placeholder' => 'Jon',
36 36
         'value'       => '',
37
-        'label'       => __( 'First Name', 'invoicing' ),
37
+        'label'       => __('First Name', 'invoicing'),
38 38
         'description' => '',
39 39
         'required'    => false,
40 40
         'id'          => 'ynkzkjyc',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         'placeholder' => 'Snow',
49 49
         'value'       => '',
50
-        'label'       => __( 'Last Name', 'invoicing' ),
50
+        'label'       => __('Last Name', 'invoicing'),
51 51
         'description' => '',
52 52
         'required'    => false,
53 53
         'id'          => 'wfjcdmzox',
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         'placeholder' => '[email protected]',
62 62
         'value'       => '',
63
-        'label'       => __( 'Billing Email', 'invoicing' ),
63
+        'label'       => __('Billing Email', 'invoicing'),
64 64
         'description' => '',
65 65
         'required'    => true,
66 66
         'id'          => 'mmdwqzpox',
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
         'value'       =>'',
87 87
         'class'       => 'btn-primary',
88
-        'label'       => __( 'Pay Now »', 'invoicing' ),
89
-        'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
88
+        'label'       => __('Pay Now »', 'invoicing'),
89
+        'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
90 90
         'id'          => 'rtqljyy',
91 91
         'name'        => 'rtqljyy',
92 92
         'type'        => 'pay_button',
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-payment-form.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
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,9 +11,9 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output_shortcode( $post ) {
14
+    public static function output_shortcode($post) {
15 15
 
16
-        if ( ! is_numeric( $post ) ) {
16
+        if (!is_numeric($post)) {
17 17
             $post = $post->ID;
18 18
         }
19 19
 
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @param WP_Post $post
27 27
      */
28
-    public static function output ( $post ) {
29
-        $success_page        = get_post_meta( $post->ID, 'wpinv_success_page', true );
30
-        $success_page        = empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page
28
+    public static function output($post) {
29
+        $success_page        = get_post_meta($post->ID, 'wpinv_success_page', true);
30
+        $success_page        = empty($success_page) ? wpinv_get_success_page_uri() : $success_page
31 31
         ?>
32 32
 
33 33
         <div id="wpinv-form-builder" style="display: flex; flex-flow: wrap;">
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
             <div class="wpinv-form-builder-left bsui" style="flex: 0 0 320px;">
36 36
                 <ul class="wpinv-form-builder-tabs  nav nav-tabs">
37 37
                     <li class='nav-item' v-if="active_tab!='new_item'">
38
-                        <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>
38
+                        <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>
39 39
                     </li>
40 40
                     <li class='nav-item' v-if='false'>
41
-                        <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>
41
+                        <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>
42 42
                     </li>
43 43
                     <li class='nav-item' v-if='false'>
44
-                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e( 'Settings', 'invoicing' ); ?></a>
44
+                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e('Settings', 'invoicing'); ?></a>
45 45
                     </li>
46 46
                 </ul>
47 47
 
48 48
                 <div class="wpinv-form-builder-tab-content bsui" style="margin-top: 16px;">
49 49
                     <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
50 50
                         <div class="wpinv-form-builder-add-field-types">
51
-                            <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
51
+                            <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
52 52
                             <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">
53 53
                                 <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 }">
54 54
                                     <button class="button btn" style="width: 100%; cursor: move;">
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 
64 64
                     <div class="wpinv-form-builder-tab-pane bsui" v-if="active_tab=='edit_item'" style="font-size: 16px;">
65 65
                         <div class="wpinv-form-builder-edit-field-wrapper">
66
-                            <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
66
+                            <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
67 67
                             <div>
68
-                                <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>
68
+                                <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>
69 69
                             </div>
70 70
                         </div>
71 71
                     </div>
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
                         <div class="wpinv-form-builder-settings-wrapper">
75 75
                         
76 76
                             <div class='form-group'>
77
-                                <label for="wpi-success-page"><?php _e( 'Success Page', 'invoicing' ); ?></label>
78
-                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url( $success_page ); ?>" class='form-control' type='text'>
79
-                                <small class='form-text text-muted'><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></small>
77
+                                <label for="wpi-success-page"><?php _e('Success Page', 'invoicing'); ?></label>
78
+                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url($success_page); ?>" class='form-control' type='text'>
79
+                                <small class='form-text text-muted'><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></small>
80 80
                             </div>
81 81
 
82 82
                         </div>
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 
88 88
             <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;">
89 89
 
90
-                <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
91
-                <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>
90
+                <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
91
+                <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>
92 92
 
93 93
                 <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 16px;">
94 94
                     <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">
95
-                        <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
95
+                        <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
96 96
                     </div>
97 97
                 </draggable>
98 98
             </div>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             <textarea style="display:none;" name="wpinv_form_items" v-model="itemString"></textarea>
102 102
         </div>
103 103
         
104
-        <?php wp_nonce_field( 'wpinv_save_payment_form', 'wpinv_save_payment_form' ) ;?>
104
+        <?php wp_nonce_field('wpinv_save_payment_form', 'wpinv_save_payment_form'); ?>
105 105
 
106 106
         <?php
107 107
     }
@@ -109,83 +109,83 @@  discard block
 block discarded – undo
109 109
     /**
110 110
      * Saves our payment forms.
111 111
      */
112
-    public static function save( $post_id, $post ) {
112
+    public static function save($post_id, $post) {
113 113
 
114
-        remove_action( 'save_post', 'WPInv_Meta_Box_Payment_Form::save' );
114
+        remove_action('save_post', 'WPInv_Meta_Box_Payment_Form::save');
115 115
 
116 116
         // $post_id and $post are required.
117
-        if ( empty( $post_id ) || empty( $post ) ) {
117
+        if (empty($post_id) || empty($post)) {
118 118
             return;
119 119
         }
120 120
         
121 121
         // Ensure that this user can edit the post.
122
-        if ( ! current_user_can( 'edit_post', $post_id ) ) {
122
+        if (!current_user_can('edit_post', $post_id)) {
123 123
             return;
124 124
         }
125 125
 
126 126
         // Dont' save meta boxes for revisions or autosaves
127
-        if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
127
+        if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
128 128
             return;
129 129
         }
130 130
 
131 131
         // Do not save for ajax requests.
132
-        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
132
+        if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
133 133
             return;
134 134
         }
135 135
 
136 136
         // Confirm the security nonce.
137
-        if ( empty( $_POST['wpinv_save_payment_form'] ) || ! wp_verify_nonce( $_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form' ) ) {
137
+        if (empty($_POST['wpinv_save_payment_form']) || !wp_verify_nonce($_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form')) {
138 138
             return;
139 139
         }
140 140
 
141 141
         // Save form items.
142
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
142
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
143 143
 
144
-        if ( empty( $form_items ) ) {
144
+        if (empty($form_items)) {
145 145
             $form_items = array();
146 146
         }
147 147
 
148
-        update_post_meta( $post_id, 'wpinv_form_items', self::maybe_save_items( $form_items ) );
148
+        update_post_meta($post_id, 'wpinv_form_items', self::maybe_save_items($form_items));
149 149
 
150 150
         // Save form elements.
151
-        $wpinv_form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
152
-        if ( empty( $wpinv_form_elements ) ) {
151
+        $wpinv_form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
152
+        if (empty($wpinv_form_elements)) {
153 153
             $wpinv_form_elements = array();
154 154
         }
155 155
 
156
-        update_post_meta( $post_id, 'wpinv_form_elements', $wpinv_form_elements );
156
+        update_post_meta($post_id, 'wpinv_form_elements', $wpinv_form_elements);
157 157
     }
158 158
 
159 159
     /**
160 160
      * Saves unsaved form items.
161 161
      */
162
-    public static function maybe_save_items( $items ) {
162
+    public static function maybe_save_items($items) {
163 163
 
164 164
         $saved = array();
165 165
 
166
-        foreach( $items as $item ) {
166
+        foreach ($items as $item) {
167 167
 
168
-            if ( is_numeric( $item['id'] ) ) {
168
+            if (is_numeric($item['id'])) {
169 169
                 $saved[] = $item;
170 170
                 continue;
171 171
             }
172 172
 
173 173
             $data = array(
174
-                'post_title'   => sanitize_text_field( $item['title'] ),
175
-                'post_excerpt' => wp_kses_post( $item['description'] ),
174
+                'post_title'   => sanitize_text_field($item['title']),
175
+                'post_excerpt' => wp_kses_post($item['description']),
176 176
                 'post_status'  => 'publish',
177 177
                 'meta'         => array(
178 178
                     'type'      => 'custom',
179
-                    'price'     => wpinv_sanitize_amount( $item['price'] ),
179
+                    'price'     => wpinv_sanitize_amount($item['price']),
180 180
                     'vat_rule'  => 'digital',
181 181
                     'vat_class' => '_standard',
182 182
                 )
183 183
             );
184 184
             
185
-            $new_item  = new WPInv_Item();
186
-            $new_item->create( $data );
185
+            $new_item = new WPInv_Item();
186
+            $new_item->create($data);
187 187
     
188
-            if ( ! empty( $new_item ) ) {
188
+            if (!empty($new_item)) {
189 189
                 $item['id'] = $new_item->ID;
190 190
                 $saved[] = $item;
191 191
             }
@@ -198,5 +198,5 @@  discard block
 block discarded – undo
198 198
 
199 199
 }
200 200
 
201
-add_action( 'save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2 );
201
+add_action('save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2);
202 202
 
Please login to merge, or discard this patch.
widgets/payment-form.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct() {
18 18
 
19
-		$forms = get_posts(
20
-			array(
21
-				'post_type'      => 'wpi_payment_form',
22
-				'orderby'        => 'title',
23
-				'order'          => 'ASC',
24
-				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
26
-			)
27
-		);
28
-
29
-		$options = array(
30
-			'' => __('Select a Form','invoicing')
31
-		);
32
-
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
35
-		}
19
+        $forms = get_posts(
20
+            array(
21
+                'post_type'      => 'wpi_payment_form',
22
+                'orderby'        => 'title',
23
+                'order'          => 'ASC',
24
+                'posts_per_page' => -1,
25
+                'post_status'    => array( 'publish' ),
26
+            )
27
+        );
28
+
29
+        $options = array(
30
+            '' => __('Select a Form','invoicing')
31
+        );
32
+
33
+        foreach( $forms as $form ) {
34
+            $options[ $form->ID ] = $form->post_title;
35
+        }
36 36
 
37 37
         $options = array(
38 38
             'textdomain'    => 'invoicing',
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                 'form'            => array(
51 51
                     'title'       => __( 'Payment Form', 'invoicing' ),
52 52
                     'desc'        => __( 'Select your payment form.', 'invoicing' ),
53
-					'type'        => 'select',
54
-					'options'     =>  $options,
53
+                    'type'        => 'select',
54
+                    'options'     =>  $options,
55 55
                     'desc_tip'    => true,
56 56
                     'default'     => '',
57 57
                     'advanced'    => false
@@ -64,59 +64,59 @@  discard block
 block discarded – undo
64 64
         parent::__construct( $options );
65 65
     }
66 66
 
67
-	/**
68
-	 * The Super block output function.
69
-	 *
70
-	 * @param array $args
71
-	 * @param array $widget_args
72
-	 * @param string $content
73
-	 *
74
-	 * @return string
75
-	 */
67
+    /**
68
+     * The Super block output function.
69
+     *
70
+     * @param array $args
71
+     * @param array $widget_args
72
+     * @param string $content
73
+     *
74
+     * @return string
75
+     */
76 76
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
-		global $invoicing;
78
-
79
-		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
81
-			return aui()->alert(
82
-				array(
83
-					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
85
-				)
86
-			);
87
-
88
-		}
89
-
90
-		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
92
-			return aui()->alert(
93
-				array(
94
-					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
-				)
97
-			);
98
-		}
99
-
100
-		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
-
104
-		ob_start();
105
-		echo "<form class='wpinv_payment_form'>";
106
-		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
-
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
-		}
113
-
114
-		echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
115
-		echo '</form>';
116
-
117
-		$content = ob_get_clean();
77
+        global $invoicing;
78
+
79
+        // Do we have a payment form?
80
+        if ( empty( $args['form'] ) ) {
81
+            return aui()->alert(
82
+                array(
83
+                    'type'    => 'warning',
84
+                    'content' => __( 'No payment form selected', 'invoicing' ),
85
+                )
86
+            );
87
+
88
+        }
89
+
90
+        // If yes, ensure that it is published.
91
+        if ( 'publish' != get_post_status( $args['form'] ) ) {
92
+            return aui()->alert(
93
+                array(
94
+                    'type'    => 'warning',
95
+                    'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
+                )
97
+            );
98
+        }
99
+
100
+        // Get the form elements and items.
101
+        $elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
+        $items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
+
104
+        ob_start();
105
+        echo "<form class='wpinv_payment_form'>";
106
+        echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
+        wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
+
109
+        foreach ( $elements as $element ) {
110
+            do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
+            do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
+        }
113
+
114
+        echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
115
+        echo '</form>';
116
+
117
+        $content = ob_get_clean();
118 118
 		
119
-		return str_replace( 'sr-only', '', $content );
119
+        return str_replace( 'sr-only', '', $content );
120 120
 
121 121
     }
122 122
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 				'orderby'        => 'title',
23 23
 				'order'          => 'ASC',
24 24
 				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
25
+				'post_status'    => array('publish'),
26 26
 			)
27 27
 		);
28 28
 
29 29
 		$options = array(
30
-			'' => __('Select a Form','invoicing')
30
+			'' => __('Select a Form', 'invoicing')
31 31
 		);
32 32
 
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
33
+		foreach ($forms as $form) {
34
+			$options[$form->ID] = $form->post_title;
35 35
 		}
36 36
 
37 37
         $options = array(
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
             'block-keywords'=> "['invoicing','buy', 'buy item', 'pay', 'payment form']",
42 42
             'class_name'     => __CLASS__,
43 43
             'base_id'       => 'wpinv_payment_form',
44
-            'name'          => __('Invoicing > Payment Form','invoicing'),
44
+            'name'          => __('Invoicing > Payment Form', 'invoicing'),
45 45
             'widget_ops'    => array(
46 46
                 'classname'   => 'wpinv-payment-form-class bsui',
47
-                'description' => esc_html__('Displays a payment form.','invoicing'),
47
+                'description' => esc_html__('Displays a payment form.', 'invoicing'),
48 48
             ),
49 49
             'arguments'           => array(
50 50
                 'form'            => array(
51
-                    'title'       => __( 'Payment Form', 'invoicing' ),
52
-                    'desc'        => __( 'Select your payment form.', 'invoicing' ),
51
+                    'title'       => __('Payment Form', 'invoicing'),
52
+                    'desc'        => __('Select your payment form.', 'invoicing'),
53 53
 					'type'        => 'select',
54 54
 					'options'     =>  $options,
55 55
                     'desc_tip'    => true,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         );
62 62
 
63 63
 
64
-        parent::__construct( $options );
64
+        parent::__construct($options);
65 65
     }
66 66
 
67 67
 	/**
@@ -73,42 +73,42 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
76
+    public function output($args = array(), $widget_args = array(), $content = '') {
77 77
 		global $invoicing;
78 78
 
79 79
 		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
80
+		if (empty($args['form'])) {
81 81
 			return aui()->alert(
82 82
 				array(
83 83
 					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
84
+					'content' => __('No payment form selected', 'invoicing'),
85 85
 				)
86 86
 			);
87 87
 
88 88
 		}
89 89
 
90 90
 		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
91
+		if ('publish' != get_post_status($args['form'])) {
92 92
 			return aui()->alert(
93 93
 				array(
94 94
 					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
95
+					'content' => __('This payment form is no longer active', 'invoicing'),
96 96
 				)
97 97
 			);
98 98
 		}
99 99
 
100 100
 		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
101
+		$elements = $invoicing->form_elements->get_form_elements($args['form']);
102
+		$items    = $invoicing->form_elements->get_form_items($args['form']);
103 103
 
104 104
 		ob_start();
105 105
 		echo "<form class='wpinv_payment_form'>";
106 106
 		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
107
+		wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
108 108
 
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
109
+		foreach ($elements as $element) {
110
+			do_action('wpinv_frontend_render_payment_form_element', $element, $items, $args['form']);
111
+			do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form']);
112 112
 		}
113 113
 
114 114
 		echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$content = ob_get_clean();
118 118
 		
119
-		return str_replace( 'sr-only', '', $content );
119
+		return str_replace('sr-only', '', $content);
120 120
 
121 121
     }
122 122
 
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'billing_email',
210
-                'name' => __( 'Billing Email', 'invoicing' ),
210
+                'name' => __('Billing Email', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
                     'placeholder'  => '[email protected]',
213 213
                     'value'        => '',
214
-                    'label'        => __( 'Billing Email', 'invoicing' ),
214
+                    'label'        => __('Billing Email', 'invoicing'),
215 215
                     'description'  => '',
216 216
                     'premade'      => true,
217 217
                 )
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 
220 220
             array( 
221 221
                 'type' => 'discount',
222
-                'name' => __( 'Discount Input', 'invoicing' ),
222
+                'name' => __('Discount Input', 'invoicing'),
223 223
                 'defaults'  => array(
224 224
                     'value'        => '',
225
-                    'input_label'  => __( 'Coupon Code', 'invoicing' ),
226
-                    'button_label' => __( 'Apply Coupon', 'invoicing' ),
227
-                    'description'  => __( 'Have a discount code? Enter it above.', 'invoicing' ),
225
+                    'input_label'  => __('Coupon Code', 'invoicing'),
226
+                    'button_label' => __('Apply Coupon', 'invoicing'),
227
+                    'description'  => __('Have a discount code? Enter it above.', 'invoicing'),
228 228
                 )
229 229
             ),
230 230
 
231 231
             array( 
232 232
                 'type' => 'items',
233
-                'name' => __( 'Items', 'invoicing' ),
233
+                'name' => __('Items', 'invoicing'),
234 234
                 'defaults'  => array(
235 235
                     'value'        => '',
236 236
                     'items_type'   => 'total',
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 
242 242
             array( 
243 243
                 'type'       => 'pay_button',
244
-                'name'       => __( 'Payment Button', 'invoicing' ),
244
+                'name'       => __('Payment Button', 'invoicing'),
245 245
                 'defaults'   => array(
246 246
                     'value'        => '',
247 247
                     'class'        => 'btn-primary',
248
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
249
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
248
+                    'label'        => __('Pay Now »', 'invoicing'),
249
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
250 250
                     'premade'      => true,
251 251
                 )
252 252
             )
253 253
         );
254 254
 
255
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
255
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
256 256
         return $this->elements;
257 257
     }
258 258
 
259 259
     /**
260 260
      * Returns the restrict markup.
261 261
      */
262
-    public function get_restrict_markup( $field, $field_type ) {
262
+    public function get_restrict_markup($field, $field_type) {
263 263
         $restrict = "$field.type=='$field_type'";
264 264
         return "v-if=\"$restrict\"";
265 265
     }
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
     /**
268 268
      * Renders the title element template.
269 269
      */
270
-    public function render_heading_template( $field ) {
271
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
270
+    public function render_heading_template($field) {
271
+        $restrict = $this->get_restrict_markup($field, 'heading');
272 272
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
273 273
     }
274 274
 
275 275
     /**
276 276
      * Renders the title element on the frontend.
277 277
      */
278
-    public function frontend_render_heading_template( $field ) {
278
+    public function frontend_render_heading_template($field) {
279 279
         $tag = $field['level'];
280 280
         echo "<$tag>{$field['text']}</$tag>";
281 281
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
     /**
284 284
      * Renders the edit title element template.
285 285
      */
286
-    public function edit_heading_template( $field ) {
287
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
288
-        $label    = __( 'Heading', 'invoicing' );
289
-        $label2   = __( 'Select Heading Level', 'invoicing' );
286
+    public function edit_heading_template($field) {
287
+        $restrict = $this->get_restrict_markup($field, 'heading');
288
+        $label    = __('Heading', 'invoicing');
289
+        $label2   = __('Select Heading Level', 'invoicing');
290 290
         $id       = $field . '.id + "_edit"';
291 291
         $id2      = $field . '.id + "_edit2"';
292 292
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * Renders a paragraph element template.
320 320
      */
321
-    public function render_paragraph_template( $field ) {
322
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
321
+    public function render_paragraph_template($field) {
322
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
323 323
         $label    = "$field.text";
324 324
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
325 325
     }
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
     /**
328 328
      * Renders the paragraph element on the frontend.
329 329
      */
330
-    public function frontend_render_paragraph_template( $field ) {
330
+    public function frontend_render_paragraph_template($field) {
331 331
         echo "<p>{$field['text']}</p>";
332 332
     }
333 333
 
334 334
     /**
335 335
      * Renders the edit paragraph element template.
336 336
      */
337
-    public function edit_paragraph_template( $field ) {
338
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
339
-        $label    = __( 'Enter your text', 'invoicing' );
337
+    public function edit_paragraph_template($field) {
338
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
339
+        $label    = __('Enter your text', 'invoicing');
340 340
         $id       = $field . '.id + "_edit"';
341 341
         echo "
342 342
             <div $restrict>
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Renders the text element template.
354 354
      */
355
-    public function render_text_template( $field ) {
356
-        $restrict = $this->get_restrict_markup( $field, 'text' );
355
+    public function render_text_template($field) {
356
+        $restrict = $this->get_restrict_markup($field, 'text');
357 357
         $label    = "$field.label";
358 358
         echo "
359 359
             <div $restrict>
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
     /**
368 368
      * Renders the text element on the frontend.
369 369
      */
370
-    public function frontend_render_text_template( $field ) {
370
+    public function frontend_render_text_template($field) {
371 371
         
372 372
         echo "<div class='form-group'>";
373 373
 
374 374
         echo aui()->input(
375 375
             array(
376
-                'name'       => esc_attr( $field['id'] ),
377
-                'id'         => esc_attr( $field['id'] ),
378
-                'placeholder'=> esc_attr( $field['placeholder'] ),
376
+                'name'       => esc_attr($field['id']),
377
+                'id'         => esc_attr($field['id']),
378
+                'placeholder'=> esc_attr($field['placeholder']),
379 379
                 'required'   => (bool) $field['required'],
380
-                'label'      => wp_kses_post( $field['label'] ),
380
+                'label'      => wp_kses_post($field['label']),
381 381
                 'no_wrap'    => true,
382 382
             )
383 383
         );
384 384
 
385
-        if ( ! empty( $field['description'] ) ) {
386
-            $description = wp_kses_post( $field['description'] );
385
+        if (!empty($field['description'])) {
386
+            $description = wp_kses_post($field['description']);
387 387
             echo "<small class='form-text text-muted'>$description</small>";
388 388
         }
389 389
 
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
     /**
395 395
      * Renders the edit text element template.
396 396
      */
397
-    public function edit_text_template( $field ) {
398
-        $restrict = $this->get_restrict_markup( $field, 'text' );
399
-        $label    = __( 'Field Label', 'invoicing' );
397
+    public function edit_text_template($field) {
398
+        $restrict = $this->get_restrict_markup($field, 'text');
399
+        $label    = __('Field Label', 'invoicing');
400 400
         $id       = $field . '.id + "_edit"';
401
-        $label2   = __( 'Placeholder text', 'invoicing' );
401
+        $label2   = __('Placeholder text', 'invoicing');
402 402
         $id2      = $field . '.id + "_edit2"';
403
-        $label3   = __( 'Help text', 'invoicing' );
404
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
403
+        $label3   = __('Help text', 'invoicing');
404
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
405 405
         $id3      = $field . '.id + "_edit3"';
406
-        $label5   = __( 'Is this field required?', 'invoicing' );
406
+        $label5   = __('Is this field required?', 'invoicing');
407 407
         $id4      = $field . '.id + "_edit4"';
408 408
         echo "
409 409
             <div $restrict>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
     /**
432 432
      * Renders the textarea element template.
433 433
      */
434
-    public function render_textarea_template( $field ) {
435
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
434
+    public function render_textarea_template($field) {
435
+        $restrict = $this->get_restrict_markup($field, 'textarea');
436 436
         $label    = "$field.label";
437 437
         echo "
438 438
             <div $restrict>
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
     /**
447 447
      * Renders the textarea element on the frontend.
448 448
      */
449
-    public function frontend_render_textarea_template( $field ) {
449
+    public function frontend_render_textarea_template($field) {
450 450
         
451 451
         echo "<div class='form-group'>";
452 452
 
453 453
         echo aui()->textarea(
454 454
             array(
455
-                'name'       => esc_attr( $field['id'] ),
456
-                'id'         => esc_attr( $field['id'] ),
457
-                'placeholder'=> esc_attr( $field['placeholder'] ),
455
+                'name'       => esc_attr($field['id']),
456
+                'id'         => esc_attr($field['id']),
457
+                'placeholder'=> esc_attr($field['placeholder']),
458 458
                 'required'   => (bool) $field['required'],
459
-                'label'      => wp_kses_post( $field['label'] ),
459
+                'label'      => wp_kses_post($field['label']),
460 460
                 'no_wrap'    => true,
461 461
                 'rows'       => 3,
462 462
             )
463 463
         );
464 464
 
465
-        if ( ! empty( $field['description'] ) ) {
466
-            $description = wp_kses_post( $field['description'] );
465
+        if (!empty($field['description'])) {
466
+            $description = wp_kses_post($field['description']);
467 467
             echo "<small class='form-text text-muted'>$description</small>";
468 468
         }
469 469
 
@@ -474,16 +474,16 @@  discard block
 block discarded – undo
474 474
     /**
475 475
      * Renders the edit textarea element template.
476 476
      */
477
-    public function edit_textarea_template( $field ) {
478
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
479
-        $label    = __( 'Field Label', 'invoicing' );
477
+    public function edit_textarea_template($field) {
478
+        $restrict = $this->get_restrict_markup($field, 'textarea');
479
+        $label    = __('Field Label', 'invoicing');
480 480
         $id       = $field . '.id + "_edit"';
481
-        $label2   = __( 'Placeholder text', 'invoicing' );
481
+        $label2   = __('Placeholder text', 'invoicing');
482 482
         $id2      = $field . '.id + "_edit2"';
483
-        $label3   = __( 'Help text', 'invoicing' );
484
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
483
+        $label3   = __('Help text', 'invoicing');
484
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
485 485
         $id3      = $field . '.id + "_edit3"';
486
-        $label5   = __( 'Is this field required?', 'invoicing' );
486
+        $label5   = __('Is this field required?', 'invoicing');
487 487
         $id4      = $field . '.id + "_edit4"';
488 488
         echo "
489 489
             <div $restrict>
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
     /**
512 512
      * Renders the select element template.
513 513
      */
514
-    public function render_select_template( $field ) {
515
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
514
+    public function render_select_template($field) {
515
+        $restrict    = $this->get_restrict_markup($field, 'select');
516 516
         $label       = "$field.label";
517 517
         $placeholder = "$field.placeholder";
518 518
         $id          = $field . '.id';
@@ -531,24 +531,24 @@  discard block
 block discarded – undo
531 531
     /**
532 532
      * Renders the select element on the frontend.
533 533
      */
534
-    public function frontend_render_select_template( $field ) {
534
+    public function frontend_render_select_template($field) {
535 535
         
536 536
         echo "<div class='form-group'>";
537 537
 
538 538
         echo aui()->select(
539 539
             array(
540
-                'name'       => esc_attr( $field['id'] ),
541
-                'id'         => esc_attr( $field['id'] ),
542
-                'placeholder'=> esc_attr( $field['placeholder'] ),
540
+                'name'       => esc_attr($field['id']),
541
+                'id'         => esc_attr($field['id']),
542
+                'placeholder'=> esc_attr($field['placeholder']),
543 543
                 'required'   => (bool) $field['required'],
544
-                'label'      => wp_kses_post( $field['label'] ),
544
+                'label'      => wp_kses_post($field['label']),
545 545
                 'no_wrap'    => true,
546 546
                 'options'    => $field['options'],
547 547
             )
548 548
         );
549 549
 
550
-        if ( ! empty( $field['description'] ) ) {
551
-            $description = wp_kses_post( $field['description'] );
550
+        if (!empty($field['description'])) {
551
+            $description = wp_kses_post($field['description']);
552 552
             echo "<small class='form-text text-muted'>$description</small>";
553 553
         }
554 554
 
@@ -559,18 +559,18 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Renders the edit select element template.
561 561
      */
562
-    public function edit_select_template( $field ) {
563
-        $restrict = $this->get_restrict_markup( $field, 'select' );
564
-        $label    = __( 'Field Label', 'invoicing' );
562
+    public function edit_select_template($field) {
563
+        $restrict = $this->get_restrict_markup($field, 'select');
564
+        $label    = __('Field Label', 'invoicing');
565 565
         $id       = $field . '.id + "_edit"';
566
-        $label2   = __( 'Placeholder text', 'invoicing' );
566
+        $label2   = __('Placeholder text', 'invoicing');
567 567
         $id2      = $field . '.id + "_edit2"';
568
-        $label3   = __( 'Help text', 'invoicing' );
569
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
568
+        $label3   = __('Help text', 'invoicing');
569
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
570 570
         $id3      = $field . '.id + "_edit3"';
571
-        $label5   = __( 'Is this field required?', 'invoicing' );
571
+        $label5   = __('Is this field required?', 'invoicing');
572 572
         $id4      = $field . '.id + "_edit4"';
573
-        $label6   = __( 'Available Options', 'invoicing' );
573
+        $label6   = __('Available Options', 'invoicing');
574 574
         echo "
575 575
             <div $restrict>
576 576
                 <div class='form-group'>
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
     /**
609 609
      * Renders the checkbox element template.
610 610
      */
611
-    public function render_checkbox_template( $field ) {
612
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
611
+    public function render_checkbox_template($field) {
612
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
613 613
         $label    = "$field.label";
614 614
         echo "
615 615
             <div class='form-check' $restrict>
@@ -623,23 +623,23 @@  discard block
 block discarded – undo
623 623
     /**
624 624
      * Renders the checkbox element on the frontend.
625 625
      */
626
-    public function frontend_render_checkbox_template( $field ) {
626
+    public function frontend_render_checkbox_template($field) {
627 627
         
628 628
         echo "<div class='form-group'>";
629 629
 
630 630
         echo aui()->input(
631 631
             array(
632
-                'name'       => esc_attr( $field['id'] ),
633
-                'id'         => esc_attr( $field['id'] ),
632
+                'name'       => esc_attr($field['id']),
633
+                'id'         => esc_attr($field['id']),
634 634
                 'required'   => (bool) $field['required'],
635
-                'label'      => wp_kses_post( $field['label'] ),
635
+                'label'      => wp_kses_post($field['label']),
636 636
                 'no_wrap'    => true,
637 637
                 'type'       => 'checkbox',
638 638
             )
639 639
         );
640 640
 
641
-        if ( ! empty( $field['description'] ) ) {
642
-            $description = wp_kses_post( $field['description'] );
641
+        if (!empty($field['description'])) {
642
+            $description = wp_kses_post($field['description']);
643 643
             echo "<small class='form-text text-muted'>$description</small>";
644 644
         }
645 645
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
     /**
651 651
      * Renders the edit checkbox element template.
652 652
      */
653
-    public function edit_checkbox_template( $field ) {
654
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
655
-        $label    = __( 'Field Label', 'invoicing' );
653
+    public function edit_checkbox_template($field) {
654
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
655
+        $label    = __('Field Label', 'invoicing');
656 656
         $id       = $field . '.id + "_edit"';
657
-        $label2   = __( 'Help text', 'invoicing' );
658
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
657
+        $label2   = __('Help text', 'invoicing');
658
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
659 659
         $id2      = $field . '.id + "_edit2"';
660
-        $label4   = __( 'Is this field required?', 'invoicing' );
660
+        $label4   = __('Is this field required?', 'invoicing');
661 661
         $id3      = $field . '.id + "_edit3"';
662 662
         echo "
663 663
             <div $restrict>
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
     /**
682 682
      * Renders the radio element template.
683 683
      */
684
-    public function render_radio_template( $field ) {
685
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
684
+    public function render_radio_template($field) {
685
+        $restrict    = $this->get_restrict_markup($field, 'radio');
686 686
         $label       = "$field.label";
687 687
         $id          = $field . '.id';
688 688
         echo "
@@ -700,19 +700,19 @@  discard block
 block discarded – undo
700 700
     /**
701 701
      * Renders the radio element on the frontend.
702 702
      */
703
-    public function frontend_render_radio_template( $field ) {
703
+    public function frontend_render_radio_template($field) {
704 704
         
705 705
         echo "<div class='form-group'>";
706 706
 
707
-        if ( ! empty( $field['label'] ) ) {
708
-            $label = wp_kses_post( $field['label'] );
707
+        if (!empty($field['label'])) {
708
+            $label = wp_kses_post($field['label']);
709 709
             echo "<legend class='col-form-label'>$label</legend>";
710 710
         }
711 711
 
712
-        foreach( $field['options'] as $index => $option ) {
712
+        foreach ($field['options'] as $index => $option) {
713 713
             $id    = $field['id'] . $index;
714
-            $value = esc_attr( $option );
715
-            $label = wp_kses_post( $option );
714
+            $value = esc_attr($option);
715
+            $label = wp_kses_post($option);
716 716
 
717 717
             echo "
718 718
                 <div class='form-check'>
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
             ";
723 723
         }
724 724
 
725
-        if ( ! empty( $field['description'] ) ) {
726
-            $description = wp_kses_post( $field['description'] );
725
+        if (!empty($field['description'])) {
726
+            $description = wp_kses_post($field['description']);
727 727
             echo "<small class='form-text text-muted'>$description</small>";
728 728
         }
729 729
 
@@ -734,16 +734,16 @@  discard block
 block discarded – undo
734 734
     /**
735 735
      * Renders the edit radio element template.
736 736
      */
737
-    public function edit_radio_template( $field ) {
738
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
739
-        $label    = __( 'Field Label', 'invoicing' );
737
+    public function edit_radio_template($field) {
738
+        $restrict = $this->get_restrict_markup($field, 'radio');
739
+        $label    = __('Field Label', 'invoicing');
740 740
         $id       = $field . '.id + "_edit"';
741
-        $label2   = __( 'Help text', 'invoicing' );
742
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
741
+        $label2   = __('Help text', 'invoicing');
742
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
743 743
         $id2      = $field . '.id + "_edit3"';
744
-        $label4   = __( 'Is this field required?', 'invoicing' );
744
+        $label4   = __('Is this field required?', 'invoicing');
745 745
         $id3      = $field . '.id + "_edit4"';
746
-        $label5   = __( 'Available Options', 'invoicing' );
746
+        $label5   = __('Available Options', 'invoicing');
747 747
         echo "
748 748
             <div $restrict>
749 749
                 <div class='form-group'>
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
     /**
778 778
      * Renders the email element template.
779 779
      */
780
-    public function render_email_template( $field ) {
781
-        $restrict = $this->get_restrict_markup( $field, 'email' );
780
+    public function render_email_template($field) {
781
+        $restrict = $this->get_restrict_markup($field, 'email');
782 782
         $label    = "$field.label";
783 783
         echo "
784 784
             <div $restrict>
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
     /**
793 793
      * Renders the billing_email element template.
794 794
      */
795
-    public function render_billing_email_template( $field ) {
796
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
795
+    public function render_billing_email_template($field) {
796
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
797 797
         $label    = "$field.label";
798 798
         echo "
799 799
             <div $restrict>
@@ -807,24 +807,24 @@  discard block
 block discarded – undo
807 807
     /**
808 808
      * Renders the email element on the frontend.
809 809
      */
810
-    public function frontend_render_email_template( $field ) {
810
+    public function frontend_render_email_template($field) {
811 811
         
812 812
         echo "<div class='form-group'>";
813 813
 
814 814
         echo aui()->input(
815 815
             array(
816
-                'name'       => esc_attr( $field['id'] ),
817
-                'id'         => esc_attr( $field['id'] ),
816
+                'name'       => esc_attr($field['id']),
817
+                'id'         => esc_attr($field['id']),
818 818
                 'required'   => (bool) $field['required'],
819
-                'label'      => wp_kses_post( $field['label'] ),
819
+                'label'      => wp_kses_post($field['label']),
820 820
                 'no_wrap'    => true,
821
-                'placeholder' => esc_attr( $field['placeholder'] ),
821
+                'placeholder' => esc_attr($field['placeholder']),
822 822
                 'type'       => 'email',
823 823
             )
824 824
         );
825 825
 
826
-        if ( ! empty( $field['description'] ) ) {
827
-            $description = wp_kses_post( $field['description'] );
826
+        if (!empty($field['description'])) {
827
+            $description = wp_kses_post($field['description']);
828 828
             echo "<small class='form-text text-muted'>$description</small>";
829 829
         }
830 830
 
@@ -835,24 +835,24 @@  discard block
 block discarded – undo
835 835
     /**
836 836
      * Renders the billing email element on the frontend.
837 837
      */
838
-    public function frontend_render_billing_email_template( $field ) {
838
+    public function frontend_render_billing_email_template($field) {
839 839
         
840 840
         echo "<div class='form-group'>";
841 841
 
842 842
         echo aui()->input(
843 843
             array(
844 844
                 'name'       => 'billing_email',
845
-                'id'         => esc_attr( $field['id'] ),
845
+                'id'         => esc_attr($field['id']),
846 846
                 'required'   => true,
847
-                'label'      => wp_kses_post( $field['label'] ),
847
+                'label'      => wp_kses_post($field['label']),
848 848
                 'no_wrap'    => true,
849
-                'placeholder' => esc_attr( $field['placeholder'] ),
849
+                'placeholder' => esc_attr($field['placeholder']),
850 850
                 'type'       => 'email',
851 851
             )
852 852
         );
853 853
 
854
-        if ( ! empty( $field['description'] ) ) {
855
-            $description = wp_kses_post( $field['description'] );
854
+        if (!empty($field['description'])) {
855
+            $description = wp_kses_post($field['description']);
856 856
             echo "<small class='form-text text-muted'>$description</small>";
857 857
         }
858 858
 
@@ -863,16 +863,16 @@  discard block
 block discarded – undo
863 863
     /**
864 864
      * Renders the edit email element template.
865 865
      */
866
-    public function edit_email_template( $field ) {
867
-        $restrict = $this->get_restrict_markup( $field, 'email' );
868
-        $label    = __( 'Field Label', 'invoicing' );
866
+    public function edit_email_template($field) {
867
+        $restrict = $this->get_restrict_markup($field, 'email');
868
+        $label    = __('Field Label', 'invoicing');
869 869
         $id       = $field . '.id + "_edit"';
870
-        $label2   = __( 'Placeholder text', 'invoicing' );
870
+        $label2   = __('Placeholder text', 'invoicing');
871 871
         $id2      = $field . '.id + "_edit2"';
872
-        $label3   = __( 'Help text', 'invoicing' );
873
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
872
+        $label3   = __('Help text', 'invoicing');
873
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
874 874
         $id3      = $field . '.id + "_edit3"';
875
-        $label5   = __( 'Is this field required?', 'invoicing' );
875
+        $label5   = __('Is this field required?', 'invoicing');
876 876
         $id4      = $field . '.id + "_edit4"';
877 877
         echo "
878 878
             <div $restrict>
@@ -900,16 +900,16 @@  discard block
 block discarded – undo
900 900
     /**
901 901
      * Renders the edit billing_email element template.
902 902
      */
903
-    public function edit_billing_email_template( $field ) {
904
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
905
-        $label    = __( 'Field Label', 'invoicing' );
903
+    public function edit_billing_email_template($field) {
904
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
905
+        $label    = __('Field Label', 'invoicing');
906 906
         $id       = $field . '.id + "_edit"';
907
-        $label2   = __( 'Placeholder text', 'invoicing' );
907
+        $label2   = __('Placeholder text', 'invoicing');
908 908
         $id2      = $field . '.id + "_edit2"';
909
-        $label3   = __( 'Help text', 'invoicing' );
910
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
909
+        $label3   = __('Help text', 'invoicing');
910
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
911 911
         $id3      = $field . '.id + "_edit3"';
912
-        $label5   = __( 'Is this field required?', 'invoicing' );
912
+        $label5   = __('Is this field required?', 'invoicing');
913 913
         $id4      = $field . '.id + "_edit4"';
914 914
         echo "
915 915
             <div $restrict>
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
     /**
934 934
      * Renders the website element template.
935 935
      */
936
-    public function render_website_template( $field ) {
937
-        $restrict = $this->get_restrict_markup( $field, 'website' );
936
+    public function render_website_template($field) {
937
+        $restrict = $this->get_restrict_markup($field, 'website');
938 938
         $label    = "$field.label";
939 939
         echo "
940 940
             <div $restrict>
@@ -948,24 +948,24 @@  discard block
 block discarded – undo
948 948
     /**
949 949
      * Renders the website element on the frontend.
950 950
      */
951
-    public function frontend_render_website_template( $field ) {
951
+    public function frontend_render_website_template($field) {
952 952
         
953 953
         echo "<div class='form-group'>";
954 954
 
955 955
         echo aui()->input(
956 956
             array(
957
-                'name'       => esc_attr( $field['id'] ),
958
-                'id'         => esc_attr( $field['id'] ),
957
+                'name'       => esc_attr($field['id']),
958
+                'id'         => esc_attr($field['id']),
959 959
                 'required'   => (bool) $field['required'],
960
-                'label'      => wp_kses_post( $field['label'] ),
960
+                'label'      => wp_kses_post($field['label']),
961 961
                 'no_wrap'    => true,
962
-                'placeholder' => esc_attr( $field['placeholder'] ),
962
+                'placeholder' => esc_attr($field['placeholder']),
963 963
                 'type'       => 'url',
964 964
             )
965 965
         );
966 966
 
967
-        if ( ! empty( $field['description'] ) ) {
968
-            $description = wp_kses_post( $field['description'] );
967
+        if (!empty($field['description'])) {
968
+            $description = wp_kses_post($field['description']);
969 969
             echo "<small class='form-text text-muted'>$description</small>";
970 970
         }
971 971
 
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
     /**
977 977
      * Renders the edit website element template.
978 978
      */
979
-    public function edit_website_template( $field ) {
980
-        $restrict = $this->get_restrict_markup( $field, 'website' );
981
-        $label    = __( 'Field Label', 'invoicing' );
979
+    public function edit_website_template($field) {
980
+        $restrict = $this->get_restrict_markup($field, 'website');
981
+        $label    = __('Field Label', 'invoicing');
982 982
         $id       = $field . '.id + "_edit"';
983
-        $label2   = __( 'Placeholder text', 'invoicing' );
983
+        $label2   = __('Placeholder text', 'invoicing');
984 984
         $id2      = $field . '.id + "_edit2"';
985
-        $label3   = __( 'Help text', 'invoicing' );
986
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
985
+        $label3   = __('Help text', 'invoicing');
986
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
987 987
         $id3      = $field . '.id + "_edit3"';
988
-        $label5   = __( 'Is this field required?', 'invoicing' );
988
+        $label5   = __('Is this field required?', 'invoicing');
989 989
         $id4      = $field . '.id + "_edit4"';
990 990
         echo "
991 991
             <div $restrict>
@@ -1013,8 +1013,8 @@  discard block
 block discarded – undo
1013 1013
     /**
1014 1014
      * Renders the date element template.
1015 1015
      */
1016
-    public function render_date_template( $field ) {
1017
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1016
+    public function render_date_template($field) {
1017
+        $restrict = $this->get_restrict_markup($field, 'date');
1018 1018
         $label    = "$field.label";
1019 1019
         echo "
1020 1020
             <div $restrict>
@@ -1028,24 +1028,24 @@  discard block
 block discarded – undo
1028 1028
     /**
1029 1029
      * Renders the date element on the frontend.
1030 1030
      */
1031
-    public function frontend_render_date_template( $field ) {
1031
+    public function frontend_render_date_template($field) {
1032 1032
         
1033 1033
         echo "<div class='form-group'>";
1034 1034
 
1035 1035
         echo aui()->input(
1036 1036
             array(
1037
-                'name'       => esc_attr( $field['id'] ),
1038
-                'id'         => esc_attr( $field['id'] ),
1037
+                'name'       => esc_attr($field['id']),
1038
+                'id'         => esc_attr($field['id']),
1039 1039
                 'required'   => (bool) $field['required'],
1040
-                'label'      => wp_kses_post( $field['label'] ),
1041
-                'placeholder' => esc_attr( $field['placeholder'] ),
1040
+                'label'      => wp_kses_post($field['label']),
1041
+                'placeholder' => esc_attr($field['placeholder']),
1042 1042
                 'no_wrap'    => true,
1043 1043
                 'type'       => 'date',
1044 1044
             )
1045 1045
         );
1046 1046
 
1047
-        if ( ! empty( $field['description'] ) ) {
1048
-            $description = wp_kses_post( $field['description'] );
1047
+        if (!empty($field['description'])) {
1048
+            $description = wp_kses_post($field['description']);
1049 1049
             echo "<small class='form-text text-muted'>$description</small>";
1050 1050
         }
1051 1051
 
@@ -1056,16 +1056,16 @@  discard block
 block discarded – undo
1056 1056
     /**
1057 1057
      * Renders the edit date element template.
1058 1058
      */
1059
-    public function edit_date_template( $field ) {
1060
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1061
-        $label    = __( 'Field Label', 'invoicing' );
1059
+    public function edit_date_template($field) {
1060
+        $restrict = $this->get_restrict_markup($field, 'date');
1061
+        $label    = __('Field Label', 'invoicing');
1062 1062
         $id       = $field . '.id + "_edit"';
1063
-        $label2   = __( 'Placeholder text', 'invoicing' );
1063
+        $label2   = __('Placeholder text', 'invoicing');
1064 1064
         $id2      = $field . '.id + "_edit2"';
1065
-        $label3   = __( 'Help text', 'invoicing' );
1066
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1065
+        $label3   = __('Help text', 'invoicing');
1066
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1067 1067
         $id3      = $field . '.id + "_edit3"';
1068
-        $label5   = __( 'Is this field required?', 'invoicing' );
1068
+        $label5   = __('Is this field required?', 'invoicing');
1069 1069
         $id4      = $field . '.id + "_edit4"';
1070 1070
         echo "
1071 1071
             <div $restrict>
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
     /**
1094 1094
      * Renders the time element template.
1095 1095
      */
1096
-    public function render_time_template( $field ) {
1097
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1096
+    public function render_time_template($field) {
1097
+        $restrict = $this->get_restrict_markup($field, 'time');
1098 1098
         $label    = "$field.label";
1099 1099
         echo "
1100 1100
             <div $restrict>
@@ -1108,24 +1108,24 @@  discard block
 block discarded – undo
1108 1108
     /**
1109 1109
      * Renders the time element on the frontend.
1110 1110
      */
1111
-    public function frontend_render_time_template( $field ) {
1111
+    public function frontend_render_time_template($field) {
1112 1112
         
1113 1113
         echo "<div class='form-group'>";
1114 1114
 
1115 1115
         echo aui()->input(
1116 1116
             array(
1117
-                'name'       => esc_attr( $field['id'] ),
1118
-                'id'         => esc_attr( $field['id'] ),
1117
+                'name'       => esc_attr($field['id']),
1118
+                'id'         => esc_attr($field['id']),
1119 1119
                 'required'   => (bool) $field['required'],
1120
-                'label'      => wp_kses_post( $field['label'] ),
1120
+                'label'      => wp_kses_post($field['label']),
1121 1121
                 'no_wrap'    => true,
1122
-                'placeholder' => esc_attr( $field['placeholder'] ),
1122
+                'placeholder' => esc_attr($field['placeholder']),
1123 1123
                 'type'       => 'time',
1124 1124
             )
1125 1125
         );
1126 1126
 
1127
-        if ( ! empty( $field['description'] ) ) {
1128
-            $description = wp_kses_post( $field['description'] );
1127
+        if (!empty($field['description'])) {
1128
+            $description = wp_kses_post($field['description']);
1129 1129
             echo "<small class='form-text text-muted'>$description</small>";
1130 1130
         }
1131 1131
 
@@ -1136,16 +1136,16 @@  discard block
 block discarded – undo
1136 1136
     /**
1137 1137
      * Renders the edit time element template.
1138 1138
      */
1139
-    public function edit_time_template( $field ) {
1140
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1141
-        $label    = __( 'Field Label', 'invoicing' );
1139
+    public function edit_time_template($field) {
1140
+        $restrict = $this->get_restrict_markup($field, 'time');
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>
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
     /**
1174 1174
      * Renders the number element template.
1175 1175
      */
1176
-    public function render_number_template( $field ) {
1177
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1176
+    public function render_number_template($field) {
1177
+        $restrict = $this->get_restrict_markup($field, 'number');
1178 1178
         $label    = "$field.label";
1179 1179
         echo "
1180 1180
             <div $restrict>
@@ -1188,24 +1188,24 @@  discard block
 block discarded – undo
1188 1188
     /**
1189 1189
      * Renders the number element on the frontend.
1190 1190
      */
1191
-    public function frontend_render_number_template( $field ) {
1191
+    public function frontend_render_number_template($field) {
1192 1192
         
1193 1193
         echo "<div class='form-group'>";
1194 1194
 
1195 1195
         echo aui()->input(
1196 1196
             array(
1197
-                'name'       => esc_attr( $field['id'] ),
1198
-                'id'         => esc_attr( $field['id'] ),
1197
+                'name'       => esc_attr($field['id']),
1198
+                'id'         => esc_attr($field['id']),
1199 1199
                 'required'   => (bool) $field['required'],
1200
-                'label'      => wp_kses_post( $field['label'] ),
1201
-                'placeholder' => esc_attr( $field['placeholder'] ),
1200
+                'label'      => wp_kses_post($field['label']),
1201
+                'placeholder' => esc_attr($field['placeholder']),
1202 1202
                 'no_wrap'    => true,
1203 1203
                 'type'       => 'number',
1204 1204
             )
1205 1205
         );
1206 1206
 
1207
-        if ( ! empty( $field['description'] ) ) {
1208
-            $description = wp_kses_post( $field['description'] );
1207
+        if (!empty($field['description'])) {
1208
+            $description = wp_kses_post($field['description']);
1209 1209
             echo "<small class='form-text text-muted'>$description</small>";
1210 1210
         }
1211 1211
 
@@ -1216,16 +1216,16 @@  discard block
 block discarded – undo
1216 1216
     /**
1217 1217
      * Renders the edit number element template.
1218 1218
      */
1219
-    public function edit_number_template( $field ) {
1220
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1221
-        $label    = __( 'Field Label', 'invoicing' );
1219
+    public function edit_number_template($field) {
1220
+        $restrict = $this->get_restrict_markup($field, 'number');
1221
+        $label    = __('Field Label', 'invoicing');
1222 1222
         $id       = $field . '.id + "_edit"';
1223
-        $label2   = __( 'Placeholder text', 'invoicing' );
1223
+        $label2   = __('Placeholder text', 'invoicing');
1224 1224
         $id2      = $field . '.id + "_edit2"';
1225
-        $label3   = __( 'Help text', 'invoicing' );
1226
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1225
+        $label3   = __('Help text', 'invoicing');
1226
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1227 1227
         $id3      = $field . '.id + "_edit3"';
1228
-        $label5   = __( 'Is this field required?', 'invoicing' );
1228
+        $label5   = __('Is this field required?', 'invoicing');
1229 1229
         $id4      = $field . '.id + "_edit4"';
1230 1230
         echo "
1231 1231
             <div $restrict>
@@ -1253,23 +1253,23 @@  discard block
 block discarded – undo
1253 1253
     /**
1254 1254
      * Renders the separator element template.
1255 1255
      */
1256
-    public function render_separator_template( $field ) {
1257
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1256
+    public function render_separator_template($field) {
1257
+        $restrict = $this->get_restrict_markup($field, 'separator');
1258 1258
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1259 1259
     }
1260 1260
 
1261 1261
     /**
1262 1262
      * Renders the separator element on the frontend.
1263 1263
      */
1264
-    public function frontend_render_separator_template( $field ) {
1264
+    public function frontend_render_separator_template($field) {
1265 1265
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1266 1266
     }
1267 1267
 
1268 1268
     /**
1269 1269
      * Renders the pay button element template.
1270 1270
      */
1271
-    public function render_pay_button_template( $field ) {
1272
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1271
+    public function render_pay_button_template($field) {
1272
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1273 1273
         $label    = "$field.label";
1274 1274
         echo "
1275 1275
             <div $restrict>
@@ -1282,24 +1282,24 @@  discard block
 block discarded – undo
1282 1282
     /**
1283 1283
      * Renders the pay_button element on the frontend.
1284 1284
      */
1285
-    public function frontend_render_pay_button_template( $field ) {
1285
+    public function frontend_render_pay_button_template($field) {
1286 1286
         
1287 1287
         echo "<div class='form-group'>";
1288 1288
 
1289
-        $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1289
+        $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']);
1290 1290
         echo aui()->input(
1291 1291
             array(
1292
-                'name'       => esc_attr( $field['id'] ),
1293
-                'id'         => esc_attr( $field['id'] ),
1294
-                'value'      => esc_attr( $field['label'] ),
1292
+                'name'       => esc_attr($field['id']),
1293
+                'id'         => esc_attr($field['id']),
1294
+                'value'      => esc_attr($field['label']),
1295 1295
                 'no_wrap'    => true,
1296 1296
                 'type'       => 'submit',
1297 1297
                 'class'      => $class,
1298 1298
             )
1299 1299
         );
1300 1300
 
1301
-        if ( ! empty( $field['description'] ) ) {
1302
-            $description = wp_kses_post( $field['description'] );
1301
+        if (!empty($field['description'])) {
1302
+            $description = wp_kses_post($field['description']);
1303 1303
             echo "<small class='form-text text-muted'>$description</small>";
1304 1304
         }
1305 1305
 
@@ -1310,14 +1310,14 @@  discard block
 block discarded – undo
1310 1310
     /**
1311 1311
      * Renders the pay button element template.
1312 1312
      */
1313
-    public function edit_pay_button_template( $field ) {
1314
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1315
-        $label    = __( 'Button Text', 'invoicing' );
1313
+    public function edit_pay_button_template($field) {
1314
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1315
+        $label    = __('Button Text', 'invoicing');
1316 1316
         $id       = $field . '.id + "_edit"';
1317
-        $label2   = __( 'Help text', 'invoicing' );
1318
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1317
+        $label2   = __('Help text', 'invoicing');
1318
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1319 1319
         $id2      = $field . '.id + "_edit2"';
1320
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1320
+        $label4   = esc_attr__('Button Type', 'invoicing');
1321 1321
         $id3      = $field . '.id + "_edit3"';
1322 1322
         echo "
1323 1323
             <div $restrict>
@@ -1333,15 +1333,15 @@  discard block
 block discarded – undo
1333 1333
                     <label :for='$id3'>$label4</label>
1334 1334
 
1335 1335
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1336
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1337
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1338
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1339
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1340
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1341
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1342
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1343
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1344
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1336
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1337
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1338
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1339
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1340
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1341
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1342
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1343
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1344
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1345 1345
                     </select>
1346 1346
                 </div>
1347 1347
             </div>
@@ -1352,8 +1352,8 @@  discard block
 block discarded – undo
1352 1352
     /**
1353 1353
      * Renders the alert element template.
1354 1354
      */
1355
-    public function render_alert_template( $field ) {
1356
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1355
+    public function render_alert_template($field) {
1356
+        $restrict = $this->get_restrict_markup($field, 'alert');
1357 1357
         $text     = "$field.text";
1358 1358
         echo "
1359 1359
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1368,15 +1368,15 @@  discard block
 block discarded – undo
1368 1368
     /**
1369 1369
      * Renders the alert element on the frontend.
1370 1370
      */
1371
-    public function frontend_render_alert_template( $field ) {
1371
+    public function frontend_render_alert_template($field) {
1372 1372
         
1373 1373
         echo "<div class='form-group'>";
1374 1374
 
1375 1375
         echo aui()->alert(
1376 1376
             array(
1377
-                'content'     => wp_kses_post( $field['text'] ),
1377
+                'content'     => wp_kses_post($field['text']),
1378 1378
                 'dismissible' => $field['dismissible'],
1379
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1379
+                'type'        => str_replace('alert-', '', $field['class']),
1380 1380
             )
1381 1381
         );
1382 1382
 
@@ -1387,14 +1387,14 @@  discard block
 block discarded – undo
1387 1387
     /**
1388 1388
      * Renders the alert element template.
1389 1389
      */
1390
-    public function edit_alert_template( $field ) {
1391
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1392
-        $label    = __( 'Alert Text', 'invoicing' );
1393
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1390
+    public function edit_alert_template($field) {
1391
+        $restrict = $this->get_restrict_markup($field, 'alert');
1392
+        $label    = __('Alert Text', 'invoicing');
1393
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1394 1394
         $id       = $field . '.id + "_edit"';
1395
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1395
+        $label3   = __('Is Dismissible?', 'invoicing');
1396 1396
         $id2      = $field . '.id + "_edit2"';
1397
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1397
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1398 1398
         $id3      = $field . '.id + "_edit3"';
1399 1399
         echo "
1400 1400
             <div $restrict>
@@ -1410,14 +1410,14 @@  discard block
 block discarded – undo
1410 1410
                     <label :for='$id3'>$label4</label>
1411 1411
 
1412 1412
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1413
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1414
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1415
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1416
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1417
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1418
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1419
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1420
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1413
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1414
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1415
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1416
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1417
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1418
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1419
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1420
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1421 1421
                     </select>
1422 1422
                 </div>
1423 1423
             </div>
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
     /**
1429 1429
      * Renders the discount element template.
1430 1430
      */
1431
-    public function render_discount_template( $field ) {
1432
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1431
+    public function render_discount_template($field) {
1432
+        $restrict = $this->get_restrict_markup($field, 'discount');
1433 1433
         ?>
1434 1434
 
1435 1435
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
     /**
1447 1447
      * Renders the discount element on the frontend.
1448 1448
      */
1449
-    public function frontend_render_discount_template( $field ) {
1449
+    public function frontend_render_discount_template($field) {
1450 1450
         
1451
-        $placeholder = esc_attr( $field['input_label'] );
1452
-        $label       = sanitize_text_field( $field['button_label'] );
1451
+        $placeholder = esc_attr($field['input_label']);
1452
+        $label       = sanitize_text_field($field['button_label']);
1453 1453
         $description = '';
1454 1454
 
1455
-        if ( ! empty( $field['description'] ) ) {
1455
+        if (!empty($field['description'])) {
1456 1456
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1457 1457
         }
1458 1458
 ?>
@@ -1473,12 +1473,12 @@  discard block
 block discarded – undo
1473 1473
     /**
1474 1474
      * Renders the discount element template.
1475 1475
      */
1476
-    public function edit_discount_template( $field ) {
1477
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1478
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1479
-        $label2   = __( 'Help Text', 'invoicing' );
1480
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1481
-        $label4   = __( 'Button Text', 'invoicing' );
1476
+    public function edit_discount_template($field) {
1477
+        $restrict = $this->get_restrict_markup($field, 'discount');
1478
+        $label    = __('Discount Input Placeholder', 'invoicing');
1479
+        $label2   = __('Help Text', 'invoicing');
1480
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1481
+        $label4   = __('Button Text', 'invoicing');
1482 1482
         $id       = $field . '.id + "_edit"';
1483 1483
         $id2      = $field . '.id + "_edit2"';
1484 1484
         $id3      = $field . '.id + "_edit3"';
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
     /**
1508 1508
      * Renders the items element template.
1509 1509
      */
1510
-    public function render_items_template( $field ) {
1511
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1510
+    public function render_items_template($field) {
1511
+        $restrict = $this->get_restrict_markup($field, 'items');
1512 1512
         echo "
1513 1513
             <div $restrict class='item_totals'>
1514 1514
 
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
                 <div v-if='$field.items_type == \"select\"'>
1554 1554
 
1555 1555
                     <select class='form-control custom-select'>
1556
-                        <option value='' disabled selected='selected'>"        . __( 'Select an option', 'invoicing' ) ."</option>
1556
+                        <option value='' disabled selected='selected'>" . __('Select an option', 'invoicing') . "</option>
1557 1557
                         <option v-for='(item, index) in form_items' :value='index'>{{item.title}} &nbsp;{{formatPrice(item.price)}}</option>
1558 1558
                     </select>
1559 1559
                 </div>
@@ -1574,66 +1574,66 @@  discard block
 block discarded – undo
1574 1574
     /**
1575 1575
      * Renders the items element on the frontend.
1576 1576
      */
1577
-    public function frontend_render_items_template( $field, $items ) {
1577
+    public function frontend_render_items_template($field, $items) {
1578 1578
         
1579 1579
         echo "<div class='form-group item_totals'>";
1580 1580
         
1581
-        $id = esc_attr( $field['id'] );
1582
-        if ( 'total' == $field[ 'items_type' ] ) {
1581
+        $id = esc_attr($field['id']);
1582
+        if ('total' == $field['items_type']) {
1583 1583
             $total = 0;
1584 1584
 
1585 1585
             ?>
1586 1586
             <div class="border item_totals_type_total">
1587 1587
 
1588 1588
                 <?php
1589
-                    foreach( $items as $item ) {
1590
-                        $total = $total + floatval( $item['price'] );
1589
+                    foreach ($items as $item) {
1590
+                        $total = $total + floatval($item['price']);
1591 1591
                 ?>
1592 1592
                     <div  class="item_totals_item">
1593 1593
                         <div class='row pl-2 pr-2 pt-2'>
1594
-                            <div class='col-8'><?php echo esc_html( $item['title'] ) ?></div>
1595
-                            <div class='col-4'><?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?></div>
1594
+                            <div class='col-8'><?php echo esc_html($item['title']) ?></div>
1595
+                            <div class='col-4'><?php echo wpinv_price(wpinv_format_amount($item['price'])) ?></div>
1596 1596
                         </div>
1597
-                        <?php if ( ! empty( $item['description'] )) { ?>
1598
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1597
+                        <?php if (!empty($item['description'])) { ?>
1598
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1599 1599
                         <?php } ?>
1600 1600
                     </div>
1601 1601
                 <?php } ?>
1602 1602
 
1603 1603
                 <div class='mt-4 border-top item_totals_total'>
1604 1604
                     <div class='row p-2'>
1605
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1606
-                        <div class='col-4'><strong><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1605
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1606
+                        <div class='col-4'><strong><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1607 1607
                     </div>
1608 1608
                 </div>
1609 1609
 
1610 1610
             </div>
1611 1611
         <?php } ?>
1612 1612
 
1613
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1613
+        <?php if ('radio' == $field['items_type']) { ?>
1614 1614
             <div class="item_totals_type_radio">
1615 1615
 
1616
-                <?php foreach( $items as $index => $item ) { ?>
1616
+                <?php foreach ($items as $index => $item) { ?>
1617 1617
                     <div  class="form-check">
1618 1618
                         <input class='form-check-input' type='radio' name='<?php echo $id; ?>' id='<?php echo $id . $index; ?>'>
1619
-                        <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?>&nbsp;<strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) ); ?></strong></label>
1619
+                        <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?>&nbsp;<strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label>
1620 1620
                     </div>
1621
-                    <?php if ( ! empty( $item['description'] )) { ?>
1622
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1621
+                    <?php if (!empty($item['description'])) { ?>
1622
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1623 1623
                     <?php } ?>
1624 1624
                 <?php } ?>
1625 1625
 
1626 1626
             </div>
1627 1627
         <?php } ?>
1628 1628
 
1629
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
1629
+        <?php if ('checkbox' == $field['items_type']) { ?>
1630 1630
 
1631 1631
             <div class="item_totals_type_checkbox">
1632 1632
 
1633 1633
                 <?php
1634
-                    foreach ( $items as $index => $item ) {
1635
-                        $title = sanitize_text_field(  $item['title'] );
1636
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1634
+                    foreach ($items as $index => $item) {
1635
+                        $title = sanitize_text_field($item['title']);
1636
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1637 1637
                         echo aui()->input(
1638 1638
                             array(
1639 1639
                                 'name'       => $id,
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
                             )
1645 1645
                         );
1646 1646
 
1647
-                        if ( ! empty( $item['description'] ) ) {
1647
+                        if (!empty($item['description'])) {
1648 1648
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
1649 1649
                         }
1650 1650
                     }
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
             </div>
1654 1654
         <?php } ?>
1655 1655
 
1656
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
1656
+        <?php if ('select' == $field['items_type']) { ?>
1657 1657
 
1658 1658
             <div class="item_totals_type_select">
1659 1659
 
@@ -1661,17 +1661,17 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
                     $options = array();
1663 1663
 
1664
-                    foreach ( $items as $index => $item ) {
1665
-                        $title = sanitize_text_field(  $item['title'] );
1666
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1667
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1664
+                    foreach ($items as $index => $item) {
1665
+                        $title = sanitize_text_field($item['title']);
1666
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1667
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1668 1668
                     }
1669 1669
 
1670 1670
                     echo aui()->select(
1671 1671
                         array(
1672 1672
                                 'name'        => $id,
1673 1673
                                 'id'          => $id,
1674
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
1674
+                                'placeholder' => __('Select an item', 'invoicing'),
1675 1675
                                 'no_wrap'     => true,
1676 1676
                                 'options'     => $options,
1677 1677
                                 'class'       => 'wpi_select2'
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
             </div>
1683 1683
         <?php } ?>
1684 1684
 
1685
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
1685
+        <?php if ('multi_select' == $field['items_type']) { ?>
1686 1686
 
1687 1687
             <div class="item_totals_type_multi_select">
1688 1688
 
@@ -1690,17 +1690,17 @@  discard block
 block discarded – undo
1690 1690
 
1691 1691
                     $options = array();
1692 1692
 
1693
-                    foreach ( $items as $index => $item ) {
1694
-                        $title = sanitize_text_field(  $item['title'] );
1695
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1696
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1693
+                    foreach ($items as $index => $item) {
1694
+                        $title = sanitize_text_field($item['title']);
1695
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1696
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1697 1697
                     }
1698 1698
 
1699 1699
                     echo aui()->select(
1700 1700
                         array(
1701 1701
                                 'name'        => $id,
1702 1702
                                 'id'          => $id,
1703
-                                'placeholder' => __( 'Select one or more items', 'invoicing' ),
1703
+                                'placeholder' => __('Select one or more items', 'invoicing'),
1704 1704
                                 'no_wrap'     => true,
1705 1705
                                 'options'     => $options,
1706 1706
                                 'multiple'    => true,
@@ -1719,11 +1719,11 @@  discard block
 block discarded – undo
1719 1719
     /**
1720 1720
      * Renders the items element template.
1721 1721
      */
1722
-    public function edit_items_template( $field ) {
1723
-        $restrict = $this->get_restrict_markup( $field, 'items' );
1724
-        $label    = __( 'Let customers...', 'invoicing' );
1725
-        $label2   = __( 'Available Items', 'invoicing' );
1726
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
1722
+    public function edit_items_template($field) {
1723
+        $restrict = $this->get_restrict_markup($field, 'items');
1724
+        $label    = __('Let customers...', 'invoicing');
1725
+        $label2   = __('Available Items', 'invoicing');
1726
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
1727 1727
         $id       = $field . '.id + "_edit"';
1728 1728
         $id2      = $field . '.id + "_edit2"';
1729 1729
         $id3      = $field . '.id + "_edit3"';
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
                 <div class='form-group mt-2'>
1776 1776
 
1777 1777
                     <select class='form-control custom-select' v-model='selected_item'>
1778
-                        <option value=''>"        . __( 'Add an item to the form', 'invoicing' ) ."</option>
1778
+                        <option value=''>" . __('Add an item to the form', 'invoicing') . "</option>
1779 1779
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
1780 1780
                     </select>
1781 1781
 
@@ -1790,11 +1790,11 @@  discard block
 block discarded – undo
1790 1790
                     <label :for='$id2'>$label</label>
1791 1791
 
1792 1792
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
1793
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
1794
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
1795
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
1796
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
1797
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
1793
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
1794
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
1795
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
1796
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
1797
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
1798 1798
                     </select>
1799 1799
 
1800 1800
                 </div>
@@ -1819,24 +1819,24 @@  discard block
 block discarded – undo
1819 1819
             'orderby'        => 'title',
1820 1820
             'order'          => 'ASC',
1821 1821
             'posts_per_page' => -1,
1822
-            'post_status'    => array( 'publish' ),
1822
+            'post_status'    => array('publish'),
1823 1823
         );
1824 1824
     
1825
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
1825
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
1826 1826
 
1827
-        if ( empty( $items ) ) {
1827
+        if (empty($items)) {
1828 1828
             return array();
1829 1829
         }
1830 1830
 
1831
-        $options    = array();
1832
-        foreach ( $items as $item ) {
1833
-            $title       = esc_html( $item->post_title );
1834
-            $title      .= wpinv_get_item_suffix( $item->ID, false );
1835
-            $id          = absint( $item->ID );
1836
-            $price       = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
1837
-            $recurring   = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
1831
+        $options = array();
1832
+        foreach ($items as $item) {
1833
+            $title       = esc_html($item->post_title);
1834
+            $title      .= wpinv_get_item_suffix($item->ID, false);
1835
+            $id          = absint($item->ID);
1836
+            $price       = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
1837
+            $recurring   = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
1838 1838
             $description = $item->post_excerpt;
1839
-            $options[] = compact( 'title', 'id', 'price', 'recurring', 'description' );
1839
+            $options[] = compact('title', 'id', 'price', 'recurring', 'description');
1840 1840
 
1841 1841
         }
1842 1842
         return $options;
@@ -1846,38 +1846,38 @@  discard block
 block discarded – undo
1846 1846
     /**
1847 1847
      * Returns an array of items for the currently being edited form.
1848 1848
      */
1849
-    public function get_form_items( $id = false ) {
1849
+    public function get_form_items($id = false) {
1850 1850
         
1851
-        if ( empty( $id ) ) {
1852
-            return wpinv_get_data( 'sample-payment-form-items' );
1851
+        if (empty($id)) {
1852
+            return wpinv_get_data('sample-payment-form-items');
1853 1853
         }
1854 1854
         
1855
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
1855
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
1856 1856
 
1857
-        if ( is_array( $form_elements ) ) {
1857
+        if (is_array($form_elements)) {
1858 1858
             return $form_elements;
1859 1859
         }
1860 1860
 
1861
-        return wpinv_get_data( 'sample-payment-form-items' );
1861
+        return wpinv_get_data('sample-payment-form-items');
1862 1862
 
1863 1863
     }
1864 1864
 
1865 1865
     /**
1866 1866
      * Returns an array of elements for the currently being edited form.
1867 1867
      */
1868
-    public function get_form_elements( $id = false ) {
1868
+    public function get_form_elements($id = false) {
1869 1869
 
1870
-        if ( empty( $id ) ) {
1871
-            return wpinv_get_data( 'sample-payment-form' );
1870
+        if (empty($id)) {
1871
+            return wpinv_get_data('sample-payment-form');
1872 1872
         }
1873 1873
         
1874
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
1874
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
1875 1875
 
1876
-        if ( is_array( $form_elements ) ) {
1876
+        if (is_array($form_elements)) {
1877 1877
             return $form_elements;
1878 1878
         }
1879 1879
 
1880
-        return wpinv_get_data( 'sample-payment-form' );
1880
+        return wpinv_get_data('sample-payment-form');
1881 1881
     }
1882 1882
 
1883 1883
 }
Please login to merge, or discard this patch.