Ejemplo n.º 1
0
    public function display_form_selector()
    {
        $forms = $this->db->get_forms_for_select();
        ?>
		<select name="parent_form">
			<option value="-1"><?php 
        _e('None', 'wpfepp-plugin');
        ?>
</option>
			<?php 
        foreach ($forms as $key => $form) {
            ?>
				<option value="<?php 
            echo $key;
            ?>
"><?php 
            echo $form;
            ?>
</option>
			<?php 
        }
        ?>
		</select>
		<?php 
    }
Ejemplo n.º 2
0
 /**
  * Fetches the form data from the database table and initializes all the class attributes.
  * 
  * @param int $form_id The row ID of this form from the database table.
  **/
 public function __construct($version, $form_id = -1)
 {
     $this->load_dependencies();
     $this->version = $version;
     if ($form_id < 0) {
         $this->valid = false;
         return;
     }
     require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-wpfepp-db-table.php';
     $this->id = $form_id;
     $this->db = WPFEPP_DB_Table::get_instance();
     $row = $this->db->get($form_id);
     $this->captcha = new WPFEPP_Captcha($this->version);
     if ($row) {
         $this->valid = true;
     } else {
         $this->valid = false;
     }
     if ($this->valid) {
         $this->name = $row['name'];
         $this->description = $row['description'];
         $this->post_type = $row['post_type'];
         $this->fields = $row['fields'];
         $this->settings = $row['settings'];
         $this->emails = $row['emails'];
         //Necessary because we need to check if the post type is public before showing any links to the end user.
         $this->post_type_obj = get_post_type_object($this->post_type);
     }
 }
Ejemplo n.º 3
0
 /**
  * Class constructor. Initializes all the class variables.
  *
  * @var string $version Plugin version.
  * @var string $slug Tab slug.
  * @var string $name Tab name.
  **/
 public function __construct($version, $slug, $name)
 {
     $this->load_dependencies();
     $this->version = $version;
     $this->slug = $slug;
     $this->name = $name;
     $this->renderer = WPFEPP_Field_Renderer::get_instance();
     $this->validator = WPFEPP_Field_Validator::get_instance();
     $this->db = WPFEPP_DB_Table::get_instance();
 }
Ejemplo n.º 4
0
 /**
  * Queries the database, sorts and filters the data, and gets it ready to be displayed.
  **/
 public function prepare_items()
 {
     $per_page = 25;
     $hidden = array();
     $columns = $this->get_columns();
     $sortable = array();
     $curr_page = $this->get_pagenum();
     $total_items = $this->db->get_total_count();
     $data = $this->db->get_forms($curr_page, $per_page);
     $this->items = $data;
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
 /**
  * The function that will run on uninstallation of the plugin to remove data.
  **/
 public static function rollback()
 {
     $data_settings = get_option('wpfepp_data_settings');
     if ($data_settings && $data_settings['delete_on_uninstall']) {
         $db_instance = WPFEPP_DB_Table::get_instance();
         $db_instance->remove_table();
         $db_instance->delete_post_meta(WPFEPP_CopyScape::$meta_key);
         delete_option('wpfepp_media_settings');
         delete_option('wpfepp_post_list_settings');
         delete_option('wpfepp_data_settings');
         delete_option('wpfepp_errors');
         delete_option('wpfepp_email_settings');
         delete_option('wpfepp_copyscape_settings');
         delete_option('wpfepp_recaptcha_settings');
         delete_option('wpfepp_version');
         delete_option('wpfepp_db_table_version');
         delete_option('wpfepp_nag_dismissed');
     }
 }