Passed
Push — master ( 03dff3...2bff3c )
by Stiofan
01:08 queued 13s
created
vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function inflectPackageVars($vars)
19 19
     {
20
-        $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
20
+        $vars['name'] = preg_replace_callback('/(-[a-z])/', function($matches) {
21 21
             return strtoupper($matches[0][1]);
22 22
         }, $vars['name']);
23 23
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected function inflectModuleVars($vars)
37 37
     {
38
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
39
-        $vars['name'] = str_replace('module-', '', $vars['name']);      // strip out module-
40
-        $vars['name'] = preg_replace('/-module$/', '', $vars['name']);  // strip out -module
41
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
42
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
38
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+        $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+        $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
43 43
 
44 44
         return $vars;
45 45
     }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function inflectThemeVars($vars)
54 54
     {
55
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
56
-        $vars['name'] = str_replace('theme-', '', $vars['name']);       // strip out theme-
57
-        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);   // strip out -theme
58
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
59
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
55
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+        $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
60 60
 
61 61
         return $vars;
62 62
     }
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     private function correctPluginName($vars)
39 39
     {
40
-        $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
40
+        $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) {
41 41
             return strtoupper($matches[0][1]);
42 42
         }, $vars['name']);
43 43
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
     }
7 7
 }
8 8
 if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
9
-    die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
10
-        'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
11
-        'php composer.phar install'.PHP_EOL);
9
+    die('You must set up the project dependencies, run the following commands:' . PHP_EOL .
10
+        'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
11
+        'php composer.phar install' . PHP_EOL);
12 12
 }
13 13
 return $loader;
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Spacing   +176 added lines, -176 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();
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
     }
32 32
     
33 33
     public function define_constants() {
34
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
35
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
34
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
35
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
36 36
     }
37 37
     
38 38
     private function actions() {
39 39
         /* Internationalize the text strings used. */
40
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
40
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
41 41
         
42 42
         /* Perform actions on admin initialization. */
43
-        add_action( 'admin_init', array( &$this, 'admin_init') );
44
-        add_action( 'init', array( &$this, 'init' ), 3 );
45
-        add_action( 'init', array( 'WPInv_Shortcodes', 'init' ) );
46
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
43
+        add_action('admin_init', array(&$this, 'admin_init'));
44
+        add_action('init', array(&$this, 'init'), 3);
45
+        add_action('init', array('WPInv_Shortcodes', 'init'));
46
+        add_action('init', array(&$this, 'wpinv_actions'));
47 47
         
48
-        if ( class_exists( 'BuddyPress' ) ) {
49
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
48
+        if (class_exists('BuddyPress')) {
49
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
50 50
         }
51 51
 
52
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
52
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
53 53
         
54
-        if ( is_admin() ) {
55
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
56
-            add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
54
+        if (is_admin()) {
55
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
56
+            add_action('admin_body_class', array(&$this, 'admin_body_class'));
57 57
         } else {
58
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
58
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
59 59
         }
60 60
         
61 61
         /**
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
          *
66 66
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
67 67
          */
68
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
68
+        do_action_ref_array('wpinv_actions', array(&$this));
69 69
 
70
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
70
+        add_action('admin_init', array(&$this, 'activation_redirect'));
71 71
     }
72 72
     
73 73
     public function plugins_loaded() {
74 74
         /* Internationalize the text strings used. */
75 75
         $this->load_textdomain();
76 76
 
77
-        do_action( 'wpinv_loaded' );
77
+        do_action('wpinv_loaded');
78 78
     }
79 79
     
80 80
     /**
@@ -82,210 +82,210 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @since 1.0
84 84
      */
85
-    public function load_textdomain( $locale = NULL ) {
86
-        if ( empty( $locale ) ) {
87
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
85
+    public function load_textdomain($locale = NULL) {
86
+        if (empty($locale)) {
87
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
88 88
         }
89 89
 
90
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
90
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
91 91
         
92
-        unload_textdomain( 'invoicing' );
93
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
94
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
92
+        unload_textdomain('invoicing');
93
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
94
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
95 95
         
96 96
         /**
97 97
          * Define language constants.
98 98
          */
99
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
99
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
100 100
     }
101 101
         
102 102
     public function includes() {
103 103
         global $wpinv_options;
104 104
         
105
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
105
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
106 106
         $wpinv_options = wpinv_get_settings();
107 107
         
108
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
109
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
110
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
111
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
112
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
113
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
114
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
115
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
116
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
117
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
118
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
119
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
120
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
121
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
122
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
123
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
124
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
125
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php' );
126
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
127
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
128
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
129
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php' );
130
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
131
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
132
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
133
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
134
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
135
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
136
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
137
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstract-wpinv-privacy.php' );
138
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
139
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
108
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
109
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
110
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
111
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
112
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
113
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
114
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
115
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
116
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
117
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
118
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
119
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
120
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
121
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
122
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
123
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
124
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
125
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php');
126
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
127
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
128
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
129
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php');
130
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
131
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
132
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
133
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
134
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
135
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
136
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
137
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstract-wpinv-privacy.php');
138
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
139
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
140 140
 
141
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
142
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
141
+        if (!class_exists('WPInv_EUVat')) {
142
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
143 143
         }
144 144
         
145
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
146
-        if ( !empty( $gateways ) ) {
147
-            foreach ( $gateways as $gateway ) {
148
-                if ( $gateway == 'manual' ) {
145
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
146
+        if (!empty($gateways)) {
147
+            foreach ($gateways as $gateway) {
148
+                if ($gateway == 'manual') {
149 149
                     continue;
150 150
                 }
151 151
                 
152 152
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
153 153
                 
154
-                if ( file_exists( $gateway_file ) ) {
155
-                    require_once( $gateway_file );
154
+                if (file_exists($gateway_file)) {
155
+                    require_once($gateway_file);
156 156
                 }
157 157
             }
158 158
         }
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
160 160
         
161
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
162
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
163
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
164
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
161
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
162
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
163
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
164
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
165 165
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
166
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
167
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
168
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
169
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
170
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
171
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
166
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
167
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
168
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
169
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
170
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
171
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
172 172
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
173 173
             // load the user class only on the users.php page
174 174
             global $pagenow;
175
-            if($pagenow=='users.php'){
175
+            if ($pagenow == 'users.php') {
176 176
                 new WPInv_Admin_Users();
177 177
             }
178 178
         }
179 179
         
180 180
         // include css inliner
181
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
182
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
181
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
182
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
183 183
         }
184 184
         
185
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
185
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
186 186
     }
187 187
     
188 188
     public function init() {
189 189
     }
190 190
     
191 191
     public function admin_init() {
192
-        if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
192
+        if (!(defined('DOING_AJAX') && DOING_AJAX)) {
193 193
         }
194 194
         
195
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
195
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
196 196
     }
197 197
 
198 198
     public function activation_redirect() {
199 199
         // Bail if no activation redirect
200
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
200
+        if (!get_transient('_wpinv_activation_redirect')) {
201 201
             return;
202 202
         }
203 203
 
204 204
         // Delete the redirect transient
205
-        delete_transient( '_wpinv_activation_redirect' );
205
+        delete_transient('_wpinv_activation_redirect');
206 206
 
207 207
         // Bail if activating from network, or bulk
208
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
208
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
209 209
             return;
210 210
         }
211 211
 
212
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
212
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
213 213
         exit;
214 214
     }
215 215
     
216 216
     public function enqueue_scripts() {
217
-        $suffix       = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
217
+        $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
218 218
         
219
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
220
-        wp_enqueue_style( 'wpinv_front_style' );
219
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
220
+        wp_enqueue_style('wpinv_front_style');
221 221
                
222 222
         // Register scripts
223
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
224
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array( 'jquery', 'wpinv-vat-script' ),  WPINV_VERSION );
223
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
224
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array('jquery', 'wpinv-vat-script'), WPINV_VERSION);
225 225
 
226 226
         $localize                         = array();
227
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
228
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
227
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
228
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
229 229
         $localize['currency_symbol']      = wpinv_currency_symbol();
230 230
         $localize['currency_pos']         = wpinv_currency_position();
231 231
         $localize['thousand_sep']         = wpinv_thousands_separator();
232 232
         $localize['decimal_sep']          = wpinv_decimal_separator();
233 233
         $localize['decimals']             = wpinv_decimals();
234
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
234
+        $localize['txtComplete']          = __('Complete', 'invoicing');
235 235
         
236
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
236
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
237 237
         
238
-        wp_enqueue_script( 'jquery-blockui' );
238
+        wp_enqueue_script('jquery-blockui');
239 239
         $autofill_api = wpinv_get_option('address_autofill_api');
240 240
         $autofill_active = wpinv_get_option('address_autofill_active');
241
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
242
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
243
-                wp_dequeue_script( 'google-maps-api' );
241
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
242
+            if (wp_script_is('google-maps-api', 'enqueued')) {
243
+                wp_dequeue_script('google-maps-api');
244 244
             }
245
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
246
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
245
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
246
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
247 247
         }
248
-        wp_enqueue_script( 'wpinv-front-script' );
249
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
248
+        wp_enqueue_script('wpinv-front-script');
249
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
250 250
     }
251 251
 
252 252
     public function admin_enqueue_scripts() {
253 253
         global $post, $pagenow;
254 254
         
255 255
         $post_type  = wpinv_admin_post_type();
256
-        $suffix     = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
257
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
256
+        $suffix     = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
257
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
258 258
 
259 259
         $jquery_ui_css = false;
260
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
260
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
261 261
             $jquery_ui_css = true;
262
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
262
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
263 263
             $jquery_ui_css = true;
264 264
         }
265
-        if ( $jquery_ui_css ) {
266
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
267
-            wp_enqueue_style( 'jquery-ui-css' );
265
+        if ($jquery_ui_css) {
266
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
267
+            wp_enqueue_style('jquery-ui-css');
268 268
         }
269 269
 
270
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
271
-        wp_enqueue_style( 'wpinv_meta_box_style' );
270
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
271
+        wp_enqueue_style('wpinv_meta_box_style');
272 272
         
273
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION );
274
-        wp_enqueue_style( 'wpinv_admin_style' );
273
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION);
274
+        wp_enqueue_style('wpinv_admin_style');
275 275
 
276
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
277
-        if ( $page == 'wpinv-subscriptions' ) {
278
-            wp_enqueue_script( 'jquery-ui-datepicker' );
276
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
277
+        if ($page == 'wpinv-subscriptions') {
278
+            wp_enqueue_script('jquery-ui-datepicker');
279 279
         }
280 280
         
281
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
282
-            wp_enqueue_script( 'jquery-ui-datepicker' );
281
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
282
+            wp_enqueue_script('jquery-ui-datepicker');
283 283
         }
284 284
 
285
-        wp_enqueue_style( 'wp-color-picker' );
286
-        wp_enqueue_script( 'wp-color-picker' );
285
+        wp_enqueue_style('wp-color-picker');
286
+        wp_enqueue_script('wp-color-picker');
287 287
         
288
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
288
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
289 289
 
290 290
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
291 291
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
             }
297 297
         }
298 298
 
299
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
300
-        wp_enqueue_script( 'wpinv-admin-script' );
299
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
300
+        wp_enqueue_script('wpinv-admin-script');
301 301
         
302 302
         $localize                               = array();
303
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
304
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
305
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
306
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
307
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
308
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
309
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
303
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
304
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
305
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
306
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
307
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
308
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
309
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
310 310
         $localize['tax']                        = wpinv_tax_amount();
311 311
         $localize['discount']                   = wpinv_discount_amount();
312 312
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -314,69 +314,69 @@  discard block
 block discarded – undo
314 314
         $localize['thousand_sep']               = wpinv_thousands_separator();
315 315
         $localize['decimal_sep']                = wpinv_decimal_separator();
316 316
         $localize['decimals']                   = wpinv_decimals();
317
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
318
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
319
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
320
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
321
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
322
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
323
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
324
-        $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' );
325
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
326
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
327
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
328
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
329
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
330
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
317
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
318
+        $localize['status_publish']             = wpinv_status_nicename('publish');
319
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
320
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
321
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
322
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
323
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
324
+        $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');
325
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
326
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
327
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
328
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
329
+        $localize['action_edit']                = __('Edit', 'invoicing');
330
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
331 331
 
332
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
332
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
333 333
 
334
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
334
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
335 335
 
336
-        if ( $page == 'wpinv-subscriptions' ) {
337
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions' . $suffix . '.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
338
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
336
+        if ($page == 'wpinv-subscriptions') {
337
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions' . $suffix . '.js', array('wpinv-admin-script'), WPINV_VERSION);
338
+            wp_enqueue_script('wpinv-sub-admin-script');
339 339
         }
340 340
     }
341 341
     
