/** * Frontend Shortcode Handle. * @param array $atts Array of attributes. * @param string $content Text within enclosing form of shortcode element. * @param string $shortcode The shortcode found, when == callback name. * @param string $meta Meta data. * @return string Returns the modified html string. */ public function shortcode_handle($atts, $content = '', $shortcode = '', $meta = '') { extract(shortcode_atts(array('size' => '', 'font_color' => '', 'color' => ''), $atts, $this->shortcode['name'])); $custom_size = $size > 10 ? $size : 16; $custom_color = $font_color !== 'default' ? $color : ''; $custom_style = $font_color !== 'default' ? 'font-size: ' . $custom_size . 'px; color: ' . $custom_color . ';' : 'font-size: ' . $custom_size . 'px'; $custom_class = empty($meta['custom_class']) ? '' : $meta['custom_class']; ob_start(); ?> <section class="axiscomposer textblock-section"> <div class="ac-textblock <?php echo esc_attr($custom_class); ?> " style="<?php echo esc_attr($custom_style); ?> "> <?php echo ac_format_content($content); ?> </div> </section> <?php return ob_get_clean(); }
/** * Frontend Shortcode Handle. * @param array $atts Array of attributes. * @param string $content Text within enclosing form of shortcode element. * @param string $shortcode The shortcode found, when == callback name. * @param string $meta Meta data. * @return string Returns the modified html string. */ public function shortcode_handle($atts, $content = '', $shortcode = '', $meta = '') { global $axiscomposer_config; $axiscomposer_config['current_column'] = $shortcode; $class = substr(str_replace('_', '-', strtolower($shortcode)), 3); $first = isset($atts[0]) && trim($atts[0]) == 'first' ? ' first' : ''; ob_start(); ?> <div class="axiscomposer flex-column <?php echo esc_attr($class . $first . ' ' . $meta['el_class']); ?> "> <?php echo ac_format_content($content); ?> </div> <?php unset($axiscomposer_config['current_column']); return ob_get_clean(); }
/** * Frontend Shortcode Handle. * @param array $atts Array of attributes. * @param string $content Text within enclosing form of shortcode element. * @param string $shortcode The shortcode found, when == callback name. * @param string $meta Meta data. * @return string Returns the modified html string. */ public function shortcode_handle($atts, $content = '', $shortcode = '', $meta = '') { $output = ''; $params = array(); self::$grid_count++; // Entire list of supported attributes and their defaults $pairs = array('id' => '', 'border' => '', 'min_height' => '0', 'smartphones' => 'ac-flex-cells'); $atts = shortcode_atts($pairs, $atts, $this->shortcode['name']); extract($atts); $params['id'] = empty($id) ? 'ac-layout-grid-' . self::$grid_count : sanitize_html_class($id); $params['class'] = 'ac-layout-grid-container ' . $border . ' ' . $smartphones . ' ' . $meta['el_class']; $params['custom_markup'] = $meta['custom_markup']; $params['open_structure'] = false; if (isset($meta['counter'])) { if ($meta['counter'] == 0) { $params['close'] = false; } if ($meta['counter'] != 0) { $params['class'] .= ' submenu-not-first'; } } AC_Shortcode_Cells::$attributes = $atts; $output .= ac_new_section($params); $output .= ac_format_content($content); $output .= ac_section_after_element_content($meta, 'after-submenu', false); return $output; }
/** * Frontend Shortcode Handle. * @param array $atts Array of attributes. * @param string $content Text within enclosing form of shortcode element. * @param string $shortcode The shortcode found, when == callback name. * @param string $meta Meta data. * @return string Returns the modified html string. */ public function shortcode_handle($atts, $content = '', $shortcode = '', $meta = '') { global $axiscomposer_config; $params = array(); $output = $background = ''; self::$section_count++; // Entire list of supported attributes and their defaults $pairs = array('background_color' => '', 'src' => '', 'background_attachment' => 'scroll', 'background_position' => 'top left', 'background_repeat' => 'no-repeat', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'min_height' => '', 'custom_min_height' => '500px', 'padding' => 'default', 'shadow' => 'no-shadow', 'bottom_border' => '', 'id' => '', 'custom_markup' => '', 'attachment' => '', 'attachment_size' => ''); $atts = shortcode_atts($pairs, $atts, $this->shortcode['name']); extract($atts); $class = 'ac-section section-padding-' . $padding . ' ' . $shadow . ' section-background-' . $background_attachment . ''; $params['attach'] = ''; $params['custom_markup'] = $meta['custom_markup']; $params['id'] = empty($id) ? 'ac-section-' . self::$section_count : sanitize_html_class($id); // Set Attachment Image if (!empty($attachment) && !empty($attachment_size)) { $attachment_entry = get_post($attachment); if (!empty($attachment_size)) { $src = wp_get_attachment_image_src($attachment_entry->ID, $attachment_size); $src = empty($src[0]) ? '' : $src[0]; } } else { $attachment = false; } // Set Background Image if ($src != '') { $background .= 'background-image: url(' . $src . '); '; $background .= 'background-position: ' . $background_position . '; '; $background .= $background_attachment == 'parallax' ? "background-attachment: scroll; " : 'background-attachment: ' . $background_attachment . '; '; if ($background_repeat == 'stretch') { $class .= 'ac-full-stretch'; $background .= 'background-repeat: no-repeat; '; } else { $background .= 'background-repeat: ' . $background_repeat . '; '; } if ($background_attachment == 'parallax') { $class .= 'ac-parallax-section'; $speed = apply_filters('axiscomposer_parallax_speed', '0.3', $params['id']); $attachment_class = $background_repeat == 'stretch' || $background_repeat == 'stretch' ? 'ac-full-stretch' : ''; $params['attach'] .= '<div class="ac-parallax ' . $attachment_class . '" data-ac-parallax-ratio="' . $speed . '" style="' . $background . '"></div>'; $background = ''; } $params['data'] = 'data-section-background-repeat="' . $background_repeat . '"'; } if ($background_color != '') { $background .= 'background-color: ' . $background_color . ';'; } if ($background) { $background = 'style="' . $background . '"'; } $params['class'] = $class . ' ' . $meta['el_class']; $params['background'] = $background; $params['min_height'] = $min_height; $params['custom_min_height'] = $custom_min_height; $params['video'] = $video; $params['video_ratio'] = $video_ratio; $params['video_mobile_disabled'] = $video_mobile_disabled; if (isset($meta['counter'])) { if ($meta['counter'] == 0) { $params['main_container'] = true; } if ($meta['counter'] == 0) { $params['close'] = false; } } $axiscomposer_config['layout_container'] = 'section'; $output .= ac_new_section($params); $output .= ac_format_content($content); // Set Extra arrow element if (strpos($bottom_border, 'border-extra') !== false) { $arrow_bg = empty($background_color) ? apply_filters('axiscomposer_background_color', '#fff') : $background_color; self::$section_close = '<div class="ac-extra-border-element ' . $bottom_border . '"><div class="arrow-wrap"><div class="arrow-inner" style="background-color: ' . $arrow_bg . '"></div></div></div>'; } else { self::$section_close = ''; } unset($axiscomposer_config['layout_container']); return $output; }
/** * Frontend Shortcode Handle. * @param array $atts Array of attributes. * @param string $content Text within enclosing form of shortcode element. * @param string $shortcode The shortcode found, when == callback name. * @param string $meta Meta data. * @return string Returns the modified html string. */ public function shortcode_handle($atts, $content = '', $shortcode = '', $meta = '') { global $axiscomposer_config; $extra_class = $outer_style = $inner_style = ''; // Entire list of supported attributes and their defaults $pairs = array('vertical_align' => '', 'padding' => '', 'color' => '', 'background_color' => '', 'background_position' => '', 'background_repeat' => '', 'background_attachment' => '', 'fetch_image' => '', 'attachment' => '', 'attachment_size' => ''); $atts = shortcode_atts($pairs, $atts, $this->shortcode['name']); if (!empty(self::$attributes['min_height'])) { $min_height = (int) self::$attr['min_height']; $outer_style = 'height: ' . $min_height . 'px; min-height: ' . $min_height . 'px;'; } if (!empty($atts['attachment'])) { $src = wp_get_attachment_image_src($atts['attachment'], $atts['attachment_size']); if (!empty($src[0])) { $atts['fetch_image'] = $src[0]; } } if (!empty($atts['colors'])) { $extra_class .= 'ac-inherit-color'; } if ($atts['background_repeat'] == 'stretch') { $extra_class .= 'ac-full-stretch'; } // Padding fetch $explode_padding = explode(',', $atts['padding']); if (count($explode_padding) > 1) { $atts['padding'] = ''; foreach ($explode_padding as $padding) { if (empty($padding)) { $padding = '0'; $atts['padding'] .= $padding . ' '; } } } if (!empty($atts['fetch_image'])) { $outer_style .= $this->style_string($atts, 'fetch_image', 'background-image'); $outer_style .= $this->style_string($atts, 'background_position', 'background-position'); $outer_style .= $this->style_string($atts, 'background_repeat', 'background-repeat'); $outer_style .= $this->style_string($atts, 'background_attachment', 'background-attachment'); } $outer_style .= $this->style_string($atts, 'vertical_align', 'vertical-align'); $outer_style .= $this->style_string($atts, 'padding'); $outer_style .= $this->style_string($atts, 'background_color', 'background-color'); // Modify the shorycode name $shortcode = str_replace('ac_cell_', 'ac_', $shortcode); $axiscomposer_config['current_column'] = $shortcode; if (!empty($outer_style)) { $outer_style = 'style="' . $outer_style . '"'; } if (!empty($inner_style)) { $inner_style = 'style="' . $inner_style . '"'; } $output = '<div class="flex-cell no-margin ' . $shortcode . $meta['el_class'] . $extra_class . self::$cell_class . '" ' . $outer_style . '>'; $output .= '<div class="flex-cell-inner ' . $inner_style . '">'; $output .= ac_format_content($content); $output .= '</div></div>'; unset($axiscomposer_config['current_column']); return $output; }