NF_Database_FormsController

The Ninja Forms NF Database FormsController class.

Defined (1)

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

/includes/Database/FormsController.php  
  1. final class NF_Database_FormsController 
  2. private $db; 
  3. private $factory; 
  4. private $forms_data = array(); 
  5.  
  6. public function __construct() 
  7. global $wpdb; 
  8. $this->db = $wpdb; 
  9.  
  10. public function setFormsData() 
  11. try { 
  12. $sql = "SELECT `id`, `title`, `created_at` FROM `{$this->db->prefix}nf3_forms`"; 
  13. $forms_data = $this->db->get_results($sql, OBJECT_K); 
  14. } catch( Exception $e ) { 
  15. return array(); 
  16.  
  17. // Provided as array of 
  18. // object {id => Str, title => Str, created_at => Str} 
  19.  
  20. return $forms_data; 
  21.  
  22. public function getFormsData() 
  23. if( empty( $this->forms_data ) ) { 
  24. $this->forms_data = $this->setFormsData(); 
  25. return( array_values( $this->forms_data ) );