Passed
Pull Request — master (#375)
by Brian
76:01
created
includes/class-wpinv.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
         require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
162 162
 
163 163
         // Register autoloader.
164
-		try {
165
-			spl_autoload_register( array( $this, 'autoload' ), true );
166
-		} catch ( Exception $e ) {
167
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
164
+        try {
165
+            spl_autoload_register( array( $this, 'autoload' ), true );
166
+        } catch ( Exception $e ) {
167
+            wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
168 168
         }
169 169
 
170 170
         require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
189 189
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
190 190
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
191
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
192
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
193
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
194
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
195
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
191
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
192
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
193
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
194
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
195
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
196 196
         require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
197 197
         require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
198 198
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
@@ -254,47 +254,47 @@  discard block
 block discarded – undo
254 254
     }
255 255
 
256 256
     /**
257
-	 * Class autoloader
258
-	 *
259
-	 * @param       string $class_name The name of the class to load.
260
-	 * @access      public
261
-	 * @since       1.0.19
262
-	 * @return      void
263
-	 */
264
-	public function autoload( $class_name ) {
265
-
266
-		// Normalize the class name...
267
-		$class_name  = strtolower( $class_name );
268
-
269
-		// ... and make sure it is our class.
270
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
271
-			return;
272
-		}
273
-
274
-		// Next, prepare the file name from the class.
275
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
276
-
277
-		// And an array of possible locations in order of importance.
278
-		$locations = array(
279
-			'includes',
280
-			'includes/data-stores',
257
+     * Class autoloader
258
+     *
259
+     * @param       string $class_name The name of the class to load.
260
+     * @access      public
261
+     * @since       1.0.19
262
+     * @return      void
263
+     */
264
+    public function autoload( $class_name ) {
265
+
266
+        // Normalize the class name...
267
+        $class_name  = strtolower( $class_name );
268
+
269
+        // ... and make sure it is our class.
270
+        if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
271
+            return;
272
+        }
273
+
274
+        // Next, prepare the file name from the class.
275
+        $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
276
+
277
+        // And an array of possible locations in order of importance.
278
+        $locations = array(
279
+            'includes',
280
+            'includes/data-stores',
281 281
             'includes/admin',
282 282
             'includes/admin/meta-boxes'
283
-		);
283
+        );
284 284
 
285
-		// Base path of the classes.
286
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
285
+        // Base path of the classes.
286
+        $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
287 287
 
288
-		foreach ( $locations as $location ) {
288
+        foreach ( $locations as $location ) {
289 289
 
290
-			if ( file_exists( "$plugin_path/$location/$file_name" ) ) {
291
-				include "$plugin_path/$location/$file_name";
292
-				break;
293
-			}
290
+            if ( file_exists( "$plugin_path/$location/$file_name" ) ) {
291
+                include "$plugin_path/$location/$file_name";
292
+                break;
293
+            }
294 294
 
295
-		}
295
+        }
296 296
 
297
-	}
297
+    }
298 298
 
299 299
     public function init() {
300 300
     }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
385 385
             wp_enqueue_style( 'jquery-ui-css' );
386 386
             wp_deregister_style( 'yoast-seo-select2' );
387
-	        wp_deregister_style( 'yoast-seo-monorepo' );
387
+            wp_deregister_style( 'yoast-seo-monorepo' );
388 388
         }
389 389
 
390 390
         wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         if ( $page == 'wpinv-subscriptions' ) {
399 399
             wp_enqueue_script( 'jquery-ui-datepicker' );
400 400
             wp_deregister_style( 'yoast-seo-select2' );
401
-	        wp_deregister_style( 'yoast-seo-monorepo' );
401
+            wp_deregister_style( 'yoast-seo-monorepo' );
402 402
         }
403 403
         
404 404
         if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
565 565
     }
566 566
 
567
-	/**
568
-	 * Register widgets
569
-	 *
570
-	 */
571
-	public function register_widgets() {
572
-		register_widget( "WPInv_Checkout_Widget" );
573
-		register_widget( "WPInv_History_Widget" );
574
-		register_widget( "WPInv_Receipt_Widget" );
575
-		register_widget( "WPInv_Subscriptions_Widget" );
576
-		register_widget( "WPInv_Buy_Item_Widget" );
567
+    /**
568
+     * Register widgets
569
+     *
570
+     */
571
+    public function register_widgets() {
572
+        register_widget( "WPInv_Checkout_Widget" );
573
+        register_widget( "WPInv_History_Widget" );
574
+        register_widget( "WPInv_Receipt_Widget" );
575
+        register_widget( "WPInv_Subscriptions_Widget" );
576
+        register_widget( "WPInv_Buy_Item_Widget" );
577 577
         register_widget( "WPInv_Messages_Widget" );
578 578
         register_widget( 'WPInv_GetPaid_Widget' );
579
-	}
579
+    }
580 580
     
581 581
     /**
582 582
      * Remove our pages from yoast sitemaps.
Please login to merge, or discard this patch.
Spacing   +267 added lines, -267 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,35 +33,35 @@  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( 'wp_footer', array( &$this, 'wp_footer' ) );
55
-        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
56
-        add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('wp_footer', array(&$this, 'wp_footer'));
55
+        add_action('widgets_init', array(&$this, 'register_widgets'));
56
+        add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids'));
57 57
 
58
-        if ( is_admin() ) {
59
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
60
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
61
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
58
+        if (is_admin()) {
59
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
60
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
61
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
62 62
 
63 63
         } else {
64
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
64
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
65 65
         }
66 66
         
67 67
         /**
@@ -71,28 +71,28 @@  discard block
 block discarded – undo
71 71
          *
72 72
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
73 73
          */
74
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
74
+        do_action_ref_array('wpinv_actions', array(&$this));
75 75
 
76
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
76
+        add_action('admin_init', array(&$this, 'activation_redirect'));
77 77
     }
78 78
 
79 79
     /**
80 80
      * Maybe show the AyeCode Connect Notice.
81 81
      */
82
-    public function init_ayecode_connect_helper(){
82
+    public function init_ayecode_connect_helper() {
83 83
         // AyeCode Connect notice
84
-        if ( is_admin() ){
84
+        if (is_admin()) {
85 85
             // set the strings so they can be translated
86 86
             $strings = array(
87
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
88
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
89
-                '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>" ),
90
-                'connect_button'    => __("Connect Site","invoicing"),
91
-                'connecting_button'    => __("Connecting...","invoicing"),
92
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
93
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
87
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
88
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
89
+                '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>"),
90
+                'connect_button'    => __("Connect Site", "invoicing"),
91
+                'connecting_button'    => __("Connecting...", "invoicing"),
92
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
93
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
94 94
             );
95
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
95
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
96 96
         }
97 97
     }
98 98
     
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
         /* Internationalize the text strings used. */
101 101
         $this->load_textdomain();
102 102
 
103
-        do_action( 'wpinv_loaded' );
103
+        do_action('wpinv_loaded');
104 104
 
105 105
         // Fix oxygen page builder conflict
106
-        if ( function_exists( 'ct_css_output' ) ) {
106
+        if (function_exists('ct_css_output')) {
107 107
             wpinv_oxygen_fix_conflict();
108 108
         }
109 109
     }
@@ -113,144 +113,144 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @since 1.0
115 115
      */
116
-    public function load_textdomain( $locale = NULL ) {
117
-        if ( empty( $locale ) ) {
118
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
116
+    public function load_textdomain($locale = NULL) {
117
+        if (empty($locale)) {
118
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
119 119
         }
120 120
 
121
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
121
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
122 122
         
123
-        unload_textdomain( 'invoicing' );
124
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
125
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
123
+        unload_textdomain('invoicing');
124
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
125
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
126 126
         
127 127
         /**
128 128
          * Define language constants.
129 129
          */
130
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
130
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
131 131
     }
132 132
 
133 133
     public function includes() {
134 134
         global $wpinv_options;
135 135
 
136
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
136
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
137 137
         $wpinv_options = wpinv_get_settings();
138 138
 
139 139
         // Load composer packages.
140
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
140
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
141 141
 
142 142
         // load AUI
143
-        require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
143
+        require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php');
144 144
 
145 145
         // Load the action scheduler.
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
147 147
 
148 148
         // Load functions.
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
162 162
 
163 163
         // Register autoloader.
164 164
 		try {
165
-			spl_autoload_register( array( $this, 'autoload' ), true );
166
-		} catch ( Exception $e ) {
167
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
168
-        }
169
-
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
173
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
174
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
175
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
176
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
177
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
178
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
181
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
182
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
183
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
184
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
185
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
186
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
187
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
188
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
189
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
190
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
191
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
192
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
193
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
194
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
195
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
196
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
197
-        require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
198
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
199
-
200
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
201
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
165
+			spl_autoload_register(array($this, 'autoload'), true);
166
+		} catch (Exception $e) {
167
+			wpinv_error_log($e->getMessage(), '', __FILE__, 149, true);
168
+        }
169
+
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
173
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
174
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
175
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
176
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
177
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
178
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
181
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
182
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
183
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
184
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
185
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
186
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
187
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
188
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
189
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
190
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
191
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
192
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
193
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
194
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
195
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
196
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
197
+        require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php');
198
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
199
+
200
+        if (!class_exists('WPInv_EUVat')) {
201
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
202 202
         }
203 203
         
204
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
205
-        if ( !empty( $gateways ) ) {
206
-            foreach ( $gateways as $gateway ) {
207
-                if ( $gateway == 'manual' ) {
204
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
205
+        if (!empty($gateways)) {
206
+            foreach ($gateways as $gateway) {
207
+                if ($gateway == 'manual') {
208 208
                     continue;
209 209
                 }
210 210
                 
211 211
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
212 212
                 
213
-                if ( file_exists( $gateway_file ) ) {
214
-                    require_once( $gateway_file );
213
+                if (file_exists($gateway_file)) {
214
+                    require_once($gateway_file);
215 215
                 }
216 216
             }
217 217
         }
218
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
218
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
219 219
         
220
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
221
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
222
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
223
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
220
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
221
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
222
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
223
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
224 224
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
225
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
226
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
227
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
228
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
229
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
230
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
231
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
232
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
233
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
225
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
226
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
227
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
228
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
229
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
230
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
231
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
232
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
233
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php');
234 234
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
235 235
             // load the user class only on the users.php page
236 236
             global $pagenow;
237
-            if($pagenow=='users.php'){
237
+            if ($pagenow == 'users.php') {
238 238
                 new WPInv_Admin_Users();
239 239
             }
240 240
         }
241 241
 
242 242
         // Register cli commands
243
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
244
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
245
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
243
+        if (defined('WP_CLI') && WP_CLI) {
244
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
245
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
246 246
         }
247 247
         
248 248
         // include css inliner
249
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
250
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
249
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
250
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
251 251
         }
252 252
         
253
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
253
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
254 254
     }
255 255
 
256 256
     /**
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 * @since       1.0.19
262 262
 	 * @return      void
263 263
 	 */
264
-	public function autoload( $class_name ) {
264
+	public function autoload($class_name) {
265 265
 
266 266
 		// Normalize the class name...
267
-		$class_name  = strtolower( $class_name );
267
+		$class_name = strtolower($class_name);
268 268
 
269 269
 		// ... and make sure it is our class.
270
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
270
+		if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) {
271 271
 			return;
272 272
 		}
273 273
 
274 274
 		// Next, prepare the file name from the class.
275
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
275
+		$file_name = 'class-' . str_replace('_', '-', $class_name) . '.php';
276 276
 
277 277
 		// And an array of possible locations in order of importance.
278 278
 		$locations = array(
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 		);
284 284
 
285 285
 		// Base path of the classes.
286
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
286
+		$plugin_path = untrailingslashit(WPINV_PLUGIN_DIR);
287 287
 
288
-		foreach ( $locations as $location ) {
288
+		foreach ($locations as $location) {
289 289
 
290
-			if ( file_exists( "$plugin_path/$location/$file_name" ) ) {
290
+			if (file_exists("$plugin_path/$location/$file_name")) {
291 291
 				include "$plugin_path/$location/$file_name";
292 292
 				break;
293 293
 			}
@@ -301,114 +301,114 @@  discard block
 block discarded – undo
301 301
     
302 302
     public function admin_init() {
303 303
         self::$instance->default_payment_form = wpinv_get_default_payment_form();
304
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
304
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
305 305
     }
306 306
 
307 307
     public function activation_redirect() {
308 308
         // Bail if no activation redirect
309
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
309
+        if (!get_transient('_wpinv_activation_redirect')) {
310 310
             return;
311 311
         }
312 312
 
313 313
         // Delete the redirect transient
314
-        delete_transient( '_wpinv_activation_redirect' );
314
+        delete_transient('_wpinv_activation_redirect');
315 315
 
316 316
         // Bail if activating from network, or bulk
317
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
317
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
318 318
             return;
319 319
         }
320 320
 
321
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
321
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
322 322
         exit;
323 323
     }
324 324
     
325 325
     public function enqueue_scripts() {
326
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
326
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
327 327
         
328
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
329
-        wp_enqueue_style( 'wpinv_front_style' );
328
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
329
+        wp_enqueue_style('wpinv_front_style');
330 330
                
331 331
         // Register scripts
332
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
333
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) );
332
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
333
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js'));
334 334
 
335 335
         $localize                         = array();
336
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
337
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
336
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
337
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
338 338
         $localize['currency_symbol']      = wpinv_currency_symbol();
339 339
         $localize['currency_pos']         = wpinv_currency_position();
340 340
         $localize['thousand_sep']         = wpinv_thousands_separator();
341 341
         $localize['decimal_sep']          = wpinv_decimal_separator();
342 342
         $localize['decimals']             = wpinv_decimals();
343
-        $localize['txtComplete']          = __( 'Continue', 'invoicing' );
343
+        $localize['txtComplete']          = __('Continue', 'invoicing');
344 344
         $localize['UseTaxes']             = wpinv_use_taxes();
345
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
345
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
346 346
 
347
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
347
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
348 348
         
349
-        wp_enqueue_script( 'jquery-blockui' );
349
+        wp_enqueue_script('jquery-blockui');
350 350
         $autofill_api = wpinv_get_option('address_autofill_api');
351 351
         $autofill_active = wpinv_get_option('address_autofill_active');
352
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
353
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
354
-                wp_dequeue_script( 'google-maps-api' );
352
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
353
+            if (wp_script_is('google-maps-api', 'enqueued')) {
354
+                wp_dequeue_script('google-maps-api');
355 355
             }
356
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
357
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
356
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
357
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
358 358
         }
359 359
 
360
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
361
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
360
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
361
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
362 362
 
363
-        wp_enqueue_script( 'wpinv-front-script' );
364
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
363
+        wp_enqueue_script('wpinv-front-script');
364
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
365 365
 
366
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
367
-        wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ),  $version, true );
366
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
367
+        wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script', 'wp-hooks'), $version, true);
368 368
     }
369 369
 
370
-    public function admin_enqueue_scripts( $hook ) {
370
+    public function admin_enqueue_scripts($hook) {
371 371
         global $post, $pagenow;
372 372
         
373 373
         $post_type  = wpinv_admin_post_type();
374
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
375
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
374
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
375
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
376 376
 
377 377
         $jquery_ui_css = false;
378
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
378
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
379 379
             $jquery_ui_css = true;
380
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
380
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
381 381
             $jquery_ui_css = true;
382 382
         }
383
-        if ( $jquery_ui_css ) {
384
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
385
-            wp_enqueue_style( 'jquery-ui-css' );
386
-            wp_deregister_style( 'yoast-seo-select2' );
387
-	        wp_deregister_style( 'yoast-seo-monorepo' );
383
+        if ($jquery_ui_css) {
384
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
385
+            wp_enqueue_style('jquery-ui-css');
386
+            wp_deregister_style('yoast-seo-select2');
387
+	        wp_deregister_style('yoast-seo-monorepo');
388 388
         }
389 389
 
390
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
391
-        wp_enqueue_style( 'wpinv_meta_box_style' );
390
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
391
+        wp_enqueue_style('wpinv_meta_box_style');
392 392
         
393
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
394
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
395
-        wp_enqueue_style( 'wpinv_admin_style' );
393
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
394
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
395
+        wp_enqueue_style('wpinv_admin_style');
396 396
 
397
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
398
-        if ( $page == 'wpinv-subscriptions' ) {
399
-            wp_enqueue_script( 'jquery-ui-datepicker' );
400
-            wp_deregister_style( 'yoast-seo-select2' );
401
-	        wp_deregister_style( 'yoast-seo-monorepo' );
397
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
398
+        if ($page == 'wpinv-subscriptions') {
399
+            wp_enqueue_script('jquery-ui-datepicker');
400
+            wp_deregister_style('yoast-seo-select2');
401
+	        wp_deregister_style('yoast-seo-monorepo');
402 402
         }
403 403
         
404
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
405
-            wp_enqueue_script( 'jquery-ui-datepicker' );
404
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
405
+            wp_enqueue_script('jquery-ui-datepicker');
406 406
         }
407 407
 
408
-        wp_enqueue_style( 'wp-color-picker' );
409
-        wp_enqueue_script( 'wp-color-picker' );
408
+        wp_enqueue_style('wp-color-picker');
409
+        wp_enqueue_script('wp-color-picker');
410 410
         
411
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
411
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
412 412
 
413 413
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
414 414
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -419,21 +419,21 @@  discard block
 block discarded – undo
419 419
             }
420 420
         }
421 421
 
422
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
423
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
422
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
423
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
424 424
 
425
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
426
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  $version );
427
-        wp_enqueue_script( 'wpinv-admin-script' );
425
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
426
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), $version);
427
+        wp_enqueue_script('wpinv-admin-script');
428 428
         
429 429
         $localize                               = array();
430
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
431
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
432
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
433
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
434
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
435
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
436
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
430
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
431
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
432
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
433
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
434
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
435
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
436
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
437 437
         $localize['tax']                        = wpinv_tax_amount();
438 438
         $localize['discount']                   = wpinv_discount_amount();
439 439
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -441,101 +441,101 @@  discard block
 block discarded – undo
441 441
         $localize['thousand_sep']               = wpinv_thousands_separator();
442 442
         $localize['decimal_sep']                = wpinv_decimal_separator();
443 443
         $localize['decimals']                   = wpinv_decimals();
444
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
445
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
446
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
447
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
448
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
449
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
450
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
451
-        $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' );
452
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
453
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
454
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
455
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
456
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
457
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
458
-        $localize['item_description']           = __( 'Item Description', 'invoicing' );
459
-
460
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
461
-
462
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
444
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
445
+        $localize['status_publish']             = wpinv_status_nicename('publish');
446
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
447
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
448
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
449
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
450
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
451
+        $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');
452
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
453
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
454
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
455
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
456
+        $localize['action_edit']                = __('Edit', 'invoicing');
457
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
458
+        $localize['item_description']           = __('Item Description', 'invoicing');
459
+
460
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
461
+
462
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
463 463
 
464 464
         // Load payment form scripts on our admin pages only.
465
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
465
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
466 466
 
467
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
468
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
469
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
467
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
468
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
469
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
470 470
 
471
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
472
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
471
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
472
+            wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
473 473
         
474
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
474
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
475 475
                 'elements'      => $this->form_elements->get_elements(),
476
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
476
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
477 477
                 'all_items'     => $this->form_elements->get_published_items(),
478 478
                 'currency'      => wpinv_currency_symbol(),
479 479
                 'position'      => wpinv_currency_position(),
480 480
                 'decimals'      => (int) wpinv_decimals(),
481 481
                 'thousands_sep' => wpinv_thousands_separator(),
482 482
                 'decimals_sep'  => wpinv_decimal_separator(),
483
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
483
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
484 484
                 'is_default'    => $post->ID == $this->default_payment_form,
485
-            ) );
485
+            ));
486 486
 
487
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
487
+            wp_enqueue_script('wpinv-admin-payment-form-script');
488 488
         }
489 489
 
