| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/ninja-forms/deprecated/classes/ |
Upload File : |
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Handles adding and removing forms.
*
* @package Ninja Forms
* @subpackage Classes/Form
* @copyright Copyright (c) 2014, WPNINJAS
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 2.9
*/
class NF_Forms {
/**
* Store our array of form ids
*
* @since 2.9
*/
var $forms = array();
/**
* Get things started
*
* @access public
* @since 2.9
* @return void
*/
public function __construct() {
add_action( 'nf_maybe_delete_form', array( $this, 'maybe_delete' ) );
}
/**
* Get all forms
*
* @access public
* @since 2.9
* @return array $forms
*/
public function get_all( $show_new = false ) {
global $wpdb;
$debug = ! empty ( $_REQUEST['debug'] ) ? true : false;
if ( empty ( $this->forms ) ) {
$forms = nf_get_objects_by_type( 'form' );
$tmp_array = array();
foreach ( $forms as $form ) {
$form_id = $form['id'];
$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 ) {
if ( $debug )
$tmp_array[] = $form_id;
} else {
$tmp_array[] = $form_id;
}
}
}
$this->forms = $tmp_array;
}
return $this->forms;
}
/**
* Delete a form if it is created and not saved within 24 hrs.
*
* @access public
* @since 2.9
* @return void
*/
public function maybe_delete( $form_id ) {
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
if ( 'new' == $status ) {
Ninja_Forms()->form( $form_id )->delete();
}
}
/**
* Update cached forms
*
* @access public
* @since 2.9
* @return void
*/
public function update_cache( $debug = false, $show_new = false ) {
$this->forms = array();
$this->get_all( $debug, $show_new );
}
}