/** * Check bootstrap shortcode parameter. * * @since 0.2.1 * @access private * @uses wp_bc_bool() * @param array $original_atts Original attributes passed to the DPS shortcode. * @return bool True if bootstrap parameter is set and evaluates to true, otherwise false. */ private function is_bootstrap($original_atts = array()) { return isset($original_atts['bootstrap']) && false !== wp_bc_bool($original_atts['bootstrap']) ? true : false; }
/** * Parse and sanitize carousel shortcode attributes. * * @since 0.1.1 * @access public * @param array $atts Array of user defined shortcode attributes. * @return array Array containing an array of query args, and and array of display vars. */ public function get_data($atts) { // variables $post_parent = intval($GLOBALS['post']->ID); $thumbnail_id = get_post_meta($post_parent, '_thumbnail_id', true); // parse shortcode atts /** * Filter the default shortcode atts. * * @param array $atts Array containing the default shortcode atts. */ $atts = shortcode_atts(apply_filters('wp_bootstrap_carousel_shortcode_atts', array('post_parent' => $post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'exclude' => '' == $thumbnail_id ? '' : $thumbnail_id, 'order' => 'ASC', 'orderby' => 'ID', 'width' => 0, 'image_size' => 'large', 'rel' => '', 'file' => 1, 'comments' => 0, 'slide' => 1, 'controls' => 1, 'interval' => 5000, 'pause' => 'hover', 'wrap' => 1, 'keyboard' => 1, 'thickbox' => 1, 'unwrap' => 0)), $atts, 'carousel'); // sanitize query vars $post_parent = intval($atts['post_parent']); $post_status = sanitize_text_field($atts['post_status']); $post_type = sanitize_text_field($atts['post_type']); $post_mime_type = sanitize_text_field($atts['post_mime_type']); $exclude = array_map('intval', explode(',', $atts['exclude'])); $order = sanitize_key($atts['order']); $orderby = 'rand' == $order ? 'none' : sanitize_key($atts['orderby']); // sanitize display vars $width = intval(str_replace(array('%', 'px', ' '), '', trim($atts['width']))); $image_size = sanitize_text_field($atts['image_size']); $rel = sanitize_text_field($atts['rel']); $file = wp_bc_bool($atts['file']); $comments = wp_bc_bool($atts['comments']); $slide = wp_bc_bool($atts['slide']); $controls = wp_bc_bool($atts['controls']); // sanitize js vars $interval = intval($atts['interval']); $pause = sanitize_text_field($atts['pause']); $wrap = wp_bc_bool($atts['wrap']); $keyboard = wp_bc_bool($atts['keyboard']); $thickbox = wp_bc_bool($atts['thickbox']); $unwrap = wp_bc_bool($atts['unwrap']); $query = get_children(compact('post_parent', 'post_status', 'post_type', 'post_mime_type', 'exclude', 'order', 'orderby')); // return data return compact('query', 'post_parent', 'width', 'image_size', 'rel', 'file', 'comments', 'slide', 'controls', 'interval', 'pause', 'wrap', 'keyboard', 'thickbox', 'unwrap'); }