@@ -1,2 +1,2 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | # Silence is golden. |
3 | 3 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -962,8 +962,8 @@ |
||
962 | 962 | aui_flip_color_scheme_on_scroll(); |
963 | 963 | |
964 | 964 | <?php |
965 | - // FSE tweaks. |
|
966 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
965 | + // FSE tweaks. |
|
966 | + if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
967 | 967 | function aui_fse_set_data_scroll() { |
968 | 968 | console.log('init scroll'); |
969 | 969 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php // @todo eventually we need to convert this to non jQuery ?> |
|
1 | + <?php // @todo eventually we need to convert this to non jQuery ?> |
|
2 | 2 | <script> |
3 | 3 | /** |
4 | 4 | * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ). |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | aui_flip_color_scheme_on_scroll(); |
1067 | 1067 | |
1068 | 1068 | <?php |
1069 | - // FSE tweaks. |
|
1070 | - if(!empty($_REQUEST['postType'])){ ?> |
|
1069 | + // FSE tweaks. |
|
1070 | + if(!empty($_REQUEST['postType'])){ ?> |
|
1071 | 1071 | function aui_fse_set_data_scroll() { |
1072 | 1072 | console.log('init scroll'); |
1073 | 1073 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Functionality to convert BS4 to BS5. |
4 | 4 | */ |
@@ -13,77 +13,77 @@ discard block |
||
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">×</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">×</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 |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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">×</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">×</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 |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |