/** * 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 = '') { $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; }