fields = $fields; $this->label = $args['label']; parent::__construct( $manager, $id, $args ); } /** * enqueue css and scrpts * * @since 1.2.8 */ public function enqueue() { wp_enqueue_style('business-roy-group-control', get_template_directory_uri() . '/inc/custom-controller/group/css/group.css', array()); wp_enqueue_script('business-roy-group-control', get_template_directory_uri().'/inc/custom-controller/group/js/group.js', array( 'jquery', 'customize-controls' ), '', true); wp_localize_script( 'business-roy-group-control', 'businessRoyLocalize', array( 'colorPalettes' => business_roy_default_color_palettes(), ) ); } /** * Renders the control wrapper and calls $this->render_content() for the internals. * * @see WP_Customize_Control::render() */ protected function render() { $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); $class = 'customize-control has-switchers customize-control-' . $this->type; ?>
  • render_content(); ?>
  • value() ) && ! empty( $this->value() ) ) { $values = json_encode( $this->value() ); } else { $values = $this->value(); } ?> link(); ?> class="business-roy-group-collection" value=""/> fields; if ( is_array( $this->value() ) && ! empty( $this->value() ) ) { $values = $this->value(); } else { $values = json_decode( $this->value(), true ); } ?>
  • " . esc_html( $this->label ) . ''; ?>

    description ) { ?> description ); ?>
  • array( 'icon' => 'dashicons-laptop', ), 'tablet' => array( 'icon' => 'dashicons-tablet', ), 'mobile' => array( 'icon' => 'dashicons-smartphone ', ), ); $default_fields = array( 'top' => true, 'right' => true, 'bottom' => true, 'left' => true, ); $box_fields_attr = ! empty( $box_fields ) ? $box_fields : $default_fields; $min = isset( $attr['min'] ) ? $attr['min'] : 0; $max = isset( $attr['max'] ) ? $attr['max'] : 1000; $step = isset( $attr['step'] ) ? $attr['step'] : 1; $link = isset( $attr['link'] ) ? $attr['link'] : 1; $link_toggle = isset( $attr['link_toggle'] ) ? $attr['link_toggle'] : true; $devices = isset( $attr['devices'] ) ? $attr['devices'] : $devices; $link_text = isset( $attr['link_text'] ) ? $attr['link_text'] : esc_html__( 'Link', 'business-roy' ); if ( count( $devices ) > 1 ) { ?>
    $device_details ) { if ( $i == 1 ) { $active = ' active'; } else { $active = ''; } echo '
    $value ) { switch ( $key ) : case 'background-size': case 'background-position': case 'background-repeat': case 'background-attachment': $output[ $key ] = sanitize_key( $value ); break; case 'background-image': $output[ $key ] = esc_url_raw( $value ); break; case 'background-color': case 'background-hover-color': case 'background-color-title': case 'title-font-color': case 'background-color-post': case 'site-title-color': case 'site-tagline-color': case 'post-font-color': case 'text-color': case 'text-hover-color': case 'title-color': case 'link-color': case 'link-hover-color': case 'on-sale-bg': case 'on-sale-color': case 'out-of-stock-bg': case 'out-of-stock-color': case 'rating-color': case 'grid-list-color': case 'grid-list-hover-color': case 'categories-color': case 'categories-hover-color': case 'deleted-price-color': case 'deleted-price-hover-color': case 'price-color': case 'price-hover-color': case 'content-color': case 'content-hover-color': case 'tab-list-color': case 'tab-content-color': case 'tab-list-border-color': case 'tab-content-border-color': case 'background-stripped-color': case 'button-color': case 'button-hover-color': case 'icon-color': case 'icon-hover-color': case 'meta-color': case 'next-prev-color': case 'next-prev-hover-color': case 'button-bg-color': case 'button-bg-hover-color': $output[ $key ] = business_roy_sanitize_color( $value ); break; case 'margin': case 'padding': case 'radius': $output[ $key ] = business_roy_sanitize_field_css_box( $value ); break; default: $output[ $key ] = sanitize_text_field( $value ); break; endswitch; } return json_encode( $output ); } return $input; } endif; if ( ! function_exists( 'business_roy_sanitize_color' ) ) : /** * Color sanitization callback * https://wordpress.stackexchange.com/questions/257581/escape-hexadecimals-rgba-values * @since 1.0.0 */ function business_roy_sanitize_color( $color ) { if ( empty( $color ) || is_array( $color ) ) { return ''; } // If string does not start with 'rgba', then treat as hex. // sanitize the hex color and finally convert hex to rgba if ( false === strpos( $color, 'rgba' ) ) { return sanitize_hex_color( $color ); } // By now we know the string is formatted as an rgba color so we need to further sanitize it. $color = str_replace( ' ', '', $color ); sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; } endif; if ( ! function_exists( 'business_roy_sanitize_field_css_box' ) ) : /** * Sanitize Default Css Box * * @since Business Roy 1.0.0 * * @param $input * @return array * */ function business_roy_sanitize_field_css_box( $input_decoded ) { // print_r($input ); exit; // $input_decoded = json_decode( $input, true ); $output = array(); if ( ! empty( $input_decoded ) ) { foreach ( $input_decoded as $device_id => $device_details ) { foreach ( $device_details as $key => $value ) { if ( $key == 'cssbox_link' ) { $output[ $device_id ][ $key ] = $value; //( ( isset( $value ) && true === $value ) ? 1 : 0 ); } else { $output[ $device_id ][ $key ] = $value !='' ? intval( $value ) : ''; } } } return ( $output ); } return $input_decoded; } endif;