| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* @package Catch Plugins |
| 9 |
* @subpackage To Top |
| 10 |
* @since To Top 1.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
|
| 14 |
//Custom control for icons |
| 15 |
class To_Top_Custom_Icons extends WP_Customize_Control |
| 16 |
{ |
| 17 |
|
| 18 |
private $icon_options = array( |
| 19 |
'dashicons-arrow-up' => 'Arrow Up', |
| 20 |
'dashicons-arrow-up-alt' => 'Arrow Up Alt', |
| 21 |
'dashicons-arrow-up-alt2' => 'Arrow Up Alt 2', |
| 22 |
); |
| 23 |
|
| 24 |
public function render_content() |
| 25 |
{ |
| 26 |
$output = ''; |
| 27 |
$output .= '<label>'; |
| 28 |
$output .= '<span class="customize-control-title">' . esc_html($this->label) . '</span>'; |
| 29 |
|
| 30 |
$output .= '<select ' . $this->get_link() . ' id="to-top-customizer-icon-type">'; |
| 31 |
|
| 32 |
foreach ($this->icon_options as $key => $value) { |
| 33 |
$output .= '<option class="dashicons ' . esc_attr($key) . '" value="' . esc_attr($key) . '">'; |
| 34 |
$output .= esc_html($value); |
| 35 |
$output .= '</option>'; |
| 36 |
} |
| 37 |
|
| 38 |
$output .= '</select>'; |
| 39 |
$output .= '</label>'; |
| 40 |
|
| 41 |
$allowed_select_html = array( |
| 42 |
'label' => array(), |
| 43 |
'span' => array( |
| 44 |
'class' => true, |
| 45 |
), |
| 46 |
'select' => array( |
| 47 |
'id' => true, |
| 48 |
'name' => true, |
| 49 |
'class' => true, |
| 50 |
'data-customize-setting-link' => true, |
| 51 |
), |
| 52 |
'option' => array( |
| 53 |
'value' => true, |
| 54 |
'class' => true, |
| 55 |
'selected' => true, |
| 56 |
), |
| 57 |
); |
| 58 |
|
| 59 |
echo wp_kses($output, $allowed_select_html); |
| 60 |
} |
| 61 |
} |
| 62 |
|