490
-        if ( $page == 'wpinv-subscriptions' ) {
491
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
492
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
490
+        if ($page == 'wpinv-subscriptions') {
491
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
492
+            wp_enqueue_script('wpinv-sub-admin-script');
493 493
         }
494 494
 
495
-        if ( $page == 'wpinv-reports' ) {
496
-            wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' );
495
+        if ($page == 'wpinv-reports') {
496
+            wp_enqueue_script('jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array('jquery'), '0.7');
497 497
         }
498 498
 
499 499
     }
500 500
 
501
-    public function admin_body_class( $classes ) {
501
+    public function admin_body_class($classes) {
502 502
         global $pagenow, $post, $current_screen;
503 503
         
504
-        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' ) ) {
504
+        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')) {
505 505
             $classes .= ' wpinv-cpt';
506 506
         }
507 507
         
508
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
508
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
509 509
 
510
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
511
-        if ( $add_class ) {
512
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
510
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
511
+        if ($add_class) {
512
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
513 513
         }
514 514
         
515 515
         $settings_class = array();
516
-        if ( $page == 'wpinv-settings' ) {
517
-            if ( !empty( $_REQUEST['tab'] ) ) {
518
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
516
+        if ($page == 'wpinv-settings') {
517
+            if (!empty($_REQUEST['tab'])) {
518
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
519 519
             }
520 520
             
521
-            if ( !empty( $_REQUEST['section'] ) ) {
522
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
521
+            if (!empty($_REQUEST['section'])) {
522
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
523 523
             }
524 524
             
525
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
525
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
526 526
         }
527 527
         
528
-        if ( !empty( $settings_class ) ) {
529
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
528
+        if (!empty($settings_class)) {
529
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
530 530
         }
531 531
         
532 532
         $post_type = wpinv_admin_post_type();
533 533
 
534
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
534
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
535 535
             return $classes .= ' wpinv';
536 536
         }
537 537
         
538
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
538
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
539 539
             $classes .= ' wpi-editable-n';
540 540
         }
541 541
 
@@ -547,21 +547,21 @@  discard block
 block discarded – undo
547 547
     }
548 548
     
549 549
     public function wpinv_actions() {
550
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
551
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
550
+        if (isset($_REQUEST['wpi_action'])) {
551
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
552 552
         }
553 553
     }
554 554
     
555
-    public function pre_get_posts( $wp_query ) {
556
-        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() ) {
557
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
555
+    public function pre_get_posts($wp_query) {
556
+        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()) {
557
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
558 558
         }
559 559
         
560 560
         return $wp_query;
561 561
     }
562 562
     
563 563
     public function bp_invoicing_init() {
564
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
564
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
565 565
     }
566 566
 
567 567
 	/**
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 */
571 571
 	public function register_widgets() {
572
-		register_widget( "WPInv_Checkout_Widget" );
573
-		register_widget( "WPInv_History_Widget" );
574
-		register_widget( "WPInv_Receipt_Widget" );
575
-		register_widget( "WPInv_Subscriptions_Widget" );
576
-		register_widget( "WPInv_Buy_Item_Widget" );
577
-        register_widget( "WPInv_Messages_Widget" );
578
-        register_widget( 'WPInv_GetPaid_Widget' );
572
+		register_widget("WPInv_Checkout_Widget");
573
+		register_widget("WPInv_History_Widget");
574
+		register_widget("WPInv_Receipt_Widget");
575
+		register_widget("WPInv_Subscriptions_Widget");
576
+		register_widget("WPInv_Buy_Item_Widget");
577
+        register_widget("WPInv_Messages_Widget");
578
+        register_widget('WPInv_GetPaid_Widget');
579 579
 	}
580 580
     
581 581
     /**
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
      * @since 1.0.19
585 585
      * @param int[] $excluded_posts_ids
586 586
      */
587
-    public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
587
+    public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) {
588 588
 
589 589
         // Ensure that we have an array.
590
-        if ( ! is_array( $excluded_posts_ids ) ) {
590
+        if (!is_array($excluded_posts_ids)) {
591 591
             $excluded_posts_ids = array();
592 592
         }
593 593
 
@@ -595,24 +595,24 @@  discard block
 block discarded – undo
595 595
         $our_pages = array();
596 596
     
597 597
         // Checkout page.
598
-        $our_pages[] = wpinv_get_option( 'checkout_page', false );
598
+        $our_pages[] = wpinv_get_option('checkout_page', false);
599 599
 
600 600
         // Success page.
601
-        $our_pages[] = wpinv_get_option( 'success_page', false );
601
+        $our_pages[] = wpinv_get_option('success_page', false);
602 602
 
603 603
         // Failure page.
604
-        $our_pages[] = wpinv_get_option( 'failure_page', false );
604
+        $our_pages[] = wpinv_get_option('failure_page', false);
605 605
 
606 606
         // History page.
607
-        $our_pages[] = wpinv_get_option( 'invoice_history_page', false );
607
+        $our_pages[] = wpinv_get_option('invoice_history_page', false);
608 608
 
609 609
         // Subscriptions page.
610
-        $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
610
+        $our_pages[] = wpinv_get_option('invoice_subscription_page', false);
611 611
 
612
-        $our_pages   = array_map( 'intval', array_filter( $our_pages ) );
612
+        $our_pages   = array_map('intval', array_filter($our_pages));
613 613
 
614 614
         $excluded_posts_ids = $excluded_posts_ids + $our_pages;
615
-        return array_unique( $excluded_posts_ids );
615
+        return array_unique($excluded_posts_ids);
616 616
 
617 617
     }
618 618
 
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +662 added lines, -662 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,23 +134,23 @@  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
                     'value'        => '',
153
-                    'label'        => __( 'Date', 'invoicing' ),
153
+                    'label'        => __('Date', 'invoicing'),
154 154
                     'description'  => '',
155 155
                     'required'     => false,
156 156
                 )
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
 
159 159
             array( 
160 160
                 'type' => 'time',
161
-                'name' => __( 'Time', 'invoicing' ),
161
+                'name' => __('Time', 'invoicing'),
162 162
                 'defaults' => array(
163 163
                     'value'        => '',
164
-                    'label'        => __( 'Time', 'invoicing' ),
164
+                    'label'        => __('Time', 'invoicing'),
165 165
                     'description'  => '',
166 166
                     'required'     => false,
167 167
                 )
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 
170 170
             array( 
171 171
                 'type' => 'number',
172
-                'name' => __( 'Number', 'invoicing' ),
172
+                'name' => __('Number', 'invoicing'),
173 173
                 'defaults' => array(
174 174
                     'placeholder'  => '',
175 175
                     'value'        => '',
176
-                    'label'        => __( 'Number', 'invoicing' ),
176
+                    'label'        => __('Number', 'invoicing'),
177 177
                     'description'  => '',
178 178
                     'required'     => false,
179 179
                 )
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
             array( 
183 183
                 'type' => 'website',
184
-                'name' => __( 'Website', 'invoicing' ),
184
+                'name' => __('Website', 'invoicing'),
185 185
                 'defaults' => array(
186 186
                     'placeholder'  => 'http://example.com',
187 187
                     'value'        => '',
188
-                    'label'        => __( 'Website', 'invoicing' ),
188
+                    'label'        => __('Website', 'invoicing'),
189 189
                     'description'  => '',
190 190
                     'required'     => false,
191 191
                 )
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 
194 194
             array( 
195 195
                 'type' => 'email',
196
-                'name' => __( 'Email', 'invoicing' ),
196
+                'name' => __('Email', 'invoicing'),
197 197
                 'defaults'  => array(
198 198
                     'placeholder'  => '[email protected]',
199 199
                     'value'        => '',
200
-                    'label'        => __( 'Email Address', 'invoicing' ),
200
+                    'label'        => __('Email Address', 'invoicing'),
201 201
                     'description'  => '',
202 202
                     'required'     => false,
203 203
                 )
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 
206 206
             array( 
207 207
                 'type' => 'address',
208
-                'name' => __( 'Address', 'invoicing' ),
208
+                'name' => __('Address', 'invoicing'),
209 209
                 'defaults'  => array(
210 210
 
211 211
                     'fields' => array(
212 212
                         array(
213 213
                             'placeholder'  => 'Jon',
214 214
                             'value'        => '',
215
-                            'label'        => __( 'First Name', 'invoicing' ),
215
+                            'label'        => __('First Name', 'invoicing'),
216 216
                             'description'  => '',
217 217
                             'required'     => false,
218 218
                             'visible'      => true,
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                         array(
223 223
                             'placeholder'  => 'Snow',
224 224
                             'value'        => '',
225
-                            'label'        => __( 'Last Name', 'invoicing' ),
225
+                            'label'        => __('Last Name', 'invoicing'),
226 226
                             'description'  => '',
227 227
                             'required'     => false,
228 228
                             'visible'      => true,
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                         array(
233 233
                             'placeholder'  => '',
234 234
                             'value'        => '',
235
-                            'label'        => __( 'Address', 'invoicing' ),
235
+                            'label'        => __('Address', 'invoicing'),
236 236
                             'description'  => '',
237 237
                             'required'     => false,
238 238
                             'visible'      => true,
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                         array(
243 243
                             'placeholder'  => '',
244 244
                             'value'        => '',
245
-                            'label'        => __( 'City', 'invoicing' ),
245
+                            'label'        => __('City', 'invoicing'),
246 246
                             'description'  => '',
247 247
                             'required'     => false,
248 248
                             'visible'      => true,
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                         ),
251 251
 
252 252
                         array(
253
-                            'placeholder'  => __( 'Select your country' ),
253
+                            'placeholder'  => __('Select your country'),
254 254
                             'value'        => '',
255
-                            'label'        => __( 'Country', 'invoicing' ),
255
+                            'label'        => __('Country', 'invoicing'),
256 256
                             'description'  => '',
257 257
                             'required'     => false,
258 258
                             'visible'      => true,
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
                         ),
261 261
 
262 262
                         array(
263
-                            'placeholder'  => __( 'Choose a state', 'invoicing' ),
263
+                            'placeholder'  => __('Choose a state', 'invoicing'),
264 264
                             'value'        => '',
265
-                            'label'        => __( 'State / Province', 'invoicing' ),
265
+                            'label'        => __('State / Province', 'invoicing'),
266 266
                             'description'  => '',
267 267
                             'required'     => false,
268 268
                             'visible'      => true,
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                         array(
273 273
                             'placeholder'  => '',
274 274
                             'value'        => '',
275
-                            'label'        => __( 'ZIP / Postcode', 'invoicing' ),
275
+                            'label'        => __('ZIP / Postcode', 'invoicing'),
276 276
                             'description'  => '',
277 277
                             'required'     => false,
278 278
                             'visible'      => true,
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                         array(
283 283
                             'placeholder'  => '',
284 284
                             'value'        => '',
285
-                            'label'        => __( 'Phone', 'invoicing' ),
285
+                            'label'        => __('Phone', 'invoicing'),
286 286
                             'description'  => '',
287 287
                             'required'     => false,
288 288
                             'visible'      => true,
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                         array(
293 293
                             'placeholder'  => '',
294 294
                             'value'        => '',
295
-                            'label'        => __( 'Company', 'invoicing' ),
295
+                            'label'        => __('Company', 'invoicing'),
296 296
                             'description'  => '',
297 297
                             'required'     => false,
298 298
                             'visible'      => false,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                         array(
303 303
                             'placeholder'  => '',
304 304
                             'value'        => '',
305
-                            'label'        => __( 'VAT Number', 'invoicing' ),
305
+                            'label'        => __('VAT Number', 'invoicing'),
306 306
                             'description'  => '',
307 307
                             'required'     => false,
308 308
                             'visible'      => false,
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 
315 315
             array( 
316 316
                 'type' => 'billing_email',
317
-                'name' => __( 'Billing Email', 'invoicing' ),
317
+                'name' => __('Billing Email', 'invoicing'),
318 318
                 'defaults'  => array(
319 319
                     'placeholder'  => '[email protected]',
320 320
                     'value'        => '',
321
-                    'label'        => __( 'Billing Email', 'invoicing' ),
321
+                    'label'        => __('Billing Email', 'invoicing'),
322 322
                     'description'  => '',
323 323
                     'premade'      => true,
324 324
                 )
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
 
327 327
             array( 
328 328
                 'type' => 'discount',
329
-                'name' => __( 'Discount Input', 'invoicing' ),
329
+                'name' => __('Discount Input', 'invoicing'),
330 330
                 'defaults'  => array(
331 331
                     'value'        => '',
332
-                    'input_label'  => __( 'Coupon Code', 'invoicing' ),
333
-                    'button_label' => __( 'Apply Coupon', 'invoicing' ),
334
-                    'description'  => __( 'Have a discount code? Enter it above.', 'invoicing' ),
332
+                    'input_label'  => __('Coupon Code', 'invoicing'),
333
+                    'button_label' => __('Apply Coupon', 'invoicing'),
334
+                    'description'  => __('Have a discount code? Enter it above.', 'invoicing'),
335 335
                 )
336 336
             ),
337 337
 
338 338
             array( 
339 339
                 'type' => 'items',
340
-                'name' => __( 'Items', 'invoicing' ),
340
+                'name' => __('Items', 'invoicing'),
341 341
                 'defaults'  => array(
342 342
                     'value'        => '',
343 343
                     'items_type'   => 'total',
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 
349 349
             array(
350 350
                 'type' => 'terms',
351
-                'name' => __( 'Terms', 'invoicing' ),
351
+                'name' => __('Terms', 'invoicing'),
352 352
                 'defaults'         => array(
353 353
                     'value'        => '',
354
-                    'text'         => __( 'I\'ve read and accept the <a href="" target="_blank">terms &amp; conditions</a>', 'invoicing' ),
354
+                    'text'         => __('I\'ve read and accept the <a href="" target="_blank">terms &amp; conditions</a>', 'invoicing'),
355 355
                     'description'  => '',
356 356
                     'required'     => true,
357 357
                 )
@@ -359,34 +359,34 @@  discard block
 block discarded – undo
359 359
 
360 360
             array(
361 361
                 'type' => 'privacy',
362
-                'name' => __( 'Privacy', 'invoicing' ),
362
+                'name' => __('Privacy', 'invoicing'),
363 363
                 'defaults'         => array(
364 364
                     'value'        => '',
365
-                    'text'         => __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our privacy policy.', 'invoicing' ),
365
+                    'text'         => __('Your personal data will be used to process your invoice, payment and for other purposes described in our privacy policy.', 'invoicing'),
366 366
                 )
367 367
             ),
368 368
 
369 369
             array( 
370 370
                 'type'       => 'pay_button',
371
-                'name'       => __( 'Payment Button', 'invoicing' ),
371
+                'name'       => __('Payment Button', 'invoicing'),
372 372
                 'defaults'   => array(
373 373
                     'value'        => '',
374 374
                     'class'        => 'btn-primary',
375
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
376
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
375
+                    'label'        => __('Pay Now »', 'invoicing'),
376
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
377 377
                     'premade'      => true,
378 378
                 )
379 379
             )
380 380
         );
381 381
 
382
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
382
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
383 383
         return $this->elements;
384 384
     }
385 385
 
386 386
     /**
387 387
      * Returns the restrict markup.
388 388
      */
389
-    public function get_restrict_markup( $field, $field_type ) {
389
+    public function get_restrict_markup($field, $field_type) {
390 390
         $restrict = "$field.type=='$field_type'";
391 391
         return "v-if=\"$restrict\"";
392 392
     }
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
     /**
395 395
      * Renders the title element template.
396 396
      */
397
-    public function render_heading_template( $field ) {
398
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
397
+    public function render_heading_template($field) {
398
+        $restrict = $this->get_restrict_markup($field, 'heading');
399 399
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
400 400
     }
401 401
 
402 402
     /**
403 403
      * Renders the title element on the frontend.
404 404
      */
405
-    public function frontend_render_heading_template( $field ) {
405
+    public function frontend_render_heading_template($field) {
406 406
         $tag = $field['level'];
407 407
         echo "<$tag>{$field['text']}</$tag>";
408 408
     }
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
     /**
411 411
      * Renders the edit title element template.
412 412
      */
413
-    public function edit_heading_template( $field ) {
414
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
415
-        $label    = __( 'Heading', 'invoicing' );
416
-        $label2   = __( 'Select Heading Level', 'invoicing' );
413
+    public function edit_heading_template($field) {
414
+        $restrict = $this->get_restrict_markup($field, 'heading');
415
+        $label    = __('Heading', 'invoicing');
416
+        $label2   = __('Select Heading Level', 'invoicing');
417 417
         $id       = $field . '.id + "_edit"';
418 418
         $id2      = $field . '.id + "_edit2"';
419 419
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
     /**
446 446
      * Renders a paragraph element template.
447 447
      */
448
-    public function render_paragraph_template( $field ) {
449
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
448
+    public function render_paragraph_template($field) {
449
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
450 450
         $label    = "$field.text";
451 451
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
452 452
     }
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
     /**
455 455
      * Renders a privacy element template.
456 456
      */
457
-    public function render_privacy_template( $field ) {
458
-        $restrict = $this->get_restrict_markup( $field, 'privacy' );
457
+    public function render_privacy_template($field) {
458
+        $restrict = $this->get_restrict_markup($field, 'privacy');
459 459
         $label    = "$field.text";
460 460
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
461 461
     }
@@ -463,23 +463,23 @@  discard block
 block discarded – undo
463 463
     /**
464 464
      * Renders the paragraph element on the frontend.
465 465
      */
466
-    public function frontend_render_paragraph_template( $field ) {
466
+    public function frontend_render_paragraph_template($field) {
467 467
         echo "<p>{$field['text']}</p>";
468 468
     }
469 469
 
470 470
     /**
471 471
      * Renders the privacy element on the frontend.
472 472
      */
473
-    public function frontend_render_privacy_template( $field ) {
473
+    public function frontend_render_privacy_template($field) {
474 474
         echo "<p>{$field['text']}</p>";
475 475
     }
476 476
 
477 477
     /**
478 478
      * Renders the edit paragraph element template.
479 479
      */
480
-    public function edit_paragraph_template( $field ) {
481
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
482
-        $label    = __( 'Enter your text', 'invoicing' );
480
+    public function edit_paragraph_template($field) {
481
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
482
+        $label    = __('Enter your text', 'invoicing');
483 483
         $id       = $field . '.id + "_edit"';
484 484
         echo "
485 485
             <div $restrict>
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
     /**
496 496
      * Renders the edit privacy element template.
497 497
      */
498
-    public function edit_privacy_template( $field ) {
499
-        $restrict = $this->get_restrict_markup( $field, 'privacy' );
500
-        $label    = __( 'Privacy Text', 'invoicing' );
498
+    public function edit_privacy_template($field) {
499
+        $restrict = $this->get_restrict_markup($field, 'privacy');
500
+        $label    = __('Privacy Text', 'invoicing');
501 501
         $id       = $field . '.id + "_edit"';
502 502
         echo "
503 503
             <div $restrict>
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
     /**
514 514
      * Renders the text element template.
515 515
      */
516
-    public function render_text_template( $field ) {
517
-        $restrict = $this->get_restrict_markup( $field, 'text' );
516
+    public function render_text_template($field) {
517
+        $restrict = $this->get_restrict_markup($field, 'text');
518 518
         $label    = "$field.label";
519 519
         echo "
520 520
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
     /**
530 530
      * Renders the text element on the frontend.
531 531
      */
532
-    public function frontend_render_text_template( $field ) {
532
+    public function frontend_render_text_template($field) {
533 533
         
534 534
         echo "<div class='form-group'>";
535 535
 
536 536
         echo aui()->input(
537 537
             array(
538
-                'name'       => esc_attr( $field['id'] ),
539
-                'id'         => esc_attr( $field['id'] ),
540
-                'placeholder'=> esc_attr( $field['placeholder'] ),
538
+                'name'       => esc_attr($field['id']),
539
+                'id'         => esc_attr($field['id']),
540
+                'placeholder'=> esc_attr($field['placeholder']),
541 541
                 'required'   => (bool) $field['required'],
542
-                'label'      => wp_kses_post( $field['label'] ),
542
+                'label'      => wp_kses_post($field['label']),
543 543
                 'no_wrap'    => true,
544 544
             )
545 545
         );
546 546
 
547
-        if ( ! empty( $field['description'] ) ) {
548
-            $description = wp_kses_post( $field['description'] );
547
+        if (!empty($field['description'])) {
548
+            $description = wp_kses_post($field['description']);
549 549
             echo "<small class='form-text text-muted'>$description</small>";
550 550
         }
551 551
 
@@ -556,16 +556,16 @@  discard block
 block discarded – undo
556 556
     /**
557 557
      * Renders the edit text element template.
558 558
      */
559
-    public function edit_text_template( $field ) {
560
-        $restrict = $this->get_restrict_markup( $field, 'text' );
561
-        $label    = __( 'Field Label', 'invoicing' );
559
+    public function edit_text_template($field) {
560
+        $restrict = $this->get_restrict_markup($field, 'text');
561
+        $label    = __('Field Label', 'invoicing');
562 562
         $id       = $field . '.id + "_edit"';
563
-        $label2   = __( 'Placeholder text', 'invoicing' );
563
+        $label2   = __('Placeholder text', 'invoicing');
564 564
         $id2      = $field . '.id + "_edit2"';
565
-        $label3   = __( 'Help text', 'invoicing' );
566
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
565
+        $label3   = __('Help text', 'invoicing');
566
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
567 567
         $id3      = $field . '.id + "_edit3"';
568
-        $label5   = __( 'Is this field required?', 'invoicing' );
568
+        $label5   = __('Is this field required?', 'invoicing');
569 569
         $id4      = $field . '.id + "_edit4"';
570 570
         echo "
571 571
             <div $restrict>
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
     /**
594 594
      * Renders the textarea element template.
595 595
      */
596
-    public function render_textarea_template( $field ) {
597
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
596
+    public function render_textarea_template($field) {
597
+        $restrict = $this->get_restrict_markup($field, 'textarea');
598 598
         $label    = "$field.label";
599 599
         echo "
600 600
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -609,24 +609,24 @@  discard block
 block discarded – undo
609 609
     /**
610 610
      * Renders the textarea element on the frontend.
611 611
      */
612
-    public function frontend_render_textarea_template( $field ) {
612
+    public function frontend_render_textarea_template($field) {
613 613
         
614 614
         echo "<div class='form-group'>";
615 615
 
616 616
         echo aui()->textarea(
617 617
             array(
618
-                'name'       => esc_attr( $field['id'] ),
619
-                'id'         => esc_attr( $field['id'] ),
620
-                'placeholder'=> esc_attr( $field['placeholder'] ),
618
+                'name'       => esc_attr($field['id']),
619
+                'id'         => esc_attr($field['id']),
620
+                'placeholder'=> esc_attr($field['placeholder']),
621 621
                 'required'   => (bool) $field['required'],
622
-                'label'      => wp_kses_post( $field['label'] ),
622
+                'label'      => wp_kses_post($field['label']),
623 623
                 'no_wrap'    => true,
624 624
                 'rows'       => 3,
625 625
             )
626 626
         );
627 627
 
628
-        if ( ! empty( $field['description'] ) ) {
629
-            $description = wp_kses_post( $field['description'] );
628
+        if (!empty($field['description'])) {
629
+            $description = wp_kses_post($field['description']);
630 630
             echo "<small class='form-text text-muted'>$description</small>";
631 631
         }
632 632
 
@@ -637,16 +637,16 @@  discard block
 block discarded – undo
637 637
     /**
638 638
      * Renders the edit textarea element template.
639 639
      */
640
-    public function edit_textarea_template( $field ) {
641
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
642
-        $label    = __( 'Field Label', 'invoicing' );
640
+    public function edit_textarea_template($field) {
641
+        $restrict = $this->get_restrict_markup($field, 'textarea');
642
+        $label    = __('Field Label', 'invoicing');
643 643
         $id       = $field . '.id + "_edit"';
644
-        $label2   = __( 'Placeholder text', 'invoicing' );
644
+        $label2   = __('Placeholder text', 'invoicing');
645 645
         $id2      = $field . '.id + "_edit2"';
646
-        $label3   = __( 'Help text', 'invoicing' );
647
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
646
+        $label3   = __('Help text', 'invoicing');
647
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
648 648
         $id3      = $field . '.id + "_edit3"';
649
-        $label5   = __( 'Is this field required?', 'invoicing' );
649
+        $label5   = __('Is this field required?', 'invoicing');
650 650
         $id4      = $field . '.id + "_edit4"';
651 651
         echo "
652 652
             <div $restrict>
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
     /**
675 675
      * Renders the select element template.
676 676
      */
677
-    public function render_select_template( $field ) {
678
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
677
+    public function render_select_template($field) {
678
+        $restrict    = $this->get_restrict_markup($field, 'select');
679 679
         $label       = "$field.label";
680 680
         $placeholder = "$field.placeholder";
681 681
         $id          = $field . '.id';
@@ -695,24 +695,24 @@  discard block
 block discarded – undo
695 695
     /**
696 696
      * Renders the select element on the frontend.
697 697
      */
698
-    public function frontend_render_select_template( $field ) {
698
+    public function frontend_render_select_template($field) {
699 699
         
700 700
         echo "<div class='form-group'>";
701 701
 
702 702
         echo aui()->select(
703 703
             array(
704
-                'name'       => esc_attr( $field['id'] ),
705
-                'id'         => esc_attr( $field['id'] ),
706
-                'placeholder'=> esc_attr( $field['placeholder'] ),
704
+                'name'       => esc_attr($field['id']),
705
+                'id'         => esc_attr($field['id']),
706
+                'placeholder'=> esc_attr($field['placeholder']),
707 707
                 'required'   => (bool) $field['required'],
708
-                'label'      => wp_kses_post( $field['label'] ),
708
+                'label'      => wp_kses_post($field['label']),
709 709
                 'no_wrap'    => true,
710
-                'options'    => array_combine( $field['options'], $field['options'] ),
710
+                'options'    => array_combine($field['options'], $field['options']),
711 711
             )
712 712
         );
713 713
 
714
-        if ( ! empty( $field['description'] ) ) {
715
-            $description = wp_kses_post( $field['description'] );
714
+        if (!empty($field['description'])) {
715
+            $description = wp_kses_post($field['description']);
716 716
             echo "<small class='form-text text-muted'>$description</small>";
717 717
         }
718 718
 
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
     /**
724 724
      * Renders the edit select element template.
725 725
      */
726
-    public function edit_select_template( $field ) {
727
-        $restrict = $this->get_restrict_markup( $field, 'select' );
728
-        $label    = __( 'Field Label', 'invoicing' );
726
+    public function edit_select_template($field) {
727
+        $restrict = $this->get_restrict_markup($field, 'select');
728
+        $label    = __('Field Label', 'invoicing');
729 729
         $id       = $field . '.id + "_edit"';
730
-        $label2   = __( 'Placeholder text', 'invoicing' );
730
+        $label2   = __('Placeholder text', 'invoicing');
731 731
         $id2      = $field . '.id + "_edit2"';
732
-        $label3   = __( 'Help text', 'invoicing' );
733
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
732
+        $label3   = __('Help text', 'invoicing');
733
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
734 734
         $id3      = $field . '.id + "_edit3"';
735
-        $label5   = __( 'Is this field required?', 'invoicing' );
735
+        $label5   = __('Is this field required?', 'invoicing');
736 736
         $id4      = $field . '.id + "_edit4"';
737
-        $label6   = __( 'Available Options', 'invoicing' );
737
+        $label6   = __('Available Options', 'invoicing');
738 738
         echo "
739 739
             <div $restrict>
740 740
                 <div class='form-group'>
@@ -772,8 +772,8 @@  discard block
 block discarded – undo
772 772
     /**
773 773
      * Renders the checkbox element template.
774 774
      */
775
-    public function render_checkbox_template( $field ) {
776
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
775
+    public function render_checkbox_template($field) {
776
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
777 777
         echo "
778 778
             <div class='form-check' $restrict>
779 779
                 <div class='wpinv-payment-form-field-preview-overlay'></div>
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
     /**
788 788
      * Renders the terms element template.
789 789
      */
790
-    public function render_terms_template( $field ) {
791
-        $restrict = $this->get_restrict_markup( $field, 'terms' );
790
+    public function render_terms_template($field) {
791
+        $restrict = $this->get_restrict_markup($field, 'terms');
792 792
         echo "
793 793
             <div class='form-check' $restrict>
794 794
                 <div class='wpinv-payment-form-field-preview-overlay'></div>
@@ -802,24 +802,24 @@  discard block
 block discarded – undo
802 802
     /**
803 803
      * Renders the checkbox element on the frontend.
804 804
      */
805
-    public function frontend_render_checkbox_template( $field ) {
805
+    public function frontend_render_checkbox_template($field) {
806 806
         
807 807
         echo "<div class='form-group'>";
808 808
 
809 809
         echo aui()->input(
810 810
             array(
811
-                'name'       => esc_attr( $field['id'] ),
812
-                'id'         => esc_attr( $field['id'] ),
811
+                'name'       => esc_attr($field['id']),
812
+                'id'         => esc_attr($field['id']),
813 813
                 'required'   => (bool) $field['required'],
814
-                'label'      => wp_kses_post( $field['label'] ),
814
+                'label'      => wp_kses_post($field['label']),
815 815
                 'no_wrap'    => true,
816
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
816
+                'value'      => esc_attr__('Yes', 'invoicing'),
817 817
                 'type'       => 'checkbox',
818 818
             )
819 819
         );
820 820
 
821
-        if ( ! empty( $field['description'] ) ) {
822
-            $description = wp_kses_post( $field['description'] );
821
+        if (!empty($field['description'])) {
822
+            $description = wp_kses_post($field['description']);
823 823
             echo "<small class='form-text text-muted'>$description</small>";
824 824
         }
825 825
 
@@ -830,24 +830,24 @@  discard block
 block discarded – undo
830 830
         /**
831 831
      * Renders the terms element on the frontend.
832 832
      */
833
-    public function frontend_render_terms_template( $field ) {
833
+    public function frontend_render_terms_template($field) {
834 834
         
835 835
         echo "<div class='form-group'>";
836 836
 
837 837
         echo aui()->input(
838 838
             array(
839
-                'name'       => esc_attr( $field['id'] ),
840
-                'id'         => esc_attr( $field['id'] ),
839
+                'name'       => esc_attr($field['id']),
840
+                'id'         => esc_attr($field['id']),
841 841
                 'required'   => (bool) $field['required'],
842
-                'label'      => wp_kses_post( $field['text'] ),
842
+                'label'      => wp_kses_post($field['text']),
843 843
                 'no_wrap'    => true,
844
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
844
+                'value'      => esc_attr__('Yes', 'invoicing'),
845 845
                 'type'       => 'checkbox',
846 846
             )
847 847
         );
848 848
 
849
-        if ( ! empty( $field['description'] ) ) {
850
-            $description = wp_kses_post( $field['description'] );
849
+        if (!empty($field['description'])) {
850
+            $description = wp_kses_post($field['description']);
851 851
             echo "<small class='form-text text-muted'>$description</small>";
852 852
         }
853 853
 
@@ -858,14 +858,14 @@  discard block
 block discarded – undo
858 858
     /**
859 859
      * Renders the edit checkbox element template.
860 860
      */
861
-    public function edit_checkbox_template( $field ) {
862
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
863
-        $label    = __( 'Field Label', 'invoicing' );
861
+    public function edit_checkbox_template($field) {
862
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
863
+        $label    = __('Field Label', 'invoicing');
864 864
         $id       = $field . '.id + "_edit"';
865
-        $label2   = __( 'Help text', 'invoicing' );
866
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
865
+        $label2   = __('Help text', 'invoicing');
866
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
867 867
         $id2      = $field . '.id + "_edit2"';
868
-        $label4   = __( 'Is this field required?', 'invoicing' );
868
+        $label4   = __('Is this field required?', 'invoicing');
869 869
         $id3      = $field . '.id + "_edit3"';
870 870
         echo "
871 871
             <div $restrict>
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
     /**
890 890
      * Renders the edit terms element template.
891 891
      */
892
-    public function edit_terms_template( $field ) {
893
-        $restrict = $this->get_restrict_markup( $field, 'terms' );
894
-        $label    = __( 'Field Label', 'invoicing' );
892
+    public function edit_terms_template($field) {
893
+        $restrict = $this->get_restrict_markup($field, 'terms');
894
+        $label    = __('Field Label', 'invoicing');
895 895
         $id       = $field . '.id + "_edit"';
896
-        $label2   = __( 'Help text', 'invoicing' );
897
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
896
+        $label2   = __('Help text', 'invoicing');
897
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
898 898
         $id2      = $field . '.id + "_edit2"';
899
-        $label4   = __( 'Is this field required?', 'invoicing' );
899
+        $label4   = __('Is this field required?', 'invoicing');
900 900
         $id3      = $field . '.id + "_edit3"';
901 901
         echo "
902 902
             <div $restrict>
@@ -920,8 +920,8 @@  discard block
 block discarded – undo
920 920
     /**
921 921
      * Renders the radio element template.
922 922
      */
923
-    public function render_radio_template( $field ) {
924
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
923
+    public function render_radio_template($field) {
924
+        $restrict    = $this->get_restrict_markup($field, 'radio');
925 925
         $label       = "$field.label";
926 926
         $id          = $field . '.id';
927 927
         echo "
@@ -940,20 +940,20 @@  discard block
 block discarded – undo
940 940
     /**
941 941
      * Renders the radio element on the frontend.
942 942
      */
943
-    public function frontend_render_radio_template( $field ) {
943
+    public function frontend_render_radio_template($field) {
944 944
         
945 945
         echo "<div class='form-group'>";
946 946
 
947
-        if ( ! empty( $field['label'] ) ) {
948
-            $label = wp_kses_post( $field['label'] );
947
+        if (!empty($field['label'])) {
948
+            $label = wp_kses_post($field['label']);
949 949
             echo "<legend class='col-form-label'>$label</legend>";
950 950
         }
951 951
 
952
-        foreach( $field['options'] as $index => $option ) {
952
+        foreach ($field['options'] as $index => $option) {
953 953
             $id    = $field['id'] . $index;
954 954
             $name  = $field['id'];
955
-            $value = esc_attr( $option );
956
-            $label = wp_kses_post( $option );
955
+            $value = esc_attr($option);
956
+            $label = wp_kses_post($option);
957 957
 
958 958
             echo "
959 959
                 <div class='form-check'>
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
             ";
964 964
         }
965 965
 
966
-        if ( ! empty( $field['description'] ) ) {
967
-            $description = wp_kses_post( $field['description'] );
966
+        if (!empty($field['description'])) {
967
+            $description = wp_kses_post($field['description']);
968 968
             echo "<small class='form-text text-muted'>$description</small>";
969 969
         }
970 970
 
@@ -975,16 +975,16 @@  discard block
 block discarded – undo
975 975
     /**
976 976
      * Renders the edit radio element template.
977 977
      */
978
-    public function edit_radio_template( $field ) {
979
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
980
-        $label    = __( 'Field Label', 'invoicing' );
978
+    public function edit_radio_template($field) {
979
+        $restrict = $this->get_restrict_markup($field, 'radio');
980
+        $label    = __('Field Label', 'invoicing');
981 981
         $id       = $field . '.id + "_edit"';
982
-        $label2   = __( 'Help text', 'invoicing' );
983
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
982
+        $label2   = __('Help text', 'invoicing');
983
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
984 984
         $id2      = $field . '.id + "_edit3"';
985
-        $label4   = __( 'Is this field required?', 'invoicing' );
985
+        $label4   = __('Is this field required?', 'invoicing');
986 986
         $id3      = $field . '.id + "_edit4"';
987
-        $label5   = __( 'Available Options', 'invoicing' );
987
+        $label5   = __('Available Options', 'invoicing');
988 988
         echo "
989 989
             <div $restrict>
990 990
                 <div class='form-group'>
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
     /**
1019 1019
      * Renders the address element template.
1020 1020
      */
1021
-    public function render_address_template( $field ) {
1022
-        $restrict    = $this->get_restrict_markup( $field, 'address' );
1021
+    public function render_address_template($field) {
1022
+        $restrict = $this->get_restrict_markup($field, 'address');
1023 1023
 
1024 1024
         echo "
1025 1025
             <div class='wpinv-address-wrapper' $restrict>
@@ -1041,75 +1041,75 @@  discard block
 block discarded – undo
1041 1041
     /**
1042 1042
      * Renders the address element on the frontend.
1043 1043
      */
1044
-    public function frontend_render_address_template( $field ) {
1044
+    public function frontend_render_address_template($field) {
1045 1045
         
1046 1046
         echo "<div class='wpinv-address-fields'>";
1047 1047
 
1048 1048
         $country = '';
1049
-        if ( is_user_logged_in() ) {
1050
-            $user  = wp_get_current_user();
1051
-            $country = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_country', true ) );
1049
+        if (is_user_logged_in()) {
1050
+            $user = wp_get_current_user();
1051
+            $country = sanitize_text_field(get_user_meta($user->ID, '_wpinv_country', true));
1052 1052
         }
1053 1053
 
1054
-        if ( empty( $country ) ) {
1054
+        if (empty($country)) {
1055 1055
             $country = wpinv_get_default_country();
1056 1056
         }
1057 1057
 
1058
-        foreach( $field['fields'] as $address_field ) {
1058
+        foreach ($field['fields'] as $address_field) {
1059 1059
 
1060
-            if ( empty( $address_field['visible'] ) ) {
1060
+            if (empty($address_field['visible'])) {
1061 1061
                 continue;
1062 1062
             }
1063 1063
 
1064
-            $class = esc_attr( $address_field['name'] );
1064
+            $class = esc_attr($address_field['name']);
1065 1065
             echo "<div class='form-group $class'>";
1066 1066
 
1067 1067
             $label = $address_field['label'];
1068 1068
 
1069
-            if ( ! empty( $address_field['required'] ) ) {
1069
+            if (!empty($address_field['required'])) {
1070 1070
                 $label .= "<span class='text-danger'> *</span>";
1071 1071
             }
1072 1072
 
1073 1073
             // Default value.
1074 1074
             $value     = '';
1075
-            if ( is_user_logged_in() ) {
1075
+            if (is_user_logged_in()) {
1076 1076
                 $user  = wp_get_current_user();
1077
-                $value = sanitize_text_field( get_user_meta( $user->ID, '_' . $address_field['name'], true ) );
1077
+                $value = sanitize_text_field(get_user_meta($user->ID, '_' . $address_field['name'], true));
1078 1078
             }
1079 1079
 
1080
-            if ( 'wpinv_country' == $address_field['name'] ) {
1080
+            if ('wpinv_country' == $address_field['name']) {
1081 1081
 
1082
-                echo aui()->select( array(
1082
+                echo aui()->select(array(
1083 1083
                     'options'          => wpinv_get_country_list(),
1084
-                    'name'             => esc_attr( $address_field['name'] ),
1085
-                    'id'               => esc_attr( $address_field['name'] ),
1084
+                    'name'             => esc_attr($address_field['name']),
1085
+                    'id'               => esc_attr($address_field['name']),
1086 1086
                     'value'            => $country,
1087
-                    'placeholder'      => esc_attr( $address_field['placeholder'] ),
1087
+                    'placeholder'      => esc_attr($address_field['placeholder']),
1088 1088
                     'required'         => (bool) $address_field['required'],
1089 1089
                     'no_wrap'          => true,
1090
-                    'label'            => wp_kses_post( $label ),
1090
+                    'label'            => wp_kses_post($label),
1091 1091
                     'select2'          => false,
1092 1092
                 ));
1093 1093
     
1094
-            } else if ( 'wpinv_state' == $address_field['name'] ) {
1094
+            } else if ('wpinv_state' == $address_field['name']) {
1095 1095
 
1096
-                $states = wpinv_get_country_states( $country );
1096
+                $states = wpinv_get_country_states($country);
1097 1097
 
1098
-                if ( empty( $value ) ) {
1098
+                if (empty($value)) {
1099 1099
                     $value = wpinv_get_default_state();
1100 1100
                 }
1101 1101
 
1102
-                if ( ! empty( $states ) ) {
1102
+                if (!empty($states)) {
1103 1103
 
1104
-                    echo aui()->select( array(
1104
+                    echo aui()->select(array(
1105 1105
                         'options'          => $states,
1106
-                        'name'             => esc_attr( $address_field['name'] ),
1107
-                        'id'               => esc_attr( $address_field['name'] ),
1106
+                        'name'             => esc_attr($address_field['name']),
1107
+                        'id'               => esc_attr($address_field['name']),
1108 1108
                         'value'            => $value,
1109
-                        'placeholder'      => esc_attr( $address_field['placeholder'] ),
1109
+                        'placeholder'      => esc_attr($address_field['placeholder']),
1110 1110
                         'required'         => (bool) $address_field['required'],
1111 1111
                         'no_wrap'          => true,
1112
-                        'label'            => wp_kses_post( $label ),
1112
+                        'label'            => wp_kses_post($label),
1113 1113
                         'select2'          => false,
1114 1114
                     ));
1115 1115
 
@@ -1117,10 +1117,10 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
                     echo aui()->input(
1119 1119
                         array(
1120
-                            'name'       => esc_attr( $address_field['name'] ),
1121
-                            'id'         => esc_attr( $address_field['name'] ),
1120
+                            'name'       => esc_attr($address_field['name']),
1121
+                            'id'         => esc_attr($address_field['name']),
1122 1122
                             'required'   => (bool) $address_field['required'],
1123
-                            'label'      => wp_kses_post( $label ),
1123
+                            'label'      => wp_kses_post($label),
1124 1124
                             'no_wrap'    => true,
1125 1125
                             'type'       => 'text',
1126 1126
                             'value'      => $value,
@@ -1133,12 +1133,12 @@  discard block
 block discarded – undo
1133 1133
 
1134 1134
                 echo aui()->input(
1135 1135
                     array(
1136
-                        'name'       => esc_attr( $address_field['name'] ),
1137
-                        'id'         => esc_attr( $address_field['name'] ),
1136
+                        'name'       => esc_attr($address_field['name']),
1137
+                        'id'         => esc_attr($address_field['name']),
1138 1138
                         'required'   => (bool) $address_field['required'],
1139
-                        'label'      => wp_kses_post( $label ),
1139
+                        'label'      => wp_kses_post($label),
1140 1140
                         'no_wrap'    => true,
1141
-                        'placeholder' => esc_attr( $address_field['placeholder'] ),
1141
+                        'placeholder' => esc_attr($address_field['placeholder']),
1142 1142
                         'type'       => 'text',
1143 1143
                         'value'      => $value,
1144 1144
                     )
@@ -1147,8 +1147,8 @@  discard block
 block discarded – undo
1147 1147
             }
1148 1148
             
1149 1149
 
1150
-            if ( ! empty( $address_field['description'] ) ) {
1151
-                $description = wp_kses_post( $address_field['description'] );
1150
+            if (!empty($address_field['description'])) {
1151
+                $description = wp_kses_post($address_field['description']);
1152 1152
                 echo "<small class='form-text text-muted'>$description</small>";
1153 1153
             }
1154 1154
     
@@ -1163,13 +1163,13 @@  discard block
 block discarded – undo
1163 1163
     /**
1164 1164
      * Renders the edit address element template.
1165 1165
      */
1166
-    public function edit_address_template( $field ) {
1167
-        $restrict  = $this->get_restrict_markup( $field, 'address' );
1168
-        $label     = __( 'Field Label', 'invoicing' );
1169
-        $label2    = __( 'Placeholder', 'invoicing' );
1170
-        $label3    = __( 'Description', 'invoicing' );
1171
-        $label4    = __( 'Is required', 'invoicing' );
1172
-        $label5    = __( 'Is visible', 'invoicing' );
1166
+    public function edit_address_template($field) {
1167
+        $restrict  = $this->get_restrict_markup($field, 'address');
1168
+        $label     = __('Field Label', 'invoicing');
1169
+        $label2    = __('Placeholder', 'invoicing');
1170
+        $label3    = __('Description', 'invoicing');
1171
+        $label4    = __('Is required', 'invoicing');
1172
+        $label5    = __('Is visible', 'invoicing');
1173 1173
         $id        = $field . '.id + "_edit_label"';
1174 1174
         $id2       = $field . '.id + "_edit_placeholder"';
1175 1175
         $id3       = $field . '.id + "_edit_description"';
@@ -1237,8 +1237,8 @@  discard block
 block discarded – undo
1237 1237
     /**
1238 1238
      * Renders the email element template.
1239 1239
      */
1240
-    public function render_email_template( $field ) {
1241
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1240
+    public function render_email_template($field) {
1241
+        $restrict = $this->get_restrict_markup($field, 'email');
1242 1242
         $label    = "$field.label";
1243 1243
         echo "
1244 1244
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
     /**
1254 1254
      * Renders the billing_email element template.
1255 1255
      */
1256
-    public function render_billing_email_template( $field ) {
1257
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1256
+    public function render_billing_email_template($field) {
1257
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1258 1258
         $label    = "$field.label";
1259 1259
         echo "
1260 1260
             <div $restrict>
@@ -1268,24 +1268,24 @@  discard block
 block discarded – undo
1268 1268
     /**
1269 1269
      * Renders the email element on the frontend.
1270 1270
      */
1271
-    public function frontend_render_email_template( $field ) {
1271
+    public function frontend_render_email_template($field) {
1272 1272
         
1273 1273
         echo "<div class='form-group'>";
1274 1274
 
1275 1275
         echo aui()->input(
1276 1276
             array(
1277
-                'name'       => esc_attr( $field['id'] ),
1278
-                'id'         => esc_attr( $field['id'] ),
1277
+                'name'       => esc_attr($field['id']),
1278
+                'id'         => esc_attr($field['id']),
1279 1279
                 'required'   => (bool) $field['required'],
1280
-                'label'      => wp_kses_post( $field['label'] ),
1280
+                'label'      => wp_kses_post($field['label']),
1281 1281
                 'no_wrap'    => true,
1282
-                'placeholder' => esc_attr( $field['placeholder'] ),
1282
+                'placeholder' => esc_attr($field['placeholder']),
1283 1283
                 'type'       => 'email',
1284 1284
             )
1285 1285
         );
1286 1286
 
1287
-        if ( ! empty( $field['description'] ) ) {
1288
-            $description = wp_kses_post( $field['description'] );
1287
+        if (!empty($field['description'])) {
1288
+            $description = wp_kses_post($field['description']);
1289 1289
             echo "<small class='form-text text-muted'>$description</small>";
1290 1290
         }
1291 1291
 
@@ -1296,30 +1296,30 @@  discard block
 block discarded – undo
1296 1296
     /**
1297 1297
      * Renders the billing email element on the frontend.
1298 1298
      */
1299
-    public function frontend_render_billing_email_template( $field ) {
1299
+    public function frontend_render_billing_email_template($field) {
1300 1300
         
1301 1301
         echo "<div class='form-group'>";
1302 1302
         $value = '';
1303 1303
 
1304
-        if ( is_user_logged_in() ) {
1304
+        if (is_user_logged_in()) {
1305 1305
             $user  = wp_get_current_user();
1306
-            $value = sanitize_email( $user->user_email );
1306
+            $value = sanitize_email($user->user_email);
1307 1307
         }
1308 1308
         echo aui()->input(
1309 1309
             array(
1310 1310
                 'name'       => 'billing_email',
1311 1311
                 'value'      => $value,
1312
-                'id'         => esc_attr( $field['id'] ),
1312
+                'id'         => esc_attr($field['id']),
1313 1313
                 'required'   => true,
1314
-                'label'      => wp_kses_post( $field['label'] ),
1314
+                'label'      => wp_kses_post($field['label']),
1315 1315
                 'no_wrap'    => true,
1316
-                'placeholder' => esc_attr( $field['placeholder'] ),
1316
+                'placeholder' => esc_attr($field['placeholder']),
1317 1317
                 'type'       => 'email',
1318 1318
             )
1319 1319
         );
1320 1320
 
1321
-        if ( ! empty( $field['description'] ) ) {
1322
-            $description = wp_kses_post( $field['description'] );
1321
+        if (!empty($field['description'])) {
1322
+            $description = wp_kses_post($field['description']);
1323 1323
             echo "<small class='form-text text-muted'>$description</small>";
1324 1324
         }
1325 1325
 
@@ -1330,16 +1330,16 @@  discard block
 block discarded – undo
1330 1330
     /**
1331 1331
      * Renders the edit email element template.
1332 1332
      */
1333
-    public function edit_email_template( $field ) {
1334
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1335
-        $label    = __( 'Field Label', 'invoicing' );
1333
+    public function edit_email_template($field) {
1334
+        $restrict = $this->get_restrict_markup($field, 'email');
1335
+        $label    = __('Field Label', 'invoicing');
1336 1336
         $id       = $field . '.id + "_edit"';
1337
-        $label2   = __( 'Placeholder text', 'invoicing' );
1337
+        $label2   = __('Placeholder text', 'invoicing');
1338 1338
         $id2      = $field . '.id + "_edit2"';
1339
-        $label3   = __( 'Help text', 'invoicing' );
1340
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1339
+        $label3   = __('Help text', 'invoicing');
1340
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1341 1341
         $id3      = $field . '.id + "_edit3"';
1342
-        $label5   = __( 'Is this field required?', 'invoicing' );
1342
+        $label5   = __('Is this field required?', 'invoicing');
1343 1343
         $id4      = $field . '.id + "_edit4"';
1344 1344
         echo "
1345 1345
             <div $restrict>
@@ -1367,16 +1367,16 @@  discard block
 block discarded – undo
1367 1367
     /**
1368 1368
      * Renders the edit billing_email element template.
1369 1369
      */
1370
-    public function edit_billing_email_template( $field ) {
1371
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1372
-        $label    = __( 'Field Label', 'invoicing' );
1370
+    public function edit_billing_email_template($field) {
1371
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1372
+        $label    = __('Field Label', 'invoicing');
1373 1373
         $id       = $field . '.id + "_edit"';
1374
-        $label2   = __( 'Placeholder text', 'invoicing' );
1374
+        $label2   = __('Placeholder text', 'invoicing');
1375 1375
         $id2      = $field . '.id + "_edit2"';
1376
-        $label3   = __( 'Help text', 'invoicing' );
1377
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1376
+        $label3   = __('Help text', 'invoicing');
1377
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1378 1378
         $id3      = $field . '.id + "_edit3"';
1379
-        $label5   = __( 'Is this field required?', 'invoicing' );
1379
+        $label5   = __('Is this field required?', 'invoicing');
1380 1380
         $id4      = $field . '.id + "_edit4"';
1381 1381
         echo "
1382 1382
             <div $restrict>
@@ -1400,8 +1400,8 @@  discard block
 block discarded – undo
1400 1400
     /**
1401 1401
      * Renders the website element template.
1402 1402
      */
1403
-    public function render_website_template( $field ) {
1404
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1403
+    public function render_website_template($field) {
1404
+        $restrict = $this->get_restrict_markup($field, 'website');
1405 1405
         $label    = "$field.label";
1406 1406
         echo "
1407 1407
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -1416,24 +1416,24 @@  discard block
 block discarded – undo
1416 1416
     /**
1417 1417
      * Renders the website element on the frontend.
1418 1418
      */
1419
-    public function frontend_render_website_template( $field ) {
1419
+    public function frontend_render_website_template($field) {
1420 1420
         
1421 1421
         echo "<div class='form-group'>";
1422 1422
 
1423 1423
         echo aui()->input(
1424 1424
             array(
1425
-                'name'       => esc_attr( $field['id'] ),
1426
-                'id'         => esc_attr( $field['id'] ),
1425
+                'name'       => esc_attr($field['id']),
1426
+                'id'         => esc_attr($field['id']),
1427 1427
                 'required'   => (bool) $field['required'],
1428
-                'label'      => wp_kses_post( $field['label'] ),
1428
+                'label'      => wp_kses_post($field['label']),
1429 1429
                 'no_wrap'    => true,
1430
-                'placeholder' => esc_attr( $field['placeholder'] ),
1430
+                'placeholder' => esc_attr($field['placeholder']),
1431 1431
                 'type'       => 'url',
1432 1432
             )
1433 1433
         );
1434 1434
 
1435
-        if ( ! empty( $field['description'] ) ) {
1436
-            $description = wp_kses_post( $field['description'] );
1435
+        if (!empty($field['description'])) {
1436
+            $description = wp_kses_post($field['description']);
1437 1437
             echo "<small class='form-text text-muted'>$description</small>";
1438 1438
         }
1439 1439
 
@@ -1444,16 +1444,16 @@  discard block
 block discarded – undo
1444 1444
     /**
1445 1445
      * Renders the edit website element template.
1446 1446
      */
1447
-    public function edit_website_template( $field ) {
1448
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1449
-        $label    = __( 'Field Label', 'invoicing' );
1447
+    public function edit_website_template($field) {
1448
+        $restrict = $this->get_restrict_markup($field, 'website');
1449
+        $label    = __('Field Label', 'invoicing');
1450 1450
         $id       = $field . '.id + "_edit"';
1451
-        $label2   = __( 'Placeholder text', 'invoicing' );
1451
+        $label2   = __('Placeholder text', 'invoicing');
1452 1452
         $id2      = $field . '.id + "_edit2"';
1453
-        $label3   = __( 'Help text', 'invoicing' );
1454
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1453
+        $label3   = __('Help text', 'invoicing');
1454
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1455 1455
         $id3      = $field . '.id + "_edit3"';
1456
-        $label5   = __( 'Is this field required?', 'invoicing' );
1456
+        $label5   = __('Is this field required?', 'invoicing');
1457 1457
         $id4      = $field . '.id + "_edit4"';
1458 1458
         echo "
1459 1459
             <div $restrict>
@@ -1481,8 +1481,8 @@  discard block
 block discarded – undo
1481 1481
     /**
1482 1482
      * Renders the date element template.
1483 1483
      */
1484
-    public function render_date_template( $field ) {
1485
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1484
+    public function render_date_template($field) {
1485
+        $restrict = $this->get_restrict_markup($field, 'date');
1486 1486
         $label    = "$field.label";
1487 1487
         echo "
1488 1488
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -1497,23 +1497,23 @@  discard block
 block discarded – undo
1497 1497
     /**
1498 1498
      * Renders the date element on the frontend.
1499 1499
      */
1500
-    public function frontend_render_date_template( $field ) {
1500
+    public function frontend_render_date_template($field) {
1501 1501
         
1502 1502
         echo "<div class='form-group'>";
1503 1503
 
1504 1504
         echo aui()->input(
1505 1505
             array(
1506
-                'name'       => esc_attr( $field['id'] ),
1507
-                'id'         => esc_attr( $field['id'] ),
1506
+                'name'       => esc_attr($field['id']),
1507
+                'id'         => esc_attr($field['id']),
1508 1508
                 'required'   => (bool) $field['required'],
1509
-                'label'      => wp_kses_post( $field['label'] ),
1509
+                'label'      => wp_kses_post($field['label']),
1510 1510
                 'no_wrap'    => true,
1511 1511
                 'type'       => 'date',
1512 1512
             )
1513 1513
         );
1514 1514
 
1515
-        if ( ! empty( $field['description'] ) ) {
1516
-            $description = wp_kses_post( $field['description'] );
1515
+        if (!empty($field['description'])) {
1516
+            $description = wp_kses_post($field['description']);
1517 1517
             echo "<small class='form-text text-muted'>$description</small>";
1518 1518
         }
1519 1519
 
@@ -1524,14 +1524,14 @@  discard block
 block discarded – undo
1524 1524
     /**
1525 1525
      * Renders the edit date element template.
1526 1526
      */
1527
-    public function edit_date_template( $field ) {
1528
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1529
-        $label    = __( 'Field Label', 'invoicing' );
1527
+    public function edit_date_template($field) {
1528
+        $restrict = $this->get_restrict_markup($field, 'date');
1529
+        $label    = __('Field Label', 'invoicing');
1530 1530
         $id       = $field . '.id + "_edit"';
1531
-        $label3   = __( 'Help text', 'invoicing' );
1532
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1531
+        $label3   = __('Help text', 'invoicing');
1532
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1533 1533
         $id3      = $field . '.id + "_edit3"';
1534
-        $label5   = __( 'Is this field required?', 'invoicing' );
1534
+        $label5   = __('Is this field required?', 'invoicing');
1535 1535
         $id4      = $field . '.id + "_edit4"';
1536 1536
         echo "
1537 1537
             <div $restrict>
@@ -1555,8 +1555,8 @@  discard block
 block discarded – undo
1555 1555
     /**
1556 1556
      * Renders the time element template.
1557 1557
      */
1558
-    public function render_time_template( $field ) {
1559
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1558
+    public function render_time_template($field) {
1559
+        $restrict = $this->get_restrict_markup($field, 'time');
1560 1560
         $label    = "$field.label";
1561 1561
         echo "
1562 1562
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -1571,23 +1571,23 @@  discard block
 block discarded – undo
1571 1571
     /**
1572 1572
      * Renders the time element on the frontend.
1573 1573
      */
1574
-    public function frontend_render_time_template( $field ) {
1574
+    public function frontend_render_time_template($field) {
1575 1575
         
1576 1576
         echo "<div class='form-group'>";
1577 1577
 
1578 1578
         echo aui()->input(
1579 1579
             array(
1580
-                'name'       => esc_attr( $field['id'] ),
1581
-                'id'         => esc_attr( $field['id'] ),
1580
+                'name'       => esc_attr($field['id']),
1581
+                'id'         => esc_attr($field['id']),
1582 1582
                 'required'   => (bool) $field['required'],
1583
-                'label'      => wp_kses_post( $field['label'] ),
1583
+                'label'      => wp_kses_post($field['label']),
1584 1584
                 'no_wrap'    => true,
1585 1585
                 'type'       => 'time',
1586 1586
             )
1587 1587
         );
1588 1588
 
1589
-        if ( ! empty( $field['description'] ) ) {
1590
-            $description = wp_kses_post( $field['description'] );
1589
+        if (!empty($field['description'])) {
1590
+            $description = wp_kses_post($field['description']);
1591 1591
             echo "<small class='form-text text-muted'>$description</small>";
1592 1592
         }
1593 1593
 
@@ -1598,14 +1598,14 @@  discard block
 block discarded – undo
1598 1598
     /**
1599 1599
      * Renders the edit time element template.
1600 1600
      */
1601
-    public function edit_time_template( $field ) {
1602
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1603
-        $label    = __( 'Field Label', 'invoicing' );
1601
+    public function edit_time_template($field) {
1602
+        $restrict = $this->get_restrict_markup($field, 'time');
1603
+        $label    = __('Field Label', 'invoicing');
1604 1604
         $id       = $field . '.id + "_edit"';
1605
-        $label3   = __( 'Help text', 'invoicing' );
1606
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1605
+        $label3   = __('Help text', 'invoicing');
1606
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1607 1607
         $id3      = $field . '.id + "_edit3"';
1608
-        $label5   = __( 'Is this field required?', 'invoicing' );
1608
+        $label5   = __('Is this field required?', 'invoicing');
1609 1609
         $id4      = $field . '.id + "_edit4"';
1610 1610
         echo "
1611 1611
             <div $restrict>
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
     /**
1630 1630
      * Renders the number element template.
1631 1631
      */
1632
-    public function render_number_template( $field ) {
1633
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1632
+    public function render_number_template($field) {
1633
+        $restrict = $this->get_restrict_markup($field, 'number');
1634 1634
         $label    = "$field.label";
1635 1635
         echo "
1636 1636
             <div $restrict class='wpinv-payment-form-field-preview'>
@@ -1645,24 +1645,24 @@  discard block
 block discarded – undo
1645 1645
     /**
1646 1646
      * Renders the number element on the frontend.
1647 1647
      */
1648
-    public function frontend_render_number_template( $field ) {
1648
+    public function frontend_render_number_template($field) {
1649 1649
         
1650 1650
         echo "<div class='form-group'>";
1651 1651
 
1652 1652
         echo aui()->input(
1653 1653
             array(
1654
-                'name'       => esc_attr( $field['id'] ),
1655
-                'id'         => esc_attr( $field['id'] ),
1654
+                'name'       => esc_attr($field['id']),
1655
+                'id'         => esc_attr($field['id']),
1656 1656
                 'required'   => (bool) $field['required'],
1657
-                'label'      => wp_kses_post( $field['label'] ),
1658
-                'placeholder' => esc_attr( $field['placeholder'] ),
1657
+                'label'      => wp_kses_post($field['label']),
1658
+                'placeholder' => esc_attr($field['placeholder']),
1659 1659
                 'no_wrap'    => true,
1660 1660
                 'type'       => 'number',
1661 1661
             )
1662 1662
         );
1663 1663
 
1664
-        if ( ! empty( $field['description'] ) ) {
1665
-            $description = wp_kses_post( $field['description'] );
1664
+        if (!empty($field['description'])) {
1665
+            $description = wp_kses_post($field['description']);
1666 1666
             echo "<small class='form-text text-muted'>$description</small>";
1667 1667
         }
1668 1668
 
@@ -1673,16 +1673,16 @@  discard block
 block discarded – undo
1673 1673
     /**
1674 1674
      * Renders the edit number element template.
1675 1675
      */
1676
-    public function edit_number_template( $field ) {
1677
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1678
-        $label    = __( 'Field Label', 'invoicing' );
1676
+    public function edit_number_template($field) {
1677
+        $restrict = $this->get_restrict_markup($field, 'number');
1678
+        $label    = __('Field Label', 'invoicing');
1679 1679
         $id       = $field . '.id + "_edit"';
1680
-        $label2   = __( 'Placeholder text', 'invoicing' );
1680
+        $label2   = __('Placeholder text', 'invoicing');
1681 1681
         $id2      = $field . '.id + "_edit2"';
1682
-        $label3   = __( 'Help text', 'invoicing' );
1683
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1682
+        $label3   = __('Help text', 'invoicing');
1683
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1684 1684
         $id3      = $field . '.id + "_edit3"';
1685
-        $label5   = __( 'Is this field required?', 'invoicing' );
1685
+        $label5   = __('Is this field required?', 'invoicing');
1686 1686
         $id4      = $field . '.id + "_edit4"';
1687 1687
         echo "
1688 1688
             <div $restrict>
@@ -1710,23 +1710,23 @@  discard block
 block discarded – undo
1710 1710
     /**
1711 1711
      * Renders the separator element template.
1712 1712
      */
1713
-    public function render_separator_template( $field ) {
1714
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1713
+    public function render_separator_template($field) {
1714
+        $restrict = $this->get_restrict_markup($field, 'separator');
1715 1715
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1716 1716
     }
1717 1717
 
1718 1718
     /**
1719 1719
      * Renders the separator element on the frontend.
1720 1720
      */
1721
-    public function frontend_render_separator_template( $field ) {
1721
+    public function frontend_render_separator_template($field) {
1722 1722
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1723 1723
     }
1724 1724
 
1725 1725
     /**
1726 1726
      * Renders the pay button element template.
1727 1727
      */
1728
-    public function render_pay_button_template( $field ) {
1729
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1728
+    public function render_pay_button_template($field) {
1729
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1730 1730
         $label    = "$field.label";
1731 1731
         echo "
1732 1732
             <div $restrict>
@@ -1739,28 +1739,28 @@  discard block
 block discarded – undo
1739 1739
     /**
1740 1740
      * Renders the pay_button element on the frontend.
1741 1741
      */
1742
-    public function frontend_render_pay_button_template( $field ) {
1742
+    public function frontend_render_pay_button_template($field) {
1743 1743
 
1744 1744
         echo "<div class='mt-4 mb-4'>";
1745
-            do_action( 'wpinv_payment_mode_select' );
1745
+            do_action('wpinv_payment_mode_select');
1746 1746
         echo "</div>";
1747 1747
 
1748 1748
         echo "<div class='form-group'>";
1749 1749
 
1750
-        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1750
+        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']);
1751 1751
         echo aui()->input(
1752 1752
             array(
1753
-                'name'       => esc_attr( $field['id'] ),
1754
-                'id'         => esc_attr( $field['id'] ),
1755
-                'value'      => esc_attr( $field['label'] ),
1753
+                'name'       => esc_attr($field['id']),
1754
+                'id'         => esc_attr($field['id']),
1755
+                'value'      => esc_attr($field['label']),
1756 1756
                 'no_wrap'    => true,
1757 1757
                 'type'       => 'submit',
1758 1758
                 'class'      => $class,
1759 1759
             )
1760 1760
         );
1761 1761
 
1762
-        if ( ! empty( $field['description'] ) ) {
1763
-            $description = wp_kses_post( $field['description'] );
1762
+        if (!empty($field['description'])) {
1763
+            $description = wp_kses_post($field['description']);
1764 1764
             echo "<small class='form-text text-muted'>$description</small>";
1765 1765
         }
1766 1766
 
@@ -1771,14 +1771,14 @@  discard block
 block discarded – undo
1771 1771
     /**
1772 1772
      * Renders the pay button element template.
1773 1773
      */
1774
-    public function edit_pay_button_template( $field ) {
1775
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1776
-        $label    = __( 'Button Text', 'invoicing' );
1774
+    public function edit_pay_button_template($field) {
1775
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1776
+        $label    = __('Button Text', 'invoicing');
1777 1777
         $id       = $field . '.id + "_edit"';
1778
-        $label2   = __( 'Help text', 'invoicing' );
1779
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1778
+        $label2   = __('Help text', 'invoicing');
1779
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1780 1780
         $id2      = $field . '.id + "_edit2"';
1781
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1781
+        $label4   = esc_attr__('Button Type', 'invoicing');
1782 1782
         $id3      = $field . '.id + "_edit3"';
1783 1783
         echo "
1784 1784
             <div $restrict>
@@ -1794,15 +1794,15 @@  discard block
 block discarded – undo
1794 1794
                     <label :for='$id3'>$label4</label>
1795 1795
 
1796 1796
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1797
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1798
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1799
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1800
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1801
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1802
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1803
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1804
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1805
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1797
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1798
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1799
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1800
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1801
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1802
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1803
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1804
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1805
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1806 1806
                     </select>
1807 1807
                 </div>
1808 1808
             </div>
@@ -1813,8 +1813,8 @@  discard block
 block discarded – undo
1813 1813
     /**
1814 1814
      * Renders the alert element template.
1815 1815
      */
1816
-    public function render_alert_template( $field ) {
1817
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1816
+    public function render_alert_template($field) {
1817
+        $restrict = $this->get_restrict_markup($field, 'alert');
1818 1818
         $text     = "$field.text";
1819 1819
         echo "
1820 1820
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1829,15 +1829,15 @@  discard block
 block discarded – undo
1829 1829
     /**
1830 1830
      * Renders the alert element on the frontend.
1831 1831
      */
1832
-    public function frontend_render_alert_template( $field ) {
1832
+    public function frontend_render_alert_template($field) {
1833 1833
         
1834 1834
         echo "<div class='form-group'>";
1835 1835
 
1836 1836
         echo aui()->alert(
1837 1837
             array(
1838
-                'content'     => wp_kses_post( $field['text'] ),
1838
+                'content'     => wp_kses_post($field['text']),
1839 1839
                 'dismissible' => $field['dismissible'],
1840
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1840
+                'type'        => str_replace('alert-', '', $field['class']),
1841 1841
             )
1842 1842
         );
1843 1843
 
@@ -1848,14 +1848,14 @@  discard block
 block discarded – undo
1848 1848
     /**
1849 1849
      * Renders the alert element template.
1850 1850
      */
1851
-    public function edit_alert_template( $field ) {
1852
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1853
-        $label    = __( 'Alert Text', 'invoicing' );
1854
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1851
+    public function edit_alert_template($field) {
1852
+        $restrict = $this->get_restrict_markup($field, 'alert');
1853
+        $label    = __('Alert Text', 'invoicing');
1854
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1855 1855
         $id       = $field . '.id + "_edit"';
1856
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1856
+        $label3   = __('Is Dismissible?', 'invoicing');
1857 1857
         $id2      = $field . '.id + "_edit2"';
1858
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1858
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1859 1859
         $id3      = $field . '.id + "_edit3"';
1860 1860
         echo "
1861 1861
             <div $restrict>
@@ -1871,14 +1871,14 @@  discard block
 block discarded – undo
1871 1871
                     <label :for='$id3'>$label4</label>
1872 1872
 
1873 1873
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1874
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1875
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1876
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1877
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1878
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1879
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1880
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1881
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1874
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1875
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1876
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1877
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1878
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1879
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1880
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1881
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1882 1882
                     </select>
1883 1883
                 </div>
1884 1884
             </div>
@@ -1889,8 +1889,8 @@  discard block
 block discarded – undo
1889 1889
     /**
1890 1890
      * Renders the discount element template.
1891 1891
      */
1892
-    public function render_discount_template( $field ) {
1893
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1892
+    public function render_discount_template($field) {
1893
+        $restrict = $this->get_restrict_markup($field, 'discount');
1894 1894
         ?>
1895 1895
 
1896 1896
             <div <?php echo $restrict; ?> class="discount_field border rounded p-3 wpinv-payment-form-field-preview">
@@ -1908,13 +1908,13 @@  discard block
 block discarded – undo
1908 1908
     /**
1909 1909
      * Renders the discount element on the frontend.
1910 1910
      */
1911
-    public function frontend_render_discount_template( $field ) {
1911
+    public function frontend_render_discount_template($field) {
1912 1912
         
1913
-        $placeholder = esc_attr( $field['input_label'] );
1914
-        $label       = sanitize_text_field( $field['button_label'] );
1913
+        $placeholder = esc_attr($field['input_label']);
1914
+        $label       = sanitize_text_field($field['button_label']);
1915 1915
         $description = '';
1916 1916
 
1917
-        if ( ! empty( $field['description'] ) ) {
1917
+        if (!empty($field['description'])) {
1918 1918
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1919 1919
         }
1920 1920
 ?>
@@ -1936,12 +1936,12 @@  discard block
 block discarded – undo
1936 1936
     /**
1937 1937
      * Renders the discount element template.
1938 1938
      */
1939
-    public function edit_discount_template( $field ) {
1940
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1941
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1942
-        $label2   = __( 'Help Text', 'invoicing' );
1943
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1944
-        $label4   = __( 'Button Text', 'invoicing' );
1939
+    public function edit_discount_template($field) {
1940
+        $restrict = $this->get_restrict_markup($field, 'discount');
1941
+        $label    = __('Discount Input Placeholder', 'invoicing');
1942
+        $label2   = __('Help Text', 'invoicing');
1943
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1944
+        $label4   = __('Button Text', 'invoicing');
1945 1945
         $id       = $field . '.id + "_edit"';
1946 1946
         $id2      = $field . '.id + "_edit2"';
1947 1947
         $id3      = $field . '.id + "_edit3"';
@@ -1970,12 +1970,12 @@  discard block
 block discarded – undo
1970 1970
     /**
1971 1971
      * Renders the items element template.
1972 1972
      */
1973
-    public function render_items_template( $field ) {
1974
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1975
-        $label     = __( 'Item totals will appear here. Click to set items.', 'invoicing' );
1976
-        $label2    = __( 'Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing' );
1977
-        $label2   .= ' ' . __( 'To prevent this, limit customers to selecting a single item.', 'invoicing' );
1978
-        $label3    = __( 'Item totals will appear here.', 'invoicing' );
1973
+    public function render_items_template($field) {
1974
+        $restrict  = $this->get_restrict_markup($field, 'items');
1975
+        $label     = __('Item totals will appear here. Click to set items.', 'invoicing');
1976
+        $label2    = __('Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing');
1977
+        $label2   .= ' ' . __('To prevent this, limit customers to selecting a single item.', 'invoicing');
1978
+        $label3    = __('Item totals will appear here.', 'invoicing');
1979 1979
         echo "
1980 1980
             <div $restrict class='item_totals text-center'>
1981 1981
                 <div v-if='!is_default'>
@@ -1992,17 +1992,17 @@  discard block
 block discarded – undo
1992 1992
     /**
1993 1993
      * Renders the items element on the frontend.
1994 1994
      */
1995
-    public function frontend_render_items_template( $field, $items ) {
1995
+    public function frontend_render_items_template($field, $items) {
1996 1996
 
1997 1997
         echo "<div class='form-group item_totals'>";
1998 1998
         
1999
-        $id = esc_attr( $field['id'] );
1999
+        $id = esc_attr($field['id']);
2000 2000
 
2001
-        if ( empty( $field[ 'items_type' ] ) ) {
2002
-            $field[ 'items_type' ] = 'total';
2001
+        if (empty($field['items_type'])) {
2002
+            $field['items_type'] = 'total';
2003 2003
         }
2004 2004
 
2005
-        if ( 'total' == $field[ 'items_type' ] ) {
2005
+        if ('total' == $field['items_type']) {
2006 2006
             $total     = 0;
2007 2007
             $tax       = 0;
2008 2008
             $sub_total = 0;
@@ -2011,16 +2011,16 @@  discard block
 block discarded – undo
2011 2011
             <div class="border item_totals_type_total">
2012 2012
 
2013 2013
                 <?php
2014
-                    foreach( $items as $item ) {
2014
+                    foreach ($items as $item) {
2015 2015
 
2016
-                        $amount = floatval( $item['price'] );
2016
+                        $amount = floatval($item['price']);
2017 2017
 
2018
-                        if ( wpinv_use_taxes() ) {
2018
+                        if (wpinv_use_taxes()) {
2019 2019
 
2020
-                            $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2020
+                            $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2021 2021
 
2022
-                            if ( wpinv_prices_include_tax() ) {
2023
-                                $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2022
+                            if (wpinv_prices_include_tax()) {
2023
+                                $pre_tax  = ($amount - $amount * $rate * 0.01);
2024 2024
                                 $item_tax = $amount - $pre_tax;
2025 2025
                             } else {
2026 2026
                                 $pre_tax  = $amount;
@@ -2032,32 +2032,32 @@  discard block
 block discarded – undo
2032 2032
                             $total     = $sub_total + $tax;
2033 2033
 
2034 2034
                         } else {
2035
-                            $total  = $total + $amount;
2035
+                            $total = $total + $amount;
2036 2036
                         }
2037 2037
 
2038 2038
                         $class  = 'col-8';
2039 2039
                         $class2 = '';
2040 2040
 
2041
-                        if ( ! empty( $item['allow_quantities'] ) ) {
2041
+                        if (!empty($item['allow_quantities'])) {
2042 2042
                             $class = 'col-6 pt-2';
2043 2043
                             $class2 = 'pt-2';
2044 2044
                         }
2045 2045
 
2046
-                        if ( ! empty( $item['custom_price'] ) ) {
2046
+                        if (!empty($item['custom_price'])) {
2047 2047
                             $class .= ' pt-2';
2048 2048
                         }
2049 2049
 
2050 2050
                         $quantity = 1;
2051
-                        if ( ! empty( $item['quantity'] ) ) {
2052
-                            $quantity = absint( $item['quantity'] );
2051
+                        if (!empty($item['quantity'])) {
2052
+                            $quantity = absint($item['quantity']);
2053 2053
                         }
2054 2054
             
2055 2055
                 ?>
2056 2056
                     <div  class="item_totals_item">
2057 2057
                         <div class='row pl-2 pr-2 pt-2'>
2058
-                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field( $item['title'] ) ?></div>
2058
+                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field($item['title']) ?></div>
2059 2059
 
2060
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2060
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2061 2061
 
2062 2062
                                 <div class='col-2'>
2063 2063
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='<?php echo $quantity ?>' min='1' required>
@@ -2065,11 +2065,11 @@  discard block
 block discarded – undo
2065 2065
 
2066 2066
                             <?php } else { ?>
2067 2067
                                 <input type='hidden' class='wpinv-item-quantity-input' value='<?php echo $quantity ?>'>
2068
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2068
+                            <?php } if (empty($item['custom_price'])) { ?>
2069 2069
 
2070 2070
                                 <div class='col-4 <?php echo $class2; ?>'>
2071
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2072
-                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2071
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2072
+                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2073 2073
                                 </div>
2074 2074
 
2075 2075
                             <?php } else {?>
@@ -2077,15 +2077,15 @@  discard block
 block discarded – undo
2077 2077
                                 <div class='col-4'>
2078 2078
                                     <div class='input-group'>
2079 2079
 
2080
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2080
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2081 2081
                                             <div class='input-group-prepend'>
2082 2082
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2083 2083
                                             </div>
2084 2084
                                         <?php } ?>
2085 2085
 
2086
-                                        <input type='text' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2086
+                                        <input type='text' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2087 2087
                                     
2088
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2088
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2089 2089
                                             <div class='input-group-append'>
2090 2090
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2091 2091
                                             </div>
@@ -2096,8 +2096,8 @@  discard block
 block discarded – undo
2096 2096
                             <?php } ?>
2097 2097
 
2098 2098
                         </div>
2099
-                        <?php if ( ! empty( $item['description'] )) { ?>
2100
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2099
+                        <?php if (!empty($item['description'])) { ?>
2100
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2101 2101
                         <?php } ?>
2102 2102
                     </div>
2103 2103
                 <?php } ?>
@@ -2105,25 +2105,25 @@  discard block
 block discarded – undo
2105 2105
                 <div class='mt-4 border-top item_totals_total p-2'>
2106 2106
 
2107 2107
                     <div class='row'>
2108
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2109
-                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2108
+                        <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2109
+                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2110 2110
                     </div>
2111 2111
 
2112 2112
                     <div class='row' style='display: none;'>
2113
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Discount', 'invoicing' ); ?></strong></div>
2114
-                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price( wpinv_format_amount( 0 ) ) ?></strong></div>
2113
+                        <div class='col-8'><strong class='mr-5'><?php _e('Discount', 'invoicing'); ?></strong></div>
2114
+                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price(wpinv_format_amount(0)) ?></strong></div>
2115 2115
                     </div>
2116 2116
 
2117
-                    <?php if ( wpinv_use_taxes() ) { ?>
2117
+                    <?php if (wpinv_use_taxes()) { ?>
2118 2118
                         <div class='row'>
2119
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2120
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2119
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2120
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2121 2121
                         </div>
2122 2122
                     <?php } ?>
2123 2123
 
2124 2124
                     <div class='row'>
2125
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2126
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2125
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2126
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2127 2127
                     </div>
2128 2128
 
2129 2129
                 </div>
@@ -2131,22 +2131,22 @@  discard block
 block discarded – undo
2131 2131
             </div>
2132 2132
         <?php } ?>
2133 2133
 
2134
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
2134
+        <?php if ('radio' == $field['items_type']) { ?>
2135 2135
             <div class="item_totals_type_radio">
2136 2136
 
2137 2137
                 <?php
2138
-                    foreach( $items as $index => $item ) {
2138
+                    foreach ($items as $index => $item) {
2139 2139
 
2140
-                        if ( ! empty( $item['required'] ) ) {
2140
+                        if (!empty($item['required'])) {
2141 2141
                             continue;
2142 2142
                         }
2143 2143
                 ?>
2144 2144
                     <div  class="form-check">
2145
-                        <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
2146
-                        <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>
2145
+                        <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
2146
+                        <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>
2147 2147
                     </div>
2148
-                    <?php if ( ! empty( $item['description'] )) { ?>
2149
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2148
+                    <?php if (!empty($item['description'])) { ?>
2149
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2150 2150
                     <?php } ?>
2151 2151
                 <?php } ?>
2152 2152
 
@@ -2158,32 +2158,32 @@  discard block
 block discarded – undo
2158 2158
                         $tax       = 0;
2159 2159
                         $sub_total = 0;
2160 2160
 
2161
-                        foreach ( $items as $item ) {
2161
+                        foreach ($items as $item) {
2162 2162
 
2163 2163
                             $class  = 'col-8';
2164 2164
                             $class2 = '';
2165 2165
 
2166
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2166
+                            if (!empty($item['allow_quantities'])) {
2167 2167
                                 $class = 'col-6 pt-2';
2168 2168
                                 $class2 = 'pt-2';
2169 2169
                             }
2170 2170
 
2171
-                            if ( ! empty( $item['custom_price'] ) ) {
2171
+                            if (!empty($item['custom_price'])) {
2172 2172
                                 $class .= ' pt-2';
2173 2173
                             }
2174 2174
 
2175 2175
                             $class3 = 'd-none';
2176 2176
                             $name   = '';
2177
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) {
2177
+                            if (!empty($item['required']) || !isset($totals_selected_radio_item)) {
2178 2178
 
2179
-                                $amount = floatval( $item['price'] );
2179
+                                $amount = floatval($item['price']);
2180 2180
 
2181
-                                if ( wpinv_use_taxes() ) {
2181
+                                if (wpinv_use_taxes()) {
2182 2182
 
2183
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2183
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2184 2184
 
2185
-                                    if ( wpinv_prices_include_tax() ) {
2186
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2185
+                                    if (wpinv_prices_include_tax()) {
2186
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2187 2187
                                         $item_tax = $amount - $pre_tax;
2188 2188
                                     } else {
2189 2189
                                         $pre_tax  = $amount;
@@ -2195,13 +2195,13 @@  discard block
 block discarded – undo
2195 2195
                                     $total     = $sub_total + $tax;
2196 2196
 
2197 2197
                                 } else {
2198
-                                    $total  = $total + $amount;
2198
+                                    $total = $total + $amount;
2199 2199
                                 }
2200 2200
 
2201 2201
                                 $class3 = '';
2202 2202
                                 $name   = "wpinv-items[{$item['id']}]";
2203 2203
 
2204
-                                if ( empty( $item['required'] ) ) {
2204
+                                if (empty($item['required'])) {
2205 2205
                                     $totals_selected_radio_item = 1;
2206 2206
                                 }
2207 2207
 
@@ -2213,9 +2213,9 @@  discard block
 block discarded – undo
2213 2213
 
2214 2214
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2215 2215
                         <div class='row pl-2 pr-2 pt-2'>
2216
-                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field( $item['title'] ) ?></div>
2216
+                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field($item['title']) ?></div>
2217 2217
 
2218
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2218
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2219 2219
 
2220 2220
                                 <div class='col-2'>
2221 2221
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2223,11 +2223,11 @@  discard block
 block discarded – undo
2223 2223
 
2224 2224
                             <?php } else { ?>
2225 2225
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2226
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2226
+                            <?php } if (empty($item['custom_price'])) { ?>
2227 2227
 
2228 2228
                                 <div class='col-4 <?php echo $class2; ?>'>
2229
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2230
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2229
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2230
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2231 2231
                                 </div>
2232 2232
 
2233 2233
                             <?php } else {?>
@@ -2235,15 +2235,15 @@  discard block
 block discarded – undo
2235 2235
                                 <div class='col-4'>
2236 2236
                                     <div class='input-group'>
2237 2237
 
2238
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2238
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2239 2239
                                             <div class='input-group-prepend'>
2240 2240
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2241 2241
                                             </div>
2242 2242
                                         <?php } ?>
2243 2243
 
2244
-                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2244
+                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2245 2245
                                     
2246
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2246
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2247 2247
                                             <div class='input-group-append'>
2248 2248
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2249 2249
                                             </div>
@@ -2254,8 +2254,8 @@  discard block
 block discarded – undo
2254 2254
                             <?php } ?>
2255 2255
 
2256 2256
                         </div>
2257
-                        <?php if ( ! empty( $item['description'] )) { ?>
2258
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2257
+                        <?php if (!empty($item['description'])) { ?>
2258
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2259 2259
                         <?php } ?>
2260 2260
                     </div>
2261 2261
                 <?php } ?>
@@ -2263,25 +2263,25 @@  discard block
 block discarded – undo
2263 2263
                 <div class='mt-4 border-top item_totals_total p-2'>
2264 2264
 
2265 2265
                     <div class='row'>
2266
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2267
-                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2266
+                        <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2267
+                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2268 2268
                     </div>
2269 2269
 
2270 2270
                     <div class='row' style='display: none;'>
2271
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Discount', 'invoicing' ); ?></strong></div>
2271
+                        <div class='col-8'><strong class='mr-5'><?php _e('Discount', 'invoicing'); ?></strong></div>
2272 2272
                         <div class='col-4'><strong class='wpinv-items-discount'></strong></div>
2273 2273
                     </div>
2274 2274
 
2275
-                    <?php if ( wpinv_use_taxes() ) { ?>
2275
+                    <?php if (wpinv_use_taxes()) { ?>
2276 2276
                         <div class='row'>
2277
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2278
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2277
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2278
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2279 2279
                         </div>
2280 2280
                     <?php } ?>
2281 2281
 
2282 2282
                     <div class='row'>
2283
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2284
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2283
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2284
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2285 2285
                     </div>
2286 2286
                 </div>
2287 2287
 
@@ -2289,22 +2289,22 @@  discard block
 block discarded – undo
2289 2289
             </div>
2290 2290
         <?php } ?>
2291 2291
 
2292
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
2292
+        <?php if ('checkbox' == $field['items_type']) { ?>
2293 2293
 
2294 2294
             <div class="item_totals_type_checkbox">
2295 2295
 
2296 2296
                 <?php
2297
-                    foreach ( $items as $index => $item ) {
2297
+                    foreach ($items as $index => $item) {
2298 2298
 
2299
-                        if ( ! empty( $item['required'] ) ) {
2299
+                        if (!empty($item['required'])) {
2300 2300
                             continue;
2301 2301
                         }
2302 2302
 
2303
-                        $title = sanitize_text_field(  $item['title'] );
2304
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2305
-                        $item_id    = esc_attr( $id . "_$index" );
2306
-                        $value = esc_attr( $item['id'] );
2307
-                        $checked = checked( ! isset( $selected_checkbox_item ), true, false );
2303
+                        $title = sanitize_text_field($item['title']);
2304
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2305
+                        $item_id = esc_attr($id . "_$index");
2306
+                        $value = esc_attr($item['id']);
2307
+                        $checked = checked(!isset($selected_checkbox_item), true, false);
2308 2308
                         $selected_checkbox_item = 1;
2309 2309
 
2310 2310
                         echo "
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
                                 <label for='$item_id' class='custom-control-label'>$title &nbsp; ($price)</label>
2314 2314
                             </div>";
2315 2315
 
2316
-                        if ( ! empty( $item['description'] ) ) {
2316
+                        if (!empty($item['description'])) {
2317 2317
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
2318 2318
                         }
2319 2319
                     }
@@ -2327,31 +2327,31 @@  discard block
 block discarded – undo
2327 2327
                         $tax       = 0;
2328 2328
                         $sub_total = 0;
2329 2329
 
2330
-                        foreach ( $items as $item ) {
2330
+                        foreach ($items as $item) {
2331 2331
 
2332 2332
                             $class  = 'col-8';
2333 2333
                             $class2 = '';
2334 2334
 
2335
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2335
+                            if (!empty($item['allow_quantities'])) {
2336 2336
                                 $class = 'col-6 pt-2';
2337 2337
                                 $class2 = 'pt-2';
2338 2338
                             }
2339 2339
 
2340
-                            if ( ! empty( $item['custom_price'] ) ) {
2340
+                            if (!empty($item['custom_price'])) {
2341 2341
                                 $class .= ' pt-2';
2342 2342
                             }
2343 2343
 
2344 2344
                             $class3 = 'd-none';
2345
-                            $name  = '';
2346
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) {
2345
+                            $name = '';
2346
+                            if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) {
2347 2347
 
2348
-                                $amount = floatval( $item['price'] );
2349
-                                if ( wpinv_use_taxes() ) {
2348
+                                $amount = floatval($item['price']);
2349
+                                if (wpinv_use_taxes()) {
2350 2350
 
2351
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2351
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2352 2352
 
2353
-                                    if ( wpinv_prices_include_tax() ) {
2354
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2353
+                                    if (wpinv_prices_include_tax()) {
2354
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2355 2355
                                         $item_tax = $amount - $pre_tax;
2356 2356
                                     } else {
2357 2357
                                         $pre_tax  = $amount;
@@ -2363,13 +2363,13 @@  discard block
 block discarded – undo
2363 2363
                                     $total     = $sub_total + $tax;
2364 2364
 
2365 2365
                                 } else {
2366
-                                    $total  = $total + $amount;
2366
+                                    $total = $total + $amount;
2367 2367
                                 }
2368 2368
 
2369 2369
                                 $class3 = '';
2370
-                                $name  = "wpinv-items[{$item['id']}]";
2370
+                                $name = "wpinv-items[{$item['id']}]";
2371 2371
 
2372
-                                if ( empty( $item['required'] ) ) {
2372
+                                if (empty($item['required'])) {
2373 2373
                                     $totals_selected_checkbox_item = 1;
2374 2374
                                 }
2375 2375
 
@@ -2381,9 +2381,9 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2383 2383
                         <div class='row pl-2 pr-2 pt-2'>
2384
-                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field( $item['title'] ) ?></div>
2384
+                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field($item['title']) ?></div>
2385 2385
 
2386
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2386
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2387 2387
 
2388 2388
                                 <div class='col-2'>
2389 2389
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2391,11 +2391,11 @@  discard block
 block discarded – undo
2391 2391
 
2392 2392
                             <?php } else { ?>
2393 2393
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2394
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2394
+                            <?php } if (empty($item['custom_price'])) { ?>
2395 2395
 
2396 2396
                                 <div class='col-4 <?php echo $class2; ?>'>
2397
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2398
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2397
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2398
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2399 2399
                                 </div>
2400 2400
 
2401 2401
                             <?php } else {?>
@@ -2403,15 +2403,15 @@  discard block
 block discarded – undo
2403 2403
                                 <div class='col-4'>
2404 2404
                                     <div class='input-group'>
2405 2405
 
2406
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2406
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2407 2407
                                             <div class='input-group-prepend'>
2408 2408
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2409 2409
                                             </div>
2410 2410
                                         <?php } ?>
2411 2411
 
2412
-                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2412
+                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2413 2413
                                     
2414
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2414
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2415 2415
                                             <div class='input-group-append'>
2416 2416
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2417 2417
                                             </div>
@@ -2422,8 +2422,8 @@  discard block
 block discarded – undo
2422 2422
                             <?php } ?>
2423 2423
 
2424 2424
                         </div>
2425
-                        <?php if ( ! empty( $item['description'] )) { ?>
2426
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2425
+                        <?php if (!empty($item['description'])) { ?>
2426
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2427 2427
                         <?php } ?>
2428 2428
                     </div>
2429 2429
                 <?php } ?>
@@ -2431,32 +2431,32 @@  discard block
 block discarded – undo
2431 2431
                 <div class='mt-4 border-top item_totals_total p-2'>
2432 2432
 
2433 2433
                     <div class='row'>
2434
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2435
-                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2434
+                        <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2435
+                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2436 2436
                     </div>
2437 2437
 
2438 2438
                     <div class='row' style='display: none;'>
2439
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Discount', 'invoicing' ); ?></strong></div>
2440
-                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price( wpinv_format_amount( 0 ) ) ?></strong></div>
2439
+                        <div class='col-8'><strong class='mr-5'><?php _e('Discount', 'invoicing'); ?></strong></div>
2440
+                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price(wpinv_format_amount(0)) ?></strong></div>
2441 2441
                     </div>
2442 2442
 
2443
-                    <?php if ( wpinv_use_taxes() ) { ?>
2443
+                    <?php if (wpinv_use_taxes()) { ?>
2444 2444
                         <div class='row'>
2445
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2446
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2445
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2446
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2447 2447
                         </div>
2448 2448
                     <?php } ?>
2449 2449
 
2450 2450
                     <div class='row'>
2451
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2452
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2451
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2452
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2453 2453
                     </div>
2454 2454
                 </div>
2455 2455
             </div>
2456 2456
             </div>
2457 2457
         <?php } ?>
2458 2458
 
2459
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
2459
+        <?php if ('select' == $field['items_type']) { ?>
2460 2460
 
2461 2461
             <div class="item_totals_type_select">
2462 2462
 
@@ -2464,17 +2464,17 @@  discard block
 block discarded – undo
2464 2464
 
2465 2465
                     $options  = array();
2466 2466
                     $selected = '';
2467
-                    foreach ( $items as $index => $item ) {
2467
+                    foreach ($items as $index => $item) {
2468 2468
 
2469
-                        if ( ! empty( $item['required'] ) ) {
2469
+                        if (!empty($item['required'])) {
2470 2470
                             continue;
2471 2471
                         }
2472 2472
 
2473
-                        $title = sanitize_text_field(  $item['title'] );
2474
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2475
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2473
+                        $title = sanitize_text_field($item['title']);
2474
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2475
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2476 2476
 
2477
-                        if ( ! isset( $selected_item ) ) {
2477
+                        if (!isset($selected_item)) {
2478 2478
                             $selected = $item['id'];
2479 2479
                             $selected_item = 1;
2480 2480
                         }
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
                         array(
2486 2486
                                 'name'        => 'payment-form-items',
2487 2487
                                 'id'          => $id,
2488
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
2488
+                                'placeholder' => __('Select an item', 'invoicing'),
2489 2489
                                 'no_wrap'     => true,
2490 2490
                                 'options'     => $options,
2491 2491
                                 'class'       => 'wpi_select2 wpinv-items-select-selector',
@@ -2502,31 +2502,31 @@  discard block
 block discarded – undo
2502 2502
                         $tax       = 0;
2503 2503
                         $sub_total = 0;
2504 2504
 
2505
-                        foreach ( $items as $item ) {
2505
+                        foreach ($items as $item) {
2506 2506
 
2507 2507
                             $class  = 'col-8';
2508 2508
                             $class2 = '';
2509 2509
 
2510
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2510
+                            if (!empty($item['allow_quantities'])) {
2511 2511
                                 $class = 'col-6 pt-2';
2512 2512
                                 $class2 = 'pt-2';
2513 2513
                             }
2514 2514
 
2515
-                            if ( ! empty( $item['custom_price'] ) ) {
2515
+                            if (!empty($item['custom_price'])) {
2516 2516
                                 $class .= ' pt-2';
2517 2517
                             }
2518 2518
 
2519 2519
                             $class3 = 'd-none';
2520
-                            $name  = '';
2521
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2520
+                            $name = '';
2521
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2522 2522
 
2523
-                                $amount = floatval( $item['price'] );
2524
-                                if ( wpinv_use_taxes() ) {
2523
+                                $amount = floatval($item['price']);
2524
+                                if (wpinv_use_taxes()) {
2525 2525
 
2526
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2526
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2527 2527
 
2528
-                                    if ( wpinv_prices_include_tax() ) {
2529
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2528
+                                    if (wpinv_prices_include_tax()) {
2529
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2530 2530
                                         $item_tax = $amount - $pre_tax;
2531 2531
                                     } else {
2532 2532
                                         $pre_tax  = $amount;
@@ -2538,13 +2538,13 @@  discard block
 block discarded – undo
2538 2538
                                     $total     = $sub_total + $tax;
2539 2539
 
2540 2540
                                 } else {
2541
-                                    $total  = $total + $amount;
2541
+                                    $total = $total + $amount;
2542 2542
                                 }
2543 2543
 
2544 2544
                                 $class3 = '';
2545
-                                $name  = "wpinv-items[{$item['id']}]";
2545
+                                $name = "wpinv-items[{$item['id']}]";
2546 2546
 
2547
-                                if ( empty( $item['required'] ) ) {
2547
+                                if (empty($item['required'])) {
2548 2548
                                     $totals_selected_select_item = 1;
2549 2549
                                 }
2550 2550
 
@@ -2556,9 +2556,9 @@  discard block
 block discarded – undo
2556 2556
 
2557 2557
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2558 2558
                         <div class='row pl-2 pr-2 pt-2'>
2559
-                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field( $item['title'] ) ?></div>
2559
+                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field($item['title']) ?></div>
2560 2560
 
2561
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2561
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2562 2562
 
2563 2563
                                 <div class='col-2'>
2564 2564
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2566,11 +2566,11 @@  discard block
 block discarded – undo
2566 2566
 
2567 2567
                             <?php } else { ?>
2568 2568
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2569
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2569
+                            <?php } if (empty($item['custom_price'])) { ?>
2570 2570
 
2571 2571
                                 <div class='col-4 <?php echo $class2; ?>'>
2572
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2573
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2572
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2573
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2574 2574
                                 </div>
2575 2575
 
2576 2576
                             <?php } else {?>
@@ -2578,15 +2578,15 @@  discard block
 block discarded – undo
2578 2578
                                 <div class='col-4'>
2579 2579
                                     <div class='input-group'>
2580 2580
 
2581
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2581
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2582 2582
                                             <div class='input-group-prepend'>
2583 2583
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2584 2584
                                             </div>
2585 2585
                                         <?php } ?>
2586 2586
 
2587
-                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2587
+                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2588 2588
                                     
2589
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2589
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2590 2590
                                             <div class='input-group-append'>
2591 2591
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2592 2592
                                             </div>
@@ -2597,8 +2597,8 @@  discard block
 block discarded – undo
2597 2597
                             <?php } ?>
2598 2598
 
2599 2599
                         </div>
2600
-                        <?php if ( ! empty( $item['description'] )) { ?>
2601
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2600
+                        <?php if (!empty($item['description'])) { ?>
2601
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2602 2602
                         <?php } ?>
2603 2603
                     </div>
2604 2604
                 <?php } ?>
@@ -2606,31 +2606,31 @@  discard block
 block discarded – undo
2606 2606
                 <div class='mt-4 border-top item_totals_total p-2'>
2607 2607
 
2608 2608
                     <div class='row'>
2609
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2610
-                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2609
+                        <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2610
+                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2611 2611
                     </div>
2612 2612
 
2613 2613
                     <div class='row' style='display: none;'>
2614
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Discount', 'invoicing' ); ?></strong></div>
2615
-                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price( wpinv_format_amount( 0 ) ) ?></strong></div>
2614
+                        <div class='col-8'><strong class='mr-5'><?php _e('Discount', 'invoicing'); ?></strong></div>
2615
+                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price(wpinv_format_amount(0)) ?></strong></div>
2616 2616
                     </div>
2617 2617
 
2618
-                    <?php if ( wpinv_use_taxes() ) { ?>
2618
+                    <?php if (wpinv_use_taxes()) { ?>
2619 2619
                         <div class='row'>
2620
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2621
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2620
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2621
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2622 2622
                         </div>
2623 2623
                     <?php } ?>
2624 2624
                     <div class='row'>
2625
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2626
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2625
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2626
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2627 2627
                     </div>
2628 2628
                 </div>
2629 2629
 
2630 2630
             </div>
2631 2631
         <?php } ?>
2632 2632
 
2633
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
2633
+        <?php if ('multi_select' == $field['items_type']) { ?>
2634 2634
 
2635 2635
             <div class="item_totals_type_multi_select">
2636 2636
 
@@ -2639,18 +2639,18 @@  discard block
 block discarded – undo
2639 2639
                     $options  = array();
2640 2640
                     $selected = array();
2641 2641
 
2642
-                    foreach ( $items as $index => $item ) {
2642
+                    foreach ($items as $index => $item) {
2643 2643
 
2644
-                        if ( ! empty( $item['required'] ) ) {
2644
+                        if (!empty($item['required'])) {
2645 2645
                             continue;
2646 2646
                         }
2647 2647
 
2648
-                        $title = sanitize_text_field(  $item['title'] );
2649
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2650
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2648
+                        $title = sanitize_text_field($item['title']);
2649
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2650
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2651 2651
 
2652
-                        if ( ! isset( $selected_item ) ) {
2653
-                            $selected = array( $item['id'] );
2652
+                        if (!isset($selected_item)) {
2653
+                            $selected = array($item['id']);
2654 2654
                             $selected_item = 1;
2655 2655
                         }
2656 2656
 
@@ -2677,31 +2677,31 @@  discard block
 block discarded – undo
2677 2677
                         $tax       = 0;
2678 2678
                         $sub_total = 0;
2679 2679
 
2680
-                        foreach ( $items as $item ) {
2680
+                        foreach ($items as $item) {
2681 2681
 
2682 2682
                             $class  = 'col-8';
2683 2683
                             $class2 = '';
2684 2684
 
2685
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2685
+                            if (!empty($item['allow_quantities'])) {
2686 2686
                                 $class = 'col-6 pt-2';
2687 2687
                                 $class2 = 'pt-2';
2688 2688
                             }
2689 2689
 
2690
-                            if ( ! empty( $item['custom_price'] ) ) {
2690
+                            if (!empty($item['custom_price'])) {
2691 2691
                                 $class .= ' pt-2';
2692 2692
                             }
2693 2693
 
2694 2694
                             $class3 = 'd-none';
2695
-                            $name  = '';
2696
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2695
+                            $name = '';
2696
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2697 2697
 
2698
-                                $amount = floatval( $item['price'] );
2699
-                                if ( wpinv_use_taxes() ) {
2698
+                                $amount = floatval($item['price']);
2699
+                                if (wpinv_use_taxes()) {
2700 2700
 
2701
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2701
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2702 2702
 
2703
-                                    if ( wpinv_prices_include_tax() ) {
2704
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2703
+                                    if (wpinv_prices_include_tax()) {
2704
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2705 2705
                                         $item_tax = $amount - $pre_tax;
2706 2706
                                     } else {
2707 2707
                                         $pre_tax  = $amount;
@@ -2713,13 +2713,13 @@  discard block
 block discarded – undo
2713 2713
                                     $total     = $sub_total + $tax;
2714 2714
 
2715 2715
                                 } else {
2716
-                                    $total  = $total + $amount;
2716
+                                    $total = $total + $amount;
2717 2717
                                 }
2718 2718
 
2719 2719
                                 $class3 = '';
2720
-                                $name  = "wpinv-items[{$item['id']}]";
2720
+                                $name = "wpinv-items[{$item['id']}]";
2721 2721
 
2722
-                                if ( empty( $item['required'] ) ) {
2722
+                                if (empty($item['required'])) {
2723 2723
                                     $totals_selected_select_item = 1;
2724 2724
                                 }
2725 2725
 
@@ -2731,9 +2731,9 @@  discard block
 block discarded – undo
2731 2731
 
2732 2732
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2733 2733
                         <div class='row pl-2 pr-2 pt-2'>
2734
-                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field( $item['title'] ) ?></div>
2734
+                            <div class='<?php echo $class; ?>'><?php echo sanitize_text_field($item['title']) ?></div>
2735 2735
 
2736
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2736
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2737 2737
 
2738 2738
                                 <div class='col-2'>
2739 2739
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2741,11 +2741,11 @@  discard block
 block discarded – undo
2741 2741
 
2742 2742
                             <?php } else { ?>
2743 2743
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2744
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2744
+                            <?php } if (empty($item['custom_price'])) { ?>
2745 2745
 
2746 2746
                                 <div class='col-4 <?php echo $class2; ?>'>
2747
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2748
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2747
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2748
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2749 2749
                                 </div>
2750 2750
 
2751 2751
                             <?php } else {?>
@@ -2753,15 +2753,15 @@  discard block
 block discarded – undo
2753 2753
                                 <div class='col-4'>
2754 2754
                                     <div class='input-group'>
2755 2755
 
2756
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2756
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2757 2757
                                             <div class='input-group-prepend'>
2758 2758
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2759 2759
                                             </div>
2760 2760
                                         <?php } ?>
2761 2761
 
2762
-                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2762
+                                        <input type='text' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2763 2763
                                     
2764
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2764
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2765 2765
                                             <div class='input-group-append'>
2766 2766
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2767 2767
                                             </div>
@@ -2772,8 +2772,8 @@  discard block
 block discarded – undo
2772 2772
                             <?php } ?>
2773 2773
 
2774 2774
                         </div>
2775
-                        <?php if ( ! empty( $item['description'] )) { ?>
2776
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2775
+                        <?php if (!empty($item['description'])) { ?>
2776
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2777 2777
                         <?php } ?>
2778 2778
                     </div>
2779 2779
                 <?php } ?>
@@ -2781,32 +2781,32 @@  discard block
 block discarded – undo
2781 2781
                 <div class='mt-4 border-top item_totals_total p-2'>
2782 2782
 
2783 2783
                     <div class='row'>
2784
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2785
-                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2784
+                        <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2785
+                        <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2786 2786
                     </div>
2787 2787
 
2788 2788
                     <div class='row' style='display: none;'>
2789
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Discount', 'invoicing' ); ?></strong></div>
2790
-                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price( wpinv_format_amount( 0 ) ) ?></strong></div>
2789
+                        <div class='col-8'><strong class='mr-5'><?php _e('Discount', 'invoicing'); ?></strong></div>
2790
+                        <div class='col-4'><strong class='wpinv-items-discount'><?php echo wpinv_price(wpinv_format_amount(0)) ?></strong></div>
2791 2791
                     </div>
2792 2792
 
2793
-                    <?php if ( wpinv_use_taxes() ) { ?>
2793
+                    <?php if (wpinv_use_taxes()) { ?>
2794 2794
                         <div class='row'>
2795
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2796
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2795
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2796
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2797 2797
                         </div>
2798 2798
                     <?php } ?>
2799 2799
 
2800 2800
                     <div class='row'>
2801
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2802
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2801
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2802
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2803 2803
                     </div>
2804 2804
                 </div>
2805 2805
 
2806 2806
             </div>
2807 2807
         <?php } ?>
2808
-        <?php if ( ! empty( $field[ 'description' ] ) ) { ?>
2809
-            <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small>
2808
+        <?php if (!empty($field['description'])) { ?>
2809
+            <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small>
2810 2810
         <?php } ?>
2811 2811
         </div>
2812 2812
         <?php
@@ -2815,20 +2815,20 @@  discard block
 block discarded – undo
2815 2815
     /**
2816 2816
      * Renders the items element template.
2817 2817
      */
2818
-    public function edit_items_template( $field ) {
2818
+    public function edit_items_template($field) {
2819 2819
         global $wpinv_euvat, $post;
2820 2820
 
2821
-        $restrict = $this->get_restrict_markup( $field, 'items' );
2821
+        $restrict = $this->get_restrict_markup($field, 'items');
2822 2822
         $id2      = $field . '.id + "_edit2"';
2823 2823
         $id3      = $field . '.id + "_edit3"';
2824 2824
 
2825 2825
         // Item types.
2826
-        $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
2826
+        $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
2827 2827
 
2828 2828
         ?>
2829 2829
         <div <?php echo $restrict; ?>>
2830 2830
             <div v-if="!is_default">
2831
-                <div class="mb-1"><?php _e( 'Form Items', 'invoicing' ); ?></div>
2831
+                <div class="mb-1"><?php _e('Form Items', 'invoicing'); ?></div>
2832 2832
                 <draggable v-model='form_items' group='selectable_form_items'>
2833 2833
                     <div class='wpinv-available-items-editor' v-for='(item, index) in form_items' :class="'item_' + item.id" :key="item.id">
2834 2834
 
@@ -2846,35 +2846,35 @@  discard block
 block discarded – undo
2846 2846
 
2847 2847
                                 <div class="form-group" v-if="! item.new">
2848 2848
                                     <span class='form-text'>
2849
-                                        <a target="_blank" :href="'<?php echo esc_url( admin_url( '/post.php?action=edit&post' ) ) ?>=' + item.id">
2850
-                                            <?php _e( 'Edit the item name, price and other details', 'invoicing' ); ?>
2849
+                                        <a target="_blank" :href="'<?php echo esc_url(admin_url('/post.php?action=edit&post')) ?>=' + item.id">
2850
+                                            <?php _e('Edit the item name, price and other details', 'invoicing'); ?>
2851 2851
                                         </a>
2852 2852
                                     </span>
2853 2853
                                 </div>
2854 2854
 
2855 2855
                                 <div class='form-group' v-if="item.new">
2856 2856
                                     <label class='mb-0 w-100'>
2857
-                                        <span><?php _e( 'Item Name', 'invoicing' ); ?></span>
2857
+                                        <span><?php _e('Item Name', 'invoicing'); ?></span>
2858 2858
                                         <input v-model='item.title' type='text' class='w-100'/>
2859 2859
                                     </label>
2860 2860
                                 </div>
2861 2861
 
2862 2862
                                 <div class='form-group'  v-if="item.new">
2863 2863
                                     <label class='mb-0 w-100'>
2864
-                                        <span v-if='!item.custom_price'><?php _e( 'Item Price', 'invoicing' ); ?></span>
2865
-                                        <span v-if='item.custom_price'><?php _e( 'Recommended Price', 'invoicing' ); ?></span>
2864
+                                        <span v-if='!item.custom_price'><?php _e('Item Price', 'invoicing'); ?></span>
2865
+                                        <span v-if='item.custom_price'><?php _e('Recommended Price', 'invoicing'); ?></span>
2866 2866
                                         <input v-model='item.price' type='text' class='w-100'/>
2867 2867
                                     </label>
2868 2868
                                 </div>
2869 2869
 
2870 2870
                                 <div class='form-group' v-if='item.new'>
2871 2871
                                     <label :for="'edit_item_type' + item.id" class='mb-0 w-100'>
2872
-                                        <span><?php _e( 'Item Type', 'invoicing' ); ?></span>
2872
+                                        <span><?php _e('Item Type', 'invoicing'); ?></span>
2873 2873
                                         <select class='w-100' v-model='item.type'>
2874 2874
                                             <?php
2875
-                                                foreach ( $item_types as $type => $_label ) {
2876
-                                                    $type  = esc_attr( $type );
2877
-                                                    $_label = esc_html( $_label );
2875
+                                                foreach ($item_types as $type => $_label) {
2876
+                                                    $type = esc_attr($type);
2877
+                                                    $_label = esc_html($_label);
2878 2878
                                                     echo "<option value='$type'>$_label</type>";
2879 2879
                                                 }
2880 2880
                                             ?>
@@ -2883,71 +2883,71 @@  discard block
 block discarded – undo
2883 2883
                                 </div>
2884 2884
 
2885 2885
                                 <div v-if='item.new'>
2886
-                                    <?php if ( $wpinv_euvat->allow_vat_rules() ) : ?>
2886
+                                    <?php if ($wpinv_euvat->allow_vat_rules()) : ?>
2887 2887
                                         <div class='form-group'>
2888
-                                            <label class='w-100 mb-0'><?php _e( 'VAT Rule', 'invoicing' ) ; ?>
2888
+                                            <label class='w-100 mb-0'><?php _e('VAT Rule', 'invoicing'); ?>
2889 2889
                                                 <select class='w-100' v-model='item.rule'>
2890 2890
                                                     <?php
2891
-                                                        foreach ( $wpinv_euvat->get_rules() as $type => $_label ) {
2892
-                                                            $type  = esc_attr( $type );
2893
-                                                            $_label = esc_html( $_label );
2891
+                                                        foreach ($wpinv_euvat->get_rules() as $type => $_label) {
2892
+                                                            $type = esc_attr($type);
2893
+                                                            $_label = esc_html($_label);
2894 2894
                                                             echo "<option value='$type'>$_label</type>";
2895 2895
                                                         }
2896 2896
                                                     ?>
2897 2897
                                                 </select>
2898 2898
                                             </label>
2899 2899
                                         </div>
2900
-                                    <?php endif;?>
2900
+                                    <?php endif; ?>
2901 2901
 
2902
-                                    <?php if ( $wpinv_euvat->allow_vat_classes() ) : ?>
2902
+                                    <?php if ($wpinv_euvat->allow_vat_classes()) : ?>
2903 2903
                                         <div class='form-group'>
2904
-                                            <label class='w-100 mb-0'><?php _e( 'VAT class', 'invoicing' ) ; ?>
2904
+                                            <label class='w-100 mb-0'><?php _e('VAT class', 'invoicing'); ?>
2905 2905
                                                 <select class='w-100' v-model='item.class'>
2906 2906
                                                     <?php
2907
-                                                        foreach ( $wpinv_euvat->get_all_classes() as $type => $_label ) {
2908
-                                                            $type  = esc_attr( $type );
2909
-                                                            $_label = esc_html( $_label );
2907
+                                                        foreach ($wpinv_euvat->get_all_classes() as $type => $_label) {
2908
+                                                            $type = esc_attr($type);
2909
+                                                            $_label = esc_html($_label);
2910 2910
                                                             echo "<option value='$type'>$_label</type>"; 
2911 2911
                                                         }
2912 2912
                                                     ?>
2913 2913
                                                 </select>
2914 2914
                                             </label>
2915 2915
                                         </div>
2916
-                                    <?php endif;?>
2916
+                                    <?php endif; ?>
2917 2917
                                                         
2918 2918
                                 </div>
2919 2919
 
2920 2920
                                 <label v-if='item.new' class='form-group'>
2921 2921
                                     <input v-model='item.custom_price' type='checkbox' />
2922
-                                    <span class='form-check-label'><?php _e( 'Allow users to pay what they want', 'invoicing' ); ?></span>
2922
+                                    <span class='form-check-label'><?php _e('Allow users to pay what they want', 'invoicing'); ?></span>
2923 2923
                                 </label>
2924 2924
 
2925 2925
                                 <div class='form-group' v-if='item.new && item.custom_price'>
2926 2926
                                     <label class='mb-0 w-100'>
2927
-                                        <span><?php _e( 'Minimum Price', 'invoicing' ); ?></span>
2927
+                                        <span><?php _e('Minimum Price', 'invoicing'); ?></span>
2928 2928
                                         <input placeholder='0.00' v-model='item.minimum_price' class='w-100' />
2929
-                                        <small class='form-text text-muted'><?php _e( 'Enter the minimum price that a user can pay', 'invoicing' ); ?></small>
2929
+                                        <small class='form-text text-muted'><?php _e('Enter the minimum price that a user can pay', 'invoicing'); ?></small>
2930 2930
                                     </label>
2931 2931
                                 </div>
2932 2932
 
2933 2933
                                 <label class='form-group'>
2934 2934
                                     <input v-model='item.allow_quantities' type='checkbox' />
2935
-                                    <span><?php _e( 'Allow users to buy several quantities', 'invoicing' ); ?></span>
2935
+                                    <span><?php _e('Allow users to buy several quantities', 'invoicing'); ?></span>
2936 2936
                                 </label>
2937 2937
 
2938 2938
                                 <label class='form-group'>
2939 2939
                                     <input v-model='item.required' type='checkbox' />
2940
-                                    <span><?php _e( 'This item is required', 'invoicing' ); ?></span>
2940
+                                    <span><?php _e('This item is required', 'invoicing'); ?></span>
2941 2941
                                 </label>
2942 2942
 
2943 2943
                                 <div class='form-group'>
2944 2944
                                     <label class="mb-0 w-100">
2945
-                                        <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
2945
+                                        <span><?php _e('Item Description', 'invoicing'); ?></span>
2946 2946
                                         <textarea v-model='item.description' class='w-100'></textarea>
2947 2947
                                     </label>
2948 2948
                                 </div>
2949 2949
 
2950
-                                    <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e( 'Delete Item', 'invoicing' ); ?></button>
2950
+                                    <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e('Delete Item', 'invoicing'); ?></button>
2951 2951
 
2952 2952
                                 </div>
2953 2953
                             </div>
@@ -2955,37 +2955,37 @@  discard block
 block discarded – undo
2955 2955
                         </div>
2956 2956
                 </draggable>
2957 2957
 
2958
-                <small v-if='! form_items.length' class='form-text text-danger'><?php _e( 'You have not set up any items. Please select an item below or create a new item.', 'invoicing' ); ?></small>
2958
+                <small v-if='! form_items.length' class='form-text text-danger'><?php _e('You have not set up any items. Please select an item below or create a new item.', 'invoicing'); ?></small>
2959 2959
 
2960 2960
                 <div class='form-group mt-2'>
2961 2961
 
2962 2962
                     <select class='w-100' style="padding: 6px 24px 6px 8px; border-color: #e0e0e0;" v-model='selected_item' @change='addSelectedItem'>
2963
-                        <option value=''><?php _e( 'Select an item to add...', 'invoicing' ) ?></option>
2963
+                        <option value=''><?php _e('Select an item to add...', 'invoicing') ?></option>
2964 2964
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
2965 2965
                     </select>
2966 2966
 
2967 2967
                 </div>
2968 2968
 
2969 2969
                 <div class='form-group'>
2970
-                    <button @click.prevent='addNewItem' class="button button-link"><?php _e( 'Or create a new item.', 'invoicing' ) ?></button>
2970
+                    <button @click.prevent='addNewItem' class="button button-link"><?php _e('Or create a new item.', 'invoicing') ?></button>
2971 2971
                 </div>
2972 2972
 
2973 2973
                 <div class='form-group mt-5'>
2974
-                    <label :for='<?php echo $id2; ?>'><?php _e( 'Let customers...', 'invoicing' ) ?></label>
2974
+                    <label :for='<?php echo $id2; ?>'><?php _e('Let customers...', 'invoicing') ?></label>
2975 2975
 
2976 2976
                     <select class='w-100' style="padding: 6px 24px 6px 8px; border-color: #e0e0e0;" :id='<?php echo $id2; ?>' v-model='<?php echo $field; ?>.items_type'>
2977
-                        <option value='total' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e( 'Buy all items on the list', 'invoicing' ); ?></option>
2978
-                        <option value='radio'><?php _e( 'Select a single item from the list', 'invoicing' ); ?></option>
2979
-                        <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e( 'Select one or more items on the list', 'invoicing' ) ;?></option>
2980
-                        <option value='select'><?php _e( 'Select a single item from a dropdown', 'invoicing' ); ?></option>
2981
-                        <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e( 'Select a one or more items from a dropdown', 'invoicing' ) ;?></option>
2977
+                        <option value='total' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e('Buy all items on the list', 'invoicing'); ?></option>
2978
+                        <option value='radio'><?php _e('Select a single item from the list', 'invoicing'); ?></option>
2979
+                        <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e('Select one or more items on the list', 'invoicing'); ?></option>
2980
+                        <option value='select'><?php _e('Select a single item from a dropdown', 'invoicing'); ?></option>
2981
+                        <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions(<?php echo $field; ?>)'><?php _e('Select a one or more items from a dropdown', 'invoicing'); ?></option>
2982 2982
                     </select>
2983 2983
 
2984 2984
                 </div>
2985 2985
             </div>
2986 2986
             <div class='form-group'>
2987
-                <label :for='<?php echo $id3; ?>'><?php _e( 'Help Text', 'invoicing' ); ?></label>
2988
-                <textarea placeholder='<?php esc_attr_e( 'Add some help text for this element', 'invoicing' ); ?>' :id='<?php echo $id3; ?>' v-model='<?php echo $field; ?>.description' class='form-control' rows='3'></textarea>
2987
+                <label :for='<?php echo $id3; ?>'><?php _e('Help Text', 'invoicing'); ?></label>
2988
+                <textarea placeholder='<?php esc_attr_e('Add some help text for this element', 'invoicing'); ?>' :id='<?php echo $id3; ?>' v-model='<?php echo $field; ?>.description' class='form-control' rows='3'></textarea>
2989 2989
             </div>
2990 2990
 
2991 2991
         </div>
@@ -3004,7 +3004,7 @@  discard block
 block discarded – undo
3004 3004
             'orderby'        => 'title',
3005 3005
             'order'          => 'ASC',
3006 3006
             'posts_per_page' => -1,
3007
-            'post_status'    => array( 'publish' ),
3007
+            'post_status'    => array('publish'),
3008 3008
             'meta_query'     => array(
3009 3009
                 array(
3010 3010
                     'key'       => '_wpinv_type',
@@ -3014,15 +3014,15 @@  discard block
 block discarded – undo
3014 3014
             )
3015 3015
         );
3016 3016
 
3017
-        $items = get_posts( apply_filters( 'getpaid_payment_form_item_dropdown_query_args', $item_args ) );
3017
+        $items = get_posts(apply_filters('getpaid_payment_form_item_dropdown_query_args', $item_args));
3018 3018
 
3019
-        if ( empty( $items ) ) {
3019
+        if (empty($items)) {
3020 3020
             return array();
3021 3021
         }
3022 3022
 
3023
-        $options    = array();
3024
-        foreach ( $items as $item ) {
3025
-            $item      = new GetPaid_Form_Item( $item );
3023
+        $options = array();
3024
+        foreach ($items as $item) {
3025
+            $item      = new GetPaid_Form_Item($item);
3026 3026
             $options[] = $item->prepare_data_for_use();
3027 3027
         }
3028 3028
         return $options;
@@ -3032,39 +3032,39 @@  discard block
 block discarded – undo
3032 3032
     /**
3033 3033
      * Returns an array of items for the currently being edited form.
3034 3034
      */
3035
-    public function get_form_items( $id = false ) {
3036
-        $form = new GetPaid_Payment_Form( $id );
3035
+    public function get_form_items($id = false) {
3036
+        $form = new GetPaid_Payment_Form($id);
3037 3037
 
3038 3038
         // Is this a default form?
3039
-        if ( $form->is_default() ) {
3039
+        if ($form->is_default()) {
3040 3040
             return array();
3041 3041
         }
3042 3042
 
3043
-        return $form->get_items( 'view', 'arrays' );
3043
+        return $form->get_items('view', 'arrays');
3044 3044
     }
3045 3045
 
3046 3046
     /**
3047 3047
      * Converts form items for use.
3048 3048
      */
3049
-    public function convert_checkout_items( $items, $invoice ) {
3049
+    public function convert_checkout_items($items, $invoice) {
3050 3050
 
3051 3051
         $converted = array();
3052
-        foreach ( $items as $item ) {
3052
+        foreach ($items as $item) {
3053 3053
 
3054 3054
             $item_id = $item['id'];
3055
-            $_item   = new WPInv_Item( $item_id );
3055
+            $_item   = new WPInv_Item($item_id);
3056 3056
 
3057
-            if( ! $_item ) {
3057
+            if (!$_item) {
3058 3058
                 continue;
3059 3059
             }
3060 3060
 
3061 3061
             $converted[] = array(
3062
-                'title'            => esc_html( wpinv_get_cart_item_name( $item ) ) . wpinv_get_item_suffix( $_item ),
3062
+                'title'            => esc_html(wpinv_get_cart_item_name($item)) . wpinv_get_item_suffix($_item),
3063 3063
                 'id'               => $item['id'],
3064 3064
                 'price'            => $item['subtotal'],
3065 3065
                 'custom_price'     => $_item->get_is_dynamic_pricing(),
3066 3066
                 'recurring'        => $_item->is_recurring(),
3067
-                'description'      => apply_filters( 'wpinv_checkout_cart_line_item_summary', '', $item, $_item, $invoice ),
3067
+                'description'      => apply_filters('wpinv_checkout_cart_line_item_summary', '', $item, $_item, $invoice),
3068 3068
                 'minimum_price'    => $_item->get_minimum_price(),
3069 3069
                 'allow_quantities' => false,
3070 3070
                 'quantity'         => $item['quantity'],
@@ -3078,27 +3078,27 @@  discard block
 block discarded – undo
3078 3078
     /**
3079 3079
      * Converts an array of id => quantity for use.
3080 3080
      */
3081
-    public function convert_normal_items( $items ) {
3081
+    public function convert_normal_items($items) {
3082 3082
 
3083 3083
         $converted = array();
3084
-        foreach ( $items as $item_id => $quantity ) {
3084
+        foreach ($items as $item_id => $quantity) {
3085 3085
 
3086
-            $item   = new WPInv_Item( $item_id );
3086
+            $item = new WPInv_Item($item_id);
3087 3087
 
3088
-            if( ! $item ) {
3088
+            if (!$item) {
3089 3089
                 continue;
3090 3090
             }
3091 3091
 
3092 3092
             $converted[] = array(
3093
-                'title'            => esc_html( $item->get_name() ) . wpinv_get_item_suffix( $item ),
3093
+                'title'            => esc_html($item->get_name()) . wpinv_get_item_suffix($item),
3094 3094
                 'id'               => $item_id,
3095 3095
                 'price'            => $item->get_price(),
3096 3096
                 'custom_price'     => $item->get_is_dynamic_pricing(),
3097 3097
                 'recurring'        => $item->is_recurring(),
3098 3098
                 'description'      => $item->get_summary(),
3099 3099
                 'minimum_price'    => $item->get_minimum_price(),
3100
-                'allow_quantities' => ! empty( $quantity ),
3101
-                'quantity'         => empty( $quantity ) ? 1 : $quantity,
3100
+                'allow_quantities' => !empty($quantity),
3101
+                'quantity'         => empty($quantity) ? 1 : $quantity,
3102 3102
                 'required'         => true,
3103 3103
             );
3104 3104
 
@@ -3111,28 +3111,28 @@  discard block
 block discarded – undo
3111 3111
     /**
3112 3112
      * Returns an array of elements for the currently being edited form.
3113 3113
      */
3114
-    public function get_form_elements( $id = false ) {
3114
+    public function get_form_elements($id = false) {
3115 3115
 
3116
-        if ( empty( $id ) ) {
3117
-            return wpinv_get_data( 'sample-payment-form' );
3116
+        if (empty($id)) {
3117
+            return wpinv_get_data('sample-payment-form');
3118 3118
         }
3119 3119
         
3120
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
3120
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
3121 3121
 
3122
-        if ( is_array( $form_elements ) ) {
3122
+        if (is_array($form_elements)) {
3123 3123
             return $form_elements;
3124 3124
         }
3125 3125
 
3126
-        return wpinv_get_data( 'sample-payment-form' );
3126
+        return wpinv_get_data('sample-payment-form');
3127 3127
     }
3128 3128
 
3129 3129
     /**
3130 3130
      * Sends a redrect response to payment details.
3131 3131
      *
3132 3132
      */
3133
-    public function send_redirect_response( $url ) {
3134
-        $url = urlencode( $url );
3135
-        wp_send_json_success( $url );
3133
+    public function send_redirect_response($url) {
3134
+        $url = urlencode($url);
3135
+        wp_send_json_success($url);
3136 3136
     }
3137 3137
 
3138 3138
     /**
@@ -3143,12 +3143,12 @@  discard block
 block discarded – undo
3143 3143
 
3144 3144
         $errors = wpinv_get_errors();
3145 3145
 
3146
-        if ( ! empty( $errors ) ) {
3146
+        if (!empty($errors)) {
3147 3147
             wpinv_print_errors();
3148 3148
             exit;
3149 3149
         }
3150 3150
 
3151
-        wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) );
3151
+        wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing'));
3152 3152
         exit;
3153 3153
 
3154 3154
     }
Please login to merge, or discard this patch.
includes/class-getpaid-form-item.php 2 patches
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,32 +10,32 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Form_Item  extends WPInv_Item {
11 11
 
12 12
     /**
13
-	 * Stores a custom description for the item.
14
-	 *
15
-	 * @var string
16
-	 */
17
-	protected $custom_description = '';
18
-
19
-	/**
20
-	 * Stores the item quantity.
21
-	 *
22
-	 * @var int
23
-	 */
24
-	protected $quantity = 1;
25
-
26
-	/**
27
-	 * Is this item required?
28
-	 *
29
-	 * @var int
30
-	 */
31
-	protected $is_required = true;
32
-
33
-	/**
34
-	 * Are quantities allowed?
35
-	 *
36
-	 * @var int
37
-	 */
38
-	protected $allow_quantities = false;
13
+     * Stores a custom description for the item.
14
+     *
15
+     * @var string
16
+     */
17
+    protected $custom_description = '';
18
+
19
+    /**
20
+     * Stores the item quantity.
21
+     *
22
+     * @var int
23
+     */
24
+    protected $quantity = 1;
25
+
26
+    /**
27
+     * Is this item required?
28
+     *
29
+     * @var int
30
+     */
31
+    protected $is_required = true;
32
+
33
+    /**
34
+     * Are quantities allowed?
35
+     *
36
+     * @var int
37
+     */
38
+    protected $allow_quantities = false;
39 39
 
40 40
     /*
41 41
 	|--------------------------------------------------------------------------
@@ -53,109 +53,109 @@  discard block
 block discarded – undo
53 53
     */
54 54
 
55 55
     /**
56
-	 * Get the item name.
57
-	 *
58
-	 * @since 1.0.19
59
-	 * @param  string $context View or edit context.
60
-	 * @return string
61
-	 */
62
-	public function get_name( $context = 'view' ) {
63
-		$name = parent::get_name( $context );
64
-		return $name . wpinv_get_item_suffix( $this );
65
-	}
66
-
67
-	/**
68
-	 * Get the item description.
69
-	 *
70
-	 * @since 1.0.19
71
-	 * @param  string $context View or edit context.
72
-	 * @return string
73
-	 */
74
-	public function get_description( $context = 'view' ) {
75
-
76
-		if ( ! empty( $this->custom_description ) ) {
77
-			return $this->custom_description;
78
-		}
79
-
80
-		return parent::get_description( $context );
81
-	}
56
+     * Get the item name.
57
+     *
58
+     * @since 1.0.19
59
+     * @param  string $context View or edit context.
60
+     * @return string
61
+     */
62
+    public function get_name( $context = 'view' ) {
63
+        $name = parent::get_name( $context );
64
+        return $name . wpinv_get_item_suffix( $this );
65
+    }
66
+
67
+    /**
68
+     * Get the item description.
69
+     *
70
+     * @since 1.0.19
71
+     * @param  string $context View or edit context.
72
+     * @return string
73
+     */
74
+    public function get_description( $context = 'view' ) {
75
+
76
+        if ( ! empty( $this->custom_description ) ) {
77
+            return $this->custom_description;
78
+        }
79
+
80
+        return parent::get_description( $context );
81
+    }
82 82
 	
83
-	/**
84
-	 * Get the item qantity.
85
-	 *
86
-	 * @since 1.0.19
87
-	 * @param  string $context View or edit context.
88
-	 * @return int
89
-	 */
90
-	public function get_qantity( $context = 'view' ) {
91
-		$quantity = (int) $this->quantity;
92
-
93
-		if ( empty( $quantity ) || 1 > $quantity ) {
94
-			$quantity = 1;
95
-		}
96
-
97
-		if ( 'view' == $context ) {
98
-			return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
99
-		}
100
-
101
-		return $quantity;
102
-
103
-	}
104
-
105
-	/**
106
-	 * Returns whether or not customers can update the item quantity.
107
-	 *
108
-	 * @since 1.0.19
109
-	 * @param  string $context View or edit context.
110
-	 * @return bool
111
-	 */
112
-	public function get_allow_quantities( $context = 'view' ) {
113
-		$allow_quantities = (bool) $this->allow_quantities;
114
-
115
-		if ( 'view' == $context ) {
116
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
117
-		}
118
-
119
-		return $allow_quantities;
120
-
121
-	}
122
-
123
-	/**
124
-	 * Returns whether or not the item is required.
125
-	 *
126
-	 * @since 1.0.19
127
-	 * @param  string $context View or edit context.
128
-	 * @return bool
129
-	 */
130
-	public function get_is_required( $context = 'view' ) {
131
-		$is_required = (bool) $this->is_required;
132
-
133
-		if ( 'view' == $context ) {
134
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
135
-		}
136
-
137
-		return $is_required;
138
-
139
-	}
140
-
141
-	/**
142
-	 * Prepares form data for use.
143
-	 *
144
-	 * @since 1.0.19
145
-	 * @param  string $context View or edit context.
146
-	 * @return array
147
-	 */
148
-	public function prepare_data_for_use() {
149
-
150
-		return array(
151
-			'title'            => sanitize_text_field( $this->get_name() ),
152
-			'id'               => $this->get_id(),
153
-			'price'            => $this->get_price(),
154
-			'recurring'        => $this->is_recurring(),
155
-			'description'      => $this->get_description(),
156
-			'allow_quantities' => $this->get_allow_quantities(),
83
+    /**
84
+     * Get the item qantity.
85
+     *
86
+     * @since 1.0.19
87
+     * @param  string $context View or edit context.
88
+     * @return int
89
+     */
90
+    public function get_qantity( $context = 'view' ) {
91
+        $quantity = (int) $this->quantity;
92
+
93
+        if ( empty( $quantity ) || 1 > $quantity ) {
94
+            $quantity = 1;
95
+        }
96
+
97
+        if ( 'view' == $context ) {
98
+            return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
99
+        }
100
+
101
+        return $quantity;
102
+
103
+    }
104
+
105
+    /**
106
+     * Returns whether or not customers can update the item quantity.
107
+     *
108
+     * @since 1.0.19
109
+     * @param  string $context View or edit context.
110
+     * @return bool
111
+     */
112
+    public function get_allow_quantities( $context = 'view' ) {
113
+        $allow_quantities = (bool) $this->allow_quantities;
114
+
115
+        if ( 'view' == $context ) {
116
+            return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
117
+        }
118
+
119
+        return $allow_quantities;
120
+
121
+    }
122
+
123
+    /**
124
+     * Returns whether or not the item is required.
125
+     *
126
+     * @since 1.0.19
127
+     * @param  string $context View or edit context.
128
+     * @return bool
129
+     */
130
+    public function get_is_required( $context = 'view' ) {
131
+        $is_required = (bool) $this->is_required;
132
+
133
+        if ( 'view' == $context ) {
134
+            return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
135
+        }
136
+
137
+        return $is_required;
138
+
139
+    }
140
+
141
+    /**
142
+     * Prepares form data for use.
143
+     *
144
+     * @since 1.0.19
145
+     * @param  string $context View or edit context.
146
+     * @return array
147
+     */
148
+    public function prepare_data_for_use() {
149
+
150
+        return array(
151
+            'title'            => sanitize_text_field( $this->get_name() ),
152
+            'id'               => $this->get_id(),
153
+            'price'            => $this->get_price(),
154
+            'recurring'        => $this->is_recurring(),
155
+            'description'      => $this->get_description(),
156
+            'allow_quantities' => $this->get_allow_quantities(),
157 157
         );
158
-	}
158
+    }
159 159
 
160 160
     /*
161 161
 	|--------------------------------------------------------------------------
@@ -167,60 +167,60 @@  discard block
 block discarded – undo
167 167
 	| object.
168 168
     */
169 169
 
170
-	/**
171
-	 * Set the item qantity.
172
-	 *
173
-	 * @since 1.0.19
174
-	 * @param  int $quantity The item quantity.
175
-	 */
176
-	public function set_quantity( $quantity ) {
177
-
178
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
179
-			$quantity = 1;
180
-		}
181
-
182
-		$this->quantity = $quantity;
183
-
184
-	}
185
-
186
-	/**
187
-	 * Set whether or not the quantities are allowed.
188
-	 *
189
-	 * @since 1.0.19
190
-	 * @param  bool $allow_quantities
191
-	 */
192
-	public function set_allow_quantities( $allow_quantities ) {
193
-		$this->allow_quantities = (bool) $allow_quantities;
194
-	}
195
-
196
-	/**
197
-	 * Set whether or not the item is required.
198
-	 *
199
-	 * @since 1.0.19
200
-	 * @param  bool $is_required
201
-	 */
202
-	public function set_is_required( $is_required ) {
203
-		$this->is_required = (bool) $is_required;
204
-	}
205
-
206
-	/**
207
-	 * Sets the custom item description.
208
-	 *
209
-	 * @since 1.0.19
210
-	 * @param  string $description
211
-	 */
212
-	public function set_custom_description( $description ) {
213
-		$this->custom_description = $description;
214
-	}
170
+    /**
171
+     * Set the item qantity.
172
+     *
173
+     * @since 1.0.19
174
+     * @param  int $quantity The item quantity.
175
+     */
176
+    public function set_quantity( $quantity ) {
177
+
178
+        if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
179
+            $quantity = 1;
180
+        }
181
+
182
+        $this->quantity = $quantity;
183
+
184
+    }
185
+
186
+    /**
187
+     * Set whether or not the quantities are allowed.
188
+     *
189
+     * @since 1.0.19
190
+     * @param  bool $allow_quantities
191
+     */
192
+    public function set_allow_quantities( $allow_quantities ) {
193
+        $this->allow_quantities = (bool) $allow_quantities;
194
+    }
195
+
196
+    /**
197
+     * Set whether or not the item is required.
198
+     *
199
+     * @since 1.0.19
200
+     * @param  bool $is_required
201
+     */
202
+    public function set_is_required( $is_required ) {
203
+        $this->is_required = (bool) $is_required;
204
+    }
205
+
206
+    /**
207
+     * Sets the custom item description.
208
+     *
209
+     * @since 1.0.19
210
+     * @param  string $description
211
+     */
212
+    public function set_custom_description( $description ) {
213
+        $this->custom_description = $description;
214
+    }
215 215
 
216 216
     /**
217 217
      * We do not want to save items to the database.
218 218
      * 
219
-	 * @return int item id
219
+     * @return int item id
220 220
      */
221 221
     public function save( $data = array() ) {
222 222
         return $this->get_id();
223
-	}
223
+    }
224 224
 
225 225
     /*
226 226
 	|--------------------------------------------------------------------------
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 	*/
233 233
 
234 234
     /**
235
-	 * Checks whether the item has enabled dynamic pricing.
236
-	 *
237
-	 * @since 1.0.19
238
-	 * @return bool
239
-	 */
240
-	public function is_required() {
235
+     * Checks whether the item has enabled dynamic pricing.
236
+     *
237
+     * @since 1.0.19
238
+     * @return bool
239
+     */
240
+    public function is_required() {
241 241
         return (bool) $this->get_is_required();
242
-	}
242
+    }
243 243
 
244 244
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 * @param  string $context View or edit context.
60 60
 	 * @return string
61 61
 	 */
62
-	public function get_name( $context = 'view' ) {
63
-		$name = parent::get_name( $context );
64
-		return $name . wpinv_get_item_suffix( $this );
62
+	public function get_name($context = 'view') {
63
+		$name = parent::get_name($context);
64
+		return $name . wpinv_get_item_suffix($this);
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 	 * @param  string $context View or edit context.
72 72
 	 * @return string
73 73
 	 */
74
-	public function get_description( $context = 'view' ) {
74
+	public function get_description($context = 'view') {
75 75
 
76
-		if ( ! empty( $this->custom_description ) ) {
76
+		if (!empty($this->custom_description)) {
77 77
 			return $this->custom_description;
78 78
 		}
79 79
 
80
-		return parent::get_description( $context );
80
+		return parent::get_description($context);
81 81
 	}
82 82
 	
83 83
 	/**
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 	 * @param  string $context View or edit context.
88 88
 	 * @return int
89 89
 	 */
90
-	public function get_qantity( $context = 'view' ) {
90
+	public function get_qantity($context = 'view') {
91 91
 		$quantity = (int) $this->quantity;
92 92
 
93
-		if ( empty( $quantity ) || 1 > $quantity ) {
93
+		if (empty($quantity) || 1 > $quantity) {
94 94
 			$quantity = 1;
95 95
 		}
96 96
 
97
-		if ( 'view' == $context ) {
98
-			return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
97
+		if ('view' == $context) {
98
+			return apply_filters('getpaid_payment_form_item_quanity', $quantity, $this);
99 99
 		}
100 100
 
101 101
 		return $quantity;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 * @param  string $context View or edit context.
110 110
 	 * @return bool
111 111
 	 */
112
-	public function get_allow_quantities( $context = 'view' ) {
112
+	public function get_allow_quantities($context = 'view') {
113 113
 		$allow_quantities = (bool) $this->allow_quantities;
114 114
 
115
-		if ( 'view' == $context ) {
116
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
115
+		if ('view' == $context) {
116
+			return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this);
117 117
 		}
118 118
 
119 119
 		return $allow_quantities;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @param  string $context View or edit context.
128 128
 	 * @return bool
129 129
 	 */
130
-	public function get_is_required( $context = 'view' ) {
130
+	public function get_is_required($context = 'view') {
131 131
 		$is_required = (bool) $this->is_required;
132 132
 
133
-		if ( 'view' == $context ) {
134
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
133
+		if ('view' == $context) {
134
+			return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this);
135 135
 		}
136 136
 
137 137
 		return $is_required;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	public function prepare_data_for_use() {
149 149
 
150 150
 		return array(
151
-			'title'            => sanitize_text_field( $this->get_name() ),
151
+			'title'            => sanitize_text_field($this->get_name()),
152 152
 			'id'               => $this->get_id(),
153 153
 			'price'            => $this->get_price(),
154 154
 			'recurring'        => $this->is_recurring(),
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 * @since 1.0.19
174 174
 	 * @param  int $quantity The item quantity.
175 175
 	 */
176
-	public function set_quantity( $quantity ) {
176
+	public function set_quantity($quantity) {
177 177
 
178
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
178
+		if (empty($quantity) || !is_numeric($quantity)) {
179 179
 			$quantity = 1;
180 180
 		}
181 181
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @since 1.0.19
190 190
 	 * @param  bool $allow_quantities
191 191
 	 */
192
-	public function set_allow_quantities( $allow_quantities ) {
192
+	public function set_allow_quantities($allow_quantities) {
193 193
 		$this->allow_quantities = (bool) $allow_quantities;
194 194
 	}
195 195
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @since 1.0.19
200 200
 	 * @param  bool $is_required
201 201
 	 */
202
-	public function set_is_required( $is_required ) {
202
+	public function set_is_required($is_required) {
203 203
 		$this->is_required = (bool) $is_required;
204 204
 	}
205 205
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @since 1.0.19
210 210
 	 * @param  string $description
211 211
 	 */
212
-	public function set_custom_description( $description ) {
212
+	public function set_custom_description($description) {
213 213
 		$this->custom_description = $description;
214 214
 	}
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * 
219 219
 	 * @return int item id
220 220
      */
221
-    public function save( $data = array() ) {
221
+    public function save($data = array()) {
222 222
         return $this->get_id();
223 223
 	}
224 224
 
Please login to merge, or discard this patch.
includes/class-getpaid-payment-form.php 2 patches
Indentation   +359 added lines, -359 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,48 +10,48 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Payment_Form  extends GetPaid_Data {
11 11
 
12 12
     /**
13
-	 * Which data store to load.
14
-	 *
15
-	 * @var string
16
-	 */
13
+     * Which data store to load.
14
+     *
15
+     * @var string
16
+     */
17 17
     protected $data_store_name = 'payment_form';
18 18
 
19 19
     /**
20
-	 * This is the name of this object type.
21
-	 *
22
-	 * @var string
23
-	 */
24
-	protected $object_type = 'payment_form';
20
+     * This is the name of this object type.
21
+     *
22
+     * @var string
23
+     */
24
+    protected $object_type = 'payment_form';
25 25
 
26 26
     /**
27
-	 * Form Data array. This is the core form data exposed in APIs.
28
-	 *
29
-	 * @since 1.0.19
30
-	 * @var array
31
-	 */
32
-	protected $data = array(
33
-		'status'               => 'draft',
34
-		'version'              => '',
35
-		'date_created'         => null,
27
+     * Form Data array. This is the core form data exposed in APIs.
28
+     *
29
+     * @since 1.0.19
30
+     * @var array
31
+     */
32
+    protected $data = array(
33
+        'status'               => 'draft',
34
+        'version'              => '',
35
+        'date_created'         => null,
36 36
         'date_modified'        => null,
37 37
         'name'                 => '',
38 38
         'author'               => 1,
39 39
         'elements'             => null,
40
-		'items'                => null,
41
-		'earned'               => 0,
42
-		'refunded'             => 0,
43
-		'cancelled'            => 0,
44
-		'failed'               => 0,
45
-	);
40
+        'items'                => null,
41
+        'earned'               => 0,
42
+        'refunded'             => 0,
43
+        'cancelled'            => 0,
44
+        'failed'               => 0,
45
+    );
46 46
 
47 47
     /**
48
-	 * Stores meta in cache for future reads.
49
-	 *
50
-	 * A group must be set to to enable caching.
51
-	 *
52
-	 * @var string
53
-	 */
54
-	protected $cache_group = 'getpaid_forms';
48
+     * Stores meta in cache for future reads.
49
+     *
50
+     * A group must be set to to enable caching.
51
+     *
52
+     * @var string
53
+     */
54
+    protected $cache_group = 'getpaid_forms';
55 55
 
56 56
     /**
57 57
      * Stores a reference to the original WP_Post object
@@ -61,32 +61,32 @@  discard block
 block discarded – undo
61 61
     protected $post = null;
62 62
 
63 63
     /**
64
-	 * Get the item if ID is passed, otherwise the item is new and empty.
65
-	 *
66
-	 * @param  int|object|WPInv_Item|WP_Post $item Item to read.
67
-	 */
68
-	public function __construct( $item = 0 ) {
69
-		parent::__construct( $item );
70
-
71
-		if ( is_numeric( $item ) && $item > 0 ) {
72
-			$this->set_id( $item );
73
-		} elseif ( $item instanceof self ) {
74
-			$this->set_id( $item->get_id() );
75
-		} elseif ( ! empty( $item->ID ) ) {
76
-			$this->set_id( $item->ID );
77
-		} else {
78
-			$this->set_object_read( true );
79
-		}
64
+     * Get the item if ID is passed, otherwise the item is new and empty.
65
+     *
66
+     * @param  int|object|WPInv_Item|WP_Post $item Item to read.
67
+     */
68
+    public function __construct( $item = 0 ) {
69
+        parent::__construct( $item );
70
+
71
+        if ( is_numeric( $item ) && $item > 0 ) {
72
+            $this->set_id( $item );
73
+        } elseif ( $item instanceof self ) {
74
+            $this->set_id( $item->get_id() );
75
+        } elseif ( ! empty( $item->ID ) ) {
76
+            $this->set_id( $item->ID );
77
+        } else {
78
+            $this->set_object_read( true );
79
+        }
80 80
 
81 81
         // Load the datastore.
82
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
82
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
83 83
 
84
-		if ( $this->get_id() > 0 ) {
84
+        if ( $this->get_id() > 0 ) {
85 85
             $this->post = get_post( $this->get_id() );
86
-			$this->data_store->read( $this );
86
+            $this->data_store->read( $this );
87 87
         }
88 88
 
89
-	}
89
+    }
90 90
 
91 91
     /*
92 92
 	|--------------------------------------------------------------------------
@@ -104,238 +104,238 @@  discard block
 block discarded – undo
104 104
     */
105 105
 
106 106
     /**
107
-	 * Get plugin version when the form was created.
108
-	 *
109
-	 * @since 1.0.19
110
-	 * @param  string $context View or edit context.
111
-	 * @return string
112
-	 */
113
-	public function get_version( $context = 'view' ) {
114
-		return $this->get_prop( 'version', $context );
107
+     * Get plugin version when the form was created.
108
+     *
109
+     * @since 1.0.19
110
+     * @param  string $context View or edit context.
111
+     * @return string
112
+     */
113
+    public function get_version( $context = 'view' ) {
114
+        return $this->get_prop( 'version', $context );
115 115
     }
116 116
 
117 117
     /**
118
-	 * Get date when the form was created.
119
-	 *
120
-	 * @since 1.0.19
121
-	 * @param  string $context View or edit context.
122
-	 * @return string
123
-	 */
124
-	public function get_date_created( $context = 'view' ) {
125
-		return $this->get_prop( 'date_created', $context );
118
+     * Get date when the form was created.
119
+     *
120
+     * @since 1.0.19
121
+     * @param  string $context View or edit context.
122
+     * @return string
123
+     */
124
+    public function get_date_created( $context = 'view' ) {
125
+        return $this->get_prop( 'date_created', $context );
126 126
     }
127 127
 
128 128
     /**
129
-	 * Get GMT date when the form was created.
130
-	 *
131
-	 * @since 1.0.19
132
-	 * @param  string $context View or edit context.
133
-	 * @return string
134
-	 */
135
-	public function get_date_created_gmt( $context = 'view' ) {
129
+     * Get GMT date when the form was created.
130
+     *
131
+     * @since 1.0.19
132
+     * @param  string $context View or edit context.
133
+     * @return string
134
+     */
135
+    public function get_date_created_gmt( $context = 'view' ) {
136 136
         $date = $this->get_date_created( $context );
137 137
 
138 138
         if ( $date ) {
139 139
             $date = get_gmt_from_date( $date );
140 140
         }
141
-		return $date;
141
+        return $date;
142 142
     }
143 143
 
144 144
     /**
145
-	 * Get date when the form was last modified.
146
-	 *
147
-	 * @since 1.0.19
148
-	 * @param  string $context View or edit context.
149
-	 * @return string
150
-	 */
151
-	public function get_date_modified( $context = 'view' ) {
152
-		return $this->get_prop( 'date_modified', $context );
145
+     * Get date when the form was last modified.
146
+     *
147
+     * @since 1.0.19
148
+     * @param  string $context View or edit context.
149
+     * @return string
150
+     */
151
+    public function get_date_modified( $context = 'view' ) {
152
+        return $this->get_prop( 'date_modified', $context );
153 153
     }
154 154
 
155 155
     /**
156
-	 * Get GMT date when the form was last modified.
157
-	 *
158
-	 * @since 1.0.19
159
-	 * @param  string $context View or edit context.
160
-	 * @return string
161
-	 */
162
-	public function get_date_modified_gmt( $context = 'view' ) {
156
+     * Get GMT date when the form was last modified.
157
+     *
158
+     * @since 1.0.19
159
+     * @param  string $context View or edit context.
160
+     * @return string
161
+     */
162
+    public function get_date_modified_gmt( $context = 'view' ) {
163 163
         $date = $this->get_date_modified( $context );
164 164
 
165 165
         if ( $date ) {
166 166
             $date = get_gmt_from_date( $date );
167 167
         }
168
-		return $date;
168
+        return $date;
169 169
     }
170 170
 
171 171
     /**
172
-	 * Get the form name.
173
-	 *
174
-	 * @since 1.0.19
175
-	 * @param  string $context View or edit context.
176
-	 * @return string
177
-	 */
178
-	public function get_name( $context = 'view' ) {
179
-		return $this->get_prop( 'name', $context );
172
+     * Get the form name.
173
+     *
174
+     * @since 1.0.19
175
+     * @param  string $context View or edit context.
176
+     * @return string
177
+     */
178
+    public function get_name( $context = 'view' ) {
179
+        return $this->get_prop( 'name', $context );
180 180
     }
181 181
 
182 182
     /**
183
-	 * Alias of self::get_name().
184
-	 *
185
-	 * @since 1.0.19
186
-	 * @param  string $context View or edit context.
187
-	 * @return string
188
-	 */
189
-	public function get_title( $context = 'view' ) {
190
-		return $this->get_name( $context );
191
-	}
192
-
193
-    /**
194
-	 * Get the owner of the form.
195
-	 *
196
-	 * @since 1.0.19
197
-	 * @param  string $context View or edit context.
198
-	 * @return int
199
-	 */
200
-	public function get_author( $context = 'view' ) {
201
-		return (int) $this->get_prop( 'author', $context );
183
+     * Alias of self::get_name().
184
+     *
185
+     * @since 1.0.19
186
+     * @param  string $context View or edit context.
187
+     * @return string
188
+     */
189
+    public function get_title( $context = 'view' ) {
190
+        return $this->get_name( $context );
202 191
     }
203 192
 
204 193
     /**
205
-	 * Get the elements that make up the form.
206
-	 *
207
-	 * @since 1.0.19
208
-	 * @param  string $context View or edit context.
209
-	 * @return array
210
-	 */
211
-	public function get_elements( $context = 'view' ) {
212
-		$elements = $this->get_prop( 'elements', $context );
194
+     * Get the owner of the form.
195
+     *
196
+     * @since 1.0.19
197
+     * @param  string $context View or edit context.
198
+     * @return int
199
+     */
200
+    public function get_author( $context = 'view' ) {
201
+        return (int) $this->get_prop( 'author', $context );
202
+    }
203
+
204
+    /**
205
+     * Get the elements that make up the form.
206
+     *
207
+     * @since 1.0.19
208
+     * @param  string $context View or edit context.
209
+     * @return array
210
+     */
211
+    public function get_elements( $context = 'view' ) {
212
+        $elements = $this->get_prop( 'elements', $context );
213 213
 
214
-		if ( empty( $elements ) || ! is_array( $elements ) ) {
214
+        if ( empty( $elements ) || ! is_array( $elements ) ) {
215 215
             return wpinv_get_data( 'sample-payment-form' );
216 216
         }
217 217
         return $elements;
218
-	}
219
-
220
-	/**
221
-	 * Get the items sold via the form.
222
-	 *
223
-	 * @since 1.0.19
224
-	 * @param  string $context View or edit context.
225
-	 * @param  string $return objects or arrays.
226
-	 * @return GetPaid_Form_Item[]|array
227
-	 */
228
-	public function get_items( $context = 'view', $return = 'objects' ) {
229
-		$items = $this->get_prop( 'items', $context );
230
-
231
-		if ( empty( $items ) || ! is_array( $items ) ) {
218
+    }
219
+
220
+    /**
221
+     * Get the items sold via the form.
222
+     *
223
+     * @since 1.0.19
224
+     * @param  string $context View or edit context.
225
+     * @param  string $return objects or arrays.
226
+     * @return GetPaid_Form_Item[]|array
227
+     */
228
+    public function get_items( $context = 'view', $return = 'objects' ) {
229
+        $items = $this->get_prop( 'items', $context );
230
+
231
+        if ( empty( $items ) || ! is_array( $items ) ) {
232 232
             $items = wpinv_get_data( 'sample-payment-form-items' );
233
-		}
233
+        }
234 234
 		
235
-		if ( 'view' != $context ) {
236
-			return $items;
237
-		}
235
+        if ( 'view' != $context ) {
236
+            return $items;
237
+        }
238 238
 
239
-		// Convert the items.
240
-		$prepared = array();
239
+        // Convert the items.
240
+        $prepared = array();
241 241
 
242
-		foreach ( $items as $key => $value ) {
242
+        foreach ( $items as $key => $value ) {
243 243
 
244
-			// $item_id => $quantity
245
-			if ( is_numeric( $key ) && is_numeric( $value ) ) {
246
-				$item   = new GetPaid_Form_Item( $key );
244
+            // $item_id => $quantity
245
+            if ( is_numeric( $key ) && is_numeric( $value ) ) {
246
+                $item   = new GetPaid_Form_Item( $key );
247 247
 
248
-				if ( $item->can_purchase() ) {
249
-					$item->set_quantity( $value );
250
-					$prepared[] = $item;
251
-				}
248
+                if ( $item->can_purchase() ) {
249
+                    $item->set_quantity( $value );
250
+                    $prepared[] = $item;
251
+                }
252 252
 
253
-				continue;
254
-			}
253
+                continue;
254
+            }
255 255
 
256
-			if ( is_array( $value ) && isset( $value['id'] ) ) {
256
+            if ( is_array( $value ) && isset( $value['id'] ) ) {
257 257
 
258
-				$item = new GetPaid_Form_Item( $value['id'] );
258
+                $item = new GetPaid_Form_Item( $value['id'] );
259 259
 
260
-				if ( ! $item->can_purchase() ) {
261
-					continue;
262
-				}
260
+                if ( ! $item->can_purchase() ) {
261
+                    continue;
262
+                }
263 263
 
264
-				// Cart items.
265
-				if ( isset( $value['subtotal'] ) ) {
266
-					$item->set_price( $value['subtotal'] );
267
-					$item->set_quantity( $value['quantity'] );
268
-					$prepared[] = $item;
269
-					continue;
270
-				}
264
+                // Cart items.
265
+                if ( isset( $value['subtotal'] ) ) {
266
+                    $item->set_price( $value['subtotal'] );
267
+                    $item->set_quantity( $value['quantity'] );
268
+                    $prepared[] = $item;
269
+                    continue;
270
+                }
271 271
 
272
-				// Payment form item.
273
-				$item->set_quantity( $value['quantity'] );
274
-				$item->set_allow_quantities( $value['allow_quantities'] );
275
-				$item->set_is_required( $value['required'] );
276
-				$item->set_custom_description( $value['description'] );
277
-				$prepared[] = $item;
278
-				continue;
272
+                // Payment form item.
273
+                $item->set_quantity( $value['quantity'] );
274
+                $item->set_allow_quantities( $value['allow_quantities'] );
275
+                $item->set_is_required( $value['required'] );
276
+                $item->set_custom_description( $value['description'] );
277
+                $prepared[] = $item;
278
+                continue;
279 279
 
280
-			}
281
-		}
280
+            }
281
+        }
282 282
 
283 283
 
284
-		if ( 'objects' == $return ) {
285
-			return $prepared;
286
-		}
284
+        if ( 'objects' == $return ) {
285
+            return $prepared;
286
+        }
287 287
 		
288
-		$items = array();
289
-		foreach ( $prepared as $item ) {
290
-			$items[] = $item->prepare_data_for_use();
291
-		}
292
-
293
-		return $items;
294
-	}
295
-
296
-	/**
297
-	 * Get the total amount earned via this form.
298
-	 *
299
-	 * @since 1.0.19
300
-	 * @param  string $context View or edit context.
301
-	 * @return array
302
-	 */
303
-	public function get_earned( $context = 'view' ) {
304
-		return $this->get_prop( 'earned', $context );
305
-	}
306
-
307
-	/**
308
-	 * Get the total amount refunded via this form.
309
-	 *
310
-	 * @since 1.0.19
311
-	 * @param  string $context View or edit context.
312
-	 * @return array
313
-	 */
314
-	public function get_refunded( $context = 'view' ) {
315
-		return $this->get_prop( 'refunded', $context );
316
-	}
317
-
318
-	/**
319
-	 * Get the total amount cancelled via this form.
320
-	 *
321
-	 * @since 1.0.19
322
-	 * @param  string $context View or edit context.
323
-	 * @return array
324
-	 */
325
-	public function get_cancelled( $context = 'view' ) {
326
-		return $this->get_prop( 'cancelled', $context );
327
-	}
328
-
329
-	/**
330
-	 * Get the total amount failed via this form.
331
-	 *
332
-	 * @since 1.0.19
333
-	 * @param  string $context View or edit context.
334
-	 * @return array
335
-	 */
336
-	public function get_failed( $context = 'view' ) {
337
-		return $this->get_prop( 'failed', $context );
338
-	}
288
+        $items = array();
289
+        foreach ( $prepared as $item ) {
290
+            $items[] = $item->prepare_data_for_use();
291
+        }
292
+
293
+        return $items;
294
+    }
295
+
296
+    /**
297
+     * Get the total amount earned via this form.
298
+     *
299
+     * @since 1.0.19
300
+     * @param  string $context View or edit context.
301
+     * @return array
302
+     */
303
+    public function get_earned( $context = 'view' ) {
304
+        return $this->get_prop( 'earned', $context );
305
+    }
306
+
307
+    /**
308
+     * Get the total amount refunded via this form.
309
+     *
310
+     * @since 1.0.19
311
+     * @param  string $context View or edit context.
312
+     * @return array
313
+     */
314
+    public function get_refunded( $context = 'view' ) {
315
+        return $this->get_prop( 'refunded', $context );
316
+    }
317
+
318
+    /**
319
+     * Get the total amount cancelled via this form.
320
+     *
321
+     * @since 1.0.19
322
+     * @param  string $context View or edit context.
323
+     * @return array
324
+     */
325
+    public function get_cancelled( $context = 'view' ) {
326
+        return $this->get_prop( 'cancelled', $context );
327
+    }
328
+
329
+    /**
330
+     * Get the total amount failed via this form.
331
+     *
332
+     * @since 1.0.19
333
+     * @param  string $context View or edit context.
334
+     * @return array
335
+     */
336
+    public function get_failed( $context = 'view' ) {
337
+        return $this->get_prop( 'failed', $context );
338
+    }
339 339
 
340 340
     /*
341 341
 	|--------------------------------------------------------------------------
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
     */
349 349
 
350 350
     /**
351
-	 * Set plugin version when the item was created.
352
-	 *
353
-	 * @since 1.0.19
354
-	 */
355
-	public function set_version( $value ) {
356
-		$this->set_prop( 'version', $value );
351
+     * Set plugin version when the item was created.
352
+     *
353
+     * @since 1.0.19
354
+     */
355
+    public function set_version( $value ) {
356
+        $this->set_prop( 'version', $value );
357 357
     }
358 358
 
359 359
     /**
360
-	 * Set date when the item was created.
361
-	 *
362
-	 * @since 1.0.19
363
-	 * @param string $value Value to set.
360
+     * Set date when the item was created.
361
+     *
362
+     * @since 1.0.19
363
+     * @param string $value Value to set.
364 364
      * @return bool Whether or not the date was set.
365
-	 */
366
-	public function set_date_created( $value ) {
365
+     */
366
+    public function set_date_created( $value ) {
367 367
         $date = strtotime( $value );
368 368
 
369 369
         if ( $date ) {
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
     }
377 377
 
378 378
     /**
379
-	 * Set date when the item was last modified.
380
-	 *
381
-	 * @since 1.0.19
382
-	 * @param string $value Value to set.
379
+     * Set date when the item was last modified.
380
+     *
381
+     * @since 1.0.19
382
+     * @param string $value Value to set.
383 383
      * @return bool Whether or not the date was set.
384
-	 */
385
-	public function set_date_modified( $value ) {
384
+     */
385
+    public function set_date_modified( $value ) {
386 386
         $date = strtotime( $value );
387 387
 
388 388
         if ( $date ) {
@@ -395,118 +395,118 @@  discard block
 block discarded – undo
395 395
     }
396 396
 
397 397
     /**
398
-	 * Set the item name.
399
-	 *
400
-	 * @since 1.0.19
401
-	 * @param  string $value New name.
402
-	 */
403
-	public function set_name( $value ) {
404
-		$this->set_prop( 'name', sanitize_text_field( $value ) );
398
+     * Set the item name.
399
+     *
400
+     * @since 1.0.19
401
+     * @param  string $value New name.
402
+     */
403
+    public function set_name( $value ) {
404
+        $this->set_prop( 'name', sanitize_text_field( $value ) );
405
+    }
406
+
407
+    /**
408
+     * Alias of self::set_name().
409
+     *
410
+     * @since 1.0.19
411
+     * @param  string $value New name.
412
+     */
413
+    public function set_title( $value ) {
414
+        $this->set_name( $value );
405 415
     }
406 416
 
407 417
     /**
408
-	 * Alias of self::set_name().
409
-	 *
410
-	 * @since 1.0.19
411
-	 * @param  string $value New name.
412
-	 */
413
-	public function set_title( $value ) {
414
-		$this->set_name( $value );
418
+     * Set the owner of the item.
419
+     *
420
+     * @since 1.0.19
421
+     * @param  int $value New author.
422
+     */
423
+    public function set_author( $value ) {
424
+        $this->set_prop( 'author', (int) $value );
425
+    }
426
+
427
+    /**
428
+     * Set the form elements.
429
+     *
430
+     * @since 1.0.19
431
+     * @param  array $value Form elements.
432
+     */
433
+    public function set_elements( $value ) {
434
+        if ( is_array( $value ) ) {
435
+            $this->set_prop( 'elements', $value );
436
+        }
415 437
     }
416 438
 
417 439
     /**
418
-	 * Set the owner of the item.
419
-	 *
420
-	 * @since 1.0.19
421
-	 * @param  int $value New author.
422
-	 */
423
-	public function set_author( $value ) {
424
-		$this->set_prop( 'author', (int) $value );
425
-	}
426
-
427
-	/**
428
-	 * Set the form elements.
429
-	 *
430
-	 * @since 1.0.19
431
-	 * @param  array $value Form elements.
432
-	 */
433
-	public function set_elements( $value ) {
434
-		if ( is_array( $value ) ) {
435
-			$this->set_prop( 'elements', $value );
436
-		}
437
-	}
438
-
439
-	/**
440
-	 * Set the form items.
441
-	 *
442
-	 * @since 1.0.19
443
-	 * @param  array $value Form elements.
444
-	 */
445
-	public function set_items( $value ) {
446
-		if ( is_array( $value ) ) {
447
-			$this->set_prop( 'items', $value );
448
-		}
449
-	}
440
+     * Set the form items.
441
+     *
442
+     * @since 1.0.19
443
+     * @param  array $value Form elements.
444
+     */
445
+    public function set_items( $value ) {
446
+        if ( is_array( $value ) ) {
447
+            $this->set_prop( 'items', $value );
448
+        }
449
+    }
450 450
 	
451
-	/**
452
-	 * Set the total amount earned via this form.
453
-	 *
454
-	 * @since 1.0.19
455
-	 * @param  float $value Amount earned.
456
-	 * @return array
457
-	 */
458
-	public function set_earned( $value ) {
459
-		return $this->set_prop( 'earned', $value );
460
-	}
461
-
462
-	/**
463
-	 * Set the total amount refunded via this form.
464
-	 *
465
-	 * @since 1.0.19
466
-	 * @param  float $value Amount refunded.
467
-	 * @return array
468
-	 */
469
-	public function set_refunded( $value ) {
470
-		return $this->set_prop( 'refunded', $value );
471
-	}
472
-
473
-	/**
474
-	 * Set the total amount cancelled via this form.
475
-	 *
476
-	 * @since 1.0.19
477
-	 * @param  float $value Amount cancelled.
478
-	 * @return array
479
-	 */
480
-	public function set_cancelled( $value ) {
481
-		return $this->set_prop( 'cancelled', $value );
482
-	}
483
-
484
-	/**
485
-	 * Set the total amount failed via this form.
486
-	 *
487
-	 * @since 1.0.19
488
-	 * @param  float $value Amount cancelled.
489
-	 * @return array
490
-	 */
491
-	public function set_failed( $value ) {
492
-		return $this->set_prop( 'failed', $value );
493
-	}
451
+    /**
452
+     * Set the total amount earned via this form.
453
+     *
454
+     * @since 1.0.19
455
+     * @param  float $value Amount earned.
456
+     * @return array
457
+     */
458
+    public function set_earned( $value ) {
459
+        return $this->set_prop( 'earned', $value );
460
+    }
461
+
462
+    /**
463
+     * Set the total amount refunded via this form.
464
+     *
465
+     * @since 1.0.19
466
+     * @param  float $value Amount refunded.
467
+     * @return array
468
+     */
469
+    public function set_refunded( $value ) {
470
+        return $this->set_prop( 'refunded', $value );
471
+    }
472
+
473
+    /**
474
+     * Set the total amount cancelled via this form.
475
+     *
476
+     * @since 1.0.19
477
+     * @param  float $value Amount cancelled.
478
+     * @return array
479
+     */
480
+    public function set_cancelled( $value ) {
481
+        return $this->set_prop( 'cancelled', $value );
482
+    }
483
+
484
+    /**
485
+     * Set the total amount failed via this form.
486
+     *
487
+     * @since 1.0.19
488
+     * @param  float $value Amount cancelled.
489
+     * @return array
490
+     */
491
+    public function set_failed( $value ) {
492
+        return $this->set_prop( 'failed', $value );
493
+    }
494 494
 
495 495
     /**
496 496
      * Create an item. For backwards compatibilty.
497 497
      *
498 498
      * @deprecated
499
-	 * @return int item id
499
+     * @return int item id
500 500
      */
501 501
     public function create( $data = array() ) {
502 502
 
503
-		// Set the properties.
504
-		if ( is_array( $data ) ) {
505
-			$this->set_props( $data );
506
-		}
503
+        // Set the properties.
504
+        if ( is_array( $data ) ) {
505
+            $this->set_props( $data );
506
+        }
507 507
 
508
-		// Save the item.
509
-		return $this->save();
508
+        // Save the item.
509
+        return $this->save();
510 510
 
511 511
     }
512 512
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      * Updates an item. For backwards compatibilty.
515 515
      *
516 516
      * @deprecated
517
-	 * @return int item id
517
+     * @return int item id
518 518
      */
519 519
     public function update( $data = array() ) {
520 520
         return $this->create( $data );
@@ -530,22 +530,22 @@  discard block
 block discarded – undo
530 530
 	*/
531 531
 
532 532
     /**
533
-	 * Checks whether this is the default payment form.
534
-	 *
535
-	 * @since 1.0.19
536
-	 * @return bool
537
-	 */
533
+     * Checks whether this is the default payment form.
534
+     *
535
+     * @since 1.0.19
536
+     * @return bool
537
+     */
538 538
     public function is_default() {
539 539
         $is_default = $this->get_id() == wpinv_get_default_payment_form();
540 540
         return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->ID, $this );
541
-	}
541
+    }
542 542
 
543 543
     /**
544
-	 * Checks whether the form is active.
545
-	 *
546
-	 * @since 1.0.19
547
-	 * @return bool
548
-	 */
544
+     * Checks whether the form is active.
545
+     *
546
+     * @since 1.0.19
547
+     * @return bool
548
+     */
549 549
     public function is_active() {
550 550
         $is_active = null !== $this->get_id();
551 551
 
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -65,25 +65,25 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param  int|object|WPInv_Item|WP_Post $item Item to read.
67 67
 	 */
68
-	public function __construct( $item = 0 ) {
69
-		parent::__construct( $item );
68
+	public function __construct($item = 0) {
69
+		parent::__construct($item);
70 70
 
71
-		if ( is_numeric( $item ) && $item > 0 ) {
72
-			$this->set_id( $item );
73
-		} elseif ( $item instanceof self ) {
74
-			$this->set_id( $item->get_id() );
75
-		} elseif ( ! empty( $item->ID ) ) {
76
-			$this->set_id( $item->ID );
71
+		if (is_numeric($item) && $item > 0) {
72
+			$this->set_id($item);
73
+		} elseif ($item instanceof self) {
74
+			$this->set_id($item->get_id());
75
+		} elseif (!empty($item->ID)) {
76
+			$this->set_id($item->ID);
77 77
 		} else {
78
-			$this->set_object_read( true );
78
+			$this->set_object_read(true);
79 79
 		}
80 80
 
81 81
         // Load the datastore.
82
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
82
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
83 83
 
84
-		if ( $this->get_id() > 0 ) {
85
-            $this->post = get_post( $this->get_id() );
86
-			$this->data_store->read( $this );
84
+		if ($this->get_id() > 0) {
85
+            $this->post = get_post($this->get_id());
86
+			$this->data_store->read($this);
87 87
         }
88 88
 
89 89
 	}
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $context View or edit context.
111 111
 	 * @return string
112 112
 	 */
113
-	public function get_version( $context = 'view' ) {
114
-		return $this->get_prop( 'version', $context );
113
+	public function get_version($context = 'view') {
114
+		return $this->get_prop('version', $context);
115 115
     }
116 116
 
117 117
     /**
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param  string $context View or edit context.
122 122
 	 * @return string
123 123
 	 */
124
-	public function get_date_created( $context = 'view' ) {
125
-		return $this->get_prop( 'date_created', $context );
124
+	public function get_date_created($context = 'view') {
125
+		return $this->get_prop('date_created', $context);
126 126
     }
127 127
 
128 128
     /**
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	 * @param  string $context View or edit context.
133 133
 	 * @return string
134 134
 	 */
135
-	public function get_date_created_gmt( $context = 'view' ) {
136
-        $date = $this->get_date_created( $context );
135
+	public function get_date_created_gmt($context = 'view') {
136
+        $date = $this->get_date_created($context);
137 137
 
138
-        if ( $date ) {
139
-            $date = get_gmt_from_date( $date );
138
+        if ($date) {
139
+            $date = get_gmt_from_date($date);
140 140
         }
141 141
 		return $date;
142 142
     }
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $context View or edit context.
149 149
 	 * @return string
150 150
 	 */
151
-	public function get_date_modified( $context = 'view' ) {
152
-		return $this->get_prop( 'date_modified', $context );
151
+	public function get_date_modified($context = 'view') {
152
+		return $this->get_prop('date_modified', $context);
153 153
     }
154 154
 
155 155
     /**
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 * @param  string $context View or edit context.
160 160
 	 * @return string
161 161
 	 */
162
-	public function get_date_modified_gmt( $context = 'view' ) {
163
-        $date = $this->get_date_modified( $context );
162
+	public function get_date_modified_gmt($context = 'view') {
163
+        $date = $this->get_date_modified($context);
164 164
 
165
-        if ( $date ) {
166
-            $date = get_gmt_from_date( $date );
165
+        if ($date) {
166
+            $date = get_gmt_from_date($date);
167 167
         }
168 168
 		return $date;
169 169
     }
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @param  string $context View or edit context.
176 176
 	 * @return string
177 177
 	 */
178
-	public function get_name( $context = 'view' ) {
179
-		return $this->get_prop( 'name', $context );
178
+	public function get_name($context = 'view') {
179
+		return $this->get_prop('name', $context);
180 180
     }
181 181
 
182 182
     /**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param  string $context View or edit context.
187 187
 	 * @return string
188 188
 	 */
189
-	public function get_title( $context = 'view' ) {
190
-		return $this->get_name( $context );
189
+	public function get_title($context = 'view') {
190
+		return $this->get_name($context);
191 191
 	}
192 192
 
193 193
     /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param  string $context View or edit context.
198 198
 	 * @return int
199 199
 	 */
200
-	public function get_author( $context = 'view' ) {
201
-		return (int) $this->get_prop( 'author', $context );
200
+	public function get_author($context = 'view') {
201
+		return (int) $this->get_prop('author', $context);
202 202
     }
203 203
 
204 204
     /**
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param  string $context View or edit context.
209 209
 	 * @return array
210 210
 	 */
211
-	public function get_elements( $context = 'view' ) {
212
-		$elements = $this->get_prop( 'elements', $context );
211
+	public function get_elements($context = 'view') {
212
+		$elements = $this->get_prop('elements', $context);
213 213
 
214
-		if ( empty( $elements ) || ! is_array( $elements ) ) {
215
-            return wpinv_get_data( 'sample-payment-form' );
214
+		if (empty($elements) || !is_array($elements)) {
215
+            return wpinv_get_data('sample-payment-form');
216 216
         }
217 217
         return $elements;
218 218
 	}
@@ -225,55 +225,55 @@  discard block
 block discarded – undo
225 225
 	 * @param  string $return objects or arrays.
226 226
 	 * @return GetPaid_Form_Item[]|array
227 227
 	 */
228
-	public function get_items( $context = 'view', $return = 'objects' ) {
229
-		$items = $this->get_prop( 'items', $context );
228
+	public function get_items($context = 'view', $return = 'objects') {
229
+		$items = $this->get_prop('items', $context);
230 230
 
231
-		if ( empty( $items ) || ! is_array( $items ) ) {
232
-            $items = wpinv_get_data( 'sample-payment-form-items' );
231
+		if (empty($items) || !is_array($items)) {
232
+            $items = wpinv_get_data('sample-payment-form-items');
233 233
 		}
234 234
 		
235
-		if ( 'view' != $context ) {
235
+		if ('view' != $context) {
236 236
 			return $items;
237 237
 		}
238 238
 
239 239
 		// Convert the items.
240 240
 		$prepared = array();
241 241
 
242
-		foreach ( $items as $key => $value ) {
242
+		foreach ($items as $key => $value) {
243 243
 
244 244
 			// $item_id => $quantity
245
-			if ( is_numeric( $key ) && is_numeric( $value ) ) {
246
-				$item   = new GetPaid_Form_Item( $key );
245
+			if (is_numeric($key) && is_numeric($value)) {
246
+				$item = new GetPaid_Form_Item($key);
247 247
 
248
-				if ( $item->can_purchase() ) {
249
-					$item->set_quantity( $value );
248
+				if ($item->can_purchase()) {
249
+					$item->set_quantity($value);
250 250
 					$prepared[] = $item;
251 251
 				}
252 252
 
253 253
 				continue;
254 254
 			}
255 255
 
256
-			if ( is_array( $value ) && isset( $value['id'] ) ) {
256
+			if (is_array($value) && isset($value['id'])) {
257 257
 
258
-				$item = new GetPaid_Form_Item( $value['id'] );
258
+				$item = new GetPaid_Form_Item($value['id']);
259 259
 
260
-				if ( ! $item->can_purchase() ) {
260
+				if (!$item->can_purchase()) {
261 261
 					continue;
262 262
 				}
263 263
 
264 264
 				// Cart items.
265
-				if ( isset( $value['subtotal'] ) ) {
266
-					$item->set_price( $value['subtotal'] );
267
-					$item->set_quantity( $value['quantity'] );
265
+				if (isset($value['subtotal'])) {
266
+					$item->set_price($value['subtotal']);
267
+					$item->set_quantity($value['quantity']);
268 268
 					$prepared[] = $item;
269 269
 					continue;
270 270
 				}
271 271
 
272 272
 				// Payment form item.
273
-				$item->set_quantity( $value['quantity'] );
274
-				$item->set_allow_quantities( $value['allow_quantities'] );
275
-				$item->set_is_required( $value['required'] );
276
-				$item->set_custom_description( $value['description'] );
273
+				$item->set_quantity($value['quantity']);
274
+				$item->set_allow_quantities($value['allow_quantities']);
275
+				$item->set_is_required($value['required']);
276
+				$item->set_custom_description($value['description']);
277 277
 				$prepared[] = $item;
278 278
 				continue;
279 279
 
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 		}
282 282
 
283 283
 
284
-		if ( 'objects' == $return ) {
284
+		if ('objects' == $return) {
285 285
 			return $prepared;
286 286
 		}
287 287
 		
288 288
 		$items = array();
289
-		foreach ( $prepared as $item ) {
289
+		foreach ($prepared as $item) {
290 290
 			$items[] = $item->prepare_data_for_use();
291 291
 		}
292 292
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 * @param  string $context View or edit context.
301 301
 	 * @return array
302 302
 	 */
303
-	public function get_earned( $context = 'view' ) {
304
-		return $this->get_prop( 'earned', $context );
303
+	public function get_earned($context = 'view') {
304
+		return $this->get_prop('earned', $context);
305 305
 	}
306 306
 
307 307
 	/**
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @param  string $context View or edit context.
312 312
 	 * @return array
313 313
 	 */
314
-	public function get_refunded( $context = 'view' ) {
315
-		return $this->get_prop( 'refunded', $context );
314
+	public function get_refunded($context = 'view') {
315
+		return $this->get_prop('refunded', $context);
316 316
 	}
317 317
 
318 318
 	/**
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 * @param  string $context View or edit context.
323 323
 	 * @return array
324 324
 	 */
325
-	public function get_cancelled( $context = 'view' ) {
326
-		return $this->get_prop( 'cancelled', $context );
325
+	public function get_cancelled($context = 'view') {
326
+		return $this->get_prop('cancelled', $context);
327 327
 	}
328 328
 
329 329
 	/**
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	 * @param  string $context View or edit context.
334 334
 	 * @return array
335 335
 	 */
336
-	public function get_failed( $context = 'view' ) {
337
-		return $this->get_prop( 'failed', $context );
336
+	public function get_failed($context = 'view') {
337
+		return $this->get_prop('failed', $context);
338 338
 	}
339 339
 
340 340
     /*
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @since 1.0.19
354 354
 	 */
355
-	public function set_version( $value ) {
356
-		$this->set_prop( 'version', $value );
355
+	public function set_version($value) {
356
+		$this->set_prop('version', $value);
357 357
     }
358 358
 
359 359
     /**
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 	 * @param string $value Value to set.
364 364
      * @return bool Whether or not the date was set.
365 365
 	 */
366
-	public function set_date_created( $value ) {
367
-        $date = strtotime( $value );
366
+	public function set_date_created($value) {
367
+        $date = strtotime($value);
368 368
 
369
-        if ( $date ) {
370
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
369
+        if ($date) {
370
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
371 371
             return true;
372 372
         }
373 373
 
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 	 * @param string $value Value to set.
383 383
      * @return bool Whether or not the date was set.
384 384
 	 */
385
-	public function set_date_modified( $value ) {
386
-        $date = strtotime( $value );
385
+	public function set_date_modified($value) {
386
+        $date = strtotime($value);
387 387
 
388
-        if ( $date ) {
389
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
388
+        if ($date) {
389
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
390 390
             return true;
391 391
         }
392 392
 
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 	 * @since 1.0.19
401 401
 	 * @param  string $value New name.
402 402
 	 */
403
-	public function set_name( $value ) {
404
-		$this->set_prop( 'name', sanitize_text_field( $value ) );
403
+	public function set_name($value) {
404
+		$this->set_prop('name', sanitize_text_field($value));
405 405
     }
406 406
 
407 407
     /**
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	 * @since 1.0.19
411 411
 	 * @param  string $value New name.
412 412
 	 */
413
-	public function set_title( $value ) {
414
-		$this->set_name( $value );
413
+	public function set_title($value) {
414
+		$this->set_name($value);
415 415
     }
416 416
 
417 417
     /**
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	 * @since 1.0.19
421 421
 	 * @param  int $value New author.
422 422
 	 */
423
-	public function set_author( $value ) {
424
-		$this->set_prop( 'author', (int) $value );
423
+	public function set_author($value) {
424
+		$this->set_prop('author', (int) $value);
425 425
 	}
426 426
 
427 427
 	/**
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 	 * @since 1.0.19
431 431
 	 * @param  array $value Form elements.
432 432
 	 */
433
-	public function set_elements( $value ) {
434
-		if ( is_array( $value ) ) {
435
-			$this->set_prop( 'elements', $value );
433
+	public function set_elements($value) {
434
+		if (is_array($value)) {
435
+			$this->set_prop('elements', $value);
436 436
 		}
437 437
 	}
438 438
 
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 	 * @since 1.0.19
443 443
 	 * @param  array $value Form elements.
444 444
 	 */
445
-	public function set_items( $value ) {
446
-		if ( is_array( $value ) ) {
447
-			$this->set_prop( 'items', $value );
445
+	public function set_items($value) {
446
+		if (is_array($value)) {
447
+			$this->set_prop('items', $value);
448 448
 		}
449 449
 	}
450 450
 	
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param  float $value Amount earned.
456 456
 	 * @return array
457 457
 	 */
458
-	public function set_earned( $value ) {
459
-		return $this->set_prop( 'earned', $value );
458
+	public function set_earned($value) {
459
+		return $this->set_prop('earned', $value);
460 460
 	}
461 461
 
462 462
 	/**
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param  float $value Amount refunded.
467 467
 	 * @return array
468 468
 	 */
469
-	public function set_refunded( $value ) {
470
-		return $this->set_prop( 'refunded', $value );
469
+	public function set_refunded($value) {
470
+		return $this->set_prop('refunded', $value);
471 471
 	}
472 472
 
473 473
 	/**
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @param  float $value Amount cancelled.
478 478
 	 * @return array
479 479
 	 */
480
-	public function set_cancelled( $value ) {
481
-		return $this->set_prop( 'cancelled', $value );
480
+	public function set_cancelled($value) {
481
+		return $this->set_prop('cancelled', $value);
482 482
 	}
483 483
 
484 484
 	/**
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 	 * @param  float $value Amount cancelled.
489 489
 	 * @return array
490 490
 	 */
491
-	public function set_failed( $value ) {
492
-		return $this->set_prop( 'failed', $value );
491
+	public function set_failed($value) {
492
+		return $this->set_prop('failed', $value);
493 493
 	}
494 494
 
495 495
     /**
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
      * @deprecated
499 499
 	 * @return int item id
500 500
      */
501
-    public function create( $data = array() ) {
501
+    public function create($data = array()) {
502 502
 
503 503
 		// Set the properties.
504
-		if ( is_array( $data ) ) {
505
-			$this->set_props( $data );
504
+		if (is_array($data)) {
505
+			$this->set_props($data);
506 506
 		}
507 507
 
508 508
 		// Save the item.
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
      * @deprecated
517 517
 	 * @return int item id
518 518
      */
519
-    public function update( $data = array() ) {
520
-        return $this->create( $data );
519
+    public function update($data = array()) {
520
+        return $this->create($data);
521 521
     }
522 522
 
523 523
     /*
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	 */
538 538
     public function is_default() {
539 539
         $is_default = $this->get_id() == wpinv_get_default_payment_form();
540
-        return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->ID, $this );
540
+        return (bool) apply_filters('wpinv_is_default_payment_form', $is_default, $this->ID, $this);
541 541
 	}
542 542
 
543 543
     /**
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
     public function is_active() {
550 550
         $is_active = null !== $this->get_id();
551 551
 
552
-        if ( ! current_user_can( 'edit_post', $this->ID ) && $this->post_status != 'publish' ) {
552
+        if (!current_user_can('edit_post', $this->ID) && $this->post_status != 'publish') {
553 553
             $is_active = false;
554 554
         }
555 555
 
556
-        return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this );
556
+        return (bool) apply_filters('wpinv_is_payment_form_active', $is_active, $this);
557 557
     }
558 558
 
559 559
 }
Please login to merge, or discard this patch.