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 ); } endif; if ( !function_exists('capacious_sanitize_dropdown_pages') ) : function capacious_sanitize_dropdown_pages( $page_id, $setting ) { $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } endif; /*santized repeater */ function capacious_sanitize_repeater($input){ $input_decoded = json_decode( $input, true ); $allowed_html = array( 'br' => array(), 'em' => array(), 'strong' => array(), 'a' => array( 'href' => array(), 'class' => array(), 'id' => array(), 'target' => array() ), 'button' => array( 'class' => array(), 'id' => array() ) ); if(!empty($input_decoded)) { foreach ($input_decoded as $boxes => $box ){ foreach ($box as $key => $value){ $input_decoded[$boxes][$key] = sanitize_text_field( $value ); } } return json_encode($input_decoded); } return $input; }