Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../deprecat.../includes
File: register.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
function ninja_forms_register_field($slug, $args = array()){
[1] Fix | Delete
global $ninja_forms_fields;
[2] Fix | Delete
[3] Fix | Delete
if( !isset( $ninja_forms_fields ) ){
[4] Fix | Delete
$ninja_forms_fields = array();
[5] Fix | Delete
}
[6] Fix | Delete
[7] Fix | Delete
$defaults = array(
[8] Fix | Delete
'conditional' => '',
[9] Fix | Delete
'default_label' => '',
[10] Fix | Delete
'default_label_pos' => '',
[11] Fix | Delete
'default_value' => '',
[12] Fix | Delete
'display_function' => '',
[13] Fix | Delete
'display_label' => true,
[14] Fix | Delete
'display_wrap' => true,
[15] Fix | Delete
'edit_autocomplete_off' => false,
[16] Fix | Delete
'edit_conditional' => true,
[17] Fix | Delete
'edit_custom_class' => true,
[18] Fix | Delete
'edit_function' => '',
[19] Fix | Delete
'edit_help' => true,
[20] Fix | Delete
'edit_label' => true,
[21] Fix | Delete
'edit_label_pos' => true,
[22] Fix | Delete
'edit_meta' => true,
[23] Fix | Delete
'edit_options' => '',
[24] Fix | Delete
'edit_placeholder' => false,
[25] Fix | Delete
'edit_req' => true,
[26] Fix | Delete
'edit_settings' => '',
[27] Fix | Delete
'edit_sub_post_process' => '',
[28] Fix | Delete
'edit_sub_pre_process' => '',
[29] Fix | Delete
'edit_sub_process' => '',
[30] Fix | Delete
'esc_html' => true,
[31] Fix | Delete
'group' => '',
[32] Fix | Delete
'interact' => true,
[33] Fix | Delete
'label_pos_options' => '',
[34] Fix | Delete
'li_class' => '',
[35] Fix | Delete
'limit' => '',
[36] Fix | Delete
'name' => $slug,
[37] Fix | Delete
'nesting' => false,
[38] Fix | Delete
'post_process' => '',
[39] Fix | Delete
'pre_process' => '',
[40] Fix | Delete
'process' => '',
[41] Fix | Delete
'process_field' => true,
[42] Fix | Delete
'req' => false,
[43] Fix | Delete
'req_validation' => '',
[44] Fix | Delete
'save_function' => '',
[45] Fix | Delete
'save_sub' => true,
[46] Fix | Delete
'show_fav' => true,
[47] Fix | Delete
'show_field_id' => true,
[48] Fix | Delete
'show_remove' => true,
[49] Fix | Delete
'sub_edit' => 'text',
[50] Fix | Delete
'sub_edit_function' => '',
[51] Fix | Delete
'use_li' => true,
[52] Fix | Delete
'visible' => 1,
[53] Fix | Delete
);
[54] Fix | Delete
[55] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[56] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[57] Fix | Delete
[58] Fix | Delete
foreach( $args as $key => $val ){
[59] Fix | Delete
$ninja_forms_fields[$slug][$key] = $val;
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
function ninja_forms_register_field_type_group( $slug, $args ){
[65] Fix | Delete
global $ninja_forms_field_type_groups;
[66] Fix | Delete
[67] Fix | Delete
foreach( $args as $key => $val ){
[68] Fix | Delete
$ninja_forms_field_type_groups[$slug][$key] = $val;
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
function ninja_forms_register_tab( $slug, $args ){
[73] Fix | Delete
global $ninja_forms_tabs;
[74] Fix | Delete
[75] Fix | Delete
if(!is_array($ninja_forms_tabs)){
[76] Fix | Delete
$ninja_forms_tabs = array();
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
$defaults = array(
[80] Fix | Delete
'active_class' => '',
[81] Fix | Delete
'add_form_id' => true,
[82] Fix | Delete
'disable_no_form_id' => false,
[83] Fix | Delete
'display_function' => '',
[84] Fix | Delete
'inactive_class' => '',
[85] Fix | Delete
'name' => '',
[86] Fix | Delete
'page' => '',
[87] Fix | Delete
'save_function' => '',
[88] Fix | Delete
'show_on_no_form_id' => true,
[89] Fix | Delete
'show_save' => true,
[90] Fix | Delete
'show_tab_links' => true,
[91] Fix | Delete
'show_this_tab_link' => true,
[92] Fix | Delete
'tab_reload' => false,
[93] Fix | Delete
);
[94] Fix | Delete
[95] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[96] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[97] Fix | Delete
[98] Fix | Delete
$page = $args['page'];
[99] Fix | Delete
[100] Fix | Delete
foreach( $args as $key => $val ){
[101] Fix | Delete
$ninja_forms_tabs[$page][$slug][$key] = $val;
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
function ninja_forms_register_sidebar( $slug, $args ){
[106] Fix | Delete
global $ninja_forms_sidebars;
[107] Fix | Delete
[108] Fix | Delete
if( !is_array($ninja_forms_sidebars ) ){
[109] Fix | Delete
$ninja_forms_sidebars = array();
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
$defaults = array(
[113] Fix | Delete
'display_function' => 'ninja_forms_sidebar_display_fields',
[114] Fix | Delete
'name' => '',
[115] Fix | Delete
'order' => '',
[116] Fix | Delete
'save_function' => '',
[117] Fix | Delete
'settings' => ''
[118] Fix | Delete
);
[119] Fix | Delete
[120] Fix | Delete
[121] Fix | Delete
[122] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[123] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[124] Fix | Delete
[125] Fix | Delete
extract( $args );
[126] Fix | Delete
[127] Fix | Delete
foreach( $args as $key => $val ){
[128] Fix | Delete
$ninja_forms_sidebars[$page][$tab][$slug][$key] = $val;
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
function ninja_forms_register_sidebar_option( $slug, $args ){
[134] Fix | Delete
global $ninja_forms_sidebars;
[135] Fix | Delete
[136] Fix | Delete
if( !is_array($ninja_forms_sidebars ) ){
[137] Fix | Delete
$ninja_forms_sidebars = array();
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
$defaults = array(
[141] Fix | Delete
'desc' => '',
[142] Fix | Delete
'display_function' => '',
[143] Fix | Delete
'help' => '',
[144] Fix | Delete
'name' => ''
[145] Fix | Delete
);
[146] Fix | Delete
[147] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[148] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[149] Fix | Delete
[150] Fix | Delete
extract( $args );
[151] Fix | Delete
[152] Fix | Delete
foreach( $args as $key => $val ){
[153] Fix | Delete
$ninja_forms_sidebars[$page][$tab][$sidebar]['settings'][$slug][$key] = $val;
[154] Fix | Delete
}
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
function ninja_forms_register_sidebar_options( $args ){
[158] Fix | Delete
global $ninja_forms_sidebars;
[159] Fix | Delete
[160] Fix | Delete
extract( $args );
[161] Fix | Delete
[162] Fix | Delete
foreach( $args['settings'] as $setting ){
[163] Fix | Delete
[164] Fix | Delete
$defaults = array(
[165] Fix | Delete
'desc' => '',
[166] Fix | Delete
'display_function' => '',
[167] Fix | Delete
'help' => '',
[168] Fix | Delete
'name' => ''
[169] Fix | Delete
);
[170] Fix | Delete
[171] Fix | Delete
$slug = $setting['name'];
[172] Fix | Delete
[173] Fix | Delete
// Parse incomming $setting into an array and merge it with $defaults
[174] Fix | Delete
$setting = wp_parse_args( $setting, $defaults );
[175] Fix | Delete
[176] Fix | Delete
foreach( $setting as $key => $val ){
[177] Fix | Delete
$ninja_forms_sidebars[$page][$tab][$sidebar]['settings'][$slug][$key] = $val;
[178] Fix | Delete
}
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
}
[182] Fix | Delete
[183] Fix | Delete
function ninja_forms_field_edit( $slug ){
[184] Fix | Delete
global $ninja_forms_fields;
[185] Fix | Delete
$function_name = $ninja_forms_fields[$slug]['edit_function'];
[186] Fix | Delete
$arguments = func_get_args();
[187] Fix | Delete
array_shift( $arguments ); // We need to remove the first arg ($function_name)
[188] Fix | Delete
call_user_func_array( $function_name, $arguments );
[189] Fix | Delete
}
[190] Fix | Delete
[191] Fix | Delete
//Screen option registration function
[192] Fix | Delete
function ninja_forms_register_screen_option( $id, $args ){
[193] Fix | Delete
global $ninja_forms_screen_options;
[194] Fix | Delete
[195] Fix | Delete
$defaults = array(
[196] Fix | Delete
'display_function' => '',
[197] Fix | Delete
'order' => '',
[198] Fix | Delete
'page' => '',
[199] Fix | Delete
'save_function' => '',
[200] Fix | Delete
'tab' => '',
[201] Fix | Delete
);
[202] Fix | Delete
[203] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[204] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[205] Fix | Delete
[206] Fix | Delete
extract( $args );
[207] Fix | Delete
[208] Fix | Delete
if($page == '' AND $tab == ''){
[209] Fix | Delete
$ninja_forms_screen_options['_universal_'][$id]['display_function'] = $display_function;
[210] Fix | Delete
$ninja_forms_screen_options['_universal_'][$id]['save_function'] = $save_function;
[211] Fix | Delete
}elseif($page != '' AND $tab == ''){
[212] Fix | Delete
$ninja_forms_screen_options[$page]['_universal_'][$id]['display_function'] = $display_function;
[213] Fix | Delete
$ninja_forms_screen_options[$page]['_universal_'][$id]['save_function'] = $save_function;
[214] Fix | Delete
}elseif($page != '' AND $tab != ''){
[215] Fix | Delete
$ninja_forms_screen_options[$page][$tab][$id]['display_function'] = $display_function;
[216] Fix | Delete
$ninja_forms_screen_options[$page][$tab][$id]['save_function'] = $save_function;
[217] Fix | Delete
}
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
//Help tab registration function
[221] Fix | Delete
function ninja_forms_register_help_screen_tab( $id, $args ){
[222] Fix | Delete
global $ninja_forms_help_screen_tabs;
[223] Fix | Delete
[224] Fix | Delete
$defaults = array(
[225] Fix | Delete
'display_function' => '',
[226] Fix | Delete
'order' => '',
[227] Fix | Delete
'page' => '',
[228] Fix | Delete
'tab' => '',
[229] Fix | Delete
'title' => '',
[230] Fix | Delete
);
[231] Fix | Delete
[232] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[233] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[234] Fix | Delete
[235] Fix | Delete
extract( $args );
[236] Fix | Delete
[237] Fix | Delete
if($page == '' AND $tab == ''){
[238] Fix | Delete
$ninja_forms_help_screen_tabs['_universal_'][$id]['title'] = $title;
[239] Fix | Delete
$ninja_forms_help_screen_tabs['_universal_'][$id]['content'] = $display_function;
[240] Fix | Delete
}elseif($page != '' AND $tab == ''){
[241] Fix | Delete
$ninja_forms_help_screen_tabs[$page]['_universal_'][$id]['title'] = $title;
[242] Fix | Delete
$ninja_forms_help_screen_tabs[$page]['_universal_'][$id]['content'] = $display_function;
[243] Fix | Delete
}elseif($page != '' AND $tab != ''){
[244] Fix | Delete
$ninja_forms_help_screen_tabs[$page][$tab][$id]['title'] = $title;
[245] Fix | Delete
$ninja_forms_help_screen_tabs[$page][$tab][$id]['content'] = $display_function;
[246] Fix | Delete
}
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
//Tab - Metaboxes Registration function
[250] Fix | Delete
function ninja_forms_register_tab_metabox($args = array()){
[251] Fix | Delete
global $ninja_forms_tabs_metaboxes;
[252] Fix | Delete
[253] Fix | Delete
$defaults = array(
[254] Fix | Delete
'display_container' => true,
[255] Fix | Delete
'save_function' => '',
[256] Fix | Delete
'state' => ''
[257] Fix | Delete
);
[258] Fix | Delete
[259] Fix | Delete
// Parse incomming $args into an array and merge it with $defaults
[260] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[261] Fix | Delete
[262] Fix | Delete
extract( $args );
[263] Fix | Delete
[264] Fix | Delete
foreach($args as $key => $val){
[265] Fix | Delete
$ninja_forms_tabs_metaboxes[$page][$tab][$slug][$key] = $val;
[266] Fix | Delete
}
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
//Register Tab Metabox Options
[270] Fix | Delete
function ninja_forms_register_tab_metabox_options( $args = array() ){
[271] Fix | Delete
global $ninja_forms_tabs_metaboxes;
[272] Fix | Delete
[273] Fix | Delete
extract( $args );
[274] Fix | Delete
[275] Fix | Delete
$new_settings = $args['settings'];
[276] Fix | Delete
[277] Fix | Delete
if( isset( $ninja_forms_tabs_metaboxes[$page][$tab][$slug]['settings'] ) ){
[278] Fix | Delete
$settings = $ninja_forms_tabs_metaboxes[$page][$tab][$slug]['settings'];
[279] Fix | Delete
}else{
[280] Fix | Delete
$settings = array();
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
if( is_array( $new_settings ) AND !empty( $new_settings ) ){
[284] Fix | Delete
foreach( $new_settings as $s ){
[285] Fix | Delete
if( is_array( $settings ) ){
[286] Fix | Delete
array_push( $settings, $s );
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
$ninja_forms_tabs_metaboxes[$page][$tab][$slug]['settings'] = $settings;
[292] Fix | Delete
}
[293] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function