Passed
Pull Request — master (#849)
by
unknown
09:57
created
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 1 patch
Switch Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,110 +9,110 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI {
12
+    class AUI {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * Holds the class instance.
16 16
 	 *
17 17
 	 * @since 1.0.0
18 18
 	 * @var null
19 19
 	 */
20
-	private static $instance = null;
20
+	    private static $instance = null;
21 21
 
22
-	/**
22
+	    /**
23 23
 	 * Holds the current AUI version number.
24 24
 	 *
25 25
 	 * @var string $ver The current version number.
26 26
 	 */
27
-	public static $ver = '0.1.72';
27
+	    public static $ver = '0.1.72';
28 28
 
29
-	public static $options = null;
29
+	    public static $options = null;
30 30
 
31
-	/**
31
+	    /**
32 32
 	 * There can be only one.
33 33
 	 *
34 34
 	 * @since 1.0.0
35 35
 	 * @return AUI|null
36 36
 	 */
37
-	public static function instance() {
38
-		if ( self::$instance == null ) {
39
-			self::$instance = new AUI();
40
-		}
37
+	    public static function instance() {
38
+		    if ( self::$instance == null ) {
39
+			    self::$instance = new AUI();
40
+		    }
41 41
 
42
-		return self::$instance;
43
-	}
42
+		    return self::$instance;
43
+	    }
44 44
 
45
-	/**
45
+	    /**
46 46
 	 * AUI constructor.
47 47
 	 *
48 48
 	 * @since 1.0.0
49 49
 	 */
50
-	private function __construct() {
51
-		if ( function_exists( "__autoload" ) ) {
52
-			spl_autoload_register( "__autoload" );
53
-		}
54
-		spl_autoload_register( array( $this, 'autoload' ) );
50
+	    private function __construct() {
51
+		    if ( function_exists( "__autoload" ) ) {
52
+			    spl_autoload_register( "__autoload" );
53
+		    }
54
+		    spl_autoload_register( array( $this, 'autoload' ) );
55 55
 
56
-		// load options
57
-		self::$options = get_option('aui_options');
58
-	}
56
+		    // load options
57
+		    self::$options = get_option('aui_options');
58
+	    }
59 59
 
60
-	/**
60
+	    /**
61 61
 	 * Autoload any components on the fly.
62 62
 	 *
63 63
 	 * @since 1.0.0
64 64
 	 *
65 65
 	 * @param $classname
66 66
 	 */
67
-	private function autoload( $classname ) {
68
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
69
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
-		if ( $file_path && is_readable( $file_path ) ) {
71
-			include_once( $file_path );
72
-		}
73
-	}
74
-
75
-	/**
67
+	    private function autoload( $classname ) {
68
+		    $class     = str_replace( '_', '-', strtolower( $classname ) );
69
+		    $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
+		    if ( $file_path && is_readable( $file_path ) ) {
71
+			    include_once( $file_path );
72
+		    }
73
+	    }
74
+
75
+	    /**
76 76
 	 * Get the AUI options.
77 77
 	 *
78 78
 	 * @param $option
79 79
 	 *
80 80
 	 * @return string|void
81 81
 	 */
82
-	public function get_option( $option ){
83
-		$result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
-
85
-		if ( ! $result && $option) {
86
-			if( $option == 'color_primary' ){
87
-				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
89
-				$result = AUI_SECONDARY_COLOR;
90
-			}
91
-		}
92
-		return $result;
93
-	}
94
-
95
-	public function render( $items = array(), $echo = false ) {
96
-		$output = '';
97
-
98
-		if ( ! empty( $items ) ) {
99
-			foreach ( $items as $args ) {
100
-				$render = isset( $args['render'] ) ? $args['render'] : '';
101
-				if ( $render && method_exists( __CLASS__, $render ) ) {
102
-					$output .= $this->$render( $args );
103
-				}
104
-			}
105
-		}
106
-
107
-		if ( $echo ) {
108
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109
-		}else{
110
-			return $output;
111
-		}
112
-
113
-	}
114
-
115
-	/**
82
+	    public function get_option( $option ){
83
+		    $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
+
85
+		    if ( ! $result && $option) {
86
+			    if( $option == 'color_primary' ){
87
+				    $result = AUI_PRIMARY_COLOR;
88
+			    }elseif( $option == 'color_secondary' ){
89
+				    $result = AUI_SECONDARY_COLOR;
90
+			    }
91
+		    }
92
+		    return $result;
93
+	    }
94
+
95
+	    public function render( $items = array(), $echo = false ) {
96
+		    $output = '';
97
+
98
+		    if ( ! empty( $items ) ) {
99
+			    foreach ( $items as $args ) {
100
+				    $render = isset( $args['render'] ) ? $args['render'] : '';
101
+				    if ( $render && method_exists( __CLASS__, $render ) ) {
102
+					    $output .= $this->$render( $args );
103
+				    }
104
+			    }
105
+		    }
106
+
107
+		    if ( $echo ) {
108
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109
+		    }else{
110
+			    return $output;
111
+		    }
112
+
113
+	    }
114
+
115
+	    /**
116 116
 	 * Render and return a bootstrap alert component.
117 117
 	 *
118 118
 	 * @since 1.0.0
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return string The rendered component.
124 124
 	 */
125
-	public function alert( $args = array(), $echo = false ) {
126
-		$output = AUI_Component_Alert::get( $args );
125
+	    public function alert( $args = array(), $echo = false ) {
126
+		    $output = AUI_Component_Alert::get( $args );
127 127
 
128
-		if ( $echo ) {
129
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
130
-		}else{
131
-			return $output;
132
-		}
133
-	}
128
+		    if ( $echo ) {
129
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
130
+		    }else{
131
+			    return $output;
132
+		    }
133
+	    }
134 134
 
135
-	/**
135
+	    /**
136 136
 	 * Render and return a bootstrap input component.
137 137
 	 *
138 138
 	 * @since 1.0.0
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string The rendered component.
144 144
 	 */
145
-	public function input( $args = array(), $echo = false ) {
146
-		$output = AUI_Component_Input::input( $args );
145
+	    public function input( $args = array(), $echo = false ) {
146
+		    $output = AUI_Component_Input::input( $args );
147 147
 
148
-		if ( $echo ) {
149
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
150
-		}else{
151
-			return $output;
152
-		}
153
-	}
148
+		    if ( $echo ) {
149
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
150
+		    }else{
151
+			    return $output;
152
+		    }
153
+	    }
154 154
 
155
-	/**
155
+	    /**
156 156
 	 * Render and return a bootstrap textarea component.
157 157
 	 *
158 158
 	 * @since 1.0.0
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string The rendered component.
164 164
 	 */
165
-	public function textarea( $args = array(), $echo = false ) {
166
-		$output = AUI_Component_Input::textarea( $args );
165
+	    public function textarea( $args = array(), $echo = false ) {
166
+		    $output = AUI_Component_Input::textarea( $args );
167 167
 
168
-		if ( $echo ) {
169
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
170
-		}else{
171
-			return $output;
172
-		}
173
-	}
168
+		    if ( $echo ) {
169
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
170
+		    }else{
171
+			    return $output;
172
+		    }
173
+	    }
174 174
 
175
-	/**
175
+	    /**
176 176
 	 * Render and return a bootstrap button component.
177 177
 	 *
178 178
 	 * @since 1.0.0
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return string The rendered component.
184 184
 	 */
185
-	public function button( $args = array(), $echo = false ) {
186
-		$output = AUI_Component_Button::get( $args );
185
+	    public function button( $args = array(), $echo = false ) {
186
+		    $output = AUI_Component_Button::get( $args );
187 187
 
188
-		if ( $echo ) {
189
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
190
-		}else{
191
-			return $output;
192
-		}
193
-	}
188
+		    if ( $echo ) {
189
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
190
+		    }else{
191
+			    return $output;
192
+		    }
193
+	    }
194 194
 
195
-	/**
195
+	    /**
196 196
 	 * Render and return a bootstrap button component.
197 197
 	 *
198 198
 	 * @since 1.0.0
@@ -202,31 +202,31 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return string The rendered component.
204 204
 	 */
205
-	public function badge( $args = array(), $echo = false ) {
206
-		$defaults = array(
207
-			'class' => 'badge badge-primary align-middle',
208
-		);
205
+	    public function badge( $args = array(), $echo = false ) {
206
+		    $defaults = array(
207
+			    'class' => 'badge badge-primary align-middle',
208
+		    );
209 209
 
210
-		// maybe set type.
211
-		if ( empty( $args['href'] ) ) {
212
-			$defaults['type'] = 'badge';
213
-		}
210
+		    // maybe set type.
211
+		    if ( empty( $args['href'] ) ) {
212
+			    $defaults['type'] = 'badge';
213
+		    }
214 214
 
215
-		/**
215
+		    /**
216 216
 		 * Parse incoming $args into an array and merge it with $defaults
217 217
 		 */
218
-		$args = wp_parse_args( $args, $defaults );
218
+		    $args = wp_parse_args( $args, $defaults );
219 219
 
220
-		$output = AUI_Component_Button::get( $args );
220
+		    $output = AUI_Component_Button::get( $args );
221 221
 
222
-		if ( $echo ) {
223
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
224
-		}else{
225
-			return $output;
226
-		}
227
-	}
222
+		    if ( $echo ) {
223
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
224
+		    }else{
225
+			    return $output;
226
+		    }
227
+	    }
228 228
 
229
-	/**
229
+	    /**
230 230
 	 * Render and return a bootstrap dropdown component.
231 231
 	 *
232 232
 	 * @since 1.0.0
@@ -236,17 +236,17 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return string The rendered component.
238 238
 	 */
239
-	public function dropdown( $args = array(), $echo = false ) {
240
-		$output = AUI_Component_Dropdown::get( $args );
239
+	    public function dropdown( $args = array(), $echo = false ) {
240
+		    $output = AUI_Component_Dropdown::get( $args );
241 241
 
242
-		if ( $echo ) {
243
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
244
-		}else{
245
-			return $output;
246
-		}
247
-	}
242
+		    if ( $echo ) {
243
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
244
+		    }else{
245
+			    return $output;
246
+		    }
247
+	    }
248 248
 
249
-	/**
249
+	    /**
250 250
 	 * Render and return a bootstrap select component.
251 251
 	 *
252 252
 	 * @since 1.0.0
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return string The rendered component.
258 258
 	 */
259
-	public function select( $args = array(), $echo = false ) {
260
-		$output = AUI_Component_Input::select( $args );
259
+	    public function select( $args = array(), $echo = false ) {
260
+		    $output = AUI_Component_Input::select( $args );
261 261
 
262
-		if ( $echo ) {
263
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
264
-		}else{
265
-			return $output;
266
-		}
267
-	}
262
+		    if ( $echo ) {
263
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
264
+		    }else{
265
+			    return $output;
266
+		    }
267
+	    }
268 268
 
269
-	/**
269
+	    /**
270 270
 	 * Render and return a bootstrap radio component.
271 271
 	 *
272 272
 	 * @since 1.0.0
@@ -276,17 +276,17 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return string The rendered component.
278 278
 	 */
279
-	public function radio( $args = array(), $echo = false ) {
280
-		$output = AUI_Component_Input::radio( $args );
279
+	    public function radio( $args = array(), $echo = false ) {
280
+		    $output = AUI_Component_Input::radio( $args );
281 281
 
282
-		if ( $echo ) {
283
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
284
-		}else{
285
-			return $output;
286
-		}
287
-	}
282
+		    if ( $echo ) {
283
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
284
+		    }else{
285
+			    return $output;
286
+		    }
287
+	    }
288 288
 
289
-	/**
289
+	    /**
290 290
 	 * Render and return a bootstrap pagination component.
291 291
 	 *
292 292
 	 * @since 1.0.0
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return string The rendered component.
298 298
 	 */
299
-	public function pagination( $args = array(), $echo = false ) {
300
-		$output = AUI_Component_Pagination::get( $args );
301
-
302
-		if ( $echo ) {
303
-			echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
304
-		}else{
305
-			return $output;
306
-		}
307
-	}
299
+	    public function pagination( $args = array(), $echo = false ) {
300
+		    $output = AUI_Component_Pagination::get( $args );
301
+
302
+		    if ( $echo ) {
303
+			    echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
304
+		    }else{
305
+			    return $output;
306
+		    }
307
+	    }
308 308
 
309 309
 }
310 310
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php 1 patch
Switch Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Functionality to convert BS4 to BS5.
4 4
  */
@@ -13,77 +13,77 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @return array|mixed|string|string[]
15 15
  */
16
-function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
17
-	global $aui_bs5;
16
+    function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) {
17
+	    global $aui_bs5;
18 18
 
19
-	if ( $aui_bs5 ) {
20
-		$convert = array(
21
-			'"ml-' => '"ms-',
22
-			'"mr-' => '"me-',
23
-			'"pl-' => '"ps-',
24
-			'"pr-' => '"pe-',
25
-			"'ml-" => "'ms-",
26
-			"'mr-" => "'me-",
27
-			"'pl-" => "'ps-",
28
-			"'pr-" => "'pe-",
29
-			' ml-' => ' ms-',
30
-			' mr-' => ' me-',
31
-			' pl-' => ' ps-',
32
-			' pr-' => ' pe-',
33
-			'.ml-' => '.ms-',
34
-			'.mr-' => '.me-',
35
-			'.pl-' => '.ps-',
36
-			'.pr-' => '.pe-',
37
-			' form-row' => ' row',
38
-			' embed-responsive-item' => '',
39
-			' embed-responsive' => ' ratio',
40
-			'-1by1'    => '-1x1',
41
-			'-4by3'    => '-4x3',
42
-			'-16by9'    => '-16x9',
43
-			'-21by9'    => '-21x9',
44
-			'geodir-lightbox-image' => 'aui-lightbox-image',
45
-			'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
-			' badge-'   => ' text-bg-',
47
-			'form-group'   => 'mb-3',
48
-			'custom-select'   => 'form-select',
49
-			'float-left'   => 'float-start',
50
-			'float-right'   => 'float-end',
51
-			'text-left'    => 'text-start',
52
-			'text-sm-left'    => 'text-sm-start',
53
-			'text-md-left'    => 'text-md-start',
54
-			'text-lg-left'    => 'text-lg-start',
55
-			'text-right'    => 'text-end',
56
-			'text-sm-right'    => 'text-sm-end',
57
-			'text-md-right'    => 'text-md-end',
58
-			'text-lg-right'    => 'text-lg-end',
59
-			'border-right'    => 'border-end',
60
-			'border-left'    => 'border-start',
61
-			'font-weight-'  => 'fw-',
62
-			'btn-block'     => 'w-100',
63
-			'rounded-left'  => 'rounded-start',
64
-			'rounded-right'  => 'rounded-end',
65
-			'font-italic' => 'fst-italic',
19
+	    if ( $aui_bs5 ) {
20
+		    $convert = array(
21
+			    '"ml-' => '"ms-',
22
+			    '"mr-' => '"me-',
23
+			    '"pl-' => '"ps-',
24
+			    '"pr-' => '"pe-',
25
+			    "'ml-" => "'ms-",
26
+			    "'mr-" => "'me-",
27
+			    "'pl-" => "'ps-",
28
+			    "'pr-" => "'pe-",
29
+			    ' ml-' => ' ms-',
30
+			    ' mr-' => ' me-',
31
+			    ' pl-' => ' ps-',
32
+			    ' pr-' => ' pe-',
33
+			    '.ml-' => '.ms-',
34
+			    '.mr-' => '.me-',
35
+			    '.pl-' => '.ps-',
36
+			    '.pr-' => '.pe-',
37
+			    ' form-row' => ' row',
38
+			    ' embed-responsive-item' => '',
39
+			    ' embed-responsive' => ' ratio',
40
+			    '-1by1'    => '-1x1',
41
+			    '-4by3'    => '-4x3',
42
+			    '-16by9'    => '-16x9',
43
+			    '-21by9'    => '-21x9',
44
+			    'geodir-lightbox-image' => 'aui-lightbox-image',
45
+			    'geodir-lightbox-iframe' => 'aui-lightbox-iframe',
46
+			    ' badge-'   => ' text-bg-',
47
+			    'form-group'   => 'mb-3',
48
+			    'custom-select'   => 'form-select',
49
+			    'float-left'   => 'float-start',
50
+			    'float-right'   => 'float-end',
51
+			    'text-left'    => 'text-start',
52
+			    'text-sm-left'    => 'text-sm-start',
53
+			    'text-md-left'    => 'text-md-start',
54
+			    'text-lg-left'    => 'text-lg-start',
55
+			    'text-right'    => 'text-end',
56
+			    'text-sm-right'    => 'text-sm-end',
57
+			    'text-md-right'    => 'text-md-end',
58
+			    'text-lg-right'    => 'text-lg-end',
59
+			    'border-right'    => 'border-end',
60
+			    'border-left'    => 'border-start',
61
+			    'font-weight-'  => 'fw-',
62
+			    'btn-block'     => 'w-100',
63
+			    'rounded-left'  => 'rounded-start',
64
+			    'rounded-right'  => 'rounded-end',
65
+			    'font-italic' => 'fst-italic',
66 66
 
67
-//			'custom-control custom-checkbox'    => 'form-check',
68
-			// data
69
-			' data-toggle=' => ' data-bs-toggle=',
70
-			'data-ride=' => 'data-bs-ride=',
71
-			'data-controlnav=' => 'data-bs-controlnav=',
72
-			'data-slide='   => 'data-bs-slide=',
73
-			'data-slide-to=' => 'data-bs-slide-to=',
74
-			'data-target='  => 'data-bs-target=',
75
-			'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
-			'class="close"' => 'class="btn-close"',
77
-			'<span aria-hidden="true">&times;</span>' => '',
78
-		);
79
-		$output  = str_replace(
80
-			array_keys( $convert ),
81
-			array_values( $convert ),
82
-			$output
83
-		);
84
-	}
67
+    //			'custom-control custom-checkbox'    => 'form-check',
68
+			    // data
69
+			    ' data-toggle=' => ' data-bs-toggle=',
70
+			    'data-ride=' => 'data-bs-ride=',
71
+			    'data-controlnav=' => 'data-bs-controlnav=',
72
+			    'data-slide='   => 'data-bs-slide=',
73
+			    'data-slide-to=' => 'data-bs-slide-to=',
74
+			    'data-target='  => 'data-bs-target=',
75
+			    'data-dismiss="modal"'  => 'data-bs-dismiss="modal"',
76
+			    'class="close"' => 'class="btn-close"',
77
+			    '<span aria-hidden="true">&times;</span>' => '',
78
+		    );
79
+		    $output  = str_replace(
80
+			    array_keys( $convert ),
81
+			    array_values( $convert ),
82
+			    $output
83
+		    );
84
+	    }
85 85
 
86
-	return $output;
86
+	    return $output;
87 87
 }
88 88
 
89
-add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
89
+    add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this
Please login to merge, or discard this patch.
wp-ayecode-ui/includes/components/class-aui-component-pagination.php 1 patch
Switch Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,114 +9,114 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI_Component_Pagination {
12
+    class AUI_Component_Pagination {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * Build the component.
16 16
 	 *
17 17
 	 * @param array $args
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get( $args = array() ) {
22
-		global $wp_query, $aui_bs5;
23
-
24
-		$defaults = array(
25
-			'class'              => '',
26
-			'mid_size'           => 2,
27
-			'prev_text'          => '<i class="fas fa-chevron-left"></i>',
28
-			'next_text'          => '<i class="fas fa-chevron-right"></i>',
29
-			'screen_reader_text' => __( 'Posts navigation', 'ayecode-connect' ),
30
-			'before_paging'      => '',
31
-			'after_paging'       => '',
32
-			'type'               => 'array',
33
-			'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1,
34
-			'links'              => array(), // an array of links if using custom links, this includes the a tag.
35
-			'rounded_style'      => false,
36
-			'custom_next_text'   => '', // Custom next page text
37
-			'custom_prev_text'   => '', // Custom prev page text
38
-		);
39
-
40
-		/**
21
+	    public static function get( $args = array() ) {
22
+		    global $wp_query, $aui_bs5;
23
+
24
+		    $defaults = array(
25
+			    'class'              => '',
26
+			    'mid_size'           => 2,
27
+			    'prev_text'          => '<i class="fas fa-chevron-left"></i>',
28
+			    'next_text'          => '<i class="fas fa-chevron-right"></i>',
29
+			    'screen_reader_text' => __( 'Posts navigation', 'ayecode-connect' ),
30
+			    'before_paging'      => '',
31
+			    'after_paging'       => '',
32
+			    'type'               => 'array',
33
+			    'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1,
34
+			    'links'              => array(), // an array of links if using custom links, this includes the a tag.
35
+			    'rounded_style'      => false,
36
+			    'custom_next_text'   => '', // Custom next page text
37
+			    'custom_prev_text'   => '', // Custom prev page text
38
+		    );
39
+
40
+		    /**
41 41
 		 * Parse incoming $args into an array and merge it with $defaults
42 42
 		 */
43
-		$args = wp_parse_args( $args, $defaults );
44
-
45
-		$output = '';
46
-
47
-		// Don't print empty markup if there's only one page.
48
-		if ( $args['total'] > 1 ) {
49
-			// Set up paginated links.
50
-			$links = !empty(  $args['links'] ) ? $args['links'] :  paginate_links( $args );
51
-
52
-			$class = !empty($args['class']) ? $args['class'] : '';
53
-
54
-			$custom_prev_link = '';
55
-			$custom_next_link = '';
56
-
57
-			// make the output bootstrap ready
58
-			$links_html = "<ul class='pagination m-0 p-0 $class'>";
59
-			if ( ! empty( $links ) ) {
60
-				foreach ( $links as $link ) {
61
-					$_link = $link;
62
-
63
-					if ( $aui_bs5 ) {
64
-						$link_class = $args['rounded_style'] ? 'page-link badge rounded-pill border-0 mx-1 fs-base text-dark link-primary' : 'page-link';
65
-						$link_class_active = $args['rounded_style'] ? ' current active fw-bold badge rounded-pill' : ' current active';
66
-						$links_html .= "<li class='page-item mx-0'>";
67
-						$link = str_replace( array( "page-numbers", " current" ), array( $link_class, $link_class_active ), $link );
68
-						$link = str_replace( 'text-dark link-primary current', 'current', $link );
69
-						$links_html .=  $link;
70
-						$links_html .= "</li>";
71
-					} else {
72
-						$active = strpos( $link, 'current' ) !== false ? 'active' : '';
73
-						$links_html .= "<li class='page-item $active'>";
74
-						$links_html .= str_replace( "page-numbers", "page-link", $link );
75
-						$links_html .= "</li>";
76
-					}
77
-
78
-					if ( strpos( $_link, 'next page-numbers' ) || strpos( $_link, 'prev page-numbers' ) ) {
79
-						$link = str_replace( array( "page-numbers", " current" ), array( 'btn btn-outline-primary rounded' . ( $args['rounded_style'] ? '-pill' : '' ) . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill' ), $_link );
80
-						$link = str_replace( 'text-dark link-primary current', 'current', $link );
81
-
82
-						if ( strpos( $_link, 'next page-numbers' ) && ! empty( $args['custom_next_text'] ) ) {
83
-							$custom_next_link = str_replace( $args['next_text'], $args['custom_next_text'], $link );
84
-						} else if ( strpos( $_link, 'prev page-numbers' ) && ! empty( $args['custom_prev_text'] ) ) {
85
-							$custom_prev_link = str_replace( $args['prev_text'], $args['custom_prev_text'], $link );
86
-						}
87
-					}
88
-				}
89
-			}
90
-			$links_html .= "</ul>";
91
-
92
-			if ( $links ) {
93
-				$output .= '<section class="px-0 py-2 w-100">';
94
-				$output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
95
-				$output .= '</section>';
96
-			}
97
-
98
-			$output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
99
-			$output = str_replace( "nav-links", "aui-nav-links", $output );
100
-		}
101
-
102
-		if ( $output ) {
103
-			if ( $custom_next_link || $custom_prev_link ) {
104
-				$total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
105
-				$current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
106
-
107
-				$output = '<div class="row d-flex align-items-center justify-content-between"><div class="col text-start">' . $custom_prev_link . '</div><div class="col text-center d-none d-md-block">' . $output . '</div><div class="col text-center d-md-none">' . $current . '/' . $args['total'] . '</div><div class="col text-end">' . $custom_next_link . '</div></div>';
108
-			}
109
-
110
-			if ( ! empty( $args['before_paging'] ) ) {
111
-				$output = $args['before_paging'] . $output;
112
-			}
113
-
114
-			if ( ! empty( $args['after_paging'] ) ) {
115
-				$output = $output . $args['after_paging'];
116
-			}
117
-		}
118
-
119
-		return $output;
120
-	}
43
+		    $args = wp_parse_args( $args, $defaults );
44
+
45
+		    $output = '';
46
+
47
+		    // Don't print empty markup if there's only one page.
48
+		    if ( $args['total'] > 1 ) {
49
+			    // Set up paginated links.
50
+			    $links = !empty(  $args['links'] ) ? $args['links'] :  paginate_links( $args );
51
+
52
+			    $class = !empty($args['class']) ? $args['class'] : '';
53
+
54
+			    $custom_prev_link = '';
55
+			    $custom_next_link = '';
56
+
57
+			    // make the output bootstrap ready
58
+			    $links_html = "<ul class='pagination m-0 p-0 $class'>";
59
+			    if ( ! empty( $links ) ) {
60
+				    foreach ( $links as $link ) {
61
+					    $_link = $link;
62
+
63
+					    if ( $aui_bs5 ) {
64
+						    $link_class = $args['rounded_style'] ? 'page-link badge rounded-pill border-0 mx-1 fs-base text-dark link-primary' : 'page-link';
65
+						    $link_class_active = $args['rounded_style'] ? ' current active fw-bold badge rounded-pill' : ' current active';
66
+						    $links_html .= "<li class='page-item mx-0'>";
67
+						    $link = str_replace( array( "page-numbers", " current" ), array( $link_class, $link_class_active ), $link );
68
+						    $link = str_replace( 'text-dark link-primary current', 'current', $link );
69
+						    $links_html .=  $link;
70
+						    $links_html .= "</li>";
71
+					    } else {
72
+						    $active = strpos( $link, 'current' ) !== false ? 'active' : '';
73
+						    $links_html .= "<li class='page-item $active'>";
74
+						    $links_html .= str_replace( "page-numbers", "page-link", $link );
75
+						    $links_html .= "</li>";
76
+					    }
77
+
78
+					    if ( strpos( $_link, 'next page-numbers' ) || strpos( $_link, 'prev page-numbers' ) ) {
79
+						    $link = str_replace( array( "page-numbers", " current" ), array( 'btn btn-outline-primary rounded' . ( $args['rounded_style'] ? '-pill' : '' ) . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill' ), $_link );
80
+						    $link = str_replace( 'text-dark link-primary current', 'current', $link );
81
+
82
+						    if ( strpos( $_link, 'next page-numbers' ) && ! empty( $args['custom_next_text'] ) ) {
83
+							    $custom_next_link = str_replace( $args['next_text'], $args['custom_next_text'], $link );
84
+						    } else if ( strpos( $_link, 'prev page-numbers' ) && ! empty( $args['custom_prev_text'] ) ) {
85
+							    $custom_prev_link = str_replace( $args['prev_text'], $args['custom_prev_text'], $link );
86
+						    }
87
+					    }
88
+				    }
89
+			    }
90
+			    $links_html .= "</ul>";
91
+
92
+			    if ( $links ) {
93
+				    $output .= '<section class="px-0 py-2 w-100">';
94
+				    $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
95
+				    $output .= '</section>';
96
+			    }
97
+
98
+			    $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
99
+			    $output = str_replace( "nav-links", "aui-nav-links", $output );
100
+		    }
101
+
102
+		    if ( $output ) {
103
+			    if ( $custom_next_link || $custom_prev_link ) {
104
+				    $total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
105
+				    $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
106
+
107
+				    $output = '<div class="row d-flex align-items-center justify-content-between"><div class="col text-start">' . $custom_prev_link . '</div><div class="col text-center d-none d-md-block">' . $output . '</div><div class="col text-center d-md-none">' . $current . '/' . $args['total'] . '</div><div class="col text-end">' . $custom_next_link . '</div></div>';
108
+			    }
109
+
110
+			    if ( ! empty( $args['before_paging'] ) ) {
111
+				    $output = $args['before_paging'] . $output;
112
+			    }
113
+
114
+			    if ( ! empty( $args['after_paging'] ) ) {
115
+				    $output = $output . $args['after_paging'];
116
+			    }
117
+		    }
118
+
119
+		    return $output;
120
+	    }
121 121
 
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-dropdown.php 1 patch
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,64 +9,64 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI_Component_Dropdown {
12
+    class AUI_Component_Dropdown {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * Build the component.
16 16
 	 *
17 17
 	 * @param array $args
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'button',
24
-			'href'       => '#',
25
-			'class'      => 'btn btn-primary dropdown-toggle',
26
-			'wrapper_class' => '',
27
-			'dropdown_menu_class' => '',
28
-			'id'         => '',
29
-			'title'      => '',
30
-			'value'      => '',
31
-			'content'    => '',
32
-			'icon'       => '',
33
-			'hover_content' => '',
34
-			'hover_icon'    => '',
35
-			'data-toggle'   => 'dropdown',
36
-			'aria-haspopup' => 'true',
37
-			'aria-expanded' => 'false',
38
-			'dropdown_menu'          => '', // unescaped html menu (non-preferred way)
39
-			'dropdown_items'          => array(), // array of AUI calls
21
+	    public static function get($args = array()){
22
+		    $defaults = array(
23
+			    'type'       => 'button',
24
+			    'href'       => '#',
25
+			    'class'      => 'btn btn-primary dropdown-toggle',
26
+			    'wrapper_class' => '',
27
+			    'dropdown_menu_class' => '',
28
+			    'id'         => '',
29
+			    'title'      => '',
30
+			    'value'      => '',
31
+			    'content'    => '',
32
+			    'icon'       => '',
33
+			    'hover_content' => '',
34
+			    'hover_icon'    => '',
35
+			    'data-toggle'   => 'dropdown',
36
+			    'aria-haspopup' => 'true',
37
+			    'aria-expanded' => 'false',
38
+			    'dropdown_menu'          => '', // unescaped html menu (non-preferred way)
39
+			    'dropdown_items'          => array(), // array of AUI calls
40 40
 
41
-		);
41
+		    );
42 42
 
43
-		/**
43
+		    /**
44 44
 		 * Parse incoming $args into an array and merge it with $defaults
45 45
 		 */
46
-		$args   = wp_parse_args( $args, $defaults );
47
-		$output = '';
48
-		if ( ! empty( $args['type'] ) ) {
49
-			// wrapper open
50
-			$output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">';
46
+		    $args   = wp_parse_args( $args, $defaults );
47
+		    $output = '';
48
+		    if ( ! empty( $args['type'] ) ) {
49
+			    // wrapper open
50
+			    $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">';
51 51
 
52
-			// button part
53
-			$output .= aui()->button($args);
52
+			    // button part
53
+			    $output .= aui()->button($args);
54 54
 
55
-			// dropdown-menu
56
-			if(!empty($args['dropdown_menu'])){
57
-				$output .= $args['dropdown_menu'];
58
-			}elseif(!empty($args['dropdown_items'])){
59
-				$output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
60
-				$output .= aui()->render($args['dropdown_items']);
61
-				$output .= '</div>';
62
-			}
55
+			    // dropdown-menu
56
+			    if(!empty($args['dropdown_menu'])){
57
+				    $output .= $args['dropdown_menu'];
58
+			    }elseif(!empty($args['dropdown_items'])){
59
+				    $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
60
+				    $output .= aui()->render($args['dropdown_items']);
61
+				    $output .= '</div>';
62
+			    }
63 63
 
64
-			// wrapper close
65
-			$output .= '</div>';
64
+			    // wrapper close
65
+			    $output .= '</div>';
66 66
 
67
-		}
67
+		    }
68 68
 
69
-		return $output;
70
-	}
69
+		    return $output;
70
+	    }
71 71
 
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-alert.php 1 patch
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,89 +9,89 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI_Component_Alert {
12
+    class AUI_Component_Alert {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * Build the component.
16 16
 	 * 
17 17
 	 * @param array $args
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
22
-		global $aui_bs5;
23
-		$defaults = array(
24
-			'type'       => 'info',
25
-			'class'      => '',
26
-			'icon' => '',
27
-			'heading'    => '',
28
-			'content'    => '',
29
-			'footer'     => '',
30
-			'dismissible'=> false,
31
-			'data'       => '',
32
-		);
33
-
34
-		/**
21
+	    public static function get($args = array()){
22
+		    global $aui_bs5;
23
+		    $defaults = array(
24
+			    'type'       => 'info',
25
+			    'class'      => '',
26
+			    'icon' => '',
27
+			    'heading'    => '',
28
+			    'content'    => '',
29
+			    'footer'     => '',
30
+			    'dismissible'=> false,
31
+			    'data'       => '',
32
+		    );
33
+
34
+		    /**
35 35
 		 * Parse incoming $args into an array and merge it with $defaults
36 36
 		 */
37
-		$args   = wp_parse_args( $args, $defaults );
38
-		$output = '';
39
-		if ( ! empty( $args['content'] ) ) {
40
-			$type = sanitize_html_class( $args['type'] );
41
-			if($type=='error'){$type='danger';}
42
-			$icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : '';
43
-
44
-			// set default icon
45
-			if(!$icon && $args['icon']!==false && $type){
46
-				if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
47
-				elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
48
-				elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
49
-				elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
50
-			}
51
-
52
-			$data = '';
53
-			$class = !empty($args['class']) ? esc_attr($args['class']) : '';
54
-			if($args['dismissible']){$class .= " alert-dismissible fade show";}
55
-
56
-			// open
57
-			$output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>';
58
-
59
-			// heading
60
-			if ( ! empty( $args['heading'] ) ) {
61
-				$output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>';
62
-			}
63
-
64
-			// icon
65
-			if ( ! empty( $icon) ) {
66
-				$output .= $icon." ";
67
-			}
68
-
69
-			// content
70
-			$output .= $args['content'];
71
-
72
-			// dismissible
73
-			if($args['dismissible']){
74
-
75
-				if ( $aui_bs5 ) {
76
-					$output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>';
77
-				}else{
78
-					$output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
79
-					$output .= '<span aria-hidden="true">&times;</span>';
80
-					$output .= '</button>';
81
-				}
82
-			}
83
-
84
-			// footer
85
-			if ( ! empty( $args['footer'] ) ) {
86
-				$output .= '<hr>';
87
-				$output .= '<p class="mb-0">' . $args['footer'] . '</p>';
88
-			}
89
-
90
-			// close
91
-			$output .= '</div>';
92
-		}
93
-
94
-		return $output;
95
-	}
37
+		    $args   = wp_parse_args( $args, $defaults );
38
+		    $output = '';
39
+		    if ( ! empty( $args['content'] ) ) {
40
+			    $type = sanitize_html_class( $args['type'] );
41
+			    if($type=='error'){$type='danger';}
42
+			    $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : '';
43
+
44
+			    // set default icon
45
+			    if(!$icon && $args['icon']!==false && $type){
46
+				    if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
47
+				    elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
48
+				    elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
49
+				    elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
50
+			    }
51
+
52
+			    $data = '';
53
+			    $class = !empty($args['class']) ? esc_attr($args['class']) : '';
54
+			    if($args['dismissible']){$class .= " alert-dismissible fade show";}
55
+
56
+			    // open
57
+			    $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>';
58
+
59
+			    // heading
60
+			    if ( ! empty( $args['heading'] ) ) {
61
+				    $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>';
62
+			    }
63
+
64
+			    // icon
65
+			    if ( ! empty( $icon) ) {
66
+				    $output .= $icon." ";
67
+			    }
68
+
69
+			    // content
70
+			    $output .= $args['content'];
71
+
72
+			    // dismissible
73
+			    if($args['dismissible']){
74
+
75
+				    if ( $aui_bs5 ) {
76
+					    $output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>';
77
+				    }else{
78
+					    $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
79
+					    $output .= '<span aria-hidden="true">&times;</span>';
80
+					    $output .= '</button>';
81
+				    }
82
+			    }
83
+
84
+			    // footer
85
+			    if ( ! empty( $args['footer'] ) ) {
86
+				    $output .= '<hr>';
87
+				    $output .= '<p class="mb-0">' . $args['footer'] . '</p>';
88
+			    }
89
+
90
+			    // close
91
+			    $output .= '</div>';
92
+		    }
93
+
94
+		    return $output;
95
+	    }
96 96
 
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-button.php 1 patch
Switch Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,145 +9,145 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI_Component_Button {
12
+    class AUI_Component_Button {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * Build the component.
16 16
 	 *
17 17
 	 * @param array $args
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'a', // a, button, badge
24
-			'href'       => '#',
25
-			'new_window' => false,
26
-			'class'      => 'btn btn-primary',
27
-			'id'         => '',
28
-			'title'      => '',
29
-			'value'      => '',
30
-			'content'    => '',
31
-			'icon'       => '',
32
-			'hover_content' => '',
33
-			'hover_icon'    => '',
34
-			'new_line_after' => true,
35
-			'no_wrap'    => true,
36
-			'onclick'    => '',
37
-			'style'  => '',
38
-			'extra_attributes'  => array(), // an array of extra attributes
39
-			'icon_extra_attributes'  => array() // an array of icon extra attributes
40
-		);
41
-
42
-		/**
21
+	    public static function get($args = array()){
22
+		    $defaults = array(
23
+			    'type'       => 'a', // a, button, badge
24
+			    'href'       => '#',
25
+			    'new_window' => false,
26
+			    'class'      => 'btn btn-primary',
27
+			    'id'         => '',
28
+			    'title'      => '',
29
+			    'value'      => '',
30
+			    'content'    => '',
31
+			    'icon'       => '',
32
+			    'hover_content' => '',
33
+			    'hover_icon'    => '',
34
+			    'new_line_after' => true,
35
+			    'no_wrap'    => true,
36
+			    'onclick'    => '',
37
+			    'style'  => '',
38
+			    'extra_attributes'  => array(), // an array of extra attributes
39
+			    'icon_extra_attributes'  => array() // an array of icon extra attributes
40
+		    );
41
+
42
+		    /**
43 43
 		 * Parse incoming $args into an array and merge it with $defaults
44 44
 		 */
45
-		$args   = wp_parse_args( $args, $defaults );
46
-		$output = '';
47
-		if ( ! empty( $args['type'] ) ) {
48
-			$type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
49
-
50
-			// open/type
51
-			if($type=='a'){
52
-				$new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
53
-				$output .= '<a href="' . $args['href'] . '"'.$new_window;
54
-			}elseif($type=='badge'){
55
-				$output .= '<span ';
56
-			}else{
57
-				$output .= '<button type="' . $type . '" ';
58
-			}
59
-
60
-			// name
61
-			if(!empty($args['name'])){
62
-				$output .= AUI_Component_Helper::name($args['name']);
63
-			}
64
-
65
-			// id
66
-			if(!empty($args['id'])){
67
-				$output .= AUI_Component_Helper::id($args['id']);
68
-			}
69
-
70
-			// title
71
-			if(!empty($args['title'])){
72
-				$output .= AUI_Component_Helper::title($args['title']);
73
-			}
74
-
75
-			// value
76
-			if(!empty($args['value'])){
77
-				$output .= AUI_Component_Helper::value($args['value']);
78
-			}
79
-
80
-			// class
81
-			$class = !empty($args['class']) ? $args['class'] : '';
82
-			$output .= AUI_Component_Helper::class_attr($class);
45
+		    $args   = wp_parse_args( $args, $defaults );
46
+		    $output = '';
47
+		    if ( ! empty( $args['type'] ) ) {
48
+			    $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
49
+
50
+			    // open/type
51
+			    if($type=='a'){
52
+				    $new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
53
+				    $output .= '<a href="' . $args['href'] . '"'.$new_window;
54
+			    }elseif($type=='badge'){
55
+				    $output .= '<span ';
56
+			    }else{
57
+				    $output .= '<button type="' . $type . '" ';
58
+			    }
59
+
60
+			    // name
61
+			    if(!empty($args['name'])){
62
+				    $output .= AUI_Component_Helper::name($args['name']);
63
+			    }
64
+
65
+			    // id
66
+			    if(!empty($args['id'])){
67
+				    $output .= AUI_Component_Helper::id($args['id']);
68
+			    }
69
+
70
+			    // title
71
+			    if(!empty($args['title'])){
72
+				    $output .= AUI_Component_Helper::title($args['title']);
73
+			    }
74
+
75
+			    // value
76
+			    if(!empty($args['value'])){
77
+				    $output .= AUI_Component_Helper::value($args['value']);
78
+			    }
79
+
80
+			    // class
81
+			    $class = !empty($args['class']) ? $args['class'] : '';
82
+			    $output .= AUI_Component_Helper::class_attr($class);
83 83
 			
84
-			// data-attributes
85
-			$output .= AUI_Component_Helper::data_attributes($args);
84
+			    // data-attributes
85
+			    $output .= AUI_Component_Helper::data_attributes($args);
86 86
 
87
-			// aria-attributes
88
-			$output .= AUI_Component_Helper::aria_attributes($args);
87
+			    // aria-attributes
88
+			    $output .= AUI_Component_Helper::aria_attributes($args);
89 89
 
90
-			// extra attributes
91
-			if(!empty($args['extra_attributes'])){
92
-				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
93
-			}
90
+			    // extra attributes
91
+			    if(!empty($args['extra_attributes'])){
92
+				    $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
93
+			    }
94 94
 
95
-			// onclick, we don't escape this
96
-			if(!empty($args['onclick'])){
97
-				$output .= ' onclick="'.$args['onclick'].'" ';
98
-			}
95
+			    // onclick, we don't escape this
96
+			    if(!empty($args['onclick'])){
97
+				    $output .= ' onclick="'.$args['onclick'].'" ';
98
+			    }
99 99
 
100
-			// style, we don't escape this
101
-			if(!empty($args['style'])){
102
-				$output .= ' style="'.$args['style'].'" ';
103
-			}
100
+			    // style, we don't escape this
101
+			    if(!empty($args['style'])){
102
+				    $output .= ' style="'.$args['style'].'" ';
103
+			    }
104 104
 
105
-			// close opening tag
106
-			$output .= ' >';
105
+			    // close opening tag
106
+			    $output .= ' >';
107 107
 
108 108
 
109
-			// hover content
110
-			$hover_content = false;
111
-			if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
112
-				$output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
113
-				$hover_content = true;
114
-			}
109
+			    // hover content
110
+			    $hover_content = false;
111
+			    if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
112
+				    $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
113
+				    $hover_content = true;
114
+			    }
115 115
 			
116
-			// content
117
-			if($hover_content){$output .= "<span class='hover-content-original'>";}
118
-			if(!empty($args['content']) || !empty($args['icon'])){
119
-				$output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content'];
120
-			}
121
-			if($hover_content){$output .= "</span>";}
116
+			    // content
117
+			    if($hover_content){$output .= "<span class='hover-content-original'>";}
118
+			    if(!empty($args['content']) || !empty($args['icon'])){
119
+				    $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content'];
120
+			    }
121
+			    if($hover_content){$output .= "</span>";}
122 122
 					
123 123
 
124 124
 
125
-			// close
126
-			if($type=='a'){
127
-				$output .= '</a>';
128
-			}elseif($type=='badge'){
129
-				$output .= '</span>';
130
-			}else{
131
-				$output .= '</button>';
132
-			}
125
+			    // close
126
+			    if($type=='a'){
127
+				    $output .= '</a>';
128
+			    }elseif($type=='badge'){
129
+				    $output .= '</span>';
130
+			    }else{
131
+				    $output .= '</button>';
132
+			    }
133 133
 
134
-			// maybe new line after?  This adds better spacing between buttons.
135
-			if(!empty($args['new_line_after'])){
136
-				$output .= PHP_EOL;
137
-			}
134
+			    // maybe new line after?  This adds better spacing between buttons.
135
+			    if(!empty($args['new_line_after'])){
136
+				    $output .= PHP_EOL;
137
+			    }
138 138
 
139 139
 
140
-			// wrap
141
-			if(!$args['no_wrap']){
142
-				$output = AUI_Component_Input::wrap(array(
143
-					'content' => $output,
144
-				));
145
-			}
140
+			    // wrap
141
+			    if(!$args['no_wrap']){
142
+				    $output = AUI_Component_Input::wrap(array(
143
+					    'content' => $output,
144
+				    ));
145
+			    }
146 146
 
147 147
 
148
-		}
148
+		    }
149 149
 
150
-		return $output;
151
-	}
150
+		    return $output;
151
+	    }
152 152
 
153 153
 }
154 154
\ No newline at end of file
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-helper.php 1 patch
Switch Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
3
+    if ( ! defined( 'ABSPATH' ) ) {
4
+	    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @since 1.0.0
11 11
  */
12
-class AUI_Component_Helper {
12
+    class AUI_Component_Helper {
13 13
 
14
-	/**
14
+	    /**
15 15
 	 * A component helper for generating a input name.
16 16
 	 *
17 17
 	 * @param $text
@@ -19,152 +19,152 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return string
21 21
 	 */
22
-	public static function name( $text, $multiple = false ) {
23
-		$output = '';
22
+	    public static function name( $text, $multiple = false ) {
23
+		    $output = '';
24 24
 
25
-		if ( $text ) {
26
-			$is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : '';
27
-			$output      = ' name="' . esc_attr( $text ) . $is_multiple . '" ';
28
-		}
25
+		    if ( $text ) {
26
+			    $is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : '';
27
+			    $output      = ' name="' . esc_attr( $text ) . $is_multiple . '" ';
28
+		    }
29 29
 
30
-		return $output;
31
-	}
30
+		    return $output;
31
+	    }
32 32
 
33
-	/**
33
+	    /**
34 34
 	 * A component helper for generating a item id.
35 35
 	 *
36 36
 	 * @param $text string The text to be used as the value.
37 37
 	 *
38 38
 	 * @return string The sanitized item.
39 39
 	 */
40
-	public static function id( $text ) {
41
-		$output = '';
40
+	    public static function id( $text ) {
41
+		    $output = '';
42 42
 
43
-		if ( $text ) {
44
-			$output = ' id="' . sanitize_html_class( $text ) . '" ';
45
-		}
43
+		    if ( $text ) {
44
+			    $output = ' id="' . sanitize_html_class( $text ) . '" ';
45
+		    }
46 46
 
47
-		return $output;
48
-	}
47
+		    return $output;
48
+	    }
49 49
 
50
-	/**
50
+	    /**
51 51
 	 * A component helper for generating a item title.
52 52
 	 *
53 53
 	 * @param $text string The text to be used as the value.
54 54
 	 *
55 55
 	 * @return string The sanitized item.
56 56
 	 */
57
-	public static function title( $text ) {
58
-		$output = '';
57
+	    public static function title( $text ) {
58
+		    $output = '';
59 59
 
60
-		if ( $text ) {
61
-			$output = ' title="' . esc_attr( $text ) . '" ';
62
-		}
60
+		    if ( $text ) {
61
+			    $output = ' title="' . esc_attr( $text ) . '" ';
62
+		    }
63 63
 
64
-		return $output;
65
-	}
64
+		    return $output;
65
+	    }
66 66
 
67
-	/**
67
+	    /**
68 68
 	 * A component helper for generating a item value.
69 69
 	 *
70 70
 	 * @param $text string The text to be used as the value.
71 71
 	 *
72 72
 	 * @return string The sanitized item.
73 73
 	 */
74
-	public static function value( $text ) {
75
-		$output = '';
74
+	    public static function value( $text ) {
75
+		    $output = '';
76 76
 
77
-		if ( $text !== null && $text !== false ) {
78
-			$output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" ';
79
-		}
77
+		    if ( $text !== null && $text !== false ) {
78
+			    $output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" ';
79
+		    }
80 80
 
81
-		return $output;
82
-	}
81
+		    return $output;
82
+	    }
83 83
 
84
-	/**
84
+	    /**
85 85
 	 * A component helper for generating a item class attribute.
86 86
 	 *
87 87
 	 * @param $text string The text to be used as the value.
88 88
 	 *
89 89
 	 * @return string The sanitized item.
90 90
 	 */
91
-	public static function class_attr( $text ) {
92
-		$output = '';
91
+	    public static function class_attr( $text ) {
92
+		    $output = '';
93 93
 
94
-		if ( $text ) {
95
-			$classes = self::esc_classes( $text );
96
-			if ( ! empty( $classes ) ) {
97
-				$output = ' class="' . $classes . '" ';
98
-			}
99
-		}
94
+		    if ( $text ) {
95
+			    $classes = self::esc_classes( $text );
96
+			    if ( ! empty( $classes ) ) {
97
+				    $output = ' class="' . $classes . '" ';
98
+			    }
99
+		    }
100 100
 
101
-		return $output;
102
-	}
101
+		    return $output;
102
+	    }
103 103
 
104
-	/**
104
+	    /**
105 105
 	 * Escape a string of classes.
106 106
 	 *
107 107
 	 * @param $text
108 108
 	 *
109 109
 	 * @return string
110 110
 	 */
111
-	public static function esc_classes( $text ) {
112
-		$output = '';
111
+	    public static function esc_classes( $text ) {
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 );
120
-			}
121
-		}
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
+			    }
121
+		    }
122 122
 
123
-		return $output;
123
+		    return $output;
124 124
 
125
-	}
125
+	    }
126 126
 
