vc-raw-html.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. /**
  6. */
  7. class WPBakeryShortCode_Vc_Raw_Html extends WPBakeryShortCode {
  8. /**
  9. * @param $param
  10. * @param $value
  11. * @return string
  12. */
  13. public function singleParamHtmlHolder( $param, $value ) {
  14. $output = '';
  15. // Compatibility fixes
  16. // TODO: check $old_names & &new_names. Leftover from copypasting?
  17. $old_names = array(
  18. 'yellow_message',
  19. 'blue_message',
  20. 'green_message',
  21. 'button_green',
  22. 'button_grey',
  23. 'button_yellow',
  24. 'button_blue',
  25. 'button_red',
  26. 'button_orange',
  27. );
  28. $new_names = array(
  29. 'alert-block',
  30. 'alert-info',
  31. 'alert-success',
  32. 'btn-success',
  33. 'btn',
  34. 'btn-info',
  35. 'btn-primary',
  36. 'btn-danger',
  37. 'btn-warning',
  38. );
  39. $value = str_ireplace( $old_names, $new_names, $value );
  40. $param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
  41. $type = isset( $param['type'] ) ? $param['type'] : '';
  42. $class = isset( $param['class'] ) ? $param['class'] : '';
  43. if ( isset( $param['holder'] ) && 'hidden' !== $param['holder'] ) {
  44. if ( 'textarea_raw_html' === $param['type'] ) {
  45. // @codingStandardsIgnoreLine
  46. $output .= sprintf( '<%s class="wpb_vc_param_value %s %s %s" name="%s">%s</%s><input type="hidden" name="%s_code" class="%s_code" value="%s" />', $param['holder'], $param_name, $type, $class, $param_name, htmlentities( rawurldecode( base64_decode( wp_strip_all_tags( $value ) ) ), ENT_COMPAT, 'UTF-8' ), $param['holder'], $param_name, $param_name, wp_strip_all_tags( $value ) );
  47. } else {
  48. $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
  49. }
  50. }
  51. return $output;
  52. }
  53. }