@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays an invoice. |
4 | 4 | * |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -?> |
|
12 | + ?> |
|
13 | 13 | |
14 | 14 | <div class="bsui"> |
15 | 15 | |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | - // Fires when printing the header. |
|
21 | - do_action( 'getpaid_invoice_header', $invoice ); |
|
20 | + // Fires when printing the header. |
|
21 | + do_action( 'getpaid_invoice_header', $invoice ); |
|
22 | 22 | |
23 | - // Print the opening wrapper. |
|
24 | - echo '<div class="container bg-white getpaid-print-no-border border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
|
23 | + // Print the opening wrapper. |
|
24 | + echo '<div class="container bg-white getpaid-print-no-border border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
|
25 | 25 | |
26 | - // Print notifications. |
|
27 | - wpinv_print_errors(); |
|
26 | + // Print notifications. |
|
27 | + wpinv_print_errors(); |
|
28 | 28 | |
29 | - // Fires when printing the invoice details. |
|
30 | - do_action( 'getpaid_invoice_details', $invoice ); |
|
29 | + // Fires when printing the invoice details. |
|
30 | + do_action( 'getpaid_invoice_details', $invoice ); |
|
31 | 31 | |
32 | - // Fires when printing the invoice line items. |
|
33 | - do_action( 'getpaid_invoice_line_items', $invoice ); |
|
32 | + // Fires when printing the invoice line items. |
|
33 | + do_action( 'getpaid_invoice_line_items', $invoice ); |
|
34 | 34 | |
35 | - // Print the closing wrapper. |
|
36 | - echo '</div>'; |
|
35 | + // Print the closing wrapper. |
|
36 | + echo '</div>'; |
|
37 | 37 | |
38 | - // Fires when printing the invoice footer. |
|
39 | - do_action( 'getpaid_invoice_footer', $invoice ); |
|
38 | + // Fires when printing the invoice footer. |
|
39 | + do_action( 'getpaid_invoice_footer', $invoice ); |
|
40 | 40 | |
41 | - ?> |
|
41 | + ?> |
|
42 | 42 | |
43 | 43 | </div> |
44 | 44 | </div> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays the billing address. |
4 | 4 | * |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | -$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
14 | -$phone = $invoice->get_phone(); |
|
15 | -$email = $invoice->get_email(); |
|
16 | -$vat_number = $invoice->get_vat_number(); |
|
17 | -$company_id = $invoice->get_company_id(); |
|
18 | -?> |
|
12 | + $invoice = new WPInv_Invoice( $invoice ); |
|
13 | + $address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
14 | + $phone = $invoice->get_phone(); |
|
15 | + $email = $invoice->get_email(); |
|
16 | + $vat_number = $invoice->get_vat_number(); |
|
17 | + $company_id = $invoice->get_company_id(); |
|
18 | + ?> |
|
19 | 19 | <div class="getpaid-billing-address form-group mb-3 text-break"> |
20 | 20 | |
21 | 21 | <div class="row"> |
@@ -29,39 +29,39 @@ discard block |
||
29 | 29 | <div class="invoice-billing-address-value col-10"> |
30 | 30 | |
31 | 31 | <?php do_action( 'getpaid_billing_address_top' ); ?> |
32 | - |
|
32 | + |
|
33 | 33 | <?php if ( ! empty( $address_row ) ) : ?> |
34 | - <div class="billing-address"> |
|
34 | + <div class="billing-address"> |
|
35 | 35 | <?php echo wp_kses_post( $address_row ); ?> |
36 | - </div> |
|
36 | + </div> |
|
37 | 37 | <?php endif; ?> |
38 | - |
|
38 | + |
|
39 | 39 | |
40 | 40 | <?php if ( ! empty( $phone ) ) : ?> |
41 | - <div class="billing-phone"> |
|
41 | + <div class="billing-phone"> |
|
42 | 42 | <?php echo wp_sprintf( esc_html__( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
43 | - </div> |
|
43 | + </div> |
|
44 | 44 | <?php endif; ?> |
45 | - |
|
45 | + |
|
46 | 46 | |
47 | 47 | <?php if ( ! empty( $email ) ) : ?> |
48 | - <div class="billing-email"> |
|
48 | + <div class="billing-email"> |
|
49 | 49 | <?php echo wp_sprintf( esc_html__( 'Email: %s', 'invoicing' ), esc_html( $email ) ); ?> |
50 | - </div> |
|
50 | + </div> |
|
51 | 51 | <?php endif; ?> |
52 | - |
|
52 | + |
|
53 | 53 | <?php if ( ! empty( $vat_number ) && wpinv_use_taxes() ) : ?> |
54 | - <div class="vat-number"> |
|
54 | + <div class="vat-number"> |
|
55 | 55 | <?php echo wp_sprintf( esc_html__( 'Vat Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?> |
56 | - </div> |
|
56 | + </div> |
|
57 | 57 | <?php endif; ?> |
58 | - |
|
58 | + |
|
59 | 59 | <?php if ( ! empty( $company_id ) ) : ?> |
60 | - <div class="company-id"> |
|
60 | + <div class="company-id"> |
|
61 | 61 | <?php echo wp_sprintf( esc_html__( 'Company ID: %s', 'invoicing' ), esc_html( $company_id ) ); ?> |
62 | - </div> |
|
62 | + </div> |
|
63 | 63 | <?php endif; ?> |
64 | - |
|
64 | + |
|
65 | 65 | <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
66 | 66 | |
67 | 67 | </div> |
@@ -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 |