Advertisement
Guest User

vc_row.php

a guest
May 10th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  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. wp_enqueue_script( 'wpb_composer_front_js' );
  36.  
  37. $el_class = $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
  38.  
  39. $css_classes = array(
  40. 'vc_row',
  41. 'wpb_row',
  42. //deprecated
  43. 'vc_row-fluid',
  44. $el_class,
  45. vc_shortcode_custom_css_class( $css ),
  46. );
  47.  
  48. if ( 'yes' === $disable_element ) {
  49. if ( vc_is_page_editable() ) {
  50. $css_classes[] = 'vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md';
  51. } else {
  52. return '';
  53. }
  54. }
  55.  
  56. if ( vc_shortcode_custom_css_has_property( $css, array(
  57. 'border',
  58. 'background',
  59. ) ) || $video_bg || $parallax
  60. ) {
  61. $css_classes[] = 'vc_row-has-fill';
  62. }
  63.  
  64. if ( ! empty( $atts['gap'] ) ) {
  65. $css_classes[] = 'vc_column-gap-' . $atts['gap'];
  66. }
  67.  
  68. $wrapper_attributes = array();
  69. // build attributes for wrapper
  70. if ( ! empty( $el_id ) ) {
  71. $wrapper_attributes[] = 'id="' . esc_attr( $el_id ) . '"';
  72. }
  73. if ( ! empty( $full_width ) ) {
  74. $wrapper_attributes[] = 'data-vc-full-width="true"';
  75. $wrapper_attributes[] = 'data-vc-full-width-init="false"';
  76. if ( 'stretch_row_content' === $full_width ) {
  77. $wrapper_attributes[] = 'data-vc-stretch-content="true"';
  78. } elseif ( 'stretch_row_content_no_spaces' === $full_width ) {
  79. $wrapper_attributes[] = 'data-vc-stretch-content="true"';
  80. $css_classes[] = 'vc_row-no-padding';
  81. }
  82. $after_output .= '<div class="vc_row-full-width vc_clearfix"></div>';
  83. }
  84.  
  85. if ( ! empty( $full_height ) ) {
  86. $css_classes[] = 'vc_row-o-full-height';
  87. if ( ! empty( $columns_placement ) ) {
  88. $flex_row = true;
  89. $css_classes[] = 'vc_row-o-columns-' . $columns_placement;
  90. if ( 'stretch' === $columns_placement ) {
  91. $css_classes[] = 'vc_row-o-equal-height';
  92. }
  93. }
  94. }
  95.  
  96. if ( ! empty( $equal_height ) ) {
  97. $flex_row = true;
  98. $css_classes[] = 'vc_row-o-equal-height';
  99. }
  100.  
  101. if ( ! empty( $content_placement ) ) {
  102. $flex_row = true;
  103. $css_classes[] = 'vc_row-o-content-' . $content_placement;
  104. }
  105.  
  106. if ( ! empty( $flex_row ) ) {
  107. $css_classes[] = 'vc_row-flex';
  108. }
  109.  
  110. $has_video_bg = ( ! empty( $video_bg ) && ! empty( $video_bg_url ) && vc_extract_youtube_id( $video_bg_url ) );
  111.  
  112. $parallax_speed = $parallax_speed_bg;
  113. if ( $has_video_bg ) {
  114. $parallax = $video_bg_parallax;
  115. $parallax_speed = $parallax_speed_video;
  116. $parallax_image = $video_bg_url;
  117. $css_classes[] = 'vc_video-bg-container';
  118. wp_enqueue_script( 'vc_youtube_iframe_api_js' );
  119. }
  120.  
  121. if ( ! empty( $parallax ) ) {
  122. wp_enqueue_script( 'vc_jquery_skrollr_js' );
  123. $wrapper_attributes[] = 'data-vc-parallax="' . esc_attr( $parallax_speed ) . '"'; // parallax speed
  124. $css_classes[] = 'vc_general vc_parallax vc_parallax-' . $parallax;
  125. if ( false !== strpos( $parallax, 'fade' ) ) {
  126. $css_classes[] = 'js-vc_parallax-o-fade';
  127. $wrapper_attributes[] = 'data-vc-parallax-o-fade="on"';
  128. } elseif ( false !== strpos( $parallax, 'fixed' ) ) {
  129. $css_classes[] = 'js-vc_parallax-o-fixed';
  130. }
  131. }
  132.  
  133. if ( ! empty( $parallax_image ) ) {
  134. if ( $has_video_bg ) {
  135. $parallax_image_src = $parallax_image;
  136. } else {
  137. $parallax_image_id = preg_replace( '/[^\d]/', '', $parallax_image );
  138. $parallax_image_src = wp_get_attachment_image_src( $parallax_image_id, 'full' );
  139. if ( ! empty( $parallax_image_src[0] ) ) {
  140. $parallax_image_src = $parallax_image_src[0];
  141. }
  142. }
  143. $wrapper_attributes[] = 'data-vc-parallax-image="' . esc_attr( $parallax_image_src ) . '"';
  144. }
  145. if ( ! $parallax && $has_video_bg ) {
  146. $wrapper_attributes[] = 'data-vc-video-bg="' . esc_attr( $video_bg_url ) . '"';
  147. }
  148. $css_class = preg_replace( '/\s+/', ' ', apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, implode( ' ', array_filter( array_unique( $css_classes ) ) ), $this->settings['base'], $atts ) );
  149. $wrapper_attributes[] = 'class="' . esc_attr( trim( $css_class ) ) . '"';
  150.  
  151. // @eggemplo changes
  152. if ( isset ( $groups_can ) && ( strlen( trim( $groups_can ) ) > 0 ) ) {
  153. $content = do_shortcode( '[groups_can capability="' . $groups_can . '"]' . ( $content ) . '[/groups_can]' );
  154. }
  155. if ( isset ( $groups_can_not ) && ( strlen( trim( $groups_can_not ) ) > 0 ) ) {
  156. $content = do_shortcode( '[groups_can_not capability="' . $groups_can_not . '"]' . ( $content ) . '[/groups_can_not]' );
  157. }
  158. // end - @eggemplo changes
  159.  
  160. $output .= '<div ' . implode( ' ', $wrapper_attributes ) . '>';
  161. $output .= wpb_js_remove_wpautop( $content );
  162. $output .= '</div>';
  163. $output .= $after_output;
  164.  
  165. echo $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement