<?php if ( ! defined( 'ABSPATH' ) ) exit;
* Handles adding and removing forms.
* @subpackage Classes/Form
* @copyright Copyright (c) 2014, WPNINJAS
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* Store our array of form ids
public function __construct() {
add_action( 'nf_maybe_delete_form', array( $this, 'maybe_delete' ) );
public function get_all( $show_new = false ) {
$debug = ! empty ( $_REQUEST['debug'] ) ? true : false;
if ( empty ( $this->forms ) ) {
$forms = nf_get_objects_by_type( 'form' );
foreach ( $forms as $form ) {
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
if ( ( $status == 'new' && $show_new ) || $status != 'new' ) {
$title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
if ( strpos( $title, '_' ) === 0 ) {
$this->forms = $tmp_array;
* Delete a form if it is created and not saved within 24 hrs.
public function maybe_delete( $form_id ) {
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
if ( 'new' == $status ) {
Ninja_Forms()->form( $form_id )->delete();
public function update_cache( $debug = false, $show_new = false ) {
$this->get_all( $debug, $show_new );