auxin_shortcode_mapper.php
6 years ago
auxin_vc_extendes.php
9 years ago
vc_raw_html.php
9 years ago
vc_row.php
8 years ago
vc_row.php
214 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | die( '-1' ); |
| 4 | } |
| 5 | |
| 6 | /** |
| 7 | * Shortcode attributes |
| 8 | * @var $atts |
| 9 | * @var $el_class |
| 10 | * @var $full_width |
| 11 | * @var $full_height |
| 12 | * @var $equal_height |
| 13 | * @var $columns_placement |
| 14 | * @var $content_placement |
| 15 | * @var $parallax |
| 16 | * @var $parallax_image |
| 17 | * @var $css |
| 18 | * @var $el_id |
| 19 | * @var $video_bg |
| 20 | * @var $video_bg_url |
| 21 | * @var $video_bg_parallax |
| 22 | * @var $parallax_speed_bg |
| 23 | * @var $parallax_speed_video |
| 24 | * @var $content - shortcode content |
| 25 | * @var $css_animation |
| 26 | * Shortcode class |
| 27 | * @var $this WPBakeryShortCode_VC_Row |
| 28 | */ |
| 29 | $el_class = $full_height = $parallax_speed_bg = $parallax_speed_video = $full_width = $equal_height = $flex_row = $columns_placement = $content_placement = $parallax = $parallax_image = $css = $el_id = $video_bg = $video_bg_url = $video_bg_parallax = $css_animation = ''; |
| 30 | $disable_element = ''; |
| 31 | $output = $after_output = ''; |
| 32 | $atts = vc_map_get_attributes( $this->getShortcode(), $atts ); |
| 33 | extract( $atts ); |
| 34 | |
| 35 | $aux_row_inner_wrapper_start = ''; // @auxin |
| 36 | $aux_row_inner_wrapper_end = ''; // @auxin |
| 37 | $aux_row_parent_wrapper_start = ''; // @auxin |
| 38 | $aux_row_parent_wrapper_end = ''; // @auxin |
| 39 | |
| 40 | wp_enqueue_script( 'wpb_composer_front_js' ); |
| 41 | |
| 42 | $el_class = $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 43 | |
| 44 | $css_classes = array( |
| 45 | 'vc_row', |
| 46 | 'wpb_row', |
| 47 | //deprecated |
| 48 | 'vc_row-fluid', |
| 49 | $el_class, |
| 50 | vc_shortcode_custom_css_class( $css ), |
| 51 | ); |
| 52 | |
| 53 | if ( 'yes' === $disable_element ) { |
| 54 | if ( vc_is_page_editable() ) { |
| 55 | $css_classes[] = 'vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md'; |
| 56 | } else { |
| 57 | return ''; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | if ( vc_shortcode_custom_css_has_property( $css, array( |
| 62 | 'border', |
| 63 | 'background', |
| 64 | ) ) || $video_bg || $parallax |
| 65 | ) { |
| 66 | $css_classes[] = 'vc_row-has-fill'; |
| 67 | } |
| 68 | |
| 69 | if ( ! empty( $atts['gap'] ) ) { |
| 70 | $css_classes[] = 'vc_column-gap-' . $atts['gap']; |
| 71 | } |
| 72 | |
| 73 | $wrapper_attributes = array(); |
| 74 | // build attributes for wrapper |
| 75 | if ( ! empty( $el_id ) ) { |
| 76 | $wrapper_attributes[] = 'id="' . esc_attr( $el_id ) . '"'; |
| 77 | } |
| 78 | |
| 79 | // @auxin start |
| 80 | /** |
| 81 | * Row stretch: |
| 82 | * - Default: $full_width = ''; |
| 83 | * - Stretch row: $full_width = 'stretch_row'; |
| 84 | * - Stretch row and content: $full_width = 'stretch_row_content'; |
| 85 | * - Stretch row and content (no padding): $full_width = 'stretch_row_content_no_spaces'; |
| 86 | */ |
| 87 | global $post, $auxin_content_layout; |
| 88 | |
| 89 | $row_wrapper_inner_start = $row_wrapper_inner_end = ''; |
| 90 | |
| 91 | //$auxـwrapper_classes = array('aux-vc-row-wrapper'); |
| 92 | |
| 93 | // Dont let vc to stretch the row by javascript if content layout is full |
| 94 | if( $post && 'full' == $auxin_content_layout ){ |
| 95 | |
| 96 | $inner_wrapper_class = ''; |
| 97 | |
| 98 | // if row stretch was 'default' or 'stretch_row' |
| 99 | if( empty( $full_width ) || 'stretch_row' == $full_width ){ |
| 100 | $css_classes[] = 'aux-vc-boxed-content'; |
| 101 | $inner_wrapper_class = 'aux-fold-width'; |
| 102 | |
| 103 | // if row stretch was stretch row and content |
| 104 | } elseif ( 'stretch_row_content' === $full_width ) { |
| 105 | $css_classes[] = 'aux-vc-stretch-content'; |
| 106 | $css_classes[] = 'aux-vc-stretch-row'; |
| 107 | |
| 108 | }elseif ( 'stretch_row_content_no_spaces' === $full_width ) { |
| 109 | $css_classes[] = 'vc_row-no-padding'; |
| 110 | $css_classes[] = 'aux-vc-stretch-content'; |
| 111 | $css_classes[] = 'aux-vc-stretch-row'; |
| 112 | } |
| 113 | |
| 114 | $row_wrapper_inner_start = '<div class="aux-vc-row-wrapper-inner '. $inner_wrapper_class .'"><div class="aux-vc-row-margin">'; |
| 115 | $row_wrapper_inner_end = '</div></div>'; |
| 116 | |
| 117 | } else { |
| 118 | // @auxin end |
| 119 | |
| 120 | if ( ! empty( $full_width ) ) { |
| 121 | $wrapper_attributes[] = 'data-vc-full-width="true"'; |
| 122 | $wrapper_attributes[] = 'data-vc-full-width-init="false"'; |
| 123 | if ( 'stretch_row_content' === $full_width ) { |
| 124 | $wrapper_attributes[] = 'data-vc-stretch-content="true"'; |
| 125 | } elseif ( 'stretch_row_content_no_spaces' === $full_width ) { |
| 126 | $wrapper_attributes[] = 'data-vc-stretch-content="true"'; |
| 127 | $css_classes[] = 'vc_row-no-padding'; |
| 128 | } |
| 129 | $after_output .= '<div class="vc_row-full-width vc_clearfix"></div>'; |
| 130 | } |
| 131 | |
| 132 | // @auxin start |
| 133 | } |
| 134 | // @auxin end |
| 135 | |
| 136 | |
| 137 | if ( ! empty( $full_height ) ) { |
| 138 | $css_classes[] = 'vc_row-o-full-height'; |
| 139 | if ( ! empty( $columns_placement ) ) { |
| 140 | $flex_row = true; |
| 141 | $css_classes[] = 'vc_row-o-columns-' . $columns_placement; |
| 142 | if ( 'stretch' === $columns_placement ) { |
| 143 | $css_classes[] = 'vc_row-o-equal-height'; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | if ( ! empty( $equal_height ) ) { |
| 149 | $flex_row = true; |
| 150 | $css_classes[] = 'vc_row-o-equal-height'; |
| 151 | } |
| 152 | |
| 153 | if ( ! empty( $content_placement ) ) { |
| 154 | $flex_row = true; |
| 155 | $css_classes[] = 'vc_row-o-content-' . $content_placement; |
| 156 | } |
| 157 | |
| 158 | if ( ! empty( $flex_row ) ) { |
| 159 | $css_classes[] = 'vc_row-flex'; |
| 160 | } |
| 161 | |
| 162 | $has_video_bg = ( ! empty( $video_bg ) && ! empty( $video_bg_url ) && vc_extract_youtube_id( $video_bg_url ) ); |
| 163 | |
| 164 | $parallax_speed = $parallax_speed_bg; |
| 165 | if ( $has_video_bg ) { |
| 166 | $parallax = $video_bg_parallax; |
| 167 | $parallax_speed = $parallax_speed_video; |
| 168 | $parallax_image = $video_bg_url; |
| 169 | $css_classes[] = 'vc_video-bg-container'; |
| 170 | wp_enqueue_script( 'vc_youtube_iframe_api_js' ); |
| 171 | } |
| 172 | |
| 173 | if ( ! empty( $parallax ) ) { |
| 174 | wp_enqueue_script( 'vc_jquery_skrollr_js' ); |
| 175 | $wrapper_attributes[] = 'data-vc-parallax="' . esc_attr( $parallax_speed ) . '"'; // parallax speed |
| 176 | $css_classes[] = 'vc_general vc_parallax vc_parallax-' . $parallax; |
| 177 | if ( false !== strpos( $parallax, 'fade' ) ) { |
| 178 | $css_classes[] = 'js-vc_parallax-o-fade'; |
| 179 | $wrapper_attributes[] = 'data-vc-parallax-o-fade="on"'; |
| 180 | } elseif ( false !== strpos( $parallax, 'fixed' ) ) { |
| 181 | $css_classes[] = 'js-vc_parallax-o-fixed'; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | |
| 186 | if ( ! empty( $parallax_image ) ) { |
| 187 | if ( $has_video_bg ) { |
| 188 | $parallax_image_src = $parallax_image; |
| 189 | } else { |
| 190 | $parallax_image_id = preg_replace( '/[^\d]/', '', $parallax_image ); |
| 191 | $parallax_image_src = wp_get_attachment_image_src( $parallax_image_id, 'full' ); |
| 192 | if ( ! empty( $parallax_image_src[0] ) ) { |
| 193 | $parallax_image_src = $parallax_image_src[0]; |
| 194 | } |
| 195 | } |
| 196 | $wrapper_attributes[] = 'data-vc-parallax-image="' . esc_attr( $parallax_image_src ) . '"'; |
| 197 | } |
| 198 | if ( ! $parallax && $has_video_bg ) { |
| 199 | $wrapper_attributes[] = 'data-vc-video-bg="' . esc_attr( $video_bg_url ) . '"'; |
| 200 | } |
| 201 | $css_class = preg_replace( '/\s+/', ' ', apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, implode( ' ', array_filter( array_unique( $css_classes ) ) ), $this->settings['base'], $atts ) ); |
| 202 | $wrapper_attributes[] = 'class="' . esc_attr( trim( $css_class ) ) . '"'; |
| 203 | |
| 204 | |
| 205 | |
| 206 | $output .= '<div ' . implode( ' ', $wrapper_attributes ) . '>'; |
| 207 | $output .= $row_wrapper_inner_start; // @auxin |
| 208 | $output .= wpb_js_remove_wpautop( $content ); |
| 209 | $output .= $row_wrapper_inner_end; // @auxin |
| 210 | $output .= '</div>'; |
| 211 | $output .= $after_output; |
| 212 | |
| 213 | echo $output; |
| 214 |