shortcode-vc-raw-js.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. $custom_tag = 'script';
  6. return array(
  7. 'name' => esc_html__( 'Raw JS', 'js_composer' ),
  8. 'base' => 'vc_raw_js',
  9. 'icon' => 'icon-wpb-raw-javascript',
  10. 'category' => esc_html__( 'Structure', 'js_composer' ),
  11. 'wrapper_class' => 'clearfix',
  12. 'description' => esc_html__( 'Output raw JavaScript code on your page', 'js_composer' ),
  13. 'params' => array(
  14. array(
  15. 'type' => 'textarea_raw_html',
  16. 'holder' => 'div',
  17. 'heading' => esc_html__( 'JavaScript Code', 'js_composer' ),
  18. 'param_name' => 'content',
  19. // @codingStandardsIgnoreLine
  20. 'value' => base64_encode( '<' . $custom_tag . '> alert( "' . esc_attr__( 'Enter your js here!', 'js_composer' ) . '" ) </' . $custom_tag . '>' ),
  21. 'description' => esc_html__( 'Enter your JavaScript code.', 'js_composer' ),
  22. ),
  23. array(
  24. 'type' => 'el_id',
  25. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  26. 'param_name' => 'el_id',
  27. 'description' => sprintf( esc_html__( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'js_composer' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
  28. ),
  29. array(
  30. 'type' => 'textfield',
  31. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  32. 'param_name' => 'el_class',
  33. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  34. ),
  35. ),
  36. );