label ) ) { ?>
label ); ?>
description ) ) { ?>
description ); ?>
value() ) ); ?>
link(); ?> />
choices as $key => $value ) { ?>
class="multi-image-checkbox"/>
label ) ) { ?>
label ); ?>
description ) ) { ?>
description ); ?>
choices as $key => $value ) { ?>
link(); ?> value() ); ?>/>
array(
'href' => array(),
'title' => array(),
'class' => array(),
'target' => array(),
),
'br' => array(),
'em' => array(),
'strong' => array(),
'i' => array(
'class' => array()
),
'span' => array(
'class' => array(),
),
'code' => array(),
);
?>
label ) ) { ?>
label ); ?>
description ) ) { ?>
description, $allowed_html ); ?>
button_labels = wp_parse_args( $this->button_labels,
array(
'add' => esc_html__( 'Add', 'caff' ),
)
);
}
/**
* Render the control in the customizer
*/
public function render_content() {
?>
label ) ) { ?>
label ); ?>
description ) ) { ?>
description ); ?>
link(); ?> />
button_labels['add'] ); ?>
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'];
}
}
/**
* Render the control in the customizer
*/
public function render_content() {
$defaultValue = $this->value();
if ( $this->multiselect ) {
$defaultValue = explode( ',', $this->value() );
}
?>
label ) ) { ?>
label ); ?>
description ) ) { ?>
description ); ?>
link(); ?> />
multiselect ? 'multiple="multiple" ' : '' ); ?>>
multiselect ) {
// When using Select2 for single selection, the Placeholder needs an empty at the top of the list for it to work (multi-selects dont need this)
echo ' ';
}
foreach ( $this->choices as $key => $value ) {
if ( is_array( $value ) ) {
echo '';
foreach ( $value as $optgroupkey => $optgroupvalue ) {
echo '' . esc_attr( $optgroupvalue ) . ' ';
}
echo ' ';
}
else {
echo '' . esc_attr( $value ) . ' ';
}
}
?>
posts = Caff_Customizer_Utilities::get_posts_as_array( $this->input_attrs );
}
/**
* Render the control in the customizer
*/
public function render_content() {
?>
label ) ) { ?>
label ); ?>
description ) ) { ?>
description ); ?>
link(); ?>>
posts ) ) {
foreach ( $this->posts as $id => $title ) {
printf( '%s ',
absint( $id ),
selected( $this->value(), $id, false ),
esc_html( $title )
);
}
}
?>
backgroundcolor ) ? esc_attr( $this->backgroundcolor ) : '#fff';
$color = !empty( $this->textcolor ) ? esc_attr( $this->textcolor ) : '#555d66';
?>
json['cafftinymcetoolbar1'] = isset( $this->input_attrs['toolbar1'] ) ? esc_attr( $this->input_attrs['toolbar1'] ) : 'bold italic bullist numlist alignleft aligncenter alignright link';
$this->json['cafftinymcetoolbar2'] = isset( $this->input_attrs['toolbar2'] ) ? esc_attr( $this->input_attrs['toolbar2'] ) : '';
$this->json['caffmediabuttons'] = isset( $this->input_attrs['mediaButtons'] ) && ( $this->input_attrs['mediaButtons'] === true ) ? true : false;
}
/**
* Render the control in the customizer
*/
public function render_content(){
?>
label ); ?>
description ) ) { ?>
description ); ?>
' . wp_kses_post( $this->label ) . ' ';
}
}
/**
* 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( 'caff_url_sanitization' ) ) {
function caff_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;
}
}
/**
* Switch sanitization
*
* @param string Switch value
* @return integer Sanitized value
*/
if ( ! function_exists( 'caff_switch_sanitization' ) ) {
function caff_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( 'caff_radio_sanitization' ) ) {
function caff_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;
}
}
}
/**
* Text sanitization
*
* @param string Input to be sanitized
* @return string Sanitized input
*/
if ( ! function_exists( 'caff_text_sanitization' ) ) {
function caff_text_sanitization( $input ) {
return sanitize_text_field( $input );
}
}
/**
* Select sanitization callback example.
*
* - Sanitization: select
* - Control: select, radio
*
* Sanitization callback for 'select' and 'radio' type controls. This callback sanitizes `$input`
* as a slug, and then validates `$input` against the choices defined for the control.
*
* @see sanitize_key() https://developer.wordpress.org/reference/functions/sanitize_key/
* @see $wp_customize->get_control() https://developer.wordpress.org/reference/classes/wp_customize_manager/get_control/
*
* @param string $input Slug to sanitize.
* @param WP_Customize_Setting $setting Setting instance.
* @return string Sanitized slug if it is a valid choice; otherwise, the setting default.
*/
function caff_sanitize_select( $input, $setting ) {
// Ensure input is a slug.
$input = sanitize_key( $input );
// Get list of choices from the control associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it; otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
/**
* Sanitize Google map code to allow iframe
*/
function caff_sanitize_map_code( $input ) {
// allow iframe.
return wp_kses( $input, array(
'iframe' => array(
'align' => true,
'width' => true,
'height' => true,
'frameborder' => true,
'name' => true,
'src' => true,
'id' => true,
'class' => true,
'style' => true,
'scrolling' => true,
'marginwidth' => true,
'marginheight' => true,
) ) );
}
}