Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/ninja-fo.../includes/Admin/Metaboxe...
File: AppendAForm.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
final class NF_Admin_Metaboxes_AppendAForm extends NF_Abstracts_Metabox
[2] Fix | Delete
{
[3] Fix | Delete
protected $_post_types = array( 'post', 'page' );
[4] Fix | Delete
[5] Fix | Delete
public function __construct()
[6] Fix | Delete
{
[7] Fix | Delete
parent::__construct();
[8] Fix | Delete
[9] Fix | Delete
$this->_title = esc_html__( 'Append a Ninja Form', 'ninja-forms' );
[10] Fix | Delete
[11] Fix | Delete
add_filter( 'the_content', array( $this, 'append_form' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
public function append_form( $content )
[15] Fix | Delete
{
[16] Fix | Delete
if ( isset( $GLOBALS[ 'post' ] ) ) {
[17] Fix | Delete
$post = $GLOBALS[ 'post' ];
[18] Fix | Delete
} else {
[19] Fix | Delete
$post = NULL;
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
if( ! $post || ! is_object( $post ) || post_password_required($post) ) return $content;
[23] Fix | Delete
[24] Fix | Delete
$form_id = get_post_meta( $post->ID, 'ninja_forms_form', TRUE );
[25] Fix | Delete
[26] Fix | Delete
if( ! $form_id ) return $content;
[27] Fix | Delete
[28] Fix | Delete
return $content . "[ninja_forms id=$form_id]";
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
public function save_post( $post_id )
[32] Fix | Delete
{
[33] Fix | Delete
if (
[34] Fix | Delete
defined('DOING_AUTOSAVE') && DOING_AUTOSAVE
[35] Fix | Delete
|| ! isset( $_POST['nf_append_form'] )
[36] Fix | Delete
|| ! wp_verify_nonce( $_POST['nf_append_form'], 'ninja_forms_append_form' )
[37] Fix | Delete
|| ( 'page' == $_POST['post_type'] && !current_user_can( 'edit_page', $post_id ) )
[38] Fix | Delete
|| ( 'post' == $_POST['post_type'] && !current_user_can( 'edit_post', $post_id ) )
[39] Fix | Delete
) return $post_id;
[40] Fix | Delete
[41] Fix | Delete
$post_id = absint( $post_id );
[42] Fix | Delete
[43] Fix | Delete
$form_id = absint( $_POST['ninja_form_select'] );
[44] Fix | Delete
[45] Fix | Delete
if ( empty ( $form_id ) ) {
[46] Fix | Delete
delete_post_meta( $post_id, 'ninja_forms_form' );
[47] Fix | Delete
} else {
[48] Fix | Delete
update_post_meta( $post_id, 'ninja_forms_form', $form_id );
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
public function render_metabox( $post, $metabox )
[53] Fix | Delete
{
[54] Fix | Delete
wp_nonce_field( 'ninja_forms_append_form', 'nf_append_form' );
[55] Fix | Delete
[56] Fix | Delete
$forms = Ninja_Forms()->form()->get_forms();
[57] Fix | Delete
[58] Fix | Delete
$form_id = get_post_meta( $post->ID, 'ninja_forms_form', true );
[59] Fix | Delete
[60] Fix | Delete
$none_text = '-- ' . esc_html__( 'None', 'ninja-forms' );
[61] Fix | Delete
[62] Fix | Delete
Ninja_Forms()->template( 'admin-metabox-append-a-form.html.php', compact( 'forms', 'form_id', 'none_text' ) );
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function