Caldera_Forms_Entry_Shortcode

Entry viewer shortcode.

Defined (1)

The class is defined in the following location(s).

/classes/entry/shortcode.php  
  1. class Caldera_Forms_Entry_Shortcode { 
  2.  
  3. /** 
  4. * Name of shortcode 
  5. * @since 1.5.0 
  6. * @var string 
  7. */ 
  8. protected static $name = 'caldera_forms_entry_viewer'; 
  9.  
  10. /** 
  11. * Get shorcode name 
  12. * @since 1.5.0 
  13. * @return string 
  14. */ 
  15. public static function get_shortcode_name() { 
  16. return self::$name; 
  17.  
  18. /** 
  19. * Callback for shortcode 
  20. * @since 1.5.0 
  21. * @param array $atts Shortcode atts 
  22. * @return string 
  23. */ 
  24. public static function shortcode_callback( $atts ) { 
  25. $atts = shortcode_atts( array( 
  26. 'form_id' => strip_tags( ! isset( $_GET[ 'cf_id' ] ) ? null : $_GET[ 'cf_id' ] ),  
  27. 'id' => strip_tags( ! isset( $_GET[ 'cf_id' ] ) ? null : $_GET[ 'cf_id' ] ),  
  28. 'ID' => strip_tags( ! isset( $_GET[ 'cf_id' ] ) ? null : $_GET[ 'cf_id' ] ),  
  29. 'type' => '2',  
  30. 'with_toolbar' => false,  
  31. 'role' => 'admin' 
  32. ), $atts, self::$name ); 
  33. if( isset( $atts[ 'id' ] ) ) { 
  34. $id = $atts[ 'id' ]; 
  35. }elseif ( isset( $atts[ 'ID' ] ) ) { 
  36. $id = $atts[ 'ID' ]; 
  37. }elseif( isset( $atts[ 'form_id' ] ) ) { 
  38. $id = $atts[ 'form_id' ]; 
  39. }else{ 
  40. $id = null; 
  41.  
  42.  
  43. if ( ! is_null( $id ) ) { 
  44. $form = Caldera_Forms_Forms::get_form( $id ); 
  45. if ( ! empty( $form ) ) { 
  46. if ( 'classic' == $atts[ 'type' ] ) { 
  47. return Caldera_Forms_Entry_Viewer::form_entry_viewer_1( $id, wp_validate_boolean( $atts[ 'with_toolbar' ] ) ); 
  48.  
  49. } else { 
  50. return Caldera_Forms_Entry_Viewer::form_entry_viewer_2( $form, array( 'token' => Caldera_Forms_API_Token::make_token( $atts[ 'role' ], $id ) ) ); 
  51.  
  52.  
  53.  
  54. return ''; 
  55.  
  56.