127
-	/**
127
+	    /**
128 128
 	 * @param $args
129 129
 	 *
130 130
 	 * @return string
131 131
 	 */
132
-	public static function data_attributes( $args ) {
133
-		$output = '';
132
+	    public static function data_attributes( $args ) {
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 ) . '" ';
140
-				}
141
-			}
142
-		}
137
+			    foreach ( $args as $key => $val ) {
138
+				    if ( substr( $key, 0, 5 ) === "data-" ) {
139
+					    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
140
+				    }
141
+			    }
142
+		    }
143 143
 
144
-		return $output;
145
-	}
144
+		    return $output;
145
+	    }
146 146
 
147
-	/**
147
+	    /**
148 148
 	 * @param $args
149 149
 	 *
150 150
 	 * @return string
151 151
 	 */
152
-	public static function aria_attributes( $args ) {
153
-		$output = '';
152
+	    public static function aria_attributes( $args ) {
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 ) . '" ';
160
-				}
161
-			}
162
-		}
157
+			    foreach ( $args as $key => $val ) {
158
+				    if ( substr( $key, 0, 5 ) === "aria-" ) {
159
+					    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
160
+				    }
161
+			    }
162
+		    }
163 163
 
164
-		return $output;
165
-	}
164
+		    return $output;
165
+	    }
166 166
 
167
-	/**
167
+	    /**
168 168
 	 * Build a font awesome icon from a class.
169 169
 	 *
170 170
 	 * @param $class
@@ -173,91 +173,91 @@  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() ) {
177
-		$output = '';
178
-
179
-		if ( $class ) {
180
-			$classes = self::esc_classes( $class );
181
-			if ( ! empty( $classes ) ) {
182
-				$output = '<i class="' . $classes . '" ';
183
-				// extra attributes
184
-				if ( ! empty( $extra_attributes ) ) {
185
-					$output .= AUI_Component_Helper::extra_attributes( $extra_attributes );
186
-				}
187
-				$output .= '></i>';
188
-				if ( $space_after ) {
189
-					$output .= " ";
190
-				}
191
-			}
192
-		}
193
-
194
-		return $output;
195
-	}
196
-
197
-	/**
176
+	    public static function icon( $class, $space_after = false, $extra_attributes = array() ) {
177
+		    $output = '';
178
+
179
+		    if ( $class ) {
180
+			    $classes = self::esc_classes( $class );
181
+			    if ( ! empty( $classes ) ) {
182
+				    $output = '<i class="' . $classes . '" ';
183
+				    // extra attributes
184
+				    if ( ! empty( $extra_attributes ) ) {
185
+					    $output .= AUI_Component_Helper::extra_attributes( $extra_attributes );
186
+				    }
187
+				    $output .= '></i>';
188
+				    if ( $space_after ) {
189
+					    $output .= " ";
190
+				    }
191
+			    }
192
+		    }
193
+
194
+		    return $output;
195
+	    }
196
+
197
+	    /**
198 198
 	 * @param $args
199 199
 	 *
200 200
 	 * @return string
201 201
 	 */
