Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../deprecat.../includes
File: activation.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
*
[3] Fix | Delete
* Function that checks to see if the new defined files from version 2.2.30 are present. If they aren't, add them.
[4] Fix | Delete
*
[5] Fix | Delete
* @since 2.2.30
[6] Fix | Delete
* @returns void
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
function ninja_forms_defined_fields_check(){
[10] Fix | Delete
$screen = get_current_screen();
[11] Fix | Delete
if ( $screen->base == 'toplevel_page_ninja-forms' ) {
[12] Fix | Delete
global $wpdb;
[13] Fix | Delete
// Run our update.
[14] Fix | Delete
// Make sure that our defined fields don't already exist.
[15] Fix | Delete
$tax = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Tax' ), ARRAY_A );
[16] Fix | Delete
if( !isset($tax['id']) ){
[17] Fix | Delete
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
[18] Fix | Delete
(NULL, 0, \'_tax\', 0, \'a:11:{s:5:"label";s:3:"Tax";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:19:"payment_field_group";s:1:"1";s:11:"payment_tax";s:1:"1";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"conditional";s:0:"";s:11:"calc_option";s:1:"0";s:4:"calc";s:0:"";}\', \'Tax\'),
[19] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:19:{s:5:"label";s:10:"First Name";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"1";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'First Name\'),
[20] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:19:{s:5:"label";s:9:"Last Name";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"1";s:9:"from_name";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Last Name\'),
[21] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:9:"Address 1";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"1";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Address 1\'),
[22] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:9:"Address 2";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"1";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Address 2\'),
[23] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:4:"City";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"1";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'City\'),
[24] Fix | Delete
(NULL, 0, \'_list\', 0, \'a:16:{s:5:"label";s:5:"State";s:9:"label_pos";s:5:"above";s:10:"multi_size";s:1:"5";s:15:"list_show_value";s:1:"1";s:4:"list";a:1:{s:7:"options";a:51:{i:0;a:4:{s:5:"label";s:7:"Alabama";s:5:"value";s:2:"AL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:1;a:4:{s:5:"label";s:6:"Alaska";s:5:"value";s:2:"AK";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:2;a:4:{s:5:"label";s:7:"Arizona";s:5:"value";s:2:"AZ";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:3;a:4:{s:5:"label";s:8:"Arkansas";s:5:"value";s:2:"AR";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:4;a:4:{s:5:"label";s:10:"California";s:5:"value";s:2:"CA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:5;a:4:{s:5:"label";s:8:"Colorado";s:5:"value";s:2:"CO";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:6;a:4:{s:5:"label";s:11:"Connecticut";s:5:"value";s:2:"CT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:7;a:4:{s:5:"label";s:8:"Delaware";s:5:"value";s:2:"DE";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:8;a:4:{s:5:"label";s:20:"District of Columbia";s:5:"value";s:2:"DC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:9;a:4:{s:5:"label";s:7:"Florida";s:5:"value";s:2:"FL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:10;a:4:{s:5:"label";s:7:"Georgia";s:5:"value";s:2:"GA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:11;a:4:{s:5:"label";s:6:"Hawaii";s:5:"value";s:2:"HI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:12;a:4:{s:5:"label";s:5:"Idaho";s:5:"value";s:2:"ID";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:13;a:4:{s:5:"label";s:8:"Illinois";s:5:"value";s:2:"IL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:14;a:4:{s:5:"label";s:7:"Indiana";s:5:"value";s:2:"IN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:15;a:4:{s:5:"label";s:4:"Iowa";s:5:"value";s:2:"IA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:16;a:4:{s:5:"label";s:6:"Kansas";s:5:"value";s:2:"KS";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:17;a:4:{s:5:"label";s:8:"Kentucky";s:5:"value";s:2:"KY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:18;a:4:{s:5:"label";s:9:"Louisiana";s:5:"value";s:2:"LA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:19;a:4:{s:5:"label";s:5:"Maine";s:5:"value";s:2:"ME";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:20;a:4:{s:5:"label";s:8:"Maryland";s:5:"value";s:2:"MD";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:21;a:4:{s:5:"label";s:13:"Massachusetts";s:5:"value";s:2:"MA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:22;a:4:{s:5:"label";s:8:"Michigan";s:5:"value";s:2:"MI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:23;a:4:{s:5:"label";s:9:"Minnesota";s:5:"value";s:2:"MN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:24;a:4:{s:5:"label";s:11:"Mississippi";s:5:"value";s:2:"MS";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:25;a:4:{s:5:"label";s:8:"Missouri";s:5:"value";s:2:"MO";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:26;a:4:{s:5:"label";s:7:"Montana";s:5:"value";s:2:"MT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:27;a:4:{s:5:"label";s:8:"Nebraska";s:5:"value";s:2:"NE";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:28;a:4:{s:5:"label";s:6:"Nevada";s:5:"value";s:2:"NV";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:29;a:4:{s:5:"label";s:13:"New Hampshire";s:5:"value";s:2:"NH";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:30;a:4:{s:5:"label";s:10:"New Jersey";s:5:"value";s:2:"NJ";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:31;a:4:{s:5:"label";s:10:"New Mexico";s:5:"value";s:2:"NM";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:32;a:4:{s:5:"label";s:8:"New York";s:5:"value";s:2:"NY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:33;a:4:{s:5:"label";s:14:"North Carolina";s:5:"value";s:2:"NC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:34;a:4:{s:5:"label";s:12:"North Dakota";s:5:"value";s:2:"ND";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:35;a:4:{s:5:"label";s:4:"Ohio";s:5:"value";s:2:"OH";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:36;a:4:{s:5:"label";s:8:"Oklahoma";s:5:"value";s:2:"OK";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:37;a:4:{s:5:"label";s:6:"Oregon";s:5:"value";s:2:"OR";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:38;a:4:{s:5:"label";s:12:"Pennsylvania";s:5:"value";s:2:"PA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:39;a:4:{s:5:"label";s:12:"Rhode Island";s:5:"value";s:2:"RI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:40;a:4:{s:5:"label";s:14:"South Carolina";s:5:"value";s:2:"SC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:41;a:4:{s:5:"label";s:12:"South Dakota";s:5:"value";s:2:"SD";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:42;a:4:{s:5:"label";s:9:"Tennessee";s:5:"value";s:2:"TN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:43;a:4:{s:5:"label";s:5:"Texas";s:5:"value";s:2:"TX";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:44;a:4:{s:5:"label";s:4:"Utah";s:5:"value";s:2:"UT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:45;a:4:{s:5:"label";s:7:"Vermont";s:5:"value";s:2:"VT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:46;a:4:{s:5:"label";s:8:"Virginia";s:5:"value";s:2:"VA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:47;a:4:{s:5:"label";s:10:"Washington";s:5:"value";s:2:"WA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:48;a:4:{s:5:"label";s:13:"West Virginia";s:5:"value";s:2:"WV";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:49;a:4:{s:5:"label";s:9:"Wisconsin";s:5:"value";s:2:"WI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:50;a:4:{s:5:"label";s:7:"Wyoming";s:5:"value";s:2:"WY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}}}s:9:"list_type";s:8:"dropdown";s:10:"user_state";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:13:"populate_term";s:0:"";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'State\'),
[25] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:15:"Zip / Post Code";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Zip / Post Code\'),
[26] Fix | Delete
(NULL, 0, \'_country\', 0, \'a:10:{s:5:"label";s:7:"Country";s:9:"label_pos";s:5:"above";s:13:"default_value";s:2:"US";s:21:"user_info_field_group";s:1:"1";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Country\'),
[27] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Email";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"1";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"0";s:10:"user_email";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Email\'),
[28] Fix | Delete
(NULL, 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Phone";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:14:"(999) 999-9999";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"1";s:10:"user_email";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Phone\'),
[29] Fix | Delete
(NULL, 0, \'_calc\', 0, \'a:20:{s:9:"calc_name";s:9:"sub_total";s:13:"default_value";s:0:"";s:17:"calc_display_type";s:4:"text";s:5:"label";s:9:"Sub Total";s:9:"label_pos";s:5:"above";s:26:"calc_display_text_disabled";s:1:"1";s:17:"calc_display_html";s:26:"<p>[ninja_forms_calc]</p>\n";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"calc_method";s:4:"auto";s:4:"calc";s:0:"";s:7:"calc_eq";s:0:"";s:19:"payment_field_group";s:1:"1";s:13:"payment_total";s:1:"0";s:17:"payment_sub_total";s:1:"1";s:11:"calc_places";s:1:"2";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Sub Total\'),
[30] Fix | Delete
(NULL, 0, \'_calc\', 0, \'a:20:{s:9:"calc_name";s:5:"total";s:13:"default_value";s:0:"";s:17:"calc_display_type";s:4:"text";s:5:"label";s:5:"Total";s:9:"label_pos";s:5:"above";s:26:"calc_display_text_disabled";s:1:"1";s:17:"calc_display_html";s:26:"<p>[ninja_forms_calc]</p>\n";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"calc_method";s:4:"auto";s:4:"calc";a:5:{i:0;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"70";}i:1;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"69";}i:2;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"15";}i:3;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"61";}i:4;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"70";}}s:7:"calc_eq";s:5:"5 + 5";s:19:"payment_field_group";s:1:"1";s:13:"payment_total";s:1:"1";s:17:"payment_sub_total";s:1:"0";s:11:"calc_places";s:1:"2";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Total\');';
[31] Fix | Delete
$wpdb->query($sql);
[32] Fix | Delete
}
[33] Fix | Delete
$credit_card = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Credit Card' ), ARRAY_A );
[34] Fix | Delete
if( !isset( $credit_card['id'] ) ){
[35] Fix | Delete
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES (92, 0, \'_credit_card\', 0, \'a:6:{s:5:"label";s:11:"Credit Card";s:19:"payment_field_group";s:1:"1";s:3:"req";s:1:"0";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"conditional";s:0:"";}\', \'Credit Card\');';
[36] Fix | Delete
$wpdb->query($sql);
[37] Fix | Delete
}
[38] Fix | Delete
}
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
add_action( 'current_screen', 'ninja_forms_defined_fields_check' );
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
function ninja_forms_activation( $network_wide ){
[45] Fix | Delete
global $wpdb;
[46] Fix | Delete
[47] Fix | Delete
if ( ! $network_wide ) { // This is a single-site activation.
[48] Fix | Delete
[49] Fix | Delete
wp_schedule_event( time(), 'daily', 'ninja_forms_daily_action' );
[50] Fix | Delete
[51] Fix | Delete
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
[52] Fix | Delete
[53] Fix | Delete
$plugin_settings = nf_get_settings();
[54] Fix | Delete
[55] Fix | Delete
$current_version = isset ( $plugin_settings['version'] ) ? $plugin_settings['version'] : '';
[56] Fix | Delete
[57] Fix | Delete
if ( $current_version != '' ) {
[58] Fix | Delete
update_option( 'nf_version_upgraded_from', $current_version );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
$forms = '';
[62] Fix | Delete
[63] Fix | Delete
$opt = $plugin_settings;
[64] Fix | Delete
[65] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." (
[66] Fix | Delete
`id` int(11) NOT NULL AUTO_INCREMENT,
[67] Fix | Delete
`row_type` int(11) NOT NULL,
[68] Fix | Delete
`type` varchar(255) CHARACTER SET utf8 NOT NULL,
[69] Fix | Delete
`order` int(11) NOT NULL,
[70] Fix | Delete
`data` longtext CHARACTER SET utf8 NOT NULL,
[71] Fix | Delete
`name` varchar(255) CHARACTER SET utf8 NOT NULL,
[72] Fix | Delete
PRIMARY KEY (`id`)
[73] Fix | Delete
) DEFAULT CHARSET=utf8;";
[74] Fix | Delete
[75] Fix | Delete
dbDelta($sql);
[76] Fix | Delete
[77] Fix | Delete
if (!function_exists('nf_change_email_fav')){
[78] Fix | Delete
require_once dirname(__FILE__).'/admin/upgrades/upgrade-functions.php';
[79] Fix | Delete
}
[80] Fix | Delete
// Remove old email settings.
[81] Fix | Delete
nf_change_email_fav();
[82] Fix | Delete
[83] Fix | Delete
$state_dropdown = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'State Dropdown' ), ARRAY_A );
[84] Fix | Delete
if( !isset($state_dropdown['id']) ){
[85] Fix | Delete
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
[86] Fix | Delete
(2, 0, \'_list\', 0, \'a:10:{s:5:\"label\";s:14:\"State Dropdown\";s:9:\"label_pos\";s:4:\"left\";s:9:\"list_type\";s:8:\"dropdown\";s:10:\"multi_size\";s:1:\"5\";s:15:\"list_show_value\";s:1:\"1\";s:4:\"list\";a:1:{s:7:\"options\";a:51:{i:0;a:3:{s:5:\"label\";s:7:\"Alabama\";s:5:\"value\";s:2:\"AL\";s:8:\"selected\";s:1:\"0\";}i:1;a:3:{s:5:\"label\";s:6:\"Alaska\";s:5:\"value\";s:2:\"AK\";s:8:\"selected\";s:1:\"0\";}i:2;a:3:{s:5:\"label\";s:7:\"Arizona\";s:5:\"value\";s:2:\"AZ\";s:8:\"selected\";s:1:\"0\";}i:3;a:3:{s:5:\"label\";s:8:\"Arkansas\";s:5:\"value\";s:2:\"AR\";s:8:\"selected\";s:1:\"0\";}i:4;a:3:{s:5:\"label\";s:10:\"California\";s:5:\"value\";s:2:\"CA\";s:8:\"selected\";s:1:\"0\";}i:5;a:3:{s:5:\"label\";s:8:\"Colorado\";s:5:\"value\";s:2:\"CO\";s:8:\"selected\";s:1:\"0\";}i:6;a:3:{s:5:\"label\";s:11:\"Connecticut\";s:5:\"value\";s:2:\"CT\";s:8:\"selected\";s:1:\"0\";}i:7;a:3:{s:5:\"label\";s:8:\"Delaware\";s:5:\"value\";s:2:\"DE\";s:8:\"selected\";s:1:\"0\";}i:8;a:3:{s:5:\"label\";s:20:\"District of Columbia\";s:5:\"value\";s:2:\"DC\";s:8:\"selected\";s:1:\"0\";}i:9;a:3:{s:5:\"label\";s:7:\"Florida\";s:5:\"value\";s:2:\"FL\";s:8:\"selected\";s:1:\"0\";}i:10;a:3:{s:5:\"label\";s:7:\"Georgia\";s:5:\"value\";s:2:\"GA\";s:8:\"selected\";s:1:\"0\";}i:11;a:3:{s:5:\"label\";s:6:\"Hawaii\";s:5:\"value\";s:2:\"HI\";s:8:\"selected\";s:1:\"0\";}i:12;a:3:{s:5:\"label\";s:5:\"Idaho\";s:5:\"value\";s:2:\"ID\";s:8:\"selected\";s:1:\"0\";}i:13;a:3:{s:5:\"label\";s:8:\"Illinois\";s:5:\"value\";s:2:\"IL\";s:8:\"selected\";s:1:\"0\";}i:14;a:3:{s:5:\"label\";s:7:\"Indiana\";s:5:\"value\";s:2:\"IN\";s:8:\"selected\";s:1:\"0\";}i:15;a:3:{s:5:\"label\";s:4:\"Iowa\";s:5:\"value\";s:2:\"IA\";s:8:\"selected\";s:1:\"0\";}i:16;a:3:{s:5:\"label\";s:6:\"Kansas\";s:5:\"value\";s:2:\"KS\";s:8:\"selected\";s:1:\"0\";}i:17;a:3:{s:5:\"label\";s:8:\"Kentucky\";s:5:\"value\";s:2:\"KY\";s:8:\"selected\";s:1:\"0\";}i:18;a:3:{s:5:\"label\";s:9:\"Louisiana\";s:5:\"value\";s:2:\"LA\";s:8:\"selected\";s:1:\"0\";}i:19;a:3:{s:5:\"label\";s:5:\"Maine\";s:5:\"value\";s:2:\"ME\";s:8:\"selected\";s:1:\"0\";}i:20;a:3:{s:5:\"label\";s:8:\"Maryland\";s:5:\"value\";s:2:\"MD\";s:8:\"selected\";s:1:\"0\";}i:21;a:3:{s:5:\"label\";s:13:\"Massachusetts\";s:5:\"value\";s:2:\"MA\";s:8:\"selected\";s:1:\"0\";}i:22;a:3:{s:5:\"label\";s:8:\"Michigan\";s:5:\"value\";s:2:\"MI\";s:8:\"selected\";s:1:\"0\";}i:23;a:3:{s:5:\"label\";s:9:\"Minnesota\";s:5:\"value\";s:2:\"MN\";s:8:\"selected\";s:1:\"0\";}i:24;a:3:{s:5:\"label\";s:11:\"Mississippi\";s:5:\"value\";s:2:\"MS\";s:8:\"selected\";s:1:\"0\";}i:25;a:3:{s:5:\"label\";s:8:\"Missouri\";s:5:\"value\";s:2:\"MO\";s:8:\"selected\";s:1:\"0\";}i:26;a:3:{s:5:\"label\";s:7:\"Montana\";s:5:\"value\";s:2:\"MT\";s:8:\"selected\";s:1:\"0\";}i:27;a:3:{s:5:\"label\";s:8:\"Nebraska\";s:5:\"value\";s:2:\"NE\";s:8:\"selected\";s:1:\"0\";}i:28;a:3:{s:5:\"label\";s:6:\"Nevada\";s:5:\"value\";s:2:\"NV\";s:8:\"selected\";s:1:\"0\";}i:29;a:3:{s:5:\"label\";s:13:\"New Hampshire\";s:5:\"value\";s:2:\"NH\";s:8:\"selected\";s:1:\"0\";}i:30;a:3:{s:5:\"label\";s:10:\"New Jersey\";s:5:\"value\";s:2:\"NJ\";s:8:\"selected\";s:1:\"0\";}i:31;a:3:{s:5:\"label\";s:10:\"New Mexico\";s:5:\"value\";s:2:\"NM\";s:8:\"selected\";s:1:\"0\";}i:32;a:3:{s:5:\"label\";s:8:\"New York\";s:5:\"value\";s:2:\"NY\";s:8:\"selected\";s:1:\"0\";}i:33;a:3:{s:5:\"label\";s:14:\"North Carolina\";s:5:\"value\";s:2:\"NC\";s:8:\"selected\";s:1:\"0\";}i:34;a:3:{s:5:\"label\";s:12:\"North Dakota\";s:5:\"value\";s:2:\"ND\";s:8:\"selected\";s:1:\"0\";}i:35;a:3:{s:5:\"label\";s:4:\"Ohio\";s:5:\"value\";s:2:\"OH\";s:8:\"selected\";s:1:\"0\";}i:36;a:3:{s:5:\"label\";s:8:\"Oklahoma\";s:5:\"value\";s:2:\"OK\";s:8:\"selected\";s:1:\"0\";}i:37;a:3:{s:5:\"label\";s:6:\"Oregon\";s:5:\"value\";s:2:\"OR\";s:8:\"selected\";s:1:\"0\";}i:38;a:3:{s:5:\"label\";s:12:\"Pennsylvania\";s:5:\"value\";s:2:\"PA\";s:8:\"selected\";s:1:\"0\";}i:39;a:3:{s:5:\"label\";s:12:\"Rhode Island\";s:5:\"value\";s:2:\"RI\";s:8:\"selected\";s:1:\"0\";}i:40;a:3:{s:5:\"label\";s:14:\"South Carolina\";s:5:\"value\";s:2:\"SC\";s:8:\"selected\";s:1:\"0\";}i:41;a:3:{s:5:\"label\";s:12:\"South Dakota\";s:5:\"value\";s:2:\"SD\";s:8:\"selected\";s:1:\"0\";}i:42;a:3:{s:5:\"label\";s:9:\"Tennessee\";s:5:\"value\";s:2:\"TN\";s:8:\"selected\";s:1:\"0\";}i:43;a:3:{s:5:\"label\";s:5:\"Texas\";s:5:\"value\";s:2:\"TX\";s:8:\"selected\";s:1:\"0\";}i:44;a:3:{s:5:\"label\";s:4:\"Utah\";s:5:\"value\";s:2:\"UT\";s:8:\"selected\";s:1:\"0\";}i:45;a:3:{s:5:\"label\";s:7:\"Vermont\";s:5:\"value\";s:2:\"VT\";s:8:\"selected\";s:1:\"0\";}i:46;a:3:{s:5:\"label\";s:8:\"Virginia\";s:5:\"value\";s:2:\"VA\";s:8:\"selected\";s:1:\"0\";}i:47;a:3:{s:5:\"label\";s:10:\"Washington\";s:5:\"value\";s:2:\"WA\";s:8:\"selected\";s:1:\"0\";}i:48;a:3:{s:5:\"label\";s:13:\"West Virginia\";s:5:\"value\";s:2:\"WV\";s:8:\"selected\";s:1:\"0\";}i:49;a:3:{s:5:\"label\";s:9:\"Wisconsin\";s:5:\"value\";s:2:\"WI\";s:8:\"selected\";s:1:\"0\";}i:50;a:3:{s:5:\"label\";s:7:\"Wyoming\";s:5:\"value\";s:2:\"WY\";s:8:\"selected\";s:1:\"0\";}}}s:3:\"req\";s:1:\"0\";s:5:\"class\";s:0:\"\";s:9:\"show_help\";s:1:\"0\";s:9:\"help_text\";s:0:\"\";}\', \'State Dropdown\')';
[87] Fix | Delete
$wpdb->query($sql);
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
$anti_spam = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Anti-Spam' ), ARRAY_A );
[91] Fix | Delete
if( !isset($anti_spam['id']) ){
[92] Fix | Delete
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
[93] Fix | Delete
(3, 0, \'_spam\', 0, \'a:6:{s:9:"label_pos";s:4:"left";s:5:"label";s:18:"Anti-Spam Question";s:6:"answer";s:16:"Anti-Spam Answer";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";}\', \'Anti-Spam\')';
[94] Fix | Delete
$wpdb->query($sql);
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
$submit = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Submit' ), ARRAY_A );
[98] Fix | Delete
if( !isset($submit['id']) ){
[99] Fix | Delete
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
[100] Fix | Delete
(4, 0, \'_submit\', 0, \'a:4:{s:5:\"label\";s:6:\"Submit\";s:5:\"class\";s:0:\"\";s:9:\"show_help\";s:1:\"0\";s:9:\"help_text\";s:0:\"\";}\', \'Submit\');';
[101] Fix | Delete
$wpdb->query($sql);
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_FIELDS_TABLE_NAME." (
[105] Fix | Delete
`id` int(11) NOT NULL AUTO_INCREMENT,
[106] Fix | Delete
`form_id` int(11) NOT NULL,
[107] Fix | Delete
`type` varchar(255) CHARACTER SET utf8 NOT NULL,
[108] Fix | Delete
`order` int(11) NOT NULL,
[109] Fix | Delete
`data` longtext CHARACTER SET utf8 NOT NULL,
[110] Fix | Delete
`fav_id` int(11) DEFAULT NULL,
[111] Fix | Delete
`def_id` int(11) DEFAULT NULL,
[112] Fix | Delete
PRIMARY KEY (`id`)
[113] Fix | Delete
) DEFAULT CHARSET=utf8 ;";
[114] Fix | Delete
[115] Fix | Delete
dbDelta($sql);
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Add our table structure for version 2.8.
[119] Fix | Delete
*/
[120] Fix | Delete
[121] Fix | Delete
// Create our object meta table
[122] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS ". NF_OBJECT_META_TABLE_NAME . " (
[123] Fix | Delete
`id` bigint(20) NOT NULL AUTO_INCREMENT,
[124] Fix | Delete
`object_id` bigint(20) NOT NULL,
[125] Fix | Delete
`meta_key` varchar(255) NOT NULL,
[126] Fix | Delete
`meta_value` longtext NOT NULL,
[127] Fix | Delete
PRIMARY KEY (`id`)
[128] Fix | Delete
) DEFAULT CHARSET=utf8;";
[129] Fix | Delete
[130] Fix | Delete
dbDelta( $sql );
[131] Fix | Delete
[132] Fix | Delete
// Create our object table
[133] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECTS_TABLE_NAME . " (
[134] Fix | Delete
`id` bigint(20) NOT NULL AUTO_INCREMENT,
[135] Fix | Delete
`type` varchar(255) NOT NULL,
[136] Fix | Delete
PRIMARY KEY (`id`)
[137] Fix | Delete
) DEFAULT CHARSET=utf8;";
[138] Fix | Delete
[139] Fix | Delete
dbDelta( $sql );
[140] Fix | Delete
[141] Fix | Delete
// Create our object relationships table
[142] Fix | Delete
[143] Fix | Delete
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " (
[144] Fix | Delete
`id` bigint(20) NOT NULL AUTO_INCREMENT,
[145] Fix | Delete
`child_id` bigint(20) NOT NULL,
[146] Fix | Delete
`parent_id` bigint(20) NOT NULL,
[147] Fix | Delete
`child_type` varchar(255) NOT NULL,
[148] Fix | Delete
`parent_type` varchar(255) NOT NULL,
[149] Fix | Delete
PRIMARY KEY (`id`)
[150] Fix | Delete
) DEFAULT CHARSET=utf8;";
[151] Fix | Delete
[152] Fix | Delete
dbDelta( $sql );
[153] Fix | Delete
[154] Fix | Delete
$title = ninja_forms_get_preview_page_title();
[155] Fix | Delete
$preview_page = get_page_by_title( $title );
[156] Fix | Delete
if( !$preview_page ) {
[157] Fix | Delete
// Create preview page object
[158] Fix | Delete
$preview_post = array(
[159] Fix | Delete
'post_title' => $title,
[160] Fix | Delete
'post_content' => 'This is a preview of how this form will appear on your website',
[161] Fix | Delete
'post_status' => 'draft',
[162] Fix | Delete
'post_type' => 'page'
[163] Fix | Delete
);
[164] Fix | Delete
[165] Fix | Delete
// Insert the page into the database
[166] Fix | Delete
$page_id = wp_insert_post( $preview_post );
[167] Fix | Delete
}else{
[168] Fix | Delete
$page_id = $preview_page->ID;
[169] Fix | Delete
}
[170] Fix | Delete
[171] Fix | Delete
$opt['preview_id'] = $page_id;
[172] Fix | Delete
[173] Fix | Delete
$opt['version'] = NF_PLUGIN_VERSION;
[174] Fix | Delete
[175] Fix | Delete
$current_settings = get_option( 'ninja_forms_settings', false );
[176] Fix | Delete
[177] Fix | Delete
if ( ! $current_settings ) {
[178] Fix | Delete
update_option( 'nf_convert_notifications_complete', true );
[179] Fix | Delete
update_option( 'nf_convert_subs_step', 'complete' );
[180] Fix | Delete
update_option( 'nf_upgrade_notice', 'closed' );
[181] Fix | Delete
update_option( 'nf_update_email_settings_complete', true );
[182] Fix | Delete
update_option( 'nf_email_fav_updated', true );
[183] Fix | Delete
update_option( 'nf_convert_forms_complete', true );
[184] Fix | Delete
update_option( 'nf_database_migrations', true );
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
update_option( "ninja_forms_settings", $opt );
[188] Fix | Delete
update_option( 'ninja_forms_version', NF_PLUGIN_VERSION );
[189] Fix | Delete
[190] Fix | Delete
// check for an existing form
[191] Fix | Delete
$starter_form_exists = ninja_forms_starter_form_exists();
[192] Fix | Delete
[193] Fix | Delete
if ( ! $starter_form_exists ) {
[194] Fix | Delete
// if a starter form doesn't exist them create it
[195] Fix | Delete
ninja_forms_add_starter_form();
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
// Add the transient to redirect
[199] Fix | Delete
// set_transient( '_nf_activation_redirect', true, 30 );
[200] Fix | Delete
[201] Fix | Delete
} else { // We're network activating.
[202] Fix | Delete
header( 'Location: ' . network_admin_url( 'plugins.php?deactivate=true&nf_action=network_activation_error' ) );
[203] Fix | Delete
exit;
[204] Fix | Delete
}
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
/**
[208] Fix | Delete
* Outputs a notice if the user attempts a network activation of the plugin.
[209] Fix | Delete
*
[210] Fix | Delete
* @since 2.7
[211] Fix | Delete
* @return void
[212] Fix | Delete
*/
[213] Fix | Delete
function nf_network_activation_error() {
[214] Fix | Delete
echo '<div class="error"><p>' . __( 'Ninja Forms cannot be network activated. Please visit each site\'s dashboard to activate the plugin.', 'ninja-forms' ) . '</p></div>';
[215] Fix | Delete
deactivate_plugins( plugin_basename( __FILE__ ), TRUE, TRUE );
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Add our network activation error to the admin_notice hook.
[220] Fix | Delete
*
[221] Fix | Delete
* @since 2.7
[222] Fix | Delete
* @return void
[223] Fix | Delete
*/
[224] Fix | Delete
function nf_add_network_activation_error() {
[225] Fix | Delete
add_action( 'network_admin_notices', 'nf_network_activation_error' );
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
add_action( 'nf_network_activation_error', 'nf_add_network_activation_error' );
[229] Fix | Delete
[230] Fix | Delete
[231] Fix | Delete
/*
[232] Fix | Delete
* Check to see if a form exists.
[233] Fix | Delete
*
[234] Fix | Delete
* @since 2.3.3
[235] Fix | Delete
* @return bool
[236] Fix | Delete
*/
[237] Fix | Delete
function ninja_forms_starter_form_exists() {
[238] Fix | Delete
$forms = ninja_forms_get_all_forms();
[239] Fix | Delete
if( empty( $forms ) ) {
[240] Fix | Delete
return false;
[241] Fix | Delete
}
[242] Fix | Delete
return true;
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
[246] Fix | Delete
/*
[247] Fix | Delete
* Add a starter form. Return the ID.
[248] Fix | Delete
*
[249] Fix | Delete
* @since 2.3.3
[250] Fix | Delete
* @returns int
[251] Fix | Delete
*/
[252] Fix | Delete
function ninja_forms_add_starter_form() {
[253] Fix | Delete
// load starter form
[254] Fix | Delete
$file = file_get_contents( NINJA_FORMS_DIR . "/includes/forms/starter-form.nff" );
[255] Fix | Delete
$file = apply_filters( 'ninja_forms_starter_form_contents', $file );
[256] Fix | Delete
[257] Fix | Delete
// create new form
[258] Fix | Delete
ninja_forms_import_form( $file );
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
[262] Fix | Delete
/*
[263] Fix | Delete
* Get the preview page title
[264] Fix | Delete
*
[265] Fix | Delete
* @since 2.5.2
[266] Fix | Delete
* @returns string
[267] Fix | Delete
*/
[268] Fix | Delete
function ninja_forms_get_preview_page_title() {
[269] Fix | Delete
return apply_filters( 'ninja_forms_preview_page_title', 'ninja_forms_preview_page' );
[270] Fix | Delete
}
[271] Fix | Delete
[272] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function