Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../includes/Display
File: Shortcodes.php
<?php
[0] Fix | Delete
[1] Fix | Delete
final class NF_Display_Shortcodes
[2] Fix | Delete
{
[3] Fix | Delete
public function __construct()
[4] Fix | Delete
{
[5] Fix | Delete
add_shortcode( 'nf_preview', array( $this, 'display_form_preview' ) );
[6] Fix | Delete
add_shortcode( 'ninja_form', array( $this, 'display_form_front_end' ) );
[7] Fix | Delete
add_shortcode( 'ninja_forms', array( $this, 'display_form_front_end' ) );
[8] Fix | Delete
add_shortcode( 'ninja_forms_display_form', array( $this, 'display_form_front_end' ) );
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
public function display_form_preview( $atts = array() )
[12] Fix | Delete
{
[13] Fix | Delete
if( ! isset( $atts[ 'id' ] ) ) return $this->display_no_id();
[14] Fix | Delete
[15] Fix | Delete
ob_start();
[16] Fix | Delete
Ninja_Forms()->display( $atts['id'], TRUE );
[17] Fix | Delete
return ob_get_clean();
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
public function display_form_front_end( $atts = array() )
[21] Fix | Delete
{
[22] Fix | Delete
if( ! isset( $atts[ 'id' ] ) ) return $this->display_no_id();
[23] Fix | Delete
[24] Fix | Delete
ob_start();
[25] Fix | Delete
Ninja_Forms()->display( $atts['id'] );
[26] Fix | Delete
return ob_get_clean();
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* TODO: Extract output to template files.
[31] Fix | Delete
* @return string
[32] Fix | Delete
*/
[33] Fix | Delete
private function display_no_id()
[34] Fix | Delete
{
[35] Fix | Delete
$output = esc_html__( 'Notice: Ninja Forms shortcode used without specifying a form.', 'ninja-forms' );
[36] Fix | Delete
[37] Fix | Delete
// TODO: Maybe support filterable permissions.
[38] Fix | Delete
if( ! current_user_can( 'manage_options' ) ) return "<!-- $output -->";
[39] Fix | Delete
[40] Fix | Delete
// TODO: Log error for support reference.
[41] Fix | Delete
// TODO: Maybe display notice if not logged in.
[42] Fix | Delete
trigger_error( esc_html__( 'Ninja Forms shortcode used without specifying a form.', 'ninja-forms' ) );
[43] Fix | Delete
[44] Fix | Delete
return "<div style='border: 3px solid red; padding: 1em; margin: 1em auto;'>$output</div>";
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function