202
-	public static function extra_attributes( $args ) {
203
-		$output = '';
202
+	    public static function extra_attributes( $args ) {
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 ) . '" ';
210
-				}
211
-			} else {
212
-				$output .= ' ' . $args . ' ';
213
-			}
207
+			    if ( is_array( $args ) ) {
208
+				    foreach ( $args as $key => $val ) {
209
+					    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
210
+				    }
211
+			    } else {
212
+				    $output .= ' ' . $args . ' ';
213
+			    }
214 214
 
215
-		}
215
+		    }
216 216
 
217
-		return $output;
218
-	}
217
+		    return $output;
218
+	    }
219 219
 
220
-	/**
220
+	    /**
221 221
 	 * @param $args
222 222
 	 *
223 223
 	 * @return string
224 224
 	 */
225
-	public static function help_text( $text ) {
226
-		$output = '';
225
+	    public static function help_text( $text ) {
226
+		    $output = '';
227 227
 
228
-		if ( $text ) {
229
-			$output .= '<small class="form-text text-muted d-block">' . wp_kses_post( $text ) . '</small>';
230
-		}
228
+		    if ( $text ) {
229
+			    $output .= '<small class="form-text text-muted d-block">' . wp_kses_post( $text ) . '</small>';
230
+		    }
231 231
 
232 232
 
233
-		return $output;
234
-	}
233
+		    return $output;
234
+	    }
235 235
 
