Passed
Pull Request — master (#284)
by Brian
06:11
created
widgets/payment-form.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct() {
18 18
 
19
-		$forms = get_posts(
20
-			array(
21
-				'post_type'      => 'wpi_payment_form',
22
-				'orderby'        => 'title',
23
-				'order'          => 'ASC',
24
-				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
26
-			)
27
-		);
28
-
29
-		$options = array(
30
-			'' => __('Select a Form','invoicing')
31
-		);
32
-
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
35
-		}
19
+        $forms = get_posts(
20
+            array(
21
+                'post_type'      => 'wpi_payment_form',
22
+                'orderby'        => 'title',
23
+                'order'          => 'ASC',
24
+                'posts_per_page' => -1,
25
+                'post_status'    => array( 'publish' ),
26
+            )
27
+        );
28
+
29
+        $options = array(
30
+            '' => __('Select a Form','invoicing')
31
+        );
32
+
33
+        foreach( $forms as $form ) {
34
+            $options[ $form->ID ] = $form->post_title;
35
+        }
36 36
 
37 37
         $options = array(
38 38
             'textdomain'    => 'invoicing',
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                 'form'            => array(
51 51
                     'title'       => __( 'Payment Form', 'invoicing' ),
52 52
                     'desc'        => __( 'Select your payment form.', 'invoicing' ),
53
-					'type'        => 'select',
54
-					'options'     =>  $options,
53
+                    'type'        => 'select',
54
+                    'options'     =>  $options,
55 55
                     'desc_tip'    => true,
56 56
                     'default'     => '',
57 57
                     'advanced'    => false
@@ -64,56 +64,56 @@  discard block
 block discarded – undo
64 64
         parent::__construct( $options );
65 65
     }
66 66
 
67
-	/**
68
-	 * The Super block output function.
69
-	 *
70
-	 * @param array $args
71
-	 * @param array $widget_args
72
-	 * @param string $content
73
-	 *
74
-	 * @return string
75
-	 */
67
+    /**
68
+     * The Super block output function.
69
+     *
70
+     * @param array $args
71
+     * @param array $widget_args
72
+     * @param string $content
73
+     *
74
+     * @return string
75
+     */
76 76
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
-		global $invoicing;
78
-
79
-		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
81
-			return aui()->alert(
82
-				array(
83
-					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
85
-				)
86
-			);
87
-
88
-		}
89
-
90
-		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
92
-			return aui()->alert(
93
-				array(
94
-					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
-				)
97
-			);
98
-		}
99
-
100
-		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
-
104
-		ob_start();
105
-
106
-		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
-
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
-		}
113
-
114
-		$content = ob_get_clean();
77
+        global $invoicing;
78
+
79
+        // Do we have a payment form?
80
+        if ( empty( $args['form'] ) ) {
81
+            return aui()->alert(
82
+                array(
83
+                    'type'    => 'warning',
84
+                    'content' => __( 'No payment form selected', 'invoicing' ),
85
+                )
86
+            );
87
+
88
+        }
89
+
90
+        // If yes, ensure that it is published.
91
+        if ( 'publish' != get_post_status( $args['form'] ) ) {
92
+            return aui()->alert(
93
+                array(
94
+                    'type'    => 'warning',
95
+                    'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
+                )
97
+            );
98
+        }
99
+
100
+        // Get the form elements and items.
101
+        $elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
+        $items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
+
104
+        ob_start();
105
+
106
+        echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
+        echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
+
109
+        foreach ( $elements as $element ) {
110
+            do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
+            do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
+        }
113
+
114
+        $content = ob_get_clean();
115 115
 		
116
-		return str_replace( 'sr-only', '', $content );
116
+        return str_replace( 'sr-only', '', $content );
117 117
 
118 118
     }
119 119
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 				'orderby'        => 'title',
23 23
 				'order'          => 'ASC',
24 24
 				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
25
+				'post_status'    => array('publish'),
26 26
 			)
27 27
 		);
28 28
 
29 29
 		$options = array(
30
-			'' => __('Select a Form','invoicing')
30
+			'' => __('Select a Form', 'invoicing')
31 31
 		);
32 32
 
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
33
+		foreach ($forms as $form) {
34
+			$options[$form->ID] = $form->post_title;
35 35
 		}
36 36
 
