Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../includes/Database/Migratio...
File: Forms.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
class NF_Database_Migrations_Forms extends NF_Abstracts_Migration
[2] Fix | Delete
{
[3] Fix | Delete
[4] Fix | Delete
/**
[5] Fix | Delete
* Constructor method for the NF_Database_Migrations_Actions class.
[6] Fix | Delete
*
[7] Fix | Delete
* @since 3.0.0
[8] Fix | Delete
*/
[9] Fix | Delete
public function __construct()
[10] Fix | Delete
{
[11] Fix | Delete
parent::__construct(
[12] Fix | Delete
'nf3_forms',
[13] Fix | Delete
'nf_migration_create_table_forms'
[14] Fix | Delete
);
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Function to run our initial migration.
[20] Fix | Delete
*
[21] Fix | Delete
* @since 3.0.0
[22] Fix | Delete
*
[23] Fix | Delete
* @updated 3.4.0
[24] Fix | Delete
*/
[25] Fix | Delete
public function run()
[26] Fix | Delete
{
[27] Fix | Delete
$query = "CREATE TABLE IF NOT EXISTS {$this->table_name()} (
[28] Fix | Delete
`id` int NOT NULL AUTO_INCREMENT,
[29] Fix | Delete
`title` longtext,
[30] Fix | Delete
`key` longtext,
[31] Fix | Delete
`created_at` TIMESTAMP,
[32] Fix | Delete
`updated_at` DATETIME,
[33] Fix | Delete
`views` int(11),
[34] Fix | Delete
`subs` int(11),
[35] Fix | Delete
`form_title` longtext,
[36] Fix | Delete
`default_label_pos` varchar(15),
[37] Fix | Delete
`show_title` bit,
[38] Fix | Delete
`clear_complete` bit,
[39] Fix | Delete
`hide_complete` bit,
[40] Fix | Delete
`logged_in` bit,
[41] Fix | Delete
`seq_num` int,
[42] Fix | Delete
UNIQUE KEY (`id`)
[43] Fix | Delete
) {$this->charset_collate( true )};";
[44] Fix | Delete
[45] Fix | Delete
dbDelta( $query );
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Function to be run as part of our CacheCollateForms required update.
[50] Fix | Delete
*
[51] Fix | Delete
* @since 3.4.0
[52] Fix | Delete
*/
[53] Fix | Delete
public function cache_collate_forms()
[54] Fix | Delete
{
[55] Fix | Delete
global $wpdb;
[56] Fix | Delete
[57] Fix | Delete
// If the form_title column exists...
[58] Fix | Delete
if ( $this->column_exists( 'form_title' ) ) {
[59] Fix | Delete
// Update our existing columns.
[60] Fix | Delete
$query = "ALTER TABLE {$this->table_name()}
[61] Fix | Delete
MODIFY `form_title` longtext {$this->charset_collate()},
[62] Fix | Delete
MODIFY `default_label_pos` varchar(15) {$this->charset_collate()};";
[63] Fix | Delete
} // Otherwise... (The form_title column does not exist.)
[64] Fix | Delete
else {
[65] Fix | Delete
// Create the new columns.
[66] Fix | Delete
$query = "ALTER TABLE {$this->table_name()}
[67] Fix | Delete
ADD `form_title` longtext {$this->charset_collate()},
[68] Fix | Delete
ADD `default_label_pos` varchar(15) {$this->charset_collate()},
[69] Fix | Delete
ADD `show_title` bit,
[70] Fix | Delete
ADD `clear_complete` bit,
[71] Fix | Delete
ADD `hide_complete` bit,
[72] Fix | Delete
ADD `logged_in` bit,
[73] Fix | Delete
ADD `seq_num` int;";
[74] Fix | Delete
}
[75] Fix | Delete
$wpdb->query( $query );
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function