236
-	/**
236
+	    /**
237 237
 	 * Replace element require context with JS.
238 238
 	 *
239 239
 	 * @param $input
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(
248
-			"jQuery(form).find('[data-argument=\"",
249
-			"\"]').find('input,select,textarea').val()",
250
-			"\"]').find('input:checked').val()",
251
-		), $input ) );
247
+		    $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
248
+			    "jQuery(form).find('[data-argument=\"",
249
+			    "\"]').find('input,select,textarea').val()",
250
+			    "\"]').find('input:checked').val()",
251
+		    ), $input ) );
252 252
 
253
-		if ( $output ) {
254
-			$output = ' data-element-require="' . $output . '" ';
255
-		}
253
+		    if ( $output ) {
254
+			    $output = ' data-element-require="' . $output . '" ';
255
+		    }
256 256
 
257
-		return $output;
258
-	}
257
+		    return $output;
258
+	    }
259 259
 
260
-	/**
260
+	    /**
261 261
 	 * Navigates through an array, object, or scalar, and removes slashes from the values.
262 262
 	 *
263 263
 	 * @since 0.1.41
@@ -267,24 +267,24 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return mixed Stripped value.
269 269
 	 */
270
-	public static function sanitize_html_field( $value, $input = array() ) {
271
-		$original = $value;
272
-
273
-		if ( is_array( $value ) ) {
274
-			foreach ( $value as $index => $item ) {
275
-				$value[ $index ] = self::_sanitize_html_field( $value, $input );
276
-			}
277
-		} elseif ( is_object( $value ) ) {
278
-			$object_vars = get_object_vars( $value );
279
-
280
-			foreach ( $object_vars as $property_name => $property_value ) {
281
-				$value->$property_name = self::_sanitize_html_field( $property_value, $input );
282
-			}
283
-		} else {
284
-			$value = self::_sanitize_html_field( $value, $input );
285
-		}
286
-
287
-		/**
270
+	    public static function sanitize_html_field( $value, $input = array() ) {
271
+		    $original = $value;
272
+
273
+		    if ( is_array( $value ) ) {
274
+			    foreach ( $value as $index => $item ) {
275
+				    $value[ $index ] = self::_sanitize_html_field( $value, $input );
276
+			    }
277
+		    } elseif ( is_object( $value ) ) {
278
+			    $object_vars = get_object_vars( $value );
279
+
280
+			    foreach ( $object_vars as $property_name => $property_value ) {
281
+				    $value->$property_name = self::_sanitize_html_field( $property_value, $input );
282
+			    }
283
+		    } else {
284
+			    $value = self::_sanitize_html_field( $value, $input );
285
+		    }
286
+
287
+		    /**
288 288
 		 * Filters content and keeps only allowable HTML elements.
289 289
 		 *
290 290
 		 * @since 0.1.41
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 		 * @param string|array $value Original content without filter.
294 294
 		 * @param array $input Input Field.
295 295
 		 */
296
-		return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
297
-	}
296
+		    return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
297
+	    }
298 298
 
