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/Database
File: FormsController.php
<?php
[0] Fix | Delete
final class NF_Database_FormsController
[1] Fix | Delete
{
[2] Fix | Delete
private $db;
[3] Fix | Delete
private $factory;
[4] Fix | Delete
private $forms_data = array();
[5] Fix | Delete
[6] Fix | Delete
public function __construct()
[7] Fix | Delete
{
[8] Fix | Delete
global $wpdb;
[9] Fix | Delete
$this->db = $wpdb;
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
public function setFormsData()
[13] Fix | Delete
{
[14] Fix | Delete
try {
[15] Fix | Delete
$forms_sql = "
[16] Fix | Delete
SELECT `id`, `title`, `created_at`
[17] Fix | Delete
FROM `{$this->db->prefix}nf3_forms`
[18] Fix | Delete
ORDER BY `title`
[19] Fix | Delete
";
[20] Fix | Delete
$forms_data = $this->db->get_results($forms_sql, OBJECT_K);
[21] Fix | Delete
[22] Fix | Delete
$public_form_keys_sql = "SELECT link.parent_id as 'form_id', link.value as 'public_link_key'
[23] Fix | Delete
FROM `{$this->db->prefix}nf3_form_meta` as link
[24] Fix | Delete
LEFT JOIN `{$this->db->prefix}nf3_form_meta` as allowed
[25] Fix | Delete
ON allowed.parent_id = link.parent_id
[26] Fix | Delete
WHERE link.key = 'public_link_key'
[27] Fix | Delete
AND allowed.key = 'allow_public_link'
[28] Fix | Delete
AND allowed.value = '1';";
[29] Fix | Delete
$public_form_keys = $this->db->get_results($public_form_keys_sql, OBJECT_K);
[30] Fix | Delete
[31] Fix | Delete
foreach($public_form_keys as $public_form_key){
[32] Fix | Delete
$form_id = $public_form_key->form_id;
[33] Fix | Delete
if(!isset($forms_data[$form_id])) continue;
[34] Fix | Delete
$forms_data[$form_id]->public_link_key = $public_form_key->public_link_key;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
} catch( Exception $e ) {
[38] Fix | Delete
return array();
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
// Provided as array of
[42] Fix | Delete
// object {id => Str, title => Str, created_at => Str}
[43] Fix | Delete
[44] Fix | Delete
return $forms_data;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
public function getFormsData()
[48] Fix | Delete
{
[49] Fix | Delete
if( empty( $this->forms_data ) ) {
[50] Fix | Delete
$this->forms_data = $this->setFormsData();
[51] Fix | Delete
}
[52] Fix | Delete
return( array_values( $this->forms_data ) );
[53] Fix | Delete
}
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function