342
-    public function admin_body_class( $classes ) {
342
+    public function admin_body_class($classes) {
343 343
         global $pagenow, $post, $current_screen;
344 344
         
345
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote' ) ) {
345
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote')) {
346 346
             $classes .= ' wpinv-cpt';
347 347
         }
348 348
         
349
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
349
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
350 350
 
351
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
352
-        if ( $add_class ) {
353
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
351
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
352
+        if ($add_class) {
353
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
354 354
         }
355 355
         
356 356
         $settings_class = array();
357
-        if ( $page == 'wpinv-settings' ) {
358
-            if ( !empty( $_REQUEST['tab'] ) ) {
359
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
357
+        if ($page == 'wpinv-settings') {
358
+            if (!empty($_REQUEST['tab'])) {
359
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
360 360
             }
361 361
             
362
-            if ( !empty( $_REQUEST['section'] ) ) {
363
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
362
+            if (!empty($_REQUEST['section'])) {
363
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
364 364
             }
365 365
             
366
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
366
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
367 367
         }
368 368
         
369
-        if ( !empty( $settings_class ) ) {
370
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
369
+        if (!empty($settings_class)) {
370
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
371 371
         }
372 372
         
373 373
         $post_type = wpinv_admin_post_type();
374 374
 
375
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
375
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
376 376
             return $classes .= ' wpinv';
377 377
         }
378 378
         
379
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
379
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
380 380
             $classes .= ' wpi-editable-n';
381 381
         }
382 382
 
@@ -388,20 +388,20 @@  discard block
 block discarded – undo
388 388
     }
389 389
     
390 390
     public function wpinv_actions() {
391
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
392
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
391
+        if (isset($_REQUEST['wpi_action'])) {
392
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
393 393
         }
394 394
     }
395 395
     
396
-    public function pre_get_posts( $wp_query ) {
397
-        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() ) {
398
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
396
+    public function pre_get_posts($wp_query) {
397
+        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()) {
398
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
399 399
         }
400 400
         
401 401
         return $wp_query;
402 402
     }
403 403
     
404 404
     public function bp_invoicing_init() {
405
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
405
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
406 406
     }
407 407
 }
408 408
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 1 patch
Spacing   +308 added lines, -308 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
6
+if (!class_exists('WP_Super_Duper')) {
7 7
 
8 8
 
9 9
 	/**
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
 		/**
34 34
 		 * Take the array options and use them to build.
35 35
 		 */
36
-		public function __construct( $options ) {
36
+		public function __construct($options) {
37 37
 			global $sd_widgets;
38 38
 
39
-			$sd_widgets[ $options['base_id'] ] = array( 'name'       => $options['name'],
39
+			$sd_widgets[$options['base_id']] = array('name'       => $options['name'],
40 40
 			                                            'class_name' => $options['class_name']
41 41
 			);
42 42
 			$this->base_id                     = $options['base_id'];
43 43
 			// lets filter the options before we do anything
44
-			$options       = apply_filters( "wp_super_duper_options", $options );
45
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
46
-			$options       = $this->add_name_from_key( $options );
44
+			$options       = apply_filters("wp_super_duper_options", $options);
45
+			$options       = apply_filters("wp_super_duper_options_{$this->base_id}", $options);
46
+			$options       = $this->add_name_from_key($options);
47 47
 			$this->options = $options;
48 48
 
49 49
 			$this->base_id   = $options['base_id'];
50
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
50
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
51 51
 
52 52
 			// init parent
53
-			parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
53
+			parent::__construct($options['base_id'], $options['name'], $options['widget_ops']);
54 54
 
55
-			if ( isset( $options['class_name'] ) ) {
55
+			if (isset($options['class_name'])) {
56 56
 				// register widget
57 57
 				$this->class_name = $options['class_name'];
58 58
 
@@ -60,25 +60,25 @@  discard block
 block discarded – undo
60 60
 				$this->register_shortcode();
61 61
 
62 62
 				// register block
63
-				add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
63
+				add_action('admin_enqueue_scripts', array($this, 'register_block'));
64 64
 			}
65 65
 
66 66
 			// add the CSS and JS we need ONCE
67 67
 			global $sd_widget_scripts;
68 68
 
69
-			if ( ! $sd_widget_scripts ) {
70
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
71
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
72
-				wp_add_inline_style( 'widgets', $this->widget_css() );
69
+			if (!$sd_widget_scripts) {
70
+				wp_add_inline_script('admin-widgets', $this->widget_js());
71
+				wp_add_inline_script('customize-controls', $this->widget_js());
72
+				wp_add_inline_style('widgets', $this->widget_css());
73 73
 
74 74
 				$sd_widget_scripts = true;
75 75
 
76 76
 				// add shortcode insert button once
77
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
78
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
77
+				add_action('media_buttons', array($this, 'shortcode_insert_button'));
78
+				add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings'));
79 79
 			}
80 80
 
81
-			do_action( 'wp_super_duper_widget_init', $options, $this );
81
+			do_action('wp_super_duper_widget_init', $options, $this);
82 82
 		}
83 83
 
84 84
 		/**
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 		public static function get_widget_settings() {
90 90
 			global $sd_widgets;
91 91
 
92
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
93
-			if ( ! $shortcode ) {
92
+			$shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : '';
93
+			if (!$shortcode) {
94 94
 				wp_die();
95 95
 			}
96
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
97
-			if ( ! $widget_args ) {
96
+			$widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : '';
97
+			if (!$widget_args) {
98 98
 				wp_die();
99 99
 			}
100
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
101
-			if ( ! $class_name ) {
100
+			$class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
101
+			if (!$class_name) {
102 102
 				wp_die();
103 103
 			}
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			$widget = new $class_name;
107 107
 
108 108
 			ob_start();
109
-			$widget->form( array() );
109
+			$widget->form(array());
110 110
 			$form = ob_get_clean();
111 111
 			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
112 112
 			echo "<style>" . $widget->widget_css() . "</style>";
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		 * @param string $editor_id Optional. Shortcode editor id. Default null.
125 125
 		 * @param string $insert_shortcode_function Optional. Insert shotcode function. Default null.
126 126
 		 */
127
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
127
+		public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
128 128
 			global $sd_widgets, $shortcode_insert_button_once;
129
-			if ( $shortcode_insert_button_once ) {
129
+			if ($shortcode_insert_button_once) {
130 130
 				return;
131 131
 			}
132 132
 			add_thickbox();
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 
136 136
 				<div class="sd-shortcode-left-wrap">
137 137
 					<?php
138
-					asort( $sd_widgets );
139
-					if ( ! empty( $sd_widgets ) ) {
138
+					asort($sd_widgets);
139
+					if (!empty($sd_widgets)) {
140 140
 						echo '<select onchange="sd_get_shortcode_options(this);">';
141
-						echo "<option>" . __( 'Select shortcode' ) . "</option>";
142
-						foreach ( $sd_widgets as $shortcode => $class ) {
143
-							echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
141
+						echo "<option>" . __('Select shortcode') . "</option>";
142
+						foreach ($sd_widgets as $shortcode => $class) {
143
+							echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
144 144
 						}
145 145
 						echo "</select>";
146 146
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 					<textarea id='sd-shortcode-output' disabled></textarea>
155 155
 					<div id='sd-shortcode-output-actions'>
156 156
 						<button class="button"
157
-						        onclick="sd_insert_shortcode()"><?php _e( 'Insert shortcode' ); ?></button>
157
+						        onclick="sd_insert_shortcode()"><?php _e('Insert shortcode'); ?></button>
158 158
 						<button class="button"
159
-						        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
159
+						        onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button>
160 160
 					</div>
161 161
 				</div>
162 162
 
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 
165 165
 			<?php
166 166
 			// if Font Awesome is available then show a icon if not show a WP icon.
167
-			$button_string = wp_style_is( 'font-awesome', 'enqueued' ) && 1 == 2 ? '<i class="fas fa-cubes" aria-hidden="true"></i>' : '<span style="padding-top: 3px;" class="dashicons dashicons-screenoptions"></span>';
167
+			$button_string = wp_style_is('font-awesome', 'enqueued') && 1 == 2 ? '<i class="fas fa-cubes" aria-hidden="true"></i>' : '<span style="padding-top: 3px;" class="dashicons dashicons-screenoptions"></span>';
168 168
 			?>
169 169
 
170 170
 			<a href="#TB_inline?width=100%&height=550&inlineId=super-duper-content"
171 171
 			   class="thickbox button super-duper-content-open"
172
-			   title="<?php _e( 'Add Shortcode' ); ?>"><?php echo $button_string; ?></a>
172
+			   title="<?php _e('Add Shortcode'); ?>"><?php echo $button_string; ?></a>
173 173
 
174 174
 			<style>
175 175
 				.sd-shortcode-left-wrap {
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 			<script>
195 195
 
196 196
 				<?php
197
-				if(! empty( $insert_shortcode_function )){
197
+				if (!empty($insert_shortcode_function)) {
198 198
 					echo $insert_shortcode_function;
199
-				}else{
199
+				} else {
200 200
 
201 201
 				/**
202 202
 				 * Function for super duper insert shortcode.
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 							'shortcode': $short_code,
247 247
 							'attributes': 123,
248 248
 							'post_id': 321,
249
-							'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
249
+							'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
250 250
 						};
251 251
 
252 252
 						jQuery.post(ajaxurl, data, function (response) {
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 			/*
365 365
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
366 366
 			 */
367
-			return str_replace( array(
367
+			return str_replace(array(
368 368
 				'<style>',
369 369
 				'</style>'
370
-			), '', $output );
370
+			), '', $output);
371 371
 		}
372 372
 
373 373
 		public function widget_js() {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 					});
525 525
 
526 526
 				}
527
-				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
527
+				<?php do_action('wp_super_duper_widget_js', $this); ?>
528 528
 			</script>
529 529
 			<?php
530 530
 			$output = ob_get_clean();
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 			/*
533 533
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
534 534
 			 */
535
-			return str_replace( array(
535
+			return str_replace(array(
536 536
 				'<script>',
537 537
 				'</script>'
538
-			), '', $output );
538
+			), '', $output);
539 539
 		}
540 540
 
541 541
 
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
 		 *
547 547
 		 * @return mixed
548 548
 		 */
549
-		private function add_name_from_key( $options, $arguments = false ) {
550
-			if ( ! empty( $options['arguments'] ) ) {
551
-				foreach ( $options['arguments'] as $key => $val ) {
552
-					$options['arguments'][ $key ]['name'] = $key;
549
+		private function add_name_from_key($options, $arguments = false) {
550
+			if (!empty($options['arguments'])) {
551
+				foreach ($options['arguments'] as $key => $val) {
552
+					$options['arguments'][$key]['name'] = $key;
553 553
 				}
554
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
555
-				foreach ( $options as $key => $val ) {
556
-					$options[ $key ]['name'] = $key;
554
+			} elseif ($arguments && is_array($options) && !empty($options)) {
555
+				foreach ($options as $key => $val) {
556
+					$options[$key]['name'] = $key;
557 557
 				}
558 558
 			}
559 559
 
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 		 * @since 1.0.0
567 567
 		 */
568 568
 		public function register_shortcode() {
569
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
570
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) );
569
+			add_shortcode($this->base_id, array($this, 'shortcode_output'));
570
+			add_action('wp_ajax_super_duper_output_shortcode', array(__CLASS__, 'render_shortcode'));
571 571
 		}
572 572
 
573 573
 		/**
@@ -577,33 +577,33 @@  discard block
 block discarded – undo
577 577
 		 */
578 578
 		public static function render_shortcode() {
579 579
 
580
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
581
-			if ( ! current_user_can( 'manage_options' ) ) {
580
+			check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
581
+			if (!current_user_can('manage_options')) {
582 582
 				wp_die();
583 583
 			}
584 584
 
585 585
 			// we might need the $post value here so lets set it.
586
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
587
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
588
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
586
+			if (isset($_POST['post_id']) && $_POST['post_id']) {
587
+				$post_obj = get_post(absint($_POST['post_id']));
588
+				if (!empty($post_obj) && empty($post)) {
589 589
 					global $post;
590 590
 					$post = $post_obj;
591 591
 				}
592 592
 			}
593 593
 
594
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
595
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
596
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
594
+			if (isset($_POST['shortcode']) && $_POST['shortcode']) {
595
+				$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
596
+				$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
597 597
 				$attributes       = '';
598
-				if ( ! empty( $attributes_array ) ) {
599
-					foreach ( $attributes_array as $key => $value ) {
600
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . wp_slash( $value ) . "' ";
598
+				if (!empty($attributes_array)) {
599
+					foreach ($attributes_array as $key => $value) {
600
+						$attributes .= " " . sanitize_title_with_dashes($key) . "='" . wp_slash($value) . "' ";
601 601
 					}
602 602
 				}
603 603
 
604 604
 				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
605 605
 
606
-				echo do_shortcode( $shortcode );
606
+				echo do_shortcode($shortcode);
607 607
 
608 608
 			}
609 609
 			wp_die();
@@ -617,37 +617,37 @@  discard block
 block discarded – undo
617 617
 		 *
618 618
 		 * @return string
619 619
 		 */
620
-		public function shortcode_output( $args = array(), $content = '' ) {
621
-			$args = self::argument_values( $args );
620
+		public function shortcode_output($args = array(), $content = '') {
621
+			$args = self::argument_values($args);
622 622
 
623 623
 			// add extra argument so we know its a output to gutenberg
624 624
 			//$args
625
-			$args = $this->string_to_bool( $args );
625
+			$args = $this->string_to_bool($args);
626 626
 
627 627
 
628
-			$calss = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
628
+			$calss = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : '';
629 629
 
630
-			$calss = apply_filters( 'wp_super_duper_div_classname', $calss, $args, $this );
631
-			$calss = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $calss, $args, $this );
630
+			$calss = apply_filters('wp_super_duper_div_classname', $calss, $args, $this);
631
+			$calss = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $calss, $args, $this);
632 632
 
633
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
634
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
633
+			$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
634
+			$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
635 635
 
636 636
 			$shortcode_args = array();
637 637
 			$output         = '';
638
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
639
-			$main_content   = $this->output( $args, $shortcode_args, $content );
640
-			if ( $main_content && ! $no_wrap ) {
638
+			$no_wrap        = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
639
+			$main_content   = $this->output($args, $shortcode_args, $content);
640
+			if ($main_content && !$no_wrap) {
641 641
 				// wrap the shortcode in a dive with the same class as the widget
642 642
 				$output .= '<div class="' . $calss . '" ' . $attrs . '>';
643
-				if ( ! empty( $args['title'] ) ) {
643
+				if (!empty($args['title'])) {
644 644
 					// if its a shortcode and there is a title try to grab the title wrappers
645
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
646
-					if ( empty( $instance ) ) {
645
+					$shortcode_args = array('before_title' => '', 'after_title' => '');
646
+					if (empty($instance)) {
647 647
 						global $wp_registered_sidebars;
648
-						if ( ! empty( $wp_registered_sidebars ) ) {
649
-							foreach ( $wp_registered_sidebars as $sidebar ) {
650
-								if ( ! empty( $sidebar['before_title'] ) ) {
648
+						if (!empty($wp_registered_sidebars)) {
649
+							foreach ($wp_registered_sidebars as $sidebar) {
650
+								if (!empty($sidebar['before_title'])) {
651 651
 									$shortcode_args['before_title'] = $sidebar['before_title'];
652 652
 									$shortcode_args['after_title']  = $sidebar['after_title'];
653 653
 									break;
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 							}
656 656
 						}
657 657
 					}
658
-					$output .= $this->output_title( $shortcode_args, $args );
658
+					$output .= $this->output_title($shortcode_args, $args);
659 659
 				}
660 660
 				$output .= $main_content;
661 661
 				$output .= '</div>';
662
-			} elseif ( $main_content && $no_wrap ) {
662
+			} elseif ($main_content && $no_wrap) {
663 663
 				$output .= $main_content;
664 664
 			}
665 665
 
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
 		 *
674 674
 		 * @return mixed
675 675
 		 */
676
-		public function string_to_bool( $options ) {
676
+		public function string_to_bool($options) {
677 677
 			// convert bool strings to booleans
678
-			foreach ( $options as $key => $val ) {
679
-				if ( $val == 'false' ) {
680
-					$options[ $key ] = false;
681
-				} elseif ( $val == 'true' ) {
682
-					$options[ $key ] = true;
678
+			foreach ($options as $key => $val) {
679
+				if ($val == 'false') {
680
+					$options[$key] = false;
681
+				} elseif ($val == 'true') {
682
+					$options[$key] = true;
683 683
 				}
684 684
 			}
685 685
 
@@ -693,24 +693,24 @@  discard block
 block discarded – undo
693 693
 		 *
694 694
 		 * @return array
695 695
 		 */
696
-		public function argument_values( $instance ) {
696
+		public function argument_values($instance) {
697 697
 			$argument_values = array();
698 698
 
699 699
 			// set widget instance
700 700
 			$this->instance = $instance;
701 701
 
702
-			if ( empty( $this->arguments ) ) {
702
+			if (empty($this->arguments)) {
703 703
 				$this->arguments = $this->get_arguments();
704 704
 			}
705 705
 
706
-			if ( ! empty( $this->arguments ) ) {
707
-				foreach ( $this->arguments as $key => $args ) {
706
+			if (!empty($this->arguments)) {
707
+				foreach ($this->arguments as $key => $args) {
708 708
 					// set the input name from the key
709 709
 					$args['name'] = $key;
710 710
 					//
711
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
712
-					if ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
713
-						$argument_values[ $key ] = $args['default'];
711
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
712
+					if ($argument_values[$key] == '' && isset($args['default'])) {
713
+						$argument_values[$key] = $args['default'];
714 714
 					}
715 715
 				}
716 716
 			}
@@ -737,12 +737,12 @@  discard block
 block discarded – undo
737 737
 		 * @return array Get arguments.
738 738
 		 */
739 739
 		public function get_arguments() {
740
-			if ( empty( $this->arguments ) ) {
740
+			if (empty($this->arguments)) {
741 741
 				$this->arguments = $this->set_arguments();
742 742
 			}
743 743
 
744
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
745
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
744
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
745
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
746 746
 
747 747
 			return $this->arguments;
748 748
 		}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		 * @param array $widget_args
755 755
 		 * @param string $content
756 756
 		 */
757
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
757
+		public function output($args = array(), $widget_args = array(), $content = '') {
758 758
 
759 759
 		}
760 760
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		 * Add the dynamic block code inline when the wp-block in enqueued.
763 763
 		 */
764 764
 		public function register_block() {
765
-			wp_add_inline_script( 'wp-blocks', $this->block() );
765
+			wp_add_inline_script('wp-blocks', $this->block());
766 766
 		}
767 767
 
768 768
 		/**
@@ -775,13 +775,13 @@  discard block
 block discarded – undo
775 775
 			$show      = false;
776 776
 			$arguments = $this->arguments;
777 777
 
778
-			if ( empty( $arguments ) ) {
778
+			if (empty($arguments)) {
779 779
 				$arguments = $this->get_arguments();
780 780
 			}
781 781
 
782
-			if ( ! empty( $arguments ) ) {
783
-				foreach ( $arguments as $argument ) {
784
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
782
+			if (!empty($arguments)) {
783
+				foreach ($arguments as $argument) {
784
+					if (isset($argument['advanced']) && $argument['advanced']) {
785 785
 						$show = true;
786 786
 					}
787 787
 				}
@@ -832,12 +832,12 @@  discard block
 block discarded – undo
832 832
 					 * @return {?WPBlock}          The block, if it has been successfully
833 833
 					 *                             registered; otherwise `undefined`.
834 834
 					 */
835
-					registerBlockType('<?php echo str_replace( "_", "-", sanitize_title_with_dashes( $this->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->options['class_name'] ) );  ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
836
-						title: '<?php echo $this->options['name'];?>', // Block title.
837
-						description: '<?php echo esc_attr( $this->options['widget_ops']['description'] )?>', // Block title.
838
-						icon: '<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
839
-						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
840
-						<?php if ( isset( $this->options['block-keywords'] ) ) {
835
+					registerBlockType('<?php echo str_replace("_", "-", sanitize_title_with_dashes($this->options['textdomain']) . '/' . sanitize_title_with_dashes($this->options['class_name'])); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
836
+						title: '<?php echo $this->options['name']; ?>', // Block title.
837
+						description: '<?php echo esc_attr($this->options['widget_ops']['description'])?>', // Block title.
838
+						icon: '<?php echo isset($this->options['block-icon']) ? esc_attr($this->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
839
+						category: '<?php echo isset($this->options['block-category']) ? esc_attr($this->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
840
+						<?php if (isset($this->options['block-keywords'])) {
841 841
 						echo "keywords : " . $this->options['block-keywords'] . ",";
842 842
 					}?>
843 843
 
@@ -847,10 +847,10 @@  discard block
 block discarded – undo
847 847
 
848 848
 						$show_alignment = false;
849 849
 
850
-						if ( ! empty( $this->arguments ) ) {
850
+						if (!empty($this->arguments)) {
851 851
 							echo "attributes : {";
852 852
 
853
-							if ( $show_advanced ) {
853
+							if ($show_advanced) {
854 854
 								echo "show_advanced: {";
855 855
 								echo "	type: 'boolean',";
856 856
 								echo "  default: false,";
@@ -858,42 +858,42 @@  discard block
 block discarded – undo
858 858
 							}
859 859
 
860 860
 							// block wrap element
861
-							if ( isset( $this->options['block-wrap'] ) ) { //@todo we should validate this?
861
+							if (isset($this->options['block-wrap'])) { //@todo we should validate this?
862 862
 								echo "block_wrap: {";
863 863
 								echo "	type: 'string',";
864
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
864
+								echo "  default: '" . esc_attr($this->options['block-wrap']) . "',";
865 865
 								echo "},";
866 866
 							}
867 867
 
868 868
 
869
-							foreach ( $this->arguments as $key => $args ) {
869
+							foreach ($this->arguments as $key => $args) {
870 870
 
871 871
 								// set if we should show alignment
872
-								if ( $key == 'alignment' ) {
872
+								if ($key == 'alignment') {
873 873
 									$show_alignment = true;
874 874
 								}
875 875
 
876 876
 								$extra = '';
877 877
 
878
-								if ( $args['type'] == 'checkbox' ) {
878
+								if ($args['type'] == 'checkbox') {
879 879
 									$type    = 'boolean';
880
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
881
-								} elseif ( $args['type'] == 'number' ) {
880
+									$default = isset($args['default']) && $args['default'] ? 'true' : 'false';
881
+								} elseif ($args['type'] == 'number') {
882 882
 									$type    = 'number';
883
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
884
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
883
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
884
+								} elseif ($args['type'] == 'select' && !empty($args['multiple'])) {
885 885
 									$type = 'array';
886
-									if ( is_array( $args['default'] ) ) {
887
-										$default = isset( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
886
+									if (is_array($args['default'])) {
887
+										$default = isset($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]";
888 888
 									} else {
889
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
889
+										$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
890 890
 									}
891
-								} elseif ( $args['type'] == 'multiselect' ) {
891
+								} elseif ($args['type'] == 'multiselect') {
892 892
 									$type    = 'array';
893
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
893
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
894 894
 								} else {
895 895
 									$type    = 'string';
896
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
896
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
897 897
 								}
898 898
 								echo $key . " : {";
899 899
 								echo "type : '$type',";
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
 									is_fetching = true;
924 924
 									var data = {
925 925
 										'action': 'super_duper_output_shortcode',
926
-										'shortcode': '<?php echo $this->options['base_id'];?>',
926
+										'shortcode': '<?php echo $this->options['base_id']; ?>',
927 927
 										'attributes': props.attributes,
928
-										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
928
+										'post_id': <?php global $post; if (isset($post->ID)) {
929 929
 										echo $post->ID;
930 930
 									}?>,
931
-										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
931
+										'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
932 932
 									};
933 933
 
934 934
 									jQuery.post(ajaxurl, data, function (response) {
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 
938 938
 										// if the content is empty then we place some placeholder text
939 939
 										if (env == '') {
940
-											env = "<div style='background:#0185ba33;padding: 10px;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>";
940
+											env = "<div style='background:#0185ba33;padding: 10px;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>";
941 941
 										}
942 942
 
943 943
 										props.setAttributes({content: env});
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 
957 957
 								el(wp.editor.BlockControls, {key: 'controls'},
958 958
 
959
-									<?php if($show_alignment){?>
959
+									<?php if ($show_alignment) {?>
960 960
 									el(
961 961
 										wp.editor.AlignmentToolbar,
962 962
 										{
@@ -974,9 +974,9 @@  discard block
 block discarded – undo
974 974
 
975 975
 									<?php
976 976
 
977
-									if(! empty( $this->arguments )){
977
+									if (!empty($this->arguments)) {
978 978
 
979
-									if ( $show_advanced ) {
979
+									if ($show_advanced) {
980 980
 									?>
981 981
 									el(
982 982
 										wp.components.ToggleControl,
@@ -992,68 +992,68 @@  discard block
 block discarded – undo
992 992
 
993 993
 									}
994 994
 
995
-									foreach($this->arguments as $key => $args){
996
-									$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
995
+									foreach ($this->arguments as $key => $args) {
996
+									$custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : '';
997 997
 									$options = '';
998 998
 									$extra = '';
999 999
 									$require = '';
1000 1000
 									$onchange = "props.setAttributes({ $key: $key } )";
1001 1001
 									$value = "props.attributes.$key";
1002
-									$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'color' );
1003
-									if ( in_array( $args['type'], $text_type ) ) {
1002
+									$text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'color');
1003
+									if (in_array($args['type'], $text_type)) {
1004 1004
 										$type = 'TextControl';
1005
-									} elseif ( $args['type'] == 'checkbox' ) {
1005
+									} elseif ($args['type'] == 'checkbox') {
1006 1006
 										$type = 'CheckboxControl';
1007 1007
 										$extra .= "checked: props.attributes.$key,";
1008 1008
 										$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
1009
-									} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
1009
+									} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
1010 1010
 										$type = 'SelectControl';
1011
-										if ( ! empty( $args['options'] ) ) {
1011
+										if (!empty($args['options'])) {
1012 1012
 											$options .= "options  : [";
1013
-											foreach ( $args['options'] as $option_val => $option_label ) {
1014
-												$options .= "{ value : '" . esc_attr( $option_val ) . "',     label : '" . esc_attr( $option_label ) . "'     },";
1013
+											foreach ($args['options'] as $option_val => $option_label) {
1014
+												$options .= "{ value : '" . esc_attr($option_val) . "',     label : '" . esc_attr($option_label) . "'     },";
1015 1015
 											}
1016 1016
 											$options .= "],";
1017 1017
 										}
1018
-										if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
1018
+										if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
1019 1019
 											$extra .= ' multiple: true, ';
1020 1020
 											//$onchange = "props.setAttributes({ $key: ['edit'] } )";
1021 1021
 											//$value = "['edit', 'delete']";
1022 1022
 										}
1023
-									} elseif ( $args['type'] == 'alignment' ) {
1023
+									} elseif ($args['type'] == 'alignment') {
1024 1024
 										$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
1025 1025
 									} else {
1026
-										continue;// if we have not implemented the control then don't break the JS.
1026
+										continue; // if we have not implemented the control then don't break the JS.
1027 1027
 									}
1028 1028
 
1029 1029
 									// add show only if advanced
1030
-									if ( ! empty( $args['advanced'] ) ) {
1030
+									if (!empty($args['advanced'])) {
1031 1031
 										echo "props.attributes.show_advanced && ";
1032 1032
 									}
1033 1033
 									// add setting require if defined
1034
-									if ( ! empty( $args['element_require'] ) ) {
1035
-										echo $this->block_props_replace( $args['element_require'], true ) . " && ";
1034
+									if (!empty($args['element_require'])) {
1035
+										echo $this->block_props_replace($args['element_require'], true) . " && ";
1036 1036
 									}
1037 1037
 									?>
1038 1038
 									el(
1039
-										wp.components.<?php echo esc_attr( $type );?>,
1039
+										wp.components.<?php echo esc_attr($type); ?>,
1040 1040
 										{
1041
-											label: '<?php echo esc_attr( $args['title'] );?>',
1042
-											help: '<?php if ( isset( $args['desc'] ) ) {
1043
-												echo esc_attr( $args['desc'] );
1041
+											label: '<?php echo esc_attr($args['title']); ?>',
1042
+											help: '<?php if (isset($args['desc'])) {
1043
+												echo esc_attr($args['desc']);
1044 1044
 											}?>',
1045
-											value: <?php echo $value;?>,
1046
-											<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
1047
-											echo "type: '" . esc_attr( $args['type'] ) . "',";
1045
+											value: <?php echo $value; ?>,
1046
+											<?php if ($type == 'TextControl' && $args['type'] != 'text') {
1047
+											echo "type: '" . esc_attr($args['type']) . "',";
1048 1048
 										}?>
1049
-											<?php if ( ! empty( $args['placeholder'] ) ) {
1050
-											echo "placeholder: '" . esc_attr( $args['placeholder'] ) . "',";
1049
+											<?php if (!empty($args['placeholder'])) {
1050
+											echo "placeholder: '" . esc_attr($args['placeholder']) . "',";
1051 1051
 										}?>
1052
-											<?php echo $options;?>
1053
-											<?php echo $extra;?>
1054
-											<?php echo $custom_attributes;?>
1055
-											onChange: function ( <?php echo $key;?> ) {
1056
-												<?php echo $onchange;?>
1052
+											<?php echo $options; ?>
1053
+											<?php echo $extra; ?>
1054
+											<?php echo $custom_attributes; ?>
1055
+											onChange: function ( <?php echo $key; ?> ) {
1056
+												<?php echo $onchange; ?>
1057 1057
 											}
1058 1058
 										}
1059 1059
 									),
@@ -1066,9 +1066,9 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 								<?php
1068 1068
 								// If the user sets block-output array then build it
1069
-								if ( ! empty( $this->options['block-output'] ) ) {
1070
-								$this->block_element( $this->options['block-output'] );
1071
-							}else{
1069
+								if (!empty($this->options['block-output'])) {
1070
+								$this->block_element($this->options['block-output']);
1071
+							} else {
1072 1072
 								// if no block-output is set then we try and get the shortcode html output via ajax.
1073 1073
 								?>
1074 1074
 								el('div', {
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 							var align = '';
1093 1093
 
1094 1094
 							// build the shortcode.
1095
-							var content = "[<?php echo $this->options['base_id'];?>";
1095
+							var content = "[<?php echo $this->options['base_id']; ?>";
1096 1096
 							<?php
1097 1097
 
1098
-							if(! empty( $this->arguments )){
1099
-							foreach($this->arguments as $key => $args){
1098
+							if (!empty($this->arguments)) {
1099
+							foreach ($this->arguments as $key => $args) {
1100 1100
 							?>
1101
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
1102
-								content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' ";
1101
+							if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
1102
+								content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' ";
1103 1103
 							}
1104 1104
 							<?php
1105 1105
 							}
@@ -1140,10 +1140,10 @@  discard block
 block discarded – undo
1140 1140
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1141 1141
 			 */
1142 1142
 
1143
-			return str_replace( array(
1143
+			return str_replace(array(
1144 1144
 				'<script>',
1145 1145
 				'</script>'
1146
-			), '', $output );
1146
+			), '', $output);
1147 1147
 		}
1148 1148
 
1149 1149
 		/**
@@ -1155,16 +1155,16 @@  discard block
 block discarded – undo
1155 1155
 		 *
1156 1156
 		 * @return string
1157 1157
 		 */
1158
-		public function array_to_attributes( $custom_attributes, $html = false ) {
1158
+		public function array_to_attributes($custom_attributes, $html = false) {
1159 1159
 			$attributes = '';
1160
-			if ( ! empty( $custom_attributes ) ) {
1160
+			if (!empty($custom_attributes)) {
1161 1161
 
1162
-				if ( $html ) {
1163
-					foreach ( $custom_attributes as $key => $val ) {
1162
+				if ($html) {
1163
+					foreach ($custom_attributes as $key => $val) {
1164 1164
 						$attributes .= " $key='$val' ";
1165 1165
 					}
1166 1166
 				} else {
1167
-					foreach ( $custom_attributes as $key => $val ) {
1167
+					foreach ($custom_attributes as $key => $val) {
1168 1168
 						$attributes .= "'$key': '$val',";
1169 1169
 					}
1170 1170
 				}
@@ -1180,86 +1180,86 @@  discard block
 block discarded – undo
1180 1180
 		 *
1181 1181
 		 * @param $args
1182 1182
 		 */
1183
-		public function block_element( $args ) {
1183
+		public function block_element($args) {
1184 1184
 
1185 1185
 
1186
-			if ( ! empty( $args ) ) {
1187
-				foreach ( $args as $element => $new_args ) {
1186
+			if (!empty($args)) {
1187
+				foreach ($args as $element => $new_args) {
1188 1188
 
1189
-					if ( is_array( $new_args ) ) { // its an element
1189
+					if (is_array($new_args)) { // its an element
1190 1190
 
1191 1191
 
1192
-						if ( isset( $new_args['element'] ) ) {
1192
+						if (isset($new_args['element'])) {
1193 1193
 
1194
-							if ( isset( $new_args['element_require'] ) ) {
1195
-								echo str_replace( array(
1194
+							if (isset($new_args['element_require'])) {
1195
+								echo str_replace(array(
1196 1196
 										"'+",
1197 1197
 										"+'"
1198
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
1199
-								unset( $new_args['element_require'] );
1198
+									), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
1199
+								unset($new_args['element_require']);
1200 1200
 							}
1201 1201
 
1202 1202
 							echo "\n el( '" . $new_args['element'] . "', {";
1203 1203
 
1204 1204
 							// get the attributes
1205
-							foreach ( $new_args as $new_key => $new_value ) {
1205
+							foreach ($new_args as $new_key => $new_value) {
1206 1206
 
1207 1207
 
1208
-								if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
1208
+								if ($new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
1209 1209
 									// do nothing
1210 1210
 								} else {
1211
-									echo $this->block_element( array( $new_key => $new_value ) );
1211
+									echo $this->block_element(array($new_key => $new_value));
1212 1212
 								}
1213 1213
 							}
1214 1214
 
1215
-							echo "},";// end attributes
1215
+							echo "},"; // end attributes
1216 1216
 
1217 1217
 							// get the content
1218 1218
 							$first_item = 0;
1219
-							foreach ( $new_args as $new_key => $new_value ) {
1220
-								if ( $new_key === 'content' || is_array( $new_value ) ) {
1219
+							foreach ($new_args as $new_key => $new_value) {
1220
+								if ($new_key === 'content' || is_array($new_value)) {
1221 1221
 
1222
-									if ( $new_key === 'content' ) {
1223
-										echo "'" . $this->block_props_replace( $new_value ) . "'";
1222
+									if ($new_key === 'content') {
1223
+										echo "'" . $this->block_props_replace($new_value) . "'";
1224 1224
 									}
1225 1225
 
1226
-									if ( is_array( $new_value ) ) {
1226
+									if (is_array($new_value)) {
1227 1227
 
1228
-										if ( isset( $new_value['element_require'] ) ) {
1229
-											echo str_replace( array(
1228
+										if (isset($new_value['element_require'])) {
1229
+											echo str_replace(array(
1230 1230
 													"'+",
1231 1231
 													"+'"
1232
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
1233
-											unset( $new_value['element_require'] );
1232
+												), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
1233
+											unset($new_value['element_require']);
1234 1234
 										}
1235 1235
 
1236
-										if ( isset( $new_value['element_repeat'] ) ) {
1236
+										if (isset($new_value['element_repeat'])) {
1237 1237
 											$x = 1;
1238
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
1239
-												$this->block_element( array( '' => $new_value ) );
1240
-												$x ++;
1238
+											while ($x <= absint($new_value['element_repeat'])) {
1239
+												$this->block_element(array('' => $new_value));
1240
+												$x++;
1241 1241
 											}
1242 1242
 										} else {
1243
-											$this->block_element( array( '' => $new_value ) );
1243
+											$this->block_element(array('' => $new_value));
1244 1244
 										}
1245 1245
 									}
1246
-									$first_item ++;
1246
+									$first_item++;
1247 1247
 								}
1248 1248
 							}
1249 1249
 
1250
-							echo ")";// end content
1250
+							echo ")"; // end content
1251 1251
 
1252 1252
 							echo ", \n";
1253 1253
 
1254 1254
 						}
1255 1255
 					} else {
1256 1256
 
1257
-						if ( substr( $element, 0, 3 ) === "if_" ) {
1258
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
1259
-						} elseif ( $element == 'style' ) {
1260
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
1257
+						if (substr($element, 0, 3) === "if_") {
1258
+							echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ",";
1259
+						} elseif ($element == 'style') {
1260
+							echo $element . ": " . $this->block_props_replace($new_args) . ",";
1261 1261
 						} else {
1262
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
1262
+							echo $element . ": '" . $this->block_props_replace($new_args) . "',";
1263 1263
 						}
1264 1264
 
1265 1265
 					}
@@ -1274,12 +1274,12 @@  discard block
 block discarded – undo
1274 1274
 		 *
1275 1275
 		 * @return mixed
1276 1276
 		 */
1277
-		public function block_props_replace( $string, $no_wrap = false ) {
1277
+		public function block_props_replace($string, $no_wrap = false) {
1278 1278
 
1279
-			if ( $no_wrap ) {
1280
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
1279
+			if ($no_wrap) {
1280
+				$string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string);
1281 1281
 			} else {
1282
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
1282
+				$string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string);
1283 1283
 			}
1284 1284
 
1285 1285
 			return $string;
@@ -1291,33 +1291,33 @@  discard block
 block discarded – undo
1291 1291
 		 * @param array $args
1292 1292
 		 * @param array $instance
1293 1293
 		 */
1294
-		public function widget( $args, $instance ) {
1294
+		public function widget($args, $instance) {
1295 1295
 
1296 1296
 			// get the filtered values
1297
-			$argument_values = $this->argument_values( $instance );
1298
-			$argument_values = $this->string_to_bool( $argument_values );
1299
-			$output          = $this->output( $argument_values, $args );
1297
+			$argument_values = $this->argument_values($instance);
1298
+			$argument_values = $this->string_to_bool($argument_values);
1299
+			$output          = $this->output($argument_values, $args);
1300 1300
 
1301
-			if ( $output ) {
1301
+			if ($output) {
1302 1302
 				// Before widget
1303 1303
 				$before_widget = $args['before_widget'];
1304
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
1305
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
1304
+				$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
1305
+				$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this);
1306 1306
 
1307 1307
 				// After widget
1308 1308
 				$after_widget = $args['after_widget'];
1309
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
1310
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
1309
+				$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
1310
+				$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this);
1311 1311
 
1312 1312
 				echo $before_widget;
1313 1313
 				// elementor strips the widget wrapping div so we check for and add it back if needed
1314
-				if ( $this->is_elementor_widget_output() ) {
1315
-					echo ! empty( $this->options['widget_ops']['classname'] ) ? "<span class='" . esc_attr( $this->options['widget_ops']['classname'] ) . "'>" : '';
1314
+				if ($this->is_elementor_widget_output()) {
1315
+					echo !empty($this->options['widget_ops']['classname']) ? "<span class='" . esc_attr($this->options['widget_ops']['classname']) . "'>" : '';
1316 1316
 				}
1317
-				echo $this->output_title( $args, $instance );
1317
+				echo $this->output_title($args, $instance);
1318 1318
 				echo $output;
1319
-				if ( $this->is_elementor_widget_output() ) {
1320
-					echo ! empty( $this->options['widget_ops']['classname'] ) ? "</span>" : '';
1319
+				if ($this->is_elementor_widget_output()) {
1320
+					echo !empty($this->options['widget_ops']['classname']) ? "</span>" : '';
1321 1321
 				}
1322 1322
 				echo $after_widget;
1323 1323
 			}
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 		 */
1332 1332
 		public function is_elementor_widget_output() {
1333 1333
 			$result = false;
1334
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
1334
+			if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') {
1335 1335
 				$result = true;
1336 1336
 			}
1337 1337
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 		 */
1347 1347
 		public function is_elementor_preview() {
1348 1348
 			$result = false;
1349
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
1349
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
1350 1350
 				$result = true;
1351 1351
 			}
1352 1352
 
@@ -1361,11 +1361,11 @@  discard block
 block discarded – undo
1361 1361
 		 *
1362 1362
 		 * @return string
1363 1363
 		 */
1364
-		public function output_title( $args, $instance = array() ) {
1364
+		public function output_title($args, $instance = array()) {
1365 1365
 			$output = '';
1366
-			if ( ! empty( $instance['title'] ) ) {
1366
+			if (!empty($instance['title'])) {
1367 1367
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
1368
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
1368
+				$title  = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
1369 1369
 				$output = $args['before_title'] . $title . $args['after_title'];
1370 1370
 			}
1371 1371
 
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		 *
1378 1378
 		 * @param array $instance The widget options.
1379 1379
 		 */
1380
-		public function form( $instance ) {
1380
+		public function form($instance) {
1381 1381
 
1382 1382
 			// set widget instance
1383 1383
 			$this->instance = $instance;
@@ -1385,12 +1385,12 @@  discard block
 block discarded – undo
1385 1385
 			// set it as a SD widget
1386 1386
 			echo $this->widget_advanced_toggle();
1387 1387
 
1388
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
1388
+			echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>";
1389 1389
 			$arguments = $this->get_arguments();
1390 1390
 
1391
-			if ( is_array( $arguments ) ) {
1392
-				foreach ( $arguments as $key => $args ) {
1393
-					$this->widget_inputs( $args, $instance );
1391
+			if (is_array($arguments)) {
1392
+				foreach ($arguments as $key => $args) {
1393
+					$this->widget_inputs($args, $instance);
1394 1394
 				}
1395 1395
 			}
1396 1396
 		}
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 		public function widget_advanced_toggle() {
1404 1404
 
1405 1405
 			$output = '';
1406
-			if ( $this->block_show_advanced() ) {
1406
+			if ($this->block_show_advanced()) {
1407 1407
 				$val = 1;
1408 1408
 			} else {
1409 1409
 				$val = 0;
@@ -1423,14 +1423,14 @@  discard block
 block discarded – undo
1423 1423
 		 *
1424 1424
 		 * @return string $output
1425 1425
 		 */
1426
-		public function convert_element_require( $input ) {
1426
+		public function convert_element_require($input) {
1427 1427
 
1428
-			$input = str_replace( "'", '"', $input );// we only want double quotes
1428
+			$input = str_replace("'", '"', $input); // we only want double quotes
1429 1429
 
1430
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
1430
+			$output = esc_attr(str_replace(array("[%", "%]"), array(
1431 1431
 				"jQuery(form).find('[data-argument=\"",
1432 1432
 				"\"]').find('input,select').val()"
1433
-			), $input ) );
1433
+			), $input));
1434 1434
 
1435 1435
 			return $output;
1436 1436
 		}
@@ -1441,54 +1441,54 @@  discard block
 block discarded – undo
1441 1441
 		 * @param $args
1442 1442
 		 * @param $instance
1443 1443
 		 */
1444
-		public function widget_inputs( $args, $instance ) {
1444
+		public function widget_inputs($args, $instance) {
1445 1445
 
1446 1446
 			$class             = "";
1447 1447
 			$element_require   = "";
1448 1448
 			$custom_attributes = "";
1449 1449
 
1450 1450
 			// get value
1451
-			if ( isset( $instance[ $args['name'] ] ) ) {
1452
-				$value = $instance[ $args['name'] ];
1453
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
1454
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
1451
+			if (isset($instance[$args['name']])) {
1452
+				$value = $instance[$args['name']];
1453
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
1454
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
1455 1455
 			} else {
1456 1456
 				$value = '';
1457 1457
 			}
1458 1458
 
1459 1459
 			// get placeholder
1460
-			if ( ! empty( $args['placeholder'] ) ) {
1461
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
1460
+			if (!empty($args['placeholder'])) {
1461
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
1462 1462
 			} else {
1463 1463
 				$placeholder = '';
1464 1464
 			}
1465 1465
 
1466 1466
 			// get if advanced
1467
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
1467
+			if (isset($args['advanced']) && $args['advanced']) {
1468 1468
 				$class .= " sd-advanced-setting ";
1469 1469
 			}
1470 1470
 
1471 1471
 			// element_require
1472
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
1472
+			if (isset($args['element_require']) && $args['element_require']) {
1473 1473
 				$element_require = $args['element_require'];
1474 1474
 			}
1475 1475
 
1476 1476
 			// custom_attributes
1477
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
1478
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
1477
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
1478
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
1479 1479
 			}
1480 1480
 
1481 1481
 			// before wrapper
1482 1482
 			?>
1483
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
1484
-			   data-argument='<?php echo esc_attr( $args['name'] ); ?>'
1485
-			   data-element_require='<?php if ( $element_require ) {
1486
-				   echo $this->convert_element_require( $element_require );
1483
+			<p class="sd-argument <?php echo esc_attr($class); ?>"
1484
+			   data-argument='<?php echo esc_attr($args['name']); ?>'
1485
+			   data-element_require='<?php if ($element_require) {
1486
+				   echo $this->convert_element_require($element_require);
1487 1487
 			   } ?>'
1488 1488
 			>
1489 1489
 				<?php
1490 1490
 
1491
-				switch ( $args['type'] ) {
1491
+				switch ($args['type']) {
1492 1492
 					//array('text','password','number','email','tel','url','color')
1493 1493
 					case "text":
1494 1494
 					case "password":
@@ -1499,46 +1499,46 @@  discard block
 block discarded – undo
1499 1499
 					case "color":
1500 1500
 						?>
1501 1501
 						<label
1502
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1502
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
1503 1503
 						<input <?php echo $placeholder; ?> class="widefat"
1504 1504
 							<?php echo $custom_attributes; ?>
1505
-							                               id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1506
-							                               name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
1507
-							                               type="<?php echo esc_attr( $args['type'] ); ?>"
1508
-							                               value="<?php echo esc_attr( $value ); ?>">
1505
+							                               id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1506
+							                               name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
1507
+							                               type="<?php echo esc_attr($args['type']); ?>"
1508
+							                               value="<?php echo esc_attr($value); ?>">
1509 1509
 						<?php
1510 1510
 
1511 1511
 						break;
1512 1512
 					case "select":
1513
-						$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
1514
-						if ( $multiple ) {
1515
-							if ( empty( $value ) ) {
1513
+						$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
1514
+						if ($multiple) {
1515
+							if (empty($value)) {
1516 1516
 								$value = array();
1517 1517
 							}
1518 1518
 						}
1519 1519
 						?>
1520 1520
 						<label
1521
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1521
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
1522 1522
 						<select <?php echo $placeholder; ?> class="widefat"
1523 1523
 							<?php echo $custom_attributes; ?>
1524
-							                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1525
-							                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
1526
-							                                if ( $multiple ) {
1524
+							                                id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1525
+							                                name="<?php echo esc_attr($this->get_field_name($args['name']));
1526
+							                                if ($multiple) {
1527 1527
 								                                echo "[]";
1528 1528
 							                                } ?>"
1529
-							<?php if ( $multiple ) {
1529
+							<?php if ($multiple) {
1530 1530
 								echo "multiple";
1531 1531
 							} //@todo not implemented yet due to gutenberg not supporting it
1532 1532
 							?>
1533 1533
 						>
1534 1534
 							<?php
1535 1535
 
1536
-							if ( ! empty( $args['options'] ) ) {
1537
-								foreach ( $args['options'] as $val => $label ) {
1538
-									if ( $multiple ) {
1539
-										$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
1536
+							if (!empty($args['options'])) {
1537
+								foreach ($args['options'] as $val => $label) {
1538
+									if ($multiple) {
1539
+										$selected = in_array($val, $value) ? 'selected="selected"' : '';
1540 1540
 									} else {
1541
-										$selected = selected( $value, $val, false );
1541
+										$selected = selected($value, $val, false);
1542 1542
 									}
1543 1543
 									echo "<option value='$val' " . $selected . ">$label</option>";
1544 1544
 								}
@@ -1550,20 +1550,20 @@  discard block
 block discarded – undo
1550 1550
 					case "checkbox":
1551 1551
 						?>
1552 1552
 						<input <?php echo $placeholder; ?>
1553
-							<?php checked( 1, $value, true ) ?>
1553
+							<?php checked(1, $value, true) ?>
1554 1554
 							<?php echo $custom_attributes; ?>
1555
-							class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1556
-							name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox"
1555
+							class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1556
+							name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox"
1557 1557
 							value="1">
1558 1558
 						<label
1559
-							for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1559
+							for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label>
1560 1560
 						<?php
1561 1561
 						break;
1562 1562
 					case "hidden":
1563 1563
 						?>
1564
-						<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1565
-						       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
1566
-						       value="<?php echo esc_attr( $value ); ?>">
1564
+						<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1565
+						       name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden"
1566
+						       value="<?php echo esc_attr($value); ?>">
1567 1567
 						<?php
1568 1568
 						break;
1569 1569
 					default:
@@ -1585,14 +1585,14 @@  discard block
 block discarded – undo
1585 1585
 		 * @return string
1586 1586
 		 * @todo, need to make its own tooltip script
1587 1587
 		 */
1588
-		public function widget_field_desc( $args ) {
1588
+		public function widget_field_desc($args) {
1589 1589
 
1590 1590
 			$description = '';
1591
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
1592
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
1593
-					$description = $this->desc_tip( $args['desc'] );
1591
+			if (isset($args['desc']) && $args['desc']) {
1592
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
1593
+					$description = $this->desc_tip($args['desc']);
1594 1594
 				} else {
1595
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
1595
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
1596 1596
 				}
1597 1597
 			}
1598 1598
 
@@ -1607,11 +1607,11 @@  discard block
 block discarded – undo
1607 1607
 		 *
1608 1608
 		 * @return string
1609 1609
 		 */
1610
-		function desc_tip( $tip, $allow_html = false ) {
1611
-			if ( $allow_html ) {
1612
-				$tip = $this->sanitize_tooltip( $tip );
1610
+		function desc_tip($tip, $allow_html = false) {
1611
+			if ($allow_html) {
1612
+				$tip = $this->sanitize_tooltip($tip);
1613 1613
 			} else {
1614
-				$tip = esc_attr( $tip );
1614
+				$tip = esc_attr($tip);
1615 1615
 			}
1616 1616
 
1617 1617
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -1624,8 +1624,8 @@  discard block
 block discarded – undo
1624 1624
 		 *
1625 1625
 		 * @return string
1626 1626
 		 */
1627
-		public function sanitize_tooltip( $var ) {
1628
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
1627
+		public function sanitize_tooltip($var) {
1628
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
1629 1629
 				'br'     => array(),
1630 1630
 				'em'     => array(),
1631 1631
 				'strong' => array(),
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 				'li'     => array(),
1636 1636
 				'ol'     => array(),
1637 1637
 				'p'      => array(),
1638
-			) ) );
1638
+			)));
1639 1639
 		}
1640 1640
 
1641 1641
 		/**
@@ -1647,23 +1647,23 @@  discard block
 block discarded – undo
1647 1647
 		 * @return array
1648 1648
 		 * @todo we should add some sanitation here.
1649 1649
 		 */
1650
-		public function update( $new_instance, $old_instance ) {
1650
+		public function update($new_instance, $old_instance) {
1651 1651
 
1652 1652
 			//save the widget
1653
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
1653
+			$instance = array_merge((array)$old_instance, (array)$new_instance);
1654 1654
 
1655 1655
 			// set widget instance
1656 1656
 			$this->instance = $instance;
1657 1657
 
1658
-			if ( empty( $this->arguments ) ) {
1658
+			if (empty($this->arguments)) {
1659 1659
 				$this->get_arguments();
1660 1660
 			}
1661 1661
 
1662 1662
 			// check for checkboxes
1663
-			if ( ! empty( $this->arguments ) ) {
1664
-				foreach ( $this->arguments as $argument ) {
1665
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
1666
-						$instance[ $argument['name'] ] = '0';
1663
+			if (!empty($this->arguments)) {
1664
+				foreach ($this->arguments as $argument) {
1665
+					if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
1666
+						$instance[$argument['name']] = '0';
1667 1667
 					}
1668 1668
 				}
1669 1669
 			}
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 		 */
1682 1682
 		public function is_block_content_call() {
1683 1683
 			$result = false;
1684
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
1684
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
1685 1685
 				$result = true;
1686 1686
 			}
1687 1687
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
22
+if (!class_exists('WP_Font_Awesome_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 		 * @return WP_Font_Awesome_Settings - Main instance.
86 86
 		 */
87 87
 		public static function instance() {
88
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
88
+			if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) {
89 89
 				self::$instance = new WP_Font_Awesome_Settings;
90 90
 
91
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
91
+				add_action('init', array(self::$instance, 'init')); // set settings
92 92
 
93
-				if ( is_admin() ) {
94
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
95
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
93
+				if (is_admin()) {
94
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
95
+					add_action('admin_init', array(self::$instance, 'register_settings'));
96 96
 				}
97 97
 
98
-				do_action( 'wp_font_awesome_settings_loaded' );
98
+				do_action('wp_font_awesome_settings_loaded');
99 99
 			}
100 100
 
101 101
 			return self::$instance;
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 		public function init() {
110 110
 			$this->settings = $this->get_settings();
111 111
 
112
-			if ( $this->settings['type'] == 'CSS' ) {
112
+			if ($this->settings['type'] == 'CSS') {
113 113
 
114
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
115
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );//echo '###';exit;
114
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
115
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); //echo '###';exit;
116 116
 				}
117 117
 
118
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
119
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
118
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
119
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000);
120 120
 				}
121 121
 
122 122
 			} else {
123 123
 
124
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
125
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );//echo '###';exit;
124
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
125
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); //echo '###';exit;
126 126
 				}
127 127
 
128
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
129
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
128
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
129
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
130 130
 				}
131 131
 			}
132 132
 
133 133
 			// remove font awesome if set to do so
134
-			if ( $this->settings['dequeue'] == '1' ) {
135
-				add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
134
+			if ($this->settings['dequeue'] == '1') {
135
+				add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3);
136 136
 			}
137 137
 
138 138
 		}
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 			// build url
145 145
 			$url = $this->get_url();
146 146
 
147
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
148
-			wp_register_style( 'font-awesome', $url, array(), null );
149
-			wp_enqueue_style( 'font-awesome' );
147
+			wp_deregister_style('font-awesome'); // deregister in case its already there
148
+			wp_register_style('font-awesome', $url, array(), null);
149
+			wp_enqueue_style('font-awesome');
150 150
 
151
-			if ( $this->settings['shims'] ) {
152
-				$url = $this->get_url( true );
153
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
154
-				wp_register_style( 'font-awesome-shims', $url, array(), null );
155
-				wp_enqueue_style( 'font-awesome-shims' );
151
+			if ($this->settings['shims']) {
152
+				$url = $this->get_url(true);
153
+				wp_deregister_style('font-awesome-shims'); // deregister in case its already there
154
+				wp_register_style('font-awesome-shims', $url, array(), null);
155
+				wp_enqueue_style('font-awesome-shims');
156 156
 			}
157 157
 		}
158 158
 
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 			// build url
164 164
 			$url = $this->get_url();
165 165
 
166
-			$deregister_function = 'wp'.'_'.'deregister'.'_'.'script';
167
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
168
-			wp_register_script( 'font-awesome', $url, array(), null );
169
-			wp_enqueue_script( 'font-awesome' );
166
+			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
167
+			call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there
168
+			wp_register_script('font-awesome', $url, array(), null);
169
+			wp_enqueue_script('font-awesome');
170 170
 
171
-			if ( $this->settings['shims'] ) {
172
-				$url = $this->get_url( true );
173
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
174
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
175
-				wp_enqueue_script( 'font-awesome-shims' );
171
+			if ($this->settings['shims']) {
172
+				$url = $this->get_url(true);
173
+				call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there
174
+				wp_register_script('font-awesome-shims', $url, array(), null);
175
+				wp_enqueue_script('font-awesome-shims');
176 176
 			}
177 177
 		}
178 178
 
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 		 *
184 184
 		 * @return string The url to the file.
185 185
 		 */
186
-		public function get_url( $shims = false ) {
186
+		public function get_url($shims = false) {
187 187
 			$script  = $shims ? 'v4-shims' : 'all';
188 188
 			$type    = $this->settings['type'];
189 189
 			$version = $this->settings['version'];
190 190
 
191 191
 			$url = "https://use.fontawesome.com/releases/"; // CDN
192
-			$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
192
+			$url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
193 193
 			$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
194 194
 			$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
195 195
 			$url .= "?wpfas=true"; // set our var so our version is not removed
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
 		 *
209 209
 		 * @return string The filtered url.
210 210
 		 */
211
-		public function remove_font_awesome( $url, $original_url, $_context ) {
211
+		public function remove_font_awesome($url, $original_url, $_context) {
212 212
 
213
-			if ( $_context == 'display'
214
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
215
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
213
+			if ($_context == 'display'
214
+			     && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false)
215
+			     && (strstr($url, ".js") !== false || strstr($url, ".css") !== false)
216 216
 			) {// it's a font-awesome-url (probably)
217 217
 
218
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
219
-					if ( $this->settings['type'] == 'JS' ) {
220
-						if ( $this->settings['js-pseudo'] ) {
218
+				if (strstr($url, "wpfas=true") !== false) {
219
+					if ($this->settings['type'] == 'JS') {
220
+						if ($this->settings['js-pseudo']) {
221 221
 							$url .= "' data-search-pseudo-elements defer='defer";
222 222
 						} else {
223 223
 							$url .= "' defer='defer";
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * Register the database settings with WordPress.
237 237
 		 */
238 238
 		public function register_settings() {
239
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
239
+			register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings');
240 240
 		}
241 241
 
242 242
 		/**
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
245 245
 		 */
246 246
 		public function menu_item() {
247
-			$menu_function = 'add'.'_'.'options'.'_'.'page'; // won't pass theme check if function name present in theme
247
+			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
248 248
 			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
249 249
 				$this,
250 250
 				'settings_page'
251
-			) );
251
+			));
252 252
 		}
253 253
 
254 254
 		/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		 */
259 259
 		public function get_settings() {
260 260
 
261
-			$db_settings = get_option( 'wp-font-awesome-settings' );
261
+			$db_settings = get_option('wp-font-awesome-settings');
262 262
 
263 263
 			$defaults = array(
264 264
 				'type'      => 'CSS', // type to use, CSS or JS
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
 				'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
270 270
 			);
271 271
 
272
-			$settings = wp_parse_args( $db_settings, $defaults );
272
+			$settings = wp_parse_args($db_settings, $defaults);
273 273
 
274 274
 			/**
275 275
 			 * Filter the Font Awesome settings.
276 276
 			 *
277 277
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
278 278
 			 */
279
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
279
+			return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults);
280 280
 		}
281 281
 
282 282
 
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
 		 * The settings page html output.
285 285
 		 */
286 286
 		public function settings_page() {
287
-			if ( ! current_user_can( 'manage_options' ) ) {
288
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
287
+			if (!current_user_can('manage_options')) {
288
+				wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings'));
289 289
 			}
290 290
 
291 291
 			// a hidden way to force the update of the verison number vai api instead of waiting the 48 hours
292
-			if(isset($_REQUEST['force-version-check'])){
292
+			if (isset($_REQUEST['force-version-check'])) {
293 293
 				$this->get_latest_version($force_api = true);
294 294
 			}
295 295
 			?>
@@ -297,47 +297,47 @@  discard block
 block discarded – undo
297 297
 				<h1><?php echo $this->name; ?></h1>
298 298
 				<form method="post" action="options.php">
299 299
 					<?php
300
-					settings_fields( 'wp-font-awesome-settings' );
301
-					do_settings_sections( 'wp-font-awesome-settings' );
300
+					settings_fields('wp-font-awesome-settings');
301
+					do_settings_sections('wp-font-awesome-settings');
302 302
 					?>
303 303
 					<table class="form-table">
304 304
 						<tr valign="top">
305
-							<th scope="row"><label for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th>
305
+							<th scope="row"><label for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th>
306 306
 							<td>
307 307
 								<select name="wp-font-awesome-settings[type]" id="wpfas-type">
308 308
 									<option
309
-										value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option>
310
-									<option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option>
309
+										value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option>
310
+									<option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option>
311 311
 								</select>
312 312
 							</td>
313 313
 						</tr>
314 314
 
315 315
 						<tr valign="top">
316
-							<th scope="row"><label for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th>
316
+							<th scope="row"><label for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th>
317 317
 							<td>
318 318
 								<select name="wp-font-awesome-settings[version]" id="wpfas-version">
319 319
 									<option
320
-										value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?>
320
+										value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?>
321 321
 									</option>
322
-									<option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>
322
+									<option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>
323 323
 										5.6.0
324 324
 									</option>
325
-									<option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>
325
+									<option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>
326 326
 										5.5.0
327 327
 									</option>
328
-									<option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>
328
+									<option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>
329 329
 										5.4.0
330 330
 									</option>
331
-									<option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>
331
+									<option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>
332 332
 										5.3.0
333 333
 									</option>
334
-									<option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>
334
+									<option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>
335 335
 										5.2.0
336 336
 									</option>
337
-									<option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>
337
+									<option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>
338 338
 										5.1.0
339 339
 									</option>
340
-									<option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>
340
+									<option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>
341 341
 										4.7.1 (CSS only)
342 342
 									</option>
343 343
 								</select>
@@ -345,51 +345,51 @@  discard block
 block discarded – undo
345 345
 						</tr>
346 346
 
347 347
 						<tr valign="top">
348
-							<th scope="row"><label for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th>
348
+							<th scope="row"><label for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th>
349 349
 							<td>
350 350
 								<select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue">
351 351
 									<option
352
-										value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option>
352
+										value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option>
353 353
 									<option
354
-										value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option>
354
+										value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option>
355 355
 									<option
356
-										value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option>
356
+										value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option>
357 357
 								</select>
358 358
 							</td>
359 359
 						</tr>
360 360
 
361 361
 						<tr valign="top">
362 362
 							<th scope="row"><label
363
-									for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label></th>
363
+									for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label></th>
364 364
 							<td>
365 365
 								<input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/>
366 366
 								<input type="checkbox" name="wp-font-awesome-settings[shims]"
367
-								       value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/>
368
-								<span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span>
367
+								       value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/>
368
+								<span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span>
369 369
 							</td>
370 370
 						</tr>
371 371
 
372 372
 						<tr valign="top">
373 373
 							<th scope="row"><label
374
-									for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label>
374
+									for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label>
375 375
 							</th>
376 376
 							<td>
377 377
 								<input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/>
378 378
 								<input type="checkbox" name="wp-font-awesome-settings[js-pseudo]"
379
-								       value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?>
379
+								       value="1" <?php checked($this->settings['js-pseudo'], '1'); ?>
380 380
 								       id="wpfas-js-pseudo"/>
381
-								<span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span>
381
+								<span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span>
382 382
 							</td>
383 383
 						</tr>
384 384
 
385 385
 						<tr valign="top">
386
-							<th scope="row"><label for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th>
386
+							<th scope="row"><label for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th>
387 387
 							<td>
388 388
 								<input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/>
389 389
 								<input type="checkbox" name="wp-font-awesome-settings[dequeue]"
390
-								       value="1" <?php checked( $this->settings['dequeue'], '1' ); ?>
390
+								       value="1" <?php checked($this->settings['dequeue'], '1'); ?>
391 391
 								       id="wpfas-dequeue"/>
392
-								<span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings' ); ?></span>
392
+								<span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings'); ?></span>
393 393
 							</td>
394 394
 						</tr>
395 395
 
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 		 *
415 415
 		 * @return string Either a valid version number or an empty string.
416 416
 		 */
417
-		public function validate_version_number( $version ) {
417
+		public function validate_version_number($version) {
418 418
 
419
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
419
+			if (version_compare($version, '0.0.1', '>=') >= 0) {
420 420
 				// valid
421 421
 			} else {
422
-				$version = '';// not validated
422
+				$version = ''; // not validated
423 423
 			}
424 424
 
425 425
 			return $version;
@@ -437,16 +437,16 @@  discard block
 block discarded – undo
437 437
 		public function get_latest_version($force_api = false) {
438 438
 			$latest_version = $this->latest;
439 439
 
440
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
440
+			$cache = get_transient('wp-font-awesome-settings-version');
441 441
 
442
-			if ( $cache === false || $force_api) { // its not set
442
+			if ($cache === false || $force_api) { // its not set
443 443
 				$api_ver = $this->get_latest_version_from_api();
444
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
444
+				if (version_compare($api_ver, $this->latest, '>=') >= 0) {
445 445
 					$latest_version = $api_ver;
446
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
446
+					set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS);
447 447
 				}
448
-			} elseif ( $this->validate_version_number( $cache ) ) {
449
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
448
+			} elseif ($this->validate_version_number($cache)) {
449
+				if (version_compare($cache, $this->latest, '>=') >= 0) {
450 450
 					$latest_version = $cache;
451 451
 				}
452 452
 			}
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
 		 */
463 463
 		public function get_latest_version_from_api() {
464 464
 			$version  = "0";
465
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
466
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
467
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
468
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
465
+			$response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest");
466
+			if (!is_wp_error($response) && is_array($response)) {
467
+				$api_response = json_decode(wp_remote_retrieve_body($response), true);
468
+				if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) {
469 469
 					$version = $api_response['tag_name'];
470 470
 				}
471 471
 			}
Please login to merge, or discard this patch.
includes/admin/register-settings.php 1 patch
Spacing   +547 added lines, -547 removed lines patch added patch discarded remove patch
@@ -1,66 +1,66 @@  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
-function wpinv_get_option( $key = '', $default = false ) {
7
+function wpinv_get_option($key = '', $default = false) {
8 8
     global $wpinv_options;
9 9
 
10
-    $value = isset( $wpinv_options[ $key ] ) ? $wpinv_options[ $key ] : $default;
11
-    $value = apply_filters( 'wpinv_get_option', $value, $key, $default );
10
+    $value = isset($wpinv_options[$key]) ? $wpinv_options[$key] : $default;
11
+    $value = apply_filters('wpinv_get_option', $value, $key, $default);
12 12
 
13
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
13
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
14 14
 }
15 15
 
16
-function wpinv_update_option( $key = '', $value = false ) {
16
+function wpinv_update_option($key = '', $value = false) {
17 17
     // If no key, exit
18
-    if ( empty( $key ) ) {
18
+    if (empty($key)) {
19 19
         return false;
20 20
     }
21 21
 
22
-    if ( empty( $value ) ) {
23
-        $remove_option = wpinv_delete_option( $key );
22
+    if (empty($value)) {
23
+        $remove_option = wpinv_delete_option($key);
24 24
         return $remove_option;
25 25
     }
26 26
 
27 27
     // First let's grab the current settings
28
-    $options = get_option( 'wpinv_settings' );
28
+    $options = get_option('wpinv_settings');
29 29
 
30 30
     // Let other plugin alter the value
31
-    $value = apply_filters( 'wpinv_update_option', $value, $key );
31
+    $value = apply_filters('wpinv_update_option', $value, $key);
32 32
 
33 33
     // Next let's try to update the value
34
-    $options[ $key ] = $value;
35
-    $did_update = update_option( 'wpinv_settings', $options );
34
+    $options[$key] = $value;
35
+    $did_update = update_option('wpinv_settings', $options);
36 36
 
37 37
     // If it's updated, let's update the global variable
38
-    if ( $did_update ) {
38
+    if ($did_update) {
39 39
         global $wpinv_options;
40
-        $wpinv_options[ $key ] = $value;
40
+        $wpinv_options[$key] = $value;
41 41
     }
42 42
 
43 43
     return $did_update;
44 44
 }
45 45
 
46
-function wpinv_delete_option( $key = '' ) {
46
+function wpinv_delete_option($key = '') {
47 47
     // If no key, exit
48
-    if ( empty( $key ) ) {
48
+    if (empty($key)) {
49 49
         return false;
50 50
     }
51 51
 
52 52
     // First let's grab the current settings
53
-    $options = get_option( 'wpinv_settings' );
53
+    $options = get_option('wpinv_settings');
54 54
 
55 55
     // Next let's try to update the value
56
-    if( isset( $options[ $key ] ) ) {
57
-        unset( $options[ $key ] );
56
+    if (isset($options[$key])) {
57
+        unset($options[$key]);
58 58
     }
59 59
 
60
-    $did_update = update_option( 'wpinv_settings', $options );
60
+    $did_update = update_option('wpinv_settings', $options);
61 61
 
62 62
     // If it updated, let's update the global variable
63
-    if ( $did_update ){
63
+    if ($did_update) {
64 64
         global $wpinv_options;
65 65
         $wpinv_options = $options;
66 66
     }
@@ -69,37 +69,37 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 function wpinv_get_settings() {
72
-    $settings = get_option( 'wpinv_settings' );
72
+    $settings = get_option('wpinv_settings');
73 73
 
74
-    if ( empty( $settings ) ) {
74
+    if (empty($settings)) {
75 75
         // Update old settings with new single option
76
-        $general_settings   = is_array( get_option( 'wpinv_settings_general' ) )    ? get_option( 'wpinv_settings_general' )    : array();
77
-        $gateways_settings  = is_array( get_option( 'wpinv_settings_gateways' ) )   ? get_option( 'wpinv_settings_gateways' )   : array();
78
-        $email_settings     = is_array( get_option( 'wpinv_settings_emails' ) )     ? get_option( 'wpinv_settings_emails' )     : array();
79
-        $tax_settings       = is_array( get_option( 'wpinv_settings_taxes' ) )      ? get_option( 'wpinv_settings_taxes' )      : array();
80
-        $misc_settings      = is_array( get_option( 'wpinv_settings_misc' ) )       ? get_option( 'wpinv_settings_misc' )       : array();
81
-        $tool_settings      = is_array( get_option( 'wpinv_settings_tools' ) )      ? get_option( 'wpinv_settings_tools' )      : array();
76
+        $general_settings   = is_array(get_option('wpinv_settings_general')) ? get_option('wpinv_settings_general') : array();
77
+        $gateways_settings  = is_array(get_option('wpinv_settings_gateways')) ? get_option('wpinv_settings_gateways') : array();
78
+        $email_settings     = is_array(get_option('wpinv_settings_emails')) ? get_option('wpinv_settings_emails') : array();
79
+        $tax_settings       = is_array(get_option('wpinv_settings_taxes')) ? get_option('wpinv_settings_taxes') : array();
80
+        $misc_settings      = is_array(get_option('wpinv_settings_misc')) ? get_option('wpinv_settings_misc') : array();
81
+        $tool_settings      = is_array(get_option('wpinv_settings_tools')) ? get_option('wpinv_settings_tools') : array();
82 82
 
83
-        $settings = array_merge( $general_settings, $gateways_settings, $tax_settings, $tool_settings );
83
+        $settings = array_merge($general_settings, $gateways_settings, $tax_settings, $tool_settings);
84 84
 
85
-        update_option( 'wpinv_settings', $settings );
85
+        update_option('wpinv_settings', $settings);
86 86
 
87 87
     }
88
-    return apply_filters( 'wpinv_get_settings', $settings );
88
+    return apply_filters('wpinv_get_settings', $settings);
89 89
 }
90 90
 
91 91
 function wpinv_register_settings() {
92
-    if ( false == get_option( 'wpinv_settings' ) ) {
93
-        add_option( 'wpinv_settings' );
92
+    if (false == get_option('wpinv_settings')) {
93
+        add_option('wpinv_settings');
94 94
     }
95 95
     
96 96
     $register_settings = wpinv_get_registered_settings();
97 97
     
98
-    foreach ( $register_settings as $tab => $sections ) {
99
-        foreach ( $sections as $section => $settings) {
98
+    foreach ($register_settings as $tab => $sections) {
99
+        foreach ($sections as $section => $settings) {
100 100
             // Check for backwards compatibility
101
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
102
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
101
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
102
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
103 103
                 $section = 'main';
104 104
                 $settings = $sections;
105 105
             }
@@ -111,41 +111,41 @@  discard block
 block discarded – undo
111 111
                 'wpinv_settings_' . $tab . '_' . $section
112 112
             );
113 113
 
114
-            foreach ( $settings as $option ) {
114
+            foreach ($settings as $option) {
115 115
                 // For backwards compatibility
116
-                if ( empty( $option['id'] ) ) {
116
+                if (empty($option['id'])) {
117 117
                     continue;
118 118
                 }
119 119
 
120
-                $name = isset( $option['name'] ) ? $option['name'] : '';
120
+                $name = isset($option['name']) ? $option['name'] : '';
121 121
 
122 122
                 add_settings_field(
123 123
                     'wpinv_settings[' . $option['id'] . ']',
124 124
                     $name,
125
-                    function_exists( 'wpinv_' . $option['type'] . '_callback' ) ? 'wpinv_' . $option['type'] . '_callback' : 'wpinv_missing_callback',
125
+                    function_exists('wpinv_' . $option['type'] . '_callback') ? 'wpinv_' . $option['type'] . '_callback' : 'wpinv_missing_callback',
126 126
                     'wpinv_settings_' . $tab . '_' . $section,
127 127
                     'wpinv_settings_' . $tab . '_' . $section,
128 128
                     array(
129 129
                         'section'     => $section,
130
-                        'id'          => isset( $option['id'] )          ? $option['id']          : null,
131
-                        'desc'        => ! empty( $option['desc'] )      ? $option['desc']        : '',
132
-                        'name'        => isset( $option['name'] )        ? $option['name']        : null,
133
-                        'size'        => isset( $option['size'] )        ? $option['size']        : null,
134
-                        'options'     => isset( $option['options'] )     ? $option['options']     : '',
135
-                        'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
136
-                        'std'         => isset( $option['std'] )         ? $option['std']         : '',
137
-                        'min'         => isset( $option['min'] )         ? $option['min']         : null,
138
-                        'max'         => isset( $option['max'] )         ? $option['max']         : null,
139
-                        'step'        => isset( $option['step'] )        ? $option['step']        : null,
140
-                        'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
141
-                        'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
142
-                        'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
143
-                        'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
144
-                        'onchange'    => !empty( $option['onchange'] )   ? $option['onchange']    : '',
145
-                        'custom'      => !empty( $option['custom'] )     ? $option['custom']      : '',
146
-                        'class'       =>  !empty( $option['class'] )     ? $option['class']      : '',
147
-                        'cols'        => !empty( $option['cols'] ) && (int)$option['cols'] > 0 ? (int)$option['cols'] : 50,
148
-                        'rows'        => !empty( $option['rows'] ) && (int)$option['rows'] > 0 ? (int)$option['rows'] : 5,
130
+                        'id'          => isset($option['id']) ? $option['id'] : null,
131
+                        'desc'        => !empty($option['desc']) ? $option['desc'] : '',
132
+                        'name'        => isset($option['name']) ? $option['name'] : null,
133
+                        'size'        => isset($option['size']) ? $option['size'] : null,
134
+                        'options'     => isset($option['options']) ? $option['options'] : '',
135
+                        'selected'    => isset($option['selected']) ? $option['selected'] : null,
136
+                        'std'         => isset($option['std']) ? $option['std'] : '',
137
+                        'min'         => isset($option['min']) ? $option['min'] : null,
138
+                        'max'         => isset($option['max']) ? $option['max'] : null,
139
+                        'step'        => isset($option['step']) ? $option['step'] : null,
140
+                        'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
141
+                        'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
142
+                        'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
143
+                        'faux'        => isset($option['faux']) ? $option['faux'] : false,
144
+                        'onchange'    => !empty($option['onchange']) ? $option['onchange'] : '',
145
+                        'custom'      => !empty($option['custom']) ? $option['custom'] : '',
146
+                        'class'       =>  !empty($option['class']) ? $option['class'] : '',
147
+                        'cols'        => !empty($option['cols']) && (int)$option['cols'] > 0 ? (int)$option['cols'] : 50,
148
+                        'rows'        => !empty($option['rows']) && (int)$option['rows'] > 0 ? (int)$option['rows'] : 5,
149 149
                     )
150 150
                 );
151 151
             }
@@ -153,194 +153,194 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     // Creates our settings in the options table
156
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
156
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
157 157
 }
158
-add_action( 'admin_init', 'wpinv_register_settings' );
158
+add_action('admin_init', 'wpinv_register_settings');
159 159
 
160 160
 function wpinv_get_registered_settings() {
161
-    $pages = wpinv_get_pages( true );
161
+    $pages = wpinv_get_pages(true);
162 162
     
163 163
     $currencies = wpinv_get_currencies();
164 164
     
165 165
     $currency_code_options = array();
166
-    foreach ( $currencies as $code => $name ) {
167
-        $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
166
+    foreach ($currencies as $code => $name) {
167
+        $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
168 168
     }
169 169
     
170 170
     $due_payment_options       = array();
171
-    $due_payment_options[0]    = __( 'Now', 'invoicing' );
172
-    for ( $i = 1; $i <= 30; $i++ ) {
171
+    $due_payment_options[0]    = __('Now', 'invoicing');
172
+    for ($i = 1; $i <= 30; $i++) {
173 173
         $due_payment_options[$i] = $i;
174 174
     }
175 175
     
176 176
     $invoice_number_padd_options = array();
177
-    for ( $i = 0; $i <= 20; $i++ ) {
177
+    for ($i = 0; $i <= 20; $i++) {
178 178
         $invoice_number_padd_options[$i] = $i;
179 179
     }
180 180
     
181 181
     $currency_symbol = wpinv_currency_symbol();
182 182
     
183 183
     $last_number = $reset_number = '';
184
-    if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
185
-        $last_invoice_number = is_numeric( $last_invoice_number ) ? $last_invoice_number : wpinv_clean_invoice_number( $last_invoice_number );
184
+    if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
185
+        $last_invoice_number = is_numeric($last_invoice_number) ? $last_invoice_number : wpinv_clean_invoice_number($last_invoice_number);
186 186
 
187
-        if ( !empty( $last_invoice_number ) ) {
188
-            $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
187
+        if (!empty($last_invoice_number)) {
188
+            $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
189 189
         }
190 190
 
191 191
         $nonce = wp_create_nonce('reset_invoice_count');
192
-        $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>';
192
+        $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
193 193
     }
194 194
     
195 195
     $alert_wrapper_start = '<p style="color: #F00">';
196 196
     $alert_wrapper_close = '</p>';
197 197
     $wpinv_settings = array(
198
-        'general' => apply_filters( 'wpinv_settings_general',
198
+        'general' => apply_filters('wpinv_settings_general',
199 199
             array(
200 200
                 'main' => array(
201 201
                     'location_settings' => array(
202 202
                         'id'   => 'location_settings',
203
-                        'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
203
+                        'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
204 204
                         'desc' => '',
205 205
                         'type' => 'header',
206 206
                     ),
207 207
                     'default_country' => array(
208 208
                         'id'      => 'default_country',
209
-                        'name'    => __( 'Default Country', 'invoicing' ),
210
-                        'desc'    => __( 'Where does your store operate from?', 'invoicing' ),
209
+                        'name'    => __('Default Country', 'invoicing'),
210
+                        'desc'    => __('Where does your store operate from?', 'invoicing'),
211 211
                         'type'    => 'select',
212 212
                         'options' => wpinv_get_country_list(),
213 213
                         'std'     => 'GB',
214
-                        'placeholder' => __( 'Select a country', 'invoicing' ),
214
+                        'placeholder' => __('Select a country', 'invoicing'),
215 215
                     ),
216 216
                     'default_state' => array(
217 217
                         'id'      => 'default_state',
218
-                        'name'    => __( 'Default State / Province', 'invoicing' ),
219
-                        'desc'    => __( 'What state / province does your store operate from?', 'invoicing' ),
218
+                        'name'    => __('Default State / Province', 'invoicing'),
219
+                        'desc'    => __('What state / province does your store operate from?', 'invoicing'),
220 220
                         'type'    => 'country_states',
221
-                        'placeholder' => __( 'Select a state', 'invoicing' ),
221
+                        'placeholder' => __('Select a state', 'invoicing'),
222 222
                     ),
223 223
                     'store_name' => array(
224 224
                         'id'   => 'store_name',
225
-                        'name' => __( 'Store Name', 'invoicing' ),
226
-                        'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
225
+                        'name' => __('Store Name', 'invoicing'),
226
+                        'desc' => __('Store name to print on invoices.', 'invoicing'),
227 227
                         'std'     => get_option('blogname'),
228 228
                         'type' => 'text',
229 229
                     ),
230 230
                     'logo' => array(
231 231
                         'id'   => 'logo',
232
-                        'name' => __( 'Logo URL', 'invoicing' ),
233
-                        'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
232
+                        'name' => __('Logo URL', 'invoicing'),
233
+                        'desc' => __('Store logo to print on invoices.', 'invoicing'),
234 234
                         'type' => 'text',
235 235
                     ),
236 236
                     'store_address' => array(
237 237
                         'id'   => 'store_address',
238
-                        'name' => __( 'Store Address', 'invoicing' ),
239
-                        'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
238
+                        'name' => __('Store Address', 'invoicing'),
239
+                        'desc' => __('Enter the store address to display on invoice', 'invoicing'),
240 240
                         'type' => 'textarea',
241 241
                     ),
242 242
                     'page_settings' => array(
243 243
                         'id'   => 'page_settings',
244
-                        'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
244
+                        'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
245 245
                         'desc' => '',
246 246
                         'type' => 'header',
247 247
                     ),
248 248
                     'checkout_page' => array(
249 249
                         'id'          => 'checkout_page',
250
-                        'name'        => __( 'Checkout Page', 'invoicing' ),
251
-                        'desc'        => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
250
+                        'name'        => __('Checkout Page', 'invoicing'),
251
+                        'desc'        => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
252 252
                         'type'        => 'select',
253 253
                         'options'     => $pages,
254
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
254
+                        'placeholder' => __('Select a page', 'invoicing'),
255 255
                     ),
256 256
                     'tandc_page' => array(
257 257
                         'id'          => 'tandc_page',
258
-                        'name'        => __( 'Terms & Conditions', 'invoicing' ),
259
-                        'desc'        => __( 'If you select a "Terms & Conditions" page here the customer will be asked to accept them on checkout.', 'invoicing' ),
258
+                        'name'        => __('Terms & Conditions', 'invoicing'),
259
+                        'desc'        => __('If you select a "Terms & Conditions" page here the customer will be asked to accept them on checkout.', 'invoicing'),
260 260
                         'type'        => 'select',
261
-                        'options'     => wpinv_get_pages( true,  __( 'Select a page', 'invoicing' )),
261
+                        'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
262 262
                         'chosen'      => true,
263
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
263
+                        'placeholder' => __('Select a page', 'invoicing'),
264 264
                     ),
265 265
                     'success_page' => array(
266 266
                         'id'          => 'success_page',
267
-                        'name'        => __( 'Success Page', 'invoicing' ),
268
-                        'desc'        => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
267
+                        'name'        => __('Success Page', 'invoicing'),
268
+                        'desc'        => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
269 269
                         'type'        => 'select',
270 270
                         'options'     => $pages,
271
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
271
+                        'placeholder' => __('Select a page', 'invoicing'),
272 272
                     ),
273 273
                     'failure_page' => array(
274 274
                         'id'          => 'failure_page',
275
-                        'name'        => __( 'Failed Transaction Page', 'invoicing' ),
276
-                        'desc'        => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
275
+                        'name'        => __('Failed Transaction Page', 'invoicing'),
276
+                        'desc'        => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
277 277
                         'type'        => 'select',
278 278
                         'options'     => $pages,
279
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
279
+                        'placeholder' => __('Select a page', 'invoicing'),
280 280
                     ),
281 281
                     'invoice_history_page' => array(
282 282
                         'id'          => 'invoice_history_page',
283
-                        'name'        => __( 'Invoice History Page', 'invoicing' ),
284
-                        'desc'        => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
283
+                        'name'        => __('Invoice History Page', 'invoicing'),
284
+                        'desc'        => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
285 285
                         'type'        => 'select',
286 286
                         'options'     => $pages,
287
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
287
+                        'placeholder' => __('Select a page', 'invoicing'),
288 288
                     ),
289 289
                     'invoice_subscription_page' => array(
290 290
                         'id'          => 'invoice_subscription_page',
291
-                        'name'        => __( 'Invoice Subscriptions Page', 'invoicing' ),
292
-                        'desc'        => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
291
+                        'name'        => __('Invoice Subscriptions Page', 'invoicing'),
292
+                        'desc'        => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
293 293
                         'type'        => 'select',
294 294
                         'options'     => $pages,
295
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
295
+                        'placeholder' => __('Select a page', 'invoicing'),
296 296
                     ),
297 297
                 ),
298 298
                 'currency_section' => array(
299 299
                     'currency_settings' => array(
300 300
                         'id'   => 'currency_settings',
301
-                        'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
301
+                        'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
302 302
                         'desc' => '',
303 303
                         'type' => 'header',
304 304
                     ),
305 305
                     'currency' => array(
306 306
                         'id'      => 'currency',
307
-                        'name'    => __( 'Currency', 'invoicing' ),
308
-                        'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
307
+                        'name'    => __('Currency', 'invoicing'),
308
+                        'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
309 309
                         'type'    => 'select',
310 310
                         'options' => $currency_code_options,
311 311
                     ),
312 312
                     'currency_position' => array(
313 313
                         'id'      => 'currency_position',
314
-                        'name'    => __( 'Currency Position', 'invoicing' ),
315
-                        'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
314
+                        'name'    => __('Currency Position', 'invoicing'),
315
+                        'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
316 316
                         'type'    => 'select',
317 317
                         'options'  => array(
318
-                            'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
319
-                            'right'       => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
320
-                            'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
321
-                            'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')'
318
+                            'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
319
+                            'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
320
+                            'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
321
+                            'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')'
322 322
                         )
323 323
                     ),
324 324
                     'thousands_separator' => array(
325 325
                         'id'   => 'thousands_separator',
326
-                        'name' => __( 'Thousands Separator', 'invoicing' ),
327
-                        'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
326
+                        'name' => __('Thousands Separator', 'invoicing'),
327
+                        'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
328 328
                         'type' => 'text',
329 329
                         'size' => 'small',
330 330
                         'std'  => ',',
331 331
                     ),
332 332
                     'decimal_separator' => array(
333 333
                         'id'   => 'decimal_separator',
334
-                        'name' => __( 'Decimal Separator', 'invoicing' ),
335
-                        'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
334
+                        'name' => __('Decimal Separator', 'invoicing'),
335
+                        'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
336 336
                         'type' => 'text',
337 337
                         'size' => 'small',
338 338
                         'std'  => '.',
339 339
                     ),
340 340
                     'decimals' => array(
341 341
                         'id'   => 'decimals',
342
-                        'name' => __( 'Number of Decimals', 'invoicing' ),
343
-                        'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
342
+                        'name' => __('Number of Decimals', 'invoicing'),
343
+                        'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
344 344
                         'type' => 'number',
345 345
                         'size' => 'small',
346 346
                         'std'  => '2',
@@ -352,29 +352,29 @@  discard block
 block discarded – undo
352 352
                 'labels' => array(
353 353
                     'labels' => array(
354 354
                         'id'   => 'labels_settings',
355
-                        'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
355
+                        'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
356 356
                         'desc' => '',
357 357
                         'type' => 'header',
358 358
                     ),
359 359
                     'vat_name' => array(
360 360
                         'id' => 'vat_name',
361
-                        'name' => __( 'VAT Name', 'invoicing' ),
362
-                        'desc' => __( 'Enter the VAT name', 'invoicing' ),
361
+                        'name' => __('VAT Name', 'invoicing'),
362
+                        'desc' => __('Enter the VAT name', 'invoicing'),
363 363
                         'type' => 'text',
364 364
                         'size' => 'regular',
365 365
                         'std' => 'VAT'
366 366
                     ),
367 367
                     'vat_invoice_notice_label' => array(
368 368
                         'id' => 'vat_invoice_notice_label',
369
-                        'name' => __( 'Invoice Notice Label', 'invoicing' ),
370
-                        'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
369
+                        'name' => __('Invoice Notice Label', 'invoicing'),
370
+                        'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
371 371
                         'type' => 'text',
372 372
                         'size' => 'regular',
373 373
                     ),
374 374
                     'vat_invoice_notice' => array(
375 375
                         'id' => 'vat_invoice_notice',
376
-                        'name' => __( 'Invoice notice', 'invoicing' ),
377
-                        'desc' =>   __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
376
+                        'name' => __('Invoice notice', 'invoicing'),
377
+                        'desc' =>   __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
378 378
                         'type' => 'text',
379 379
                         'size' => 'regular',
380 380
                     )
@@ -386,22 +386,22 @@  discard block
 block discarded – undo
386 386
                 'main' => array(
387 387
                     'gateway_settings' => array(
388 388
                         'id'   => 'api_header',
389
-                        'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
389
+                        'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
390 390
                         'desc' => '',
391 391
                         'type' => 'header',
392 392
                     ),
393 393
                     'gateways' => array(
394 394
                         'id'      => 'gateways',
395
-                        'name'    => __( 'Payment Gateways', 'invoicing' ),
396
-                        'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
395
+                        'name'    => __('Payment Gateways', 'invoicing'),
396
+                        'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
397 397
                         'type'    => 'gateways',
398 398
                         'std'     => array('manual'=>1),
399 399
                         'options' => wpinv_get_payment_gateways(),
400 400
                     ),
401 401
                     'default_gateway' => array(
402 402
                         'id'      => 'default_gateway',
403
-                        'name'    => __( 'Default Gateway', 'invoicing' ),
404
-                        'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
403
+                        'name'    => __('Default Gateway', 'invoicing'),
404
+                        'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
405 405
                         'type'    => 'gateway_select',
406 406
                         'std'     => 'manual',
407 407
                         'options' => wpinv_get_payment_gateways(),
@@ -415,19 +415,19 @@  discard block
 block discarded – undo
415 415
                 'main' => array(
416 416
                     'tax_settings' => array(
417 417
                         'id'   => 'tax_settings',
418
-                        'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
418
+                        'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
419 419
                         'type' => 'header',
420 420
                     ),
421 421
                     'enable_taxes' => array(
422 422
                         'id'   => 'enable_taxes',
423
-                        'name' => __( 'Enable Taxes', 'invoicing' ),
424
-                        'desc' => __( 'Check this to enable taxes on invoices.', 'invoicing' ),
423
+                        'name' => __('Enable Taxes', 'invoicing'),
424
+                        'desc' => __('Check this to enable taxes on invoices.', 'invoicing'),
425 425
                         'type' => 'checkbox',
426 426
                     ),
427 427
                     'tax_rate' => array(
428 428
                         'id'   => 'tax_rate',
429
-                        'name' => __( 'Fallback Tax Rate', 'invoicing' ),
430
-                        'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
429
+                        'name' => __('Fallback Tax Rate', 'invoicing'),
430
+                        'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
431 431
                         'type' => 'number',
432 432
                         'size' => 'small',
433 433
                         'min'  => '0',
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
                 'rates' => array(
440 440
                     'tax_rates' => array(
441 441
                         'id'   => 'tax_rates',
442
-                        'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
443
-                        'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
442
+                        'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
443
+                        'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
444 444
                         'type' => 'tax_rates',
445 445
                     ),
446 446
                 )
@@ -452,61 +452,61 @@  discard block
 block discarded – undo
452 452
                 'main' => array(
453 453
                     'email_settings_header' => array(
454 454
                         'id'   => 'email_settings_header',
455
-                        'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
455
+                        'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
456 456
                         'type' => 'header',
457 457
                     ),
458 458
                     'email_from_name' => array(
459 459
                         'id'   => 'email_from_name',
460
-                        'name' => __( 'From Name', 'invoicing' ),
461
-                        'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
462
-                        'std' => esc_attr( get_bloginfo( 'name', 'display' ) ),
460
+                        'name' => __('From Name', 'invoicing'),
461
+                        'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
462
+                        'std' => esc_attr(get_bloginfo('name', 'display')),
463 463
                         'type' => 'text',
464 464
                     ),
465 465
                     'email_from' => array(
466 466
                         'id'   => 'email_from',
467
-                        'name' => __( 'From Email', 'invoicing' ),
468
-                        'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close),
469
-                        'std' => get_option( 'admin_email' ),
467
+                        'name' => __('From Email', 'invoicing'),
468
+                        'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
469
+                        'std' => get_option('admin_email'),
470 470
                         'type' => 'text',
471 471
                     ),
472 472
                     'overdue_settings_header' => array(
473 473
                         'id'   => 'overdue_settings_header',
474
-                        'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
474
+                        'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
475 475
                         'type' => 'header',
476 476
                     ),
477 477
                     'overdue_active' => array(
478 478
                         'id'   => 'overdue_active',
479
-                        'name' => __( 'Enable Due Date', 'invoicing' ),
480
-                        'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
479
+                        'name' => __('Enable Due Date', 'invoicing'),
480
+                        'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
481 481
                         'type' => 'checkbox',
482 482
                         'std'  => false,
483 483
                     ),
484 484
                     'overdue_days' => array(
485 485
                         'id'          => 'overdue_days',
486
-                        'name'        => __( 'Default Due Date', 'invoicing' ),
487
-                        'desc'        => __( 'Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing' ),
486
+                        'name'        => __('Default Due Date', 'invoicing'),
487
+                        'desc'        => __('Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing'),
488 488
                         'type'        => 'select',
489 489
                         'options'     => $due_payment_options,
490 490
                         'std'         => 0,
491
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
491
+                        'placeholder' => __('Select a page', 'invoicing'),
492 492
                     ),
493 493
                     'email_template_header' => array(
494 494
                         'id'   => 'email_template_header',
495
-                        'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
495
+                        'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
496 496
                         'type' => 'header',
497 497
                     ),
498 498
                     'email_header_image' => array(
499 499
                         'id'   => 'email_header_image',
500
-                        'name' => __( 'Header Image', 'invoicing' ),
501
-                        'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
500
+                        'name' => __('Header Image', 'invoicing'),
501
+                        'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
502 502
                         'std' => '',
503 503
                         'type' => 'text',
504 504
                     ),
505 505
                     'email_footer_text' => array(
506 506
                         'id'   => 'email_footer_text',
507
-                        'name' => __( 'Footer Text', 'invoicing' ),
508
-                        'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
509
-                        'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GeoDirectory', 'invoicing' ),
507
+                        'name' => __('Footer Text', 'invoicing'),
508
+                        'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
509
+                        'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GeoDirectory', 'invoicing'),
510 510
                         'type' => 'textarea',
511 511
                         'class' => 'regular-text',
512 512
                         'rows' => 2,
@@ -514,29 +514,29 @@  discard block
 block discarded – undo
514 514
                     ),
515 515
                     'email_base_color' => array(
516 516
                         'id'   => 'email_base_color',
517
-                        'name' => __( 'Base Color', 'invoicing' ),
518
-                        'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
517
+                        'name' => __('Base Color', 'invoicing'),
518
+                        'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
519 519
                         'std' => '#557da2',
520 520
                         'type' => 'color',
521 521
                     ),
522 522
                     'email_background_color' => array(
523 523
                         'id'   => 'email_background_color',
524
-                        'name' => __( 'Background Color', 'invoicing' ),
525
-                        'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
524
+                        'name' => __('Background Color', 'invoicing'),
525
+                        'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
526 526
                         'std' => '#f5f5f5',
527 527
                         'type' => 'color',
528 528
                     ),
529 529
                     'email_body_background_color' => array(
530 530
                         'id'   => 'email_body_background_color',
531
-                        'name' => __( 'Body Background Color', 'invoicing' ),
532
-                        'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
531
+                        'name' => __('Body Background Color', 'invoicing'),
532
+                        'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
533 533
                         'std' => '#fdfdfd',
534 534
                         'type' => 'color',
535 535
                     ),
536 536
                     'email_text_color' => array(
537 537
                         'id'   => 'email_text_color',
538
-                        'name' => __( 'Body Text Color', 'invoicing' ),
539
-                        'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
538
+                        'name' => __('Body Text Color', 'invoicing'),
539
+                        'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
540 540
                         'std' => '#505050',
541 541
                         'type' => 'color',
542 542
                     ),
@@ -555,26 +555,26 @@  discard block
 block discarded – undo
555 555
                 'main' => array(
556 556
                     'invoicing_privacy_policy_settings' => array(
557 557
                         'id'   => 'invoicing_privacy_policy_settings',
558
-                        'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
558
+                        'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
559 559
                         'type' => 'header',
560 560
                     ),
561 561
                     'privacy_page' => array(
562 562
                         'id'          => 'privacy_page',
563
-                        'name'        => __( 'Privacy Page', 'invoicing' ),
564
-                        'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
563
+                        'name'        => __('Privacy Page', 'invoicing'),
564
+                        'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
565 565
                         'type'        => 'select',
566
-                        'options'     => wpinv_get_pages( true,  __( 'Select a page', 'invoicing' )),
566
+                        'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
567 567
                         'chosen'      => true,
568
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
568
+                        'placeholder' => __('Select a page', 'invoicing'),
569 569
                     ),
570 570
                     'invoicing_privacy_checkout_message' => array(
571 571
                         'id' => 'invoicing_privacy_checkout_message',
572
-                        'name' => __( 'Checkout privacy policy', 'invoicing' ),
573
-                        'desc' => __( 'Optionally add privacy policy message which will display on checkout page.', 'invoicing' ),
572
+                        'name' => __('Checkout privacy policy', 'invoicing'),
573
+                        'desc' => __('Optionally add privacy policy message which will display on checkout page.', 'invoicing'),
574 574
                         'type' => 'textarea',
575 575
                         'class'=> 'regular-text',
576 576
                         'rows' => 4,
577
-                        'std'  => sprintf( __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing' ), '[wpinv_privacy_policy]' ),
577
+                        'std'  => sprintf(__('Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing'), '[wpinv_privacy_policy]'),
578 578
                     ),
579 579
                 ),
580 580
             )
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
                 'main' => array(
586 586
                     'invoice_number_format_settings' => array(
587 587
                         'id'   => 'invoice_number_format_settings',
588
-                        'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
588
+                        'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
589 589
                         'type' => 'header',
590 590
                     ),
591 591
                     'sequential_invoice_number' => array(
592 592
                         'id'   => 'sequential_invoice_number',
593
-                        'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
594
-                        'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
593
+                        'name' => __('Sequential Invoice Numbers', 'invoicing'),
594
+                        'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
595 595
                         'type' => 'checkbox',
596 596
                     ),
597 597
                     'invoice_sequence_start' => array(
598 598
                         'id'   => 'invoice_sequence_start',
599
-                        'name' => __( 'Sequential Starting Number', 'invoicing' ),
600
-                        'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
599
+                        'name' => __('Sequential Starting Number', 'invoicing'),
600
+                        'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
601 601
                         'type' => 'number',
602 602
                         'size' => 'small',
603 603
                         'std'  => '1',
@@ -605,16 +605,16 @@  discard block
 block discarded – undo
605 605
                     ),
606 606
                     'invoice_number_padd' => array(
607 607
                         'id'      => 'invoice_number_padd',
608
-                        'name'    => __( 'Minimum Digits', 'invoicing' ),
609
-                        'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
608
+                        'name'    => __('Minimum Digits', 'invoicing'),
609
+                        'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
610 610
                         'type'    => 'select',
611 611
                         'options' => $invoice_number_padd_options,
612 612
                         'std'     => 5,
613 613
                     ),
614 614
                     'invoice_number_prefix' => array(
615 615
                         'id' => 'invoice_number_prefix',
616
-                        'name' => __( 'Invoice Number Prefix', 'invoicing' ),
617
-                        'desc' => __( 'Prefix for all invoice numbers. Ex: WPINV-', 'invoicing' ),
616
+                        'name' => __('Invoice Number Prefix', 'invoicing'),
617
+                        'desc' => __('Prefix for all invoice numbers. Ex: WPINV-', 'invoicing'),
618 618
                         'type' => 'text',
619 619
                         'size' => 'regular',
620 620
                         'std' => 'WPINV-',
@@ -622,32 +622,32 @@  discard block
 block discarded – undo
622 622
                     ),
623 623
                     'invoice_number_postfix' => array(
624 624
                         'id' => 'invoice_number_postfix',
625
-                        'name' => __( 'Invoice Number Postfix', 'invoicing' ),
626
-                        'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
625
+                        'name' => __('Invoice Number Postfix', 'invoicing'),
626
+                        'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
627 627
                         'type' => 'text',
628 628
                         'size' => 'regular',
629 629
                         'std' => ''
630 630
                     ),
631 631
                     'checkout_settings' => array(
632 632
                         'id'   => 'checkout_settings',
633
-                        'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
633
+                        'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
634 634
                         'type' => 'header',
635 635
                     ),
636 636
                     'login_to_checkout' => array(
637 637
                         'id'   => 'login_to_checkout',
638
-                        'name' => __( 'Require Login To Checkout', 'invoicing' ),
639
-                        'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
638
+                        'name' => __('Require Login To Checkout', 'invoicing'),
639
+                        'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
640 640
                         'type' => 'checkbox',
641 641
                     ),
642 642
                     'uninstall_settings' => array(
643 643
                         'id'   => 'uninstall_settings',
644
-                        'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
644
+                        'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
645 645
                         'type' => 'header',
646 646
                     ),
647 647
                     'remove_data_on_unistall' => array(
648 648
                         'id'   => 'remove_data_on_unistall',
649
-                        'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
650
-                        'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
649
+                        'name' => __('Remove Data on Uninstall?', 'invoicing'),
650
+                        'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
651 651
                         'type' => 'checkbox',
652 652
                         'std'  => ''
653 653
                     ),
@@ -655,80 +655,80 @@  discard block
 block discarded – undo
655 655
                 'fields' => array(
656 656
                     'fields_settings' => array(
657 657
                         'id'   => 'fields_settings',
658
-                        'name' => '<h3>' . __( 'Address Fields', 'invoicing' ) . '</h3>',
659
-                        'desc' => __( 'Tick fields which are mandatory in invoice address fields.', 'invoicing' ),
658
+                        'name' => '<h3>' . __('Address Fields', 'invoicing') . '</h3>',
659
+                        'desc' => __('Tick fields which are mandatory in invoice address fields.', 'invoicing'),
660 660
                         'type' => 'header',
661 661
                     ),
662 662
                     'fname_mandatory' => array(
663 663
                         'id'   => 'fname_mandatory',
664
-                        'name' => __( 'First Name', 'invoicing' ),
664
+                        'name' => __('First Name', 'invoicing'),
665 665
                         'type' => 'checkbox',
666 666
                         'std'  => true,
667 667
                     ),
668 668
                     'lname_mandatory' => array(
669 669
                         'id'   => 'lname_mandatory',
670
-                        'name' => __( 'Last Name', 'invoicing' ),
670
+                        'name' => __('Last Name', 'invoicing'),
671 671
                         'type' => 'checkbox',
672 672
                         'std'  => true,
673 673
                     ),
674 674
                     'address_mandatory' => array(
675 675
                         'id'   => 'address_mandatory',
676
-                        'name' => __( 'Address', 'invoicing' ),
676
+                        'name' => __('Address', 'invoicing'),
677 677
                         'type' => 'checkbox',
678 678
                         'std'  => true,
679 679
                     ),
680 680
                     'city_mandatory' => array(
681 681
                         'id'   => 'city_mandatory',
682
-                        'name' => __( 'City', 'invoicing' ),
682
+                        'name' => __('City', 'invoicing'),
683 683
                         'type' => 'checkbox',
684 684
                         'std'  => true,
685 685
                     ),
686 686
                     'country_mandatory' => array(
687 687
                         'id'   => 'country_mandatory',
688
-                        'name' => __( 'Country', 'invoicing' ),
688
+                        'name' => __('Country', 'invoicing'),
689 689
                         'type' => 'checkbox',
690 690
                         'std'  => true,
691 691
                     ),
692 692
                     'state_mandatory' => array(
693 693
                         'id'   => 'state_mandatory',
694
-                        'name' => __( 'State / Province', 'invoicing' ),
694
+                        'name' => __('State / Province', 'invoicing'),
695 695
                         'type' => 'checkbox',
696 696
                         'std'  => true,
697 697
                     ),
698 698
                     'zip_mandatory' => array(
699 699
                         'id'   => 'zip_mandatory',
700
-                        'name' => __( 'ZIP / Postcode', 'invoicing' ),
700
+                        'name' => __('ZIP / Postcode', 'invoicing'),
701 701
                         'type' => 'checkbox',
702 702
                         'std'  => true,
703 703
                     ),
704 704
                     'phone_mandatory' => array(
705 705
                         'id'   => 'phone_mandatory',
706
-                        'name' => __( 'Phone Number', 'invoicing' ),
706
+                        'name' => __('Phone Number', 'invoicing'),
707 707
                         'type' => 'checkbox',
708 708
                         'std'  => true,
709 709
                     ),
710 710
                     'force_show_company' => array(
711 711
                         'id'   => 'force_show_company',
712
-                        'name' => __( 'Force show company name at checkout.', 'invoicing' ),
712
+                        'name' => __('Force show company name at checkout.', 'invoicing'),
713 713
                         'type' => 'checkbox',
714 714
                         'std'  => false,
715 715
                     ),
716 716
                     'address_autofill_settings' => array(
717 717
                         'id'   => 'address_autofill_settings',
718
-                        'name' => '<h3>' . __( 'Google Address Auto Complete', 'invoicing' ) . '</h3>',
718
+                        'name' => '<h3>' . __('Google Address Auto Complete', 'invoicing') . '</h3>',
719 719
                         'type' => 'header',
720 720
                     ),
721 721
                     'address_autofill_active' => array(
722 722
                         'id'   => 'address_autofill_active',
723
-                        'name' => __( 'Enable/Disable', 'invoicing' ),
724
-                        'desc' => __( 'Enable google address auto complete', 'invoicing' ),
723
+                        'name' => __('Enable/Disable', 'invoicing'),
724
+                        'desc' => __('Enable google address auto complete', 'invoicing'),
725 725
                         'type' => 'checkbox',
726 726
                         'std'  => 0
727 727
                     ),
728 728
                     'address_autofill_api' => array(
729 729
                         'id' => 'address_autofill_api',
730
-                        'name' => __( 'Google Place API Key', 'invoicing' ),
731
-                        'desc' => wp_sprintf(__( 'Enter google place API key. For more information go to google place API %sdocumenation%s', 'invoicing' ), '<a href="https://developers.google.com/maps/documentation/javascript/places-autocomplete" target="_blank">', '</a>' ),
730
+                        'name' => __('Google Place API Key', 'invoicing'),
731
+                        'desc' => wp_sprintf(__('Enter google place API key. For more information go to google place API %sdocumenation%s', 'invoicing'), '<a href="https://developers.google.com/maps/documentation/javascript/places-autocomplete" target="_blank">', '</a>'),
732 732
                         'type' => 'text',
733 733
                         'size' => 'regular',
734 734
                         'std' => ''
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
                 'custom-css' => array(
738 738
                     'css_settings' => array(
739 739
                         'id'   => 'css_settings',
740
-                        'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
740
+                        'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
741 741
                         'type' => 'header',
742 742
                     ),
743 743
                     'template_custom_css' => array(
744 744
                         'id' => 'template_custom_css',
745
-                        'name' => __( 'Invoice Template CSS', 'invoicing' ),
746
-                        'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
745
+                        'name' => __('Invoice Template CSS', 'invoicing'),
746
+                        'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
747 747
                         'type' => 'textarea',
748 748
                         'class'=> 'regular-text',
749 749
                         'rows' => 10,
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
                 'main' => array(
758 758
                     'tool_settings' => array(
759 759
                         'id'   => 'tool_settings',
760
-                        'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
761
-                        'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
760
+                        'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
761
+                        'desc' => __('Invoicing diagnostic tools', 'invoicing'),
762 762
                         'type' => 'tools',
763 763
                     ),
764 764
                 ),
@@ -766,136 +766,136 @@  discard block
 block discarded – undo
766 766
         )
767 767
     );
768 768
 
769
-    return apply_filters( 'wpinv_registered_settings', $wpinv_settings );
769
+    return apply_filters('wpinv_registered_settings', $wpinv_settings);
770 770
 }
771 771
 
772
-function wpinv_settings_sanitize( $input = array() ) {
772
+function wpinv_settings_sanitize($input = array()) {
773 773
     global $wpinv_options;
774 774
 
775
-    if ( empty( $_POST['_wp_http_referer'] ) ) {
775
+    if (empty($_POST['_wp_http_referer'])) {
776 776
         return $input;
777 777
     }
778 778
 
779
-    parse_str( $_POST['_wp_http_referer'], $referrer );
779
+    parse_str($_POST['_wp_http_referer'], $referrer);
780 780
 
781 781
     $settings = wpinv_get_registered_settings();
782
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
783
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
782
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
783
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
784 784
 
785 785
     $input = $input ? $input : array();
786
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
787
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
786
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
787
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
788 788
 
789 789
     // Loop through each setting being saved and pass it through a sanitization filter
790
-    foreach ( $input as $key => $value ) {
790
+    foreach ($input as $key => $value) {
791 791
         // Get the setting type (checkbox, select, etc)
792
-        $type = isset( $settings[ $tab ][ $key ]['type'] ) ? $settings[ $tab ][ $key ]['type'] : false;
792
+        $type = isset($settings[$tab][$key]['type']) ? $settings[$tab][$key]['type'] : false;
793 793
 
794
-        if ( $type ) {
794
+        if ($type) {
795 795
             // Field type specific filter
796
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
796
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
797 797
         }
798 798
 
799 799
         // General filter
800
-        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
800
+        $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
801 801
     }
802 802
 
803 803
     // Loop through the whitelist and unset any that are empty for the tab being saved
804
-    $main_settings    = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
805
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
804
+    $main_settings    = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
805
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
806 806
 
807
-    $found_settings = array_merge( $main_settings, $section_settings );
807
+    $found_settings = array_merge($main_settings, $section_settings);
808 808
 
809
-    if ( ! empty( $found_settings ) ) {
810
-        foreach ( $found_settings as $key => $value ) {
809
+    if (!empty($found_settings)) {
810
+        foreach ($found_settings as $key => $value) {
811 811
 
812 812
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
813
-            if ( is_numeric( $key ) ) {
813
+            if (is_numeric($key)) {
814 814
                 $key = $value['id'];
815 815
             }
816 816
 
817
-            if ( empty( $input[ $key ] ) ) {
818
-                unset( $wpinv_options[ $key ] );
817
+            if (empty($input[$key])) {
818
+                unset($wpinv_options[$key]);
819 819
             }
820 820
         }
821 821
     }
822 822
 
823 823
     // Merge our new settings with the existing
824
-    $output = array_merge( $wpinv_options, $input );
824
+    $output = array_merge($wpinv_options, $input);
825 825
 
826
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
826
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
827 827
 
828 828
     return $output;
829 829
 }
830 830
 
831
-function wpinv_settings_sanitize_misc_accounting( $input ) {
831
+function wpinv_settings_sanitize_misc_accounting($input) {
832 832
     global $wpinv_options, $wpi_session;
833 833
 
834
-    if ( !current_user_can( 'manage_options' ) ) {
834
+    if (!current_user_can('manage_options')) {
835 835
         return $input;
836 836
     }
837 837
 
838
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
838
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
839 839
         // Shows an admin notice about upgrading previous order numbers
840
-        $wpi_session->set( 'upgrade_sequential', '1' );
840
+        $wpi_session->set('upgrade_sequential', '1');
841 841
     }
842 842
 
843 843
     return $input;
844 844
 }
845
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
845
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
846 846
 
847
-function wpinv_settings_sanitize_tax_rates( $input ) {
848
-    if( !current_user_can( 'manage_options' ) ) {
847
+function wpinv_settings_sanitize_tax_rates($input) {
848
+    if (!current_user_can('manage_options')) {
849 849
         return $input;
850 850
     }
851 851
 
852
-    $new_rates = !empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
852
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
853 853
 
854 854
     $tax_rates = array();
855 855
 
856
-    if ( !empty( $new_rates ) ) {
857
-        foreach ( $new_rates as $rate ) {
858
-            if ( isset( $rate['country'] ) && empty( $rate['country'] ) && empty( $rate['state'] ) ) {
856
+    if (!empty($new_rates)) {
857
+        foreach ($new_rates as $rate) {
858
+            if (isset($rate['country']) && empty($rate['country']) && empty($rate['state'])) {
859 859
                 continue;
860 860
             }
861 861
             
862
-            $rate['rate'] = wpinv_sanitize_amount( $rate['rate'], 4 );
862
+            $rate['rate'] = wpinv_sanitize_amount($rate['rate'], 4);
863 863
             
864 864
             $tax_rates[] = $rate;
865 865
         }
866 866
     }
867 867
 
868
-    update_option( 'wpinv_tax_rates', $tax_rates );
868
+    update_option('wpinv_tax_rates', $tax_rates);
869 869
 
870 870
     return $input;
871 871
 }
872
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
872
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
873 873
 
874
-function wpinv_sanitize_text_field( $input ) {
875
-    return trim( $input );
874
+function wpinv_sanitize_text_field($input) {
875
+    return trim($input);
876 876
 }
877
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
877
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
878 878
 
879 879
 function wpinv_get_settings_tabs() {
880 880
     $tabs             = array();
881
-    $tabs['general']  = __( 'General', 'invoicing' );
882
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
883
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
884
-    $tabs['emails']   = __( 'Emails', 'invoicing' );
885
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
886
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
887
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
888
-
889
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
881
+    $tabs['general']  = __('General', 'invoicing');
882
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
883
+    $tabs['taxes']    = __('Taxes', 'invoicing');
884
+    $tabs['emails']   = __('Emails', 'invoicing');
885
+    $tabs['privacy']  = __('Privacy', 'invoicing');
886
+    $tabs['misc']     = __('Misc', 'invoicing');
887
+    $tabs['tools']    = __('Tools', 'invoicing');
888
+
889
+    return apply_filters('wpinv_settings_tabs', $tabs);
890 890
 }
891 891
 
892
-function wpinv_get_settings_tab_sections( $tab = false ) {
892
+function wpinv_get_settings_tab_sections($tab = false) {
893 893
     $tabs     = false;
894 894
     $sections = wpinv_get_registered_settings_sections();
895 895
 
896
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
897
-        $tabs = $sections[ $tab ];
898
-    } else if ( $tab ) {
896
+    if ($tab && !empty($sections[$tab])) {
897
+        $tabs = $sections[$tab];
898
+    } else if ($tab) {
899 899
         $tabs = false;
900 900
     }
901 901
 
@@ -905,143 +905,143 @@  discard block
 block discarded – undo
905 905
 function wpinv_get_registered_settings_sections() {
906 906
     static $sections = false;
907 907
 
908
-    if ( false !== $sections ) {
908
+    if (false !== $sections) {
909 909
         return $sections;
910 910
     }
911 911
 
912 912
     $sections = array(
913
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
914
-            'main' => __( 'General Settings', 'invoicing' ),
915
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
916
-            'labels' => __( 'Label Texts', 'invoicing' ),
917
-        ) ),
918
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
919
-            'main' => __( 'Gateway Settings', 'invoicing' ),
920
-        ) ),
921
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
922
-            'main' => __( 'Tax Settings', 'invoicing' ),
923
-            'rates' => __( 'Tax Rates', 'invoicing' ),
924
-        ) ),
925
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
926
-            'main' => __( 'Email Settings', 'invoicing' ),
927
-        ) ),
928
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
929
-            'main' => __( 'Privacy policy', 'invoicing' ),
930
-        ) ),
931
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
932
-            'main' => __( 'Miscellaneous', 'invoicing' ),
933
-            'fields' => __( 'Fields Settings', 'invoicing' ),
934
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
935
-        ) ),
936
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
937
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
938
-        ) ),
913
+        'general' => apply_filters('wpinv_settings_sections_general', array(
914
+            'main' => __('General Settings', 'invoicing'),
915
+            'currency_section' => __('Currency Settings', 'invoicing'),
916
+            'labels' => __('Label Texts', 'invoicing'),
917
+        )),
918
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
919
+            'main' => __('Gateway Settings', 'invoicing'),
920
+        )),
921
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
922
+            'main' => __('Tax Settings', 'invoicing'),
923
+            'rates' => __('Tax Rates', 'invoicing'),
924
+        )),
925
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
926
+            'main' => __('Email Settings', 'invoicing'),
927
+        )),
928
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
929
+            'main' => __('Privacy policy', 'invoicing'),
930
+        )),
931
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
932
+            'main' => __('Miscellaneous', 'invoicing'),
933
+            'fields' => __('Fields Settings', 'invoicing'),
934
+            'custom-css' => __('Custom CSS', 'invoicing'),
935
+        )),
936
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
937
+            'main' => __('Diagnostic Tools', 'invoicing'),
938
+        )),
939 939
     );
940 940
 
941
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
941
+    $sections = apply_filters('wpinv_settings_sections', $sections);
942 942
 
943 943
     return $sections;
944 944
 }
945 945
 
946
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
946
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
947 947
 	$pages_options = array();
948 948
 
949
-	if( $default_label !== NULL && $default_label !== false ) {
950
-		$pages_options = array( '' => $default_label ); // Blank option
949
+	if ($default_label !== NULL && $default_label !== false) {
950
+		$pages_options = array('' => $default_label); // Blank option
951 951
 	}
952 952
 
953 953
 	$pages = get_pages();
954
-	if ( $pages ) {
955
-		foreach ( $pages as $page ) {
954
+	if ($pages) {
955
+		foreach ($pages as $page) {
956 956
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
957
-            $pages_options[ $page->ID ] = $title;
957
+            $pages_options[$page->ID] = $title;
958 958
 		}
959 959
 	}
960 960
 
961 961
 	return $pages_options;
962 962
 }
963 963
 
964
-function wpinv_header_callback( $args ) {
965
-	if ( !empty( $args['desc'] ) ) {
964
+function wpinv_header_callback($args) {
965
+	if (!empty($args['desc'])) {
966 966
         echo $args['desc'];
967 967
     }
968 968
 }
969 969
 
970
-function wpinv_hidden_callback( $args ) {
970
+function wpinv_hidden_callback($args) {
971 971
 	global $wpinv_options;
972 972
 
973
-	if ( isset( $args['set_value'] ) ) {
973
+	if (isset($args['set_value'])) {
974 974
 		$value = $args['set_value'];
975
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
976
-		$value = $wpinv_options[ $args['id'] ];
975
+	} elseif (isset($wpinv_options[$args['id']])) {
976
+		$value = $wpinv_options[$args['id']];
977 977
 	} else {
978
-		$value = isset( $args['std'] ) ? $args['std'] : '';
978
+		$value = isset($args['std']) ? $args['std'] : '';
979 979
 	}
980 980
 
981
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
981
+	if (isset($args['faux']) && true === $args['faux']) {
982 982
 		$args['readonly'] = true;
983
-		$value = isset( $args['std'] ) ? $args['std'] : '';
983
+		$value = isset($args['std']) ? $args['std'] : '';
984 984
 		$name  = '';
985 985
 	} else {
986
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
986
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
987 987
 	}
988 988
 
989
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
989
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
990 990
     
991 991
 	echo $html;
992 992
 }
993 993
 
994
-function wpinv_checkbox_callback( $args ) {
994
+function wpinv_checkbox_callback($args) {
995 995
 	global $wpinv_options;
996 996
     
997
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
997
+    $sanitize_id = wpinv_sanitize_key($args['id']);
998 998
 
999
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
999
+	if (isset($args['faux']) && true === $args['faux']) {
1000 1000
 		$name = '';
1001 1001
 	} else {
1002 1002
 		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
1003 1003
 	}
1004 1004
 
1005
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
1005
+	$checked = isset($wpinv_options[$args['id']]) ? checked(1, $wpinv_options[$args['id']], false) : '';
1006 1006
 	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
1007
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1007
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1008 1008
 
1009 1009
 	echo $html;
1010 1010
 }
1011 1011
 
1012
-function wpinv_multicheck_callback( $args ) {
1012
+function wpinv_multicheck_callback($args) {
1013 1013
 	global $wpinv_options;
1014 1014
 
1015
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
1016
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
1015
+	$sanitize_id = wpinv_sanitize_key($args['id']);
1016
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
1017 1017
 
1018
-	if ( ! empty( $args['options'] ) ) {
1018
+	if (!empty($args['options'])) {
1019 1019
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
1020
-        foreach( $args['options'] as $key => $option ):
1021
-			$sanitize_key = wpinv_sanitize_key( $key );
1022
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
1020
+        foreach ($args['options'] as $key => $option):
1021
+			$sanitize_key = wpinv_sanitize_key($key);
1022
+			if (isset($wpinv_options[$args['id']][$sanitize_key])) { 
1023 1023
 				$enabled = $sanitize_key;
1024 1024
 			} else { 
1025 1025
 				$enabled = NULL; 
1026 1026
 			}
1027
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
1028
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
1027
+			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/>&nbsp;';
1028
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
1029 1029
 		endforeach;
1030 1030
 		echo '</div>';
1031 1031
 		echo '<p class="description">' . $args['desc'] . '</p>';
1032 1032
 	}
1033 1033
 }
1034 1034
 
1035
-function wpinv_payment_icons_callback( $args ) {
1035
+function wpinv_payment_icons_callback($args) {
1036 1036
 	global $wpinv_options;
1037 1037
     
1038
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1038
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1039 1039
 
1040
-	if ( ! empty( $args['options'] ) ) {
1041
-		foreach( $args['options'] as $key => $option ) {
1042
-            $sanitize_key = wpinv_sanitize_key( $key );
1040
+	if (!empty($args['options'])) {
1041
+		foreach ($args['options'] as $key => $option) {
1042
+            $sanitize_key = wpinv_sanitize_key($key);
1043 1043
             
1044
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
1044
+			if (isset($wpinv_options[$args['id']][$key])) {
1045 1045
 				$enabled = $option;
1046 1046
 			} else {
1047 1047
 				$enabled = NULL;
@@ -1049,196 +1049,196 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
1051 1051
 
1052
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
1052
+				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
1053 1053
 
1054
-				if ( wpinv_string_is_image_url( $key ) ) {
1055
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1054
+				if (wpinv_string_is_image_url($key)) {
1055
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1056 1056
 				} else {
1057
-					$card = strtolower( str_replace( ' ', '', $option ) );
1057
+					$card = strtolower(str_replace(' ', '', $option));
1058 1058
 
1059
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
1060
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
1059
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
1060
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
1061 1061
 					} else {
1062
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
1062
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
1063 1063
 						$content_dir = WP_CONTENT_DIR;
1064 1064
 
1065
-						if ( function_exists( 'wp_normalize_path' ) ) {
1065
+						if (function_exists('wp_normalize_path')) {
1066 1066
 							// Replaces backslashes with forward slashes for Windows systems
1067
-							$image = wp_normalize_path( $image );
1068
-							$content_dir = wp_normalize_path( $content_dir );
1067
+							$image = wp_normalize_path($image);
1068
+							$content_dir = wp_normalize_path($content_dir);
1069 1069
 						}
1070 1070
 
1071
-						$image = str_replace( $content_dir, content_url(), $image );
1071
+						$image = str_replace($content_dir, content_url(), $image);
1072 1072
 					}
1073 1073
 
1074
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1074
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1075 1075
 				}
1076 1076
 			echo $option . '</label>';
1077 1077
 		}
1078
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1078
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
1079 1079
 	}
1080 1080
 }
1081 1081
 
1082
-function wpinv_radio_callback( $args ) {
1082
+function wpinv_radio_callback($args) {
1083 1083
 	global $wpinv_options;
1084 1084
     
1085
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1085
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1086 1086
     
1087
-    foreach ( $args['options'] as $key => $option ) :
1088
-		$sanitize_key = wpinv_sanitize_key( $key );
1087
+    foreach ($args['options'] as $key => $option) :
1088
+		$sanitize_key = wpinv_sanitize_key($key);
1089 1089
         
1090 1090
         $checked = false;
1091 1091
 
1092
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1092
+		if (isset($wpinv_options[$args['id']]) && $wpinv_options[$args['id']] == $key)
1093 1093
 			$checked = true;
1094
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1094
+		elseif (isset($args['std']) && $args['std'] == $key && !isset($wpinv_options[$args['id']]))
1095 1095
 			$checked = true;
1096 1096
 
1097 1097
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1098
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1098
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option) . '</label><br/>';
1099 1099
 	endforeach;
1100 1100
 
1101
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1101
+	echo '<p class="description">' . wp_kses_post($args['desc']) . '</p>';
1102 1102
 }
1103 1103
 
1104
-function wpinv_gateways_callback( $args ) {
1104
+function wpinv_gateways_callback($args) {
1105 1105
 	global $wpinv_options;
1106 1106
     
1107
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1107
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1108 1108
 
1109
-	foreach ( $args['options'] as $key => $option ) :
1110
-		$sanitize_key = wpinv_sanitize_key( $key );
1109
+	foreach ($args['options'] as $key => $option) :
1110
+		$sanitize_key = wpinv_sanitize_key($key);
1111 1111
         
1112
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
1112
+        if (isset($wpinv_options['gateways'][$key]))
1113 1113
 			$enabled = '1';
1114 1114
 		else
1115 1115
 			$enabled = null;
1116 1116
 
1117
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1118
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1117
+		echo '<input name="wpinv_settings[' . esc_attr($args['id']) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1118
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>';
1119 1119
 	endforeach;
1120 1120
 }
1121 1121
 
1122 1122
 function wpinv_gateway_select_callback($args) {
1123 1123
 	global $wpinv_options;
1124 1124
     
1125
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1125
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1126 1126
 
1127 1127
 	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1128 1128
 
1129
-	foreach ( $args['options'] as $key => $option ) :
1130
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1131
-            $selected = selected( $key, $args['selected'], false );
1129
+	foreach ($args['options'] as $key => $option) :
1130
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
1131
+            $selected = selected($key, $args['selected'], false);
1132 1132
         } else {
1133
-            $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1133
+            $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : '';
1134 1134
         }
1135
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1135
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
1136 1136
 	endforeach;
1137 1137
 
1138 1138
 	echo '</select>';
1139
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1139
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1140 1140
 }
1141 1141
 
1142
-function wpinv_text_callback( $args ) {
1142
+function wpinv_text_callback($args) {
1143 1143
 	global $wpinv_options;
1144 1144
     
1145
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1145
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1146 1146
 
1147
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1148
-		$value = $wpinv_options[ $args['id'] ];
1147
+	if (isset($wpinv_options[$args['id']])) {
1148
+		$value = $wpinv_options[$args['id']];
1149 1149
 	} else {
1150
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1150
+		$value = isset($args['std']) ? $args['std'] : '';
1151 1151
 	}
1152 1152
 
1153
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1153
+	if (isset($args['faux']) && true === $args['faux']) {
1154 1154
 		$args['readonly'] = true;
1155
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1155
+		$value = isset($args['std']) ? $args['std'] : '';
1156 1156
 		$name  = '';
1157 1157
 	} else {
1158
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1158
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
1159 1159
 	}
1160
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1160
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
1161 1161
 
1162 1162
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1163
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1164
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1165
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1163
+	$size     = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1164
+	$html     = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>';
1165
+	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1166 1166
 
1167 1167
 	echo $html;
1168 1168
 }
1169 1169
 
1170
-function wpinv_number_callback( $args ) {
1170
+function wpinv_number_callback($args) {
1171 1171
 	global $wpinv_options;
1172 1172
     
1173
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1173
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1174 1174
 
1175
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1176
-		$value = $wpinv_options[ $args['id'] ];
1175
+	if (isset($wpinv_options[$args['id']])) {
1176
+		$value = $wpinv_options[$args['id']];
1177 1177
 	} else {
1178
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1178
+		$value = isset($args['std']) ? $args['std'] : '';
1179 1179
 	}
1180 1180
 
1181
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1181
+	if (isset($args['faux']) && true === $args['faux']) {
1182 1182
 		$args['readonly'] = true;
1183
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1183
+		$value = isset($args['std']) ? $args['std'] : '';
1184 1184
 		$name  = '';
1185 1185
 	} else {
1186
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1186
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
1187 1187
 	}
1188 1188
 
1189
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1190
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1191
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1192
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1189
+	$max  = isset($args['max']) ? $args['max'] : 999999;
1190
+	$min  = isset($args['min']) ? $args['min'] : 0;
1191
+	$step = isset($args['step']) ? $args['step'] : 1;
1192
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
1193 1193
 
1194
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1195
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1196
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1194
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1195
+	$html = '<input type="number" step="' . esc_attr($step) . '" max="' . esc_attr($max) . '" min="' . esc_attr($min) . '" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"/>';
1196
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1197 1197
 
1198 1198
 	echo $html;
1199 1199
 }
1200 1200
 
1201
-function wpinv_textarea_callback( $args ) {
1201
+function wpinv_textarea_callback($args) {
1202 1202
 	global $wpinv_options;
1203 1203
     
1204
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1204
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1205 1205
 
1206
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1207
-		$value = $wpinv_options[ $args['id'] ];
1206
+	if (isset($wpinv_options[$args['id']])) {
1207
+		$value = $wpinv_options[$args['id']];
1208 1208
 	} else {
1209
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1209
+		$value = isset($args['std']) ? $args['std'] : '';
1210 1210
 	}
1211 1211
     
1212
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1213
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1212
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1213
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
1214 1214
 
1215
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1216
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1215
+	$html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>';
1216
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1217 1217
 
1218 1218
 	echo $html;
1219 1219
 }
1220 1220
 
1221
-function wpinv_password_callback( $args ) {
1221
+function wpinv_password_callback($args) {
1222 1222
 	global $wpinv_options;
1223 1223
     
1224
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1224
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1225 1225
 
1226
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1227
-		$value = $wpinv_options[ $args['id'] ];
1226
+	if (isset($wpinv_options[$args['id']])) {
1227
+		$value = $wpinv_options[$args['id']];
1228 1228
 	} else {
1229
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1229
+		$value = isset($args['std']) ? $args['std'] : '';
1230 1230
 	}
1231 1231
 
1232
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1233
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
1234
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1232
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1233
+	$html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>';
1234
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1235 1235
 
1236 1236
 	echo $html;
1237 1237
 }
1238 1238
 
1239 1239
 function wpinv_missing_callback($args) {
1240 1240
 	printf(
1241
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1241
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
1242 1242
 		'<strong>' . $args['id'] . '</strong>'
1243 1243
 	);
1244 1244
 }
@@ -1246,131 +1246,131 @@  discard block
 block discarded – undo
1246 1246
 function wpinv_select_callback($args) {
1247 1247
 	global $wpinv_options;
1248 1248
     
1249
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1249
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1250 1250
 
1251
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1252
-		$value = $wpinv_options[ $args['id'] ];
1251
+	if (isset($wpinv_options[$args['id']])) {
1252
+		$value = $wpinv_options[$args['id']];
1253 1253
 	} else {
1254
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1254
+		$value = isset($args['std']) ? $args['std'] : '';
1255 1255
 	}
1256 1256
     
1257
-    if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1257
+    if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
1258 1258
         $value = $args['selected'];
1259 1259
     }
1260 1260
 
1261
-	if ( isset( $args['placeholder'] ) ) {
1261
+	if (isset($args['placeholder'])) {
1262 1262
 		$placeholder = $args['placeholder'];
1263 1263
 	} else {
1264 1264
 		$placeholder = '';
1265 1265
 	}
1266 1266
     
1267
-    if( !empty( $args['onchange'] ) ) {
1268
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
1267
+    if (!empty($args['onchange'])) {
1268
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
1269 1269
     } else {
1270 1270
         $onchange = '';
1271 1271
     }
1272 1272
 
1273
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1273
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />';
1274 1274
 
1275
-	foreach ( $args['options'] as $option => $name ) {
1276
-		$selected = selected( $option, $value, false );
1277
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1275
+	foreach ($args['options'] as $option => $name) {
1276
+		$selected = selected($option, $value, false);
1277
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
1278 1278
 	}
1279 1279
 
1280 1280
 	$html .= '</select>';
1281
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1281
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1282 1282
 
1283 1283
 	echo $html;
1284 1284
 }
1285 1285
 
1286
-function wpinv_color_select_callback( $args ) {
1286
+function wpinv_color_select_callback($args) {
1287 1287
 	global $wpinv_options;
1288 1288
     
1289
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1289
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1290 1290
 
1291
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1292
-		$value = $wpinv_options[ $args['id'] ];
1291
+	if (isset($wpinv_options[$args['id']])) {
1292
+		$value = $wpinv_options[$args['id']];
1293 1293
 	} else {
1294
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1294
+		$value = isset($args['std']) ? $args['std'] : '';
1295 1295
 	}
1296 1296
 
1297
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1297
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
1298 1298
 
1299
-	foreach ( $args['options'] as $option => $color ) {
1300
-		$selected = selected( $option, $value, false );
1301
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1299
+	foreach ($args['options'] as $option => $color) {
1300
+		$selected = selected($option, $value, false);
1301
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
1302 1302
 	}
1303 1303
 
1304 1304
 	$html .= '</select>';
1305
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1305
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1306 1306
 
1307 1307
 	echo $html;
1308 1308
 }
1309 1309
 
1310
-function wpinv_rich_editor_callback( $args ) {
1310
+function wpinv_rich_editor_callback($args) {
1311 1311
 	global $wpinv_options, $wp_version;
1312 1312
     
1313
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1313
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1314 1314
 
1315
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1316
-		$value = $wpinv_options[ $args['id'] ];
1315
+	if (isset($wpinv_options[$args['id']])) {
1316
+		$value = $wpinv_options[$args['id']];
1317 1317
 
1318
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1319
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1318
+		if (empty($args['allow_blank']) && empty($value)) {
1319
+			$value = isset($args['std']) ? $args['std'] : '';
1320 1320
 		}
1321 1321
 	} else {
1322
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1322
+		$value = isset($args['std']) ? $args['std'] : '';
1323 1323
 	}
1324 1324
 
1325
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1325
+	$rows = isset($args['size']) ? $args['size'] : 20;
1326 1326
 
1327
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1327
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
1328 1328
 		ob_start();
1329
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
1329
+		wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false));
1330 1330
 		$html = ob_get_clean();
1331 1331
 	} else {
1332
-		$html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1332
+		$html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>';
1333 1333
 	}
1334 1334
 
1335
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1335
+	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1336 1336
 
1337 1337
 	echo $html;
1338 1338
 }
1339 1339
 
1340
-function wpinv_upload_callback( $args ) {
1340
+function wpinv_upload_callback($args) {
1341 1341
 	global $wpinv_options;
1342 1342
     
1343
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1343
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1344 1344
 
1345
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1345
+	if (isset($wpinv_options[$args['id']])) {
1346 1346
 		$value = $wpinv_options[$args['id']];
1347 1347
 	} else {
1348 1348
 		$value = isset($args['std']) ? $args['std'] : '';
1349 1349
 	}
1350 1350
 
1351
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1352
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1353
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1354
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1351
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1352
+	$html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>';
1353
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
1354
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1355 1355
 
1356 1356
 	echo $html;
1357 1357
 }
1358 1358
 
1359
-function wpinv_color_callback( $args ) {
1359
+function wpinv_color_callback($args) {
1360 1360
 	global $wpinv_options;
1361 1361
     
1362
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1362
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1363 1363
 
1364
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1365
-		$value = $wpinv_options[ $args['id'] ];
1364
+	if (isset($wpinv_options[$args['id']])) {
1365
+		$value = $wpinv_options[$args['id']];
1366 1366
 	} else {
1367
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1367
+		$value = isset($args['std']) ? $args['std'] : '';
1368 1368
 	}
1369 1369
 
1370
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1370
+	$default = isset($args['std']) ? $args['std'] : '';
1371 1371
 
1372
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
1373
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1372
+	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($default) . '" />';
1373
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1374 1374
 
1375 1375
 	echo $html;
1376 1376
 }
@@ -1378,9 +1378,9 @@  discard block
 block discarded – undo
1378 1378
 function wpinv_country_states_callback($args) {
1379 1379
 	global $wpinv_options;
1380 1380
     
1381
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1381
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1382 1382
 
1383
-	if ( isset( $args['placeholder'] ) ) {
1383
+	if (isset($args['placeholder'])) {
1384 1384
 		$placeholder = $args['placeholder'];
1385 1385
 	} else {
1386 1386
 		$placeholder = '';
@@ -1388,16 +1388,16 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
 	$states = wpinv_get_country_states();
1390 1390
 
1391
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1392
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1391
+	$class = empty($states) ? ' class="wpinv-no-states"' : '';
1392
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
1393 1393
 
1394
-	foreach ( $states as $option => $name ) {
1395
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1396
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1394
+	foreach ($states as $option => $name) {
1395
+		$selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : '';
1396
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
1397 1397
 	}
1398 1398
 
1399 1399
 	$html .= '</select>';
1400
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1400
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1401 1401
 
1402 1402
 	echo $html;
1403 1403
 }
@@ -1412,95 +1412,95 @@  discard block
 block discarded – undo
1412 1412
 	<table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts">
1413 1413
 		<thead>
1414 1414
 			<tr>
1415
-				<th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th>
1416
-				<th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th>
1417
-                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e( 'Apply rate to whole country, regardless of state / province', 'invoicing' ); ?>"><?php _e( 'Country Wide', 'invoicing' ); ?></th>
1418
-                <th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> 
1419
-                <th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th>
1420
-				<th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th>
1415
+				<th scope="col" class="wpinv_tax_country"><?php _e('Country', 'invoicing'); ?></th>
1416
+				<th scope="col" class="wpinv_tax_state"><?php _e('State / Province', 'invoicing'); ?></th>
1417
+                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e('Apply rate to whole country, regardless of state / province', 'invoicing'); ?>"><?php _e('Country Wide', 'invoicing'); ?></th>
1418
+                <th scope="col" class="wpinv_tax_rate"><?php _e('Rate %', 'invoicing'); ?></th> 
1419
+                <th scope="col" class="wpinv_tax_name"><?php _e('Tax Name', 'invoicing'); ?></th>
1420
+				<th scope="col" class="wpinv_tax_action"><?php _e('Remove', 'invoicing'); ?></th>
1421 1421
 			</tr>
1422 1422
 		</thead>
1423 1423
         <tbody>
1424
-		<?php if( !empty( $rates ) ) : ?>
1425
-			<?php foreach( $rates as $key => $rate ) : ?>
1424
+		<?php if (!empty($rates)) : ?>
1425
+			<?php foreach ($rates as $key => $rate) : ?>
1426 1426
             <?php 
1427
-            $sanitized_key = wpinv_sanitize_key( $key );
1427
+            $sanitized_key = wpinv_sanitize_key($key);
1428 1428
             ?>
1429 1429
 			<tr>
1430 1430
 				<td class="wpinv_tax_country">
1431 1431
 					<?php
1432
-					echo wpinv_html_select( array(
1433
-						'options'          => wpinv_get_country_list( true ),
1432
+					echo wpinv_html_select(array(
1433
+						'options'          => wpinv_get_country_list(true),
1434 1434
 						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1435 1435
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1436 1436
 						'selected'         => $rate['country'],
1437 1437
 						'show_option_all'  => false,
1438 1438
 						'show_option_none' => false,
1439 1439
 						'class'            => 'wpinv-tax-country',
1440
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1441
-					) );
1440
+						'placeholder'      => __('Choose a country', 'invoicing')
1441
+					));
1442 1442
 					?>
1443 1443
 				</td>
1444 1444
 				<td class="wpinv_tax_state">
1445 1445
 					<?php
1446
-					$states = wpinv_get_country_states( $rate['country'] );
1447
-					if( !empty( $states ) ) {
1448
-						echo wpinv_html_select( array(
1449
-							'options'          => array_merge( array( '' => '' ), $states ),
1446
+					$states = wpinv_get_country_states($rate['country']);
1447
+					if (!empty($states)) {
1448
+						echo wpinv_html_select(array(
1449
+							'options'          => array_merge(array('' => ''), $states),
1450 1450
 							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1451 1451
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1452 1452
 							'selected'         => $rate['state'],
1453 1453
 							'show_option_all'  => false,
1454 1454
 							'show_option_none' => false,
1455
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1456
-						) );
1455
+							'placeholder'      => __('Choose a state', 'invoicing')
1456
+						));
1457 1457
 					} else {
1458
-						echo wpinv_html_text( array(
1458
+						echo wpinv_html_text(array(
1459 1459
 							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1460
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1460
+							'value' => !empty($rate['state']) ? $rate['state'] : '',
1461 1461
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1462
-						) );
1462
+						));
1463 1463
 					}
1464 1464
 					?>
1465 1465
 				</td>
1466 1466
 				<td class="wpinv_tax_global">
1467
-					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/>
1468
-					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
1467
+					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked(true, !empty($rate['global'])); ?>/>
1468
+					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
1469 1469
 				</td>
1470
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html( $rate['rate'] ); ?>"/></td>
1471
-                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html( $rate['name'] ); ?>"/></td>
1472
-				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1470
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html($rate['rate']); ?>"/></td>
1471
+                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html($rate['name']); ?>"/></td>
1472
+				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
1473 1473
 			</tr>
1474 1474
 			<?php endforeach; ?>
1475 1475
 		<?php else : ?>
1476 1476
 			<tr>
1477 1477
 				<td class="wpinv_tax_country">
1478 1478
 					<?php
1479
-					echo wpinv_html_select( array(
1480
-						'options'          => wpinv_get_country_list( true ),
1479
+					echo wpinv_html_select(array(
1480
+						'options'          => wpinv_get_country_list(true),
1481 1481
 						'name'             => 'tax_rates[0][country]',
1482 1482
 						'show_option_all'  => false,
1483 1483
 						'show_option_none' => false,
1484 1484
 						'class'            => 'wpinv-tax-country',
1485
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1486
-					) ); ?>
1485
+						'placeholder'      => __('Choose a country', 'invoicing')
1486
+					)); ?>
1487 1487
 				</td>
1488 1488
 				<td class="wpinv_tax_state">
1489
-					<?php echo wpinv_html_text( array(
1489
+					<?php echo wpinv_html_text(array(
1490 1490
 						'name' => 'tax_rates[0][state]'
1491
-					) ); ?>
1491
+					)); ?>
1492 1492
 				</td>
1493 1493
 				<td class="wpinv_tax_global">
1494 1494
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
1495
-					<label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
1495
+					<label for="tax_rates[0][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
1496 1496
 				</td>
1497
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>" value="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>"/></td>
1497
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option('tax_rate', 0); ?>" value="<?php echo (float)wpinv_get_option('tax_rate', 0); ?>"/></td>
1498 1498
                 <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td>
1499
-				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1499
+				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
1500 1500
 			</tr>
1501 1501
 		<?php endif; ?>
1502 1502
         </tbody>
1503
-        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot>
1503
+        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e('Add Tax Rate', 'invoicing'); ?></span></td></tr></tfoot>
1504 1504
 	</table>
1505 1505
 	<?php
1506 1506
 	echo ob_get_clean();
@@ -1511,76 +1511,76 @@  discard block
 block discarded – undo
1511 1511
     ob_start(); ?>
1512 1512
     </td><tr>
1513 1513
     <td colspan="2" class="wpinv_tools_tdbox">
1514
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1515
-    <?php do_action( 'wpinv_tools_before' ); ?>
1514
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1515
+    <?php do_action('wpinv_tools_before'); ?>
1516 1516
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
1517 1517
         <thead>
1518 1518
             <tr>
1519
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
1520
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
1521
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
1519
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
1520
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
1521
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
1522 1522
             </tr>
1523 1523
         </thead>
1524
-            <?php do_action( 'wpinv_tools_row' ); ?>
1524
+            <?php do_action('wpinv_tools_row'); ?>
1525 1525
         <tbody>
1526 1526
         </tbody>
1527 1527
     </table>
1528
-    <?php do_action( 'wpinv_tools_after' ); ?>
1528
+    <?php do_action('wpinv_tools_after'); ?>
1529 1529
     <?php
1530 1530
     echo ob_get_clean();
1531 1531
 }
1532 1532
 
1533
-function wpinv_descriptive_text_callback( $args ) {
1534
-	echo wp_kses_post( $args['desc'] );
1533
+function wpinv_descriptive_text_callback($args) {
1534
+	echo wp_kses_post($args['desc']);
1535 1535
 }
1536 1536
 
1537
-function wpinv_hook_callback( $args ) {
1538
-	do_action( 'wpinv_' . $args['id'], $args );
1537
+function wpinv_hook_callback($args) {
1538
+	do_action('wpinv_' . $args['id'], $args);
1539 1539
 }
1540 1540
 
1541 1541
 function wpinv_set_settings_cap() {
1542 1542
 	return 'manage_options';
1543 1543
 }
1544
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1544
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1545 1545
 
1546
-function wpinv_settings_sanitize_input( $value, $key ) {
1547
-    if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) {
1548
-        $value = wpinv_sanitize_amount( $value, 4 );
1546
+function wpinv_settings_sanitize_input($value, $key) {
1547
+    if ($key == 'tax_rate' || $key == 'eu_fallback_rate') {
1548
+        $value = wpinv_sanitize_amount($value, 4);
1549 1549
         $value = $value >= 100 ? 99 : $value;
1550 1550
     }
1551 1551
         
1552 1552
     return $value;
1553 1553
 }
1554
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1554
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1555 1555
 
1556
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1557
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1558
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1556
+function wpinv_on_update_settings($old_value, $value, $option) {
1557
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1558
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1559 1559
     
1560
-    if ( $old != $new ) {
1561
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1560
+    if ($old != $new) {
1561
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1562 1562
     }
1563 1563
 }
1564
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1565
-add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1566
-add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1567
-add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1568
-add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1569
-add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1570
-add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1571
-add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1572
-add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1573
-add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1574
-add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1575
-
1576
-function wpinv_settings_tab_bottom_emails( $active_tab, $section ) {
1564
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1565
+add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1566
+add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1567
+add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1568
+add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1569
+add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1570
+add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1571
+add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1572
+add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1573
+add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2);
1574
+add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2);
1575
+
1576
+function wpinv_settings_tab_bottom_emails($active_tab, $section) {
1577 1577
     ?>
1578 1578
     <div class="wpinv-email-wc-row ">
1579 1579
         <div class="wpinv-email-wc-td">
1580
-            <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3>
1580
+            <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3>
1581 1581
             <p class="wpinv-email-wc-description">
1582 1582
                 <?php
1583
-                $description = __( 'The following wildcards can be used in email subjects, heading and content:<br>
1583
+                $description = __('The following wildcards can be used in email subjects, heading and content:<br>
1584 1584
                     <strong>{site_title} :</strong> Site Title<br>
1585 1585
                     <strong>{name} :</strong> Customer\'s full name<br>
1586 1586
                     <strong>{first_name} :</strong> Customer\'s first name<br>
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
                     <strong>{invoice_due_date} :</strong> The date the invoice is due<br>
1595 1595
                     <strong>{date} :</strong> Today\'s date.<br>
1596 1596
                     <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br>
1597
-                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' );
1597
+                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing');
1598 1598
                 echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section);
1599 1599
                 ?>
1600 1600
             </p>
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -7,245 +7,245 @@  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
-function wpinv_columns( $columns ) {
14
+function wpinv_columns($columns) {
15 15
     $columns = array(
16 16
         'cb'                => $columns['cb'],
17
-        'number'            => __( 'Number', 'invoicing' ),
18
-        'customer'          => __( 'Customer', 'invoicing' ),
19
-        'amount'            => __( 'Amount', 'invoicing' ),
20
-        'invoice_date'      => __( 'Created Date', 'invoicing' ),
21
-        'payment_date'      => __( 'Payment Date', 'invoicing' ),
22
-        'status'            => __( 'Status', 'invoicing' ),
23
-        'ID'                => __( 'ID', 'invoicing' ),
24
-        'wpi_actions'       => __( 'Actions', 'invoicing' ),
17
+        'number'            => __('Number', 'invoicing'),
18
+        'customer'          => __('Customer', 'invoicing'),
19
+        'amount'            => __('Amount', 'invoicing'),
20
+        'invoice_date'      => __('Created Date', 'invoicing'),
21
+        'payment_date'      => __('Payment Date', 'invoicing'),
22
+        'status'            => __('Status', 'invoicing'),
23
+        'ID'                => __('ID', 'invoicing'),
24
+        'wpi_actions'       => __('Actions', 'invoicing'),
25 25
     );
26 26
 
27
-    return apply_filters( 'wpi_invoice_table_columns', $columns );
27
+    return apply_filters('wpi_invoice_table_columns', $columns);
28 28
 }
29
-add_filter( 'manage_wpi_invoice_posts_columns', 'wpinv_columns' );
29
+add_filter('manage_wpi_invoice_posts_columns', 'wpinv_columns');
30 30
 
31
-function wpinv_bulk_actions( $actions ) {
32
-    if ( isset( $actions['edit'] ) ) {
33
-        unset( $actions['edit'] );
31
+function wpinv_bulk_actions($actions) {
32
+    if (isset($actions['edit'])) {
33
+        unset($actions['edit']);
34 34
     }
35 35
 
36 36
     return $actions;
37 37
 }
38
-add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' );
39
-add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' );
38
+add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions');
39
+add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions');
40 40
 
41
-function wpinv_sortable_columns( $columns ) {
41
+function wpinv_sortable_columns($columns) {
42 42
     $columns = array(
43
-        'ID'            => array( 'ID', true ),
44
-        'number'        => array( 'number', false ),
45
-        'amount'        => array( 'amount', false ),
46
-        'invoice_date'  => array( 'date', false ),
47
-        'payment_date'  => array( 'payment_date', true ),
48
-        'customer'      => array( 'customer', false ),
49
-        'status'        => array( 'status', false ),
43
+        'ID'            => array('ID', true),
44
+        'number'        => array('number', false),
45
+        'amount'        => array('amount', false),
46
+        'invoice_date'  => array('date', false),
47
+        'payment_date'  => array('payment_date', true),
48
+        'customer'      => array('customer', false),
49
+        'status'        => array('status', false),
50 50
     );
51 51
     
52
-    return apply_filters( 'wpi_invoice_table_sortable_columns', $columns );
52
+    return apply_filters('wpi_invoice_table_sortable_columns', $columns);
53 53
 }
54
-add_filter( 'manage_edit-wpi_invoice_sortable_columns', 'wpinv_sortable_columns' );
54
+add_filter('manage_edit-wpi_invoice_sortable_columns', 'wpinv_sortable_columns');
55 55
 
56
-add_action( 'manage_wpi_invoice_posts_custom_column', 'wpinv_posts_custom_column');
57
-function wpinv_posts_custom_column( $column_name, $post_id = 0 ) {
56
+add_action('manage_wpi_invoice_posts_custom_column', 'wpinv_posts_custom_column');
57
+function wpinv_posts_custom_column($column_name, $post_id = 0) {
58 58
     global $post, $wpi_invoice;
59 59
     
60
-    if ( empty( $wpi_invoice ) || ( !empty( $wpi_invoice ) && $post->ID != $wpi_invoice->ID ) ) {
61
-        $wpi_invoice = new WPInv_Invoice( $post->ID );
60
+    if (empty($wpi_invoice) || (!empty($wpi_invoice) && $post->ID != $wpi_invoice->ID)) {
61
+        $wpi_invoice = new WPInv_Invoice($post->ID);
62 62
     }
63 63
 
64 64
     $value = NULL;
65 65
     
66
-    switch ( $column_name ) {
66
+    switch ($column_name) {
67 67
         case 'email' :
68
-            $value   = $wpi_invoice->get_email();
68
+            $value = $wpi_invoice->get_email();
69 69
             break;
70 70
         case 'customer' :
71 71
             $customer_name = $wpi_invoice->get_user_full_name();
72
-            $customer_name = $customer_name != '' ? $customer_name : __( 'Customer', 'invoicing' );
73
-            $value = '<a href="' . esc_url( get_edit_user_link( $wpi_invoice->get_user_id() ) ) . '">' . $customer_name . '</a>';
74
-            if ( $email = $wpi_invoice->get_email() ) {
72
+            $customer_name = $customer_name != '' ? $customer_name : __('Customer', 'invoicing');
73
+            $value = '<a href="' . esc_url(get_edit_user_link($wpi_invoice->get_user_id())) . '">' . $customer_name . '</a>';
74
+            if ($email = $wpi_invoice->get_email()) {
75 75
                 $value .= '<br><a class="email" href="mailto:' . $email . '">' . $email . '</a>';
76 76
             }
77 77
             break;
78 78
         case 'amount' :
79
-            echo $wpi_invoice->get_total( true );
79
+            echo $wpi_invoice->get_total(true);
80 80
             break;
81 81
         case 'invoice_date' :
82
-            $date_format = get_option( 'date_format' );
83
-            $time_format = get_option( 'time_format' );
84
-            $date_time_format = $date_format . ' '. $time_format;
82
+            $date_format = get_option('date_format');
83
+            $time_format = get_option('time_format');
84
+            $date_time_format = $date_format . ' ' . $time_format;
85 85
             
86 86
             $m_time = $post->post_date;
87
-            $h_time = mysql2date( $date_format, $m_time );
87
+            $h_time = mysql2date($date_format, $m_time);
88 88
             
89
-            $value   = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>';
89
+            $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>';
90 90
             break;
91 91
         case 'payment_date' :
92
-            if ( $date_completed = $wpi_invoice->get_meta( '_wpinv_completed_date', true ) ) {
93
-                $date_format = get_option( 'date_format' );
94
-                $time_format = get_option( 'time_format' );
95
-                $date_time_format = $date_format . ' '. $time_format;
92
+            if ($date_completed = $wpi_invoice->get_meta('_wpinv_completed_date', true)) {
93
+                $date_format = get_option('date_format');
94
+                $time_format = get_option('time_format');
95
+                $date_time_format = $date_format . ' ' . $time_format;
96 96
                 
97 97
                 $m_time = $date_completed;
98
-                $h_time = mysql2date( $date_format, $m_time );
98
+                $h_time = mysql2date($date_format, $m_time);
99 99
                 
100
-                $value   = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>';
100
+                $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>';
101 101
             } else {
102 102
                 $value = '-';
103 103
             }
104 104
             break;
105 105
         case 'status' :
106
-            $value   = $wpi_invoice->get_status( true ) . ( $wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '' );
107
-            $is_viewed = wpinv_is_invoice_viewed( $wpi_invoice->ID );
108
-            if ( 1 == $is_viewed ) {
109
-                $value .= '&nbsp;&nbsp;<i class="fa fa-eye" title="'.__( 'Viewed by Customer', 'invoicing' ).'"></i>';
106
+            $value = $wpi_invoice->get_status(true) . ($wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __('(r)', 'invoicing') . '</span>' : '');
107
+            $is_viewed = wpinv_is_invoice_viewed($wpi_invoice->ID);
108
+            if (1 == $is_viewed) {
109
+                $value .= '&nbsp;&nbsp;<i class="fa fa-eye" title="' . __('Viewed by Customer', 'invoicing') . '"></i>';
110 110
             }
111
-            if ( ( $wpi_invoice->is_paid() || $wpi_invoice->is_refunded() ) && ( $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ) ) ) {
112
-                $value .= '<br><small class="meta gateway">' . wp_sprintf( __( 'Via %s', 'invoicing' ), $gateway_title ) . '</small>';
111
+            if (($wpi_invoice->is_paid() || $wpi_invoice->is_refunded()) && ($gateway_title = wpinv_get_gateway_admin_label($wpi_invoice->get_gateway()))) {
112
+                $value .= '<br><small class="meta gateway">' . wp_sprintf(__('Via %s', 'invoicing'), $gateway_title) . '</small>';
113 113
             }
114 114
             break;
115 115
         case 'number' :
116
-            $edit_link = get_edit_post_link( $post->ID );
117
-            $value = '<a title="' . esc_attr__( 'View Invoice Details', 'invoicing' ) . '" href="' . esc_url( $edit_link ) . '">' . $wpi_invoice->get_number() . '</a>';
116
+            $edit_link = get_edit_post_link($post->ID);
117
+            $value = '<a title="' . esc_attr__('View Invoice Details', 'invoicing') . '" href="' . esc_url($edit_link) . '">' . $wpi_invoice->get_number() . '</a>';
118 118
             break;
119 119
         case 'wpi_actions' :
120 120
             $value = '';
121
-            if ( !empty( $post->post_name ) ) {
122
-                $value .= '<a title="' . esc_attr__( 'Print invoice', 'invoicing' ) . '" href="' . esc_url( get_permalink( $post->ID ) ) . '" class="button ui-tip column-act-btn" title="" target="_blank"><span class="dashicons dashicons-print"><i style="" class="fa fa-print"></i></span></a>';
121
+            if (!empty($post->post_name)) {
122
+                $value .= '<a title="' . esc_attr__('Print invoice', 'invoicing') . '" href="' . esc_url(get_permalink($post->ID)) . '" class="button ui-tip column-act-btn" title="" target="_blank"><span class="dashicons dashicons-print"><i style="" class="fa fa-print"></i></span></a>';
123 123
             }
124 124
             
125
-            if ( $email = $wpi_invoice->get_email() ) {
126
-                $value .= '<a title="' . esc_attr__( 'Send invoice to customer', 'invoicing' ) . '" href="' . esc_url( add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) ) . '" class="button ui-tip column-act-btn"><span class="dashicons dashicons-email-alt"></span></a>';
125
+            if ($email = $wpi_invoice->get_email()) {
126
+                $value .= '<a title="' . esc_attr__('Send invoice to customer', 'invoicing') . '" href="' . esc_url(add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID))) . '" class="button ui-tip column-act-btn"><span class="dashicons dashicons-email-alt"></span></a>';
127 127
             }
128 128
             
129 129
             break;
130 130
         default:
131
-            $value = isset( $post->$column_name ) ? $post->$column_name : '';
131
+            $value = isset($post->$column_name) ? $post->$column_name : '';
132 132
             break;
133 133
 
134 134
     }
135
-    $value = apply_filters( 'wpinv_payments_table_column', $value, $post->ID, $column_name );
135
+    $value = apply_filters('wpinv_payments_table_column', $value, $post->ID, $column_name);
136 136
     
137
-    if ( $value !== NULL ) {
137
+    if ($value !== NULL) {
138 138
         echo $value;
139 139
     }
140 140
 }
141 141
 
142
-function wpinv_admin_post_id( $id = 0 ) {
142
+function wpinv_admin_post_id($id = 0) {
143 143
     global $post;
144 144
 
145
-    if ( isset( $id ) && ! empty( $id ) ) {
145
+    if (isset($id) && !empty($id)) {
146 146
         return (int)$id;
147
-    } else if ( get_the_ID() ) {
148
-        return (int) get_the_ID();
149
-    } else if ( isset( $post->ID ) && !empty( $post->ID ) ) {
150
-        return (int) $post->ID;
151
-    } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) {
152
-        return (int) $_GET['post'];
153
-    } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) {
154
-        return (int) $_GET['id'];
155
-    } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
156
-        return (int) $_POST['id'];
147
+    } else if (get_the_ID()) {
148
+        return (int)get_the_ID();
149
+    } else if (isset($post->ID) && !empty($post->ID)) {
150
+        return (int)$post->ID;
151
+    } else if (isset($_GET['post']) && !empty($_GET['post'])) {
152
+        return (int)$_GET['post'];
153
+    } else if (isset($_GET['id']) && !empty($_GET['id'])) {
154
+        return (int)$_GET['id'];
155
+    } else if (isset($_POST['id']) && !empty($_POST['id'])) {
156
+        return (int)$_POST['id'];
157 157
     } 
158 158
 
159 159
     return null;
160 160
 }
161 161
     
162
-function wpinv_admin_post_type( $id = 0 ) {
163
-    if ( !$id ) {
162
+function wpinv_admin_post_type($id = 0) {
163
+    if (!$id) {
164 164
         $id = wpinv_admin_post_id();
165 165
     }
166 166
     
167
-    $type = get_post_type( $id );
167
+    $type = get_post_type($id);
168 168
     
169
-    if ( !$type ) {
170
-        $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null;
169
+    if (!$type) {
170
+        $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null;
171 171
     }
172 172
     
173
-    return apply_filters( 'wpinv_admin_post_type', $type, $id );
173
+    return apply_filters('wpinv_admin_post_type', $type, $id);
174 174
 }
175 175
 
176 176
 function wpinv_admin_messages() {
177 177
 	global $wpinv_options, $pagenow, $post;
178 178
 
179
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
180
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
179
+	if (isset($_GET['wpinv-message']) && 'discount_added' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
180
+		 add_settings_error('wpinv-notices', 'wpinv-discount-added', __('Discount code added.', 'invoicing'), 'updated');
181 181
 	}
182 182
 
183
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
184
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
183
+	if (isset($_GET['wpinv-message']) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
184
+		add_settings_error('wpinv-notices', 'wpinv-discount-add-fail', __('There was a problem adding your discount code, please try again.', 'invoicing'), 'error');
185 185
 	}
186 186
 
187
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
188
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
187
+	if (isset($_GET['wpinv-message']) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
188
+		add_settings_error('wpinv-notices', 'wpinv-discount-exists', __('A discount with that code already exists, please use a different code.', 'invoicing'), 'error');
189 189
 	}
190 190
 
191
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
192
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
191
+	if (isset($_GET['wpinv-message']) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
192
+		 add_settings_error('wpinv-notices', 'wpinv-discount-updated', __('Discount code updated.', 'invoicing'), 'updated');
193 193
 	}
194 194
 
195
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
196
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
195
+	if (isset($_GET['wpinv-message']) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
196
+		add_settings_error('wpinv-notices', 'wpinv-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'invoicing'), 'error');
197 197
 	}
198 198
 
199
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
200
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
199
+	if (isset($_GET['wpinv-message']) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
200
+		add_settings_error('wpinv-notices', 'wpinv-deleted', __('The invoice has been deleted.', 'invoicing'), 'updated');
201 201
 	}
202 202
 
203
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
204
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
203
+	if (isset($_GET['wpinv-message']) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
204
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Email notification is disabled. Please check settings.', 'invoicing'), 'error');
205 205
 	}
206 206
 
207
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
208
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
207
+	if (isset($_GET['wpinv-message']) && 'email_sent' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
208
+		add_settings_error('wpinv-notices', 'wpinv-sent', __('The email has been sent to customer.', 'invoicing'), 'updated');
209 209
     }
210 210
     
211
-    if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
212
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
211
+    if (isset($_GET['wpinv-message']) && 'email_fail' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
212
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Fail to send email to the customer.', 'invoicing'), 'error');
213 213
     }
214 214
 
215
-    if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
216
-        add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
215
+    if (isset($_GET['wpinv-message']) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
216
+        add_settings_error('wpinv-notices', 'wpinv-note-deleted', __('The invoice note has been deleted.', 'invoicing'), 'updated');
217 217
     }
218 218
 
219
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
220
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
219
+	if (isset($_GET['wpinv-message']) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
220
+		add_settings_error('wpinv-notices', 'wpinv-settings-imported', __('The settings have been imported.', 'invoicing'), 'updated');
221 221
 	}
222 222
 
223
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
224
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
223
+	if (isset($_GET['wpinv-message']) && 'note-added' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
224
+		add_settings_error('wpinv-notices', 'wpinv-note-added', __('The invoice note has been added successfully.', 'invoicing'), 'updated');
225 225
 	}
226 226
 
227
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
228
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
227
+	if (isset($_GET['wpinv-message']) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can('manage_options')) {
228
+		add_settings_error('wpinv-notices', 'wpinv-updated', __('The invoice has been successfully updated.', 'invoicing'), 'updated');
229 229
 	}
230 230
     
231
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
232
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
231
+	if ($pagenow == 'post.php' && !empty($post->post_type) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable($post)) {
232
+		$message = apply_filters('wpinv_item_non_editable_message', __('This item in not editable.', 'invoicing'), $post->ID);
233 233
 
234
-		if ( !empty( $message ) ) {
235
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
234
+		if (!empty($message)) {
235
+			add_settings_error('wpinv-notices', 'wpinv-edit-n', $message, 'updated');
236 236
 		}
237 237
 	}
238 238
 
239
-	settings_errors( 'wpinv-notices' );
239
+	settings_errors('wpinv-notices');
240 240
 }
241
-add_action( 'admin_notices', 'wpinv_admin_messages' );
241
+add_action('admin_notices', 'wpinv_admin_messages');
242 242
 
243
-add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' );
244
-function wpinv_show_test_payment_gateway_notice(){
245
-    add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' );
243
+add_action('admin_init', 'wpinv_show_test_payment_gateway_notice');
244
+function wpinv_show_test_payment_gateway_notice() {
245
+    add_action('admin_notices', 'wpinv_test_payment_gateway_messages');
246 246
 }
247 247
 
248
-function wpinv_test_payment_gateway_messages(){
248
+function wpinv_test_payment_gateway_messages() {
249 249
     $gateways = wpinv_get_enabled_payment_gateways();
250 250
     $name = array(); $test_gateways = '';
251 251
     if ($gateways) {
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
         }
257 257
         $test_gateways = implode(', ', $name);
258 258
     }
259
-    if(isset($test_gateways) && !empty($test_gateways)){
259
+    if (isset($test_gateways) && !empty($test_gateways)) {
260 260
         $link = admin_url('admin.php?page=wpinv-settings&tab=gateways');
261
-        $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link );
261
+        $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link);
262 262
         ?>
263 263
         <div class="notice notice-warning is-dismissible">
264 264
             <p><?php echo $notice; ?></p>
@@ -267,29 +267,29 @@  discard block
 block discarded – undo
267 267
     }
268 268
 }
269 269
 
270
-function wpinv_items_columns( $existing_columns ) {
270
+function wpinv_items_columns($existing_columns) {
271 271
     global $wpinv_euvat;
272 272
     
273 273
     $columns                = array();
274 274
     $columns['cb']          = $existing_columns['cb'];
275
-    $columns['title']       = __( 'Title', 'invoicing' );
276
-    $columns['price']       = __( 'Price', 'invoicing' );
277
-    if ( $wpinv_euvat->allow_vat_rules() ) {
278
-        $columns['vat_rule']    = __( 'VAT rule type', 'invoicing' );
275
+    $columns['title']       = __('Title', 'invoicing');
276
+    $columns['price']       = __('Price', 'invoicing');
277
+    if ($wpinv_euvat->allow_vat_rules()) {
278
+        $columns['vat_rule']    = __('VAT rule type', 'invoicing');
279 279
     }
280
-    if ( $wpinv_euvat->allow_vat_classes() ) {
281
-        $columns['vat_class']   = __( 'VAT class', 'invoicing' );
280
+    if ($wpinv_euvat->allow_vat_classes()) {
281
+        $columns['vat_class']   = __('VAT class', 'invoicing');
282 282
     }
283
-    $columns['type']        = __( 'Type', 'invoicing' );
284
-    $columns['recurring']   = __( 'Recurring', 'invoicing' );
285
-    $columns['date']        = __( 'Date', 'invoicing' );
286
-    $columns['id']          = __( 'ID', 'invoicing' );
283
+    $columns['type']        = __('Type', 'invoicing');
284
+    $columns['recurring']   = __('Recurring', 'invoicing');
285
+    $columns['date']        = __('Date', 'invoicing');
286
+    $columns['id']          = __('ID', 'invoicing');
287 287
 
288
-    return apply_filters( 'wpinv_items_columns', $columns );
288
+    return apply_filters('wpinv_items_columns', $columns);
289 289
 }
290
-add_filter( 'manage_wpi_item_posts_columns', 'wpinv_items_columns' );
290
+add_filter('manage_wpi_item_posts_columns', 'wpinv_items_columns');
291 291
 
292
-function wpinv_items_sortable_columns( $columns ) {
292
+function wpinv_items_sortable_columns($columns) {
293 293
     $columns['price']       = 'price';
294 294
     $columns['vat_rule']    = 'vat_rule';
295 295
     $columns['vat_class']   = 'vat_class';
@@ -299,151 +299,151 @@  discard block
 block discarded – undo
299 299
 
300 300
     return $columns;
301 301
 }
302
-add_filter( 'manage_edit-wpi_item_sortable_columns', 'wpinv_items_sortable_columns' );
302
+add_filter('manage_edit-wpi_item_sortable_columns', 'wpinv_items_sortable_columns');
303 303
 
304
-function wpinv_items_table_custom_column( $column ) {
304
+function wpinv_items_table_custom_column($column) {
305 305
     global $wpinv_euvat, $post, $wpi_item;
306 306
     
307
-    if ( empty( $wpi_item ) || ( !empty( $wpi_item ) && $post->ID != $wpi_item->ID ) ) {
308
-        $wpi_item = new WPInv_Item( $post->ID );
307
+    if (empty($wpi_item) || (!empty($wpi_item) && $post->ID != $wpi_item->ID)) {
308
+        $wpi_item = new WPInv_Item($post->ID);
309 309
     }
310 310
 
311
-    switch ( $column ) {
311
+    switch ($column) {
312 312
         case 'price' :
313
-            echo wpinv_item_price( $post->ID );
313
+            echo wpinv_item_price($post->ID);
314 314
         break;
315 315
         case 'vat_rule' :
316
-            echo $wpinv_euvat->item_rule_label( $post->ID );
316
+            echo $wpinv_euvat->item_rule_label($post->ID);
317 317
         break;
318 318
         case 'vat_class' :
319
-            echo $wpinv_euvat->item_class_label( $post->ID );
319
+            echo $wpinv_euvat->item_class_label($post->ID);
320 320
         break;
321 321
         case 'type' :
322
-            echo wpinv_item_type( $post->ID ) . '<span class="meta">' . $wpi_item->get_custom_singular_name() . '</span>';
322
+            echo wpinv_item_type($post->ID) . '<span class="meta">' . $wpi_item->get_custom_singular_name() . '</span>';
323 323
         break;
324 324
         case 'recurring' :
325
-            echo ( wpinv_is_recurring_item( $post->ID ) ? '<i class="fa fa-check fa-recurring-y"></i>' : '<i class="fa fa-close fa-recurring-n"></i>' );
325
+            echo (wpinv_is_recurring_item($post->ID) ? '<i class="fa fa-check fa-recurring-y"></i>' : '<i class="fa fa-close fa-recurring-n"></i>');
326 326
         break;
327 327
         case 'id' :
328 328
            echo $post->ID;
329 329
            echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '">
330
-                    <div class="price">' . wpinv_get_item_price( $post->ID ) . '</div>';
331
-                    if ( $wpinv_euvat->allow_vat_rules() ) {
332
-                        echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule( $post->ID ) . '</div>';
330
+                    <div class="price">' . wpinv_get_item_price($post->ID) . '</div>';
331
+                    if ($wpinv_euvat->allow_vat_rules()) {
332
+                        echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule($post->ID) . '</div>';
333 333
                     }
334
-                    if ( $wpinv_euvat->allow_vat_classes() ) {
335
-                        echo '<div class="vat_class">' . $wpinv_euvat->get_item_class( $post->ID ) . '</div>';
334
+                    if ($wpinv_euvat->allow_vat_classes()) {
335
+                        echo '<div class="vat_class">' . $wpinv_euvat->get_item_class($post->ID) . '</div>';
336 336
                     }
337
-                    echo '<div class="type">' . wpinv_get_item_type( $post->ID ) . '</div>
337
+                    echo '<div class="type">' . wpinv_get_item_type($post->ID) . '</div>
338 338
                 </div>';
339 339
         break;
340 340
     }
341 341
     
342
-    do_action( 'wpinv_items_table_column_item_' . $column, $wpi_item, $post );
342
+    do_action('wpinv_items_table_column_item_' . $column, $wpi_item, $post);
343 343
 }
344
-add_action( 'manage_wpi_item_posts_custom_column', 'wpinv_items_table_custom_column' );
344
+add_action('manage_wpi_item_posts_custom_column', 'wpinv_items_table_custom_column');
345 345
 
346 346
 function wpinv_add_items_filters() {
347 347
     global $wpinv_euvat, $typenow;
348 348
 
349 349
     // Checks if the current post type is 'item'
350
-    if ( $typenow == 'wpi_item') {
351
-        if ( $wpinv_euvat->allow_vat_rules() ) {
352
-            echo wpinv_html_select( array(
353
-                    'options'          => array_merge( array( '' => __( 'All VAT rules', 'invoicing' ) ), $wpinv_euvat->get_rules() ),
350
+    if ($typenow == 'wpi_item') {
351
+        if ($wpinv_euvat->allow_vat_rules()) {
352
+            echo wpinv_html_select(array(
353
+                    'options'          => array_merge(array('' => __('All VAT rules', 'invoicing')), $wpinv_euvat->get_rules()),
354 354
                     'name'             => 'vat_rule',
355 355
                     'id'               => 'vat_rule',
356
-                    'selected'         => ( isset( $_GET['vat_rule'] ) ? $_GET['vat_rule'] : '' ),
356
+                    'selected'         => (isset($_GET['vat_rule']) ? $_GET['vat_rule'] : ''),
357 357
                     'show_option_all'  => false,
358 358
                     'show_option_none' => false,
359 359
                     'class'            => 'gdmbx2-text-medium',
360
-                ) );
360
+                ));
361 361
         }
362 362
         
363
-        if ( $wpinv_euvat->allow_vat_classes() ) {
364
-            echo wpinv_html_select( array(
365
-                    'options'          => array_merge( array( '' => __( 'All VAT classes', 'invoicing' ) ), $wpinv_euvat->get_all_classes() ),
363
+        if ($wpinv_euvat->allow_vat_classes()) {
364
+            echo wpinv_html_select(array(
365
+                    'options'          => array_merge(array('' => __('All VAT classes', 'invoicing')), $wpinv_euvat->get_all_classes()),
366 366
                     'name'             => 'vat_class',
367 367
                     'id'               => 'vat_class',
368
-                    'selected'         => ( isset( $_GET['vat_class'] ) ? $_GET['vat_class'] : '' ),
368
+                    'selected'         => (isset($_GET['vat_class']) ? $_GET['vat_class'] : ''),
369 369
                     'show_option_all'  => false,
370 370
                     'show_option_none' => false,
371 371
                     'class'            => 'gdmbx2-text-medium',
372
-                ) );
372
+                ));
373 373
         }
374 374
             
375
-        echo wpinv_html_select( array(
376
-                'options'          => array_merge( array( '' => __( 'All item types', 'invoicing' ) ), wpinv_get_item_types() ),
375
+        echo wpinv_html_select(array(
376
+                'options'          => array_merge(array('' => __('All item types', 'invoicing')), wpinv_get_item_types()),
377 377
                 'name'             => 'type',
378 378
                 'id'               => 'type',
379
-                'selected'         => ( isset( $_GET['type'] ) ? $_GET['type'] : '' ),
379
+                'selected'         => (isset($_GET['type']) ? $_GET['type'] : ''),
380 380
                 'show_option_all'  => false,
381 381
                 'show_option_none' => false,
382 382
                 'class'            => 'gdmbx2-text-medium',
383
-            ) );
383
+            ));
384 384
 
385
-        if ( isset( $_REQUEST['all_posts'] ) && '1' === $_REQUEST['all_posts'] ) {
385
+        if (isset($_REQUEST['all_posts']) && '1' === $_REQUEST['all_posts']) {
386 386
             echo '<input type="hidden" name="all_posts" value="1" />';
387 387
         }
388 388
     }
389 389
 }
390
-add_action( 'restrict_manage_posts', 'wpinv_add_items_filters', 100 );
390
+add_action('restrict_manage_posts', 'wpinv_add_items_filters', 100);
391 391
 
392
-function wpinv_send_invoice_after_save( $invoice ) {
393
-    if ( empty( $_POST['wpi_save_send'] ) ) {
392
+function wpinv_send_invoice_after_save($invoice) {
393
+    if (empty($_POST['wpi_save_send'])) {
394 394
         return;
395 395
     }
396 396
     
397
-    if ( !empty( $invoice->ID ) && !empty( $invoice->post_type ) && 'wpi_invoice' == $invoice->post_type ) {
398
-        wpinv_user_invoice_notification( $invoice->ID );
397
+    if (!empty($invoice->ID) && !empty($invoice->post_type) && 'wpi_invoice' == $invoice->post_type) {
398
+        wpinv_user_invoice_notification($invoice->ID);
399 399
     }
400 400
 }
401
-add_action( 'wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1 );
401
+add_action('wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1);
402 402
 
403
-function wpinv_send_register_new_user( $data, $postarr ) {
404
-    if ( current_user_can( 'manage_options' ) && !empty( $data['post_type'] ) && ( 'wpi_invoice' == $data['post_type'] || 'wpi_quote' == $data['post_type'] ) ) {
405
-        $is_new_user = !empty( $postarr['wpinv_new_user'] ) ? true : false;
406
-        $email = !empty( $postarr['wpinv_email'] ) && $postarr['wpinv_email'] && is_email( $postarr['wpinv_email'] ) ? $postarr['wpinv_email'] : NULL;
403
+function wpinv_send_register_new_user($data, $postarr) {
404
+    if (current_user_can('manage_options') && !empty($data['post_type']) && ('wpi_invoice' == $data['post_type'] || 'wpi_quote' == $data['post_type'])) {
405
+        $is_new_user = !empty($postarr['wpinv_new_user']) ? true : false;
406
+        $email = !empty($postarr['wpinv_email']) && $postarr['wpinv_email'] && is_email($postarr['wpinv_email']) ? $postarr['wpinv_email'] : NULL;
407 407
         
408
-        if ( $is_new_user && $email && !email_exists( $email ) ) {
409
-            $first_name = !empty( $postarr['wpinv_first_name'] ) ? sanitize_text_field( $postarr['wpinv_first_name'] ) : '';
410
-            $last_name = !empty( $postarr['wpinv_last_name'] ) ? sanitize_text_field( $postarr['wpinv_last_name'] ) : '';
411
-            $display_name = $first_name || $last_name ? trim( $first_name . ' ' . $last_name ) : '';
412
-            $user_nicename = $display_name ? trim( $display_name ) : $email;
413
-            $user_company = !empty( $postarr['wpinv_company'] ) ? sanitize_text_field( $postarr['wpinv_company'] ) : '';
408
+        if ($is_new_user && $email && !email_exists($email)) {
409
+            $first_name = !empty($postarr['wpinv_first_name']) ? sanitize_text_field($postarr['wpinv_first_name']) : '';
410
+            $last_name = !empty($postarr['wpinv_last_name']) ? sanitize_text_field($postarr['wpinv_last_name']) : '';
411
+            $display_name = $first_name || $last_name ? trim($first_name . ' ' . $last_name) : '';
412
+            $user_nicename = $display_name ? trim($display_name) : $email;
413
+            $user_company = !empty($postarr['wpinv_company']) ? sanitize_text_field($postarr['wpinv_company']) : '';
414 414
             
415
-            $user_login = sanitize_user( str_replace( ' ', '', $display_name ), true );
416
-            if ( !( validate_username( $user_login ) && !username_exists( $user_login ) ) ) {
415
+            $user_login = sanitize_user(str_replace(' ', '', $display_name), true);
416
+            if (!(validate_username($user_login) && !username_exists($user_login))) {
417 417
                 $new_user_login = strstr($email, '@', true);
418
-                if ( validate_username( $user_login ) && username_exists( $user_login ) ) {
419
-                    $user_login = sanitize_user($new_user_login, true );
418
+                if (validate_username($user_login) && username_exists($user_login)) {
419
+                    $user_login = sanitize_user($new_user_login, true);
420 420
                 }
421
-                if ( validate_username( $user_login ) && username_exists( $user_login ) ) {
422
-                    $user_append_text = rand(10,1000);
423
-                    $user_login = sanitize_user($new_user_login.$user_append_text, true );
421
+                if (validate_username($user_login) && username_exists($user_login)) {
422
+                    $user_append_text = rand(10, 1000);
423
+                    $user_login = sanitize_user($new_user_login . $user_append_text, true);
424 424
                 }
425 425
                 
426
-                if ( !( validate_username( $user_login ) && !username_exists( $user_login ) ) ) {
426
+                if (!(validate_username($user_login) && !username_exists($user_login))) {
427 427
                     $user_login = $email;
428 428
                 }
429 429
             }
430 430
             
431 431
             $userdata = array(
432 432
                 'user_login' => $user_login,
433
-                'user_pass' => wp_generate_password( 12, false ),
434
-                'user_email' => sanitize_text_field( $email ),
433
+                'user_pass' => wp_generate_password(12, false),
434
+                'user_email' => sanitize_text_field($email),
435 435
                 'first_name' => $first_name,
436 436
                 'last_name' => $last_name,
437
-                'user_nicename' => wpinv_utf8_substr( $user_nicename, 0, 50 ),
437
+                'user_nicename' => wpinv_utf8_substr($user_nicename, 0, 50),
438 438
                 'nickname' => $display_name,
439 439
                 'display_name' => $display_name,
440 440
             );
441 441
 
442
-            $userdata = apply_filters( 'wpinv_register_new_user_data', $userdata );
442
+            $userdata = apply_filters('wpinv_register_new_user_data', $userdata);
443 443
             
444
-            $new_user_id = wp_insert_user( $userdata );
444
+            $new_user_id = wp_insert_user($userdata);
445 445
             
446
-            if ( !is_wp_error( $new_user_id ) ) {
446
+            if (!is_wp_error($new_user_id)) {
447 447
                 $data['post_author'] = $new_user_id;
448 448
                 $_POST['post_author'] = $new_user_id;
449 449
                 $_POST['post_author_override'] = $new_user_id;
@@ -464,72 +464,72 @@  discard block
 block discarded – undo
464 464
                 
465 465
                 $meta = array();
466 466
                 ///$meta['_wpinv_user_id'] = $new_user_id;
467
-                foreach ( $meta_fields as $field ) {
468
-                    $meta['_wpinv_' . $field] = isset( $postarr['wpinv_' . $field] ) ? sanitize_text_field( $postarr['wpinv_' . $field] ) : '';
467
+                foreach ($meta_fields as $field) {
468
+                    $meta['_wpinv_' . $field] = isset($postarr['wpinv_' . $field]) ? sanitize_text_field($postarr['wpinv_' . $field]) : '';
469 469
                 }
470 470
                 
471
-                $meta = apply_filters( 'wpinv_register_new_user_meta', $meta, $new_user_id );
471
+                $meta = apply_filters('wpinv_register_new_user_meta', $meta, $new_user_id);
472 472
 
473 473
                 // Update user meta.
474
-                foreach ( $meta as $key => $value ) {
475
-                    update_user_meta( $new_user_id, $key, $value );
474
+                foreach ($meta as $key => $value) {
475
+                    update_user_meta($new_user_id, $key, $value);
476 476
                 }
477 477
                 
478
-                if ( function_exists( 'wp_send_new_user_notifications' ) ) {
478
+                if (function_exists('wp_send_new_user_notifications')) {
479 479
                     // Send email notifications related to the creation of new user.
480
-                    wp_send_new_user_notifications( $new_user_id, 'user' );
480
+                    wp_send_new_user_notifications($new_user_id, 'user');
481 481
                 }
482 482
             } else {
483
-                wpinv_error_log( $new_user_id->get_error_message(), 'Invoice add new user', __FILE__, __LINE__ );
483
+                wpinv_error_log($new_user_id->get_error_message(), 'Invoice add new user', __FILE__, __LINE__);
484 484
             }
485 485
         }
486 486
     }
487 487
     
488 488
     return $data;
489 489
 }
490
-add_filter( 'wp_insert_post_data', 'wpinv_send_register_new_user', 10, 2 );
490
+add_filter('wp_insert_post_data', 'wpinv_send_register_new_user', 10, 2);
491 491
 
492
-function wpinv_show_recurring_supported_gateways( $item_ID ) {
492
+function wpinv_show_recurring_supported_gateways($item_ID) {
493 493
     $all_gateways = wpinv_get_payment_gateways();
494 494
 
495
-    if ( !empty( $all_gateways ) ) {
495
+    if (!empty($all_gateways)) {
496 496
         $gateways = array();
497 497
 
498
-        foreach ( $all_gateways as $key => $gateway ) {
499
-            if ( wpinv_gateway_support_subscription( $key ) ) {
498
+        foreach ($all_gateways as $key => $gateway) {
499
+            if (wpinv_gateway_support_subscription($key)) {
500 500
                 $gateways[] = $gateway['admin_label'];
501 501
             }
502 502
         }
503 503
 
504
-        if ( !empty( $gateways ) ) {
504
+        if (!empty($gateways)) {
505 505
             ?>
506
-            <span class="description"><?php echo wp_sprintf( __( 'Recurring payments only supported by: %s', 'invoicing' ), implode( ', ', $gateways ) ); ?></span>
506
+            <span class="description"><?php echo wp_sprintf(__('Recurring payments only supported by: %s', 'invoicing'), implode(', ', $gateways)); ?></span>
507 507
             <?php
508 508
         }
509 509
     }
510 510
 }
511
-add_action( 'wpinv_item_price_field', 'wpinv_show_recurring_supported_gateways', -10, 1 );
511
+add_action('wpinv_item_price_field', 'wpinv_show_recurring_supported_gateways', -10, 1);
512 512
 
513
-function wpinv_post_updated_messages( $messages ) {
513
+function wpinv_post_updated_messages($messages) {
514 514
     global $post, $post_ID;
515 515
 
516 516
     $messages['wpi_discount'] = array(
517 517
         0   => '',
518
-        1   => __( 'Discount updated.', 'invoicing' ),
519
-        2   => __( 'Custom field updated.', 'invoicing' ),
520
-        3   => __( 'Custom field deleted.', 'invoicing' ),
521
-        4   => __( 'Discount updated.', 'invoicing' ),
522
-        5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
523
-        6   => __( 'Discount updated.', 'invoicing' ),
524
-        7   => __( 'Discount saved.', 'invoicing' ),
525
-        8   => __( 'Discount submitted.', 'invoicing' ),
526
-        9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
527
-        10  => __( 'Discount draft updated.', 'invoicing' ),
518
+        1   => __('Discount updated.', 'invoicing'),
519
+        2   => __('Custom field updated.', 'invoicing'),
520
+        3   => __('Custom field deleted.', 'invoicing'),
521
+        4   => __('Discount updated.', 'invoicing'),
522
+        5   => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int)$_GET['revision'], false)) : false,
523
+        6   => __('Discount updated.', 'invoicing'),
524
+        7   => __('Discount saved.', 'invoicing'),
525
+        8   => __('Discount submitted.', 'invoicing'),
526
+        9   => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
527
+        10  => __('Discount draft updated.', 'invoicing'),
528 528
     );
529 529
 
530 530
     return $messages;
531 531
 }
532
-add_filter( 'post_updated_messages', 'wpinv_post_updated_messages', 10, 1 );
532
+add_filter('post_updated_messages', 'wpinv_post_updated_messages', 10, 1);
533 533
 
534 534
 add_action('admin_init', 'admin_init_example_type');
535 535
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 function admin_init_example_type() {
540 540
     global $typenow;
541 541
 
542
-    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) {
542
+    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') {
543 543
         add_filter('posts_search', 'posts_search_example_type', 10, 2);
544 544
     }
545 545
 }
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
     global $wpdb;
555 555
 
556 556
     if ($query->is_main_query() && !empty($query->query['s'])) {
557
-        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )";
558
-        if ( ! empty( $search ) ) {
559
-            $search = preg_replace( '/^ AND /', '', $search );
557
+        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )";
558
+        if (!empty($search)) {
559
+            $search = preg_replace('/^ AND /', '', $search);
560 560
             $search = " AND ( {$search} OR ( {$conditions_str} ) )";
561 561
         } else {
562 562
             $search = " AND ( {$conditions_str} )";
@@ -566,9 +566,9 @@  discard block
 block discarded – undo
566 566
     return $search;
567 567
 }
568 568
 
569
-add_action( 'admin_init', 'wpinv_reset_invoice_count' );
570
-function wpinv_reset_invoice_count(){
571
-    if(isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
569
+add_action('admin_init', 'wpinv_reset_invoice_count');
570
+function wpinv_reset_invoice_count() {
571
+    if (isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
572 572
         wpinv_update_option('invoice_sequence_start', 1);
573 573
         delete_option('wpinv_last_invoice_number');
574 574
         $url = add_query_arg(array('reset_invoice_done' => 1));
@@ -579,8 +579,8 @@  discard block
 block discarded – undo
579 579
 }
580 580
 
581 581
 add_action('admin_notices', 'wpinv_invoice_count_reset_message');
582
-function wpinv_invoice_count_reset_message(){
583
-    if(isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
582
+function wpinv_invoice_count_reset_message() {
583
+    if (isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
584 584
         $notice = __('Invoice number sequence reset successfully.', 'invoicing');
585 585
         ?>
586 586
         <div class="notice notice-success is-dismissible">
Please login to merge, or discard this patch.