299
-	/**
299
+	    /**
300 300
 	 * Filters content and keeps only allowable HTML elements.
301 301
 	 *
302 302
 	 * This function makes sure that only the allowed HTML element names, attribute
@@ -316,25 +316,25 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @return string Filtered content with only allowed HTML elements.
318 318
 	 */
319
-	public static function _sanitize_html_field( $value, $input = array() ) {
320
-		if ( $value === '' ) {
321
-			return $value;
322
-		}
319
+	    public static function _sanitize_html_field( $value, $input = array() ) {
320
+		    if ( $value === '' ) {
321
+			    return $value;
322
+		    }
323 323
 
324
-		$allowed_html = self::kses_allowed_html( 'post', $input );
324
+		    $allowed_html = self::kses_allowed_html( 'post', $input );
325 325
 
326
-		if ( ! is_array( $allowed_html ) ) {
327
-			$allowed_html = wp_kses_allowed_html( 'post' );
328
-		}
326
+		    if ( ! is_array( $allowed_html ) ) {
327
+			    $allowed_html = wp_kses_allowed_html( 'post' );
328
+		    }
329 329
 
330
-		$filtered = trim( wp_unslash( $value ) );
331
-		$filtered = wp_kses( $filtered, $allowed_html );
332
-		$filtered = balanceTags( $filtered ); // Balances tags
330
+		    $filtered = trim( wp_unslash( $value ) );
331
+		    $filtered = wp_kses( $filtered, $allowed_html );
332
+		    $filtered = balanceTags( $filtered ); // Balances tags
333 333
 
334
-		return $filtered;
335
-	}
334
+		    return $filtered;
335
+	    }
336 336
 
337
-	/**
337
+	    /**
338 338
 	 * Returns an array of allowed HTML tags and attributes for a given context.
339 339
 	 *
340 340
 	 * @since 0.1.41
@@ -346,32 +346,32 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @return array Array of allowed HTML tags and their allowed attributes.
348 348
 	 */
