@@ -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 | ); |
@@ -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()->select( |
| 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 ), |
|
| 27 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 26 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 27 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 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' => 'url', |
| 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' => 'email', |
| 28 | 28 | ) |
| 29 | 29 | ); |