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/AJAX/Controll...
File: Fields.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
class NF_AJAX_Controllers_Fields extends NF_Abstracts_Controller
[2] Fix | Delete
{
[3] Fix | Delete
private $publish_processing;
[4] Fix | Delete
[5] Fix | Delete
public function __construct()
[6] Fix | Delete
{
[7] Fix | Delete
// Ajax call handed in 'maybe_delete_field' in this file
[8] Fix | Delete
add_action( 'wp_ajax_nf_maybe_delete_field', array( $this,
[9] Fix | Delete
'maybe_delete_field' ) );
[10] Fix | Delete
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Check if the field has data, if so let the front-end know to show
[15] Fix | Delete
* delete field modal
[16] Fix | Delete
*/
[17] Fix | Delete
public function maybe_delete_field() {
[18] Fix | Delete
[19] Fix | Delete
// Does the current user have admin privileges
[20] Fix | Delete
if (!current_user_can(apply_filters('ninja_forms_admin_all_forms_capabilities', 'manage_options'))) {
[21] Fix | Delete
$this->_data['errors'] = esc_html__('Access denied. You must have admin privileges to perform this action.', 'ninja-forms');
[22] Fix | Delete
$this->_respond();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
// If we don't have a nonce...
[26] Fix | Delete
// OR if the nonce is invalid...
[27] Fix | Delete
if (!isset($_REQUEST['security']) || !wp_verify_nonce($_REQUEST['security'], 'ninja_forms_builder_nonce')) {
[28] Fix | Delete
// Kick the request out now.
[29] Fix | Delete
$this->_data['errors'] = esc_html__('Request forbidden.', 'ninja-forms');
[30] Fix | Delete
$this->_respond();
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
if (!isset($_REQUEST['fieldID']) || empty($_REQUEST['fieldID'])) {
[34] Fix | Delete
$this->_respond();
[35] Fix | Delete
}
[36] Fix | Delete
$field_id = absint($_REQUEST[ 'fieldID' ]);
[37] Fix | Delete
// $field_key = $_REQUEST[ 'fieldKey' ];
[38] Fix | Delete
[39] Fix | Delete
global $wpdb;
[40] Fix | Delete
// query for checking postmeta for submission data for field
[41] Fix | Delete
$sql = $wpdb->prepare( "SELECT meta_value FROM `" . $wpdb->prefix . "postmeta`
[42] Fix | Delete
WHERE meta_key = '_field_%d' LIMIT 1", $field_id );
[43] Fix | Delete
$result = $wpdb->get_results( $sql, 'ARRAY_N' );
[44] Fix | Delete
[45] Fix | Delete
$has_data = false;
[46] Fix | Delete
[47] Fix | Delete
// if there are results, has_data is true
[48] Fix | Delete
if( 0 < count( $result ) ) {
[49] Fix | Delete
$has_data = true;
[50] Fix | Delete
}
[51] Fix | Delete
$this->_data[ 'field_has_data' ] = $has_data;
[52] Fix | Delete
[53] Fix | Delete
$this->_respond();
[54] Fix | Delete
}
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function