349
-	public static function kses_allowed_html( $context = 'post', $input = array() ) {
350
-		$allowed_html = wp_kses_allowed_html( $context );
351
-
352
-		if ( is_array( $allowed_html ) ) {
353
-			// <iframe>
354
-			if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
355
-				$allowed_html['iframe'] = array(
356
-					'class'           => true,
357
-					'id'              => true,
358
-					'src'             => true,
359
-					'width'           => true,
360
-					'height'          => true,
361
-					'frameborder'     => true,
362
-					'marginwidth'     => true,
363
-					'marginheight'    => true,
364
-					'scrolling'       => true,
365
-					'style'           => true,
366
-					'title'           => true,
367
-					'allow'           => true,
368
-					'allowfullscreen' => true,
369
-					'data-*'          => true,
370
-				);
371
-			}
372
-		}
373
-
374
-		/**
349
+	    public static function kses_allowed_html( $context = 'post', $input = array() ) {
350
+		    $allowed_html = wp_kses_allowed_html( $context );
351
+
352
+		    if ( is_array( $allowed_html ) ) {
353
+			    // <iframe>
354
+			    if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
355
+				    $allowed_html['iframe'] = array(
356
+					    'class'           => true,
357
+					    'id'              => true,
358
+					    'src'             => true,
359
+					    'width'           => true,
360
+					    'height'          => true,
361
+					    'frameborder'     => true,
362
+					    'marginwidth'     => true,
363
+					    'marginheight'    => true,
364
+					    'scrolling'       => true,
365
+					    'style'           => true,
366
+					    'title'           => true,
367
+					    'allow'           => true,
368
+					    'allowfullscreen' => true,
369
+					    'data-*'          => true,
370
+				    );
371
+			    }
372
+		    }
373
+
374
+		    /**
375 375
 		 * Filters the allowed html tags.
376 376
 		 *
377 377
 		 * @since 0.1.41
@@ -380,30 +380,30 @@  discard block
 block discarded – undo
380 380
 		 * @param @param string|array $context The context for which to retrieve tags.
381 381
 		 * @param array $input Input field.
382 382
 		 */
383
-		return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
384
-	}
383
+		    return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
384
+	    }
385 385
 
386
-	public static function get_column_class( $label_number = 2, $type = 'label' ) {
386
+	    public static function get_column_class( $label_number = 2, $type = 'label' ) {
387 387
 
388
-		$class = '';
388
+		    $class = '';
389 389
 
390
-		// set default if empty
391
-		if( $label_number === '' ){
392
-			$label_number = 2;
393
-		}
390
+		    // set default if empty
391
+		    if( $label_number === '' ){
392
+			    $label_number = 2;
393
+		    }
394 394
 
395
-		if ( $label_number && $label_number < 12 && $label_number > 0 ) {
396
-			if ( $type == 'label' ) {
397
-				$class = 'col-sm-' . absint( $label_number );
398
-			} elseif ( $type == 'input' ) {
399
-				$class = 'col-sm-' . ( 12 - absint( $label_number ) );
400
-			}
401
-		}
395
+		    if ( $label_number && $label_number < 12 && $label_number > 0 ) {
396
+			    if ( $type == 'label' ) {
397
+				    $class = 'col-sm-' . absint( $label_number );
398
+			    } elseif ( $type == 'input' ) {
399
+				    $class = 'col-sm-' . ( 12 - absint( $label_number ) );
400
+			    }
401
+		    }
402 402
 
403
-		return $class;
404
-	}
403
+		    return $class;
404
+	    }
405 405
 
406
-	/**
406
+	    /**
407 407
 	 * Sanitizes a multiline string from user input or from the database.
408 408
 	 *
409 409
 	 * Emulate the WP native sanitize_textarea_field function in a %%variable%% safe way.
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 	 * @param string $str String to sanitize.
416 416
 	 * @return string Sanitized string.
417 417
 	 */
418
-	public static function sanitize_textarea_field( $str ) {
419
-		$filtered = self::_sanitize_text_fields( $str, true );
418
+	    public static function sanitize_textarea_field( $str ) {
419
+		    $filtered = self::_sanitize_text_fields( $str, true );
420 420
 
421
-		/**
421
+		    /**
422 422
 		 * Filters a sanitized textarea field string.
423 423
 		 *
424 424
 		 * @see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 		 * @param string $filtered The sanitized string.
427 427
 		 * @param string $str      The string prior to being sanitized.
428 428
 		 */
429
-		return apply_filters( 'sanitize_textarea_field', $filtered, $str );
430
-	}
429
+		    return apply_filters( 'sanitize_textarea_field', $filtered, $str );
430
+	    }
431 431
 
432
-	/**
432
+	    /**
433 433
 	 * Internal helper function to sanitize a string from user input or from the db.
434 434
 	 *
435 435
 	 * @since 0.1.66
@@ -439,42 +439,42 @@  discard block
 block discarded – undo
439 439
 	 * @param bool   $keep_newlines Optional. Whether to keep newlines. Default: false.
440 440
 	 * @return string Sanitized string.
441 441
 	 */
442
-	public static function _sanitize_text_fields( $str, $keep_newlines = false ) {
443
-		if ( is_object( $str ) || is_array( $str ) ) {
444
-			return '';
445
-		}
446
-
447
-		$str = (string) $str;
448
-
449
-		$filtered = wp_check_invalid_utf8( $str );
450
-
451
-		if ( strpos( $filtered, '<' ) !== false ) {
452
-			$filtered = wp_pre_kses_less_than( $filtered );
453
-			// This will strip extra whitespace for us.
454
-			$filtered = wp_strip_all_tags( $filtered, false );
455
-
456
-			// Use HTML entities in a special case to make sure no later
457
-			// newline stripping stage could lead to a functional tag.
458
-			$filtered = str_replace( "<\n", "&lt;\n", $filtered );
459
-		}
460
-
461
-		if ( ! $keep_newlines ) {
462
-			$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
463
-		}
464
-		$filtered = trim( $filtered );
465
-
466
-		$found = false;
467
-		while ( preg_match( '`[^%](%[a-f0-9]{2})`i', $filtered, $match ) ) {
468
-			$filtered = str_replace( $match[1], '', $filtered );
469
-			$found = true;
470
-		}
471
-		unset( $match );
472
-
473
-		if ( $found ) {
474
-			// Strip out the whitespace that may now exist after removing the octets.
475
-			$filtered = trim( preg_replace( '` +`', ' ', $filtered ) );
476
-		}
477
-
478
-		return $filtered;
479
-	}
442
+	    public static function _sanitize_text_fields( $str, $keep_newlines = false ) {
443
+		    if ( is_object( $str ) || is_array( $str ) ) {
444
+			    return '';
445
+		    }
446
+
447
+		    $str = (string) $str;
448
+
449
+		    $filtered = wp_check_invalid_utf8( $str );
450
+
451
+		    if ( strpos( $filtered, '<' ) !== false ) {
452
+			    $filtered = wp_pre_kses_less_than( $filtered );
453
+			    // This will strip extra whitespace for us.
454
+			    $filtered = wp_strip_all_tags( $filtered, false );
455
+
456
+			    // Use HTML entities in a special case to make sure no later
457
+			    // newline stripping stage could lead to a functional tag.
458
+			    $filtered = str_replace( "<\n", "&lt;\n", $filtered );
459
+		    }
460
+
461
+		    if ( ! $keep_newlines ) {
462
+			    $filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
463
+		    }
464
+		    $filtered = trim( $filtered );
465
+
466
+		    $found = false;
467
+		    while ( preg_match( '`[^%](%[a-f0-9]{2})`i', $filtered, $match ) ) {
468
+			    $filtered = str_replace( $match[1], '', $filtered );
469
+			    $found = true;
470
+		    }
471
+		    unset( $match );
472
+
473
+		    if ( $found ) {
474
+			    // Strip out the whitespace that may now exist after removing the octets.
475
+			    $filtered = trim( preg_replace( '` +`', ' ', $filtered ) );
476
+		    }
477
+
478
+		    return $filtered;
479
+	    }
480 480
 }
481 481
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/subscriptions.php 1 patch
Switch Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -577,40 +577,40 @@  discard block
 block discarded – undo
577 577
 
578 578
 								switch ( $key ) {
579 579
 
580
-								case 'total':
581
-										echo '<strong>';
582
-										wpinv_the_price( $payment->get_total(), $payment->get_currency() );
583
-										echo '</strong>';
584
-									break;
585
-
586
-								case 'relationship':
587
-										echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' );
588
-									break;
589
-
590
-								case 'date':
591
-									echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) );
592
-									break;
593
-
594
-								case 'status':
595
-										$status = $payment->get_status_nicename();
596
-										if ( is_admin() ) {
597
-										$status = $payment->get_status_label_html();
598
-										}
599
-
600
-										echo wp_kses_post( $status );
601
-									break;
602
-
603
-								case 'invoice':
604
-										if ( ! is_admin() ) {
605
-											$link = $payment->get_view_url();
606
-										} else {
607
-											$link = get_edit_post_link( $payment->get_id() );
608
-										}
609
-
610
-										$invoice = esc_html( $payment->get_number() );
611
-
612
-										echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" );
613
-									break;
580
+								    case 'total':
581
+										    echo '<strong>';
582
+										    wpinv_the_price( $payment->get_total(), $payment->get_currency() );
583
+										    echo '</strong>';
584
+									    break;
585
+
586
+								    case 'relationship':
587
+										    echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' );
588
+									    break;
589
+
590
+								    case 'date':
591
+									    echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) );
592
+									    break;
593
+
594
+								    case 'status':
595
+										    $status = $payment->get_status_nicename();
596
+										    if ( is_admin() ) {
597
+										    $status = $payment->get_status_label_html();
598
+										    }
599
+
600
+										    echo wp_kses_post( $status );
601
+									    break;
602
+
603
+								    case 'invoice':
604
+										    if ( ! is_admin() ) {
605
+											    $link = $payment->get_view_url();
606
+										    } else {
607
+											    $link = get_edit_post_link( $payment->get_id() );
608
+										    }
609
+
610
+										    $invoice = esc_html( $payment->get_number() );
611
+
612
+										    echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" );
613
+									    break;
614 614
 										}
615 615
 
616 616
 								echo '</td>';
@@ -705,37 +705,37 @@  discard block
 block discarded – undo
705 705
 
