/** * Some shortcodes triks. * From: http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/ */ function dt_get_puny_shortcodes() { $puny_shortcodes = array('dt_gap' => array(DT_Shortcode_Gap::get_instance(), 'shortcode'), 'dt_divider' => array(DT_Shortcode_Divider::get_instance(), 'shortcode'), 'dt_stripe' => array(DT_Shortcode_Stripe::get_instance(), 'shortcode'), 'dt_box' => array(DT_Shortcode_Box::get_instance(), 'shortcode'), 'dt_cell' => array(DT_Shortcode_Columns::get_instance(), 'shortcode_cell'), 'dt_code' => array(DT_Shortcode_Code::get_instance(), 'shortcode_prepare'), 'dt_toggle' => array(DT_Shortcode_Toggles::get_instance(), 'shortcode'), 'dt_item' => array(DT_Shortcode_Accordion::get_instance(), 'shortcode_item'), 'dt_benefits' => array(DT_Shortcode_Benefits::get_instance(), 'shortcode_benefits'), 'dt_benefit' => array(DT_Shortcode_Benefits::get_instance(), 'shortcode_benefit'), 'dt_progress_bars' => array(DT_Shortcode_ProgressBars::get_instance(), 'shortcode_bars'), 'dt_progress_bar' => array(DT_Shortcode_ProgressBars::get_instance(), 'shortcode_bar'), 'dt_button' => array(DT_Shortcode_Button::get_instance(), 'shortcode'), 'dt_teaser' => array(DT_Shortcode_Teaser::get_instance(), 'shortcode'), 'dt_call_to_action' => array(DT_Shortcode_CallToAction::get_instance(), 'shortcode'), 'dt_fancy_image' => array(DT_Shortcode_FancyImage::get_instance(), 'shortcode'), 'dt_list_item' => array(DT_Shortcode_List::get_instance(), 'shortcode_item'), 'dt_list' => array(DT_Shortcode_List::get_instance(), 'shortcode_list'), 'dt_quote' => array(DT_Shortcode_Quote::get_instance(), 'shortcode'), 'dt_banner' => array(DT_Shortcode_Banner::get_instance(), 'shortcode'), 'dt_accordion' => array(DT_Shortcode_Accordion::get_instance(), 'shortcode_accordion'), 'dt_text' => array(DT_Shortcode_AnimatedText::get_instance(), 'shortcode'), 'dt_social_icons' => array(DT_Shortcode_SocialIcons::get_instance(), 'shortcode_icons_content'), 'dt_social_icon' => array(DT_Shortcode_SocialIcons::get_instance(), 'shortcode_icon'), 'dt_vc_list_item' => array(DT_Shortcode_List_Vc::get_instance(), 'shortcode_item'), 'dt_vc_list' => array(DT_Shortcode_List_Vc::get_instance(), 'shortcode_list')); if (function_exists('vc_is_inline') && vc_is_inline()) { $puny_shortcodes = array(); } return apply_filters('dt_get_puny_shortcodes', $puny_shortcodes); }
// add shortcode button $tinymce_button = new DT_ADD_MCE_BUTTON($this->plugin_name, basename(dirname(__FILE__)), false, 4); } public function shortcode_bars($atts, $content = null) { $attributes = shortcode_atts(array('show_percentage' => '1'), $atts); $attributes['show_percentage'] = apply_filters('dt_sanitize_flag', $attributes['show_percentage']); $atts_backup = self::$atts; self::$atts = $attributes; $output = sprintf('<div class="skills animate-element">%s</div>', do_shortcode($content)); self::$atts = $atts_backup; return $output; } public function shortcode_bar($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'color' => '', 'percentage' => ''), $atts)); $title = wp_kses($title, array()); $color = esc_attr($color); $percentage = absint($percentage); $percentage = $percentage > 100 ? 100 : $percentage; $show_percentage = true; if (!empty(self::$atts)) { $show_percentage = self::$atts['show_percentage']; } $output = sprintf('<div class="skill-name">%1$s%4$s</div><div class="skill"><div class="skill-value" data-width="%2$s"%3$s></div></div>', $title, $percentage, $color ? ' style="background-color: ' . $color . '"' : '', $show_percentage ? ' <span>' . $percentage . '%</span>' : ''); return $output; } } // create shortcode DT_Shortcode_ProgressBars::get_instance();