vc-raw-js.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-raw-html.php' );
  6. /**
  7. * Class WPBakeryShortCode_Vc_Raw_Js
  8. */
  9. class WPBakeryShortCode_Vc_Raw_Js extends WPBakeryShortCode_Vc_Raw_html {
  10. /**
  11. * @return mixed|string
  12. */
  13. protected function getFileName() {
  14. return 'vc_raw_html';
  15. }
  16. /**
  17. * @param $atts
  18. * @param null $content
  19. * @return string
  20. */
  21. protected function contentInline( $atts, $content = null ) {
  22. $el_class = $width = $el_position = '';
  23. extract( shortcode_atts( array(
  24. 'el_class' => '',
  25. 'el_position' => '',
  26. 'width' => '1/2',
  27. ), $atts ) );
  28. $el_class = $this->getExtraClass( $el_class );
  29. $el_class .= ' wpb_raw_js';
  30. // @codingStandardsIgnoreLine
  31. $content = rawurldecode( base64_decode( wp_strip_all_tags( $content ) ) );
  32. $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_raw_code' . $el_class, $this->settings['base'], $atts );
  33. $output = '
  34. <div class="' . $css_class . '">
  35. <div class="wpb_wrapper">
  36. <textarea style="display: none;" class="vc_js_inline_holder">' . esc_attr( $content ) . '</textarea>
  37. </div>
  38. </div>
  39. ';
  40. return $output;
  41. }
  42. }