Passed
Push — master ( d61518...77758e )
by Brian
04:26
created
vendor/composer/installed.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,90 +1,90 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'root' => 
3
-  array (
3
+  array(
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
7
-    array (
7
+    array(
8 8
     ),
9 9
     'reference' => '4b094a9228b10d14ba32d30d478a694ed5bf34eb',
10 10
     'name' => 'ayecode/invoicing',
11 11
   ),
12 12
   'versions' => 
13
-  array (
13
+  array(
14 14
     'ayecode/ayecode-connect-helper' => 
15
-    array (
15
+    array(
16 16
       'pretty_version' => '1.0.3',
17 17
       'version' => '1.0.3.0',
18 18
       'aliases' => 
19
-      array (
19
+      array(
20 20
       ),
21 21
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24
-    array (
24
+    array(
25 25
       'pretty_version' => 'dev-master',
26 26
       'version' => 'dev-master',
27 27
       'aliases' => 
28
-      array (
28
+      array(
29 29
       ),
30 30
       'reference' => '4b094a9228b10d14ba32d30d478a694ed5bf34eb',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.41',
35 35
       'version' => '0.1.41.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => '5646d3060999d75b74c0d723e44fe84fce9d2a4b',
40 40
     ),
41 41
     'ayecode/wp-font-awesome-settings' => 
42
-    array (
42
+    array(
43 43
       'pretty_version' => '1.0.12',
44 44
       'version' => '1.0.12.0',
45 45
       'aliases' => 
46
-      array (
46
+      array(
47 47
       ),
48 48
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
49 49
     ),
50 50
     'ayecode/wp-super-duper' => 
51
-    array (
51
+    array(
52 52
       'pretty_version' => '1.0.23',
53 53
       'version' => '1.0.23.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => '9473c0b7cf3ef4c32374222994a3e4613cdaeb48',
58 58
     ),
59 59
     'composer/installers' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => 'v1.10.0',
62 62
       'version' => '1.10.0.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d',
67 67
     ),
68 68
     'maxmind-db/reader' => 
69
-    array (
69
+    array(
70 70
       'pretty_version' => 'v1.6.0',
71 71
       'version' => '1.6.0.0',
72 72
       'aliases' => 
73
-      array (
73
+      array(
74 74
       ),
75 75
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
76 76
     ),
77 77
     'roundcube/plugin-installer' => 
78
-    array (
78
+    array(
79 79
       'replaced' => 
80
-      array (
80
+      array(
81 81
         0 => '*',
82 82
       ),
83 83
     ),
84 84
     'shama/baton' => 
85
-    array (
85
+    array(
86 86
       'replaced' => 
87
-      array (
87
+      array(
88 88
         0 => '*',
89 89
       ),
90 90
     ),
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.41";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-helper.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return string
21 21
 	 */
22
-	public static function name($text,$multiple = false){
22
+	public static function name($text, $multiple = false) {
23 23
 		$output = '';
24 24
 
25
-		if($text){
26
-			$is_multiple = strpos($text, '[') === false && $multiple  ? '[]' : '';
27
-			$output = ' name="'.esc_attr($text).$is_multiple.'" ';
25
+		if ($text) {
26
+			$is_multiple = strpos($text, '[') === false && $multiple ? '[]' : '';
27
+			$output = ' name="' . esc_attr($text) . $is_multiple . '" ';
28 28
 		}
29 29
 
30 30
 		return $output;
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return string The sanitized item.
39 39
 	 */
40
-	public static function id($text){
40
+	public static function id($text) {
41 41
 		$output = '';
42 42
 
43
-		if($text){
44
-			$output = ' id="'.sanitize_html_class($text).'" ';
43
+		if ($text) {
44
+			$output = ' id="' . sanitize_html_class($text) . '" ';
45 45
 		}
46 46
 
47 47
 		return $output;
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return string The sanitized item.
56 56
 	 */
57
-	public static function title($text){
57
+	public static function title($text) {
58 58
 		$output = '';
59 59
 
60
-		if($text){
61
-			$output = ' title="'.esc_attr($text).'" ';
60
+		if ($text) {
61
+			$output = ' title="' . esc_attr($text) . '" ';
62 62
 		}
63 63
 
64 64
 		return $output;
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return string The sanitized item.
73 73
 	 */
74
-	public static function value($text){
74
+	public static function value($text) {
75 75
 		$output = '';
76 76
 
77
-		if($text){
78
-			$output = ' value="'.sanitize_text_field($text).'" ';
77
+		if ($text) {
78
+			$output = ' value="' . sanitize_text_field($text) . '" ';
79 79
 		}
80 80
 
81 81
 		return $output;
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return string The sanitized item.
90 90
 	 */
91
-	public static function class_attr($text){
91
+	public static function class_attr($text) {
92 92
 		$output = '';
93 93
 
94
-		if($text){
94
+		if ($text) {
95 95
 			$classes = self::esc_classes($text);
96
-			if(!empty($classes)){
97
-				$output = ' class="'.$classes.'" ';
96
+			if (!empty($classes)) {
97
+				$output = ' class="' . $classes . '" ';
98 98
 			}
99 99
 		}
100 100
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return string
110 110
 	 */
111
-	public static function esc_classes($text){
111
+	public static function esc_classes($text) {
112 112
 		$output = '';
113 113
 
114
-		if($text){
115
-			$classes = explode(" ",$text);
116
-			$classes = array_map("trim",$classes);
117
-			$classes = array_map("sanitize_html_class",$classes);
118
-			if(!empty($classes)){
119
-				$output = implode(" ",$classes);
114
+		if ($text) {
115
+			$classes = explode(" ", $text);
116
+			$classes = array_map("trim", $classes);
117
+			$classes = array_map("sanitize_html_class", $classes);
118
+			if (!empty($classes)) {
119
+				$output = implode(" ", $classes);
120 120
 			}
121 121
 		}
122 122
 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string
131 131
 	 */
132
-	public static function data_attributes($args){
132
+	public static function data_attributes($args) {
133 133
 		$output = '';
134 134
 
135
-		if(!empty($args)){
135
+		if (!empty($args)) {
136 136
 
137
-			foreach($args as $key => $val){
138
-				if(substr( $key, 0, 5 ) === "data-"){
139
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
137
+			foreach ($args as $key => $val) {
138
+				if (substr($key, 0, 5) === "data-") {
139
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
140 140
 				}
141 141
 			}
142 142
 		}
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return string
151 151
 	 */
152
-	public static function aria_attributes($args){
152
+	public static function aria_attributes($args) {
153 153
 		$output = '';
154 154
 
155
-		if(!empty($args)){
155
+		if (!empty($args)) {
156 156
 
157
-			foreach($args as $key => $val){
158
-				if(substr( $key, 0, 5 ) === "aria-"){
159
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
157
+			foreach ($args as $key => $val) {
158
+				if (substr($key, 0, 5) === "aria-") {
159
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
160 160
 				}
161 161
 			}
162 162
 		}
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return string
175 175
 	 */
176
-	public static function icon($class,$space_after = false, $extra_attributes = array()){
176
+	public static function icon($class, $space_after = false, $extra_attributes = array()) {
177 177
 		$output = '';
178 178
 
179
-		if($class){
179
+		if ($class) {
180 180
 			$classes = self::esc_classes($class);
181
-			if(!empty($classes)){
182
-				$output = '<i class="'.$classes.'" ';
181
+			if (!empty($classes)) {
182
+				$output = '<i class="' . $classes . '" ';
183 183
 				// extra attributes
184
-				if(!empty($extra_attributes)){
184
+				if (!empty($extra_attributes)) {
185 185
 					$output .= AUI_Component_Helper::extra_attributes($extra_attributes);
186 186
 				}
187 187
 				$output .= '></i>';
188
-				if($space_after){
188
+				if ($space_after) {
189 189
 					$output .= " ";
190 190
 				}
191 191
 			}
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string
201 201
 	 */
202
-	public static function extra_attributes($args){
202
+	public static function extra_attributes($args) {
203 203
 		$output = '';
204 204
 
205
-		if(!empty($args)){
205
+		if (!empty($args)) {
206 206
 
207
-			if( is_array($args) ){
208
-				foreach($args as $key => $val){
209
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
207
+			if (is_array($args)) {
208
+				foreach ($args as $key => $val) {
209
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
210 210
 				}
211
-			}else{
212
-				$output .= ' '.$args.' ';
211
+			} else {
212
+				$output .= ' ' . $args . ' ';
213 213
 			}
214 214
 
215 215
 		}
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return string
224 224
 	 */
225
-	public static function help_text($text){
225
+	public static function help_text($text) {
226 226
 		$output = '';
227 227
 
228
-		if($text){
229
-			$output .= '<small class="form-text text-muted">'.wp_kses_post($text).'</small>';
228
+		if ($text) {
229
+			$output .= '<small class="form-text text-muted">' . wp_kses_post($text) . '</small>';
230 230
 		}
231 231
 
232 232
 
@@ -240,18 +240,18 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return string|void
242 242
 	 */
243
-	public static function element_require( $input ) {
243
+	public static function element_require($input) {
244 244
 
245
-		$input = str_replace( "'", '"', $input );// we only want double quotes
245
+		$input = str_replace("'", '"', $input); // we only want double quotes
246 246
 
247
-		$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
247
+		$output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array(
248 248
 			"jQuery(form).find('[data-argument=\"",
249 249
 			"\"]').find('input,select,textarea').val()",
250 250
 			"\"]').find('input:checked').val()",
251
-		), $input ) );
251
+		), $input));
252 252
 
253
-		if($output){
254
-			$output = ' data-element-require="'.$output.'" ';
253
+		if ($output) {
254
+			$output = ' data-element-require="' . $output . '" ';
255 255
 		}
256 256
 
257 257
 		return $output;
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 	 * @param array $input Input.
269 269
 	 * @return array Array of allowed HTML tags and their allowed attributes.
270 270
 	 */
271
-	public static function kses_allowed_html( $context = 'post', $input = array() ) {
272
-		$allowed_html = wp_kses_allowed_html( $context );
271
+	public static function kses_allowed_html($context = 'post', $input = array()) {
272
+		$allowed_html = wp_kses_allowed_html($context);
273 273
 
274
-		if ( is_array( $allowed_html ) ) {
274
+		if (is_array($allowed_html)) {
275 275
 			// <iframe>
276
-			if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
277
-				$allowed_html['iframe']     = array(
276
+			if (!isset($allowed_html['iframe']) && $context == 'post') {
277
+				$allowed_html['iframe'] = array(
278 278
 					'class'        => true,
279 279
 					'id'           => true,
280 280
 					'src'          => true,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		 * @param @param string|array $context The context for which to retrieve tags.
303 303
 		 * @param array $input Input field.
304 304
 		 */
305
-		return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
305
+		return apply_filters('ayecode_ui_kses_allowed_html', $allowed_html, $context, $input);
306 306
 	}
307 307
 
308 308
 	/**
@@ -324,20 +324,20 @@  discard block
 block discarded – undo
324 324
 	 * @param array  $input       Input Field.
325 325
 	 * @return string Filtered content with only allowed HTML elements.
326 326
 	 */
327
-	public static function _sanitize_html_field( $value, $input = array() ) {
328
-		if ( $value === '' ) {
327
+	public static function _sanitize_html_field($value, $input = array()) {
328
+		if ($value === '') {
329 329
 			return $value;
330 330
 		}
331 331
 
332
-		$allowed_html = self::kses_allowed_html( 'post', $input );
332
+		$allowed_html = self::kses_allowed_html('post', $input);
333 333
 
334
-		if ( ! is_array( $allowed_html ) ) {
335
-			$allowed_html = wp_kses_allowed_html( 'post' );
334
+		if (!is_array($allowed_html)) {
335
+			$allowed_html = wp_kses_allowed_html('post');
336 336
 		}
337 337
 
338
-		$filtered = trim( wp_unslash( $value ) );
339
-		$filtered = wp_kses( $filtered, $allowed_html );
340
-		$filtered = balanceTags( $filtered ); // Balances tags
338
+		$filtered = trim(wp_unslash($value));
339
+		$filtered = wp_kses($filtered, $allowed_html);
340
+		$filtered = balanceTags($filtered); // Balances tags
341 341
 
342 342
 		return $filtered;
343 343
 	}
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
 	 * @param array  $input Input Field.
352 352
 	 * @return mixed Stripped value.
353 353
 	 */
354
-	public static function sanitize_html_field( $value, $input = array() ) {
354
+	public static function sanitize_html_field($value, $input = array()) {
355 355
 		$original = $value;
356 356
 
357
-		if ( is_array( $value ) ) {
358
-			foreach ( $value as $index => $item ) {
359
-				$value[ $index ] = self::_sanitize_html_field( $value, $input );
357
+		if (is_array($value)) {
358
+			foreach ($value as $index => $item) {
359
+				$value[$index] = self::_sanitize_html_field($value, $input);
360 360
 			}
361
-		} elseif ( is_object( $value ) ) {
362
-			$object_vars = get_object_vars( $value );
361
+		} elseif (is_object($value)) {
362
+			$object_vars = get_object_vars($value);
363 363
 
364
-			foreach ( $object_vars as $property_name => $property_value ) {
365
-				$value->$property_name = self::_sanitize_html_field( $property_value, $input );
364
+			foreach ($object_vars as $property_name => $property_value) {
365
+				$value->$property_name = self::_sanitize_html_field($property_value, $input);
366 366
 			}
367 367
 		} else {
368
-			$value = self::_sanitize_html_field( $value, $input );
368
+			$value = self::_sanitize_html_field($value, $input);
369 369
 		}
370 370
 
371 371
 		/**
@@ -377,6 +377,6 @@  discard block
 block discarded – undo
377 377
 		 * @param string|array $value Original content without filter.
378 378
 		 * @param array  $input       Input Field.
379 379
 		 */
380
-		return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
380
+		return apply_filters('ayecode_ui_sanitize_html_field', $value, $original, $input);
381 381
 	}
382 382
 }
383 383
\ No newline at end of file
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 1 patch
Spacing   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function input($args = array()){
21
+	public static function input($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'text',
24 24
 			'name'       => '',
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 		/**
53 53
 		 * Parse incoming $args into an array and merge it with $defaults
54 54
 		 */
55
-		$args   = wp_parse_args( $args, $defaults );
55
+		$args   = wp_parse_args($args, $defaults);
56 56
 		$output = '';
57
-		if ( ! empty( $args['type'] ) ) {
57
+		if (!empty($args['type'])) {
58 58
 			// hidden label option needs to be empty
59 59
 			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
60 60
 
61
-			$type = sanitize_html_class( $args['type'] );
61
+			$type = sanitize_html_class($args['type']);
62 62
 
63 63
 			$help_text = '';
64 64
 			$label = '';
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 			$label_args = array(
67 67
 				'title'=> $args['label'],
68 68
 				'for'=> $args['id'],
69
-				'class' => $args['label_class']." ",
69
+				'class' => $args['label_class'] . " ",
70 70
 				'label_type' => $args['label_type']
71 71
 			);
72 72
 
73 73
 			// floating labels need label after
74
-			if( $args['label_type'] == 'floating' && $type != 'checkbox' ){
74
+			if ($args['label_type'] == 'floating' && $type != 'checkbox') {
75 75
 				$label_after = true;
76 76
 				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
77 77
 			}
78 78
 
79 79
 			// Some special sauce for files
80
-			if($type=='file' ){
80
+			if ($type == 'file') {
81 81
 				$label_after = true; // if type file we need the label after
82 82
 				$args['class'] .= ' custom-file-input ';
83
-			}elseif($type=='checkbox'){
83
+			}elseif ($type == 'checkbox') {
84 84
 				$label_after = true; // if type file we need the label after
85 85
 				$args['class'] .= ' custom-control-input ';
86
-			}elseif($type=='datepicker' || $type=='timepicker'){
86
+			}elseif ($type == 'datepicker' || $type == 'timepicker') {
87 87
 				$type = 'text';
88 88
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
89 89
 				$args['class'] .= ' bg-initial ';
@@ -99,65 +99,65 @@  discard block
 block discarded – undo
99 99
 			$output .= '<input type="' . $type . '" ';
100 100
 
101 101
 			// name
102
-			if(!empty($args['name'])){
103
-				$output .= ' name="'.esc_attr($args['name']).'" ';
102
+			if (!empty($args['name'])) {
103
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
104 104
 			}
105 105
 
106 106
 			// id
107
-			if(!empty($args['id'])){
108
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
107
+			if (!empty($args['id'])) {
108
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
109 109
 			}
110 110
 
111 111
 			// placeholder
112
-			if(isset($args['placeholder']) && '' != $args['placeholder'] ){
113
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
112
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
113
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
114 114
 			}
115 115
 
116 116
 			// title
117
-			if(!empty($args['title'])){
118
-				$output .= ' title="'.esc_attr($args['title']).'" ';
117
+			if (!empty($args['title'])) {
118
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
119 119
 			}
120 120
 
121 121
 			// value
122
-			if(!empty($args['value'])){
123
-				$output .= ' value="'.sanitize_text_field($args['value']).'" ';
122
+			if (!empty($args['value'])) {
123
+				$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
124 124
 			}
125 125
 
126 126
 			// checked, for radio and checkboxes
127
-			if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
127
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
128 128
 				$output .= ' checked ';
129 129
 			}
130 130
 
131 131
 			// validation text
132
-			if(!empty($args['validation_text'])){
133
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
132
+			if (!empty($args['validation_text'])) {
133
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
134 134
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
135 135
 			}
136 136
 
137 137
 			// validation_pattern
138
-			if(!empty($args['validation_pattern'])){
139
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
138
+			if (!empty($args['validation_pattern'])) {
139
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
140 140
 			}
141 141
 
142 142
 			// step (for numbers)
143
-			if(!empty($args['step'])){
144
-				$output .= ' step="'.$args['step'].'" ';
143
+			if (!empty($args['step'])) {
144
+				$output .= ' step="' . $args['step'] . '" ';
145 145
 			}
146 146
 
147 147
 			// required
148
-			if(!empty($args['required'])){
148
+			if (!empty($args['required'])) {
149 149
 				$output .= ' required ';
150 150
 			}
151 151
 
152 152
 			// class
153
-			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
154
-			$output .= ' class="form-control '.$class.'" ';
153
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
154
+			$output .= ' class="form-control ' . $class . '" ';
155 155
 
156 156
 			// data-attributes
157 157
 			$output .= AUI_Component_Helper::data_attributes($args);
158 158
 
159 159
 			// extra attributes
160
-			if(!empty($args['extra_attributes'])){
160
+			if (!empty($args['extra_attributes'])) {
161 161
 				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
162 162
 			}
163 163
 
@@ -166,40 +166,40 @@  discard block
 block discarded – undo
166 166
 
167 167
 
168 168
 			// label
169
-			if(!empty($args['label'])){
170
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
171
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
172
-				$label = self::label( $label_args, $type );
169
+			if (!empty($args['label'])) {
170
+				if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; }
171
+				elseif ($type == 'checkbox') {$label_args['class'] .= 'custom-control-label'; }
172
+				$label = self::label($label_args, $type);
173 173
 			}
174 174
 
175 175
 			// help text
176
-			if(!empty($args['help_text'])){
176
+			if (!empty($args['help_text'])) {
177 177
 				$help_text = AUI_Component_Helper::help_text($args['help_text']);
178 178
 			}
179 179
 
180 180
 
181 181
 			// set help text in the correct possition
182
-			if($label_after){
182
+			if ($label_after) {
183 183
 				$output .= $label . $help_text;
184 184
 			}
185 185
 
186 186
 			// some input types need a separate wrap
187
-			if($type == 'file') {
188
-				$output = self::wrap( array(
187
+			if ($type == 'file') {
188
+				$output = self::wrap(array(
189 189
 					'content' => $output,
190 190
 					'class'   => 'form-group custom-file'
191
-				) );
192
-			}elseif($type == 'checkbox'){
191
+				));
192
+			}elseif ($type == 'checkbox') {
193 193
 				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
194
-				$output = self::wrap( array(
194
+				$output = self::wrap(array(
195 195
 					'content' => $output,
196
-					'class'   => 'custom-control '.$wrap_class
197
-				) );
196
+					'class'   => 'custom-control ' . $wrap_class
197
+				));
198 198
 
199
-				if($args['label_type']=='horizontal'){
199
+				if ($args['label_type'] == 'horizontal') {
200 200
 					$output = '<div class="col-sm-2 col-form-label"></div><div class="col-sm-10">' . $output . '</div>';
201 201
 				}
202
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
202
+			}elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
203 203
 
204 204
 
205 205
 				// allow password field to toggle view
@@ -213,49 +213,49 @@  discard block
 block discarded – undo
213 213
 			}
214 214
 
215 215
 			// input group wraps
216
-			if($args['input_group_left'] || $args['input_group_right']){
216
+			if ($args['input_group_left'] || $args['input_group_right']) {
217 217
 				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
218
-				if($args['input_group_left']){
219
-					$output = self::wrap( array(
218
+				if ($args['input_group_left']) {
219
+					$output = self::wrap(array(
220 220
 						'content' => $output,
221
-						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative'.$w100  : 'input-group',
221
+						'class'   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
222 222
 						'input_group_left' => $args['input_group_left'],
223 223
 						'input_group_left_inside'    => $args['input_group_left_inside']
224
-					) );
224
+					));
225 225
 				}
226
-				if($args['input_group_right']){
227
-					$output = self::wrap( array(
226
+				if ($args['input_group_right']) {
227
+					$output = self::wrap(array(
228 228
 						'content' => $output,
229
-						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative'.$w100 : 'input-group',
229
+						'class'   => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
230 230
 						'input_group_right' => $args['input_group_right'],
231 231
 						'input_group_right_inside'    => $args['input_group_right_inside']
232
-					) );
232
+					));
233 233
 				}
234 234
 
235 235
 			}
236 236
 
237
-			if(!$label_after){
237
+			if (!$label_after) {
238 238
 				$output .= $help_text;
239 239
 			}
240 240
 
241 241
 
242
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
243
-				$output = self::wrap( array(
242
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
243
+				$output = self::wrap(array(
244 244
 					'content' => $output,
245 245
 					'class'   => 'col-sm-10',
246
-				) );
246
+				));
247 247
 			}
248 248
 
249
-			if(!$label_after){
249
+			if (!$label_after) {
250 250
 				$output = $label . $output;
251 251
 			}
252 252
 
253 253
 			// wrap
254
-			if(!$args['no_wrap']){
254
+			if (!$args['no_wrap']) {
255 255
 
256
-				$form_group_class = $args['label_type']=='floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
257
-				$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
258
-				$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
256
+				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
257
+				$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
258
+				$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
259 259
 				$output = self::wrap(array(
260 260
 					'content' => $output,
261 261
 					'class'   => $wrap_class,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @return string The rendered component.
280 280
 	 */
281
-	public static function textarea($args = array()){
281
+	public static function textarea($args = array()) {
282 282
 		$defaults = array(
283 283
 			'name'       => '',
284 284
 			'class'      => '',
@@ -306,43 +306,43 @@  discard block
 block discarded – undo
306 306
 		/**
307 307
 		 * Parse incoming $args into an array and merge it with $defaults
308 308
 		 */
309
-		$args   = wp_parse_args( $args, $defaults );
309
+		$args   = wp_parse_args($args, $defaults);
310 310
 		$output = '';
311 311
 
312 312
 		// hidden label option needs to be empty
313 313
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
314 314
 
315 315
 		// floating labels don't work with wysiwyg so set it as top
316
-		if($args['label_type'] == 'floating' && !empty($args['wysiwyg'])){
316
+		if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) {
317 317
 			$args['label_type'] = 'top';
318 318
 		}
319 319
 
320 320
 		$label_after = $args['label_after'];
321 321
 
322 322
 		// floating labels need label after
323
-		if( $args['label_type'] == 'floating' && empty($args['wysiwyg']) ){
323
+		if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) {
324 324
 			$label_after = true;
325 325
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
326 326
 		}
327 327
 
328 328
 		// label
329
-		if(!empty($args['label']) && is_array($args['label'])){
330
-		}elseif(!empty($args['label']) && !$label_after){
329
+		if (!empty($args['label']) && is_array($args['label'])) {
330
+		}elseif (!empty($args['label']) && !$label_after) {
331 331
 			$label_args = array(
332 332
 				'title'=> $args['label'],
333 333
 				'for'=> $args['id'],
334
-				'class' => $args['label_class']." ",
334
+				'class' => $args['label_class'] . " ",
335 335
 				'label_type' => $args['label_type']
336 336
 			);
337
-			$output .= self::label( $label_args );
337
+			$output .= self::label($label_args);
338 338
 		}
339 339
 
340 340
 		// maybe horizontal label
341
-		if($args['label_type']=='horizontal'){
341
+		if ($args['label_type'] == 'horizontal') {
342 342
 			$output .= '<div class="col-sm-10">';
343 343
 		}
344 344
 
345
-		if(!empty($args['wysiwyg'])){
345
+		if (!empty($args['wysiwyg'])) {
346 346
 			ob_start();
347 347
 			$content = $args['value'];
348 348
 			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
@@ -356,65 +356,65 @@  discard block
 block discarded – undo
356 356
 			);
357 357
 
358 358
 			// maybe set settings if array
359
-			if(is_array($args['wysiwyg'])){
360
-				$settings  = wp_parse_args( $args['wysiwyg'], $settings );
359
+			if (is_array($args['wysiwyg'])) {
360
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
361 361
 			}
362 362
 
363
-			wp_editor( $content, $editor_id, $settings );
363
+			wp_editor($content, $editor_id, $settings);
364 364
 			$output .= ob_get_clean();
365
-		}else{
365
+		} else {
366 366
 
367 367
 			// open
368 368
 			$output .= '<textarea ';
369 369
 
370 370
 			// name
371
-			if(!empty($args['name'])){
372
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
371
+			if (!empty($args['name'])) {
372
+				$output .= ' name="' . sanitize_html_class($args['name']) . '" ';
373 373
 			}
374 374
 
375 375
 			// id
376
-			if(!empty($args['id'])){
377
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
376
+			if (!empty($args['id'])) {
377
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
378 378
 			}
379 379
 
380 380
 			// placeholder
381
-			if(isset($args['placeholder']) && '' != $args['placeholder']){
382
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
381
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
382
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
383 383
 			}
384 384
 
385 385
 			// title
386
-			if(!empty($args['title'])){
387
-				$output .= ' title="'.esc_attr($args['title']).'" ';
386
+			if (!empty($args['title'])) {
387
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
388 388
 			}
389 389
 
390 390
 			// validation text
391
-			if(!empty($args['validation_text'])){
392
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
391
+			if (!empty($args['validation_text'])) {
392
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
393 393
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
394 394
 			}
395 395
 
396 396
 			// validation_pattern
397
-			if(!empty($args['validation_pattern'])){
398
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
397
+			if (!empty($args['validation_pattern'])) {
398
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
399 399
 			}
400 400
 
401 401
 			// required
402
-			if(!empty($args['required'])){
402
+			if (!empty($args['required'])) {
403 403
 				$output .= ' required ';
404 404
 			}
405 405
 
406 406
 			// rows
407
-			if(!empty($args['rows'])){
408
-				$output .= ' rows="'.absint($args['rows']).'" ';
407
+			if (!empty($args['rows'])) {
408
+				$output .= ' rows="' . absint($args['rows']) . '" ';
409 409
 			}
410 410
 
411 411
 
412 412
 			// class
413 413
 			$class = !empty($args['class']) ? $args['class'] : '';
414
-			$output .= ' class="form-control '.$class.'" ';
414
+			$output .= ' class="form-control ' . $class . '" ';
415 415
 
416 416
 			// extra attributes
417
-			if(!empty($args['extra_attributes'])){
417
+			if (!empty($args['extra_attributes'])) {
418 418
 				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
419 419
 			}
420 420
 
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
 			$output .= ' >';
423 423
 
424 424
 			// value
425
-			if ( ! empty( $args['value'] ) ) {
426
-				if ( ! empty( $args['allow_tags'] ) ) {
427
-					$output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
425
+			if (!empty($args['value'])) {
426
+				if (!empty($args['allow_tags'])) {
427
+					$output .= AUI_Component_Helper::sanitize_html_field($args['value'], $args); // Sanitize HTML.
428 428
 				} else {
429
-					$output .= sanitize_textarea_field( $args['value'] );
429
+					$output .= sanitize_textarea_field($args['value']);
430 430
 				}
431 431
 			}
432 432
 
@@ -435,32 +435,32 @@  discard block
 block discarded – undo
435 435
 
436 436
 		}
437 437
 
438
-		if(!empty($args['label']) && $label_after){
438
+		if (!empty($args['label']) && $label_after) {
439 439
 			$label_args = array(
440 440
 				'title'=> $args['label'],
441 441
 				'for'=> $args['id'],
442
-				'class' => $args['label_class']." ",
442
+				'class' => $args['label_class'] . " ",
443 443
 				'label_type' => $args['label_type']
444 444
 			);
445
-			$output .= self::label( $label_args );
445
+			$output .= self::label($label_args);
446 446
 		}
447 447
 
448 448
 		// help text
449
-		if(!empty($args['help_text'])){
449
+		if (!empty($args['help_text'])) {
450 450
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
451 451
 		}
452 452
 
453 453
 		// maybe horizontal label
454
-		if($args['label_type']=='horizontal'){
454
+		if ($args['label_type'] == 'horizontal') {
455 455
 			$output .= '</div>';
456 456
 		}
457 457
 
458 458
 
459 459
 		// wrap
460
-		if(!$args['no_wrap']){
461
-			$form_group_class = $args['label_type']=='floating' ? 'form-label-group' : 'form-group';
462
-			$wrap_class = $args['label_type']=='horizontal' ? $form_group_class . ' row' : $form_group_class;
463
-			$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
460
+		if (!$args['no_wrap']) {
461
+			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
462
+			$wrap_class = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
463
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
464 464
 			$output = self::wrap(array(
465 465
 				'content' => $output,
466 466
 				'class'   => $wrap_class,
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		return $output;
474 474
 	}
475 475
 
476
-	public static function label($args = array(), $type = ''){
476
+	public static function label($args = array(), $type = '') {
477 477
 		//<label for="exampleInputEmail1">Email address</label>
478 478
 		$defaults = array(
479 479
 			'title'       => 'div',
@@ -485,20 +485,20 @@  discard block
 block discarded – undo
485 485
 		/**
486 486
 		 * Parse incoming $args into an array and merge it with $defaults
487 487
 		 */
488
-		$args   = wp_parse_args( $args, $defaults );
488
+		$args   = wp_parse_args($args, $defaults);
489 489
 		$output = '';
490 490
 
491
-		if($args['title']){
491
+		if ($args['title']) {
492 492
 
493 493
 			// maybe hide labels //@todo set a global option for visibility class
494
-			if($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type']) ){
494
+			if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) {
495 495
 				$class = $args['class'];
496
-			}else{
497
-				$class = 'sr-only '.$args['class'];
496
+			} else {
497
+				$class = 'sr-only ' . $args['class'];
498 498
 			}
499 499
 
500 500
 			// maybe horizontal
501
-			if($args['label_type']=='horizontal' && $type != 'checkbox'){
501
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
502 502
 				$class .= ' col-sm-2 col-form-label';
503 503
 			}
504 504
 
@@ -506,20 +506,20 @@  discard block
 block discarded – undo
506 506
 			$output .= '<label ';
507 507
 
508 508
 			// for
509
-			if(!empty($args['for'])){
510
-				$output .= ' for="'.sanitize_text_field($args['for']).'" ';
509
+			if (!empty($args['for'])) {
510
+				$output .= ' for="' . sanitize_text_field($args['for']) . '" ';
511 511
 			}
512 512
 
513 513
 			// class
514
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
515
-			$output .= ' class="'.$class.'" ';
514
+			$class = $class ? AUI_Component_Helper::esc_classes($class) : '';
515
+			$output .= ' class="' . $class . '" ';
516 516
 
517 517
 			// close
518 518
 			$output .= '>';
519 519
 
520 520
 
521 521
 			// title, don't escape fully as can contain html
522
-			if(!empty($args['title'])){
522
+			if (!empty($args['title'])) {
523 523
 				$output .= wp_kses_post($args['title']);
524 524
 			}
525 525
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @return string
542 542
 	 */
543
-	public static function wrap($args = array()){
543
+	public static function wrap($args = array()) {
544 544
 		$defaults = array(
545 545
 			'type'       => 'div',
546 546
 			'class'      => 'form-group',
@@ -556,55 +556,55 @@  discard block
 block discarded – undo
556 556
 		/**
557 557
 		 * Parse incoming $args into an array and merge it with $defaults
558 558
 		 */
559
-		$args   = wp_parse_args( $args, $defaults );
559
+		$args   = wp_parse_args($args, $defaults);
560 560
 		$output = '';
561
-		if($args['type']){
561
+		if ($args['type']) {
562 562
 
563 563
 			// open
564
-			$output .= '<'.sanitize_html_class($args['type']);
564
+			$output .= '<' . sanitize_html_class($args['type']);
565 565
 
566 566
 			// element require
567
-			if(!empty($args['element_require'])){
567
+			if (!empty($args['element_require'])) {
568 568
 				$output .= AUI_Component_Helper::element_require($args['element_require']);
569 569
 				$args['class'] .= " aui-conditional-field";
570 570
 			}
571 571
 
572 572
 			// argument_id
573
-			if( !empty($args['argument_id']) ){
574
-				$output .= ' data-argument="'.esc_attr($args['argument_id']).'"';
573
+			if (!empty($args['argument_id'])) {
574
+				$output .= ' data-argument="' . esc_attr($args['argument_id']) . '"';
575 575
 			}
576 576
 
577 577
 			// class
578
-			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
579
-			$output .= ' class="'.$class.'" ';
578
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
579
+			$output .= ' class="' . $class . '" ';
580 580
 
581 581
 			// close wrap
582 582
 			$output .= ' >';
583 583
 
584 584
 
585 585
 			// Input group left
586
-			if(!empty($args['input_group_left'])){
586
+			if (!empty($args['input_group_left'])) {
587 587
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
588
-				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
589
-				$output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
588
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
589
+				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
590 590
 			}
591 591
 
592 592
 			// content
593 593
 			$output .= $args['content'];
594 594
 
595 595
 			// Input group right
596
-			if(!empty($args['input_group_right'])){
596
+			if (!empty($args['input_group_right'])) {
597 597
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
598
-				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
599
-				$output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
598
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
599
+				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
600 600
 			}
601 601
 
602 602
 
603 603
 			// close wrap
604
-			$output .= '</'.sanitize_html_class($args['type']).'>';
604
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
605 605
 
606 606
 
607
-		}else{
607
+		} else {
608 608
 			$output = $args['content'];
609 609
 		}
610 610
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @return string The rendered component.
620 620
 	 */
621
-	public static function select($args = array()){
621
+	public static function select($args = array()) {
622 622
 		$defaults = array(
623 623
 			'class'      => '',
624 624
 			'wrap_class' => '',
@@ -644,11 +644,11 @@  discard block
 block discarded – undo
644 644
 		/**
645 645
 		 * Parse incoming $args into an array and merge it with $defaults
646 646
 		 */
647
-		$args   = wp_parse_args( $args, $defaults );
647
+		$args   = wp_parse_args($args, $defaults);
648 648
 		$output = '';
649 649
 
650 650
 		// for now lets hide floating labels
651
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'hidden';}
651
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'hidden'; }
652 652
 
653 653
 		// hidden label option needs to be empty
654 654
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
@@ -657,47 +657,47 @@  discard block
 block discarded – undo
657 657
 		$label_after = $args['label_after'];
658 658
 
659 659
 		// floating labels need label after
660
-		if( $args['label_type'] == 'floating' ){
660
+		if ($args['label_type'] == 'floating') {
661 661
 			$label_after = true;
662 662
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
663 663
 		}
664 664
 
665 665
 		// Maybe setup select2
666 666
 		$is_select2 = false;
667
-		if(!empty($args['select2'])){
667
+		if (!empty($args['select2'])) {
668 668
 			$args['class'] .= ' aui-select2';
669 669
 			$is_select2 = true;
670
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
670
+		}elseif (strpos($args['class'], 'aui-select2') !== false) {
671 671
 			$is_select2 = true;
672 672
 		}
673 673
 
674 674
 		// select2 tags
675
-		if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equals needed here for some reason
675
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason
676 676
 			$args['data-tags'] = 'true';
677 677
 			$args['data-token-separators'] = "[',']";
678 678
 			$args['multiple'] = true;
679 679
 		}
680 680
 
681 681
 		// select2 placeholder
682
-		if($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])){
682
+		if ($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])) {
683 683
 			$args['data-placeholder'] = esc_attr($args['placeholder']);
684 684
 			$args['data-allow-clear'] = isset($args['data-allow-clear']) ? (bool) $args['data-allow-clear'] : true;
685 685
 		}
686 686
 
687 687
 		// label
688
-		if(!empty($args['label']) && is_array($args['label'])){
689
-		}elseif(!empty($args['label']) && !$label_after){
688
+		if (!empty($args['label']) && is_array($args['label'])) {
689
+		}elseif (!empty($args['label']) && !$label_after) {
690 690
 			$label_args = array(
691 691
 				'title'=> $args['label'],
692 692
 				'for'=> $args['id'],
693
-				'class' => $args['label_class']." ",
693
+				'class' => $args['label_class'] . " ",
694 694
 				'label_type' => $args['label_type']
695 695
 			);
696 696
 			$output .= self::label($label_args);
697 697
 		}
698 698
 
699 699
 		// maybe horizontal label
700
-		if($args['label_type']=='horizontal'){
700
+		if ($args['label_type'] == 'horizontal') {
701 701
 			$output .= '<div class="col-sm-10">';
702 702
 		}
703 703
 
@@ -705,32 +705,32 @@  discard block
 block discarded – undo
705 705
 		$output .= '<select ';
706 706
 
707 707
 		// style
708
-		if($is_select2){
708
+		if ($is_select2) {
709 709
 			$output .= " style='width:100%;' ";
710 710
 		}
711 711
 
712 712
 		// element require
713
-		if(!empty($args['element_require'])){
713
+		if (!empty($args['element_require'])) {
714 714
 			$output .= AUI_Component_Helper::element_require($args['element_require']);
715 715
 			$args['class'] .= " aui-conditional-field";
716 716
 		}
717 717
 
718 718
 		// class
719 719
 		$class = !empty($args['class']) ? $args['class'] : '';
720
-		$output .= AUI_Component_Helper::class_attr('custom-select '.$class);
720
+		$output .= AUI_Component_Helper::class_attr('custom-select ' . $class);
721 721
 
722 722
 		// name
723
-		if(!empty($args['name'])){
724
-			$output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
723
+		if (!empty($args['name'])) {
724
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
725 725
 		}
726 726
 
727 727
 		// id
728
-		if(!empty($args['id'])){
728
+		if (!empty($args['id'])) {
729 729
 			$output .= AUI_Component_Helper::id($args['id']);
730 730
 		}
731 731
 
732 732
 		// title
733
-		if(!empty($args['title'])){
733
+		if (!empty($args['title'])) {
734 734
 			$output .= AUI_Component_Helper::title($args['title']);
735 735
 		}
736 736
 
@@ -741,17 +741,17 @@  discard block
 block discarded – undo
741 741
 		$output .= AUI_Component_Helper::aria_attributes($args);
742 742
 
743 743
 		// extra attributes
744
-		if(!empty($args['extra_attributes'])){
744
+		if (!empty($args['extra_attributes'])) {
745 745
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
746 746
 		}
747 747
 
748 748
 		// required
749
-		if(!empty($args['required'])){
749
+		if (!empty($args['required'])) {
750 750
 			$output .= ' required ';
751 751
 		}
752 752
 
753 753
 		// multiple
754
-		if(!empty($args['multiple'])){
754
+		if (!empty($args['multiple'])) {
755 755
 			$output .= ' multiple ';
756 756
 		}
757 757
 
@@ -759,21 +759,21 @@  discard block
 block discarded – undo
759 759
 		$output .= ' >';
760 760
 
761 761
 		// placeholder
762
-		if(isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2){
763
-			$output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
764
-		}elseif($is_select2 && !empty($args['placeholder'])){
762
+		if (isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2) {
763
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
764
+		}elseif ($is_select2 && !empty($args['placeholder'])) {
765 765
 			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
766 766
 		}
767 767
 
768 768
 		// Options
769
-		if(!empty($args['options'])){
769
+		if (!empty($args['options'])) {
770 770
 
771
-			if(!is_array($args['options'])){
771
+			if (!is_array($args['options'])) {
772 772
 				$output .= $args['options']; // not the preferred way but an option
773
-			}else{
774
-				foreach($args['options'] as $val => $name){
773
+			} else {
774
+				foreach ($args['options'] as $val => $name) {
775 775
 					$selected = '';
776
-					if(is_array($name)){
776
+					if (is_array($name)) {
777 777
 						if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
778 778
 							$option_label = isset($name['label']) ? $name['label'] : '';
779 779
 
@@ -781,23 +781,23 @@  discard block
 block discarded – undo
781 781
 						} else {
782 782
 							$option_label = isset($name['label']) ? $name['label'] : '';
783 783
 							$option_value = isset($name['value']) ? $name['value'] : '';
784
-							if(!empty($args['multiple']) && !empty($args['value']) && is_array($args['value']) ){
784
+							if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) {
785 785
 								$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
786
-							} elseif(!empty($args['value'])) {
787
-								$selected = selected($option_value,stripslashes_deep($args['value']), false);
786
+							} elseif (!empty($args['value'])) {
787
+								$selected = selected($option_value, stripslashes_deep($args['value']), false);
788 788
 							}
789 789
 
790 790
 							$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
791 791
 						}
792
-					}else{
793
-						if(!empty($args['value'])){
794
-							if(is_array($args['value'])){
795
-								$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
796
-							} elseif(!empty($args['value'])) {
797
-								$selected = selected( $args['value'], $val, false);
792
+					} else {
793
+						if (!empty($args['value'])) {
794
+							if (is_array($args['value'])) {
795
+								$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
796
+							} elseif (!empty($args['value'])) {
797
+								$selected = selected($args['value'], $val, false);
798 798
 							}
799 799
 						}
800
-						$output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';
800
+						$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';
801 801
 					}
802 802
 				}
803 803
 			}
@@ -807,31 +807,31 @@  discard block
 block discarded – undo
807 807
 		// closing tag
808 808
 		$output .= '</select>';
809 809
 
810
-		if(!empty($args['label']) && $label_after){
810
+		if (!empty($args['label']) && $label_after) {
811 811
 			$label_args = array(
812 812
 				'title'=> $args['label'],
813 813
 				'for'=> $args['id'],
814
-				'class' => $args['label_class']." ",
814
+				'class' => $args['label_class'] . " ",
815 815
 				'label_type' => $args['label_type']
816 816
 			);
817 817
 			$output .= self::label($label_args);
818 818
 		}
819 819
 
820 820
 		// help text
821
-		if(!empty($args['help_text'])){
821
+		if (!empty($args['help_text'])) {
822 822
 			$output .= AUI_Component_Helper::help_text($args['help_text']);
823 823
 		}
824 824
 
825 825
 		// maybe horizontal label
826
-		if($args['label_type']=='horizontal'){
826
+		if ($args['label_type'] == 'horizontal') {
827 827
 			$output .= '</div>';
828 828
 		}
829 829
 
830 830
 
831 831
 		// wrap
832
-		if(!$args['no_wrap']){
833
-			$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
834
-			$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
832
+		if (!$args['no_wrap']) {
833
+			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
834
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
835 835
 			$output = self::wrap(array(
836 836
 				'content' => $output,
837 837
 				'class'   => $wrap_class,
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return string The rendered component.
853 853
 	 */
854
-	public static function radio($args = array()){
854
+	public static function radio($args = array()) {
855 855
 		$defaults = array(
856 856
 			'class'      => '',
857 857
 			'wrap_class' => '',
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 		/**
875 875
 		 * Parse incoming $args into an array and merge it with $defaults
876 876
 		 */
877
-		$args   = wp_parse_args( $args, $defaults );
877
+		$args = wp_parse_args($args, $defaults);
878 878
 
879 879
 		// for now lets use horizontal for floating
880
-		if( $args['label_type'] == 'floating' ){$args['label_type'] = 'horizontal';}
880
+		if ($args['label_type'] == 'floating') {$args['label_type'] = 'horizontal'; }
881 881
 
882 882
 		$label_args = array(
883 883
 			'title'=> $args['label'],
884
-			'class' => $args['label_class']." pt-0 ",
884
+			'class' => $args['label_class'] . " pt-0 ",
885 885
 			'label_type' => $args['label_type']
886 886
 		);
887 887
 
@@ -890,36 +890,36 @@  discard block
 block discarded – undo
890 890
 
891 891
 
892 892
 		// label before
893
-		if(!empty($args['label'])){
894
-			$output .= self::label( $label_args, 'radio' );
893
+		if (!empty($args['label'])) {
894
+			$output .= self::label($label_args, 'radio');
895 895
 		}
896 896
 
897 897
 		// maybe horizontal label
898
-		if($args['label_type']=='horizontal'){
898
+		if ($args['label_type'] == 'horizontal') {
899 899
 			$output .= '<div class="col-sm-10">';
900 900
 		}
901 901
 
902
-		if(!empty($args['options'])){
902
+		if (!empty($args['options'])) {
903 903
 			$count = 0;
904
-			foreach($args['options'] as $value => $label){
904
+			foreach ($args['options'] as $value => $label) {
905 905
 				$option_args = $args;
906 906
 				$option_args['value'] = $value;
907 907
 				$option_args['label'] = $label;
908 908
 				$option_args['checked'] = $value == $args['value'] ? true : false;
909
-				$output .= self::radio_option($option_args,$count);
909
+				$output .= self::radio_option($option_args, $count);
910 910
 				$count++;
911 911
 			}
912 912
 		}
913 913
 
914 914
 		// maybe horizontal label
915
-		if($args['label_type']=='horizontal'){
915
+		if ($args['label_type'] == 'horizontal') {
916 916
 			$output .= '</div>';
917 917
 		}
918 918
 
919 919
 
920 920
 		// wrap
921
-		$wrap_class = $args['label_type']=='horizontal' ? 'form-group row' : 'form-group';
922
-		$wrap_class = !empty($args['wrap_class']) ? $wrap_class." ".$args['wrap_class'] : $wrap_class;
921
+		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
922
+		$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
923 923
 		$output = self::wrap(array(
924 924
 			'content' => $output,
925 925
 			'class'   => $wrap_class,
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 *
939 939
 	 * @return string The rendered component.
940 940
 	 */
941
-	public static function radio_option($args = array(),$count = ''){
941
+	public static function radio_option($args = array(), $count = '') {
942 942
 		$defaults = array(
943 943
 			'class'      => '',
944 944
 			'id'         => '',
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 		/**
957 957
 		 * Parse incoming $args into an array and merge it with $defaults
958 958
 		 */
959
-		$args   = wp_parse_args( $args, $defaults );
959
+		$args   = wp_parse_args($args, $defaults);
960 960
 
961 961
 		$output = '';
962 962
 
@@ -967,27 +967,27 @@  discard block
 block discarded – undo
967 967
 		$output .= ' class="form-check-input" ';
968 968
 
969 969
 		// name
970
-		if(!empty($args['name'])){
970
+		if (!empty($args['name'])) {
971 971
 			$output .= AUI_Component_Helper::name($args['name']);
972 972
 		}
973 973
 
974 974
 		// id
975
-		if(!empty($args['id'])){
976
-			$output .= AUI_Component_Helper::id($args['id'].$count);
975
+		if (!empty($args['id'])) {
976
+			$output .= AUI_Component_Helper::id($args['id'] . $count);
977 977
 		}
978 978
 
979 979
 		// title
980
-		if(!empty($args['title'])){
980
+		if (!empty($args['title'])) {
981 981
 			$output .= AUI_Component_Helper::title($args['title']);
982 982
 		}
983 983
 
984 984
 		// value
985
-		if(isset($args['value'])){
986
-			$output .= ' value="'.sanitize_text_field($args['value']).'" ';
985
+		if (isset($args['value'])) {
986
+			$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
987 987
 		}
988 988
 
989 989
 		// checked, for radio and checkboxes
990
-		if( $args['checked'] ){
990
+		if ($args['checked']) {
991 991
 			$output .= ' checked ';
992 992
 		}
993 993
 
@@ -998,12 +998,12 @@  discard block
 block discarded – undo
998 998
 		$output .= AUI_Component_Helper::aria_attributes($args);
999 999
 
1000 1000
 		// extra attributes
1001
-		if(!empty($args['extra_attributes'])){
1001
+		if (!empty($args['extra_attributes'])) {
1002 1002
 			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
1003 1003
 		}
1004 1004
 
1005 1005
 		// required
1006
-		if(!empty($args['required'])){
1006
+		if (!empty($args['required'])) {
1007 1007
 			$output .= ' required ';
1008 1008
 		}
1009 1009
 
@@ -1011,13 +1011,13 @@  discard block
 block discarded – undo
1011 1011
 		$output .= ' >';
1012 1012
 
1013 1013
 		// label
1014
-		if(!empty($args['label']) && is_array($args['label'])){
1015
-		}elseif(!empty($args['label'])){
1016
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id'].$count,'class'=>'form-check-label'),'radio');
1014
+		if (!empty($args['label']) && is_array($args['label'])) {
1015
+		}elseif (!empty($args['label'])) {
1016
+			$output .= self::label(array('title'=>$args['label'], 'for'=>$args['id'] . $count, 'class'=>'form-check-label'), 'radio');
1017 1017
 		}
1018 1018
 
1019 1019
 		// wrap
1020
-		if(!$args['no_wrap']){
1020
+		if (!$args['no_wrap']) {
1021 1021
 			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1022 1022
 			$output = self::wrap(array(
1023 1023
 				'content' => $output,
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Spacing   +242 added lines, -242 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( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 		 * @return AyeCode_UI_Settings - Main instance.
99 99
 		 */
100 100
 		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
101
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
102 102
 
103 103
 				self::$instance = new AyeCode_UI_Settings;
104 104
 
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+				add_action('init', array(self::$instance, 'init')); // set settings
106 106
 
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
107
+				if (is_admin()) {
108
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
109
+					add_action('admin_init', array(self::$instance, 'register_settings'));
110 110
 
111 111
 					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
113 113
 				}
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
117
+				do_action('ayecode_ui_settings_loaded');
118 118
 			}
119 119
 
120 120
 			return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		/**
124 124
 		 * Setup some constants.
125 125
 		 */
126
-		public function constants(){
126
+		public function constants() {
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129 129
 			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
@@ -143,25 +143,25 @@  discard block
 block discarded – undo
143 143
 			 *
144 144
 			 * We load super early in case there is a theme version that might change the colors
145 145
 			 */
146
-			if ( $this->settings['css'] ) {
147
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
146
+			if ($this->settings['css']) {
147
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1);
148 148
 			}
149
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
150
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
149
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
150
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
151 151
 			}
152 152
 
153 153
 			// maybe load JS
154
-			if ( $this->settings['js'] ) {
154
+			if ($this->settings['js']) {
155 155
 				$priority = $this->is_bs3_compat() ? 100 : 1;
156
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
156
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority);
157 157
 			}
158
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
159
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
158
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
159
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
160 160
 			}
161 161
 
162 162
 			// Maybe set the HTML font size
163
-			if ( $this->settings['html_font_size'] ) {
164
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
163
+			if ($this->settings['html_font_size']) {
164
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
165 165
 			}
166 166
 
167 167
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 		 *
173 173
 		 * @return bool
174 174
 		 */
175
-		public function load_admin_scripts(){
175
+		public function load_admin_scripts() {
176 176
 			$result = true;
177 177
 
178
-			if(!empty($this->settings['disable_admin'])){
179
-				$url_parts = explode("\n",$this->settings['disable_admin']);
180
-				foreach($url_parts as $part){
181
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
178
+			if (!empty($this->settings['disable_admin'])) {
179
+				$url_parts = explode("\n", $this->settings['disable_admin']);
180
+				foreach ($url_parts as $part) {
181
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
182 182
 						return false; // return early, no point checking further
183 183
 					}
184 184
 				}
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 		/**
191 191
 		 * Add a html font size to the footer.
192 192
 		 */
193
-		public function html_font_size(){
193
+		public function html_font_size() {
194 194
 			$this->settings = $this->get_settings();
195
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
195
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
196 196
 		}
197 197
 
198 198
 		/**
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 
205 205
 			$rtl = is_rtl() ? '-rtl' : '';
206 206
 
207
-			if($this->settings[$css_setting]){
208
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
209
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
210
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
211
-				wp_enqueue_style( 'ayecode-ui' );
207
+			if ($this->settings[$css_setting]) {
208
+				$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
209
+				$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css';
210
+				wp_register_style('ayecode-ui', $url, array(), $this->latest);
211
+				wp_enqueue_style('ayecode-ui');
212 212
 
213 213
 				// flatpickr
214
-				wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
214
+				wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest);
215 215
 
216 216
 
217 217
 				// fix some wp-admin issues
218
-				if(is_admin()){
218
+				if (is_admin()) {
219 219
 					$custom_css = "
220 220
                 body{
221 221
                     background-color: #f1f1f1;
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 						    padding: 0;
259 259
 						}
260 260
 					";
261
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
261
+					wp_add_inline_style('ayecode-ui', $custom_css);
262 262
 				}
263 263
 
264 264
 				// custom changes
265
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
265
+				wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
266 266
 
267 267
 			}
268 268
 		}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * If this remains small then its best to use this than to add another JS file.
274 274
 		 */
275
-		public function inline_script(){
275
+		public function inline_script() {
276 276
 			ob_start();
277 277
 			?>
278 278
 			<script>
@@ -771,10 +771,10 @@  discard block
 block discarded – undo
771 771
 			/*
772 772
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
773 773
 			 */
774
-			return str_replace( array(
774
+			return str_replace(array(
775 775
 				'<script>',
776 776
 				'</script>'
777
-			), '', $output );
777
+			), '', $output);
778 778
 		}
779 779
 
780 780
 
@@ -788,13 +788,13 @@  discard block
 block discarded – undo
788 788
 			ob_start();
789 789
 			?>
790 790
 			<script>
791
-				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
791
+				<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
792 792
 				/* With Avada builder */
793 793
 
794 794
 				<?php } ?>
795 795
 			</script>
796 796
 			<?php
797
-			return str_replace( array(
797
+			return str_replace(array(
798 798
 				'<script>',
799 799
 				'</script>'
800 800
 			), '', ob_get_clean());
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		 *
806 806
 		 * If this remains small then its best to use this than to add another JS file.
807 807
 		 */
808
-		public function inline_script_file_browser(){
808
+		public function inline_script_file_browser() {
809 809
 			ob_start();
810 810
 			?>
811 811
 			<script>
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
 			/*
821 821
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
822 822
 			 */
823
-			return str_replace( array(
823
+			return str_replace(array(
824 824
 				'<script>',
825 825
 				'</script>'
826
-			), '', $output );
826
+			), '', $output);
827 827
 		}
828 828
 
829 829
 		/**
@@ -834,40 +834,40 @@  discard block
 block discarded – undo
834 834
 			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
835 835
 
836 836
 			// select2
837
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
837
+			wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
838 838
 
839 839
 			// flatpickr
840
-			wp_register_script( 'flatpickr', $this->url.'assets/js/flatpickr.min.js', array(), $this->latest );
840
+			wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest);
841 841
 
842 842
 			// Bootstrap file browser
843
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
844
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
843
+			wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
844
+			wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
845 845
 
846 846
 			$load_inline = false;
847 847
 
848
-			if($this->settings[$js_setting]=='core-popper'){
848
+			if ($this->settings[$js_setting] == 'core-popper') {
849 849
 				// Bootstrap bundle
850
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
851
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest, $this->is_bs3_compat() );
850
+				$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
851
+				wp_register_script('bootstrap-js-bundle', $url, array('select2', 'jquery'), $this->latest, $this->is_bs3_compat());
852 852
 				// if in admin then add to footer for compatibility.
853
-				is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle');
853
+				is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
854 854
 				$script = $this->inline_script();
855
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
856
-			}elseif($this->settings[$js_setting]=='popper'){
857
-				$url = $this->url.'assets/js/popper.min.js';
858
-				wp_register_script( 'bootstrap-js-popper', $url, array('select2','jquery'), $this->latest );
859
-				wp_enqueue_script( 'bootstrap-js-popper' );
855
+				wp_add_inline_script('bootstrap-js-bundle', $script);
856
+			}elseif ($this->settings[$js_setting] == 'popper') {
857
+				$url = $this->url . 'assets/js/popper.min.js';
858
+				wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->latest);
859
+				wp_enqueue_script('bootstrap-js-popper');
860 860
 				$load_inline = true;
861
-			}else{
861
+			} else {
862 862
 				$load_inline = true;
863 863
 			}
864 864
 
865 865
 			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
866
-			if($load_inline){
867
-				wp_register_script( 'bootstrap-dummy', '',array('select2','jquery') );
868
-				wp_enqueue_script( 'bootstrap-dummy' );
866
+			if ($load_inline) {
867
+				wp_register_script('bootstrap-dummy', '', array('select2', 'jquery'));
868
+				wp_enqueue_script('bootstrap-dummy');
869 869
 				$script = $this->inline_script();
870
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
870
+				wp_add_inline_script('bootstrap-dummy', $script);
871 871
 			}
872 872
 
873 873
 		}
@@ -875,9 +875,9 @@  discard block
 block discarded – undo
875 875
 		/**
876 876
 		 * Enqueue flatpickr if called.
877 877
 		 */
878
-		public function enqueue_flatpickr(){
879
-			wp_enqueue_style( 'flatpickr' );
880
-			wp_enqueue_script( 'flatpickr' );
878
+		public function enqueue_flatpickr() {
879
+			wp_enqueue_style('flatpickr');
880
+			wp_enqueue_script('flatpickr');
881 881
 		}
882 882
 
883 883
 		/**
@@ -889,15 +889,15 @@  discard block
 block discarded – undo
889 889
 
890 890
 			$url = '';
891 891
 			// check if we are inside a plugin
892
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
892
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
893 893
 
894 894
 			// add check in-case user has changed wp-content dir name.
895 895
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
896
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
897
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
896
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
897
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
898 898
 
899
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
900
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
899
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
900
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
901 901
 			}
902 902
 
903 903
 			return $url;
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 		 * Register the database settings with WordPress.
908 908
 		 */
909 909
 		public function register_settings() {
910
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
910
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
911 911
 		}
912 912
 
913 913
 		/**
@@ -916,10 +916,10 @@  discard block
 block discarded – undo
916 916
 		 */
917 917
 		public function menu_item() {
918 918
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
919
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
919
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
920 920
 				$this,
921 921
 				'settings_page'
922
-			) );
922
+			));
923 923
 		}
924 924
 
925 925
 		/**
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 		 *
928 928
 		 * @return array
929 929
 		 */
930
-		public function theme_js_settings(){
930
+		public function theme_js_settings() {
931 931
 			return array(
932 932
 				'ayetheme' => 'popper',
933 933
 				'listimia' => 'required',
@@ -943,17 +943,17 @@  discard block
 block discarded – undo
943 943
 		 */
944 944
 		public function get_settings() {
945 945
 
946
-			$db_settings = get_option( 'ayecode-ui-settings' );
946
+			$db_settings = get_option('ayecode-ui-settings');
947 947
 			$js_default = 'core-popper';
948 948
 			$js_default_backend = $js_default;
949 949
 
950 950
 			// maybe set defaults (if no settings set)
951
-			if(empty($db_settings)){
952
-				$active_theme = strtolower( get_template() ); // active parent theme.
951
+			if (empty($db_settings)) {
952
+				$active_theme = strtolower(get_template()); // active parent theme.
953 953
 				$theme_js_settings = self::theme_js_settings();
954
-				if(isset($theme_js_settings[$active_theme])){
954
+				if (isset($theme_js_settings[$active_theme])) {
955 955
 					$js_default = $theme_js_settings[$active_theme];
956
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
956
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
957 957
 				}
958 958
 			}
959 959
 
@@ -966,14 +966,14 @@  discard block
 block discarded – undo
966 966
 				'disable_admin'     =>  '', // URL snippets to disable loading on admin
967 967
 			);
968 968
 
969
-			$settings = wp_parse_args( $db_settings, $defaults );
969
+			$settings = wp_parse_args($db_settings, $defaults);
970 970
 
971 971
 			/**
972 972
 			 * Filter the Bootstrap settings.
973 973
 			 *
974 974
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
975 975
 			 */
976
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
976
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
977 977
 		}
978 978
 
979 979
 
@@ -981,90 +981,90 @@  discard block
 block discarded – undo
981 981
 		 * The settings page html output.
982 982
 		 */
983 983
 		public function settings_page() {
984
-			if ( ! current_user_can( 'manage_options' ) ) {
985
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
984
+			if (!current_user_can('manage_options')) {
985
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
986 986
 			}
987 987
 			?>
988 988
 			<div class="wrap">
989 989
 				<h1><?php echo $this->name; ?></h1>
990
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
990
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", "aui"); ?></p>
991 991
 				<form method="post" action="options.php">
992 992
 					<?php
993
-					settings_fields( 'ayecode-ui-settings' );
994
-					do_settings_sections( 'ayecode-ui-settings' );
993
+					settings_fields('ayecode-ui-settings');
994
+					do_settings_sections('ayecode-ui-settings');
995 995
 					?>
996 996
 
997
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
997
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
998 998
 					<table class="form-table wpbs-table-settings">
999 999
 						<tr valign="top">
1000 1000
 							<th scope="row"><label
1001
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1001
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
1002 1002
 							<td>
1003 1003
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
1004
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1005
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1006
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1004
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1005
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1006
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1007 1007
 								</select>
1008 1008
 							</td>
1009 1009
 						</tr>
1010 1010
 
1011 1011
 						<tr valign="top">
1012 1012
 							<th scope="row"><label
1013
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1013
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
1014 1014
 							<td>
1015 1015
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
1016
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1017
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1018
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1019
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1016
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1017
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1018
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1019
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1020 1020
 								</select>
1021 1021
 							</td>
1022 1022
 						</tr>
1023 1023
 
1024 1024
 						<tr valign="top">
1025 1025
 							<th scope="row"><label
1026
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
1026
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
1027 1027
 							<td>
1028
-								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" />
1029
-								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.","aui");?></p>
1028
+								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" />
1029
+								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", "aui"); ?></p>
1030 1030
 							</td>
1031 1031
 						</tr>
1032 1032
 
1033 1033
 					</table>
1034 1034
 
1035
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1035
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1036 1036
 					<table class="form-table wpbs-table-settings">
1037 1037
 						<tr valign="top">
1038 1038
 							<th scope="row"><label
1039
-									for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1039
+									for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1040 1040
 							<td>
1041 1041
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1042
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1043
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option>
1044
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1042
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1043
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option>
1044
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1045 1045
 								</select>
1046 1046
 							</td>
1047 1047
 						</tr>
1048 1048
 
1049 1049
 						<tr valign="top">
1050 1050
 							<th scope="row"><label
1051
-									for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1051
+									for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1052 1052
 							<td>
1053 1053
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1054
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1055
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1056
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1057
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1054
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1055
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1056
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1057
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1058 1058
 								</select>
1059 1059
 							</td>
1060 1060
 						</tr>
1061 1061
 
1062 1062
 						<tr valign="top">
1063 1063
 							<th scope="row"><label
1064
-									for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1064
+									for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1065 1065
 							<td>
1066
-								<p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p>
1067
-								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin'];?></textarea>
1066
+								<p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p>
1067
+								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin']; ?></textarea>
1068 1068
 
1069 1069
 							</td>
1070 1070
 						</tr>
@@ -1082,9 +1082,9 @@  discard block
 block discarded – undo
1082 1082
 			<?php
1083 1083
 		}
1084 1084
 
1085
-		public function customizer_settings($wp_customize){
1085
+		public function customizer_settings($wp_customize) {
1086 1086
 			$wp_customize->add_section('aui_settings', array(
1087
-				'title'    => __('AyeCode UI','aui'),
1087
+				'title'    => __('AyeCode UI', 'aui'),
1088 1088
 				'priority' => 120,
1089 1089
 			));
1090 1090
 
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 				'type'              => 'option',
1099 1099
 				'transport'         => 'refresh',
1100 1100
 			));
1101
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1102
-				'label'    => __('Primary Color','aui'),
1101
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1102
+				'label'    => __('Primary Color', 'aui'),
1103 1103
 				'section'  => 'aui_settings',
1104 1104
 				'settings' => 'aui_options[color_primary]',
1105 1105
 			)));
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 				'type'              => 'option',
1112 1112
 				'transport'         => 'refresh',
1113 1113
 			));
1114
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1115
-				'label'    => __('Secondary Color','aui'),
1114
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1115
+				'label'    => __('Secondary Color', 'aui'),
1116 1116
 				'section'  => 'aui_settings',
1117 1117
 				'settings' => 'aui_options[color_secondary]',
1118 1118
 			)));
@@ -1138,12 +1138,12 @@  discard block
 block discarded – undo
1138 1138
 			.collapse.show:not(.in){display: inherit;}
1139 1139
 			.fade.show{opacity: 1;}
1140 1140
 
1141
-			<?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?>
1141
+			<?php if (defined('SVQ_THEME_VERSION')) { ?>
1142 1142
 			/* KLEO theme specific */
1143 1143
 			.kleo-main-header .navbar-collapse.collapse.show:not(.in){display: inherit !important;}
1144 1144
 			<?php } ?>
1145 1145
 
1146
-			<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1146
+			<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1147 1147
 			/* With Avada builder */
1148 1148
 			body.modal-open .modal.in  {opacity:1;z-index: 99999}
1149 1149
 			body.modal-open .modal.bsui.in .modal-content  {box-shadow: none;}
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 			<?php } ?>
1152 1152
 			</style>
1153 1153
 			<?php
1154
-			return str_replace( array(
1154
+			return str_replace(array(
1155 1155
 				'<style>',
1156 1156
 				'</style>'
1157 1157
 			), '', ob_get_clean());
@@ -1171,16 +1171,16 @@  discard block
 block discarded – undo
1171 1171
 				<?php
1172 1172
 
1173 1173
 					// BS v3 compat
1174
-					if( self::is_bs3_compat() ){
1174
+					if (self::is_bs3_compat()) {
1175 1175
 					    echo self::bs3_compat_css();
1176 1176
 					}
1177 1177
 
1178
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1179
-						echo self::css_primary($primary_color,$compatibility);
1178
+					if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) {
1179
+						echo self::css_primary($primary_color, $compatibility);
1180 1180
 					}
1181 1181
 
1182
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1183
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1182
+					if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) {
1183
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
1184 1184
 					}
1185 1185
                 ?>
1186 1186
 			</style>
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 			/*
1191 1191
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1192 1192
 			 */
1193
-			return str_replace( array(
1193
+			return str_replace(array(
1194 1194
 				'<style>',
1195 1195
 				'</style>'
1196 1196
 			), '', ob_get_clean());
@@ -1201,48 +1201,48 @@  discard block
 block discarded – undo
1201 1201
 		 *
1202 1202
 		 * @return bool
1203 1203
 		 */
1204
-		public static function is_bs3_compat(){
1204
+		public static function is_bs3_compat() {
1205 1205
 			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1206 1206
 		}
1207 1207
 
1208
-		public static function css_primary($color_code,$compatibility){;
1208
+		public static function css_primary($color_code, $compatibility) {;
1209 1209
 			$color_code = sanitize_hex_color($color_code);
1210
-			if(!$color_code){return '';}
1210
+			if (!$color_code) {return ''; }
1211 1211
 			/**
1212 1212
 			 * c = color, b = background color, o = border-color, f = fill
1213 1213
 			 */
1214 1214
 			$selectors = array(
1215 1215
 				'a' => array('c'),
1216
-				'.btn-primary' => array('b','o'),
1217
-				'.btn-primary.disabled' => array('b','o'),
1218
-				'.btn-primary:disabled' => array('b','o'),
1219
-				'.btn-outline-primary' => array('c','o'),
1220
-				'.btn-outline-primary:hover' => array('b','o'),
1221
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1222
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1223
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1216
+				'.btn-primary' => array('b', 'o'),
1217
+				'.btn-primary.disabled' => array('b', 'o'),
1218
+				'.btn-primary:disabled' => array('b', 'o'),
1219
+				'.btn-outline-primary' => array('c', 'o'),
1220
+				'.btn-outline-primary:hover' => array('b', 'o'),
1221
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1222
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1223
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1224 1224
 				'.btn-link' => array('c'),
1225 1225
 				'.dropdown-item.active' => array('b'),
1226
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1227
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1226
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1227
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1228 1228
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1229 1229
 //				'.custom-range::-moz-range-thumb' => array('b'),
1230 1230
 //				'.custom-range::-ms-thumb' => array('b'),
1231 1231
 				'.nav-pills .nav-link.active' => array('b'),
1232 1232
 				'.nav-pills .show>.nav-link' => array('b'),
1233 1233
 				'.page-link' => array('c'),
1234
-				'.page-item.active .page-link' => array('b','o'),
1234
+				'.page-item.active .page-link' => array('b', 'o'),
1235 1235
 				'.badge-primary' => array('b'),
1236
-				'.alert-primary' => array('b','o'),
1236
+				'.alert-primary' => array('b', 'o'),
1237 1237
 				'.progress-bar' => array('b'),
1238
-				'.list-group-item.active' => array('b','o'),
1239
-				'.bg-primary' => array('b','f'),
1238
+				'.list-group-item.active' => array('b', 'o'),
1239
+				'.bg-primary' => array('b', 'f'),
1240 1240
 				'.btn-link.btn-primary' => array('c'),
1241 1241
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1242 1242
 			);
1243 1243
 
1244 1244
 			$important_selectors = array(
1245
-				'.bg-primary' => array('b','f'),
1245
+				'.bg-primary' => array('b', 'f'),
1246 1246
 				'.border-primary' => array('o'),
1247 1247
 				'.text-primary' => array('c'),
1248 1248
 			);
@@ -1259,116 +1259,116 @@  discard block
 block discarded – undo
1259 1259
 			$output = '';
1260 1260
 
1261 1261
 			// build rules into each type
1262
-			foreach($selectors as $selector => $types){
1263
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1264
-				$types = array_combine($types,$types);
1265
-				if(isset($types['c'])){$color[] = $selector;}
1266
-				if(isset($types['b'])){$background[] = $selector;}
1267
-				if(isset($types['o'])){$border[] = $selector;}
1268
-				if(isset($types['f'])){$fill[] = $selector;}
1262
+			foreach ($selectors as $selector => $types) {
1263
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1264
+				$types = array_combine($types, $types);
1265
+				if (isset($types['c'])) {$color[] = $selector; }
1266
+				if (isset($types['b'])) {$background[] = $selector; }
1267
+				if (isset($types['o'])) {$border[] = $selector; }
1268
+				if (isset($types['f'])) {$fill[] = $selector; }
1269 1269
 			}
1270 1270
 
1271 1271
 			// build rules into each type
1272
-			foreach($important_selectors as $selector => $types){
1273
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1274
-				$types = array_combine($types,$types);
1275
-				if(isset($types['c'])){$color_i[] = $selector;}
1276
-				if(isset($types['b'])){$background_i[] = $selector;}
1277
-				if(isset($types['o'])){$border_i[] = $selector;}
1278
-				if(isset($types['f'])){$fill_i[] = $selector;}
1272
+			foreach ($important_selectors as $selector => $types) {
1273
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1274
+				$types = array_combine($types, $types);
1275
+				if (isset($types['c'])) {$color_i[] = $selector; }
1276
+				if (isset($types['b'])) {$background_i[] = $selector; }
1277
+				if (isset($types['o'])) {$border_i[] = $selector; }
1278
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1279 1279
 			}
1280 1280
 
1281 1281
 			// add any color rules
1282
-			if(!empty($color)){
1283
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1282
+			if (!empty($color)) {
1283
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1284 1284
 			}
1285
-			if(!empty($color_i)){
1286
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1285
+			if (!empty($color_i)) {
1286
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1287 1287
 			}
1288 1288
 
1289 1289
 			// add any background color rules
1290
-			if(!empty($background)){
1291
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1290
+			if (!empty($background)) {
1291
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1292 1292
 			}
1293
-			if(!empty($background_i)){
1294
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1293
+			if (!empty($background_i)) {
1294
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1295 1295
 			}
1296 1296
 
1297 1297
 			// add any border color rules
1298
-			if(!empty($border)){
1299
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1298
+			if (!empty($border)) {
1299
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1300 1300
 			}
1301
-			if(!empty($border_i)){
1302
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1301
+			if (!empty($border_i)) {
1302
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1303 1303
 			}
1304 1304
 
1305 1305
 			// add any fill color rules
1306
-			if(!empty($fill)){
1307
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1306
+			if (!empty($fill)) {
1307
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1308 1308
 			}
1309
-			if(!empty($fill_i)){
1310
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1309
+			if (!empty($fill_i)) {
1310
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1311 1311
 			}
1312 1312
 
1313 1313
 
1314 1314
 			$prefix = $compatibility ? ".bsui " : "";
1315 1315
 
1316 1316
 			// darken
1317
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1318
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1319
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1317
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1318
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1319
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1320 1320
 
1321 1321
 			// lighten
1322
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1322
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1323 1323
 
1324 1324
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1325
-			$op_25 = $color_code."40"; // 25% opacity
1325
+			$op_25 = $color_code . "40"; // 25% opacity
1326 1326
 
1327 1327
 
1328 1328
 			// button states
1329
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1330
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1331
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1332
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1329
+			$output .= $prefix . " .btn-primary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1330
+			$output .= $prefix . " .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1331
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1332
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1333 1333
 
1334 1334
 
1335 1335
 			// dropdown's
1336
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1336
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1337 1337
 
1338 1338
 
1339 1339
 			// input states
1340
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1340
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1341 1341
 
1342 1342
 			// page link
1343
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1343
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1344 1344
 
1345 1345
 			return $output;
1346 1346
 		}
1347 1347
 
1348
-		public static function css_secondary($color_code,$compatibility){;
1348
+		public static function css_secondary($color_code, $compatibility) {;
1349 1349
 			$color_code = sanitize_hex_color($color_code);
1350
-			if(!$color_code){return '';}
1350
+			if (!$color_code) {return ''; }
1351 1351
 			/**
1352 1352
 			 * c = color, b = background color, o = border-color, f = fill
1353 1353
 			 */
1354 1354
 			$selectors = array(
1355
-				'.btn-secondary' => array('b','o'),
1356
-				'.btn-secondary.disabled' => array('b','o'),
1357
-				'.btn-secondary:disabled' => array('b','o'),
1358
-				'.btn-outline-secondary' => array('c','o'),
1359
-				'.btn-outline-secondary:hover' => array('b','o'),
1355
+				'.btn-secondary' => array('b', 'o'),
1356
+				'.btn-secondary.disabled' => array('b', 'o'),
1357
+				'.btn-secondary:disabled' => array('b', 'o'),
1358
+				'.btn-outline-secondary' => array('c', 'o'),
1359
+				'.btn-outline-secondary:hover' => array('b', 'o'),
1360 1360
 				'.btn-outline-secondary.disabled' => array('c'),
1361 1361
 				'.btn-outline-secondary:disabled' => array('c'),
1362
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1363
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1364
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1362
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1363
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1364
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
1365 1365
 				'.badge-secondary' => array('b'),
1366
-				'.alert-secondary' => array('b','o'),
1366
+				'.alert-secondary' => array('b', 'o'),
1367 1367
 				'.btn-link.btn-secondary' => array('c'),
1368 1368
 			);
1369 1369
 
1370 1370
 			$important_selectors = array(
1371
-				'.bg-secondary' => array('b','f'),
1371
+				'.bg-secondary' => array('b', 'f'),
1372 1372
 				'.border-secondary' => array('o'),
1373 1373
 				'.text-secondary' => array('c'),
1374 1374
 			);
@@ -1385,77 +1385,77 @@  discard block
 block discarded – undo
1385 1385
 			$output = '';
1386 1386
 
1387 1387
 			// build rules into each type
1388
-			foreach($selectors as $selector => $types){
1389
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1390
-				$types = array_combine($types,$types);
1391
-				if(isset($types['c'])){$color[] = $selector;}
1392
-				if(isset($types['b'])){$background[] = $selector;}
1393
-				if(isset($types['o'])){$border[] = $selector;}
1394
-				if(isset($types['f'])){$fill[] = $selector;}
1388
+			foreach ($selectors as $selector => $types) {
1389
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1390
+				$types = array_combine($types, $types);
1391
+				if (isset($types['c'])) {$color[] = $selector; }
1392
+				if (isset($types['b'])) {$background[] = $selector; }
1393
+				if (isset($types['o'])) {$border[] = $selector; }
1394
+				if (isset($types['f'])) {$fill[] = $selector; }
1395 1395
 			}
1396 1396
 
1397 1397
 			// build rules into each type
1398
-			foreach($important_selectors as $selector => $types){
1399
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1400
-				$types = array_combine($types,$types);
1401
-				if(isset($types['c'])){$color_i[] = $selector;}
1402
-				if(isset($types['b'])){$background_i[] = $selector;}
1403
-				if(isset($types['o'])){$border_i[] = $selector;}
1404
-				if(isset($types['f'])){$fill_i[] = $selector;}
1398
+			foreach ($important_selectors as $selector => $types) {
1399
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1400
+				$types = array_combine($types, $types);
1401
+				if (isset($types['c'])) {$color_i[] = $selector; }
1402
+				if (isset($types['b'])) {$background_i[] = $selector; }
1403
+				if (isset($types['o'])) {$border_i[] = $selector; }
1404
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1405 1405
 			}
1406 1406
 
1407 1407
 			// add any color rules
1408
-			if(!empty($color)){
1409
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1408
+			if (!empty($color)) {
1409
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1410 1410
 			}
1411
-			if(!empty($color_i)){
1412
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1411
+			if (!empty($color_i)) {
1412
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1413 1413
 			}
1414 1414
 
1415 1415
 			// add any background color rules
1416
-			if(!empty($background)){
1417
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1416
+			if (!empty($background)) {
1417
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1418 1418
 			}
1419
-			if(!empty($background_i)){
1420
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1419
+			if (!empty($background_i)) {
1420
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1421 1421
 			}
1422 1422
 
1423 1423
 			// add any border color rules
1424
-			if(!empty($border)){
1425
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1424
+			if (!empty($border)) {
1425
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1426 1426
 			}
1427
-			if(!empty($border_i)){
1428
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1427
+			if (!empty($border_i)) {
1428
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1429 1429
 			}
1430 1430
 
1431 1431
 			// add any fill color rules
1432
-			if(!empty($fill)){
1433
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1432
+			if (!empty($fill)) {
1433
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1434 1434
 			}
1435
-			if(!empty($fill_i)){
1436
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1435
+			if (!empty($fill_i)) {
1436
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1437 1437
 			}
1438 1438
 
1439 1439
 
1440 1440
 			$prefix = $compatibility ? ".bsui " : "";
1441 1441
 
1442 1442
 			// darken
1443
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1444
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1445
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1443
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1444
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1445
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1446 1446
 
1447 1447
 			// lighten
1448
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1448
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1449 1449
 
1450 1450
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1451
-			$op_25 = $color_code."40"; // 25% opacity
1451
+			$op_25 = $color_code . "40"; // 25% opacity
1452 1452
 
1453 1453
 
1454 1454
 			// button states
1455
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1456
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1457
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1458
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1455
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1456
+			$output .= $prefix . " .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1457
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1458
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1459 1459
 
1460 1460
 
1461 1461
 			return $output;
@@ -1491,8 +1491,8 @@  discard block
 block discarded – undo
1491 1491
 		/**
1492 1492
 		 * Check if we should display examples.
1493 1493
 		 */
1494
-		public function maybe_show_examples(){
1495
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1494
+		public function maybe_show_examples() {
1495
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1496 1496
 				echo "<head>";
1497 1497
 				wp_head();
1498 1498
 				echo "</head>";
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
 		 *
1509 1509
 		 * @return string
1510 1510
 		 */
1511
-		public function get_examples(){
1511
+		public function get_examples() {
1512 1512
 			$output = '';
1513 1513
 
1514 1514
 
Please login to merge, or discard this patch.
includes/class-wpinv-discount.php 1 patch
Spacing   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @since   1.0.15
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Discount class.
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @since 1.0.15
14 14
  *
15 15
  */
16
-class WPInv_Discount extends GetPaid_Data  {
16
+class WPInv_Discount extends GetPaid_Data {
17 17
 
18 18
 	/**
19 19
 	 * Which data store to load.
@@ -79,35 +79,35 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param int|array|string|WPInv_Discount|WP_Post $discount discount data, object, ID or code.
81 81
 	 */
82
-	public function __construct( $discount = 0 ) {
83
-		parent::__construct( $discount );
82
+	public function __construct($discount = 0) {
83
+		parent::__construct($discount);
84 84
 
85
-		if ( is_numeric( $discount ) && 'wpi_discount' === get_post_type( $discount ) ) {
86
-			$this->set_id( $discount );
87
-		} elseif ( $discount instanceof self ) {
88
-			$this->set_id( $discount->get_id() );
89
-		} elseif ( ! empty( $discount->ID ) ) {
90
-			$this->set_id( $discount->ID );
91
-		} elseif ( is_array( $discount ) ) {
92
-			$this->set_props( $discount );
85
+		if (is_numeric($discount) && 'wpi_discount' === get_post_type($discount)) {
86
+			$this->set_id($discount);
87
+		} elseif ($discount instanceof self) {
88
+			$this->set_id($discount->get_id());
89
+		} elseif (!empty($discount->ID)) {
90
+			$this->set_id($discount->ID);
91
+		} elseif (is_array($discount)) {
92
+			$this->set_props($discount);
93 93
 
94
-			if ( isset( $discount['ID'] ) ) {
95
-				$this->set_id( $discount['ID'] );
94
+			if (isset($discount['ID'])) {
95
+				$this->set_id($discount['ID']);
96 96
 			}
97 97
 
98
-		} elseif ( is_scalar( $discount ) && $discount = self::get_discount_id_by_code( $discount ) ) {
99
-			$this->set_id( $discount );
98
+		} elseif (is_scalar($discount) && $discount = self::get_discount_id_by_code($discount)) {
99
+			$this->set_id($discount);
100 100
 		} else {
101
-			$this->set_object_read( true );
101
+			$this->set_object_read(true);
102 102
 		}
103 103
 
104 104
         // Load the datastore.
105
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
105
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
106 106
 
107
-		if ( $this->get_id() > 0 ) {
108
-            $this->post = get_post( $this->get_id() );
107
+		if ($this->get_id() > 0) {
108
+            $this->post = get_post($this->get_id());
109 109
             $this->ID   = $this->get_id();
110
-			$this->data_store->read( $this );
110
+			$this->data_store->read($this);
111 111
         }
112 112
 
113 113
 	}
@@ -123,50 +123,50 @@  discard block
 block discarded – undo
123 123
 	 * @since 1.0.15
124 124
 	 * @return array|bool array of discount details on success. False otherwise.
125 125
 	 */
126
-	public static function get_data_by( $field, $value ) {
126
+	public static function get_data_by($field, $value) {
127 127
 
128
-		if ( 'id' == strtolower( $field ) ) {
128
+		if ('id' == strtolower($field)) {
129 129
 			// Make sure the value is numeric to avoid casting objects, for example,
130 130
 			// to int 1.
131
-			if ( ! is_numeric( $value ) )
131
+			if (!is_numeric($value))
132 132
 				return false;
133
-			$value = intval( $value );
134
-			if ( $value < 1 )
133
+			$value = intval($value);
134
+			if ($value < 1)
135 135
 				return false;
136 136
 		}
137 137
 
138
-		if ( ! $value || ! is_string( $field ) ) {
138
+		if (!$value || !is_string($field)) {
139 139
 			return false;
140 140
 		}
141 141
 
142
-		$field = trim( $field );
142
+		$field = trim($field);
143 143
 
144 144
 		// prepare query args
145
-		switch ( strtolower( $field ) ) {
145
+		switch (strtolower($field)) {
146 146
 			case 'id':
147 147
 				$discount_id = $value;
148
-				$args		 = array( 'include' => array( $value ) );
148
+				$args = array('include' => array($value));
149 149
 				break;
150 150
 			case 'discount_code':
151 151
 			case 'code':
152
-				$value       = trim( $value );
153
-				$discount_id = wp_cache_get( $value, 'WPInv_Discount_Codes' );
154
-				$args		 = array( 'meta_key' => '_wpi_discount_code', 'meta_value' => $value );
152
+				$value       = trim($value);
153
+				$discount_id = wp_cache_get($value, 'WPInv_Discount_Codes');
154
+				$args = array('meta_key' => '_wpi_discount_code', 'meta_value' => $value);
155 155
 				break;
156 156
 			case 'name':
157 157
 				$discount_id = 0;
158
-				$args		 = array( 'name' => trim( $value ) );
158
+				$args		 = array('name' => trim($value));
159 159
 				break;
160 160
 			default:
161
-				$args		 = apply_filters( "wpinv_discount_get_data_by_{$field}_args", null, $value );
162
-				if ( ! is_array( $args ) ) {
163
-					return apply_filters( "wpinv_discount_get_data_by_$field", false, $value );
161
+				$args		 = apply_filters("wpinv_discount_get_data_by_{$field}_args", null, $value);
162
+				if (!is_array($args)) {
163
+					return apply_filters("wpinv_discount_get_data_by_$field", false, $value);
164 164
 				}
165 165
 
166 166
 		}
167 167
 
168 168
 		// Check if there is a cached value.
169
-		if ( ! empty( $discount_id ) && $discount = wp_cache_get( (int) $discount_id, 'WPInv_Discounts' ) ) {
169
+		if (!empty($discount_id) && $discount = wp_cache_get((int) $discount_id, 'WPInv_Discounts')) {
170 170
 			return $discount;
171 171
 		}
172 172
 
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 			array(
176 176
 				'post_type'      => 'wpi_discount',
177 177
 				'posts_per_page' => 1,
178
-				'post_status'    => array( 'publish', 'pending', 'draft', 'expired' )
178
+				'post_status'    => array('publish', 'pending', 'draft', 'expired')
179 179
 			)
180 180
 		);
181 181
 
182
-		$discount = get_posts( $args );
182
+		$discount = get_posts($args);
183 183
 
184
-		if( empty( $discount ) ) {
184
+		if (empty($discount)) {
185 185
 			return false;
186 186
 		}
187 187
 
@@ -190,30 +190,30 @@  discard block
 block discarded – undo
190 190
 		// Prepare the return data.
191 191
 		$return = array(
192 192
             'ID'                          => $discount->ID,
193
-            'code'                        => get_post_meta( $discount->ID, '_wpi_discount_code', true ),
194
-            'amount'                      => get_post_meta( $discount->ID, '_wpi_discount_amount', true ),
193
+            'code'                        => get_post_meta($discount->ID, '_wpi_discount_code', true),
194
+            'amount'                      => get_post_meta($discount->ID, '_wpi_discount_amount', true),
195 195
             'date_created'                => $discount->post_date,
196 196
 			'date_modified'               => $discount->post_modified,
197 197
 			'status'               		  => $discount->post_status,
198
-			'start'                  	  => get_post_meta( $discount->ID, '_wpi_discount_start', true ),
199
-            'expiration'                  => get_post_meta( $discount->ID, '_wpi_discount_expiration', true ),
200
-            'type'               		  => get_post_meta( $discount->ID, '_wpi_discount_type', true ),
198
+			'start'                  	  => get_post_meta($discount->ID, '_wpi_discount_start', true),
199
+            'expiration'                  => get_post_meta($discount->ID, '_wpi_discount_expiration', true),
200
+            'type'               		  => get_post_meta($discount->ID, '_wpi_discount_type', true),
201 201
             'description'                 => $discount->post_excerpt,
202
-            'uses'                 		  => get_post_meta( $discount->ID, '_wpi_discount_uses', true ),
203
-            'is_single_use'               => get_post_meta( $discount->ID, '_wpi_discount_is_single_use', true ),
204
-            'items'              	      => get_post_meta( $discount->ID, '_wpi_discount_items', true ),
205
-            'excluded_items'              => get_post_meta( $discount->ID, '_wpi_discount_excluded_items', true ),
206
-            'max_uses'                    => get_post_meta( $discount->ID, '_wpi_discount_max_uses', true ),
207
-            'is_recurring'                => get_post_meta( $discount->ID, '_wpi_discount_is_recurring', true ),
208
-            'min_total'                   => get_post_meta( $discount->ID, '_wpi_discount_min_total', true ),
209
-            'max_total'                   => get_post_meta( $discount->ID, '_wpi_discount_max_total', true ),
202
+            'uses'                 		  => get_post_meta($discount->ID, '_wpi_discount_uses', true),
203
+            'is_single_use'               => get_post_meta($discount->ID, '_wpi_discount_is_single_use', true),
204
+            'items'              	      => get_post_meta($discount->ID, '_wpi_discount_items', true),
205
+            'excluded_items'              => get_post_meta($discount->ID, '_wpi_discount_excluded_items', true),
206
+            'max_uses'                    => get_post_meta($discount->ID, '_wpi_discount_max_uses', true),
207
+            'is_recurring'                => get_post_meta($discount->ID, '_wpi_discount_is_recurring', true),
208
+            'min_total'                   => get_post_meta($discount->ID, '_wpi_discount_min_total', true),
209
+            'max_total'                   => get_post_meta($discount->ID, '_wpi_discount_max_total', true),
210 210
         );
211 211
 
212
-		$return = apply_filters( 'wpinv_discount_properties', $return );
212
+		$return = apply_filters('wpinv_discount_properties', $return);
213 213
 
214 214
 		// Update the cache with our data
215
-		wp_cache_add( $discount->ID, $return, 'WPInv_Discounts' );
216
-		wp_cache_add( $return['code'], $discount->ID, 'WPInv_Discount_Codes' );
215
+		wp_cache_add($discount->ID, $return, 'WPInv_Discounts');
216
+		wp_cache_add($return['code'], $discount->ID, 'WPInv_Discount_Codes');
217 217
 
218 218
 		return $return;
219 219
 	}
@@ -227,19 +227,19 @@  discard block
 block discarded – undo
227 227
 	 * @since 1.0.15
228 228
 	 * @return int
229 229
 	 */
230
-	public static function get_discount_id_by_code( $discount_code ) {
230
+	public static function get_discount_id_by_code($discount_code) {
231 231
 
232 232
 		// Trim the code.
233
-		$discount_code = trim( $discount_code );
233
+		$discount_code = trim($discount_code);
234 234
 
235 235
 		// Ensure a value has been passed.
236
-		if ( empty( $discount_code ) ) {
236
+		if (empty($discount_code)) {
237 237
 			return 0;
238 238
 		}
239 239
 
240 240
 		// Maybe retrieve from the cache.
241
-		$discount_id   = wp_cache_get( $discount_code, 'getpaid_discount_codes' );
242
-		if ( ! empty( $discount_id ) ) {
241
+		$discount_id = wp_cache_get($discount_code, 'getpaid_discount_codes');
242
+		if (!empty($discount_id)) {
243 243
 			return $discount_id;
244 244
 		}
245 245
 
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
 				'meta_value'     => $discount_code,
251 251
 				'post_type'      => 'wpi_discount',
252 252
 				'posts_per_page' => 1,
253
-				'post_status'    => array( 'publish', 'pending', 'draft', 'expired' ),
253
+				'post_status'    => array('publish', 'pending', 'draft', 'expired'),
254 254
 				'fields'         => 'ids',
255 255
 			)
256 256
 		);
257 257
 
258
-		if ( empty( $discounts ) ) {
258
+		if (empty($discounts)) {
259 259
 			return 0;
260 260
 		}
261 261
 
262 262
 		$discount_id = $discounts[0];
263 263
 
264 264
 		// Update the cache with our data
265
-		wp_cache_add( get_post_meta( $discount_id, '_wpi_discount_code', true ), $discount_id, 'getpaid_discount_codes' );
265
+		wp_cache_add(get_post_meta($discount_id, '_wpi_discount_code', true), $discount_id, 'getpaid_discount_codes');
266 266
 
267 267
 		return $discount_id;
268 268
 	}
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return bool Whether the given discount field is set.
277 277
 	 */
278
-	public function __isset( $key ){
279
-		return isset( $this->data[$key] ) || method_exists( $this, "get_$key");
278
+	public function __isset($key) {
279
+		return isset($this->data[$key]) || method_exists($this, "get_$key");
280 280
 	}
281 281
 
282 282
 	/*
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 	 * @param  string $context View or edit context.
302 302
 	 * @return string
303 303
 	 */
304
-	public function get_status( $context = 'view' ) {
305
-		return $this->get_prop( 'status', $context );
304
+	public function get_status($context = 'view') {
305
+		return $this->get_prop('status', $context);
306 306
     }
307 307
 
308 308
     /**
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 	 * @param  string $context View or edit context.
313 313
 	 * @return string
314 314
 	 */
315
-	public function get_version( $context = 'view' ) {
316
-		return $this->get_prop( 'version', $context );
315
+	public function get_version($context = 'view') {
316
+		return $this->get_prop('version', $context);
317 317
     }
318 318
 
319 319
     /**
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 	 * @param  string $context View or edit context.
324 324
 	 * @return string
325 325
 	 */
326
-	public function get_date_created( $context = 'view' ) {
327
-		return $this->get_prop( 'date_created', $context );
326
+	public function get_date_created($context = 'view') {
327
+		return $this->get_prop('date_created', $context);
328 328
     }
329 329
 
330 330
     /**
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 	 * @param  string $context View or edit context.
335 335
 	 * @return string
336 336
 	 */
337
-	public function get_date_created_gmt( $context = 'view' ) {
338
-        $date = $this->get_date_created( $context );
337
+	public function get_date_created_gmt($context = 'view') {
338
+        $date = $this->get_date_created($context);
339 339
 
340
-        if ( $date ) {
341
-            $date = get_gmt_from_date( $date );
340
+        if ($date) {
341
+            $date = get_gmt_from_date($date);
342 342
         }
343 343
 		return $date;
344 344
     }
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 * @param  string $context View or edit context.
351 351
 	 * @return string
352 352
 	 */
353
-	public function get_date_modified( $context = 'view' ) {
354
-		return $this->get_prop( 'date_modified', $context );
353
+	public function get_date_modified($context = 'view') {
354
+		return $this->get_prop('date_modified', $context);
355 355
     }
356 356
 
357 357
     /**
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 	 * @param  string $context View or edit context.
362 362
 	 * @return string
363 363
 	 */
364
-	public function get_date_modified_gmt( $context = 'view' ) {
365
-        $date = $this->get_date_modified( $context );
364
+	public function get_date_modified_gmt($context = 'view') {
365
+        $date = $this->get_date_modified($context);
366 366
 
367
-        if ( $date ) {
368
-            $date = get_gmt_from_date( $date );
367
+        if ($date) {
368
+            $date = get_gmt_from_date($date);
369 369
         }
370 370
 		return $date;
371 371
     }
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @param  string $context View or edit context.
378 378
 	 * @return string
379 379
 	 */
380
-	public function get_name( $context = 'view' ) {
381
-		return $this->get_prop( 'name', $context );
380
+	public function get_name($context = 'view') {
381
+		return $this->get_prop('name', $context);
382 382
     }
383 383
 
384 384
     /**
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 	 * @param  string $context View or edit context.
389 389
 	 * @return string
390 390
 	 */
391
-	public function get_title( $context = 'view' ) {
392
-		return $this->get_name( $context );
391
+	public function get_title($context = 'view') {
392
+		return $this->get_name($context);
393 393
     }
394 394
 
395 395
     /**
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
 	 * @param  string $context View or edit context.
400 400
 	 * @return string
401 401
 	 */
402
-	public function get_description( $context = 'view' ) {
403
-		return $this->get_prop( 'description', $context );
402
+	public function get_description($context = 'view') {
403
+		return $this->get_prop('description', $context);
404 404
     }
405 405
 
406 406
     /**
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	 * @param  string $context View or edit context.
411 411
 	 * @return string
412 412
 	 */
413
-	public function get_excerpt( $context = 'view' ) {
414
-		return $this->get_description( $context );
413
+	public function get_excerpt($context = 'view') {
414
+		return $this->get_description($context);
415 415
     }
416 416
 
417 417
     /**
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 * @param  string $context View or edit context.
422 422
 	 * @return string
423 423
 	 */
424
-	public function get_summary( $context = 'view' ) {
425
-		return $this->get_description( $context );
424
+	public function get_summary($context = 'view') {
425
+		return $this->get_description($context);
426 426
     }
427 427
 
428 428
     /**
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 	 * @param  string $context View or edit context.
433 433
 	 * @return string
434 434
 	 */
435
-	public function get_author( $context = 'view' ) {
436
-		return (int) $this->get_prop( 'author', $context );
435
+	public function get_author($context = 'view') {
436
+		return (int) $this->get_prop('author', $context);
437 437
 	}
438 438
 	
439 439
 	/**
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 * @param  string $context View or edit context.
444 444
 	 * @return string
445 445
 	 */
446
-	public function get_code( $context = 'view' ) {
447
-		return $this->get_prop( 'code', $context );
446
+	public function get_code($context = 'view') {
447
+		return $this->get_prop('code', $context);
448 448
 	}
449 449
 	
450 450
 	/**
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param  string $context View or edit context.
455 455
 	 * @return string
456 456
 	 */
457
-	public function get_coupon_code( $context = 'view' ) {
458
-		return $this->get_code( $context );
457
+	public function get_coupon_code($context = 'view') {
458
+		return $this->get_code($context);
459 459
 	}
460 460
 	
461 461
 	/**
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * @param  string $context View or edit context.
466 466
 	 * @return string
467 467
 	 */
468
-	public function get_discount_code( $context = 'view' ) {
469
-		return $this->get_code( $context );
468
+	public function get_discount_code($context = 'view') {
469
+		return $this->get_code($context);
470 470
 	}
471 471
 	
472 472
 	/**
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	 * @param  string $context View or edit context.
477 477
 	 * @return float
478 478
 	 */
479
-	public function get_amount( $context = 'view' ) {
480
-		return $this->get_prop( 'amount', $context );
479
+	public function get_amount($context = 'view') {
480
+		return $this->get_prop('amount', $context);
481 481
 	}
482 482
 
483 483
 	/**
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	public function get_formatted_amount() {
490 490
 
491
-		if ( $this->is_type( 'flat' ) ) {
492
-			$rate = wpinv_price( $this->get_amount() );
491
+		if ($this->is_type('flat')) {
492
+			$rate = wpinv_price($this->get_amount());
493 493
 		} else {
494 494
 			$rate = $this->get_amount() . '%';
495 495
 		}
496 496
 
497
-		return apply_filters( 'wpinv_format_discount_rate', $rate, $this->get_type(), $this->get_amount() );
497
+		return apply_filters('wpinv_format_discount_rate', $rate, $this->get_type(), $this->get_amount());
498 498
 	}
499 499
 	
500 500
 	/**
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param  string $context View or edit context.
505 505
 	 * @return string
506 506
 	 */
507
-	public function get_start( $context = 'view' ) {
508
-		return $this->get_prop( 'start', $context );
507
+	public function get_start($context = 'view') {
508
+		return $this->get_prop('start', $context);
509 509
 	}
510 510
 	
511 511
 	/**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * @param  string $context View or edit context.
516 516
 	 * @return string
517 517
 	 */
518
-	public function get_start_date( $context = 'view' ) {
519
-		return $this->get_start( $context );
518
+	public function get_start_date($context = 'view') {
519
+		return $this->get_start($context);
520 520
 	}
521 521
 	
522 522
 	/**
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	 * @param  string $context View or edit context.
527 527
 	 * @return string
528 528
 	 */
529
-	public function get_expiration( $context = 'view' ) {
530
-		return $this->get_prop( 'expiration', $context );
529
+	public function get_expiration($context = 'view') {
530
+		return $this->get_prop('expiration', $context);
531 531
 	}
532 532
 	
533 533
 	/**
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @param  string $context View or edit context.
538 538
 	 * @return string
539 539
 	 */
540
-	public function get_expiration_date( $context = 'view' ) {
541
-		return $this->get_expiration( $context );
540
+	public function get_expiration_date($context = 'view') {
541
+		return $this->get_expiration($context);
542 542
 	}
543 543
 
544 544
 	/**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 	 * @param  string $context View or edit context.
549 549
 	 * @return string
550 550
 	 */
551
-	public function get_end_date( $context = 'view' ) {
552
-		return $this->get_expiration( $context );
551
+	public function get_end_date($context = 'view') {
552
+		return $this->get_expiration($context);
553 553
 	}
554 554
 	
555 555
 	/**
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 * @param  string $context View or edit context.
560 560
 	 * @return string
561 561
 	 */
562
-	public function get_type( $context = 'view' ) {
563
-		return $this->get_prop( 'type', $context );
562
+	public function get_type($context = 'view') {
563
+		return $this->get_prop('type', $context);
564 564
 	}
565 565
 
566 566
 	/**
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
 	 * @param  string $context View or edit context.
571 571
 	 * @return int
572 572
 	 */
573
-	public function get_uses( $context = 'view' ) {
574
-		return (int) $this->get_prop( 'uses', $context );
573
+	public function get_uses($context = 'view') {
574
+		return (int) $this->get_prop('uses', $context);
575 575
 	}
576 576
 
577 577
 	/**
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	 */
583 583
 	public function get_usage() {
584 584
 
585
-		if ( ! $this->has_limit() ) {
585
+		if (!$this->has_limit()) {
586 586
 			return $this->get_uses() . ' / ' . ' &infin;';
587 587
 		}
588 588
 
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 	 * @param  string $context View or edit context.
598 598
 	 * @return int
599 599
 	 */
600
-	public function get_max_uses( $context = 'view' ) {
601
-		$max_uses = $this->get_prop( 'max_uses', $context );
602
-		return empty( $max_uses ) ? null : $max_uses;
600
+	public function get_max_uses($context = 'view') {
601
+		$max_uses = $this->get_prop('max_uses', $context);
602
+		return empty($max_uses) ? null : $max_uses;
603 603
 	}
604 604
 
605 605
 	/**
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
 	 * @param  string $context View or edit context.
610 610
 	 * @return bool
611 611
 	 */
612
-	public function get_is_single_use( $context = 'view' ) {
613
-		return $this->get_prop( 'is_single_use', $context );
612
+	public function get_is_single_use($context = 'view') {
613
+		return $this->get_prop('is_single_use', $context);
614 614
 	}
615 615
 
616 616
 	/**
@@ -620,8 +620,8 @@  discard block
 block discarded – undo
620 620
 	 * @param  string $context View or edit context.
621 621
 	 * @return array
622 622
 	 */
623
-	public function get_items( $context = 'view' ) {
624
-		return wpinv_parse_list( $this->get_prop( 'items', $context ) );
623
+	public function get_items($context = 'view') {
624
+		return wpinv_parse_list($this->get_prop('items', $context));
625 625
 	}
626 626
 
627 627
 	/**
@@ -631,8 +631,8 @@  discard block
 block discarded – undo
631 631
 	 * @param  string $context View or edit context.
632 632
 	 * @return array
633 633
 	 */
634
-	public function get_allowed_items( $context = 'view' ) {
635
-		return $this->get_items( $context );
634
+	public function get_allowed_items($context = 'view') {
635
+		return $this->get_items($context);
636 636
 	}
637 637
 
638 638
 	/**
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
 	 * @param  string $context View or edit context.
643 643
 	 * @return array
644 644
 	 */
645
-	public function get_excluded_items( $context = 'view' ) {
646
-		return wpinv_parse_list( $this->get_prop( 'excluded_items', $context ) );
645
+	public function get_excluded_items($context = 'view') {
646
+		return wpinv_parse_list($this->get_prop('excluded_items', $context));
647 647
 	}
648 648
 
649 649
 	/**
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param  string $context View or edit context.
654 654
 	 * @return int|string|bool
655 655
 	 */
656
-	public function get_is_recurring( $context = 'view' ) {
657
-		return $this->get_prop( 'is_recurring', $context );
656
+	public function get_is_recurring($context = 'view') {
657
+		return $this->get_prop('is_recurring', $context);
658 658
 	}
659 659
 
660 660
 	/**
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
 	 * @param  string $context View or edit context.
665 665
 	 * @return float
666 666
 	 */
667
-	public function get_min_total( $context = 'view' ) {
668
-		$minimum = $this->get_prop( 'min_total', $context );
669
-		return empty( $minimum ) ? null : $minimum;
667
+	public function get_min_total($context = 'view') {
668
+		$minimum = $this->get_prop('min_total', $context);
669
+		return empty($minimum) ? null : $minimum;
670 670
 	}
671 671
 
672 672
 	/**
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param  string $context View or edit context.
677 677
 	 * @return float
678 678
 	 */
679
-	public function get_minimum_total( $context = 'view' ) {
680
-		return $this->get_min_total( $context );
679
+	public function get_minimum_total($context = 'view') {
680
+		return $this->get_min_total($context);
681 681
 	}
682 682
 
683 683
 	/**
@@ -687,9 +687,9 @@  discard block
 block discarded – undo
687 687
 	 * @param  string $context View or edit context.
688 688
 	 * @return float
689 689
 	 */
690
-	public function get_max_total( $context = 'view' ) {
691
-		$maximum = $this->get_prop( 'max_total', $context );
692
-		return empty( $maximum ) ? null : $maximum;
690
+	public function get_max_total($context = 'view') {
691
+		$maximum = $this->get_prop('max_total', $context);
692
+		return empty($maximum) ? null : $maximum;
693 693
 	}
694 694
 
695 695
 	/**
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 	 * @param  string $context View or edit context.
700 700
 	 * @return float
701 701
 	 */
702
-	public function get_maximum_total( $context = 'view' ) {
703
-		return $this->get_max_total( $context );
702
+	public function get_maximum_total($context = 'view') {
703
+		return $this->get_max_total($context);
704 704
 	}
705 705
 
706 706
 	/**
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 * @param  string $context View or edit context.
714 714
 	 * @return mixed Value of the given discount property (if set).
715 715
 	 */
716
-	public function get( $key, $context = 'view' ) {
717
-        return $this->get_prop( $key, $context );
716
+	public function get($key, $context = 'view') {
717
+        return $this->get_prop($key, $context);
718 718
 	}
719 719
 
720 720
 	/*
@@ -734,10 +734,10 @@  discard block
 block discarded – undo
734 734
 	 * @param  string $status New status.
735 735
 	 * @return array details of change.
736 736
 	 */
737
-	public function set_status( $status ) {
737
+	public function set_status($status) {
738 738
         $old_status = $this->get_status();
739 739
 
740
-        $this->set_prop( 'status', $status );
740
+        $this->set_prop('status', $status);
741 741
 
742 742
 		return array(
743 743
 			'from' => $old_status,
@@ -750,8 +750,8 @@  discard block
 block discarded – undo
750 750
 	 *
751 751
 	 * @since 1.0.19
752 752
 	 */
753
-	public function set_version( $value ) {
754
-		$this->set_prop( 'version', $value );
753
+	public function set_version($value) {
754
+		$this->set_prop('version', $value);
755 755
     }
756 756
 
757 757
     /**
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 	 * @param string $value Value to set.
762 762
      * @return bool Whether or not the date was set.
763 763
 	 */
764
-	public function set_date_created( $value ) {
765
-        $date = strtotime( $value );
764
+	public function set_date_created($value) {
765
+        $date = strtotime($value);
766 766
 
767
-        if ( $date ) {
768
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
767
+        if ($date) {
768
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
769 769
             return true;
770 770
         }
771 771
 
@@ -780,11 +780,11 @@  discard block
 block discarded – undo
780 780
 	 * @param string $value Value to set.
781 781
      * @return bool Whether or not the date was set.
782 782
 	 */
783
-	public function set_date_modified( $value ) {
784
-        $date = strtotime( $value );
783
+	public function set_date_modified($value) {
784
+        $date = strtotime($value);
785 785
 
786
-        if ( $date ) {
787
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
786
+        if ($date) {
787
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
788 788
             return true;
789 789
         }
790 790
 
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
 	 * @since 1.0.19
799 799
 	 * @param  string $value New name.
800 800
 	 */
801
-	public function set_name( $value ) {
802
-        $name = sanitize_text_field( $value );
803
-		$this->set_prop( 'name', $name );
801
+	public function set_name($value) {
802
+        $name = sanitize_text_field($value);
803
+		$this->set_prop('name', $name);
804 804
     }
805 805
 
806 806
     /**
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 	 * @since 1.0.19
810 810
 	 * @param  string $value New name.
811 811
 	 */
812
-	public function set_title( $value ) {
813
-		$this->set_name( $value );
812
+	public function set_title($value) {
813
+		$this->set_name($value);
814 814
     }
815 815
 
816 816
     /**
@@ -819,9 +819,9 @@  discard block
 block discarded – undo
819 819
 	 * @since 1.0.19
820 820
 	 * @param  string $value New description.
821 821
 	 */
822
-	public function set_description( $value ) {
823
-        $description = wp_kses_post( $value );
824
-		return $this->set_prop( 'description', $description );
822
+	public function set_description($value) {
823
+        $description = wp_kses_post($value);
824
+		return $this->set_prop('description', $description);
825 825
     }
826 826
 
827 827
     /**
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
 	 * @since 1.0.19
831 831
 	 * @param  string $value New description.
832 832
 	 */
833
-	public function set_excerpt( $value ) {
834
-		$this->set_description( $value );
833
+	public function set_excerpt($value) {
834
+		$this->set_description($value);
835 835
     }
836 836
 
837 837
     /**
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	 * @since 1.0.19
841 841
 	 * @param  string $value New description.
842 842
 	 */
843
-	public function set_summary( $value ) {
844
-		$this->set_description( $value );
843
+	public function set_summary($value) {
844
+		$this->set_description($value);
845 845
     }
846 846
 
847 847
     /**
@@ -850,8 +850,8 @@  discard block
 block discarded – undo
850 850
 	 * @since 1.0.19
851 851
 	 * @param  int $value New author.
852 852
 	 */
853
-	public function set_author( $value ) {
854
-		$this->set_prop( 'author', (int) $value );
853
+	public function set_author($value) {
854
+		$this->set_prop('author', (int) $value);
855 855
 	}
856 856
 	
857 857
 	/**
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
 	 * @since 1.0.19
861 861
 	 * @param string $value New discount code.
862 862
 	 */
863
-	public function set_code( $value ) {
864
-		$code = sanitize_text_field( $value );
865
-		$this->set_prop( 'code', $code );
863
+	public function set_code($value) {
864
+		$code = sanitize_text_field($value);
865
+		$this->set_prop('code', $code);
866 866
 	}
867 867
 	
868 868
 	/**
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
 	 * @since 1.0.19
872 872
 	 * @param string $value New discount code.
873 873
 	 */
874
-	public function set_coupon_code( $value ) {
875
-		$this->set_code( $value );
874
+	public function set_coupon_code($value) {
875
+		$this->set_code($value);
876 876
 	}
877 877
 	
878 878
 	/**
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 	 * @since 1.0.19
882 882
 	 * @param string $value New discount code.
883 883
 	 */
884
-	public function set_discount_code( $value ) {
885
-		$this->set_code( $value );
884
+	public function set_discount_code($value) {
885
+		$this->set_code($value);
886 886
 	}
887 887
 	
888 888
 	/**
@@ -891,9 +891,9 @@  discard block
 block discarded – undo
891 891
 	 * @since 1.0.19
892 892
 	 * @param float $value New discount code.
893 893
 	 */
894
-	public function set_amount( $value ) {
895
-		$amount = floatval( wpinv_sanitize_amount( $value ) );
896
-		$this->set_prop( 'amount', $amount );
894
+	public function set_amount($value) {
895
+		$amount = floatval(wpinv_sanitize_amount($value));
896
+		$this->set_prop('amount', $amount);
897 897
 	}
898 898
 
899 899
 	/**
@@ -902,15 +902,15 @@  discard block
 block discarded – undo
902 902
 	 * @since 1.0.19
903 903
 	 * @param float $value New start date.
904 904
 	 */
905
-	public function set_start( $value ) {
906
-		$date = strtotime( $value );
905
+	public function set_start($value) {
906
+		$date = strtotime($value);
907 907
 
908
-        if ( $date ) {
909
-            $this->set_prop( 'start', date( 'Y-m-d H:i', $date ) );
908
+        if ($date) {
909
+            $this->set_prop('start', date('Y-m-d H:i', $date));
910 910
             return true;
911 911
 		}
912 912
 		
913
-		$this->set_prop( 'start', '' );
913
+		$this->set_prop('start', '');
914 914
 
915 915
         return false;
916 916
 	}
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
 	 * @since 1.0.19
922 922
 	 * @param string $value New start date.
923 923
 	 */
924
-	public function set_start_date( $value ) {
925
-		$this->set_start( $value );
924
+	public function set_start_date($value) {
925
+		$this->set_start($value);
926 926
 	}
927 927
 
928 928
 	/**
@@ -931,15 +931,15 @@  discard block
 block discarded – undo
931 931
 	 * @since 1.0.19
932 932
 	 * @param float $value New expiration date.
933 933
 	 */
934
-	public function set_expiration( $value ) {
935
-		$date = strtotime( $value );
934
+	public function set_expiration($value) {
935
+		$date = strtotime($value);
936 936
 
937
-        if ( $date ) {
938
-            $this->set_prop( 'expiration', date( 'Y-m-d H:i', $date ) );
937
+        if ($date) {
938
+            $this->set_prop('expiration', date('Y-m-d H:i', $date));
939 939
             return true;
940 940
         }
941 941
 
942
-		$this->set_prop( 'expiration', '' );
942
+		$this->set_prop('expiration', '');
943 943
         return false;
944 944
 	}
945 945
 
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
 	 * @since 1.0.19
950 950
 	 * @param string $value New expiration date.
951 951
 	 */
952
-	public function set_expiration_date( $value ) {
953
-		$this->set_expiration( $value );
952
+	public function set_expiration_date($value) {
953
+		$this->set_expiration($value);
954 954
 	}
955 955
 
956 956
 	/**
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
 	 * @since 1.0.19
960 960
 	 * @param string $value New expiration date.
961 961
 	 */
962
-	public function set_end_date( $value ) {
963
-		$this->set_expiration( $value );
962
+	public function set_end_date($value) {
963
+		$this->set_expiration($value);
964 964
 	}
965 965
 
966 966
 	/**
@@ -969,9 +969,9 @@  discard block
 block discarded – undo
969 969
 	 * @since 1.0.19
970 970
 	 * @param string $value New discount type.
971 971
 	 */
972
-	public function set_type( $value ) {
973
-		if ( $value && array_key_exists( sanitize_text_field( $value ), wpinv_get_discount_types() ) ) {
974
-			$this->set_prop( 'type', sanitize_text_field( $value ) );
972
+	public function set_type($value) {
973
+		if ($value && array_key_exists(sanitize_text_field($value), wpinv_get_discount_types())) {
974
+			$this->set_prop('type', sanitize_text_field($value));
975 975
 		}
976 976
 	}
977 977
 
@@ -981,15 +981,15 @@  discard block
 block discarded – undo
981 981
 	 * @since 1.0.19
982 982
 	 * @param int $value usage count.
983 983
 	 */
984
-	public function set_uses( $value ) {
984
+	public function set_uses($value) {
985 985
 
986 986
 		$value = (int) $value;
987 987
 
988
-		if ( $value < 0 ) {
988
+		if ($value < 0) {
989 989
 			$value = 0;
990 990
 		}
991 991
 
992
-		$this->set_prop( 'uses', (int) $value );
992
+		$this->set_prop('uses', (int) $value);
993 993
 	}
994 994
 
995 995
 	/**
@@ -998,8 +998,8 @@  discard block
 block discarded – undo
998 998
 	 * @since 1.0.19
999 999
 	 * @param int $value maximum usage count.
1000 1000
 	 */
1001
-	public function set_max_uses( $value ) {
1002
-		$this->set_prop( 'max_uses', absint( $value ) );
1001
+	public function set_max_uses($value) {
1002
+		$this->set_prop('max_uses', absint($value));
1003 1003
 	}
1004 1004
 
1005 1005
 	/**
@@ -1008,8 +1008,8 @@  discard block
 block discarded – undo
1008 1008
 	 * @since 1.0.19
1009 1009
 	 * @param int|bool $value is single use.
1010 1010
 	 */
1011
-	public function set_is_single_use( $value ) {
1012
-		$this->set_prop( 'is_single_use', (bool) $value );
1011
+	public function set_is_single_use($value) {
1012
+		$this->set_prop('is_single_use', (bool) $value);
1013 1013
 	}
1014 1014
 
1015 1015
 	/**
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 	 * @since 1.0.19
1019 1019
 	 * @param array $value items.
1020 1020
 	 */
1021
-	public function set_items( $value ) {
1022
-		$this->set_prop( 'items', wpinv_parse_list( $value ) );
1021
+	public function set_items($value) {
1022
+		$this->set_prop('items', wpinv_parse_list($value));
1023 1023
 	}
1024 1024
 
1025 1025
 	/**
@@ -1028,8 +1028,8 @@  discard block
 block discarded – undo
1028 1028
 	 * @since 1.0.19
1029 1029
 	 * @param array $value items.
1030 1030
 	 */
1031
-	public function set_allowed_items( $value ) {
1032
-		$this->set_items( $value );
1031
+	public function set_allowed_items($value) {
1032
+		$this->set_items($value);
1033 1033
 	}
1034 1034
 
1035 1035
 	/**
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
 	 * @since 1.0.19
1039 1039
 	 * @param array $value items.
1040 1040
 	 */
1041
-	public function set_excluded_items( $value ) {
1042
-		$this->set_prop( 'excluded_items', wpinv_parse_list( $value ) );
1041
+	public function set_excluded_items($value) {
1042
+		$this->set_prop('excluded_items', wpinv_parse_list($value));
1043 1043
 	}
1044 1044
 
1045 1045
 	/**
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
 	 * @since 1.0.19
1049 1049
 	 * @param int|bool $value is recurring.
1050 1050
 	 */
1051
-	public function set_is_recurring( $value ) {
1052
-		$this->set_prop( 'is_recurring', (bool) $value );
1051
+	public function set_is_recurring($value) {
1052
+		$this->set_prop('is_recurring', (bool) $value);
1053 1053
 	}
1054 1054
 
1055 1055
 	/**
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
 	 * @since 1.0.19
1059 1059
 	 * @param float $value minimum total.
1060 1060
 	 */
1061
-	public function set_min_total( $value ) {
1062
-		$this->set_prop( 'min_total', (float) wpinv_sanitize_amount( $value ) );
1061
+	public function set_min_total($value) {
1062
+		$this->set_prop('min_total', (float) wpinv_sanitize_amount($value));
1063 1063
 	}
1064 1064
 
1065 1065
 	/**
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 	 * @since 1.0.19
1069 1069
 	 * @param float $value minimum total.
1070 1070
 	 */
1071
-	public function set_minimum_total( $value ) {
1072
-		$this->set_min_total( $value );
1071
+	public function set_minimum_total($value) {
1072
+		$this->set_min_total($value);
1073 1073
 	}
1074 1074
 
1075 1075
 	/**
@@ -1078,8 +1078,8 @@  discard block
 block discarded – undo
1078 1078
 	 * @since 1.0.19
1079 1079
 	 * @param float $value maximum total.
1080 1080
 	 */
1081
-	public function set_max_total( $value ) {
1082
-		$this->set_prop( 'max_total', (float) wpinv_sanitize_amount( $value ) );
1081
+	public function set_max_total($value) {
1082
+		$this->set_prop('max_total', (float) wpinv_sanitize_amount($value));
1083 1083
 	}
1084 1084
 
1085 1085
 	/**
@@ -1088,23 +1088,23 @@  discard block
 block discarded – undo
1088 1088
 	 * @since 1.0.19
1089 1089
 	 * @param float $value maximum total.
1090 1090
 	 */
1091
-	public function set_maximum_total( $value ) {
1092
-		$this->set_max_total( $value );
1091
+	public function set_maximum_total($value) {
1092
+		$this->set_max_total($value);
1093 1093
 	}
1094 1094
 
1095 1095
 	/**
1096 1096
 	 * @deprecated
1097 1097
 	 */
1098
-	public function refresh(){}
1098
+	public function refresh() {}
1099 1099
 
1100 1100
 	/**
1101 1101
 	 * @deprecated
1102 1102
 	 *
1103 1103
 	 */
1104
-	public function update_status( $status = 'publish' ){
1104
+	public function update_status($status = 'publish') {
1105 1105
 
1106
-		if ( $this->exists() && $this->get_status() != $status ) {
1107
-			$this->set_status( $status );
1106
+		if ($this->exists() && $this->get_status() != $status) {
1107
+			$this->set_status($status);
1108 1108
 			$this->save();
1109 1109
 		}
1110 1110
 
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 	 *
1125 1125
 	 * @since 1.0.15
1126 1126
 	 */
1127
-	public function exists(){
1127
+	public function exists() {
1128 1128
 		$id = $this->get_id();
1129
-		return ! empty( $id );
1129
+		return !empty($id);
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 	 * @since 1.0.15
1138 1138
 	 * @return bool
1139 1139
 	 */
1140
-	public function is_type( $type ) {
1140
+	public function is_type($type) {
1141 1141
 		return $this->get_type() == $type;
1142 1142
 	}
1143 1143
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	public function has_limit() {
1161 1161
 		$limit = $this->get_max_uses();
1162
-		return ! empty( $limit );
1162
+		return !empty($limit);
1163 1163
 	}
1164 1164
 
1165 1165
 	/**
@@ -1180,13 +1180,13 @@  discard block
 block discarded – undo
1180 1180
 	 */
1181 1181
 	public function has_exceeded_limit() {
1182 1182
 
1183
-		if ( ! $this->has_limit() || ! $this->has_uses() ) {
1184
-			$exceeded = false ;
1183
+		if (!$this->has_limit() || !$this->has_uses()) {
1184
+			$exceeded = false;
1185 1185
 		} else {
1186 1186
 			$exceeded = (int) $this->get_max_uses() <= $this->get_uses();
1187 1187
 		}
1188 1188
 
1189
-		return apply_filters( 'wpinv_is_discount_maxed_out', $exceeded, $this->get_id(), $this, $this->get_code() );
1189
+		return apply_filters('wpinv_is_discount_maxed_out', $exceeded, $this->get_id(), $this, $this->get_code());
1190 1190
 	}
1191 1191
 
1192 1192
 	/**
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 	 */
1198 1198
 	public function has_expiration_date() {
1199 1199
 		$date = $this->get_expiration_date();
1200
-		return ! empty( $date );
1200
+		return !empty($date);
1201 1201
 	}
1202 1202
 
1203 1203
 	/**
@@ -1207,8 +1207,8 @@  discard block
 block discarded – undo
1207 1207
 	 * @return bool
1208 1208
 	 */
1209 1209
 	public function is_expired() {
1210
-		$expired = $this->has_expiration_date() ? current_time( 'timestamp' ) > strtotime( $this->get_expiration_date() ) : false;
1211
-		return apply_filters( 'wpinv_is_discount_expired', $expired, $this->get_id(), $this, $this->get_code() );
1210
+		$expired = $this->has_expiration_date() ? current_time('timestamp') > strtotime($this->get_expiration_date()) : false;
1211
+		return apply_filters('wpinv_is_discount_expired', $expired, $this->get_id(), $this, $this->get_code());
1212 1212
 	}
1213 1213
 
1214 1214
 	/**
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 */
1220 1220
 	public function has_start_date() {
1221 1221
 		$date = $this->get_start_date();
1222
-		return ! empty( $date );
1222
+		return !empty($date);
1223 1223
 	}
1224 1224
 
1225 1225
 	/**
@@ -1229,8 +1229,8 @@  discard block
 block discarded – undo
1229 1229
 	 * @return bool
1230 1230
 	 */
1231 1231
 	public function has_started() {
1232
-		$started = $this->has_start_date() ? true : current_time( 'timestamp' ) > strtotime( $this->get_start_date() );
1233
-		return apply_filters( 'wpinv_is_discount_started', $started, $this->get_id(), $this, $this->get_code() );
1232
+		$started = $this->has_start_date() ? true : current_time('timestamp') > strtotime($this->get_start_date());
1233
+		return apply_filters('wpinv_is_discount_started', $started, $this->get_id(), $this, $this->get_code());
1234 1234
 	}
1235 1235
 
1236 1236
 	/**
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 	 */
1242 1242
 	public function has_allowed_items() {
1243 1243
 		$allowed_items = $this->get_allowed_items();
1244
-		return ! empty( $allowed_items );
1244
+		return !empty($allowed_items);
1245 1245
 	}
1246 1246
 
1247 1247
 	/**
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 	 */
1253 1253
 	public function has_excluded_items() {
1254 1254
 		$excluded_items = $this->get_excluded_items();
1255
-		return ! empty( $excluded_items );
1255
+		return !empty($excluded_items);
1256 1256
 	}
1257 1257
 
1258 1258
 	/**
@@ -1262,17 +1262,17 @@  discard block
 block discarded – undo
1262 1262
 	 * @since 1.0.15
1263 1263
 	 * @return boolean
1264 1264
 	 */
1265
-	public function is_valid_for_items( $item_ids ) {
1265
+	public function is_valid_for_items($item_ids) {
1266 1266
 
1267
-		$item_ids = wp_parse_id_list( $item_ids );
1268
-		$included = array_intersect( $item_ids, $this->get_allowed_items() );
1269
-		$excluded = array_intersect( $item_ids, $this->get_excluded_items() );
1267
+		$item_ids = wp_parse_id_list($item_ids);
1268
+		$included = array_intersect($item_ids, $this->get_allowed_items());
1269
+		$excluded = array_intersect($item_ids, $this->get_excluded_items());
1270 1270
 
1271
-		if ( $this->has_excluded_items() && ! empty( $excluded ) ) {
1271
+		if ($this->has_excluded_items() && !empty($excluded)) {
1272 1272
 			return false;
1273 1273
 		}
1274 1274
 
1275
-		if ( $this->has_allowed_items() && empty( $included ) ) {
1275
+		if ($this->has_allowed_items() && empty($included)) {
1276 1276
 			return false;
1277 1277
 		}
1278 1278
 
@@ -1286,8 +1286,8 @@  discard block
 block discarded – undo
1286 1286
 	 * @since 1.0.15
1287 1287
 	 * @return boolean
1288 1288
 	 */
1289
-	public function is_valid_for_amount( $amount ) {
1290
-		return $this->is_minimum_amount_met( $amount ) && $this->is_maximum_amount_met( $amount );
1289
+	public function is_valid_for_amount($amount) {
1290
+		return $this->is_minimum_amount_met($amount) && $this->is_maximum_amount_met($amount);
1291 1291
 	}
1292 1292
 
1293 1293
 	/**
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 	 */
1299 1299
 	public function has_minimum_amount() {
1300 1300
 		$minimum = $this->get_minimum_total();
1301
-		return ! empty( $minimum );
1301
+		return !empty($minimum);
1302 1302
 	}
1303 1303
 
1304 1304
 	/**
@@ -1308,10 +1308,10 @@  discard block
 block discarded – undo
1308 1308
 	 * @since 1.0.15
1309 1309
 	 * @return boolean
1310 1310
 	 */
1311
-	public function is_minimum_amount_met( $amount ) {
1312
-		$amount = floatval( wpinv_sanitize_amount( $amount ) );
1313
-		$min_met= ! ( $this->has_minimum_amount() && $amount < floatval( wpinv_sanitize_amount( $this->get_minimum_total() ) ) );
1314
-		return apply_filters( 'wpinv_is_discount_min_met', $min_met, $this->get_id(), $this, $this->get_code(), $amount );
1311
+	public function is_minimum_amount_met($amount) {
1312
+		$amount = floatval(wpinv_sanitize_amount($amount));
1313
+		$min_met = !($this->has_minimum_amount() && $amount < floatval(wpinv_sanitize_amount($this->get_minimum_total())));
1314
+		return apply_filters('wpinv_is_discount_min_met', $min_met, $this->get_id(), $this, $this->get_code(), $amount);
1315 1315
 	}
1316 1316
 
1317 1317
 	/**
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 	 */
1323 1323
 	public function has_maximum_amount() {
1324 1324
 		$maximum = $this->get_maximum_total();
1325
-		return ! empty( $maximum );
1325
+		return !empty($maximum);
1326 1326
 	}
1327 1327
 
1328 1328
 	/**
@@ -1332,10 +1332,10 @@  discard block
 block discarded – undo
1332 1332
 	 * @since 1.0.15
1333 1333
 	 * @return boolean
1334 1334
 	 */
1335
-	public function is_maximum_amount_met( $amount ) {
1336
-		$amount = floatval( wpinv_sanitize_amount( $amount ) );
1337
-		$max_met= ! ( $this->has_maximum_amount() && $amount > floatval( wpinv_sanitize_amount( $this->get_maximum_total() ) ) );
1338
-		return apply_filters( 'wpinv_is_discount_max_met', $max_met, $this->get_id(), $this, $this->get_code(), $amount );
1335
+	public function is_maximum_amount_met($amount) {
1336
+		$amount = floatval(wpinv_sanitize_amount($amount));
1337
+		$max_met = !($this->has_maximum_amount() && $amount > floatval(wpinv_sanitize_amount($this->get_maximum_total())));
1338
+		return apply_filters('wpinv_is_discount_max_met', $max_met, $this->get_id(), $this, $this->get_code(), $amount);
1339 1339
 	}
1340 1340
 
1341 1341
 	/**
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 	 */
1347 1347
 	public function is_recurring() {
1348 1348
 		$recurring = $this->get_is_recurring();
1349
-		return ! empty( $recurring );
1349
+		return !empty($recurring);
1350 1350
 	}
1351 1351
 
1352 1352
 	/**
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	 */
1358 1358
 	public function is_single_use() {
1359 1359
 		$usage = $this->get_is_single_use();
1360
-		return ! empty( $usage );
1360
+		return !empty($usage);
1361 1361
 	}
1362 1362
 
1363 1363
 	/**
@@ -1367,37 +1367,37 @@  discard block
 block discarded – undo
1367 1367
 	 * @since 1.0.15
1368 1368
 	 * @return boolean
1369 1369
 	 */
1370
-	public function is_valid_for_user( $user ) {
1370
+	public function is_valid_for_user($user) {
1371 1371
 
1372 1372
 		// Ensure that the discount is single use.
1373
-		if ( empty( $user ) || ! $this->is_single_use() ) {
1373
+		if (empty($user) || !$this->is_single_use()) {
1374 1374
 			return true;
1375 1375
 		}
1376 1376
 
1377 1377
 		// Prepare the user id.
1378 1378
 		$user_id = 0;
1379
-        if ( is_numeric( $user ) ) {
1380
-            $user_id = absint( $user );
1381
-        } else if ( is_email( $user ) && $user_data = get_user_by( 'email', $user ) ) {
1379
+        if (is_numeric($user)) {
1380
+            $user_id = absint($user);
1381
+        } else if (is_email($user) && $user_data = get_user_by('email', $user)) {
1382 1382
             $user_id = $user_data->ID;
1383
-        } else if ( $user_data = get_user_by( 'login', $user ) ) {
1383
+        } else if ($user_data = get_user_by('login', $user)) {
1384 1384
             $user_id = $user_data->ID;
1385 1385
         }
1386 1386
 
1387 1387
 		// Ensure that we have a user.
1388
-		if ( empty( $user_id ) ) {
1388
+		if (empty($user_id)) {
1389 1389
 			return true;
1390 1390
 		}
1391 1391
 
1392 1392
 		// Get all payments with matching user id.
1393
-        $payments = wpinv_get_invoices( array( 'user' => $user_id, 'limit' => false, 'paginate' => false ) );
1394
-		$code     = strtolower( $this->get_code() );
1393
+        $payments = wpinv_get_invoices(array('user' => $user_id, 'limit' => false, 'paginate' => false));
1394
+		$code = strtolower($this->get_code());
1395 1395
 
1396 1396
 		// For each payment...
1397
-		foreach ( $payments as $payment ) {
1397
+		foreach ($payments as $payment) {
1398 1398
 
1399 1399
 			// Only check for paid invoices.
1400
-			if ( $payment->is_paid() && strtolower( $payment->get_discount_code() ) == $code ) {
1400
+			if ($payment->is_paid() && strtolower($payment->get_discount_code()) == $code) {
1401 1401
 				return false;
1402 1402
 			}
1403 1403
 
@@ -1423,24 +1423,24 @@  discard block
 block discarded – undo
1423 1423
 	 * @param int $by The number of usages to increas by.
1424 1424
 	 * @return int
1425 1425
 	 */
1426
-	public function increase_usage( $by = 1 ) {
1426
+	public function increase_usage($by = 1) {
1427 1427
 
1428 1428
 		// Abort if zero.
1429
-		if ( empty( $by ) ) {
1429
+		if (empty($by)) {
1430 1430
 			return;
1431 1431
 		}
1432 1432
 
1433 1433
 		// Increase the usage.
1434
-		$this->set_uses( $this->get_uses() + (int) $by );
1434
+		$this->set_uses($this->get_uses() + (int) $by);
1435 1435
 
1436 1436
 		// Save the discount.
1437 1437
 		$this->save();
1438 1438
 
1439 1439
 		// Fire relevant hooks.
1440
-		if( (int) $by > 0 ) {
1441
-			do_action( 'wpinv_discount_increase_use_count', $this->get_uses(), $this->get_id(), $this->get_code(),  absint( $by ) );
1440
+		if ((int) $by > 0) {
1441
+			do_action('wpinv_discount_increase_use_count', $this->get_uses(), $this->get_id(), $this->get_code(), absint($by));
1442 1442
 		} else {
1443
-			do_action( 'wpinv_discount_decrease_use_count', $this->get_uses(), $this->get_id(), $this->get_code(), absint( $by ) );
1443
+			do_action('wpinv_discount_decrease_use_count', $this->get_uses(), $this->get_id(), $this->get_code(), absint($by));
1444 1444
 		}
1445 1445
 
1446 1446
 		// Return the number of times the discount has been used.
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 	 * @param float $amount
1465 1465
 	 * @return float
1466 1466
 	 */
1467
-	public function get_discounted_amount( $amount ) {
1467
+	public function get_discounted_amount($amount) {
1468 1468
 
1469 1469
 		// Convert amount to float.
1470 1470
 		$amount = (float) $amount;
@@ -1472,29 +1472,29 @@  discard block
 block discarded – undo
1472 1472
 		// Get discount amount.
1473 1473
 		$discount_amount = $this->get_amount();
1474 1474
 
1475
-		if ( empty( $discount_amount ) ) {
1475
+		if (empty($discount_amount)) {
1476 1476
 			return 0;
1477 1477
 		}
1478 1478
 
1479 1479
 		// Format the amount.
1480
-		$discount_amount = floatval( wpinv_sanitize_amount( $discount_amount ) );
1480
+		$discount_amount = floatval(wpinv_sanitize_amount($discount_amount));
1481 1481
 		
1482 1482
 		// If this is a percentage discount.
1483
-		if ( $this->is_type( 'percent' ) ) {
1484
-            $discount_amount = $amount * ( $discount_amount / 100 );
1483
+		if ($this->is_type('percent')) {
1484
+            $discount_amount = $amount * ($discount_amount / 100);
1485 1485
 		}
1486 1486
 
1487 1487
 		// Discount can not be less than zero...
1488
-		if ( $discount_amount < 0 ) {
1488
+		if ($discount_amount < 0) {
1489 1489
 			$discount_amount = 0;
1490 1490
 		}
1491 1491
 
1492 1492
 		// ... or more than the amount.
1493
-		if ( $discount_amount > $amount ) {
1493
+		if ($discount_amount > $amount) {
1494 1494
 			$discount_amount = $amount;
1495 1495
 		}
1496 1496
 
1497
-		return apply_filters( 'wpinv_discount_total_discount_amount', $discount_amount, $amount, $this );
1497
+		return apply_filters('wpinv_discount_total_discount_amount', $discount_amount, $amount, $this);
1498 1498
 	}
1499 1499
 
1500 1500
 }
Please login to merge, or discard this patch.
templates/payment-forms/form.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Make sure that the form is active.
13
-if ( ! $form->is_active() ) {
13
+if (!$form->is_active()) {
14 14
     echo aui()->alert(
15 15
         array(
16 16
             'type'    => 'warning',
17
-            'content' => __( 'This payment form is no longer active', 'invoicing' ),
17
+            'content' => __('This payment form is no longer active', 'invoicing'),
18 18
         )
19 19
     );
20 20
     return;
21 21
 }
22 22
 
23 23
 // Fires before displaying a payment form.
24
-do_action( 'getpaid_before_payment_form', $form );
24
+do_action('getpaid_before_payment_form', $form);
25 25
 ?>
26 26
 
27
-<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>'>
27
+<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>'>
28 28
 
29 29
 
30 30
     <?php
31 31
     
32 32
         // Fires when printing the top of a payment form.
33
-        do_action( 'getpaid_payment_form_top', $form );
33
+        do_action('getpaid_payment_form_top', $form);
34 34
 
35 35
         // And the optional invoice id.
36
-        if ( ! empty( $form->invoice ) ) {
37
-            echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
36
+        if (!empty($form->invoice)) {
37
+            echo getpaid_hidden_field('invoice_id', $form->invoice->get_id());
38 38
         }
39 39
 
40 40
         // We also want to include the form id.
41
-        echo getpaid_hidden_field( 'form_id', $form->get_id() );
41
+        echo getpaid_hidden_field('form_id', $form->get_id());
42 42
 
43 43
         // And an indication that this is a payment form submission.
44
-        echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
44
+        echo getpaid_hidden_field('getpaid_payment_form_submission', '1');
45 45
 
46 46
         // Fires before displaying payment form elements.
47
-        do_action( 'getpaid_payment_form_before_elements', $form );
47
+        do_action('getpaid_payment_form_before_elements', $form);
48 48
 
49 49
         // Display the elements.
50 50
         ?>
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
             <div class="row">
53 53
                 <?php
54 54
 
55
-                    foreach ( $form->get_elements() as $element ) {
55
+                    foreach ($form->get_elements() as $element) {
56 56
 
57
-                        if ( isset( $element['type'] ) ) {
58
-                            $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) );
57
+                        if (isset($element['type'])) {
58
+                            $grid_class = esc_attr(getpaid_get_form_element_grid_class($element));
59 59
                             echo "<div class='$grid_class'>";
60
-                            do_action( 'getpaid_payment_form_element', $element, $form );
61
-                            do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
60
+                            do_action('getpaid_payment_form_element', $element, $form);
61
+                            do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form);
62 62
                             echo "</div>";
63 63
                         }
64 64
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 
71 71
         <?php
72 72
         // Fires after displaying payment form elements.
73
-        do_action( 'getpaid_payment_form_after_elements', $form );
73
+        do_action('getpaid_payment_form_after_elements', $form);
74 74
 
75 75
         echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
76 76
 
77
-        if ( wpinv_current_user_can_manage_invoicing() ) {
77
+        if (wpinv_current_user_can_manage_invoicing()) {
78 78
 
79 79
             edit_post_link(
80
-                __( 'Edit this form.', 'invoicing' ),
80
+                __('Edit this form.', 'invoicing'),
81 81
                 '<small class="form-text text-muted">',
82
-                '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
82
+                '&nbsp;' . __('This is only visible to website administators.', 'invoicing') . '</small>',
83 83
                 $form->get_id(),
84 84
                 'text-danger'
85 85
             );
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;">
93 93
         <div class="spinner-border mx-auto align-self-center text-white" role="status">
94
-            <span class="sr-only"><?php _e( 'Loading...', 'invoicing' );?></span>
94
+            <span class="sr-only"><?php _e('Loading...', 'invoicing'); ?></span>
95 95
         </div>
96 96
     </div>
97 97
 
@@ -100,4 +100,4 @@  discard block
 block discarded – undo
100 100
 <?php
101 101
 
102 102
 // Fires after displaying a payment form.
103
-do_action( 'getpaid_after_payment_form', $form );
103
+do_action('getpaid_after_payment_form', $form);
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     /**
38 38
 	 * Class constructor.
39 39
 	 */
40
-	public function __construct(){
40
+	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
66
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
67
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
70
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
71
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'));
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page'));
64
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
65
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
66
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
67
+		add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages'));
68
+		add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables'));
69
+		add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices'));
70
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'));
71
+		do_action('getpaid_init_admin_hooks', $this);
72 72
 
73 73
     }
74 74
 
@@ -79,38 +79,38 @@  discard block
 block discarded – undo
79 79
 	public function enqeue_scripts() {
80 80
         global $current_screen, $pagenow;
81 81
 
82
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
82
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
83 83
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
84 84
 
85
-        if ( ! empty( $current_screen->post_type ) ) {
85
+        if (!empty($current_screen->post_type)) {
86 86
 			$page = $current_screen->post_type;
87 87
         }
88 88
 
89 89
         // General styles.
90
-        if ( false !== stripos( $page, 'wpi' ) ) {
90
+        if (false !== stripos($page, 'wpi')) {
91 91
 
92 92
             // Styles.
93
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
94
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
95
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
96
-            wp_enqueue_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16' );
93
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
94
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
95
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
96
+            wp_enqueue_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui.min.css', array(), '1.8.16');
97 97
 
98 98
             // Scripts.
99
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
99
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
100 100
 
101
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
102
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-ui-tooltip', 'wp-color-picker', 'jquery-ui-datepicker' ),  $version );
103
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
101
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
102
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-ui-tooltip', 'wp-color-picker', 'jquery-ui-datepicker'), $version);
103
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
104 104
 
105 105
         }
106 106
 
107 107
         // Payment form scripts.
108
-		if ( 'wpi_payment_form' == $page && $editing ) {
108
+		if ('wpi_payment_form' == $page && $editing) {
109 109
             $this->load_payment_form_scripts();
110 110
         }
111 111
 
112
-		if ( $page == 'wpinv-subscriptions' ) {
113
-			wp_enqueue_script( 'postbox' );
112
+		if ($page == 'wpinv-subscriptions') {
113
+			wp_enqueue_script('postbox');
114 114
 		}
115 115
 
116 116
     }
@@ -123,32 +123,32 @@  discard block
 block discarded – undo
123 123
         global $post;
124 124
 
125 125
 		$date_range = array(
126
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
126
+			'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days'
127 127
 		);
128 128
 
129
-		if ( $date_range['period'] == 'custom' ) {
129
+		if ($date_range['period'] == 'custom') {
130 130
 			
131
-			if ( isset( $_GET['from'] ) ) {
132
-				$date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
131
+			if (isset($_GET['from'])) {
132
+				$date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS);
133 133
 			}
134 134
 
135
-			if ( isset( $_GET['to'] ) ) {
136
-				$date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
135
+			if (isset($_GET['to'])) {
136
+				$date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS);
137 137
 			}
138 138
 
139 139
 		}
140 140
 
141 141
         $i18n = array(
142
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
143
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
144
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
145
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
146
-			'rest_root'                 => esc_url_raw( rest_url() ),
142
+            'ajax_url'                  => admin_url('admin-ajax.php'),
143
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
144
+			'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
145
+			'rest_nonce'                => wp_create_nonce('wp_rest'),
146
+			'rest_root'                 => esc_url_raw(rest_url()),
147 147
 			'date_range'                => $date_range,
148
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
149
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
150
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
151
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
148
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
149
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
150
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
151
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
152 152
             'tax'                       => wpinv_tax_amount(),
153 153
             'discount'                  => 0,
154 154
 			'currency_symbol'           => wpinv_currency_symbol(),
@@ -157,36 +157,36 @@  discard block
 block discarded – undo
157 157
             'thousand_sep'              => wpinv_thousands_separator(),
158 158
             'decimal_sep'               => wpinv_decimal_separator(),
159 159
             'decimals'                  => wpinv_decimals(),
160
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
161
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
162
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
163
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
164
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
165
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
166
-            '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' ),
167
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
168
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
169
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
170
-            'action_edit'               => __( 'Edit', 'invoicing' ),
171
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
172
-            'item_description'          => __( 'Item Description', 'invoicing' ),
173
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
174
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
175
-			'searching'                 => __( 'Searching', 'invoicing' ),
176
-			'loading'                   => __( 'Loading...', 'invoicing' ),
160
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
161
+            'status_publish'            => wpinv_status_nicename('publish'),
162
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
163
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
164
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
165
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
166
+            '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'),
167
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
168
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
169
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
170
+            'action_edit'               => __('Edit', 'invoicing'),
171
+            'action_cancel'             => __('Cancel', 'invoicing'),
172
+            'item_description'          => __('Item Description', 'invoicing'),
173
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
174
+            'discount_description'      => __('Discount Description', 'invoicing'),
175
+			'searching'                 => __('Searching', 'invoicing'),
176
+			'loading'                   => __('Loading...', 'invoicing'),
177 177
         );
178 178
 
179
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
179
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
180 180
 
181
-			$invoice              = new WPInv_Invoice( $post );
181
+			$invoice              = new WPInv_Invoice($post);
182 182
 			$i18n['save_invoice'] = sprintf(
183
-				__( 'Save %s', 'invoicing' ),
184
-				ucfirst( $invoice->get_invoice_quote_type() )
183
+				__('Save %s', 'invoicing'),
184
+				ucfirst($invoice->get_invoice_quote_type())
185 185
 			);
186 186
 
187 187
 			$i18n['invoice_description'] = sprintf(
188
-				__( '%s Description', 'invoicing' ),
189
-				ucfirst( $invoice->get_invoice_quote_type() )
188
+				__('%s Description', 'invoicing'),
189
+				ucfirst($invoice->get_invoice_quote_type())
190 190
 			);
191 191
 
192 192
 		}
@@ -200,24 +200,24 @@  discard block
 block discarded – undo
200 200
 	 * @param  string $footer_text
201 201
 	 * @return string
202 202
 	 */
203
-	public function admin_footer_text( $footer_text ) {
203
+	public function admin_footer_text($footer_text) {
204 204
 		global $current_screen;
205 205
 
206
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
206
+		$page = isset($_GET['page']) ? $_GET['page'] : '';
207 207
 
208
-        if ( ! empty( $current_screen->post_type ) ) {
208
+        if (!empty($current_screen->post_type)) {
209 209
 			$page = $current_screen->post_type;
210 210
         }
211 211
 
212 212
         // General styles.
213
-        if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
213
+        if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) {
214 214
 
215 215
 			// Change the footer text
216
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
216
+			if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) {
217 217
 
218
-				$rating_url  = esc_url(
218
+				$rating_url = esc_url(
219 219
 					wp_nonce_url(
220
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
220
+						admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'),
221 221
 						'getpaid-nonce',
222 222
 						'getpaid-nonce'
223 223
 						)
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 				$footer_text = sprintf(
227 227
 					/* translators: %s: five stars */
228
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
228
+					__('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'),
229 229
 					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
230 230
 				);
231 231
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 				$footer_text = sprintf(
235 235
 					/* translators: %s: GetPaid */
236
-					__( 'Thank you for using %s!', 'invoicing' ),
236
+					__('Thank you for using %s!', 'invoicing'),
237 237
 					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
238 238
 				);
239 239
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @since  2.0.0
251 251
 	 */
252 252
 	public function redirect_to_wordpress_rating_page() {
253
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
254
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
253
+		update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1);
254
+		wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post');
255 255
 		exit;
256 256
 	}
257 257
 
@@ -262,30 +262,30 @@  discard block
 block discarded – undo
262 262
 	protected function load_payment_form_scripts() {
263 263
         global $post;
264 264
 
265
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
266
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
267
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
265
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
266
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
267
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
268 268
 
269
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
270
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
269
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
270
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
271 271
 
272 272
 		wp_localize_script(
273 273
             'wpinv-admin-payment-form-script',
274 274
             'wpinvPaymentFormAdmin',
275 275
             array(
276
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
277
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
276
+				'elements'      => wpinv_get_data('payment-form-elements'),
277
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
278 278
 				'currency'      => wpinv_currency_symbol(),
279 279
 				'position'      => wpinv_currency_position(),
280 280
 				'decimals'      => (int) wpinv_decimals(),
281 281
 				'thousands_sep' => wpinv_thousands_separator(),
282 282
 				'decimals_sep'  => wpinv_decimal_separator(),
283
-				'form_items'    => gepaid_get_form_items( $post->ID ),
283
+				'form_items'    => gepaid_get_form_items($post->ID),
284 284
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
285 285
             )
286 286
         );
287 287
 
288
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
288
+        wp_enqueue_script('wpinv-admin-payment-form-script');
289 289
 
290 290
     }
291 291
 
@@ -296,25 +296,25 @@  discard block
 block discarded – undo
296 296
      * @return string
297 297
 	 *
298 298
 	 */
299
-    public function admin_body_class( $classes ) {
299
+    public function admin_body_class($classes) {
300 300
 		global $pagenow, $post, $current_screen;
301 301
 
302 302
 
303
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
303
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
304 304
 
305
-        if ( ! empty( $current_screen->post_type ) ) {
305
+        if (!empty($current_screen->post_type)) {
306 306
 			$page = $current_screen->post_type;
307 307
         }
308 308
 
309
-        if ( false !== stripos( $page, 'wpi' ) ) {
310
-            $classes .= ' wpi-' . sanitize_key( $page );
309
+        if (false !== stripos($page, 'wpi')) {
310
+            $classes .= ' wpi-' . sanitize_key($page);
311 311
         }
312 312
 
313
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
313
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
314 314
             $classes .= ' wpinv-cpt wpinv';
315 315
 		}
316 316
 		
317
-		if ( getpaid_is_invoice_post_type( $page ) ) {
317
+		if (getpaid_is_invoice_post_type($page)) {
318 318
             $classes .= ' getpaid-is-invoice-cpt';
319 319
         }
320 320
 
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
     /**
325 325
 	 * Maybe show the AyeCode Connect Notice.
326 326
 	 */
327
-	public function init_ayecode_connect_helper(){
327
+	public function init_ayecode_connect_helper() {
328 328
 
329 329
         new AyeCode_Connect_Helper(
330 330
             array(
331
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
332
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
333
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
334
-				'connect_button'    => __("Connect Site","invoicing"),
335
-				'connecting_button'    => __("Connecting...","invoicing"),
336
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
337
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
331
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
332
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
333
+				'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
334
+				'connect_button'    => __("Connect Site", "invoicing"),
335
+				'connecting_button'    => __("Connecting...", "invoicing"),
336
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
337
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
338 338
             ),
339
-            array( 'wpi-addons' )
339
+            array('wpi-addons')
340 340
         );
341 341
 
342 342
     }
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public function activation_redirect() {
350 350
 
351
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
351
+		$redirected = get_option('wpinv_redirected_to_settings');
352 352
 
353
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
353
+		if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) {
354 354
 			return;
355 355
 		}
356 356
 
357 357
 		// Bail if activating from network, or bulk
358
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
358
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
359 359
 			return;
360 360
 		}
361 361
 
362
-	    update_option( 'wpinv_redirected_to_settings', 1 );
362
+	    update_option('wpinv_redirected_to_settings', 1);
363 363
 
364
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
364
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
365 365
         exit;
366 366
 
367 367
 	}
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
      */
372 372
     public function maybe_do_admin_action() {
373 373
 
374
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
375
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
376
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
374
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
375
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
376
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
377 377
         }
378 378
 
379 379
     }
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 	 * 
384 384
 	 * @param array $args
385 385
      */
386
-    public function send_customer_invoice( $args ) {
387
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ) );
386
+    public function send_customer_invoice($args) {
387
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']));
388 388
 
389
-		if ( $sent ) {
390
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
389
+		if ($sent) {
390
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
391 391
 		} else {
392
-			$this->show_error( __( 'Could not sent the invoice to the customer', 'invoicing' ) );
392
+			$this->show_error(__('Could not sent the invoice to the customer', 'invoicing'));
393 393
 		}
394 394
 
395
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
395
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
396 396
 		exit;
397 397
 	}
398 398
 
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
 	 * 
402 402
 	 * @param array $args
403 403
      */
404
-    public function send_customer_payment_reminder( $args ) {
405
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
404
+    public function send_customer_payment_reminder($args) {
405
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
406 406
 
407
-		if ( $sent ) {
408
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
407
+		if ($sent) {
408
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
409 409
 		} else {
410
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
410
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
411 411
 		}
412 412
 
413
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
413
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
414 414
 		exit;
415 415
 	}
416 416
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
      */
421 421
     public function admin_reset_tax_rates() {
422 422
 
423
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
424
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
423
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
424
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
425 425
 		exit;
426 426
 
427 427
 	}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
     public function admin_create_missing_pages() {
434 434
 		$installer = new GetPaid_Installer();
435 435
 		$installer->create_pages();
436
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
437
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
436
+		$this->show_success(__('GetPaid pages updated.', 'invoicing'));
437
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
438 438
 		exit;
439 439
 	}
440 440
 
@@ -446,35 +446,35 @@  discard block
 block discarded – undo
446 446
 		global $wpdb;
447 447
 		$installer = new GetPaid_Installer();
448 448
 
449
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
449
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') {
450 450
 			$installer->create_subscriptions_table();
451 451
 
452
-			if ( $wpdb->last_error !== '' ) {
453
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
452
+			if ($wpdb->last_error !== '') {
453
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
454 454
 			}
455 455
 		}
456 456
 
457
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
457
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') {
458 458
 			$installer->create_invoices_table();
459 459
 
460
-			if ( $wpdb->last_error !== '' ) {
461
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
460
+			if ($wpdb->last_error !== '') {
461
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
462 462
 			}
463 463
 		}
464 464
 
465
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
465
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') {
466 466
 			$installer->create_invoice_items_table();
467 467
 
468
-			if ( $wpdb->last_error !== '' ) {
469
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
468
+			if ($wpdb->last_error !== '') {
469
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
470 470
 			}
471 471
 		}
472 472
 
473
-		if ( ! $this->has_notices() ) {
474
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
473
+		if (!$this->has_notices()) {
474
+			$this->show_success(__('Your GetPaid tables have been updated.', 'invoicing'));
475 475
 		}
476 476
 
477
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
477
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
478 478
 		exit;
479 479
 	}
480 480
 
@@ -489,10 +489,10 @@  discard block
 block discarded – undo
489 489
 		$installer->migrate_old_invoices();
490 490
 
491 491
 		// Show an admin message.
492
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
492
+		$this->show_success(__('Your invoices have been migrated.', 'invoicing'));
493 493
 
494 494
 		// Redirect the admin.
495
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
495
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
496 496
 		exit;
497 497
 
498 498
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
      * @return array
505 505
 	 */
506 506
 	public function get_notices() {
507
-		$notices = get_option( 'wpinv_admin_notices' );
508
-        return is_array( $notices ) ? $notices : array();
507
+		$notices = get_option('wpinv_admin_notices');
508
+        return is_array($notices) ? $notices : array();
509 509
 	}
510 510
 
511 511
 	/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
      * @return array
516 516
 	 */
517 517
 	public function has_notices() {
518
-		return count( $this->get_notices() ) > 0;
518
+		return count($this->get_notices()) > 0;
519 519
 	}
520 520
 
521 521
 	/**
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 * @since       1.0.19
526 526
 	 */
527 527
 	public function clear_notices() {
528
-		delete_option( 'wpinv_admin_notices' );
528
+		delete_option('wpinv_admin_notices');
529 529
 	}
530 530
 
531 531
 	/**
@@ -534,16 +534,16 @@  discard block
 block discarded – undo
534 534
 	 * @access      public
535 535
 	 * @since       1.0.19
536 536
 	 */
537
-	public function save_notice( $type, $message ) {
537
+	public function save_notice($type, $message) {
538 538
 		$notices = $this->get_notices();
539 539
 
540
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
541
-			$notices[ $type ] = array();
540
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
541
+			$notices[$type] = array();
542 542
 		}
543 543
 
544
-		$notices[ $type ][] = $message;
544
+		$notices[$type][] = $message;
545 545
 
546
-		update_option( 'wpinv_admin_notices', $notices );
546
+		update_option('wpinv_admin_notices', $notices);
547 547
 	}
548 548
 
549 549
 	/**
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	 * @access      public
554 554
 	 * @since       1.0.19
555 555
 	 */
556
-	public function show_success( $msg ) {
557
-		$this->save_notice( 'success', $msg );
556
+	public function show_success($msg) {
557
+		$this->save_notice('success', $msg);
558 558
 	}
559 559
 
560 560
 	/**
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
 	 * @param       string $msg The message to qeue.
565 565
 	 * @since       1.0.19
566 566
 	 */
567
-	public function show_error( $msg ) {
568
-		$this->save_notice( 'error', $msg );
567
+	public function show_error($msg) {
568
+		$this->save_notice('error', $msg);
569 569
 	}
570 570
 
571 571
 	/**
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 	 * @param       string $msg The message to qeue.
576 576
 	 * @since       1.0.19
577 577
 	 */
578
-	public function show_warning( $msg ) {
579
-		$this->save_notice( 'warning', $msg );
578
+	public function show_warning($msg) {
579
+		$this->save_notice('warning', $msg);
580 580
 	}
581 581
 
582 582
 	/**
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 * @param       string $msg The message to qeue.
587 587
 	 * @since       1.0.19
588 588
 	 */
589
-	public function show_info( $msg ) {
590
-		$this->save_notice( 'info', $msg );
589
+	public function show_info($msg) {
590
+		$this->save_notice('info', $msg);
591 591
 	}
592 592
 
593 593
 	/**
@@ -601,32 +601,32 @@  discard block
 block discarded – undo
601 601
         $notices = $this->get_notices();
602 602
         $this->clear_notices();
603 603
 
604
-		foreach ( $notices as $type => $messages ) {
604
+		foreach ($notices as $type => $messages) {
605 605
 
606
-			if ( ! is_array( $messages ) ) {
606
+			if (!is_array($messages)) {
607 607
 				continue;
608 608
 			}
609 609
 
610
-            $type  = sanitize_key( $type );
611
-			foreach ( $messages as $message ) {
612
-                $message = wp_kses_post( $message );
610
+            $type = sanitize_key($type);
611
+			foreach ($messages as $message) {
612
+                $message = wp_kses_post($message);
613 613
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
614 614
             }
615 615
 
616 616
         }
617 617
 
618
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
618
+		foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) {
619 619
 
620
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
621
-				$url     = esc_url(
620
+			if (!is_numeric(wpinv_get_option($page, false))) {
621
+				$url = esc_url(
622 622
 					wp_nonce_url(
623
-						add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
623
+						add_query_arg('getpaid-admin-action', 'create_missing_pages'),
624 624
 						'getpaid-nonce',
625 625
 						'getpaid-nonce'
626 626
 					)
627 627
 				);
628
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
629
-				$message2 = __( 'Generate Pages', 'invoicing' );
628
+				$message  = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing');
629
+				$message2 = __('Generate Pages', 'invoicing');
630 630
 				echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
631 631
 				break;
632 632
 			}
Please login to merge, or discard this patch.
includes/class-getpaid-invoice-notification-emails.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * This class handles invoice notificaiton emails.
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		$this->invoice_actions = apply_filters(
29 29
 			'getpaid_notification_email_invoice_triggers',
30 30
 			array(
31
-				'getpaid_new_invoice'                   => array( 'new_invoice', 'user_invoice' ),
31
+				'getpaid_new_invoice'                   => array('new_invoice', 'user_invoice'),
32 32
 				'getpaid_invoice_status_wpi-cancelled'  => 'cancelled_invoice',
33 33
 				'getpaid_invoice_status_wpi-failed'     => 'failed_invoice',
34 34
 				'getpaid_invoice_status_wpi-onhold'     => 'onhold_invoice',
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function init_hooks() {
52 52
 
53
-		add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 );
54
-		add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 );
53
+		add_filter('getpaid_get_email_merge_tags', array($this, 'invoice_merge_tags'), 10, 2);
54
+		add_filter('getpaid_invoice_email_recipients', array($this, 'filter_email_recipients'), 10, 2);
55 55
 
56
-		foreach ( $this->invoice_actions as $hook => $email_type ) {
57
-			$this->init_email_type_hook( $hook, $email_type );
56
+		foreach ($this->invoice_actions as $hook => $email_type) {
57
+			$this->init_email_type_hook($hook, $email_type);
58 58
 		}
59 59
 	}
60 60
 
@@ -64,25 +64,25 @@  discard block
 block discarded – undo
64 64
 	 * @param string $hook
65 65
 	 * @param string|array $email_type
66 66
 	 */
67
-	public function init_email_type_hook( $hook, $email_type ) {
67
+	public function init_email_type_hook($hook, $email_type) {
68 68
 
69
-		$email_type = wpinv_parse_list( $email_type );
69
+		$email_type = wpinv_parse_list($email_type);
70 70
 
71
-		foreach ( $email_type as $type ) {
71
+		foreach ($email_type as $type) {
72 72
 
73
-			$email = new GetPaid_Notification_Email( $type );
73
+			$email = new GetPaid_Notification_Email($type);
74 74
 
75 75
 			// Abort if it is not active.
76
-			if ( ! $email->is_active() ) {
76
+			if (!$email->is_active()) {
77 77
 				continue;
78 78
 			}
79 79
 
80
-			if ( method_exists( $this, $type ) ) {
81
-				add_action( $hook, array( $this, $type ), 100, 2 );
80
+			if (method_exists($this, $type)) {
81
+				add_action($hook, array($this, $type), 100, 2);
82 82
 				continue;
83 83
 			}
84 84
 
85
-			do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook );
85
+			do_action('getpaid_invoice_init_email_type_hook', $type, $hook);
86 86
 		}
87 87
 
88 88
 	}
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 	 * @param array $merge_tags
94 94
 	 * @param mixed|WPInv_Invoice|WPInv_Subscription $object
95 95
 	 */
96
-	public function invoice_merge_tags( $merge_tags, $object ) {
96
+	public function invoice_merge_tags($merge_tags, $object) {
97 97
 
98
-		if ( is_a( $object, 'WPInv_Invoice' ) ) {
98
+		if (is_a($object, 'WPInv_Invoice')) {
99 99
 			return array_merge(
100 100
 				$merge_tags,
101
-				$this->get_invoice_merge_tags( $object )
101
+				$this->get_invoice_merge_tags($object)
102 102
 			);
103 103
 		}
104 104
 
105
-		if ( is_a( $object, 'WPInv_Subscription' ) ) {
105
+		if (is_a($object, 'WPInv_Subscription')) {
106 106
 			return array_merge(
107 107
 				$merge_tags,
108
-				$this->get_invoice_merge_tags( $object->get_parent_payment() )
108
+				$this->get_invoice_merge_tags($object->get_parent_payment())
109 109
 			);
110 110
 		}
111 111
 
@@ -119,35 +119,35 @@  discard block
 block discarded – undo
119 119
 	 * @param WPInv_Invoice $invoice
120 120
 	 * @return array
121 121
 	 */
122
-	public function get_invoice_merge_tags( $invoice ) {
122
+	public function get_invoice_merge_tags($invoice) {
123 123
 
124 124
 		// Abort if it does not exist.
125
-		if ( ! $invoice->get_id() ) {
125
+		if (!$invoice->get_id()) {
126 126
 			return array();
127 127
 		}
128 128
 
129 129
 		$merge_tags = array(
130
-			'{name}'                => sanitize_text_field( $invoice->get_user_full_name() ),
131
-			'{full_name}'           => sanitize_text_field( $invoice->get_user_full_name() ),
132
-			'{first_name}'          => sanitize_text_field( $invoice->get_first_name() ),
133
-			'{last_name}'           => sanitize_text_field( $invoice->get_last_name() ),
134
-			'{email}'               => sanitize_email( $invoice->get_email() ),
135
-			'{invoice_number}'      => sanitize_text_field( $invoice->get_number() ),
136
-			'{invoice_currency}'    => sanitize_text_field( $invoice->get_currency() ),
137
-			'{invoice_total}'       => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ),
138
-			'{invoice_link}'        => esc_url( $invoice->get_view_url() ),
139
-			'{invoice_pay_link}'    => esc_url( $invoice->get_checkout_payment_url() ),
140
-			'{invoice_receipt_link}'=> esc_url( $invoice->get_receipt_url() ),
141
-			'{invoice_date}'        => getpaid_format_date_value( $invoice->get_date_created() ),
142
-			'{invoice_due_date}'    => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ),
143
-			'{invoice_quote}'       => sanitize_text_field( strtolower( $invoice->get_label() ) ),
144
-			'{invoice_label}'       => sanitize_text_field( ucfirst( $invoice->get_label() ) ),
145
-			'{invoice_description}' => wp_kses_post( $invoice->get_description() ),
146
-			'{subscription_name}'   => wp_kses_post( $invoice->get_subscription_name() ),
147
-			'{is_was}'              => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ),
130
+			'{name}'                => sanitize_text_field($invoice->get_user_full_name()),
131
+			'{full_name}'           => sanitize_text_field($invoice->get_user_full_name()),
132
+			'{first_name}'          => sanitize_text_field($invoice->get_first_name()),
133
+			'{last_name}'           => sanitize_text_field($invoice->get_last_name()),
134
+			'{email}'               => sanitize_email($invoice->get_email()),
135
+			'{invoice_number}'      => sanitize_text_field($invoice->get_number()),
136
+			'{invoice_currency}'    => sanitize_text_field($invoice->get_currency()),
137
+			'{invoice_total}'       => sanitize_text_field(wpinv_price($invoice->get_total(), $invoice->get_currency())),
138
+			'{invoice_link}'        => esc_url($invoice->get_view_url()),
139
+			'{invoice_pay_link}'    => esc_url($invoice->get_checkout_payment_url()),
140
+			'{invoice_receipt_link}'=> esc_url($invoice->get_receipt_url()),
141
+			'{invoice_date}'        => getpaid_format_date_value($invoice->get_date_created()),
142
+			'{invoice_due_date}'    => getpaid_format_date_value($invoice->get_due_date(), __('on receipt', 'invoicing')),
143
+			'{invoice_quote}'       => sanitize_text_field(strtolower($invoice->get_label())),
144
+			'{invoice_label}'       => sanitize_text_field(ucfirst($invoice->get_label())),
145
+			'{invoice_description}' => wp_kses_post($invoice->get_description()),
146
+			'{subscription_name}'   => wp_kses_post($invoice->get_subscription_name()),
147
+			'{is_was}'              => strtotime($invoice->get_due_date()) < current_time('timestamp') ? __('was', 'invoicing') : __('is', 'invoicing'),
148 148
 		);
149 149
 
150
-		return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice );
150
+		return apply_filters('getpaid_invoice_email_merge_tags', $merge_tags, $invoice);
151 151
 	}
152 152
 
153 153
 	/**
@@ -159,35 +159,35 @@  discard block
 block discarded – undo
159 159
 	 * @param string|array $recipients
160 160
 	 * @param array $extra_args Extra template args.
161 161
 	 */
162
-	public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) {
162
+	public function send_email($invoice, $email, $type, $recipients, $extra_args = array()) {
163 163
 
164
-		do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email );
164
+		do_action('getpaid_before_send_invoice_notification', $type, $invoice, $email);
165 165
 
166 166
 		$mailer     = new GetPaid_Notification_Email_Sender();
167 167
 		$merge_tags = $email->get_merge_tags();
168 168
 
169 169
 		$result = $mailer->send(
170
-			apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ),
171
-			$email->add_merge_tags( $email->get_subject(), $merge_tags ),
172
-			$email->get_content( $merge_tags, $extra_args ),
170
+			apply_filters('getpaid_invoice_email_recipients', wpinv_parse_list($recipients), $email),
171
+			$email->add_merge_tags($email->get_subject(), $merge_tags),
172
+			$email->get_content($merge_tags, $extra_args),
173 173
 			$email->get_attachments()
174 174
 		);
175 175
 
176 176
 		// Maybe send a copy to the admin.
177
-		if ( $email->include_admin_bcc() ) {
177
+		if ($email->include_admin_bcc()) {
178 178
 			$mailer->send(
179 179
 				wpinv_get_admin_email(),
180
-				$email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ),
181
-				$email->get_content( $merge_tags ),
180
+				$email->add_merge_tags($email->get_subject() . __(' - ADMIN BCC COPY', 'invoicing'), $merge_tags),
181
+				$email->get_content($merge_tags),
182 182
 				$email->get_attachments()
183 183
 			);
184 184
 		}
185 185
 
186
-		if ( ! $result ) {
187
-			$invoice->add_note( sprintf( __( 'Failed sending %s notification email.', 'invoicing' ), sanitize_key( $type ) ), false, false, true );
186
+		if (!$result) {
187
+			$invoice->add_note(sprintf(__('Failed sending %s notification email.', 'invoicing'), sanitize_key($type)), false, false, true);
188 188
 		}
189 189
 
190
-		do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email );
190
+		do_action('getpaid_after_send_invoice_notification', $type, $invoice, $email);
191 191
 
192 192
 		return $result;
193 193
 	}
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 * @param array $recipients
199 199
 	 * @param GetPaid_Notification_Email $email
200 200
 	 */
201
-	public function filter_email_recipients( $recipients, $email ) {
201
+	public function filter_email_recipients($recipients, $email) {
202 202
 
203
-		if ( ! $email->is_admin_email() ) {
203
+		if (!$email->is_admin_email()) {
204 204
 			$cc = $email->object->get_email_cc();
205 205
 
206
-			if ( ! empty( $cc ) ) {
207
-				$cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) );
208
-				$recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) );
206
+			if (!empty($cc)) {
207
+				$cc = array_map('sanitize_email', wpinv_parse_list($cc));
208
+				$recipients = array_filter(array_unique(array_merge($recipients, $cc)));
209 209
 			}
210 210
 
211 211
 		}
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 	 *
220 220
 	 * @param WPInv_Invoice $invoice
221 221
 	 */
222
-	public function new_invoice( $invoice ) {
222
+	public function new_invoice($invoice) {
223 223
 
224 224
 		// Only send this email for invoices created via the admin page.
225
-		if ( ! $invoice->is_type( 'invoice' ) || $this->is_payment_form_invoice( $invoice->get_id() ) ) {
225
+		if (!$invoice->is_type('invoice') || $this->is_payment_form_invoice($invoice->get_id())) {
226 226
 			return;
227 227
 		}
228 228
 
229
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
229
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
230 230
 		$recipient = wpinv_get_admin_email();
231 231
 
232
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
232
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
233 233
 
234 234
 	}
235 235
 
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @param WPInv_Invoice $invoice
240 240
 	 */
241
-	public function cancelled_invoice( $invoice ) {
241
+	public function cancelled_invoice($invoice) {
242 242
 
243
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
243
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
244 244
 		$recipient = wpinv_get_admin_email();
245 245
 
246
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
246
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
247 247
 
248 248
 	}
249 249
 
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param WPInv_Invoice $invoice
254 254
 	 */
255
-	public function failed_invoice( $invoice ) {
255
+	public function failed_invoice($invoice) {
256 256
 
257
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
257
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
258 258
 		$recipient = wpinv_get_admin_email();
259 259
 
260
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
260
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
261 261
 
262 262
 	}
263 263
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param WPInv_Invoice $invoice
268 268
 	 */
269
-	public function onhold_invoice( $invoice ) {
269
+	public function onhold_invoice($invoice) {
270 270
 
271
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
271
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
272 272
 		$recipient = $invoice->get_email();
273 273
 
274
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
274
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
275 275
 
276 276
 	}
277 277
 
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @param WPInv_Invoice $invoice
282 282
 	 */
283
-	public function processing_invoice( $invoice ) {
283
+	public function processing_invoice($invoice) {
284 284
 
285
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
285
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
286 286
 		$recipient = $invoice->get_email();
287 287
 
288
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
288
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
289 289
 
290 290
 	}
291 291
 
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @param WPInv_Invoice $invoice
296 296
 	 */
297
-	public function completed_invoice( $invoice ) {
297
+	public function completed_invoice($invoice) {
298 298
 
299 299
 		// (Maybe) abort if it is a renewal invoice.
300
-		if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) {
300
+		if ($invoice->is_renewal() && !wpinv_get_option('email_completed_invoice_renewal_active', false)) {
301 301
 			return;
302 302
 		}
303 303
 
304
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
304
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
305 305
 		$recipient = $invoice->get_email();
306 306
 
307
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
307
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
308 308
 
309 309
 	}
310 310
 
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @param WPInv_Invoice $invoice
315 315
 	 */
316
-	public function refunded_invoice( $invoice ) {
316
+	public function refunded_invoice($invoice) {
317 317
 
318
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
318
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
319 319
 		$recipient = $invoice->get_email();
320 320
 
321
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
321
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
322 322
 
323 323
 	}
324 324
 
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @param WPInv_Invoice $invoice
329 329
 	 */
330
-	public function user_invoice( $invoice ) {
330
+	public function user_invoice($invoice) {
331 331
 
332 332
 		// Only send this email for invoices created via the admin page.
333
-		if ( ! $invoice->is_type( 'invoice' ) || $this->is_payment_form_invoice( $invoice->get_id() ) ) {
333
+		if (!$invoice->is_type('invoice') || $this->is_payment_form_invoice($invoice->get_id())) {
334 334
 			return;
335 335
 		}
336 336
 
337
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
337
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
338 338
 		$recipient = $invoice->get_email();
339 339
 
340
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
340
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient);
341 341
 
342 342
 	}
343 343
 
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 	 * @param int $invoice
348 348
 	 * @return bool
349 349
 	 */
350
-	public function is_payment_form_invoice( $invoice ) {
351
-		return empty( $_GET['getpaid-admin-action'] ) && ( 'payment_form' == get_post_meta( $invoice, 'wpinv_created_via', true ) || 'geodirectory' == get_post_meta( $invoice, 'wpinv_created_via', true ) );
350
+	public function is_payment_form_invoice($invoice) {
351
+		return empty($_GET['getpaid-admin-action']) && ('payment_form' == get_post_meta($invoice, 'wpinv_created_via', true) || 'geodirectory' == get_post_meta($invoice, 'wpinv_created_via', true));
352 352
 	}
353 353
 
354 354
 	/**
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 	 * @param WPInv_Invoice $invoice
358 358
 	 * @param string $note
359 359
 	 */
360
-	public function user_note( $invoice, $note ) {
360
+	public function user_note($invoice, $note) {
361 361
 
362
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
362
+		$email     = new GetPaid_Notification_Email(__FUNCTION__, $invoice);
363 363
 		$recipient = $invoice->get_email();
364 364
 
365
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) );
365
+		return $this->send_email($invoice, $email, __FUNCTION__, $recipient, array('customer_note' => $note));
366 366
 
367 367
 	}
368 368
 
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @param WPInv_Invoice $invoice
373 373
 	 */
374
-	public function force_send_overdue_notice( $invoice ) {
375
-		$email = new GetPaid_Notification_Email( 'overdue', $invoice );
376
-		return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() );
374
+	public function force_send_overdue_notice($invoice) {
375
+		$email = new GetPaid_Notification_Email('overdue', $invoice);
376
+		return $this->send_email($invoice, $email, 'overdue', $invoice->get_email());
377 377
 	}
378 378
 
379 379
 	/**
@@ -384,37 +384,37 @@  discard block
 block discarded – undo
384 384
 	public function overdue() {
385 385
 		global $wpdb;
386 386
 
387
-		$email = new GetPaid_Notification_Email( __FUNCTION__ );
387
+		$email = new GetPaid_Notification_Email(__FUNCTION__);
388 388
 
389 389
 		// Fetch reminder days.
390
-		$reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) );
390
+		$reminder_days = array_unique(wp_parse_id_list($email->get_option('days')));
391 391
 
392 392
 		// Abort if non is set.
393
-		if ( empty( $reminder_days ) ) {
393
+		if (empty($reminder_days)) {
394 394
 			return;
395 395
 		}
396 396
 
397 397
 		// Retrieve date query.
398
-		$date_query = $this->get_date_query( $reminder_days );
398
+		$date_query = $this->get_date_query($reminder_days);
399 399
 
400 400
 		// Invoices table.
401 401
 		$table = $wpdb->prefix . 'getpaid_invoices';
402 402
 
403 403
 		// Fetch invoices.
404
-		$invoices  = $wpdb->get_col(
404
+		$invoices = $wpdb->get_col(
405 405
 			"SELECT posts.ID FROM $wpdb->posts as posts
406 406
 			LEFT JOIN $table as invoices ON invoices.post_id = posts.ID
407 407
 			WHERE posts.post_type = 'wpi_invoice' AND posts.post_status = 'wpi-pending' $date_query");
408 408
 
409
-		foreach ( $invoices as $invoice ) {
409
+		foreach ($invoices as $invoice) {
410 410
 
411 411
 			// Only send this email for invoices created via the admin page.
412
-			if ( ! $this->is_payment_form_invoice( $invoice ) ) {
413
-				$invoice       = new WPInv_Invoice( $invoice );
412
+			if (!$this->is_payment_form_invoice($invoice)) {
413
+				$invoice       = new WPInv_Invoice($invoice);
414 414
 				$email->object = $invoice;
415 415
 
416
-				if ( $invoice->needs_payment() ) {
417
-					$this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() );
416
+				if ($invoice->needs_payment()) {
417
+					$this->send_email($invoice, $email, __FUNCTION__, $invoice->get_email());
418 418
 				}
419 419
 
420 420
 			}
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
 	 * @param array $reminder_days
430 430
 	 * @return string
431 431
 	 */
432
-	public function get_date_query( $reminder_days ) {
432
+	public function get_date_query($reminder_days) {
433 433
 
434 434
 		$date_query = array(
435 435
 			'relation'  => 'OR'
436 436
 		);
437 437
 
438
-		foreach ( $reminder_days as $days ) {
439
-			$date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) );
438
+		foreach ($reminder_days as $days) {
439
+			$date = date_parse(date('Y-m-d', strtotime("-$days days", current_time('timestamp'))));
440 440
 
441 441
 			$date_query[] = array(
442 442
 				'year'  => $date['year'],
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
 		}
448 448
 
449
-		$date_query = new WP_Date_Query( $date_query, 'invoices.due_date' );
449
+		$date_query = new WP_Date_Query($date_query, 'invoices.due_date');
450 450
 
451 451
 		return $date_query->get_sql();
452 452
 
Please login to merge, or discard this patch.