Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../deprecat.../includes/admin
File: save.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
function ninja_forms_admin_save(){
[2] Fix | Delete
global $ninja_forms_tabs, $ninja_forms_sidebars, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
[3] Fix | Delete
if(!empty($_POST) AND !empty($_POST['_ninja_forms_admin_submit']) AND $_POST['_ninja_forms_admin_submit'] != ''){
[4] Fix | Delete
if(wp_verify_nonce($_POST['_ninja_forms_admin_submit'],'_ninja_forms_save') AND check_admin_referer('_ninja_forms_save','_ninja_forms_admin_submit')){
[5] Fix | Delete
$current_page = esc_html( $_REQUEST['page'] );
[6] Fix | Delete
$current_tab = ninja_forms_get_current_tab();
[7] Fix | Delete
[8] Fix | Delete
$data_array = array();
[9] Fix | Delete
if ( isset( $_REQUEST['form_id'] ) and $_REQUEST['form_id'] != 'new' ) {
[10] Fix | Delete
$form_id = absint( $_REQUEST['form_id'] );
[11] Fix | Delete
[12] Fix | Delete
// Dump our current form transient.
[13] Fix | Delete
delete_transient( 'nf_form_' . $form_id );
[14] Fix | Delete
} else if ( isset ( $_REQUEST['form_id'] ) and $_REQUEST['form_id'] == 'new' ) {
[15] Fix | Delete
$form_id = 'new';
[16] Fix | Delete
} else {
[17] Fix | Delete
$form_id = '';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
foreach ( $_POST as $key => $val ) {
[21] Fix | Delete
if ( substr($key, 0, 1) != '_') {
[22] Fix | Delete
$data_array[$key] = esc_html($val);
[23] Fix | Delete
}
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
$data_array = ninja_forms_stripslashes_deep( $data_array );
[27] Fix | Delete
//$data_array = ninja_forms_esc_html_deep( $data_array );
[28] Fix | Delete
[29] Fix | Delete
//Call any save functions registered to metaboxes
[30] Fix | Delete
if( isset( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) AND is_array( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) AND !empty( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) ){
[31] Fix | Delete
foreach( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $opts ){
[32] Fix | Delete
[33] Fix | Delete
// Get the save function of our options, if set, and call them, passing the data that has been posted.
[34] Fix | Delete
if( isset( $opts['settings'] ) AND !empty( $opts['settings'] ) ){
[35] Fix | Delete
foreach( $opts['settings'] as $setting ){
[36] Fix | Delete
if( isset( $setting['save_function'] ) ){
[37] Fix | Delete
if( isset( $form_id ) and $form_id != '' ){
[38] Fix | Delete
$arguments['form_id'] = $form_id;
[39] Fix | Delete
}
[40] Fix | Delete
$arguments['data'] = $data_array;
[41] Fix | Delete
if( $setting['save_function'] != '' ){
[42] Fix | Delete
if( $ninja_forms_admin_update_message != '' ){
[43] Fix | Delete
$ninja_forms_admin_update_message .= ' ';
[44] Fix | Delete
}
[45] Fix | Delete
$ninja_forms_admin_update_message .= call_user_func_array($setting['save_function'], $arguments);
[46] Fix | Delete
do_action( 'ninja_forms_save_admin_metabox_option', $setting, $form_id, $data_array );
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
if( isset( $opts['save_function'] ) ){
[53] Fix | Delete
$save_function = $opts['save_function'];
[54] Fix | Delete
$arguments = func_get_args();
[55] Fix | Delete
array_shift($arguments); // We need to remove the first arg ($function_name)
[56] Fix | Delete
if ( isset( $form_id ) and $form_id != '' ) {
[57] Fix | Delete
$arguments['form_id'] = $form_id;
[58] Fix | Delete
}
[59] Fix | Delete
$arguments['data'] = $data_array;
[60] Fix | Delete
if($save_function != ''){
[61] Fix | Delete
if( $ninja_forms_admin_update_message != '' ){
[62] Fix | Delete
$ninja_forms_admin_update_message .= ' ';
[63] Fix | Delete
}
[64] Fix | Delete
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
[65] Fix | Delete
do_action( 'ninja_forms_save_admin_metabox', $slug, $form_id, $data_array );
[66] Fix | Delete
}
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
// Get the save function of our current sidebars, if present, and call them, passing the data that has been posted.
[74] Fix | Delete
if(isset($ninja_forms_sidebars[$current_page][$current_tab]) AND is_array($ninja_forms_sidebars[$current_page][$current_tab])){
[75] Fix | Delete
foreach($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar){
[76] Fix | Delete
if($sidebar['save_function'] != ''){
[77] Fix | Delete
$save_function = $sidebar['save_function'];
[78] Fix | Delete
$arguments = func_get_args();
[79] Fix | Delete
array_shift($arguments); // We need to remove the first arg ($function_name)
[80] Fix | Delete
if ( isset( $form_id ) and $form_id != '' ){
[81] Fix | Delete
$arguments['form_id'] = $form_id;
[82] Fix | Delete
}
[83] Fix | Delete
$arguments['data'] = $data_array;
[84] Fix | Delete
if($save_function != ''){
[85] Fix | Delete
if( $ninja_forms_admin_update_message != '' ){
[86] Fix | Delete
$ninja_forms_admin_update_message .= ' ';
[87] Fix | Delete
}
[88] Fix | Delete
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
[89] Fix | Delete
do_action( 'ninja_forms_save_admin_sidebar', $slug, $form_id, $data_array );
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
// Get the save function of our current tab and call it, passing the data that has been posted.
[96] Fix | Delete
$save_function = $ninja_forms_tabs[$current_page][$current_tab]['save_function'];
[97] Fix | Delete
$tab_reload = $ninja_forms_tabs[$current_page][$current_tab]['tab_reload'];
[98] Fix | Delete
$arguments = func_get_args();
[99] Fix | Delete
array_shift($arguments); // We need to remove the first arg ($function_name)
[100] Fix | Delete
if ( isset( $form_id ) and $form_id != '' ) {
[101] Fix | Delete
$arguments['form_id'] = $form_id;
[102] Fix | Delete
}
[103] Fix | Delete
$arguments['data'] = $data_array;
[104] Fix | Delete
[105] Fix | Delete
if($save_function != ''){
[106] Fix | Delete
[107] Fix | Delete
$ninja_forms_admin_update_message = call_user_func_array($save_function, $arguments);
[108] Fix | Delete
do_action( 'ninja_forms_save_admin_tab', $current_tab, $form_id, $data_array );
[109] Fix | Delete
}
[110] Fix | Delete
if ( $tab_reload ) {
[111] Fix | Delete
$redirect_array = array( 'update_message' => urlencode( $ninja_forms_admin_update_message ) );
[112] Fix | Delete
$url = esc_url_raw( add_query_arg( $redirect_array ) );
[113] Fix | Delete
wp_redirect( $url );
[114] Fix | Delete
}
[115] Fix | Delete
}
[116] Fix | Delete
}
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
add_action( 'admin_init', 'ninja_forms_admin_save', 999 );
[120] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function