706 706
 								switch ( $key ) {
707 707
 
708
-								case 'item_name':
709
-										$item_name = get_the_title( $subscription_group_item['item_id'] );
710
-										$item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name;
708
+								    case 'item_name':
709
+										    $item_name = get_the_title( $subscription_group_item['item_id'] );
710
+										    $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name;
711 711
 
712
-										if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) {
713
-										echo esc_html( $item_name );
714
-										} else {
715
-										printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] );
716
-											}
712
+										    if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) {
713
+										    echo esc_html( $item_name );
714
+										    } else {
715
+										    printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] );
716
+											    }
717 717
 
718
-									break;
718
+									    break;
719 719
 
720
-								case 'price':
721
-									wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() );
722
-									break;
720
+								    case 'price':
721
+									    wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() );
722
+									    break;
723 723
 
724
-								case 'tax':
725
-									wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() );
726
-									break;
724
+								    case 'tax':
725
+									    wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() );
726
+									    break;
727 727
 
728
-								case 'discount':
729
-									wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() );
730
-									break;
728
+								    case 'discount':
729
+									    wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() );
730
+									    break;
731 731
 
732
-								case 'initial':
733
-									wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() );
734
-									break;
732
+								    case 'initial':
733
+									    wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() );
734
+									    break;
735 735
 
736
-								case 'recurring':
737
-										echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' );
738
-									break;
736
+								    case 'recurring':
737
+										    echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' );
738
+									    break;
739 739
 
740 740
 										}
741 741
 
@@ -759,29 +759,29 @@  discard block
 block discarded – undo
759 759
 
760 760
 								switch ( $key ) {
761 761
 
762
-								case 'item_name':
763
-										echo esc_html( $subscription_group_fee['name'] );
764
-									break;
762
+								    case 'item_name':
763
+										    echo esc_html( $subscription_group_fee['name'] );
764
+									    break;
765 765
 
766
-								case 'price':
767
-									wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
768
-									break;
766
+								    case 'price':
767
+									    wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
768
+									    break;
769 769
 
770
-								case 'tax':
771
-									echo '&mdash;';
772
-									break;
770
+								    case 'tax':
771
+									    echo '&mdash;';
772
+									    break;
773 773
 
774
-								case 'discount':
775
-										echo '&mdash;';
776
-									break;
774
+								    case 'discount':
775
+										    echo '&mdash;';
776
+									    break;
777 777
 
778
-								case 'initial':
779
-									wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
780
-									break;
778
+								    case 'initial':
779
+									    wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
780
+									    break;
781 781
 
782
-								case 'recurring':
783
-										echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' );
784
-									break;
782
+								    case 'recurring':
783
+										    echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' );
784
+									    break;
785 785
 
786 786
 										}
787 787
 
@@ -886,39 +886,39 @@  discard block
 block discarded – undo
886 886
 
887 887
 								switch ( $key ) {
888 888
 
889
-								case 'status':
890
-										echo wp_kses_post( $_suscription->get_status_label_html() );
891
-									break;
892
-
893
-								case 'item':
894
-											$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
895
-											echo wp_kses_post( implode( ' | ', $markup ) );
896
-									break;
897
-
898
-								case 'renewals':
899
-									$max_bills = $_suscription->get_bill_times();
900
-									echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
901
-									break;
902
-
903
-								case 'renewal_date':
904
-										echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '&mdash;';
905
-									break;
906
-
907
-								case 'start_date':
908
-										echo 'pending' == $_suscription->get_status() ? '&mdash;' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) );
909
-									break;
910
-
911
-								case 'subscription':
912
-										$url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url();
913
-										printf(
914
-                                            '%1$s#%2$s%3$s',
915
-                                            '<a href="' . esc_url( $url ) . '">',
916
-                                            '<strong>' . intval( $_suscription->get_id() ) . '</strong>',
917
-											'</a>'
918
-                                        );
919
-
920
-											echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) );
921
-									break;
889
+								    case 'status':
890
+										    echo wp_kses_post( $_suscription->get_status_label_html() );
891
+									    break;
892
+
893
+								    case 'item':
894
+											    $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
895
+											    echo wp_kses_post( implode( ' | ', $markup ) );
896
+									    break;
897
+
898
+								    case 'renewals':
899
+									    $max_bills = $_suscription->get_bill_times();
900
+									    echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
901
+									    break;
902
+
903
+								    case 'renewal_date':
904
+										    echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '&mdash;';
905
+									    break;
906
+
907
+								    case 'start_date':
908
+										    echo 'pending' == $_suscription->get_status() ? '&mdash;' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) );
909
+									    break;
910
+
911
+								    case 'subscription':
912
+										    $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url();
913
+										    printf(
914
+                                                '%1$s#%2$s%3$s',
915
+                                                '<a href="' . esc_url( $url ) . '">',
916
+                                                '<strong>' . intval( $_suscription->get_id() ) . '</strong>',
917
+											    '</a>'
918
+                                            );
919
+
920
+											    echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) );
921
+									    break;
922 922
 
923 923
 										}
924 924
 
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Switch Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Displays a single line item in an invoice.
4 4
  *
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+    defined( 'ABSPATH' ) || exit;
14 14
 
15
-do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
15
+    do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
16 16
 
17
-?>
17
+    ?>
18 18
 
19 19
 <div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'>
20 20
 
@@ -26,90 +26,90 @@  discard block
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
29
+					    // Fires before printing a line item column.
30
+					    do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
31 31
 
32
-					// Item name.
33
-					if ( 'name' === $column ) {
32
+					    // Item name.
33
+					    if ( 'name' === $column ) {
34 34
 
35
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
35
+						    $has_featured_image = has_post_thumbnail( $item->get_id() );
36 36
 
37
-						if ( $has_featured_image ) {
38
-							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
39
-							echo '<div class="getpaid-form-item-image-container mr-2" style="width:85px;">';
40
-							echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'getpaid-form-item-image mb-0' ) );
41
-							echo '</div>';
42
-							echo '<div class="getpaid-form-item-name-container">';
43
-						}
37
+						    if ( $has_featured_image ) {
38
+							    echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
39
+							    echo '<div class="getpaid-form-item-image-container mr-2" style="width:85px;">';
40
+							    echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'getpaid-form-item-image mb-0' ) );
41
+							    echo '</div>';
42
+							    echo '<div class="getpaid-form-item-name-container">';
43
+						    }
44 44
 
45
-						// Display the name.
46
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
45
+						    // Display the name.
46
+						    echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
47 47
 
48
-						// And an optional description.
49
-						$description = $item->get_description();
48
+						    // And an optional description.
49
+						    $description = $item->get_description();
50 50
 
51
-						if ( ! empty( $description ) ) {
52
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
53
-						}
51
+						    if ( ! empty( $description ) ) {
52
+							    echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
53
+						    }
54 54
 
55
-						// Fires before printing the line item actions.
56
-						do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
55
+						    // Fires before printing the line item actions.
56
+						    do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
57 57
 
58
-						$actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
58
+						    $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
59 59
 
60
-						if ( ! empty( $actions ) ) {
60
+						    if ( ! empty( $actions ) ) {
61 61
 
62
-							$sanitized  = array();
63
-							foreach ( $actions as $key => $item_action ) {
64
-								$key         = sanitize_html_class( $key );
65
-								$item_action = wp_kses_post( $item_action );
66
-								$sanitized[] = "<span class='$key'>$item_action</span>";
67
-							}
62
+							    $sanitized  = array();
63
+							    foreach ( $actions as $key => $item_action ) {
64
+								    $key         = sanitize_html_class( $key );
65
+								    $item_action = wp_kses_post( $item_action );
66
+								    $sanitized[] = "<span class='$key'>$item_action</span>";
67
+							    }
68 68
 
69
-							echo "<small class='form-text getpaid-line-item-actions'>";
70
-							echo wp_kses_post( implode( ' | ', $sanitized ) );
71
-							echo '</small>';
69
+							    echo "<small class='form-text getpaid-line-item-actions'>";
70
+							    echo wp_kses_post( implode( ' | ', $sanitized ) );
71
+							    echo '</small>';
72 72
 
73
-						}
73
+						    }
74 74
 
75
-						if ( $has_featured_image ) {
76
-							echo '</div>';
77
-							echo '</div>';
78
-						}
79
-					}
75
+						    if ( $has_featured_image ) {
76
+							    echo '</div>';
77
+							    echo '</div>';
78
+						    }
79
+					    }
80 80
 
81
-					// Item price.
82
-					if ( 'price' === $column ) {
81
+					    // Item price.
82
+					    if ( 'price' === $column ) {
83 83
 
84
-					// Display the item price (or recurring price if this is a renewal invoice)
85
-					$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
-					wpinv_the_price( $price, $invoice->get_currency() );
84
+					    // Display the item price (or recurring price if this is a renewal invoice)
85
+					    $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
+					    wpinv_the_price( $price, $invoice->get_currency() );
87 87
 
88
-					}
88
+					    }
89 89
 
90
-					// Tax rate.
91
-					if ( 'tax_rate' === $column ) {
92
-					echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
93
-					}
90
+					    // Tax rate.
91
+					    if ( 'tax_rate' === $column ) {
92
+					    echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
93
+					    }
94 94
 
95
-					// Item quantity.
96
-					if ( 'quantity' === $column ) {
97
-					echo (float) $item->get_quantity();
98
-					}
95
+					    // Item quantity.
96
+					    if ( 'quantity' === $column ) {
97
+					    echo (float) $item->get_quantity();
98
+					    }
99 99
 
100
-					// Item sub total.
101
-					if ( 'subtotal' === $column ) {
102
-					$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
-					wpinv_the_price( $subtotal, $invoice->get_currency() );
104
-					}
100
+					    // Item sub total.
101
+					    if ( 'subtotal' === $column ) {
102
+					    $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
+					    wpinv_the_price( $subtotal, $invoice->get_currency() );
104
+					    }
105 105
 
106
-					// Fires when printing a line item column.
107
-					do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
106
+					    // Fires when printing a line item column.
107
+					    do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
108 108
 
109
-					// Fires after printing a line item column.
110
-					do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
109
+					    // Fires after printing a line item column.
110
+					    do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
111 111
 
112
-				?>
112
+				    ?>
113 113
 
114 114
 			</div>
115 115
 
Please login to merge, or discard this patch.