protected function sanitize_attributes(&$atts) { $attributes = shortcode_atts(array('type' => 'masonry', 'category' => '', 'order' => 'desc', 'orderby' => 'date', 'number' => '12', 'show_title' => '', 'show_excerpt' => '', 'show_details' => '', 'show_link' => '', 'show_zoom' => '', 'show_categories' => '', 'show_date' => '', 'show_author' => '', 'show_comments' => '', 'columns' => '2', 'column_width' => '370', 'padding' => '20', 'descriptions' => 'under_image', 'hover_bg_color' => 'accent', 'bg_under_projects' => 'with_paddings', 'content_aligment' => 'left', 'colored_bg_content_aligment' => 'centre', 'hover_animation' => 'fade', 'bgwl_animation_effect' => '1', 'hover_content_visibility' => 'on_hover', 'loading_effect' => 'none', 'proportion' => '', 'same_width' => 'false', 'full_width' => '', 'show_filter' => '', 'show_orderby' => '', 'show_order' => '', 'posts_per_page' => '-1'), $atts); // sanitize attributes $attributes['type'] = sanitize_key($attributes['type']); $attributes['loading_effect'] = sanitize_key($attributes['loading_effect']); $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['posts_per_page'] = apply_filters('dt_sanitize_posts_per_page', $attributes['posts_per_page'], $attributes['number']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } $attributes['show_title'] = apply_filters('dt_sanitize_flag', $attributes['show_title']); $attributes['show_excerpt'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpt']); $attributes['show_details'] = apply_filters('dt_sanitize_flag', $attributes['show_details']); $attributes['show_link'] = apply_filters('dt_sanitize_flag', $attributes['show_link']); $attributes['show_zoom'] = apply_filters('dt_sanitize_flag', $attributes['show_zoom']); $attributes['show_categories'] = apply_filters('dt_sanitize_flag', $attributes['show_categories']); $attributes['show_date'] = apply_filters('dt_sanitize_flag', $attributes['show_date']); $attributes['show_author'] = apply_filters('dt_sanitize_flag', $attributes['show_author']); $attributes['show_comments'] = apply_filters('dt_sanitize_flag', $attributes['show_comments']); $attributes['show_filter'] = apply_filters('dt_sanitize_flag', $attributes['show_filter']); $attributes['show_orderby'] = apply_filters('dt_sanitize_flag', $attributes['show_orderby']); $attributes['show_order'] = apply_filters('dt_sanitize_flag', $attributes['show_order']); $attributes['columns'] = absint($attributes['columns']); $attributes['descriptions'] = sanitize_key($attributes['descriptions']); $attributes['descriptions'] = str_replace('hover', 'hoover', $attributes['descriptions']); $attributes['hover_bg_color'] = sanitize_key($attributes['hover_bg_color']); $attributes['bg_under_projects'] = sanitize_key($attributes['bg_under_projects']); $attributes['hover_animation'] = sanitize_key($attributes['hover_animation']); $attributes['bgwl_animation_effect'] = sanitize_key($attributes['bgwl_animation_effect']); $attributes['hover_content_visibility'] = sanitize_key($attributes['hover_content_visibility']); $attributes['hover_content_visibility'] = str_replace('hover', 'hoover', $attributes['hover_content_visibility']); $attributes['content_aligment'] = in_array($attributes['content_aligment'], array('centre', 'center')) ? 'center' : 'left'; $attributes['colored_bg_content_aligment'] = str_replace('centre', 'center', $attributes['colored_bg_content_aligment']); $attributes['same_width'] = apply_filters('dt_sanitize_flag', $attributes['same_width']); $attributes['full_width'] = apply_filters('dt_sanitize_flag', $attributes['full_width']); $attributes['padding'] = intval($attributes['padding']); $attributes['column_width'] = intval($attributes['column_width']); if ($attributes['proportion']) { $wh = array_map('absint', explode(':', $attributes['proportion'])); if (2 == count($wh) && !empty($wh[0]) && !empty($wh[1])) { $attributes['proportion'] = array('width' => $wh[0], 'height' => $wh[1]); } else { $attributes['proportion'] = absint($attributes['proportion']); } } return $attributes; }
protected function sanitize_attributes(&$atts) { $default_atts = array('category' => '', 'order' => 'desc', 'orderby' => 'date', 'number' => '12', 'show_title' => '', 'show_excerpt' => '', 'show_categories' => '', 'show_date' => '', 'show_author' => '', 'show_comments' => '', 'show_miniatures' => '', 'show_media_count' => '', 'padding' => '20', 'target_height' => '240', 'hide_last_row' => '', 'descriptions' => 'on_hover_centered', 'hover_bg_color' => 'accent', 'bg_under_albums' => 'disabled', 'content_aligment' => 'left', 'colored_bg_content_aligment' => 'centre', 'hover_animation' => 'fade', 'bgwl_animation_effect' => '1', 'hover_content_visibility' => 'on_hover', 'loading_effect' => 'none', 'proportion' => '', 'full_width' => '', 'show_filter' => '', 'posts_per_page' => '-1'); $attributes = shortcode_atts($default_atts, $atts); // sanitize attributes $attributes['loading_effect'] = sanitize_key($attributes['loading_effect']); $attributes['hover_bg_color'] = sanitize_key($attributes['hover_bg_color']); $attributes['hover_animation'] = sanitize_key($attributes['hover_animation']); $attributes['bgwl_animation_effect'] = sanitize_key($attributes['bgwl_animation_effect']); $attributes['descriptions'] = sanitize_key($attributes['descriptions']); $attributes['descriptions'] = str_replace('hover', 'hoover', $attributes['descriptions']); $attributes['bg_under_albums'] = sanitize_key($attributes['bg_under_albums']); $attributes['content_aligment'] = in_array($attributes['content_aligment'], array('centre', 'center')) ? 'center' : 'left'; $attributes['colored_bg_content_aligment'] = str_replace('centre', 'center', $attributes['colored_bg_content_aligment']); $attributes['hover_content_visibility'] = sanitize_key($attributes['hover_content_visibility']); $attributes['hover_content_visibility'] = str_replace('hover', 'hoover', $attributes['hover_content_visibility']); $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['posts_per_page'] = apply_filters('dt_sanitize_posts_per_page', $attributes['posts_per_page'], $attributes['number']); $attributes['show_title'] = apply_filters('dt_sanitize_flag', $attributes['show_title']); $attributes['show_excerpt'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpt']); $attributes['show_categories'] = apply_filters('dt_sanitize_flag', $attributes['show_categories']); $attributes['show_date'] = apply_filters('dt_sanitize_flag', $attributes['show_date']); $attributes['show_author'] = apply_filters('dt_sanitize_flag', $attributes['show_author']); $attributes['show_comments'] = apply_filters('dt_sanitize_flag', $attributes['show_comments']); $attributes['show_filter'] = apply_filters('dt_sanitize_flag', $attributes['show_filter']); $attributes['show_miniatures'] = apply_filters('dt_sanitize_flag', $attributes['show_miniatures']); $attributes['show_miniatures'] = apply_filters('dt_sanitize_flag', $attributes['show_miniatures']); $attributes['show_media_count'] = apply_filters('dt_sanitize_flag', $attributes['show_media_count']); $attributes['full_width'] = apply_filters('dt_sanitize_flag', $attributes['full_width']); $attributes['hide_last_row'] = apply_filters('dt_sanitize_flag', $attributes['hide_last_row']); $attributes['padding'] = intval($attributes['padding']); $attributes['target_height'] = intval($attributes['target_height']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } if ($attributes['proportion']) { $wh = array_map('absint', explode(':', $attributes['proportion'])); if (2 == count($wh) && !empty($wh[0]) && !empty($wh[1])) { $attributes['proportion'] = array('width' => $wh[0], 'height' => $wh[1]); } else { $attributes['proportion'] = ''; } } return $attributes; }
protected function sanitize_attributes(&$atts) { $default_atts = array('category' => '', 'padding' => '5', 'proportion' => '', 'loading_effect' => 'fade_in', 'target_height' => '240', 'hide_last_row' => '', 'show_title' => '', 'show_excerpt' => '', 'number' => '6', 'order' => '', 'orderby' => ''); $attributes = shortcode_atts($default_atts, $atts); // sanitize attributes $attributes['loading_effect'] = sanitize_key($attributes['loading_effect']); $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['show_title'] = apply_filters('dt_sanitize_flag', $attributes['show_title']); $attributes['show_excerpt'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpt']); $attributes['hide_last_row'] = apply_filters('dt_sanitize_flag', $attributes['hide_last_row']); $attributes['padding'] = intval($attributes['padding']); $attributes['target_height'] = intval($attributes['target_height']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } if ($attributes['proportion']) { $wh = array_map('absint', explode(':', $attributes['proportion'])); if (2 == count($wh) && !empty($wh[0]) && !empty($wh[1])) { $attributes['proportion'] = array('width' => $wh[0], 'height' => $wh[1]); } else { $attributes['proportion'] = ''; } } return $attributes; }
protected function sanitize_attributes(&$atts) { $atts = $this->compatibility_filter($atts); $attributes = shortcode_atts(array('type' => 'masonry', 'category' => '', 'order' => 'desc', 'orderby' => 'date', 'number' => '12', 'proportion' => '', 'same_width' => 'false', 'padding' => '20', 'column_width' => '370', 'columns_number' => '3', 'full_width' => '', 'fancy_date' => '', 'background' => 'disabled', 'show_excerpts' => '', 'show_read_more_button' => '', 'loading_effect' => 'none', 'show_post_categories' => '', 'show_post_date' => '', 'show_post_author' => '', 'show_post_comments' => '', 'show_filter' => '', 'show_orderby' => '', 'show_order' => '', 'posts_per_page' => '-1'), $atts); // sanitize attributes $attributes['type'] = sanitize_key($attributes['type']); $attributes['background'] = sanitize_key($attributes['background']); $attributes['loading_effect'] = sanitize_key($attributes['loading_effect']); $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['posts_per_page'] = apply_filters('dt_sanitize_posts_per_page', $attributes['posts_per_page'], $attributes['number']); $attributes['same_width'] = apply_filters('dt_sanitize_flag', $attributes['same_width']); $attributes['full_width'] = apply_filters('dt_sanitize_flag', $attributes['full_width']); $attributes['fancy_date'] = apply_filters('dt_sanitize_flag', $attributes['fancy_date']); $attributes['show_excerpts'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpts']); $attributes['show_read_more_button'] = apply_filters('dt_sanitize_flag', $attributes['show_read_more_button']); $attributes['show_post_categories'] = apply_filters('dt_sanitize_flag', $attributes['show_post_categories']); $attributes['show_post_date'] = apply_filters('dt_sanitize_flag', $attributes['show_post_date']); $attributes['show_post_author'] = apply_filters('dt_sanitize_flag', $attributes['show_post_author']); $attributes['show_post_comments'] = apply_filters('dt_sanitize_flag', $attributes['show_post_comments']); $attributes['show_filter'] = apply_filters('dt_sanitize_flag', $attributes['show_filter']); $attributes['show_orderby'] = apply_filters('dt_sanitize_flag', $attributes['show_orderby']); $attributes['show_order'] = apply_filters('dt_sanitize_flag', $attributes['show_order']); $attributes['padding'] = absint($attributes['padding']); $attributes['column_width'] = absint($attributes['column_width']); $attributes['columns_number'] = absint($attributes['columns_number']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } if ($attributes['proportion']) { $wh = array_map('absint', explode(':', $attributes['proportion'])); if (2 == count($wh) && !empty($wh[0]) && !empty($wh[1])) { $attributes['proportion'] = array('width' => $wh[0], 'height' => $wh[1]); } else { $attributes['proportion'] = ''; } } return $attributes; }
protected function sanitize_attributes(&$atts) { $atts = $this->compatibility_filter($atts); $clean_atts = shortcode_atts(array('category' => '', 'column_width' => '180', 'columns_number' => '3', 'style' => '1', 'image_background' => '1', 'image_background_border' => '', 'image_background_border_radius' => '', 'image_background_paint' => 'light', 'image_background_color' => '', 'image_hover_background_paint' => 'light', 'image_hover_background_color' => '', 'image_background_size' => '70', 'icons_size' => '36', 'icons_paint' => 'light', 'icons_color' => '', 'icons_hover_paint' => 'light', 'icons_hover_color' => '', 'decorative_lines' => 'disabled', 'header_size' => 'h5', 'content_size' => 'normal', 'number' => '6', 'target_blank' => 'true', 'order' => '', 'orderby' => '', 'animation' => 'none', 'animate' => 'one_by_one'), $atts); $clean_atts['order'] = apply_filters('dt_sanitize_order', $clean_atts['order']); $clean_atts['orderby'] = apply_filters('dt_sanitize_orderby', $clean_atts['orderby']); $clean_atts['number'] = apply_filters('dt_sanitize_posts_per_page', $clean_atts['number']); $clean_atts['image_background'] = apply_filters('dt_sanitize_flag', $clean_atts['image_background']); $clean_atts['target_blank'] = apply_filters('dt_sanitize_flag', $clean_atts['target_blank']); $clean_atts['image_background_border'] = sanitize_key($clean_atts['image_background_border']); $clean_atts['image_background_paint'] = sanitize_key($clean_atts['image_background_paint']); $clean_atts['image_hover_background_paint'] = sanitize_key($clean_atts['image_hover_background_paint']); $clean_atts['icons_paint'] = sanitize_key($clean_atts['icons_paint']); $clean_atts['icons_hover_paint'] = sanitize_key($clean_atts['icons_hover_paint']); $clean_atts['decorative_lines'] = sanitize_key($clean_atts['decorative_lines']); $clean_atts['header_size'] = sanitize_key($clean_atts['header_size']); $clean_atts['content_size'] = sanitize_key($clean_atts['content_size']); $clean_atts['animate'] = sanitize_key($clean_atts['animate']); $clean_atts['column_width'] = absint($clean_atts['column_width']); $clean_atts['columns_number'] = absint($clean_atts['columns_number']); $clean_atts['style'] = absint($clean_atts['style']); $clean_atts['image_background_border_radius'] = absint($clean_atts['image_background_border_radius']); $clean_atts['icons_size'] = absint($clean_atts['icons_size']); $clean_atts['image_background_size'] = absint($clean_atts['image_background_size']); $clean_atts['image_background_color'] = esc_attr($clean_atts['image_background_color']); $clean_atts['image_hover_background_color'] = esc_attr($clean_atts['image_hover_background_color']); $clean_atts['icons_color'] = esc_attr($clean_atts['icons_color']); $clean_atts['icons_hover_color'] = esc_attr($clean_atts['icons_hover_color']); if ($clean_atts['category']) { $clean_atts['category'] = presscore_sanitize_explode_string($clean_atts['category']); $clean_atts['select'] = 'only'; } else { $clean_atts['select'] = 'all'; } $this->atts = $clean_atts; return $clean_atts; }
protected function sanitize_attributes($atts) { $default_atts = array('type' => 'masonry', 'category' => '', 'columns' => '2', 'order' => '', 'orderby' => '', 'number' => '6', 'padding' => '5', 'column_width' => '370', 'full_width' => '', 'autoslide' => '0', 'loading_effect' => 'fade_in'); $attributes = shortcode_atts($default_atts, $atts); // sanitize attributes $attributes['type'] = sanitize_key($attributes['type']); $attributes['loading_effect'] = sanitize_key($attributes['loading_effect']); $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['full_width'] = apply_filters('dt_sanitize_flag', $attributes['full_width']); $attributes['padding'] = intval($attributes['padding']); $attributes['autoslide'] = absint($attributes['autoslide']); $attributes['column_width'] = absint($attributes['column_width']); $attributes['columns'] = absint($attributes['columns']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } return $attributes; }
protected function sanitize_attributes(&$atts) { $attributes = shortcode_atts(array('category' => '', 'order' => 'desc', 'orderby' => 'date', 'number' => '12', 'show_title' => '', 'show_excerpt' => '', 'show_details' => '', 'show_link' => '', 'show_zoom' => '', 'show_categories' => '', 'show_date' => '', 'show_author' => '', 'show_comments' => '', 'padding' => '20', 'appearance' => 'under_image', 'hover_bg_color' => 'accent', 'bg_under_projects' => 'disabled', 'content_aligment' => 'left', 'hover_animation' => 'fade', 'colored_bg_content_aligment' => 'centre', 'bgwl_animation_effect' => '1', 'hover_content_visibility' => 'on_hover', 'autoslide' => '', 'loop' => '', 'arrows' => 'light', 'width' => '', 'height' => '210'), $atts); // sanitize attributes $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']); $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']); $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['show_title'] = apply_filters('dt_sanitize_flag', $attributes['show_title']); $attributes['show_excerpt'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpt']); $attributes['show_details'] = apply_filters('dt_sanitize_flag', $attributes['show_details']); $attributes['show_link'] = apply_filters('dt_sanitize_flag', $attributes['show_link']); $attributes['show_zoom'] = apply_filters('dt_sanitize_flag', $attributes['show_zoom']); $attributes['show_categories'] = apply_filters('dt_sanitize_flag', $attributes['show_categories']); $attributes['show_date'] = apply_filters('dt_sanitize_flag', $attributes['show_date']); $attributes['show_author'] = apply_filters('dt_sanitize_flag', $attributes['show_author']); $attributes['show_comments'] = apply_filters('dt_sanitize_flag', $attributes['show_comments']); $attributes['loop'] = apply_filters('dt_sanitize_flag', $attributes['loop']); $attributes['appearance'] = str_replace('hover', 'hoover', sanitize_key($attributes['appearance'])); $attributes['hover_content_visibility'] = str_replace('hover', 'hoover', sanitize_key($attributes['hover_content_visibility'])); $attributes['hover_animation'] = sanitize_key($attributes['hover_animation']); $attributes['bgwl_animation_effect'] = sanitize_key($attributes['bgwl_animation_effect']); $attributes['hover_bg_color'] = sanitize_key($attributes['hover_bg_color']); $attributes['bg_under_projects'] = sanitize_key($attributes['bg_under_projects']); $attributes['content_aligment'] = sanitize_key($attributes['content_aligment']); $attributes['colored_bg_content_aligment'] = str_replace('centre', 'center', $attributes['colored_bg_content_aligment']); $attributes['arrows'] = sanitize_key($attributes['arrows']); $attributes['width'] = absint($attributes['width']); $attributes['height'] = absint($attributes['height']); $attributes['padding'] = absint($attributes['padding']); $attributes['autoslide'] = absint($attributes['autoslide']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } return $attributes; }
protected function sanitize_attributes(&$atts) { $default_atts = array('category' => '', 'padding' => '5', 'show_title' => '', 'show_excerpt' => '', 'number' => '6', 'orderby' => 'recent', 'autoslide' => '', 'loop' => '', 'arrows' => 'light', 'width' => 0, 'height' => 210); $attributes = shortcode_atts($default_atts, $atts); // sanitize attributes $attributes['orderby'] = 'recent' == $attributes['orderby'] ? 'date' : 'rand'; $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['show_title'] = apply_filters('dt_sanitize_flag', $attributes['show_title']); $attributes['show_excerpt'] = apply_filters('dt_sanitize_flag', $attributes['show_excerpt']); $attributes['loop'] = apply_filters('dt_sanitize_flag', $attributes['loop']); $attributes['arrows'] = sanitize_key($attributes['arrows']); $attributes['width'] = absint($attributes['width']); $attributes['height'] = absint($attributes['height']); $attributes['padding'] = absint($attributes['padding']); $attributes['autoslide'] = absint($attributes['autoslide']); if ($attributes['category']) { $attributes['category'] = presscore_sanitize_explode_string($attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } return $attributes; }