37 37
         $options = array(
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
             'block-keywords'=> "['invoicing','buy', 'buy item', 'pay', 'payment form']",
42 42
             'class_name'     => __CLASS__,
43 43
             'base_id'       => 'wpinv_payment_form',
44
-            'name'          => __('Invoicing > Payment Form','invoicing'),
44
+            'name'          => __('Invoicing > Payment Form', 'invoicing'),
45 45
             'widget_ops'    => array(
46 46
                 'classname'   => 'wpinv-payment-form-class bsui',
47
-                'description' => esc_html__('Displays a payment form.','invoicing'),
47
+                'description' => esc_html__('Displays a payment form.', 'invoicing'),
48 48
             ),
49 49
             'arguments'           => array(
50 50
                 'form'            => array(
51
-                    'title'       => __( 'Payment Form', 'invoicing' ),
52
-                    'desc'        => __( 'Select your payment form.', 'invoicing' ),
51
+                    'title'       => __('Payment Form', 'invoicing'),
52
+                    'desc'        => __('Select your payment form.', 'invoicing'),
53 53
 					'type'        => 'select',
54 54
 					'options'     =>  $options,
55 55
                     'desc_tip'    => true,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         );
62 62
 
63 63
 
64
-        parent::__construct( $options );
64
+        parent::__construct($options);
65 65
     }
66 66
 
67 67
 	/**
@@ -73,47 +73,47 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
76
+    public function output($args = array(), $widget_args = array(), $content = '') {
77 77
 		global $invoicing;
78 78
 
79 79
 		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
80
+		if (empty($args['form'])) {
81 81
 			return aui()->alert(
82 82
 				array(
83 83
 					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
84
+					'content' => __('No payment form selected', 'invoicing'),
85 85
 				)
86 86
 			);
87 87
 
88 88
 		}
89 89
 
90 90
 		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
91
+		if ('publish' != get_post_status($args['form'])) {
92 92
 			return aui()->alert(
93 93
 				array(
94 94
 					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
95
+					'content' => __('This payment form is no longer active', 'invoicing'),
96 96
 				)
97 97
 			);
98 98
 		}
99 99
 
100 100
 		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
101
+		$elements = $invoicing->form_elements->get_form_elements($args['form']);
102
+		$items    = $invoicing->form_elements->get_form_items($args['form']);
103 103
 
104 104
 		ob_start();
105 105
 
106 106
 		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
107
+		echo wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
108 108
 
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
109
+		foreach ($elements as $element) {
110
+			do_action('wpinv_frontend_render_payment_form_element', $element, $items, $args['form']);
111
+			do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form']);
112 112
 		}
113 113
 
114 114
 		$content = ob_get_clean();
115 115
 		
116
-		return str_replace( 'sr-only', '', $content );
116
+		return str_replace('sr-only', '', $content);
117 117
 
118 118
     }
119 119
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-payment-form.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Payment_Form {
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output ( $post ) {
15
-        $success_page        = get_post_meta( $post->ID, 'wpinv_success_page', true );
16
-        $success_page        = empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page
14
+    public static function output($post) {
15
+        $success_page        = get_post_meta($post->ID, 'wpinv_success_page', true);
16
+        $success_page        = empty($success_page) ? wpinv_get_success_page_uri() : $success_page
17 17
         ?>
18 18
 
19 19
         <div id="wpinv-form-builder" style="display: flex; flex-flow: wrap;">
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
             <div class="wpinv-form-builder-left bsui" style="flex: 0 0 320px;">
22 22
                 <ul class="wpinv-form-builder-tabs  nav nav-tabs">
23 23
                     <li class='nav-item' v-if="active_tab!='new_item'">
24
-                        <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e( 'Add new element', 'invoicing' ); ?></a>
24
+                        <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e('Add new element', 'invoicing'); ?></a>
25 25
                     </li>
26 26
                     <li class='nav-item' v-if='false'>
27
-                        <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e( 'Edit element', 'invoicing' ); ?></a>
27
+                        <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e('Edit element', 'invoicing'); ?></a>
28 28
                     </li>
29 29
                     <li class='nav-item' v-if='false'>
30
-                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e( 'Settings', 'invoicing' ); ?></a>
30
+                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e('Settings', 'invoicing'); ?></a>
31 31
                     </li>
32 32
                 </ul>
33 33
 
34 34
                 <div class="wpinv-form-builder-tab-content bsui" style="margin-top: 16px;">
35 35
                     <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
36 36
                         <div class="wpinv-form-builder-add-field-types">
37
-                            <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
37
+                            <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
38 38
                             <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable">
39 39
                                 <li v-for="element in elements" style="width: 49%; background-color: #fafafa; margin-bottom: 9px; cursor: move; border: 1px solid #eeeeee;" @click.prevent="addField(element)">
40 40
                                     <button class="button btn" style="width: 100%; cursor: move;">
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
                     <div class="wpinv-form-builder-tab-pane bsui" v-if="active_tab=='edit_item'" style="font-size: 16px;">
51 51
                         <div class="wpinv-form-builder-edit-field-wrapper">
52
-                            <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
52
+                            <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
53 53
                             <div>
54
-                                <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)"><?php _e( 'Delete Field', 'invoicing' ); ?></button>
54
+                                <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)"><?php _e('Delete Field', 'invoicing'); ?></button>
55 55
                             </div>
56 56
                         </div>
57 57
                     </div>
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
                         <div class="wpinv-form-builder-settings-wrapper">
61 61
                         
62 62
                             <div class='form-group'>
63
-                                <label for="wpi-success-page"><?php _e( 'Success Page', 'invoicing' ); ?></label>
64
-                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url( $success_page ); ?>" class='form-control' type='text'>
65
-                                <small class='form-text text-muted'><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></small>
63
+                                <label for="wpi-success-page"><?php _e('Success Page', 'invoicing'); ?></label>
64
+                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url($success_page); ?>" class='form-control' type='text'>
65
+                                <small class='form-text text-muted'><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></small>
66 66
                             </div>
67 67
 
68 68
                         </div>
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 
74 74
             <div class="wpinv-form-builder-right" style="flex: 1; padding-top: 40px;border-left: 1px solid #ddd;padding-left: 20px;min-height: 520px;margin-left: 10px;">
75 75
 
76
-                <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
77
-                <p class='form-text text-muted' v-if='! form_elements.length'><?php _e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p>
76
+                <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
77
+                <p class='form-text text-muted' v-if='! form_elements.length'><?php _e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p>
78 78
 
79 79
                 <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 16px;">
80 80
                     <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="{ active: active_form_element==form_element &&  active_tab=='edit_item' }" @click="active_tab = 'edit_item'; active_form_element = form_element">
81
-                        <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
81
+                        <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
82 82
                     </div>
83 83
                 </draggable>
84 84
             </div>
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             <textarea style="display:none;" name="wpinv_form_items" v-model="itemString"></textarea>
88 88
         </div>
89 89
         
90
-        <?php wp_nonce_field( 'wpinv_save_payment_form', 'wpinv_save_payment_form' ) ;?>
90
+        <?php wp_nonce_field('wpinv_save_payment_form', 'wpinv_save_payment_form'); ?>
91 91
 
92 92
         <?php
93 93
     }
@@ -95,83 +95,83 @@  discard block
 block discarded – undo
95 95
     /**
96 96
      * Saves our payment forms.
97 97
      */
98
-    public static function save( $post_id, $post ) {
98
+    public static function save($post_id, $post) {
99 99
 
100
-        remove_action( 'save_post', 'WPInv_Meta_Box_Payment_Form::save' );
100
+        remove_action('save_post', 'WPInv_Meta_Box_Payment_Form::save');
101 101
 
102 102
         // $post_id and $post are required.
103
-        if ( empty( $post_id ) || empty( $post ) ) {
103
+        if (empty($post_id) || empty($post)) {
104 104
             return;
105 105
         }
106 106
         
107 107
         // Ensure that this user can edit the post.
108
-        if ( ! current_user_can( 'edit_post', $post_id ) ) {
108
+        if (!current_user_can('edit_post', $post_id)) {
109 109
             return;
110 110
         }
111 111
 
112 112
         // Dont' save meta boxes for revisions or autosaves
113
-        if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
113
+        if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
114 114
             return;
115 115
         }
116 116
 
117 117
         // Do not save for ajax requests.
118
-        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
118
+        if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
119 119
             return;
120 120
         }
121 121
 
122 122
         // Confirm the security nonce.
123
-        if ( empty( $_POST['wpinv_save_payment_form'] ) || ! wp_verify_nonce( $_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form' ) ) {
123
+        if (empty($_POST['wpinv_save_payment_form']) || !wp_verify_nonce($_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form')) {
124 124
             return;
125 125
         }
126 126
 
127 127
         // Save form items.
128
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
128
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
129 129
 
130
-        if ( empty( $form_items ) ) {
130
+        if (empty($form_items)) {
131 131
             $form_items = array();
132 132
         }
133 133
 
134
-        update_post_meta( $post_id, 'wpinv_form_items', self::maybe_save_items( $form_items ) );
134
+        update_post_meta($post_id, 'wpinv_form_items', self::maybe_save_items($form_items));
135 135
 
136 136
         // Save form elements.
137
-        $wpinv_form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
138
-        if ( empty( $wpinv_form_elements ) ) {
137
+        $wpinv_form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
138
+        if (empty($wpinv_form_elements)) {
139 139
             $wpinv_form_elements = array();
140 140
         }
141 141
 
142
-        update_post_meta( $post_id, 'wpinv_form_elements', $wpinv_form_elements );
142
+        update_post_meta($post_id, 'wpinv_form_elements', $wpinv_form_elements);
143 143
     }
144 144
 
145 145
     /**
146 146
      * Saves unsaved form items.
147 147
      */
148
-    public static function maybe_save_items( $items ) {
148
+    public static function maybe_save_items($items) {
149 149
 
150 150
         $saved = array();
151 151
 
152
-        foreach( $items as $item ) {
152
+        foreach ($items as $item) {
153 153
 
154
-            if ( is_numeric( $item['id'] ) ) {
154
+            if (is_numeric($item['id'])) {
155 155
                 $saved[] = $item;
156 156
                 continue;
157 157
             }
158 158
 
159 159
             $data = array(
160
-                'post_title'   => sanitize_text_field( $item['title'] ),
161
-                'post_excerpt' => wp_kses_post( $item['description'] ),
160
+                'post_title'   => sanitize_text_field($item['title']),
161
+                'post_excerpt' => wp_kses_post($item['description']),
162 162
                 'post_status'  => 'publish',
163 163
                 'meta'         => array(
164 164
                     'type'      => 'custom',
165
-                    'price'     => wpinv_sanitize_amount( $item['price'] ),
165
+                    'price'     => wpinv_sanitize_amount($item['price']),
166 166
                     'vat_rule'  => 'digital',
167 167
                     'vat_class' => '_standard',
168 168
                 )
169 169
             );
170 170
             
171
-            $new_item  = new WPInv_Item();
172
-            $new_item->create( $data );
171
+            $new_item = new WPInv_Item();
172
+            $new_item->create($data);
173 173
     
174
-            if ( ! empty( $new_item ) ) {
174
+            if (!empty($new_item)) {
175 175
                 $item['id'] = $new_item->ID;
176 176
                 $saved[] = $item;
177 177
             }
@@ -184,5 +184,5 @@  discard block
 block discarded – undo
184 184
 
185 185
 }
186 186
 
187
-add_action( 'save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2 );
187
+add_action('save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2);
188 188
 
Please login to merge, or discard this patch.
includes/class-wpinv.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171 171
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172 172
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
173
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178 178
         require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179 179
         require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180 180
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
@@ -487,17 +487,17 @@  discard block
 block discarded – undo
487 487
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
488 488
     }
489 489
 
490
-	/**
491
-	 * Register widgets
492
-	 *
493
-	 */
494
-	public function register_widgets() {
495
-		register_widget( "WPInv_Checkout_Widget" );
496
-		register_widget( "WPInv_History_Widget" );
497
-		register_widget( "WPInv_Receipt_Widget" );
498
-		register_widget( "WPInv_Subscriptions_Widget" );
499
-		register_widget( "WPInv_Buy_Item_Widget" );
490
+    /**
491
+     * Register widgets
492
+     *
493
+     */
494
+    public function register_widgets() {
495
+        register_widget( "WPInv_Checkout_Widget" );
496
+        register_widget( "WPInv_History_Widget" );
497
+        register_widget( "WPInv_Receipt_Widget" );
498
+        register_widget( "WPInv_Subscriptions_Widget" );
499
+        register_widget( "WPInv_Buy_Item_Widget" );
500 500
         register_widget( "WPInv_Messages_Widget" );
501 501
         register_widget( 'WPInv_Payment_Form_Widget' );
502
-	}
502
+    }
503 503
 }
504 504
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Plugin {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) {
19 19
             self::$instance = new WPInv_Plugin;
20 20
             self::$instance->includes();
21 21
             self::$instance->actions();
@@ -33,33 +33,33 @@  discard block
 block discarded – undo
33 33
     }
34 34
     
35 35
     public function define_constants() {
36
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
37
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
36
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
37
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
38 38
     }
39 39
     
40 40
     private function actions() {
41 41
         /* Internationalize the text strings used. */
42
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
42
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
43 43
         
44 44
         /* Perform actions on admin initialization. */
45
-        add_action( 'admin_init', array( &$this, 'admin_init') );
46
-        add_action( 'init', array( &$this, 'init' ), 3 );
47
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
45
+        add_action('admin_init', array(&$this, 'admin_init'));
46
+        add_action('init', array(&$this, 'init'), 3);
47
+        add_action('init', array(&$this, 'wpinv_actions'));
48 48
         
49
-        if ( class_exists( 'BuddyPress' ) ) {
50
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
49
+        if (class_exists('BuddyPress')) {
50
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
51 51
         }
52 52
 
53
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
54
-        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('widgets_init', array(&$this, 'register_widgets'));
55 55
 
56
-        if ( is_admin() ) {
57
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
58
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
59
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
56
+        if (is_admin()) {
57
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
58
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
59
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
60 60
 
61 61
         } else {
62
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
62
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
63 63
         }
64 64
         
65 65
         /**
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
          *
70 70
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
71 71
          */
72
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
72
+        do_action_ref_array('wpinv_actions', array(&$this));
73 73
 
74
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
74
+        add_action('admin_init', array(&$this, 'activation_redirect'));
75 75
     }
76 76
 
77 77
     /**
78 78
      * Maybe show the AyeCode Connect Notice.
79 79
      */
80
-    public function init_ayecode_connect_helper(){
80
+    public function init_ayecode_connect_helper() {
81 81
         // AyeCode Connect notice
82
-        if ( is_admin() ){
82
+        if (is_admin()) {
83 83
             // set the strings so they can be translated
84 84
             $strings = array(
85
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
86
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
87
-                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
88
-                'connect_button'    => __("Connect Site","invoicing"),
89
-                'connecting_button'    => __("Connecting...","invoicing"),
90
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
91
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
85
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
86
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
87
+                'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
88
+                'connect_button'    => __("Connect Site", "invoicing"),
89
+                'connecting_button'    => __("Connecting...", "invoicing"),
90
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
91
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
92 92
             );
93
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
93
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
94 94
         }
95 95
     }
96 96
     
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
         /* Internationalize the text strings used. */
99 99
         $this->load_textdomain();
100 100
 
101
-        do_action( 'wpinv_loaded' );
101
+        do_action('wpinv_loaded');
102 102
 
103 103
         // Fix oxygen page builder conflict
104
-        if ( function_exists( 'ct_css_output' ) ) {
104
+        if (function_exists('ct_css_output')) {
105 105
             wpinv_oxygen_fix_conflict();
106 106
         }
107 107
     }
@@ -111,234 +111,234 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @since 1.0
113 113
      */
114
-    public function load_textdomain( $locale = NULL ) {
115
-        if ( empty( $locale ) ) {
116
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
114
+    public function load_textdomain($locale = NULL) {
115
+        if (empty($locale)) {
116
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
117 117
         }
118 118
 
119
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
119
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
120 120
         
121
-        unload_textdomain( 'invoicing' );
122
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
123
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
121
+        unload_textdomain('invoicing');
122
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
123
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
124 124
         
125 125
         /**
126 126
          * Define language constants.
127 127
          */
128
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
128
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
129 129
     }
130 130
         
131 131
     public function includes() {
132 132
         global $wpinv_options;
133 133
         
134
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
134
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
135 135
         $wpinv_options = wpinv_get_settings();
136 136
         
137
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
138
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
139
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
140
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
141
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
142
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
143
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
144
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
145
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
147
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
148
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
162
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
163
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
164
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
165
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
166
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
167
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
168
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
169
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
181
-
182
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
183
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
137
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
138
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
139
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
140
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
141
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
142
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
143
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
144
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
145
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
147
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
148
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
162
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
163
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
164
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
165
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
166
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
167
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
168
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
169
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
173
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
174
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
175
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
176
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
177
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
178
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'widgets/payment-form.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
181
+
182
+        if (!class_exists('WPInv_EUVat')) {
183
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
184 184
         }
185 185
         
186
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
187
-        if ( !empty( $gateways ) ) {
188
-            foreach ( $gateways as $gateway ) {
189
-                if ( $gateway == 'manual' ) {
186
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
187
+        if (!empty($gateways)) {
188
+            foreach ($gateways as $gateway) {
189
+                if ($gateway == 'manual') {
190 190
                     continue;
191 191
                 }
192 192
                 
193 193
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
194 194
                 
195
-                if ( file_exists( $gateway_file ) ) {
196
-                    require_once( $gateway_file );
195
+                if (file_exists($gateway_file)) {
196
+                    require_once($gateway_file);
197 197
                 }
198 198
             }
199 199
         }
200
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
200
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
201 201
         
202
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
203
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
204
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
205
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
202
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
203
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
204
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
205
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
206 206
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
207
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
208
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
209
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
210
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
211
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
212
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
213
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
214
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
207
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
208
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
209
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
210
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
211
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
212
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
213
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
214
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
215 215
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
216 216
             // load the user class only on the users.php page
217 217
             global $pagenow;
218
-            if($pagenow=='users.php'){
218
+            if ($pagenow == 'users.php') {
219 219
                 new WPInv_Admin_Users();
220 220
             }
221 221
         }
222 222
 
223 223
         // Register cli commands
224
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
225
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
226
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
224
+        if (defined('WP_CLI') && WP_CLI) {
225
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
226
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
227 227
         }
228 228
         
229 229
         // include css inliner
230
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
231
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
230
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
231
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
232 232
         }
233 233
         
234
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
234
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
235 235
     }
236 236
     
237 237
     public function init() {
238 238
     }
239 239
     
240 240
     public function admin_init() {
241
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
241
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
242 242
     }
243 243
 
244 244
     public function activation_redirect() {
245 245
         // Bail if no activation redirect
246
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
246
+        if (!get_transient('_wpinv_activation_redirect')) {
247 247
             return;
248 248
         }
249 249
 
250 250
         // Delete the redirect transient
251
-        delete_transient( '_wpinv_activation_redirect' );
251
+        delete_transient('_wpinv_activation_redirect');
252 252
 
253 253
         // Bail if activating from network, or bulk
254
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
254
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
255 255
             return;
256 256
         }
257 257
 
258
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
258
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
259 259
         exit;
260 260
     }
261 261
     
262 262
     public function enqueue_scripts() {
263
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
263
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
264 264
         
265
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
266
-        wp_enqueue_style( 'wpinv_front_style' );
265
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
266
+        wp_enqueue_style('wpinv_front_style');
267 267
                
268 268
         // Register scripts
269
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
270
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  WPINV_VERSION );
269
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
270
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), WPINV_VERSION);
271 271
 
272 272
         $localize                         = array();
273
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
274
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
273
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
274
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
275 275
         $localize['currency_symbol']      = wpinv_currency_symbol();
276 276
         $localize['currency_pos']         = wpinv_currency_position();
277 277
         $localize['thousand_sep']         = wpinv_thousands_separator();
278 278
         $localize['decimal_sep']          = wpinv_decimal_separator();
279 279
         $localize['decimals']             = wpinv_decimals();
280
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
280
+        $localize['txtComplete']          = __('Complete', 'invoicing');
281 281
         $localize['UseTaxes']             = wpinv_use_taxes();
282
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
282
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
283 283
 
284
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
284
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
285 285
         
286
-        wp_enqueue_script( 'jquery-blockui' );
286
+        wp_enqueue_script('jquery-blockui');
287 287
         $autofill_api = wpinv_get_option('address_autofill_api');
288 288
         $autofill_active = wpinv_get_option('address_autofill_active');
289
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
290
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
291
-                wp_dequeue_script( 'google-maps-api' );
289
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
290
+            if (wp_script_is('google-maps-api', 'enqueued')) {
291
+                wp_dequeue_script('google-maps-api');
292 292
             }
293
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
294
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
293
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
294
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
295 295
         }
296 296
 
297
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
298
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
297
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
298
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
299 299
 
300
-        wp_enqueue_script( 'wpinv-front-script' );
301
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
300
+        wp_enqueue_script('wpinv-front-script');
301
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
302 302
     }
303 303
 
304
-    public function admin_enqueue_scripts( $hook ) {
304
+    public function admin_enqueue_scripts($hook) {
305 305
         global $post, $pagenow;
306 306
         
307 307
         $post_type  = wpinv_admin_post_type();
308
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
309
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
308
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
309
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
310 310
 
311 311
         $jquery_ui_css = false;
312
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
312
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
313 313
             $jquery_ui_css = true;
314
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
314
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
315 315
             $jquery_ui_css = true;
316 316
         }
317
-        if ( $jquery_ui_css ) {
318
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
319
-            wp_enqueue_style( 'jquery-ui-css' );
317
+        if ($jquery_ui_css) {
318
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
319
+            wp_enqueue_style('jquery-ui-css');
320 320
         }
321 321
 
322
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
323
-        wp_enqueue_style( 'wpinv_meta_box_style' );
322
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
323
+        wp_enqueue_style('wpinv_meta_box_style');
324 324
         
325
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
326
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
327
-        wp_enqueue_style( 'wpinv_admin_style' );
325
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
326
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
327
+        wp_enqueue_style('wpinv_admin_style');
328 328
 
329
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
330
-        if ( $page == 'wpinv-subscriptions' ) {
331
-            wp_enqueue_script( 'jquery-ui-datepicker' );
329
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
330
+        if ($page == 'wpinv-subscriptions') {
331
+            wp_enqueue_script('jquery-ui-datepicker');
332 332
         }
333 333
         
334
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
335
-            wp_enqueue_script( 'jquery-ui-datepicker' );
334
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
335
+            wp_enqueue_script('jquery-ui-datepicker');
336 336
         }
337 337
 
338
-        wp_enqueue_style( 'wp-color-picker' );
339
-        wp_enqueue_script( 'wp-color-picker' );
338
+        wp_enqueue_style('wp-color-picker');
339
+        wp_enqueue_script('wp-color-picker');
340 340
         
341
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
341
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
342 342
 
343 343
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
344 344
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -349,20 +349,20 @@  discard block
 block discarded – undo
349 349
             }
350 350
         }
351 351
 
352
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
353
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
352
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
353
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
354 354
 
355
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
356
-        wp_enqueue_script( 'wpinv-admin-script' );
355
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
356
+        wp_enqueue_script('wpinv-admin-script');
357 357
         
358 358
         $localize                               = array();
359
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
360
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
361
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
362
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
363
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
364
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
365
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
359
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
360
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
361
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
362
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
363
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
364
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
365
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
366 366
         $localize['tax']                        = wpinv_tax_amount();
367 367
         $localize['discount']                   = wpinv_discount_amount();
368 368
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -370,95 +370,95 @@  discard block
 block discarded – undo
370 370
         $localize['thousand_sep']               = wpinv_thousands_separator();
371 371
         $localize['decimal_sep']                = wpinv_decimal_separator();
372 372
         $localize['decimals']                   = wpinv_decimals();
373
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
374
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
375
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
376
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
377
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
378
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
379
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
380
-        $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' );
381
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
382
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
383
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
384
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
385
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
386
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
387
-
388
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
389
-
390
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
373
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
374
+        $localize['status_publish']             = wpinv_status_nicename('publish');
375
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
376
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
377
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
378
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
379
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
380
+        $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');
381
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
382
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
383
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
384
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
385
+        $localize['action_edit']                = __('Edit', 'invoicing');
386
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
387
+
388
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
389
+
390
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
391 391
 
392 392
         // Load payment form scripts on our admin pages only.
393
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
393
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
394 394
 
395
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
396
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
397
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
395
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
396
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
397
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
398 398
 
399
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
400
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
399
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
400
+            wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
401 401
         
402
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
402
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
403 403
                 'elements'      => $this->form_elements->get_elements(),
404
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
404
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
405 405
                 'all_items'     => $this->form_elements->get_published_items(),
406 406
                 'currency'      => wpinv_currency_symbol(),
407 407
                 'position'      => wpinv_currency_position(),
408 408
                 'decimals'      => (int) wpinv_decimals(),
409 409
                 'thousands_sep' => wpinv_thousands_separator(),
410 410
                 'decimals_sep'  => wpinv_decimal_separator(),
411
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
412
-            ) );
411
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
412
+            ));
413 413
 
414
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
414
+            wp_enqueue_script('wpinv-admin-payment-form-script');
415 415
         }
416 416
 
417
-        if ( $page == 'wpinv-subscriptions' ) {
418
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
419
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
417
+        if ($page == 'wpinv-subscriptions') {
418
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
419
+            wp_enqueue_script('wpinv-sub-admin-script');
420 420
         }
421 421
 
422 422
     }
423 423
     
424
-    public function admin_body_class( $classes ) {
424
+    public function admin_body_class($classes) {
425 425
         global $pagenow, $post, $current_screen;
426 426
         
427
-        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' ) ) {
427
+        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')) {
428 428
             $classes .= ' wpinv-cpt';
429 429
         }
430 430
         
431
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
431
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
432 432
 
433
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
434
-        if ( $add_class ) {
435
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
433
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
434
+        if ($add_class) {
435
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
436 436
         }
437 437
         
438 438
         $settings_class = array();
439
-        if ( $page == 'wpinv-settings' ) {
440
-            if ( !empty( $_REQUEST['tab'] ) ) {
441
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
439
+        if ($page == 'wpinv-settings') {
440
+            if (!empty($_REQUEST['tab'])) {
441
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
442 442
             }
443 443
             
444
-            if ( !empty( $_REQUEST['section'] ) ) {
445
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
444
+            if (!empty($_REQUEST['section'])) {
445
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
446 446
             }
447 447
             
448
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
448
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
449 449
         }
450 450
         
451
-        if ( !empty( $settings_class ) ) {
452
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
451
+        if (!empty($settings_class)) {
452
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
453 453
         }
454 454
         
455 455
         $post_type = wpinv_admin_post_type();
456 456
 
457
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
457
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
458 458
             return $classes .= ' wpinv';
459 459
         }
460 460
         
461
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
461
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
462 462
             $classes .= ' wpi-editable-n';
463 463
         }
464 464
 
@@ -470,21 +470,21 @@  discard block
 block discarded – undo
470 470
     }
471 471
     
472 472
     public function wpinv_actions() {
473
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
474
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
473
+        if (isset($_REQUEST['wpi_action'])) {
474
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
475 475
         }
476 476
     }
477 477
     
478
-    public function pre_get_posts( $wp_query ) {
479
-        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() ) {
480
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
478
+    public function pre_get_posts($wp_query) {
479
+        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()) {
480
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
481 481
         }
482 482
         
483 483
         return $wp_query;
484 484
     }
485 485
     
486 486
     public function bp_invoicing_init() {
487
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
487
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
488 488
     }
489 489
 
490 490
 	/**
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	 *
493 493
 	 */
494 494
 	public function register_widgets() {
495
-		register_widget( "WPInv_Checkout_Widget" );
496
-		register_widget( "WPInv_History_Widget" );
497
-		register_widget( "WPInv_Receipt_Widget" );
498
-		register_widget( "WPInv_Subscriptions_Widget" );
499
-		register_widget( "WPInv_Buy_Item_Widget" );
500
-        register_widget( "WPInv_Messages_Widget" );
501
-        register_widget( 'WPInv_Payment_Form_Widget' );
495
+		register_widget("WPInv_Checkout_Widget");
496
+		register_widget("WPInv_History_Widget");
497
+		register_widget("WPInv_Receipt_Widget");
498
+		register_widget("WPInv_Subscriptions_Widget");
499
+		register_widget("WPInv_Buy_Item_Widget");
500
+        register_widget("WPInv_Messages_Widget");
501
+        register_widget('WPInv_Payment_Form_Widget');
502 502
 	}
503 503
 }
504 504
\ No newline at end of file
Please login to merge, or discard this patch.
includes/data/sample-payment-form-items.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17
-        'title'       => __( 'My Cool Item', 'invoicing' ),
17
+        'title'       => __('My Cool Item', 'invoicing'),
18 18
         'id'          => 'fxhnagzi',
19 19
         'price'       => '999.00',
20 20
         'recurring'   => false,
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     array(
26 26
 
27
-        'title'       => __( 'Shipping Fee', 'invoicing' ),
27
+        'title'       => __('Shipping Fee', 'invoicing'),
28 28
         'id'          => 'rxnymibri',
29 29
         'price'       => '19.99',
30 30
         'recurring'   => false,
Please login to merge, or discard this patch.
includes/data/sample-payment-form.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17 17
         'level' => 'h2',
18
-        'text'  => __( 'Payment Form', 'invoicing' ),
18
+        'text'  => __('Payment Form', 'invoicing'),
19 19
         'id'    => 'uiylyczw',
20 20
         'name'  => 'uiylyczw',
21 21
         'type'  => 'heading'
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     array(
25 25
 
26
-        'text' => __( 'Fill the form below to place an order for my cool item', 'invoicing' ),
26
+        'text' => __('Fill the form below to place an order for my cool item', 'invoicing'),
27 27
         'id'   => 'pcvqjj',
28 28
         'name' => 'pcvqjj',
29 29
         'type' => 'paragraph'
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
         'placeholder' => 'Jon',
36 36
         'value'       => '',
37
-        'label'       => __( 'First Name', 'invoicing' ),
37
+        'label'       => __('First Name', 'invoicing'),
38 38
         'description' => '',
39 39
         'required'    => false,
40 40
         'id'          => 'ynkzkjyc',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         'placeholder' => 'Snow',
49 49
         'value'       => '',
50
-        'label'       => __( 'Last Name', 'invoicing' ),
50
+        'label'       => __('Last Name', 'invoicing'),
51 51
         'description' => '',
52 52
         'required'    => false,
53 53
         'id'          => 'wfjcdmzox',
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         'placeholder' => '[email protected]',
62 62
         'value'       => '',
63
-        'label'       => __( 'Email Address', 'invoicing' ),
63
+        'label'       => __('Email Address', 'invoicing'),
64 64
         'description' => '',
65 65
         'required'    => false,
66 66
         'id'          => 'mmdwqzpox',
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 
85 85
         'value'       =>'',
86 86
         'class'       => 'btn-primary',
87
-        'label'       => __( 'Pay Now »', 'invoicing' ),
88
-        'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
87
+        'label'       => __('Pay Now »', 'invoicing'),
88
+        'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
89 89
         'id'          => 'rtqljyy',
90 90
         'name'        => 'rtqljyy',
91 91
         'type'        => 'pay_button'
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +350 added lines, -350 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function __construct() {
15 15
 
16
-        foreach( $this->get_elements() as $element ) {
16
+        foreach ($this->get_elements() as $element) {
17 17
             $element = $element['type'];
18 18
 
19
-            if ( method_exists( $this, "render_{$element}_template" ) ) {
20
-                add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 );
19
+            if (method_exists($this, "render_{$element}_template")) {
20
+                add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2);
21 21
             }
22 22
 
23
-            if ( method_exists( $this, "edit_{$element}_template" ) ) {
24
-                add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 );
23
+            if (method_exists($this, "edit_{$element}_template")) {
24
+                add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2);
25 25
             }
26 26
 
27
-            if ( method_exists( $this, "frontend_render_{$element}_template" ) ) {
28
-                add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 );
27
+            if (method_exists($this, "frontend_render_{$element}_template")) {
28
+                add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3);
29 29
             }
30 30
 
31 31
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function get_elements() {
39 39
 
40
-        if ( ! empty( $this->elements ) ) {
40
+        if (!empty($this->elements)) {
41 41
             return $this->elements;
42 42
         }
43 43
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 
46 46
             array(
47 47
                 'type'     => 'heading',
48
-                'name'     => __( 'Heading', 'invoicing' ),
48
+                'name'     => __('Heading', 'invoicing'),
49 49
                 'defaults' => array(
50 50
                     'level' => 'h2',
51
-                    'text'  => __( 'Heading', 'invoicing' ),
51
+                    'text'  => __('Heading', 'invoicing'),
52 52
                 )
53 53
             ),
54 54
 
55 55
             array(
56 56
                 'type' => 'paragraph',
57
-                'name' => __( 'Paragraph', 'invoicing' ),
57
+                'name' => __('Paragraph', 'invoicing'),
58 58
                 'defaults'  => array(
59
-                    'text'  => __( 'Paragraph text', 'invoicing' ),
59
+                    'text'  => __('Paragraph text', 'invoicing'),
60 60
                 )
61 61
             ),
62 62
 
63 63
             array( 
64 64
                 'type' => 'alert',
65
-                'name' => __( 'Alert', 'invoicing' ),
65
+                'name' => __('Alert', 'invoicing'),
66 66
                 'defaults'  => array(
67 67
                     'value'        => '',
68 68
                     'class'        => 'alert-warning',
69
-                    'text'         => __( 'Alert', 'invoicing' ),
69
+                    'text'         => __('Alert', 'invoicing'),
70 70
                     'dismissible'  => false,
71 71
                 )
72 72
             ),
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
             array(
84 84
                 'type' => 'text',
85
-                'name' => __( 'Text Input', 'invoicing' ),
85
+                'name' => __('Text Input', 'invoicing'),
86 86
                 'defaults'  => array(
87
-                    'placeholder'  => __( 'Enter some text', 'invoicing' ),
87
+                    'placeholder'  => __('Enter some text', 'invoicing'),
88 88
                     'value'        => '',
89
-                    'label'        => __( 'Field Label', 'invoicing' ),
89
+                    'label'        => __('Field Label', 'invoicing'),
90 90
                     'description'  => '',
91 91
                     'required'     => false,
92 92
                 )
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
             array(
96 96
                 'type' => 'textarea',
97
-                'name' => __( 'Textarea', 'invoicing' ),
97
+                'name' => __('Textarea', 'invoicing'),
98 98
                 'defaults'         => array(
99
-                    'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
99
+                    'placeholder'  => __('Enter your text hear', 'invoicing'),
100 100
                     'value'        => '',
101
-                    'label'        => __( 'Textarea Label', 'invoicing' ),
101
+                    'label'        => __('Textarea Label', 'invoicing'),
102 102
                     'description'  => '',
103 103
                     'required'     => false,
104 104
                 )
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
             array(
108 108
                 'type' => 'select',
109
-                'name' => __( 'Dropdown', 'invoicing' ),
109
+                'name' => __('Dropdown', 'invoicing'),
110 110
                 'defaults'         => array(
111
-                    'placeholder'  => __( 'Select a value', 'invoicing' ),
111
+                    'placeholder'  => __('Select a value', 'invoicing'),
112 112
                     'value'        => '',
113
-                    'label'        => __( 'Dropdown Label', 'invoicing' ),
113
+                    'label'        => __('Dropdown Label', 'invoicing'),
114 114
                     'description'  => '',
115 115
                     'required'     => false,
116 116
                     'options'      => array(
117
-                        esc_attr__( 'Option One', 'invoicing' ),
118
-                        esc_attr__( 'Option Two', 'invoicing' ),
119
-                        esc_attr__( 'Option Three', 'invoicing' )
117
+                        esc_attr__('Option One', 'invoicing'),
118
+                        esc_attr__('Option Two', 'invoicing'),
119
+                        esc_attr__('Option Three', 'invoicing')
120 120
                     ),
121 121
                 )
122 122
             ),
123 123
 
124 124
             array(
125 125
                 'type' => 'checkbox',
126
-                'name' => __( 'Checkbox', 'invoicing' ),
126
+                'name' => __('Checkbox', 'invoicing'),
127 127
                 'defaults'         => array(
128 128
                     'value'        => '',
129
-                    'label'        => __( 'Checkbox Label', 'invoicing' ),
129
+                    'label'        => __('Checkbox Label', 'invoicing'),
130 130
                     'description'  => '',
131 131
                     'required'     => false,
132 132
                 )
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 
135 135
             array( 
136 136
                 'type' => 'radio',
137
-                'name' => __( 'Multiple Choice', 'invoicing' ),
137
+                'name' => __('Multiple Choice', 'invoicing'),
138 138
                 'defaults'     => array(
139
-                    'label'    => __( 'Select one choice', 'invoicing' ),
139
+                    'label'    => __('Select one choice', 'invoicing'),
140 140
                     'options'  => array(
141
-                        esc_attr__( 'Choice One', 'invoicing' ),
142
-                        esc_attr__( 'Choice Two', 'invoicing' ),
143
-                        esc_attr__( 'Choice Three', 'invoicing' )
141
+                        esc_attr__('Choice One', 'invoicing'),
142
+                        esc_attr__('Choice Two', 'invoicing'),
143
+                        esc_attr__('Choice Three', 'invoicing')
144 144
                     ),
145 145
                 )
146 146
             ),
147 147
 
148 148
             array( 
149 149
                 'type' => 'date',
150
-                'name' => __( 'Date', 'invoicing' ),
150
+                'name' => __('Date', 'invoicing'),
151 151
                 'defaults' => array(
152 152
                     'placeholder'  => '',
153 153
                     'value'        => '',
154
-                    'label'        => __( 'Date', 'invoicing' ),
154
+                    'label'        => __('Date', 'invoicing'),
155 155
                     'description'  => '',
156 156
                     'required'     => false,
157 157
                 )
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
             array( 
161 161
                 'type' => 'time',
162
-                'name' => __( 'Time', 'invoicing' ),
162
+                'name' => __('Time', 'invoicing'),
163 163
                 'defaults' => array(
164 164
                     'placeholder'  => '',
165 165
                     'value'        => '',
166
-                    'label'        => __( 'Time', 'invoicing' ),
166
+                    'label'        => __('Time', 'invoicing'),
167 167
                     'description'  => '',
168 168
                     'required'     => false,
169 169
                 )
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
             array( 
173 173
                 'type' => 'number',
174
-                'name' => __( 'Number', 'invoicing' ),
174
+                'name' => __('Number', 'invoicing'),
175 175
                 'defaults' => array(
176 176
                     'placeholder'  => '',
177 177
                     'value'        => '',
178
-                    'label'        => __( 'Number', 'invoicing' ),
178
+                    'label'        => __('Number', 'invoicing'),
179 179
                     'description'  => '',
180 180
                     'required'     => false,
181 181
                 )
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
             array( 
185 185
                 'type' => 'website',
186
-                'name' => __( 'Website', 'invoicing' ),
186
+                'name' => __('Website', 'invoicing'),
187 187
                 'defaults' => array(
188 188
                     'placeholder'  => 'http://example.com',
189 189
                     'value'        => '',
190
-                    'label'        => __( 'Website', 'invoicing' ),
190
+                    'label'        => __('Website', 'invoicing'),
191 191
                     'description'  => '',
192 192
                     'required'     => false,
193 193
                 )
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
             array( 
197 197
                 'type' => 'email',
198
-                'name' => __( 'Email', 'invoicing' ),
198
+                'name' => __('Email', 'invoicing'),
199 199
                 'defaults'  => array(
200 200
                     'placeholder'  => '[email protected]',
201 201
                     'value'        => '',
202
-                    'label'        => __( 'Email Address', 'invoicing' ),
202
+                    'label'        => __('Email Address', 'invoicing'),
203 203
                     'description'  => '',
204 204
                     'required'     => false,
205 205
                 )
@@ -207,18 +207,18 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'discount',
210
-                'name' => __( 'Discount Input', 'invoicing' ),
210
+                'name' => __('Discount Input', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
                     'value'        => '',
213
-                    'input_label'  => __( 'Coupon Code', 'invoicing' ),
214
-                    'button_label' => __( 'Apply Coupon', 'invoicing' ),
215
-                    'description'  => __( 'Have a discount code? Enter it above.', 'invoicing' ),
213
+                    'input_label'  => __('Coupon Code', 'invoicing'),
214
+                    'button_label' => __('Apply Coupon', 'invoicing'),
215
+                    'description'  => __('Have a discount code? Enter it above.', 'invoicing'),
216 216
                 )
217 217
             ),
218 218
 
219 219
             array( 
220 220
                 'type' => 'items',
221
-                'name' => __( 'Items', 'invoicing' ),
221
+                'name' => __('Items', 'invoicing'),
222 222
                 'defaults'  => array(
223 223
                     'value'        => '',
224 224
                     'items_type'   => 'total',
@@ -228,24 +228,24 @@  discard block
 block discarded – undo
228 228
 
229 229
             array( 
230 230
                 'type' => 'pay_button',
231
-                'name' => __( 'Payment Button', 'invoicing' ),
231
+                'name' => __('Payment Button', 'invoicing'),
232 232
                 'defaults'  => array(
233 233
                     'value'        => '',
234 234
                     'class'        => 'btn-primary',
235
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
236
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
235
+                    'label'        => __('Pay Now »', 'invoicing'),
236
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
237 237
                 )
238 238
             )
239 239
         );
240 240
 
241
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
241
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
242 242
         return $this->elements;
243 243
     }
244 244
 
245 245
     /**
246 246
      * Returns the restrict markup.
247 247
      */
248
-    public function get_restrict_markup( $field, $field_type ) {
248
+    public function get_restrict_markup($field, $field_type) {
249 249
         $restrict = "$field.type=='$field_type'";
250 250
         return "v-if=\"$restrict\"";
251 251
     }
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
     /**
254 254
      * Renders the title element template.
255 255
      */
256
-    public function render_heading_template( $field ) {
257
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
256
+    public function render_heading_template($field) {
257
+        $restrict = $this->get_restrict_markup($field, 'heading');
258 258
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
259 259
     }
260 260
 
261 261
     /**
262 262
      * Renders the title element on the frontend.
263 263
      */
264
-    public function frontend_render_heading_template( $field ) {
264
+    public function frontend_render_heading_template($field) {
265 265
         $tag = $field['level'];
266 266
         echo "<$tag>{$field['text']}</$tag>";
267 267
     }
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
     /**
270 270
      * Renders the edit title element template.
271 271
      */
272
-    public function edit_heading_template( $field ) {
273
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
274
-        $label    = __( 'Heading', 'invoicing' );
275
-        $label2   = __( 'Select Heading Level', 'invoicing' );
272
+    public function edit_heading_template($field) {
273
+        $restrict = $this->get_restrict_markup($field, 'heading');
274
+        $label    = __('Heading', 'invoicing');
275
+        $label2   = __('Select Heading Level', 'invoicing');
276 276
         $id       = $field . '.id + "_edit"';
277 277
         $id2      = $field . '.id + "_edit2"';
278 278
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
     /**
305 305
      * Renders a paragraph element template.
306 306
      */
307
-    public function render_paragraph_template( $field ) {
308
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
307
+    public function render_paragraph_template($field) {
308
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
309 309
         $label    = "$field.text";
310 310
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
311 311
     }
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
     /**
314 314
      * Renders the paragraph element on the frontend.
315 315
      */
316
-    public function frontend_render_paragraph_template( $field ) {
316
+    public function frontend_render_paragraph_template($field) {
317 317
         echo "<p>{$field['text']}</p>";
318 318
     }
319 319
 
320 320
     /**
321 321
      * Renders the edit paragraph element template.
322 322
      */
323
-    public function edit_paragraph_template( $field ) {
324
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
325
-        $label    = __( 'Enter your text', 'invoicing' );
323
+    public function edit_paragraph_template($field) {
324
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
325
+        $label    = __('Enter your text', 'invoicing');
326 326
         $id       = $field . '.id + "_edit"';
327 327
         echo "
328 328
             <div $restrict>
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
     /**
339 339
      * Renders the text element template.
340 340
      */
341
-    public function render_text_template( $field ) {
342
-        $restrict = $this->get_restrict_markup( $field, 'text' );
341
+    public function render_text_template($field) {
342
+        $restrict = $this->get_restrict_markup($field, 'text');
343 343
         $label    = "$field.label";
344 344
         echo "
345 345
             <div $restrict>
@@ -353,23 +353,23 @@  discard block
 block discarded – undo
353 353
     /**
354 354
      * Renders the text element on the frontend.
355 355
      */
356
-    public function frontend_render_text_template( $field ) {
356
+    public function frontend_render_text_template($field) {
357 357
         
358 358
         echo "<div class='form-group'>";
359 359
 
360 360
         echo aui()->input(
361 361
             array(
362
-                'name'       => esc_attr( $field['id'] ),
363
-                'id'         => esc_attr( $field['id'] ),
364
-                'placeholder'=> esc_attr( $field['placeholder'] ),
362
+                'name'       => esc_attr($field['id']),
363
+                'id'         => esc_attr($field['id']),
364
+                'placeholder'=> esc_attr($field['placeholder']),
365 365
                 'required'   => (bool) $field['required'],
366
-                'label'      => wp_kses_post( $field['label'] ),
366
+                'label'      => wp_kses_post($field['label']),
367 367
                 'no_wrap'    => true,
368 368
             )
369 369
         );
370 370
 
371
-        if ( ! empty( $field['description'] ) ) {
372
-            $description = wp_kses_post( $field['description'] );
371
+        if (!empty($field['description'])) {
372
+            $description = wp_kses_post($field['description']);
373 373
             echo "<small class='form-text text-muted'>$description</small>";
374 374
         }
375 375
 
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
     /**
381 381
      * Renders the edit text element template.
382 382
      */
383
-    public function edit_text_template( $field ) {
384
-        $restrict = $this->get_restrict_markup( $field, 'text' );
385
-        $label    = __( 'Field Label', 'invoicing' );
383
+    public function edit_text_template($field) {
384
+        $restrict = $this->get_restrict_markup($field, 'text');
385
+        $label    = __('Field Label', 'invoicing');
386 386
         $id       = $field . '.id + "_edit"';
387
-        $label2   = __( 'Placeholder text', 'invoicing' );
387
+        $label2   = __('Placeholder text', 'invoicing');
388 388
         $id2      = $field . '.id + "_edit2"';
389
-        $label3   = __( 'Help text', 'invoicing' );
390
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
389
+        $label3   = __('Help text', 'invoicing');
390
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
391 391
         $id3      = $field . '.id + "_edit3"';
392
-        $label5   = __( 'Is this field required?', 'invoicing' );
392
+        $label5   = __('Is this field required?', 'invoicing');
393 393
         $id4      = $field . '.id + "_edit4"';
394 394
         echo "
395 395
             <div $restrict>
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
     /**
418 418
      * Renders the textarea element template.
419 419
      */
420
-    public function render_textarea_template( $field ) {
421
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
420
+    public function render_textarea_template($field) {
421
+        $restrict = $this->get_restrict_markup($field, 'textarea');
422 422
         $label    = "$field.label";
423 423
         echo "
424 424
             <div $restrict>
@@ -432,24 +432,24 @@  discard block
 block discarded – undo
432 432
     /**
433 433
      * Renders the textarea element on the frontend.
434 434
      */
435
-    public function frontend_render_textarea_template( $field ) {
435
+    public function frontend_render_textarea_template($field) {
436 436
         
437 437
         echo "<div class='form-group'>";
438 438
 
439 439
         echo aui()->textarea(
440 440
             array(
441
-                'name'       => esc_attr( $field['id'] ),
442
-                'id'         => esc_attr( $field['id'] ),
443
-                'placeholder'=> esc_attr( $field['placeholder'] ),
441
+                'name'       => esc_attr($field['id']),
442
+                'id'         => esc_attr($field['id']),
443
+                'placeholder'=> esc_attr($field['placeholder']),
444 444
                 'required'   => (bool) $field['required'],
445
-                'label'      => wp_kses_post( $field['label'] ),
445
+                'label'      => wp_kses_post($field['label']),
446 446
                 'no_wrap'    => true,
447 447
                 'rows'       => 3,
448 448
             )
449 449
         );
450 450
 
451
-        if ( ! empty( $field['description'] ) ) {
452
-            $description = wp_kses_post( $field['description'] );
451
+        if (!empty($field['description'])) {
452
+            $description = wp_kses_post($field['description']);
453 453
             echo "<small class='form-text text-muted'>$description</small>";
454 454
         }
455 455
 
@@ -460,16 +460,16 @@  discard block
 block discarded – undo
460 460
     /**
461 461
      * Renders the edit textarea element template.
462 462
      */
463
-    public function edit_textarea_template( $field ) {
464
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
465
-        $label    = __( 'Field Label', 'invoicing' );
463
+    public function edit_textarea_template($field) {
464
+        $restrict = $this->get_restrict_markup($field, 'textarea');
465
+        $label    = __('Field Label', 'invoicing');
466 466
         $id       = $field . '.id + "_edit"';
467
-        $label2   = __( 'Placeholder text', 'invoicing' );
467
+        $label2   = __('Placeholder text', 'invoicing');
468 468
         $id2      = $field . '.id + "_edit2"';
469
-        $label3   = __( 'Help text', 'invoicing' );
470
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
469
+        $label3   = __('Help text', 'invoicing');
470
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
471 471
         $id3      = $field . '.id + "_edit3"';
472
-        $label5   = __( 'Is this field required?', 'invoicing' );
472
+        $label5   = __('Is this field required?', 'invoicing');
473 473
         $id4      = $field . '.id + "_edit4"';
474 474
         echo "
475 475
             <div $restrict>
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
     /**
498 498
      * Renders the select element template.
499 499
      */
500
-    public function render_select_template( $field ) {
501
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
500
+    public function render_select_template($field) {
501
+        $restrict    = $this->get_restrict_markup($field, 'select');
502 502
         $label       = "$field.label";
503 503
         $placeholder = "$field.placeholder";
504 504
         $id          = $field . '.id';
@@ -517,24 +517,24 @@  discard block
 block discarded – undo
517 517
     /**
518 518
      * Renders the select element on the frontend.
519 519
      */
520
-    public function frontend_render_select_template( $field ) {
520
+    public function frontend_render_select_template($field) {
521 521
         
522 522
         echo "<div class='form-group'>";
523 523
 
524 524
         echo aui()->select(
525 525
             array(
526
-                'name'       => esc_attr( $field['id'] ),
527
-                'id'         => esc_attr( $field['id'] ),
528
-                'placeholder'=> esc_attr( $field['placeholder'] ),
526
+                'name'       => esc_attr($field['id']),
527
+                'id'         => esc_attr($field['id']),
528
+                'placeholder'=> esc_attr($field['placeholder']),
529 529
                 'required'   => (bool) $field['required'],
530
-                'label'      => wp_kses_post( $field['label'] ),
530
+                'label'      => wp_kses_post($field['label']),
531 531
                 'no_wrap'    => true,
532 532
                 'options'    => $field['options'],
533 533
             )
534 534
         );
535 535
 
536
-        if ( ! empty( $field['description'] ) ) {
537
-            $description = wp_kses_post( $field['description'] );
536
+        if (!empty($field['description'])) {
537
+            $description = wp_kses_post($field['description']);
538 538
             echo "<small class='form-text text-muted'>$description</small>";
539 539
         }
540 540
 
@@ -545,18 +545,18 @@  discard block
 block discarded – undo
545 545
     /**
546 546
      * Renders the edit select element template.
547 547
      */
548
-    public function edit_select_template( $field ) {
549
-        $restrict = $this->get_restrict_markup( $field, 'select' );
550
-        $label    = __( 'Field Label', 'invoicing' );
548
+    public function edit_select_template($field) {
549
+        $restrict = $this->get_restrict_markup($field, 'select');
550
+        $label    = __('Field Label', 'invoicing');
551 551
         $id       = $field . '.id + "_edit"';
552
-        $label2   = __( 'Placeholder text', 'invoicing' );
552
+        $label2   = __('Placeholder text', 'invoicing');
553 553
         $id2      = $field . '.id + "_edit2"';
554
-        $label3   = __( 'Help text', 'invoicing' );
555
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
554
+        $label3   = __('Help text', 'invoicing');
555
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
556 556
         $id3      = $field . '.id + "_edit3"';
557
-        $label5   = __( 'Is this field required?', 'invoicing' );
557
+        $label5   = __('Is this field required?', 'invoicing');
558 558
         $id4      = $field . '.id + "_edit4"';
559
-        $label6   = __( 'Available Options', 'invoicing' );
559
+        $label6   = __('Available Options', 'invoicing');
560 560
         echo "
561 561
             <div $restrict>
562 562
                 <div class='form-group'>
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
     /**
595 595
      * Renders the checkbox element template.
596 596
      */
597
-    public function render_checkbox_template( $field ) {
598
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
597
+    public function render_checkbox_template($field) {
598
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
599 599
         $label    = "$field.label";
600 600
         echo "
601 601
             <div class='form-check' $restrict>
@@ -609,23 +609,23 @@  discard block
 block discarded – undo
609 609
     /**
610 610
      * Renders the checkbox element on the frontend.
611 611
      */
612
-    public function frontend_render_checkbox_template( $field ) {
612
+    public function frontend_render_checkbox_template($field) {
613 613
         
614 614
         echo "<div class='form-group'>";
615 615
 
616 616
         echo aui()->input(
617 617
             array(
618
-                'name'       => esc_attr( $field['id'] ),
619
-                'id'         => esc_attr( $field['id'] ),
618
+                'name'       => esc_attr($field['id']),
619
+                'id'         => esc_attr($field['id']),
620 620
                 'required'   => (bool) $field['required'],
621
-                'label'      => wp_kses_post( $field['label'] ),
621
+                'label'      => wp_kses_post($field['label']),
622 622
                 'no_wrap'    => true,
623 623
                 'type'       => 'checkbox',
624 624
             )
625 625
         );
626 626
 
627
-        if ( ! empty( $field['description'] ) ) {
628
-            $description = wp_kses_post( $field['description'] );
627
+        if (!empty($field['description'])) {
628
+            $description = wp_kses_post($field['description']);
629 629
             echo "<small class='form-text text-muted'>$description</small>";
630 630
         }
631 631
 
@@ -636,14 +636,14 @@  discard block
 block discarded – undo
636 636
     /**
637 637
      * Renders the edit checkbox element template.
638 638
      */
639
-    public function edit_checkbox_template( $field ) {
640
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
641
-        $label    = __( 'Field Label', 'invoicing' );
639
+    public function edit_checkbox_template($field) {
640
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
641
+        $label    = __('Field Label', 'invoicing');
642 642
         $id       = $field . '.id + "_edit"';
643
-        $label2   = __( 'Help text', 'invoicing' );
644
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
643
+        $label2   = __('Help text', 'invoicing');
644
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
645 645
         $id2      = $field . '.id + "_edit2"';
646
-        $label4   = __( 'Is this field required?', 'invoicing' );
646
+        $label4   = __('Is this field required?', 'invoicing');
647 647
         $id3      = $field . '.id + "_edit3"';
648 648
         echo "
649 649
             <div $restrict>
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
     /**
668 668
      * Renders the radio element template.
669 669
      */
670
-    public function render_radio_template( $field ) {
671
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
670
+    public function render_radio_template($field) {
671
+        $restrict    = $this->get_restrict_markup($field, 'radio');
672 672
         $label       = "$field.label";
673 673
         $id          = $field . '.id';
674 674
         echo "
@@ -686,19 +686,19 @@  discard block
 block discarded – undo
686 686
     /**
687 687
      * Renders the radio element on the frontend.
688 688
      */
689
-    public function frontend_render_radio_template( $field ) {
689
+    public function frontend_render_radio_template($field) {
690 690
         
691 691
         echo "<div class='form-group'>";
692 692
 
693
-        if ( ! empty( $field['label'] ) ) {
694
-            $label = wp_kses_post( $field['label'] );
693
+        if (!empty($field['label'])) {
694
+            $label = wp_kses_post($field['label']);
695 695
             echo "<legend class='col-form-label'>$label</legend>";
696 696
         }
697 697
 
698
-        foreach( $field['options'] as $index => $option ) {
698
+        foreach ($field['options'] as $index => $option) {
699 699
             $id    = $field['id'] . $index;
700
-            $value = esc_attr( $option );
701
-            $label = wp_kses_post( $option );
700
+            $value = esc_attr($option);
701
+            $label = wp_kses_post($option);
702 702
 
703 703
             echo "
704 704
                 <div class='form-check'>
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
             ";
709 709
         }
710 710
 
711
-        if ( ! empty( $field['description'] ) ) {
712
-            $description = wp_kses_post( $field['description'] );
711
+        if (!empty($field['description'])) {
712
+            $description = wp_kses_post($field['description']);
713 713
             echo "<small class='form-text text-muted'>$description</small>";
714 714
         }
715 715
 
@@ -720,16 +720,16 @@  discard block
 block discarded – undo
720 720
     /**
721 721
      * Renders the edit radio element template.
722 722
      */
723
-    public function edit_radio_template( $field ) {
724
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
725
-        $label    = __( 'Field Label', 'invoicing' );
723
+    public function edit_radio_template($field) {
724
+        $restrict = $this->get_restrict_markup($field, 'radio');
725
+        $label    = __('Field Label', 'invoicing');
726 726
         $id       = $field . '.id + "_edit"';
727
-        $label2   = __( 'Help text', 'invoicing' );
728
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
727
+        $label2   = __('Help text', 'invoicing');
728
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
729 729
         $id2      = $field . '.id + "_edit3"';
730
-        $label4   = __( 'Is this field required?', 'invoicing' );
730
+        $label4   = __('Is this field required?', 'invoicing');
731 731
         $id3      = $field . '.id + "_edit4"';
732
-        $label5   = __( 'Available Options', 'invoicing' );
732
+        $label5   = __('Available Options', 'invoicing');
733 733
         echo "
734 734
             <div $restrict>
735 735
                 <div class='form-group'>
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
     /**
764 764
      * Renders the email element template.
765 765
      */
766
-    public function render_email_template( $field ) {
767
-        $restrict = $this->get_restrict_markup( $field, 'email' );
766
+    public function render_email_template($field) {
767
+        $restrict = $this->get_restrict_markup($field, 'email');
768 768
         $label    = "$field.label";
769 769
         echo "
770 770
             <div $restrict>
@@ -778,23 +778,23 @@  discard block
 block discarded – undo
778 778
     /**
779 779
      * Renders the email element on the frontend.
780 780
      */
781
-    public function frontend_render_email_template( $field ) {
781
+    public function frontend_render_email_template($field) {
782 782
         
783 783
         echo "<div class='form-group'>";
784 784
 
785 785
         echo aui()->input(
786 786
             array(
787
-                'name'       => esc_attr( $field['id'] ),
788
-                'id'         => esc_attr( $field['id'] ),
787
+                'name'       => esc_attr($field['id']),
788
+                'id'         => esc_attr($field['id']),
789 789
                 'required'   => (bool) $field['required'],
790
-                'label'      => wp_kses_post( $field['label'] ),
790
+                'label'      => wp_kses_post($field['label']),
791 791
                 'no_wrap'    => true,
792 792
                 'type'       => 'email',
793 793
             )
794 794
         );
795 795
 
796
-        if ( ! empty( $field['description'] ) ) {
797
-            $description = wp_kses_post( $field['description'] );
796
+        if (!empty($field['description'])) {
797
+            $description = wp_kses_post($field['description']);
798 798
             echo "<small class='form-text text-muted'>$description</small>";
799 799
         }
800 800
 
@@ -805,16 +805,16 @@  discard block
 block discarded – undo
805 805
     /**
806 806
      * Renders the edit email element template.
807 807
      */
808
-    public function edit_email_template( $field ) {
809
-        $restrict = $this->get_restrict_markup( $field, 'email' );
810
-        $label    = __( 'Field Label', 'invoicing' );
808
+    public function edit_email_template($field) {
809
+        $restrict = $this->get_restrict_markup($field, 'email');
810
+        $label    = __('Field Label', 'invoicing');
811 811
         $id       = $field . '.id + "_edit"';
812
-        $label2   = __( 'Placeholder text', 'invoicing' );
812
+        $label2   = __('Placeholder text', 'invoicing');
813 813
         $id2      = $field . '.id + "_edit2"';
814
-        $label3   = __( 'Help text', 'invoicing' );
815
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
814
+        $label3   = __('Help text', 'invoicing');
815
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
816 816
         $id3      = $field . '.id + "_edit3"';
817
-        $label5   = __( 'Is this field required?', 'invoicing' );
817
+        $label5   = __('Is this field required?', 'invoicing');
818 818
         $id4      = $field . '.id + "_edit4"';
819 819
         echo "
820 820
             <div $restrict>
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
     /**
843 843
      * Renders the website element template.
844 844
      */
845
-    public function render_website_template( $field ) {
846
-        $restrict = $this->get_restrict_markup( $field, 'website' );
845
+    public function render_website_template($field) {
846
+        $restrict = $this->get_restrict_markup($field, 'website');
847 847
         $label    = "$field.label";
848 848
         echo "
849 849
             <div $restrict>
@@ -857,23 +857,23 @@  discard block
 block discarded – undo
857 857
     /**
858 858
      * Renders the website element on the frontend.
859 859
      */
860
-    public function frontend_render_website_template( $field ) {
860
+    public function frontend_render_website_template($field) {
861 861
         
862 862
         echo "<div class='form-group'>";
863 863
 
864 864
         echo aui()->input(
865 865
             array(
866
-                'name'       => esc_attr( $field['id'] ),
867
-                'id'         => esc_attr( $field['id'] ),
866
+                'name'       => esc_attr($field['id']),
867
+                'id'         => esc_attr($field['id']),
868 868
                 'required'   => (bool) $field['required'],
869
-                'label'      => wp_kses_post( $field['label'] ),
869
+                'label'      => wp_kses_post($field['label']),
870 870
                 'no_wrap'    => true,
871 871
                 'type'       => 'url',
872 872
             )
873 873
         );
874 874
 
875
-        if ( ! empty( $field['description'] ) ) {
876
-            $description = wp_kses_post( $field['description'] );
875
+        if (!empty($field['description'])) {
876
+            $description = wp_kses_post($field['description']);
877 877
             echo "<small class='form-text text-muted'>$description</small>";
878 878
         }
879 879
 
@@ -884,16 +884,16 @@  discard block
 block discarded – undo
884 884
     /**
885 885
      * Renders the edit website element template.
886 886
      */
887
-    public function edit_website_template( $field ) {
888
-        $restrict = $this->get_restrict_markup( $field, 'website' );
889
-        $label    = __( 'Field Label', 'invoicing' );
887
+    public function edit_website_template($field) {
888
+        $restrict = $this->get_restrict_markup($field, 'website');
889
+        $label    = __('Field Label', 'invoicing');
890 890
         $id       = $field . '.id + "_edit"';
891
-        $label2   = __( 'Placeholder text', 'invoicing' );
891
+        $label2   = __('Placeholder text', 'invoicing');
892 892
         $id2      = $field . '.id + "_edit2"';
893
-        $label3   = __( 'Help text', 'invoicing' );
894
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
893
+        $label3   = __('Help text', 'invoicing');
894
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
895 895
         $id3      = $field . '.id + "_edit3"';
896
-        $label5   = __( 'Is this field required?', 'invoicing' );
896
+        $label5   = __('Is this field required?', 'invoicing');
897 897
         $id4      = $field . '.id + "_edit4"';
898 898
         echo "
899 899
             <div $restrict>
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
     /**
922 922
      * Renders the date element template.
923 923
      */
924
-    public function render_date_template( $field ) {
925
-        $restrict = $this->get_restrict_markup( $field, 'date' );
924
+    public function render_date_template($field) {
925
+        $restrict = $this->get_restrict_markup($field, 'date');
926 926
         $label    = "$field.label";
927 927
         echo "
928 928
             <div $restrict>
@@ -936,23 +936,23 @@  discard block
 block discarded – undo
936 936
     /**
937 937
      * Renders the date element on the frontend.
938 938
      */
939
-    public function frontend_render_date_template( $field ) {
939
+    public function frontend_render_date_template($field) {
940 940
         
941 941
         echo "<div class='form-group'>";
942 942
 
943 943
         echo aui()->input(
944 944
             array(
945
-                'name'       => esc_attr( $field['id'] ),
946
-                'id'         => esc_attr( $field['id'] ),
945
+                'name'       => esc_attr($field['id']),
946
+                'id'         => esc_attr($field['id']),
947 947
                 'required'   => (bool) $field['required'],
948
-                'label'      => wp_kses_post( $field['label'] ),
948
+                'label'      => wp_kses_post($field['label']),
949 949
                 'no_wrap'    => true,
950 950
                 'type'       => 'date',
951 951
             )
952 952
         );
953 953
 
954
-        if ( ! empty( $field['description'] ) ) {
955
-            $description = wp_kses_post( $field['description'] );
954
+        if (!empty($field['description'])) {
955
+            $description = wp_kses_post($field['description']);
956 956
             echo "<small class='form-text text-muted'>$description</small>";
957 957
         }
958 958
 
@@ -963,16 +963,16 @@  discard block
 block discarded – undo
963 963
     /**
964 964
      * Renders the edit date element template.
965 965
      */
966
-    public function edit_date_template( $field ) {
967
-        $restrict = $this->get_restrict_markup( $field, 'date' );
968
-        $label    = __( 'Field Label', 'invoicing' );
966
+    public function edit_date_template($field) {
967
+        $restrict = $this->get_restrict_markup($field, 'date');
968
+        $label    = __('Field Label', 'invoicing');
969 969
         $id       = $field . '.id + "_edit"';
970
-        $label2   = __( 'Placeholder text', 'invoicing' );
970
+        $label2   = __('Placeholder text', 'invoicing');
971 971
         $id2      = $field . '.id + "_edit2"';
972
-        $label3   = __( 'Help text', 'invoicing' );
973
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
972
+        $label3   = __('Help text', 'invoicing');
973
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
974 974
         $id3      = $field . '.id + "_edit3"';
975
-        $label5   = __( 'Is this field required?', 'invoicing' );
975
+        $label5   = __('Is this field required?', 'invoicing');
976 976
         $id4      = $field . '.id + "_edit4"';
977 977
         echo "
978 978
             <div $restrict>
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
     /**
1001 1001
      * Renders the time element template.
1002 1002
      */
1003
-    public function render_time_template( $field ) {
1004
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1003
+    public function render_time_template($field) {
1004
+        $restrict = $this->get_restrict_markup($field, 'time');
1005 1005
         $label    = "$field.label";
1006 1006
         echo "
1007 1007
             <div $restrict>
@@ -1015,23 +1015,23 @@  discard block
 block discarded – undo
1015 1015
     /**
1016 1016
      * Renders the time element on the frontend.
1017 1017
      */
1018
-    public function frontend_render_time_template( $field ) {
1018
+    public function frontend_render_time_template($field) {
1019 1019
         
1020 1020
         echo "<div class='form-group'>";
1021 1021
 
1022 1022
         echo aui()->input(
1023 1023
             array(
1024
-                'name'       => esc_attr( $field['id'] ),
1025
-                'id'         => esc_attr( $field['id'] ),
1024
+                'name'       => esc_attr($field['id']),
1025
+                'id'         => esc_attr($field['id']),
1026 1026
                 'required'   => (bool) $field['required'],
1027
-                'label'      => wp_kses_post( $field['label'] ),
1027
+                'label'      => wp_kses_post($field['label']),
1028 1028
                 'no_wrap'    => true,
1029 1029
                 'type'       => 'time',
1030 1030
             )
1031 1031
         );
1032 1032
 
1033
-        if ( ! empty( $field['description'] ) ) {
1034
-            $description = wp_kses_post( $field['description'] );
1033
+        if (!empty($field['description'])) {
1034
+            $description = wp_kses_post($field['description']);
1035 1035
             echo "<small class='form-text text-muted'>$description</small>";
1036 1036
         }
1037 1037
 
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
     /**
1043 1043
      * Renders the edit time element template.
1044 1044
      */
1045
-    public function edit_time_template( $field ) {
1046
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1047
-        $label    = __( 'Field Label', 'invoicing' );
1045
+    public function edit_time_template($field) {
1046
+        $restrict = $this->get_restrict_markup($field, 'time');
1047
+        $label    = __('Field Label', 'invoicing');
1048 1048
         $id       = $field . '.id + "_edit"';
1049
-        $label2   = __( 'Placeholder text', 'invoicing' );
1049
+        $label2   = __('Placeholder text', 'invoicing');
1050 1050
         $id2      = $field . '.id + "_edit2"';
1051
-        $label3   = __( 'Help text', 'invoicing' );
1052
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1051
+        $label3   = __('Help text', 'invoicing');
1052
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1053 1053
         $id3      = $field . '.id + "_edit3"';
1054
-        $label5   = __( 'Is this field required?', 'invoicing' );
1054
+        $label5   = __('Is this field required?', 'invoicing');
1055 1055
         $id4      = $field . '.id + "_edit4"';
1056 1056
         echo "
1057 1057
             <div $restrict>
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
     /**
1080 1080
      * Renders the number element template.
1081 1081
      */
1082
-    public function render_number_template( $field ) {
1083
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1082
+    public function render_number_template($field) {
1083
+        $restrict = $this->get_restrict_markup($field, 'number');
1084 1084
         $label    = "$field.label";
1085 1085
         echo "
1086 1086
             <div $restrict>
@@ -1094,23 +1094,23 @@  discard block
 block discarded – undo
1094 1094
     /**
1095 1095
      * Renders the number element on the frontend.
1096 1096
      */
1097
-    public function frontend_render_number_template( $field ) {
1097
+    public function frontend_render_number_template($field) {
1098 1098
         
1099 1099
         echo "<div class='form-group'>";
1100 1100
 
1101 1101
         echo aui()->input(
1102 1102
             array(
1103
-                'name'       => esc_attr( $field['id'] ),
1104
-                'id'         => esc_attr( $field['id'] ),
1103
+                'name'       => esc_attr($field['id']),
1104
+                'id'         => esc_attr($field['id']),
1105 1105
                 'required'   => (bool) $field['required'],
1106
-                'label'      => wp_kses_post( $field['label'] ),
1106
+                'label'      => wp_kses_post($field['label']),
1107 1107
                 'no_wrap'    => true,
1108 1108
                 'type'       => 'number',
1109 1109
             )
1110 1110
         );
1111 1111
 
1112
-        if ( ! empty( $field['description'] ) ) {
1113
-            $description = wp_kses_post( $field['description'] );
1112
+        if (!empty($field['description'])) {
1113
+            $description = wp_kses_post($field['description']);
1114 1114
             echo "<small class='form-text text-muted'>$description</small>";
1115 1115
         }
1116 1116
 
@@ -1121,16 +1121,16 @@  discard block
 block discarded – undo
1121 1121
     /**
1122 1122
      * Renders the edit number element template.
1123 1123
      */
1124
-    public function edit_number_template( $field ) {
1125
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1126
-        $label    = __( 'Field Label', 'invoicing' );
1124
+    public function edit_number_template($field) {
1125
+        $restrict = $this->get_restrict_markup($field, 'number');
1126
+        $label    = __('Field Label', 'invoicing');
1127 1127
         $id       = $field . '.id + "_edit"';
1128
-        $label2   = __( 'Placeholder text', 'invoicing' );
1128
+        $label2   = __('Placeholder text', 'invoicing');
1129 1129
         $id2      = $field . '.id + "_edit2"';
1130
-        $label3   = __( 'Help text', 'invoicing' );
1131
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1130
+        $label3   = __('Help text', 'invoicing');
1131
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1132 1132
         $id3      = $field . '.id + "_edit3"';
1133
-        $label5   = __( 'Is this field required?', 'invoicing' );
1133
+        $label5   = __('Is this field required?', 'invoicing');
1134 1134
         $id4      = $field . '.id + "_edit4"';
1135 1135
         echo "
1136 1136
             <div $restrict>
@@ -1158,23 +1158,23 @@  discard block
 block discarded – undo
1158 1158
     /**
1159 1159
      * Renders the separator element template.
1160 1160
      */
1161
-    public function render_separator_template( $field ) {
1162
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1161
+    public function render_separator_template($field) {
1162
+        $restrict = $this->get_restrict_markup($field, 'separator');
1163 1163
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1164 1164
     }
1165 1165
 
1166 1166
     /**
1167 1167
      * Renders the separator element on the frontend.
1168 1168
      */
1169
-    public function frontend_render_separator_template( $field ) {
1169
+    public function frontend_render_separator_template($field) {
1170 1170
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1171 1171
     }
1172 1172
 
1173 1173
     /**
1174 1174
      * Renders the pay button element template.
1175 1175
      */
1176
-    public function render_pay_button_template( $field ) {
1177
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1176
+    public function render_pay_button_template($field) {
1177
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1178 1178
         $label    = "$field.label";
1179 1179
         echo "
1180 1180
             <div $restrict>
@@ -1187,24 +1187,24 @@  discard block
 block discarded – undo
1187 1187
     /**
1188 1188
      * Renders the pay_button element on the frontend.
1189 1189
      */
1190
-    public function frontend_render_pay_button_template( $field ) {
1190
+    public function frontend_render_pay_button_template($field) {
1191 1191
         
1192 1192
         echo "<div class='form-group'>";
1193 1193
 
1194
-        $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1194
+        $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']);
1195 1195
         echo aui()->button(
1196 1196
             array(
1197
-                'name'       => esc_attr( $field['id'] ),
1198
-                'id'         => esc_attr( $field['id'] ),
1199
-                'content'    => wp_kses_post( $field['label'] ),
1197
+                'name'       => esc_attr($field['id']),
1198
+                'id'         => esc_attr($field['id']),
1199
+                'content'    => wp_kses_post($field['label']),
1200 1200
                 'no_wrap'    => true,
1201 1201
                 'type'       => 'button',
1202 1202
                 'class'      => $class,
1203 1203
             )
1204 1204
         );
1205 1205
 
1206
-        if ( ! empty( $field['description'] ) ) {
1207
-            $description = wp_kses_post( $field['description'] );
1206
+        if (!empty($field['description'])) {
1207
+            $description = wp_kses_post($field['description']);
1208 1208
             echo "<small class='form-text text-muted'>$description</small>";
1209 1209
         }
1210 1210
 
@@ -1215,14 +1215,14 @@  discard block
 block discarded – undo
1215 1215
     /**
1216 1216
      * Renders the pay button element template.
1217 1217
      */
1218
-    public function edit_pay_button_template( $field ) {
1219
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1220
-        $label    = __( 'Button Text', 'invoicing' );
1218
+    public function edit_pay_button_template($field) {
1219
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1220
+        $label    = __('Button Text', 'invoicing');
1221 1221
         $id       = $field . '.id + "_edit"';
1222
-        $label2   = __( 'Help text', 'invoicing' );
1223
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1222
+        $label2   = __('Help text', 'invoicing');
1223
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1224 1224
         $id2      = $field . '.id + "_edit2"';
1225
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1225
+        $label4   = esc_attr__('Button Type', 'invoicing');
1226 1226
         $id3      = $field . '.id + "_edit3"';
1227 1227
         echo "
1228 1228
             <div $restrict>
@@ -1238,15 +1238,15 @@  discard block
 block discarded – undo
1238 1238
                     <label :for='$id3'>$label4</label>
1239 1239
 
1240 1240
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1241
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1242
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1243
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1244
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1245
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1246
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1247
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1248
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1249
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1241
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1242
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1243
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1244
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1245
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1246
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1247
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1248
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1249
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1250 1250
                     </select>
1251 1251
                 </div>
1252 1252
             </div>
@@ -1257,8 +1257,8 @@  discard block
 block discarded – undo
1257 1257
     /**
1258 1258
      * Renders the alert element template.
1259 1259
      */
1260
-    public function render_alert_template( $field ) {
1261
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1260
+    public function render_alert_template($field) {
1261
+        $restrict = $this->get_restrict_markup($field, 'alert');
1262 1262
         $text     = "$field.text";
1263 1263
         echo "
1264 1264
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1273,15 +1273,15 @@  discard block
 block discarded – undo
1273 1273
     /**
1274 1274
      * Renders the alert element on the frontend.
1275 1275
      */
1276
-    public function frontend_render_alert_template( $field ) {
1276
+    public function frontend_render_alert_template($field) {
1277 1277
         
1278 1278
         echo "<div class='form-group'>";
1279 1279
 
1280 1280
         echo aui()->alert(
1281 1281
             array(
1282
-                'content'     => wp_kses_post( $field['text'] ),
1282
+                'content'     => wp_kses_post($field['text']),
1283 1283
                 'dismissible' => $field['dismissible'],
1284
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1284
+                'type'        => str_replace('alert-', '', $field['class']),
1285 1285
             )
1286 1286
         );
1287 1287
 
@@ -1292,14 +1292,14 @@  discard block
 block discarded – undo
1292 1292
     /**
1293 1293
      * Renders the alert element template.
1294 1294
      */
1295
-    public function edit_alert_template( $field ) {
1296
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1297
-        $label    = __( 'Alert Text', 'invoicing' );
1298
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1295
+    public function edit_alert_template($field) {
1296
+        $restrict = $this->get_restrict_markup($field, 'alert');
1297
+        $label    = __('Alert Text', 'invoicing');
1298
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1299 1299
         $id       = $field . '.id + "_edit"';
1300
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1300
+        $label3   = __('Is Dismissible?', 'invoicing');
1301 1301
         $id2      = $field . '.id + "_edit2"';
1302
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1302
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1303 1303
         $id3      = $field . '.id + "_edit3"';
1304 1304
         echo "
1305 1305
             <div $restrict>
@@ -1315,14 +1315,14 @@  discard block
 block discarded – undo
1315 1315
                     <label :for='$id3'>$label4</label>
1316 1316
 
1317 1317
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1318
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1319
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1320
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1321
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1322
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1323
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1324
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1325
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1318
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1319
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1320
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1321
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1322
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1323
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1324
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1325
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1326 1326
                     </select>
1327 1327
                 </div>
1328 1328
             </div>
@@ -1333,8 +1333,8 @@  discard block
 block discarded – undo
1333 1333
     /**
1334 1334
      * Renders the discount element template.
1335 1335
      */
1336
-    public function render_discount_template( $field ) {
1337
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1336
+    public function render_discount_template($field) {
1337
+        $restrict = $this->get_restrict_markup($field, 'discount');
1338 1338
         ?>
1339 1339
 
1340 1340
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1351,13 +1351,13 @@  discard block
 block discarded – undo
1351 1351
     /**
1352 1352
      * Renders the discount element on the frontend.
1353 1353
      */
1354
-    public function frontend_render_discount_template( $field ) {
1354
+    public function frontend_render_discount_template($field) {
1355 1355
         
1356
-        $placeholder = esc_attr( $field['input_label'] );
1357
-        $label       = sanitize_text_field( $field['button_label'] );
1356
+        $placeholder = esc_attr($field['input_label']);
1357
+        $label       = sanitize_text_field($field['button_label']);
1358 1358
         $description = '';
1359 1359
 
1360
-        if ( ! empty( $field['description'] ) ) {
1360
+        if (!empty($field['description'])) {
1361 1361
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1362 1362
         }
1363 1363
 ?>
@@ -1378,12 +1378,12 @@  discard block
 block discarded – undo
1378 1378
     /**
1379 1379
      * Renders the discount element template.
1380 1380
      */
1381
-    public function edit_discount_template( $field ) {
1382
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1383
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1384
-        $label2   = __( 'Help Text', 'invoicing' );
1385
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1386
-        $label4   = __( 'Button Text', 'invoicing' );
1381
+    public function edit_discount_template($field) {
1382
+        $restrict = $this->get_restrict_markup($field, 'discount');
1383
+        $label    = __('Discount Input Placeholder', 'invoicing');
1384
+        $label2   = __('Help Text', 'invoicing');
1385
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1386
+        $label4   = __('Button Text', 'invoicing');
1387 1387
         $id       = $field . '.id + "_edit"';
1388 1388
         $id2      = $field . '.id + "_edit2"';
1389 1389
         $id3      = $field . '.id + "_edit3"';
@@ -1412,8 +1412,8 @@  discard block
 block discarded – undo
1412 1412
     /**
1413 1413
      * Renders the items element template.
1414 1414
      */
1415
-    public function render_items_template( $field ) {
1416
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1415
+    public function render_items_template($field) {
1416
+        $restrict = $this->get_restrict_markup($field, 'items');
1417 1417
         echo "
1418 1418
             <div $restrict class='item_totals'>
1419 1419
 
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
                 <div v-if='$field.items_type == \"select\"'>
1459 1459
 
1460 1460
                     <select class='form-control custom-select'>
1461
-                        <option value='' disabled selected='selected'>"        . __( 'Select an option', 'invoicing' ) ."</option>
1461
+                        <option value='' disabled selected='selected'>" . __('Select an option', 'invoicing') . "</option>
1462 1462
                         <option v-for='(item, index) in form_items' :value='index'>{{item.title}} &nbsp;{{formatPrice(item.price)}}</option>
1463 1463
                     </select>
1464 1464
                 </div>
@@ -1479,66 +1479,66 @@  discard block
 block discarded – undo
1479 1479
     /**
1480 1480
      * Renders the items element on the frontend.
1481 1481
      */
1482
-    public function frontend_render_items_template( $field, $items ) {
1482
+    public function frontend_render_items_template($field, $items) {
1483 1483
         
1484 1484
         echo "<div class='form-group item_totals'>";
1485 1485
         
1486
-        $id = esc_attr( $field['id'] );
1487
-        if ( 'total' == $field[ 'items_type' ] ) {
1486
+        $id = esc_attr($field['id']);
1487
+        if ('total' == $field['items_type']) {
1488 1488
             $total = 0;
1489 1489
 
1490 1490
             ?>
1491 1491
             <div class="border item_totals_type_total">
1492 1492
 
1493 1493
                 <?php
1494
-                    foreach( $items as $item ) {
1495
-                        $total = $total + floatval( $item['price'] );
1494
+                    foreach ($items as $item) {
1495
+                        $total = $total + floatval($item['price']);
1496 1496
                 ?>
1497 1497
                     <div  class="item_totals_item">
1498 1498
                         <div class='row pl-2 pr-2 pt-2'>
1499
-                            <div class='col-8'><?php echo esc_html( $item['title'] ) ?></div>
1500
-                            <div class='col-4'><?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?></div>
1499
+                            <div class='col-8'><?php echo esc_html($item['title']) ?></div>
1500
+                            <div class='col-4'><?php echo wpinv_price(wpinv_format_amount($item['price'])) ?></div>
1501 1501
                         </div>
1502
-                        <?php if ( ! empty( $item['description'] )) { ?>
1503
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1502
+                        <?php if (!empty($item['description'])) { ?>
1503
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1504 1504
                         <?php } ?>
1505 1505
                     </div>
1506 1506
                 <?php } ?>
1507 1507
 
1508 1508
                 <div class='mt-4 border-top item_totals_total'>
1509 1509
                     <div class='row p-2'>
1510
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1511
-                        <div class='col-4'><strong><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1510
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1511
+                        <div class='col-4'><strong><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1512 1512
                     </div>
1513 1513
                 </div>
1514 1514
 
1515 1515
             </div>
1516 1516
         <?php } ?>
1517 1517
 
1518
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1518
+        <?php if ('radio' == $field['items_type']) { ?>
1519 1519
             <div class="item_totals_type_radio">
1520 1520
 
1521
-                <?php foreach( $items as $index => $item ) { ?>
1521
+                <?php foreach ($items as $index => $item) { ?>
1522 1522
                     <div  class="form-check">
1523 1523
                         <input class='form-check-input' type='radio' name='<?php echo $id; ?>' id='<?php echo $id . $index; ?>'>
1524
-                        <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>
1524
+                        <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>
1525 1525
                     </div>
1526
-                    <?php if ( ! empty( $item['description'] )) { ?>
1527
-                        <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1526
+                    <?php if (!empty($item['description'])) { ?>
1527
+                        <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1528 1528
                     <?php } ?>
1529 1529
                 <?php } ?>
1530 1530
 
1531 1531
             </div>
1532 1532
         <?php } ?>
1533 1533
 
1534
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
1534
+        <?php if ('checkbox' == $field['items_type']) { ?>
1535 1535
 
1536 1536
             <div class="item_totals_type_checkbox">
1537 1537
 
1538 1538
                 <?php
1539
-                    foreach ( $items as $index => $item ) {
1540
-                        $title = sanitize_text_field(  $item['title'] );
1541
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1539
+                    foreach ($items as $index => $item) {
1540
+                        $title = sanitize_text_field($item['title']);
1541
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1542 1542
                         echo aui()->input(
1543 1543
                             array(
1544 1544
                                 'name'       => $id,
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
                             )
1550 1550
                         );
1551 1551
 
1552
-                        if ( ! empty( $item['description'] ) ) {
1552
+                        if (!empty($item['description'])) {
1553 1553
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
1554 1554
                         }
1555 1555
                     }
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
             </div>
1559 1559
         <?php } ?>
1560 1560
 
1561
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
1561
+        <?php if ('select' == $field['items_type']) { ?>
1562 1562
 
1563 1563
             <div class="item_totals_type_select">
1564 1564
 
@@ -1566,17 +1566,17 @@  discard block
 block discarded – undo
1566 1566
 
1567 1567
                     $options = array();
1568 1568
 
1569
-                    foreach ( $items as $index => $item ) {
1570
-                        $title = sanitize_text_field(  $item['title'] );
1571
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1572
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1569
+                    foreach ($items as $index => $item) {
1570
+                        $title = sanitize_text_field($item['title']);
1571
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1572
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1573 1573
                     }
1574 1574
 
1575 1575
                     echo aui()->select(
1576 1576
                         array(
1577 1577
                                 'name'        => $id,
1578 1578
                                 'id'          => $id,
1579
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
1579
+                                'placeholder' => __('Select an item', 'invoicing'),
1580 1580
                                 'no_wrap'     => true,
1581 1581
                                 'options'     => $options,
1582 1582
                         )
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
             </div>
1587 1587
         <?php } ?>
1588 1588
 
1589
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
1589
+        <?php if ('multi_select' == $field['items_type']) { ?>
1590 1590
 
1591 1591
             <div class="item_totals_type_multi_select">
1592 1592
 
@@ -1594,17 +1594,17 @@  discard block
 block discarded – undo
1594 1594
 
1595 1595
                     $options = array();
1596 1596
 
1597
-                    foreach ( $items as $index => $item ) {
1598
-                        $title = sanitize_text_field(  $item['title'] );
1599
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1600
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1597
+                    foreach ($items as $index => $item) {
1598
+                        $title = sanitize_text_field($item['title']);
1599
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1600
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1601 1601
                     }
1602 1602
 
1603 1603
                     echo aui()->select(
1604 1604
                         array(
1605 1605
                                 'name'        => $id,
1606 1606
                                 'id'          => $id,
1607
-                                'placeholder' => __( 'Select one or more items', 'invoicing' ),
1607
+                                'placeholder' => __('Select one or more items', 'invoicing'),
1608 1608
                                 'no_wrap'     => true,
1609 1609
                                 'options'     => $options,
1610 1610
                                 'multiple'    => true,
@@ -1622,11 +1622,11 @@  discard block
 block discarded – undo
1622 1622
     /**
1623 1623
      * Renders the items element template.
1624 1624
      */
1625
-    public function edit_items_template( $field ) {
1626
-        $restrict = $this->get_restrict_markup( $field, 'items' );
1627
-        $label    = __( 'Let customers...', 'invoicing' );
1628
-        $label2   = __( 'Available Items', 'invoicing' );
1629
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
1625
+    public function edit_items_template($field) {
1626
+        $restrict = $this->get_restrict_markup($field, 'items');
1627
+        $label    = __('Let customers...', 'invoicing');
1628
+        $label2   = __('Available Items', 'invoicing');
1629
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
1630 1630
         $id       = $field . '.id + "_edit"';
1631 1631
         $id2      = $field . '.id + "_edit2"';
1632 1632
         $id3      = $field . '.id + "_edit3"';
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
                 <div class='form-group mt-2'>
1677 1677
 
1678 1678
                     <select class='form-control custom-select' v-model='selected_item'>
1679
-                        <option value=''>"        . __( 'Add an item to the form', 'invoicing' ) ."</option>
1679
+                        <option value=''>" . __('Add an item to the form', 'invoicing') . "</option>
1680 1680
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
1681 1681
                     </select>
1682 1682
 
@@ -1691,11 +1691,11 @@  discard block
 block discarded – undo
1691 1691
                     <label :for='$id2'>$label</label>
1692 1692
 
1693 1693
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
1694
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
1695
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
1696
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
1697
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
1698
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
1694
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
1695
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
1696
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
1697
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
1698
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
1699 1699
                     </select>
1700 1700
 
1701 1701
                 </div>
@@ -1720,24 +1720,24 @@  discard block
 block discarded – undo
1720 1720
             'orderby'        => 'title',
1721 1721
             'order'          => 'ASC',
1722 1722
             'posts_per_page' => -1,
1723
-            'post_status'    => array( 'publish' ),
1723
+            'post_status'    => array('publish'),
1724 1724
         );
1725 1725
     
1726
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
1726
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
1727 1727
 
1728
-        if ( empty( $items ) ) {
1728
+        if (empty($items)) {
1729 1729
             return array();
1730 1730
         }
1731 1731
 
1732
-        $options    = array();
1733
-        foreach ( $items as $item ) {
1734
-            $title       = esc_html( $item->post_title );
1735
-            $title      .= wpinv_get_item_suffix( $item->ID, false );
1736
-            $id          = absint( $item->ID );
1737
-            $price       = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
1738
-            $recurring   = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
1732
+        $options = array();
1733
+        foreach ($items as $item) {
1734
+            $title       = esc_html($item->post_title);
1735
+            $title      .= wpinv_get_item_suffix($item->ID, false);
1736
+            $id          = absint($item->ID);
1737
+            $price       = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
1738
+            $recurring   = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
1739 1739
             $description = $item->post_excerpt;
1740
-            $options[] = compact( 'title', 'id', 'price', 'recurring', 'description' );
1740
+            $options[] = compact('title', 'id', 'price', 'recurring', 'description');
1741 1741
 
1742 1742
         }
1743 1743
         return $options;
@@ -1747,38 +1747,38 @@  discard block
 block discarded – undo
1747 1747
     /**
1748 1748
      * Returns an array of items for the currently being edited form.
1749 1749
      */
1750
-    public function get_form_items( $id = false ) {
1750
+    public function get_form_items($id = false) {
1751 1751
         
1752
-        if ( empty( $id ) ) {
1753
-            return wpinv_get_data( 'sample-payment-form-items' );
1752
+        if (empty($id)) {
1753
+            return wpinv_get_data('sample-payment-form-items');
1754 1754
         }
1755 1755
         
1756
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
1756
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
1757 1757
 
1758
-        if ( is_array( $form_elements ) ) {
1758
+        if (is_array($form_elements)) {
1759 1759
             return $form_elements;
1760 1760
         }
1761 1761
 
1762
-        return wpinv_get_data( 'sample-payment-form-items' );
1762
+        return wpinv_get_data('sample-payment-form-items');
1763 1763
 
1764 1764
     }
1765 1765
 
1766 1766
     /**
1767 1767
      * Returns an array of elements for the currently being edited form.
1768 1768
      */
1769
-    public function get_form_elements( $id = false ) {
1769
+    public function get_form_elements($id = false) {
1770 1770
 
1771
-        if ( empty( $id ) ) {
1772
-            return wpinv_get_data( 'sample-payment-form' );
1771
+        if (empty($id)) {
1772
+            return wpinv_get_data('sample-payment-form');
1773 1773
         }
1774 1774
         
1775
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
1775
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
1776 1776
 
1777
-        if ( is_array( $form_elements ) ) {
1777
+        if (is_array($form_elements)) {
1778 1778
             return $form_elements;
1779 1779
         }
1780 1780
 
1781
-        return wpinv_get_data( 'sample-payment-form' );
1781
+        return wpinv_get_data('sample-payment-form');
1782 1782
     }
1783 1783
 
1784 1784
 }
Please login to merge, or discard this patch.