* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ if ( class_exists( 'WP_Customize_Control' ) ) { class Skyrocket_Simple_Notice_Custom_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'simple_notice'; /** * Render the control in the customizer */ public function render_content() { ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?>
link(); checked( $this->value() ); ?>>
label ); ?> description ) ) { ?> description ); ?>
button_labels = wp_parse_args( $this->button_labels, array( 'add' => __( 'Add', 'becommerce-store' ), ) ); } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'jquery', 'jquery-ui-core' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { ?>
label ) ) { ?> label ); ?> description ) ) { ?> description ); ?> link(); ?> />
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Skyrocket_Single_Accordion_Custom_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'single_accordion'; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'jquery', 'jquery-ui-core' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { $allowed_html = array( 'a' => array( 'href' => array(), 'title' => array(), 'class' => array(), 'target' => array(), ), 'br' => array(), 'em' => array(), 'strong' => array(), 'i' => array( 'class' => array() ), ); ?>
label ); ?>
description ) ) { echo ''; } else { echo wp_kses( $this->description, $allowed_html ); } ?>
input_attrs['multiselect'] ) && $this->input_attrs['multiselect'] ) { $this->multiselect = true; } // Check if a placeholder string has been specified if ( isset( $this->input_attrs['placeholder'] ) && $this->input_attrs['placeholder'] ) { $this->placeholder = $this->input_attrs['placeholder']; } } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-select2-js', get_template_directory_uri() . '/admin/assets/select2.full.js', array( 'jquery' ), '4.0.13', true ); wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'skyrocket-select2-js' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); wp_enqueue_style( 'skyrocket-select2-css', get_template_directory_uri() . '/admin/assets/select2.css', array(), '4.0.13', 'all' ); } /** * Render the control in the customizer */ public function render_content() { $defaultValue = $this->value(); if ( $this->multiselect ) { $defaultValue = explode( ',', $this->value() ); } ?> * @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Skyrocket_Dropdown_Select2_Custom_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'dropdown_select2'; /** * The type of Select2 Dropwdown to display. Can be either a single select dropdown or a multi-select dropdown. Either false for true. Default = false */ private $multiselect = false; /** * The Placeholder value to display. Select2 requires a Placeholder value to be set when using the clearall option. Default = 'Please select...' */ private $placeholder = 'Please select...'; /** * Constructor */ public function __construct( $manager, $id, $args = array(), $options = array() ) { parent::__construct( $manager, $id, $args ); // Check if this is a multi-select field if ( isset( $this->input_attrs['multiselect'] ) && $this->input_attrs['multiselect'] ) { $this->multiselect = true; } // Check if a placeholder string has been specified if ( isset( $this->input_attrs['placeholder'] ) && $this->input_attrs['placeholder'] ) { $this->placeholder = $this->input_attrs['placeholder']; } } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-select2-js', get_template_directory_uri() . '/admin/assets/select2.full.js', array( 'jquery' ), '4.0.13', true ); wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'skyrocket-select2-js' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); wp_enqueue_style( 'skyrocket-select2-css', get_template_directory_uri() . '/admin/assets/select2.css', array(), '4.0.13', 'all' ); } /** * Render the control in the customizer */ public function render_content() { $defaultValue = $this->value(); if ( $this->multiselect ) { $defaultValue = explode( ',', $this->value() ); } ?> tab ) { $this->json['tab'] = $this->tab; } } /** * Enqueue scripts/styles. * * @since 3.4.0 */ public function enqueue() { wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'skyrocket-select2-js' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); } /** * Render the control's content. * */ public function render_content() { ?>
choices as $key => $choice ) : ?>
* @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns * */ class Skyrocket_Upsell_Section extends WP_Customize_Section { /** * The type of control being rendered */ public $type = 'skyrocket-upsell'; /** * The Upsell URL */ public $url = ''; /** * The background color for the control */ public $backgroundcolor = ''; /** * The text color for the control */ public $textcolor = ''; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . '/admin/assets/customizer.js', array( 'jquery' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); } /** * Render the section, and the controls that have been added to it. */ protected function render() { $bkgrndcolor = !empty( $this->backgroundcolor ) ? esc_attr( $this->backgroundcolor ) : '#fff'; $color = !empty( $this->textcolor ) ? esc_attr( $this->textcolor ) : '#555d66'; ?>
  • > >title ); ?>

  • * @license http://www.gnu.org/licenses/gpl-2.0.html * @link https://github.com/maddisondesigns */ class Skyrocket_Divider_Custom_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'simple_divider'; /** * Define the available widths for the divider */ private $available_divider_widths = array( "default", "full", "half" ); /** * Define the available types of divider */ private $available_divider_types = array( "solid", "dashed", "dotted", "double" ); /** * Define the width of the divider. Either 'default', 'full', or 'half'. Default = 'default' */ private $dividerwidth = 'default'; /** * Define the type of divider line. Either 'solid', 'dashed' or 'dotted'. Default = 'solid' */ private $dividertype = 'solid'; /** * Define size of the top margin in px. Default = 20 */ private $margintop = 20; /** * Define size of the top margin in px. Default = 20 */ private $marginbottom = 20; /** * Constructor */ public function __construct( $manager, $id, $args = array(), $options = array() ) { parent::__construct( $manager, $id, $args ); // Check the width of the divider if ( isset( $this->input_attrs['width'] ) ) { if ( in_array( strtolower( $this->input_attrs['width'] ), $this->available_divider_widths, true ) ) { $this->dividerwidth = strtolower( $this->input_attrs['width'] ); } } // Check the type of divider if ( isset( $this->input_attrs['type'] ) ) { if ( in_array( strtolower( $this->input_attrs['type'] ), $this->available_divider_types, true ) ) { $this->dividertype = strtolower( $this->input_attrs['type'] ); } } // Check if the top margin is specified and valid. Will accept int and string values. i.e. 42 or '42' if ( isset( $this->input_attrs['margintop'] ) && is_numeric( $this->input_attrs['margintop'] ) ) { $this->margintop = abs( (int)$this->input_attrs['margintop'] ); } // Check if the bottom margin is specified and valid. Will accept int and string values. i.e. 42 or '42' if ( isset( $this->input_attrs['marginbottom'] ) && is_numeric( $this->input_attrs['marginbottom'] ) ) { $this->marginbottom = abs( (int)$this->input_attrs['marginbottom'] ); } } /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . '/admin/assets/customizer.css', array(), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { ?>
    * @license http://www.gnu.org/licenses/gpl-3.0.html * @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker */ class Skyrocket_Customize_Alpha_Color_Control extends WP_Customize_Control { /** * The type of control being rendered */ public $type = 'alpha-color'; /** * Add support for palettes to be passed in. * * Supported palette values are true, false, or an array of RGBa and Hex colors. */ public $palette; /** * Add support for showing the opacity value on the slider handle. */ public $show_opacity; /** * Enqueue our scripts and styles */ public function enqueue() { wp_enqueue_script( 'skyrocket-custom-controls-js', get_template_directory_uri() . 'js/customizer.js', array( 'jquery', 'wp-color-picker' ), '1.0', true ); wp_enqueue_style( 'skyrocket-custom-controls-css', get_template_directory_uri() . 'css/customizer.css', array( 'wp-color-picker' ), '1.0', 'all' ); } /** * Render the control in the customizer */ public function render_content() { // Process the palette if ( is_array( $this->palette ) ) { $palette = implode( '|', $this->palette ); } else { // Default to true. $palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true'; } // Support passing show_opacity as string or boolean. Default to true. $show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true'; ?> link(); ?> /> $value ) { $input[$key] = sanitize_text_field( $value ); } $input = implode( ',', $input ); } else { $input = sanitize_text_field( $input ); } return $input; } } /** * Switch sanitization * * @param string Switch value * @return integer Sanitized value */ if ( ! function_exists( 'skyrocket_switch_sanitization' ) ) { function skyrocket_switch_sanitization( $input ) { if ( true === $input ) { return 1; } else { return 0; } } } /** * Radio Button and Select sanitization * * @param string Radio Button value * @return integer Sanitized value */ if ( ! function_exists( 'skyrocket_radio_sanitization' ) ) { function skyrocket_radio_sanitization( $input, $setting ) { //get the list of possible radio box or select options $choices = $setting->manager->get_control( $setting->id )->choices; if ( array_key_exists( $input, $choices ) ) { return $input; } else { return $setting->default; } } } /** * URL sanitization * * @param string Input to be sanitized (either a string containing a single url or multiple, separated by commas) * @return string Sanitized input */ if ( ! function_exists( 'skyrocket_url_sanitization' ) ) { function skyrocket_url_sanitization( $input ) { if ( strpos( $input, ',' ) !== false) { $input = explode( ',', $input ); } if ( is_array( $input ) ) { foreach ($input as $key => $value) { $input[$key] = esc_url_raw( $value ); } $input = implode( ',', $input ); } else { $input = esc_url_raw( $input ); } return $input; } } /** * Alpha Color (Hex, RGB & RGBa) sanitization * * @param string Input to be sanitized * @return string Sanitized input */ if ( ! function_exists( 'skyrocket_hex_rgba_sanitization' ) ) { function skyrocket_hex_rgba_sanitization( $input, $setting ) { if ( empty( $input ) || is_array( $input ) ) { return $setting->default; } if ( false === strpos( $input, 'rgb' ) ) { // If string doesn't start with 'rgb' then santize as hex color $input = sanitize_hex_color( $input ); } else { if ( false === strpos( $input, 'rgba' ) ) { // Sanitize as RGB color $input = str_replace( ' ', '', $input ); sscanf( $input, 'rgb(%d,%d,%d)', $red, $green, $blue ); $input = 'rgb(' . skyrocket_in_range( $red, 0, 255 ) . ',' . skyrocket_in_range( $green, 0, 255 ) . ',' . skyrocket_in_range( $blue, 0, 255 ) . ')'; } else { // Sanitize as RGBa color $input = str_replace( ' ', '', $input ); sscanf( $input, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); $input = 'rgba(' . skyrocket_in_range( $red, 0, 255 ) . ',' . skyrocket_in_range( $green, 0, 255 ) . ',' . skyrocket_in_range( $blue, 0, 255 ) . ',' . skyrocket_in_range( $alpha, 0, 1 ) . ')'; } } return $input; } } /* Sanitizers File Image*/ function becommerce_store_sanitize_file( $file, $setting ) { $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'webp' => 'image/webp' ); $file_ext = wp_check_filetype( $file, $mimes ); return ( $file_ext['ext'] ? $file : $setting->default ); } }