@@ -7,30 +7,30 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Set the currency position. |
| 13 | 13 | $position = wpinv_currency_position(); |
| 14 | 14 | |
| 15 | -if ( $position == 'left_space' ) { |
|
| 15 | +if ($position == 'left_space') { |
|
| 16 | 16 | $position = 'left'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( $position == 'right_space' ) { |
|
| 19 | +if ($position == 'right_space') { |
|
| 20 | 20 | $position = 'right'; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | echo aui()->input( |
| 24 | 24 | array( |
| 25 | - 'name' => esc_attr( $id ), |
|
| 26 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 27 | - 'placeholder' => empty( $placeholder ) ? wpinv_format_amount(0) : wpinv_format_amount( $placeholder ), |
|
| 28 | - 'value' => empty( $value ) ? wpinv_format_amount(0) : wpinv_format_amount( $value ), |
|
| 29 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ), |
|
| 25 | + 'name' => esc_attr($id), |
|
| 26 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 27 | + 'placeholder' => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder), |
|
| 28 | + 'value' => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value), |
|
| 29 | + 'label' => empty($label) ? '' : wp_kses_post($label), |
|
| 30 | 30 | 'label_type' => 'vertical', |
| 31 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 32 | - 'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
| 33 | - 'input_group_left' => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
| 31 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 32 | + 'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
| 33 | + 'input_group_left' => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
| 34 | 34 | 'class' => 'getpaid-refresh-on-change', |
| 35 | 35 | ) |
| 36 | 36 | ); |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | * Displays a list of all subscriptions rules |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 6 | +if (!defined('ABSPATH')) exit; |
|
| 7 | 7 | |
| 8 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 8 | +if (!class_exists('WP_List_Table')) { |
|
| 9 | 9 | include_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
| 10 | 10 | } |
| 11 | 11 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $this->prepare_query(); |
| 80 | 80 | |
| 81 | - $this->base_url = remove_query_arg( 'status' ); |
|
| 81 | + $this->base_url = remove_query_arg('status'); |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
@@ -91,21 +91,21 @@ discard block |
||
| 91 | 91 | $query = array( |
| 92 | 92 | 'number' => $this->per_page, |
| 93 | 93 | 'paged' => $this->get_paged(), |
| 94 | - 'status' => ( isset( $_GET['status'] ) && array_key_exists( $_GET['status'], getpaid_get_subscription_statuses() ) ) ? $_GET['status'] : 'all', |
|
| 95 | - 'orderby' => ( isset( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id', |
|
| 96 | - 'order' => ( isset( $_GET['order'] ) ) ? $_GET['order'] : 'DESC', |
|
| 94 | + 'status' => (isset($_GET['status']) && array_key_exists($_GET['status'], getpaid_get_subscription_statuses())) ? $_GET['status'] : 'all', |
|
| 95 | + 'orderby' => (isset($_GET['orderby'])) ? $_GET['orderby'] : 'id', |
|
| 96 | + 'order' => (isset($_GET['order'])) ? $_GET['order'] : 'DESC', |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | // Prepare class properties. |
| 100 | - $this->query = new GetPaid_Subscriptions_Query( $query ); |
|
| 100 | + $this->query = new GetPaid_Subscriptions_Query($query); |
|
| 101 | 101 | $this->total_count = $this->query->get_total(); |
| 102 | 102 | $this->current_total_count = $this->query->get_total(); |
| 103 | 103 | $this->items = $this->query->get_results(); |
| 104 | - $this->status_counts = getpaid_get_subscription_status_counts( $query ); |
|
| 104 | + $this->status_counts = getpaid_get_subscription_status_counts($query); |
|
| 105 | 105 | |
| 106 | - if ( 'all' != $query['status'] ) { |
|
| 107 | - unset( $query['status'] ); |
|
| 108 | - $this->total_count = getpaid_get_subscriptions( $query, 'count' ); |
|
| 106 | + if ('all' != $query['status']) { |
|
| 107 | + unset($query['status']); |
|
| 108 | + $this->total_count = getpaid_get_subscriptions($query, 'count'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | } |
@@ -122,26 +122,26 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function get_views() { |
| 124 | 124 | |
| 125 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : 'all'; |
|
| 125 | + $current = isset($_GET['status']) ? $_GET['status'] : 'all'; |
|
| 126 | 126 | $views = array( |
| 127 | 127 | |
| 128 | 128 | 'all' => sprintf( |
| 129 | 129 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
| 130 | - esc_url( add_query_arg( 'status', false, $this->base_url ) ), |
|
| 130 | + esc_url(add_query_arg('status', false, $this->base_url)), |
|
| 131 | 131 | $current === 'all' ? ' class="current"' : '', |
| 132 | - __('All','invoicing' ), |
|
| 132 | + __('All', 'invoicing'), |
|
| 133 | 133 | $this->total_count |
| 134 | 134 | ) |
| 135 | 135 | |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - foreach ( array_filter( $this->status_counts ) as $status => $count ) { |
|
| 138 | + foreach (array_filter($this->status_counts) as $status => $count) { |
|
| 139 | 139 | |
| 140 | - $views[ $status ] = sprintf( |
|
| 140 | + $views[$status] = sprintf( |
|
| 141 | 141 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
| 142 | - esc_url( add_query_arg( 'status', urlencode( $status ), $this->base_url ) ), |
|
| 142 | + esc_url(add_query_arg('status', urlencode($status), $this->base_url)), |
|
| 143 | 143 | $current === $status ? ' class="current"' : '', |
| 144 | - sanitize_text_field( getpaid_get_subscription_status_label( $status ) ), |
|
| 144 | + sanitize_text_field(getpaid_get_subscription_status_label($status)), |
|
| 145 | 145 | $count |
| 146 | 146 | ); |
| 147 | 147 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | * @since 1.0.0 |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - public function column_default( $item, $column_name ) { |
|
| 162 | - return apply_filters( "getpaid_subscriptions_table_column_$column_name", $item->$column_name ); |
|
| 161 | + public function column_default($item, $column_name) { |
|
| 162 | + return apply_filters("getpaid_subscriptions_table_column_$column_name", $item->$column_name); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @param WPInv_Subscription $item |
| 169 | 169 | * @return string |
| 170 | 170 | */ |
| 171 | - public function column_cb( $item ) { |
|
| 172 | - return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item->get_id() ) ); |
|
| 171 | + public function column_cb($item) { |
|
| 172 | + return sprintf('<input type="checkbox" name="id[]" value="%s" />', esc_html($item->get_id())); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @since 1.0.0 |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | - public function column_status( $item ) { |
|
| 182 | + public function column_status($item) { |
|
| 183 | 183 | return $item->get_status_label_html(); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,46 +190,46 @@ discard block |
||
| 190 | 190 | * @since 1.0.0 |
| 191 | 191 | * @return string |
| 192 | 192 | */ |
| 193 | - public function column_subscription( $item ) { |
|
| 193 | + public function column_subscription($item) { |
|
| 194 | 194 | |
| 195 | - $username = __( '(Missing User)', 'invoicing' ); |
|
| 195 | + $username = __('(Missing User)', 'invoicing'); |
|
| 196 | 196 | |
| 197 | - $user = get_userdata( $item->get_customer_id() ); |
|
| 198 | - if ( $user ) { |
|
| 197 | + $user = get_userdata($item->get_customer_id()); |
|
| 198 | + if ($user) { |
|
| 199 | 199 | |
| 200 | 200 | $username = sprintf( |
| 201 | 201 | '<a href="user-edit.php?user_id=%s">%s</a>', |
| 202 | - absint( $user->ID ), |
|
| 203 | - ! empty( $user->display_name ) ? sanitize_text_field( $user->display_name ) : sanitize_email( $user->user_email ) |
|
| 202 | + absint($user->ID), |
|
| 203 | + !empty($user->display_name) ? sanitize_text_field($user->display_name) : sanitize_email($user->user_email) |
|
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // translators: $1: is opening link, $2: is subscription id number, $3: is closing link tag, $4: is user's name |
| 209 | 209 | $column_content = sprintf( |
| 210 | - _x( '%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing' ), |
|
| 211 | - '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $item->get_id() ) ) ) . '">', |
|
| 212 | - '<strong>' . esc_attr( $item->get_id() ) . '</strong>', '</a>', |
|
| 210 | + _x('%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing'), |
|
| 211 | + '<a href="' . esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($item->get_id()))) . '">', |
|
| 212 | + '<strong>' . esc_attr($item->get_id()) . '</strong>', '</a>', |
|
| 213 | 213 | $username |
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | 216 | $row_actions = array(); |
| 217 | 217 | |
| 218 | 218 | // View subscription. |
| 219 | - $view_url = esc_url( add_query_arg( 'id', $item->get_id(), admin_url( 'admin.php?page=wpinv-subscriptions' ) )); |
|
| 220 | - $row_actions['view'] = '<a href="' . $view_url . '">' . __( 'View Subscription', 'invoicing' ) . '</a>'; |
|
| 219 | + $view_url = esc_url(add_query_arg('id', $item->get_id(), admin_url('admin.php?page=wpinv-subscriptions'))); |
|
| 220 | + $row_actions['view'] = '<a href="' . $view_url . '">' . __('View Subscription', 'invoicing') . '</a>'; |
|
| 221 | 221 | |
| 222 | 222 | // View invoice. |
| 223 | - $invoice = get_post( $item->get_parent_invoice_id() ); |
|
| 223 | + $invoice = get_post($item->get_parent_invoice_id()); |
|
| 224 | 224 | |
| 225 | - if ( ! empty( $invoice ) ) { |
|
| 226 | - $view_url = get_edit_post_link( $invoice ); |
|
| 227 | - $row_actions['invoice'] = '<a href="' . $view_url . '">' . __( 'View Invoice', 'invoicing' ) . '</a>'; |
|
| 225 | + if (!empty($invoice)) { |
|
| 226 | + $view_url = get_edit_post_link($invoice); |
|
| 227 | + $row_actions['invoice'] = '<a href="' . $view_url . '">' . __('View Invoice', 'invoicing') . '</a>'; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - $row_actions = $this->row_actions( apply_filters( 'getpaid_subscription_table_row_actions', $row_actions, $item ) ); |
|
| 230 | + $row_actions = $this->row_actions(apply_filters('getpaid_subscription_table_row_actions', $row_actions, $item)); |
|
| 231 | 231 | |
| 232 | - return "<strong>$column_content</strong>" . $this->column_amount( $item ) . $row_actions; |
|
| 232 | + return "<strong>$column_content</strong>" . $this->column_amount($item) . $row_actions; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | * @since 1.0.0 |
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | - public function column_renewal_date( $item ) { |
|
| 243 | - return getpaid_format_date_value( $item->get_expiration() ); |
|
| 242 | + public function column_renewal_date($item) { |
|
| 243 | + return getpaid_format_date_value($item->get_expiration()); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | * @since 1.0.0 |
| 251 | 251 | * @return string |
| 252 | 252 | */ |
| 253 | - public function column_start_date( $item ) { |
|
| 254 | - return getpaid_format_date_value( $item->get_date_created() ); |
|
| 253 | + public function column_start_date($item) { |
|
| 254 | + return getpaid_format_date_value($item->get_date_created()); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | * @since 1.0.19 |
| 262 | 262 | * @return string |
| 263 | 263 | */ |
| 264 | - public function column_amount( $item ) { |
|
| 265 | - $amount = getpaid_get_formatted_subscription_amount( $item ); |
|
| 264 | + public function column_amount($item) { |
|
| 265 | + $amount = getpaid_get_formatted_subscription_amount($item); |
|
| 266 | 266 | return "<span class='text-muted form-text mt-2 mb-2'>$amount</span>"; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | * @since 1.0.0 |
| 274 | 274 | * @return string |
| 275 | 275 | */ |
| 276 | - public function column_renewals( $item ) { |
|
| 276 | + public function column_renewals($item) { |
|
| 277 | 277 | $max_bills = $item->get_bill_times(); |
| 278 | - return $item->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "∞" : $max_bills ); |
|
| 278 | + return $item->get_times_billed() . ' / ' . (empty($max_bills) ? "∞" : $max_bills); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -285,16 +285,16 @@ discard block |
||
| 285 | 285 | * @since 1.0.0 |
| 286 | 286 | * @return string |
| 287 | 287 | */ |
| 288 | - public function column_item( $item ) { |
|
| 289 | - $_item = get_post( $item->get_product_id() ); |
|
| 288 | + public function column_item($item) { |
|
| 289 | + $_item = get_post($item->get_product_id()); |
|
| 290 | 290 | |
| 291 | - if ( ! empty( $_item ) ) { |
|
| 292 | - $link = get_edit_post_link( $_item ); |
|
| 293 | - $link = esc_url( $link ); |
|
| 294 | - $name = esc_html( get_the_title( $_item ) ); |
|
| 291 | + if (!empty($_item)) { |
|
| 292 | + $link = get_edit_post_link($_item); |
|
| 293 | + $link = esc_url($link); |
|
| 294 | + $name = esc_html(get_the_title($_item)); |
|
| 295 | 295 | return "<a href='$link'>$name</a>"; |
| 296 | 296 | } else { |
| 297 | - return sprintf( __( 'Item #%s', 'invoicing' ), $item->get_product_id() ); |
|
| 297 | + return sprintf(__('Item #%s', 'invoicing'), $item->get_product_id()); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @return int |
| 306 | 306 | */ |
| 307 | 307 | public function get_paged() { |
| 308 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 308 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | $hidden = array(); |
| 319 | 319 | $sortable = $this->get_sortable_columns(); |
| 320 | 320 | |
| 321 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 321 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 322 | 322 | |
| 323 | 323 | $this->set_pagination_args( |
| 324 | 324 | array( |
| 325 | 325 | 'total_items' => $this->current_total_count, |
| 326 | 326 | 'per_page' => $this->per_page, |
| 327 | - 'total_pages' => ceil( $this->current_total_count / $this->per_page ) |
|
| 327 | + 'total_pages' => ceil($this->current_total_count / $this->per_page) |
|
| 328 | 328 | ) |
| 329 | 329 | ); |
| 330 | 330 | } |
@@ -334,18 +334,18 @@ discard block |
||
| 334 | 334 | * |
| 335 | 335 | * @return array |
| 336 | 336 | */ |
| 337 | - public function get_columns(){ |
|
| 337 | + public function get_columns() { |
|
| 338 | 338 | $columns = array( |
| 339 | 339 | 'cb' => '<input type="checkbox" />', |
| 340 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
| 341 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
| 342 | - 'renewal_date' => __( 'Next Payment', 'invoicing' ), |
|
| 343 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
| 344 | - 'item' => __( 'Item', 'invoicing' ), |
|
| 345 | - 'status' => __( 'Status', 'invoicing' ), |
|
| 340 | + 'subscription' => __('Subscription', 'invoicing'), |
|
| 341 | + 'start_date' => __('Start Date', 'invoicing'), |
|
| 342 | + 'renewal_date' => __('Next Payment', 'invoicing'), |
|
| 343 | + 'renewals' => __('Payments', 'invoicing'), |
|
| 344 | + 'item' => __('Item', 'invoicing'), |
|
| 345 | + 'status' => __('Status', 'invoicing'), |
|
| 346 | 346 | ); |
| 347 | 347 | |
| 348 | - return apply_filters( 'manage_getpaid_subscriptions_table_columns', $columns ); |
|
| 348 | + return apply_filters('manage_getpaid_subscriptions_table_columns', $columns); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -355,15 +355,15 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | public function get_sortable_columns() { |
| 357 | 357 | $sortable = array( |
| 358 | - 'subscription' => array( 'id', true ), |
|
| 359 | - 'start_date' => array( 'created', true ), |
|
| 360 | - 'renewal_date' => array( 'expiration', true ), |
|
| 361 | - 'renewals' => array( 'bill_times', true ), |
|
| 362 | - 'item' => array( 'product_id', true ), |
|
| 363 | - 'status' => array( 'status', true ), |
|
| 358 | + 'subscription' => array('id', true), |
|
| 359 | + 'start_date' => array('created', true), |
|
| 360 | + 'renewal_date' => array('expiration', true), |
|
| 361 | + 'renewals' => array('bill_times', true), |
|
| 362 | + 'item' => array('product_id', true), |
|
| 363 | + 'status' => array('status', true), |
|
| 364 | 364 | ); |
| 365 | 365 | |
| 366 | - return apply_filters( 'manage_getpaid_subscriptions_sortable_table_columns', $sortable ); |
|
| 366 | + return apply_filters('manage_getpaid_subscriptions_sortable_table_columns', $sortable); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @return bool |
| 373 | 373 | */ |
| 374 | 374 | public function has_items() { |
| 375 | - return ! empty( $this->current_total_count ); |
|
| 375 | + return !empty($this->current_total_count); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * Bail if we are not in WP. |
| 14 | 14 | */ |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if (!defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Only add if the class does not already exist. |
| 21 | 21 | */ |
| 22 | -if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) { |
|
| 22 | +if (!class_exists('WP_Font_Awesome_Settings')) { |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | * @return WP_Font_Awesome_Settings - Main instance. |
| 88 | 88 | */ |
| 89 | 89 | public static function instance() { |
| 90 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 90 | + if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) { |
|
| 91 | 91 | self::$instance = new WP_Font_Awesome_Settings; |
| 92 | 92 | |
| 93 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 93 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
| 94 | 94 | |
| 95 | - if ( is_admin() ) { |
|
| 96 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 97 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 95 | + if (is_admin()) { |
|
| 96 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
| 97 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 100 | + do_action('wp_font_awesome_settings_loaded'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return self::$instance; |
@@ -111,30 +111,30 @@ discard block |
||
| 111 | 111 | public function init() { |
| 112 | 112 | $this->settings = $this->get_settings(); |
| 113 | 113 | |
| 114 | - if ( $this->settings['type'] == 'CSS' ) { |
|
| 114 | + if ($this->settings['type'] == 'CSS') { |
|
| 115 | 115 | |
| 116 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 117 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 116 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 117 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 121 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 120 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 121 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | } else { |
| 125 | 125 | |
| 126 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 127 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 126 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 127 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 131 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 130 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 131 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // remove font awesome if set to do so |
| 136 | - if ( $this->settings['dequeue'] == '1' ) { |
|
| 137 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 136 | + if ($this->settings['dequeue'] == '1') { |
|
| 137 | + add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | } |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | // build url |
| 147 | 147 | $url = $this->get_url(); |
| 148 | 148 | |
| 149 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 150 | - wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 151 | - wp_enqueue_style( 'font-awesome' ); |
|
| 149 | + wp_deregister_style('font-awesome'); // deregister in case its already there |
|
| 150 | + wp_register_style('font-awesome', $url, array(), null); |
|
| 151 | + wp_enqueue_style('font-awesome'); |
|
| 152 | 152 | |
| 153 | - if ( $this->settings['shims'] ) { |
|
| 154 | - $url = $this->get_url( true ); |
|
| 155 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 156 | - wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 157 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
| 153 | + if ($this->settings['shims']) { |
|
| 154 | + $url = $this->get_url(true); |
|
| 155 | + wp_deregister_style('font-awesome-shims'); // deregister in case its already there |
|
| 156 | + wp_register_style('font-awesome-shims', $url, array(), null); |
|
| 157 | + wp_enqueue_style('font-awesome-shims'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -166,15 +166,15 @@ discard block |
||
| 166 | 166 | $url = $this->get_url(); |
| 167 | 167 | |
| 168 | 168 | $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
| 169 | - call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
| 170 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 171 | - wp_enqueue_script( 'font-awesome' ); |
|
| 172 | - |
|
| 173 | - if ( $this->settings['shims'] ) { |
|
| 174 | - $url = $this->get_url( true ); |
|
| 175 | - call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
| 176 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 177 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
| 169 | + call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there |
|
| 170 | + wp_register_script('font-awesome', $url, array(), null); |
|
| 171 | + wp_enqueue_script('font-awesome'); |
|
| 172 | + |
|
| 173 | + if ($this->settings['shims']) { |
|
| 174 | + $url = $this->get_url(true); |
|
| 175 | + call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there |
|
| 176 | + wp_register_script('font-awesome-shims', $url, array(), null); |
|
| 177 | + wp_enqueue_script('font-awesome-shims'); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
@@ -185,16 +185,16 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @return string The url to the file. |
| 187 | 187 | */ |
| 188 | - public function get_url( $shims = false ) { |
|
| 188 | + public function get_url($shims = false) { |
|
| 189 | 189 | $script = $shims ? 'v4-shims' : 'all'; |
| 190 | 190 | $sub = $this->settings['pro'] ? 'pro' : 'use'; |
| 191 | 191 | $type = $this->settings['type']; |
| 192 | 192 | $version = $this->settings['version']; |
| 193 | - $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
| 193 | + $kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : ''; |
|
| 194 | 194 | $url = ''; |
| 195 | 195 | |
| 196 | - if ( $type == 'KIT' && $kit_url ) { |
|
| 197 | - if ( $shims ) { |
|
| 196 | + if ($type == 'KIT' && $kit_url) { |
|
| 197 | + if ($shims) { |
|
| 198 | 198 | // if its a kit then we don't add shims here |
| 199 | 199 | return ''; |
| 200 | 200 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $url .= "?wpfas=true"; // set our var so our version is not removed |
| 203 | 203 | } else { |
| 204 | 204 | $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
| 205 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 205 | + $url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 206 | 206 | $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
| 207 | 207 | $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
| 208 | 208 | $url .= "?wpfas=true"; // set our var so our version is not removed |
@@ -222,16 +222,16 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return string The filtered url. |
| 224 | 224 | */ |
| 225 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 225 | + public function remove_font_awesome($url, $original_url, $_context) { |
|
| 226 | 226 | |
| 227 | - if ( $_context == 'display' |
|
| 228 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 229 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 227 | + if ($_context == 'display' |
|
| 228 | + && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false) |
|
| 229 | + && (strstr($url, ".js") !== false || strstr($url, ".css") !== false) |
|
| 230 | 230 | ) {// it's a font-awesome-url (probably) |
| 231 | 231 | |
| 232 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 233 | - if ( $this->settings['type'] == 'JS' ) { |
|
| 234 | - if ( $this->settings['js-pseudo'] ) { |
|
| 232 | + if (strstr($url, "wpfas=true") !== false) { |
|
| 233 | + if ($this->settings['type'] == 'JS') { |
|
| 234 | + if ($this->settings['js-pseudo']) { |
|
| 235 | 235 | $url .= "' data-search-pseudo-elements defer='defer"; |
| 236 | 236 | } else { |
| 237 | 237 | $url .= "' defer='defer"; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * Register the database settings with WordPress. |
| 251 | 251 | */ |
| 252 | 252 | public function register_settings() { |
| 253 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 253 | + register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings'); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function menu_item() { |
| 261 | 261 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
| 262 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 262 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 263 | 263 | $this, |
| 264 | 264 | 'settings_page' |
| 265 | - ) ); |
|
| 265 | + )); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function get_settings() { |
| 274 | 274 | |
| 275 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 275 | + $db_settings = get_option('wp-font-awesome-settings'); |
|
| 276 | 276 | |
| 277 | 277 | $defaults = array( |
| 278 | 278 | 'type' => 'CSS', // type to use, CSS or JS or KIT |
@@ -285,14 +285,14 @@ discard block |
||
| 285 | 285 | 'kit-url' => '', // the kit url |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 288 | + $settings = wp_parse_args($db_settings, $defaults); |
|
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | 291 | * Filter the Font Awesome settings. |
| 292 | 292 | * |
| 293 | 293 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
| 294 | 294 | */ |
| 295 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 295 | + return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | * The settings page html output. |
| 301 | 301 | */ |
| 302 | 302 | public function settings_page() { |
| 303 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 304 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) ); |
|
| 303 | + if (!current_user_can('manage_options')) { |
|
| 304 | + wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings')); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // a hidden way to force the update of the verison number vai api instead of waiting the 48 hours |
| 308 | - if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
| 309 | - $this->get_latest_version( $force_api = true ); |
|
| 308 | + if (isset($_REQUEST['force-version-check'])) { |
|
| 309 | + $this->get_latest_version($force_api = true); |
|
| 310 | 310 | } |
| 311 | 311 | ?> |
| 312 | 312 | <style> |
@@ -326,37 +326,37 @@ discard block |
||
| 326 | 326 | <h1><?php echo $this->name; ?></h1> |
| 327 | 327 | <form method="post" action="options.php"> |
| 328 | 328 | <?php |
| 329 | - settings_fields( 'wp-font-awesome-settings' ); |
|
| 330 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 329 | + settings_fields('wp-font-awesome-settings'); |
|
| 330 | + do_settings_sections('wp-font-awesome-settings'); |
|
| 331 | 331 | $kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : ''; |
| 332 | 332 | ?> |
| 333 | - <table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>"> |
|
| 333 | + <table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>"> |
|
| 334 | 334 | <tr valign="top"> |
| 335 | 335 | <th scope="row"><label |
| 336 | - for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th> |
|
| 336 | + for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th> |
|
| 337 | 337 | <td> |
| 338 | 338 | <select name="wp-font-awesome-settings[type]" id="wpfas-type" |
| 339 | 339 | onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}"> |
| 340 | 340 | <option |
| 341 | - value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option> |
|
| 342 | - <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option> |
|
| 341 | + value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option> |
|
| 342 | + <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option> |
|
| 343 | 343 | <option |
| 344 | - value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option> |
|
| 344 | + value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option> |
|
| 345 | 345 | </select> |
| 346 | 346 | </td> |
| 347 | 347 | </tr> |
| 348 | 348 | |
| 349 | 349 | <tr valign="top" class="wpfas-kit-show"> |
| 350 | 350 | <th scope="row"><label |
| 351 | - for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th> |
|
| 351 | + for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th> |
|
| 352 | 352 | <td> |
| 353 | 353 | <input class="regular-text" id="wpfas-kit-url" type="url" |
| 354 | 354 | name="wp-font-awesome-settings[kit-url]" |
| 355 | - value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" |
|
| 356 | - placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 355 | + value="<?php echo esc_attr($this->settings['kit-url']); ?>" |
|
| 356 | + placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 357 | 357 | <span><?php |
| 358 | 358 | echo sprintf( |
| 359 | - __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ), |
|
| 359 | + __('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'), |
|
| 360 | 360 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
| 361 | 361 | '</a>' |
| 362 | 362 | ); |
@@ -366,31 +366,31 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | <tr valign="top" class="wpfas-kit-hide"> |
| 368 | 368 | <th scope="row"><label |
| 369 | - for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th> |
|
| 369 | + for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th> |
|
| 370 | 370 | <td> |
| 371 | 371 | <select name="wp-font-awesome-settings[version]" id="wpfas-version"> |
| 372 | 372 | <option |
| 373 | - value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?> |
|
| 373 | + value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?> |
|
| 374 | 374 | </option> |
| 375 | - <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>> |
|
| 375 | + <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>> |
|
| 376 | 376 | 5.6.0 |
| 377 | 377 | </option> |
| 378 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>> |
|
| 378 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>> |
|
| 379 | 379 | 5.5.0 |
| 380 | 380 | </option> |
| 381 | - <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>> |
|
| 381 | + <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>> |
|
| 382 | 382 | 5.4.0 |
| 383 | 383 | </option> |
| 384 | - <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>> |
|
| 384 | + <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>> |
|
| 385 | 385 | 5.3.0 |
| 386 | 386 | </option> |
| 387 | - <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>> |
|
| 387 | + <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>> |
|
| 388 | 388 | 5.2.0 |
| 389 | 389 | </option> |
| 390 | - <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>> |
|
| 390 | + <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>> |
|
| 391 | 391 | 5.1.0 |
| 392 | 392 | </option> |
| 393 | - <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>> |
|
| 393 | + <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>> |
|
| 394 | 394 | 4.7.1 (CSS only) |
| 395 | 395 | </option> |
| 396 | 396 | </select> |
@@ -399,29 +399,29 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | <tr valign="top"> |
| 401 | 401 | <th scope="row"><label |
| 402 | - for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th> |
|
| 402 | + for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th> |
|
| 403 | 403 | <td> |
| 404 | 404 | <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue"> |
| 405 | 405 | <option |
| 406 | - value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option> |
|
| 406 | + value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option> |
|
| 407 | 407 | <option |
| 408 | - value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option> |
|
| 408 | + value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option> |
|
| 409 | 409 | <option |
| 410 | - value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option> |
|
| 410 | + value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option> |
|
| 411 | 411 | </select> |
| 412 | 412 | </td> |
| 413 | 413 | </tr> |
| 414 | 414 | |
| 415 | 415 | <tr valign="top" class="wpfas-kit-hide"> |
| 416 | 416 | <th scope="row"><label |
| 417 | - for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th> |
|
| 417 | + for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th> |
|
| 418 | 418 | <td> |
| 419 | 419 | <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/> |
| 420 | 420 | <input type="checkbox" name="wp-font-awesome-settings[pro]" |
| 421 | - value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/> |
|
| 421 | + value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/> |
|
| 422 | 422 | <span><?php |
| 423 | 423 | echo sprintf( |
| 424 | - __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ), |
|
| 424 | + __('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings'), |
|
| 425 | 425 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/pro"><i class="fas fa-external-link-alt"></i>', |
| 426 | 426 | '</a>', |
| 427 | 427 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn"><i class="fas fa-external-link-alt"></i>', |
@@ -433,38 +433,38 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | <tr valign="top" class="wpfas-kit-hide"> |
| 435 | 435 | <th scope="row"><label |
| 436 | - for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label> |
|
| 436 | + for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label> |
|
| 437 | 437 | </th> |
| 438 | 438 | <td> |
| 439 | 439 | <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/> |
| 440 | 440 | <input type="checkbox" name="wp-font-awesome-settings[shims]" |
| 441 | - value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/> |
|
| 442 | - <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span> |
|
| 441 | + value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/> |
|
| 442 | + <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span> |
|
| 443 | 443 | </td> |
| 444 | 444 | </tr> |
| 445 | 445 | |
| 446 | 446 | <tr valign="top" class="wpfas-kit-hide"> |
| 447 | 447 | <th scope="row"><label |
| 448 | - for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label> |
|
| 448 | + for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label> |
|
| 449 | 449 | </th> |
| 450 | 450 | <td> |
| 451 | 451 | <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/> |
| 452 | 452 | <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]" |
| 453 | - value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?> |
|
| 453 | + value="1" <?php checked($this->settings['js-pseudo'], '1'); ?> |
|
| 454 | 454 | id="wpfas-js-pseudo"/> |
| 455 | - <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span> |
|
| 455 | + <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span> |
|
| 456 | 456 | </td> |
| 457 | 457 | </tr> |
| 458 | 458 | |
| 459 | 459 | <tr valign="top"> |
| 460 | 460 | <th scope="row"><label |
| 461 | - for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th> |
|
| 461 | + for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th> |
|
| 462 | 462 | <td> |
| 463 | 463 | <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/> |
| 464 | 464 | <input type="checkbox" name="wp-font-awesome-settings[dequeue]" |
| 465 | - value="1" <?php checked( $this->settings['dequeue'], '1' ); ?> |
|
| 465 | + value="1" <?php checked($this->settings['dequeue'], '1'); ?> |
|
| 466 | 466 | id="wpfas-dequeue"/> |
| 467 | - <span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings' ); ?></span> |
|
| 467 | + <span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings'); ?></span> |
|
| 468 | 468 | </td> |
| 469 | 469 | </tr> |
| 470 | 470 | |
@@ -489,12 +489,12 @@ discard block |
||
| 489 | 489 | * |
| 490 | 490 | * @return string Either a valid version number or an empty string. |
| 491 | 491 | */ |
| 492 | - public function validate_version_number( $version ) { |
|
| 492 | + public function validate_version_number($version) { |
|
| 493 | 493 | |
| 494 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 494 | + if (version_compare($version, '0.0.1', '>=') >= 0) { |
|
| 495 | 495 | // valid |
| 496 | 496 | } else { |
| 497 | - $version = '';// not validated |
|
| 497 | + $version = ''; // not validated |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | return $version; |
@@ -509,19 +509,19 @@ discard block |
||
| 509 | 509 | * @since 1.0.7 |
| 510 | 510 | * @return mixed|string The latest version number found. |
| 511 | 511 | */ |
| 512 | - public function get_latest_version( $force_api = false ) { |
|
| 512 | + public function get_latest_version($force_api = false) { |
|
| 513 | 513 | $latest_version = $this->latest; |
| 514 | 514 | |
| 515 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 515 | + $cache = get_transient('wp-font-awesome-settings-version'); |
|
| 516 | 516 | |
| 517 | - if ( $cache === false || $force_api ) { // its not set |
|
| 517 | + if ($cache === false || $force_api) { // its not set |
|
| 518 | 518 | $api_ver = $this->get_latest_version_from_api(); |
| 519 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 519 | + if (version_compare($api_ver, $this->latest, '>=') >= 0) { |
|
| 520 | 520 | $latest_version = $api_ver; |
| 521 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 521 | + set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS); |
|
| 522 | 522 | } |
| 523 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 524 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 523 | + } elseif ($this->validate_version_number($cache)) { |
|
| 524 | + if (version_compare($cache, $this->latest, '>=') >= 0) { |
|
| 525 | 525 | $latest_version = $cache; |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -537,10 +537,10 @@ discard block |
||
| 537 | 537 | */ |
| 538 | 538 | public function get_latest_version_from_api() { |
| 539 | 539 | $version = "0"; |
| 540 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 541 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 542 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 543 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 540 | + $response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest"); |
|
| 541 | + if (!is_wp_error($response) && is_array($response)) { |
|
| 542 | + $api_response = json_decode(wp_remote_retrieve_body($response), true); |
|
| 543 | + if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) { |
|
| 544 | 544 | $version = $api_response['tag_name']; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return string The rendered component. |
| 20 | 20 | */ |
| 21 | - public static function get( $args = array() ) { |
|
| 21 | + public static function get($args = array()) { |
|
| 22 | 22 | global $wp_query; |
| 23 | 23 | |
| 24 | 24 | $defaults = array( |
@@ -26,57 +26,57 @@ discard block |
||
| 26 | 26 | 'mid_size' => 2, |
| 27 | 27 | 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
| 28 | 28 | 'next_text' => '<i class="fas fa-chevron-right"></i>', |
| 29 | - 'screen_reader_text' => __( 'Posts navigation','aui' ), |
|
| 29 | + 'screen_reader_text' => __('Posts navigation', 'aui'), |
|
| 30 | 30 | 'before_paging' => '', |
| 31 | 31 | 'after_paging' => '', |
| 32 | 32 | 'type' => 'array', |
| 33 | - 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
| 33 | + 'total' => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1, |
|
| 34 | 34 | 'links' => array() // an array of links if using custom links, this includes the a tag. |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Parse incoming $args into an array and merge it with $defaults |
| 39 | 39 | */ |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | 42 | $output = ''; |
| 43 | 43 | |
| 44 | 44 | // Don't print empty markup if there's only one page. |
| 45 | - if ( $args['total'] > 1 ) { |
|
| 45 | + if ($args['total'] > 1) { |
|
| 46 | 46 | |
| 47 | 47 | // Set up paginated links. |
| 48 | - $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
| 48 | + $links = !empty($args['links']) ? $args['links'] : paginate_links($args); |
|
| 49 | 49 | |
| 50 | 50 | $class = !empty($args['class']) ? $args['class'] : ''; |
| 51 | 51 | |
| 52 | 52 | // make the output bootstrap ready |
| 53 | 53 | $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
| 54 | - if ( ! empty( $links ) ) { |
|
| 55 | - foreach ( $links as $link ) { |
|
| 56 | - $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
| 54 | + if (!empty($links)) { |
|
| 55 | + foreach ($links as $link) { |
|
| 56 | + $active = strpos($link, 'current') !== false ? 'active' : ''; |
|
| 57 | 57 | $links_html .= "<li class='page-item $active'>"; |
| 58 | - $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
| 58 | + $links_html .= str_replace("page-numbers", "page-link", $link); |
|
| 59 | 59 | $links_html .= "</li>"; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | $links_html .= "</ul>"; |
| 63 | 63 | |
| 64 | - if ( $links ) { |
|
| 64 | + if ($links) { |
|
| 65 | 65 | $output .= '<section class="px-0 py-2 w-100">'; |
| 66 | - $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
| 66 | + $output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']); |
|
| 67 | 67 | $output .= '</section>'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
| 71 | - $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
| 70 | + $output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output); |
|
| 71 | + $output = str_replace("nav-links", "aui-nav-links", $output); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( $output ) { |
|
| 75 | - if ( ! empty( $args['before_paging'] ) ) { |
|
| 74 | + if ($output) { |
|
| 75 | + if (!empty($args['before_paging'])) { |
|
| 76 | 76 | $output = $args['before_paging'] . $output; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if ( ! empty( $args['after_paging'] ) ) { |
|
| 79 | + if (!empty($args['after_paging'])) { |
|
| 80 | 80 | $output = $output . $args['after_paging']; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return AUI|null |
| 36 | 36 | */ |
| 37 | 37 | public static function instance() { |
| 38 | - if ( self::$instance == null ) { |
|
| 38 | + if (self::$instance == null) { |
|
| 39 | 39 | self::$instance = new AUI(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | * @since 1.0.0 |
| 49 | 49 | */ |
| 50 | 50 | private function __construct() { |
| 51 | - if ( function_exists( "__autoload" ) ) { |
|
| 52 | - spl_autoload_register( "__autoload" ); |
|
| 51 | + if (function_exists("__autoload")) { |
|
| 52 | + spl_autoload_register("__autoload"); |
|
| 53 | 53 | } |
| 54 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 54 | + spl_autoload_register(array($this, 'autoload')); |
|
| 55 | 55 | |
| 56 | 56 | // load options |
| 57 | 57 | self::$options = get_option('aui_options'); |
@@ -64,11 +64,11 @@ discard block |
||
| 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 ); |
|
| 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 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,27 +79,27 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return string|void |
| 81 | 81 | */ |
| 82 | - public function get_option( $option ){ |
|
| 82 | + public function get_option($option) { |
|
| 83 | 83 | $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : ''; |
| 84 | 84 | |
| 85 | - if ( ! $result && $option) { |
|
| 86 | - if( $option == 'color_primary' ){ |
|
| 85 | + if (!$result && $option) { |
|
| 86 | + if ($option == 'color_primary') { |
|
| 87 | 87 | $result = AUI_PRIMARY_COLOR; |
| 88 | - }elseif( $option == 'color_secondary' ){ |
|
| 88 | + }elseif ($option == 'color_secondary') { |
|
| 89 | 89 | $result = AUI_SECONDARY_COLOR; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | return $result; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function render( $items = array() ) { |
|
| 95 | + public function render($items = array()) { |
|
| 96 | 96 | $output = ''; |
| 97 | 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 ); |
|
| 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 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return string The rendered component. |
| 118 | 118 | */ |
| 119 | - public function alert( $args = array() ) { |
|
| 120 | - return AUI_Component_Alert::get( $args ); |
|
| 119 | + public function alert($args = array()) { |
|
| 120 | + return AUI_Component_Alert::get($args); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string The rendered component. |
| 131 | 131 | */ |
| 132 | - public function input( $args = array() ) { |
|
| 133 | - return AUI_Component_Input::input( $args ); |
|
| 132 | + public function input($args = array()) { |
|
| 133 | + return AUI_Component_Input::input($args); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return string The rendered component. |
| 144 | 144 | */ |
| 145 | - public function textarea( $args = array() ) { |
|
| 146 | - return AUI_Component_Input::textarea( $args ); |
|
| 145 | + public function textarea($args = array()) { |
|
| 146 | + return AUI_Component_Input::textarea($args); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return string The rendered component. |
| 157 | 157 | */ |
| 158 | - public function button( $args = array() ) { |
|
| 159 | - return AUI_Component_Button::get( $args ); |
|
| 158 | + public function button($args = array()) { |
|
| 159 | + return AUI_Component_Button::get($args); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -168,22 +168,22 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return string The rendered component. |
| 170 | 170 | */ |
| 171 | - public function badge( $args = array() ) { |
|
| 171 | + public function badge($args = array()) { |
|
| 172 | 172 | $defaults = array( |
| 173 | 173 | 'class' => 'badge badge-primary align-middle', |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | // maybe set type |
| 177 | - if ( empty( $args['href'] ) ) { |
|
| 177 | + if (empty($args['href'])) { |
|
| 178 | 178 | $defaults['type'] = 'badge'; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * Parse incoming $args into an array and merge it with $defaults |
| 183 | 183 | */ |
| 184 | - $args = wp_parse_args( $args, $defaults ); |
|
| 184 | + $args = wp_parse_args($args, $defaults); |
|
| 185 | 185 | |
| 186 | - return AUI_Component_Button::get( $args ); |
|
| 186 | + return AUI_Component_Button::get($args); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return string The rendered component. |
| 197 | 197 | */ |
| 198 | - public function dropdown( $args = array() ) { |
|
| 199 | - return AUI_Component_Dropdown::get( $args ); |
|
| 198 | + public function dropdown($args = array()) { |
|
| 199 | + return AUI_Component_Dropdown::get($args); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return string The rendered component. |
| 210 | 210 | */ |
| 211 | - public function select( $args = array() ) { |
|
| 212 | - return AUI_Component_Input::select( $args ); |
|
| 211 | + public function select($args = array()) { |
|
| 212 | + return AUI_Component_Input::select($args); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * @return string The rendered component. |
| 223 | 223 | */ |
| 224 | - public function radio( $args = array() ) { |
|
| 225 | - return AUI_Component_Input::radio( $args ); |
|
| 224 | + public function radio($args = array()) { |
|
| 225 | + return AUI_Component_Input::radio($args); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return string The rendered component. |
| 236 | 236 | */ |
| 237 | - public function pagination( $args = array() ) { |
|
| 238 | - return AUI_Component_Pagination::get( $args ); |
|
| 237 | + public function pagination($args = array()) { |
|
| 238 | + return AUI_Component_Pagination::get($args); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | \ No newline at end of file |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | 13 | |
| 14 | -if ( ! empty( $required ) ) { |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | echo aui()->input( |
| 19 | 19 | array( |
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 22 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 20 | + 'name' => esc_attr($id), |
|
| 21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 22 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | 25 | 'label_type' => 'vertical', |
| 26 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 26 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 27 | 27 | 'type' => 'datepicker', |
| 28 | 28 | ) |
| 29 | 29 | ); |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | 13 | |
| 14 | -if ( ! empty( $required ) ) { |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | echo aui()->input( |
| 19 | 19 | array( |
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 22 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 20 | + 'name' => esc_attr($id), |
|
| 21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 22 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | 25 | 'label_type' => 'vertical', |
| 26 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 26 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 27 | 27 | 'type' => 'number', |
| 28 | 28 | ) |
| 29 | 29 | ); |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | 13 | |
| 14 | -if ( ! empty( $required ) ) { |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | echo aui()->radio( |
| 19 | 19 | array( |
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 22 | - 'required' => ! empty( $required ), |
|
| 20 | + 'name' => esc_attr($id), |
|
| 21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 22 | + 'required' => !empty($required), |
|
| 23 | 23 | 'label' => $label, |
| 24 | 24 | 'label_type' => 'vertical', |
| 25 | 25 | 'inline' => false, |
| 26 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 26 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | 28 | ) |
| 29 | 29 | ); |
@@ -7,35 +7,35 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Ensure that we have options. |
| 13 | -if ( empty( $options ) ) { |
|
| 13 | +if (empty($options)) { |
|
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Prepare price options. |
| 18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
| 19 | -$keys = array_keys( $options ); |
|
| 20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
| 18 | +$options = getpaid_convert_price_string_to_options($options); |
|
| 19 | +$keys = array_keys($options); |
|
| 20 | +$value = empty($options) ? '' : $keys[0]; |
|
| 21 | 21 | |
| 22 | 22 | // Prepare id. |
| 23 | -$id = esc_attr( $id ); |
|
| 23 | +$id = esc_attr($id); |
|
| 24 | 24 | |
| 25 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
| 25 | +$select_type = empty($select_type) ? 'select' : $select_type; |
|
| 26 | 26 | |
| 27 | 27 | // Item select; |
| 28 | -if ( $select_type == 'select' ) { |
|
| 28 | +if ($select_type == 'select') { |
|
| 29 | 29 | echo aui()->select( |
| 30 | 30 | array( |
| 31 | 31 | 'name' => $id, |
| 32 | - 'id' => $id . uniqid( '_' ), |
|
| 33 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 32 | + 'id' => $id . uniqid('_'), |
|
| 33 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 34 | 34 | 'value' => $value, |
| 35 | - 'label' => empty( $label ) ? '' : sanitize_text_field( $label ), |
|
| 35 | + 'label' => empty($label) ? '' : sanitize_text_field($label), |
|
| 36 | 36 | 'label_type' => 'vertical', |
| 37 | 37 | 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
| 38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 39 | 39 | 'options' => $options, |
| 40 | 40 | ) |
| 41 | 41 | ); |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Item radios; |
| 46 | -if ( $select_type == 'radios' ) { |
|
| 46 | +if ($select_type == 'radios') { |
|
| 47 | 47 | echo aui()->radio( |
| 48 | 48 | array( |
| 49 | - 'name' => esc_attr( $id ), |
|
| 50 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 51 | - 'label' => empty( $label ) ? '' : sanitize_text_field( $label ), |
|
| 49 | + 'name' => esc_attr($id), |
|
| 50 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 51 | + 'label' => empty($label) ? '' : sanitize_text_field($label), |
|
| 52 | 52 | 'label_type' => 'vertical', |
| 53 | 53 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change', |
| 54 | 54 | 'value' => $value, |
| 55 | 55 | 'inline' => false, |
| 56 | 56 | 'options' => $options, |
| 57 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 57 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 58 | 58 | ) |
| 59 | 59 | ); |
| 60 | 60 | return; |
@@ -62,30 +62,30 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // Display the label. |
| 65 | -if ( ! empty( $label ) ) { |
|
| 66 | - $label = sanitize_text_field( $label ); |
|
| 65 | +if (!empty($label)) { |
|
| 66 | + $label = sanitize_text_field($label); |
|
| 67 | 67 | echo "<label>$label</label>"; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Item buttons; |
| 71 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
| 71 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
| 72 | 72 | |
| 73 | 73 | $class = 'getpaid-price-buttons'; |
| 74 | 74 | |
| 75 | - if ( $select_type == 'circles' ) { |
|
| 75 | + if ($select_type == 'circles') { |
|
| 76 | 76 | $class .= ' getpaid-price-circles'; |
| 77 | 77 | } |
| 78 | 78 | echo "<div class='$class'>"; |
| 79 | 79 | |
| 80 | - foreach ( $options as $price => $label ) { |
|
| 81 | - $label = sanitize_text_field( $label ); |
|
| 82 | - $price = esc_attr( $price ); |
|
| 83 | - $_id = $id . uniqid( '_' ); |
|
| 84 | - $checked = checked( $price, $value, false ); |
|
| 80 | + foreach ($options as $price => $label) { |
|
| 81 | + $label = sanitize_text_field($label); |
|
| 82 | + $price = esc_attr($price); |
|
| 83 | + $_id = $id . uniqid('_'); |
|
| 84 | + $checked = checked($price, $value, false); |
|
| 85 | 85 | |
| 86 | 86 | $class = 'rounded'; |
| 87 | 87 | |
| 88 | - if ( $select_type == 'circles' ) { |
|
| 88 | + if ($select_type == 'circles') { |
|
| 89 | 89 | $class = ''; |
| 90 | 90 | } |
| 91 | 91 | echo " |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Item checkboxes; |
| 104 | -if ( $select_type == 'checkboxes' ) { |
|
| 104 | +if ($select_type == 'checkboxes') { |
|
| 105 | 105 | echo '<div class="form-group">'; |
| 106 | 106 | |
| 107 | - foreach ( $options as $price => $label ) { |
|
| 108 | - $label = sanitize_text_field( $label ); |
|
| 109 | - $price = esc_attr( $price ); |
|
| 110 | - $checked = checked( $price, $value, false ); |
|
| 107 | + foreach ($options as $price => $label) { |
|
| 108 | + $label = sanitize_text_field($label); |
|
| 109 | + $price = esc_attr($price); |
|
| 110 | + $checked = checked($price, $value, false); |
|
| 111 | 111 | echo " |
| 112 | 112 | <label class='d-block'> |
| 113 | 113 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change' name='{$id}[]' value='$price' $checked /> |
@@ -120,6 +120,6 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | -if ( ! empty( $description ) ) { |
|
| 123 | +if (!empty($description)) { |
|
| 124 | 124 | echo "<small class='form-text text-muted'>$description</small>"; |
| 125 | 125 | } |