示例#1
0
 public function render($atts)
 {
     extract($atts);
     $extra = $this->extra(array('id' => $id, 'class' => $class, 'style' => $style));
     $card_padding = implode(' ', $card_padding);
     if ($front_graphic == 'icon') {
         $front_graphic = "front_icon=\"{$front_icon}\" front_icon_size=\"{$front_icon_size}\" front_icon_color=\"{$front_icon_color}\"";
     } else {
         if ($front_graphic == 'image') {
             $front_graphic = "front_image=\"{$front_image}\" front_image_width=\"{$front_image_width}\"";
         }
     }
     $front_border = $this->borderStyle($front_border_width, $front_border_style, $front_border_color);
     $front_style = $front_border . ' color: ' . $front_color . '; background-color: ' . $front_bg_color . ';';
     $back_border = $this->borderStyle($back_border_width, $back_border_style, $back_border_color);
     $back_style = $back_border . ' color: ' . $back_color . '; background-color: ' . $back_bg_color . ';';
     $front_title = cs_clean_shortcode_att($front_title);
     $front_text = cs_clean_shortcode_att($front_text);
     $back_title = cs_clean_shortcode_att($back_title);
     $back_text = cs_clean_shortcode_att($back_text);
     $back_button_text = cs_clean_shortcode_att($back_button_text);
     if ('true' == $back_button_enabled) {
         $back_button_atts = " back_button_text=\"{$back_button_text}\" back_button_link=\"{$back_button_link}\" back_button_color=\"{$back_button_color}\" back_button_bg_color=\"{$back_button_bg_color}\"";
     } else {
         $back_button_atts = " back_button_enabled=\"false\"";
     }
     $shortcode = "[x_card animation=\"{$animation}\" center_vertically=\"{$center_vertically}\" front_style=\"{$front_style}\" {$front_graphic} front_title=\"{$front_title}\" front_text=\"{$front_text}\" back_style=\"{$back_style}\" back_title=\"{$back_title}\" back_text=\"{$back_text}\" {$back_button_atts} padding=\"{$card_padding}\"{$extra}]";
     return $shortcode;
 }
示例#2
0
 public function render($atts)
 {
     extract($atts);
     $cite = cs_clean_shortcode_att($cite);
     $shortcode = "[x_blockquote cite=\"{$cite}\" type=\"{$align}\"{$extra}]{$content}[/x_blockquote]";
     return $shortcode;
 }
 public function render($atts)
 {
     extract($atts);
     $alt_padding = implode(' ', $alt_padding);
     if ($graphic == 'icon') {
         $graphic = "icon=\"{$icon_type}\" icon_size=\"{$icon_size}\"";
     } else {
         if ($graphic == 'image') {
             $graphic = "image=\"{$image}\" image_width=\"{$image_width}\"";
         }
     }
     $text = cs_clean_shortcode_att($text);
     $shortcode = "[x_creative_cta padding=\"{$alt_padding}\" text=\"{$text}\" font_size=\"{$font_size}\" {$graphic} animation=\"{$animation}\" link=\"{$link}\" color=\"{$color}\" bg_color=\"{$bg_color}\" bg_color_hover=\"{$bg_color_hover}\"{$extra}]";
     return $shortcode;
 }
 /**
  * Data is assumed to be sanitize
  * @param  [type] $atts    [description]
  * @param  string $content [description]
  * @param  [type] $parent  [description]
  * @return [type]          [description]
  */
 public function build_shortcode($atts, $content = '', $parent = null)
 {
     if (!apply_filters($this->hook_prefix . 'should_have_markup', true, $atts, $content, $parent)) {
         return '';
     }
     $atts = $this->compose($atts);
     $atts = $this->controls()->filter_atts_for_shortcode($atts);
     $atts = apply_filters($this->hook_prefix . 'update_build_shortcode_atts', $atts, $parent);
     $atts = $this->build_shortcode_clean_atts($atts);
     if (isset($atts['content'])) {
         if ('' == $content) {
             $content = $atts['content'];
         }
         unset($atts['content']);
     }
     $content = apply_filters($this->hook_prefix . 'update_build_shortcode_content', $content, $parent);
     $output = "[{$this->shortcode_name}";
     foreach ($atts as $attribute => $value) {
         $clean = cs_clean_shortcode_att($value);
         $att = sanitize_key($attribute);
         $output .= " {$att}=\"{$clean}\"";
     }
     if ($content == '' && !apply_filters($this->hook_prefix . 'always_close_shortcode', false)) {
         $output .= "]";
     } else {
         $output .= "]{$content}[/{$this->shortcode_name}]";
     }
     return $output;
 }
 public function build_shortcode($atts, $content = '')
 {
     if (!apply_filters($this->hook_prefix . 'should_have_markup', true, $atts, $content)) {
         return '';
     }
     $atts = wp_parse_args($atts, $this->get_applied_defaults());
     // if ( apply_filters( $this->hook_prefix . 'explicit_defaults', true ) ) {
     // }
     $atts = $this->controls()->backfill_content($atts);
     $atts = $this->controls()->filter_atts_for_shortcode($atts);
     $atts = apply_filters($this->hook_prefix . 'update_build_shortcode_atts', $atts);
     $atts = $this->build_shortcode_clean_atts($atts);
     if ('' == $content && isset($atts['content'])) {
         $content = $atts['content'];
         unset($atts['content']);
     }
     $content = apply_filters($this->hook_prefix . 'update_build_shortcode_content', $content);
     $output = "[{$this->shortcode_name}";
     foreach ($atts as $attribute => $value) {
         $clean = cs_clean_shortcode_att($value);
         $att = sanitize_key($attribute);
         $output .= " {$att}=\"{$clean}\"";
     }
     if ($content == '' && !apply_filters($this->hook_prefix . 'always_close_shortcode', false)) {
         $output .= "]";
     } else {
         $output .= "]{$content}[/{$this->shortcode_name}]";
     }
     return $output;
 }
示例#6
0
function cs_build_shortcode($name, $attributes, $extra = '', $content = '')
{
    $output = "[{$name}";
    if (isset($attributes['class'])) {
        $attributes['class'] = cs_sanitize_html_classes($attributes['class']);
    }
    foreach ($attributes as $attribute => $value) {
        $clean = cs_clean_shortcode_att($value);
        $att = sanitize_key($attribute);
        $output .= " {$att}=\"{$clean}\"";
    }
    if ($extra != '') {
        $output .= " {$extra}";
    }
    if ($content == '') {
        $output .= "]";
    } else {
        $output .= "]{$content}[/{$name}]";
    }
    return $output;
}