Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../deprecat.../includes/display/fields
File: label.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
/**
[1] Fix | Delete
* Outputs the HTML of the field label if it is set to display.
[2] Fix | Delete
* Also outputs the required symbol if it is set.
[3] Fix | Delete
**/
[4] Fix | Delete
[5] Fix | Delete
function ninja_forms_display_field_label( $field_id, $data ){
[6] Fix | Delete
global $ninja_forms_fields, $ninja_forms_loading, $ninja_forms_processing;
[7] Fix | Delete
[8] Fix | Delete
$field = ninja_forms_get_field_by_id( $field_id );
[9] Fix | Delete
$form_id = $field['form_id'];
[10] Fix | Delete
[11] Fix | Delete
$plugin_settings = nf_get_settings();
[12] Fix | Delete
[13] Fix | Delete
if ( isset ( $ninja_forms_loading ) && $ninja_forms_loading->get_form_ID() == $form_id ) {
[14] Fix | Delete
$field_row = $ninja_forms_loading->get_field_settings( $field_id );
[15] Fix | Delete
} else if ( isset ( $ninja_forms_processing ) && $ninja_forms_processing->get_form_ID() == $form_id ) {
[16] Fix | Delete
$field_row = $ninja_forms_processing->get_field_settings( $field_id );
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
$field_type = $field_row['type'];
[20] Fix | Delete
[21] Fix | Delete
if( isset ( $data['label'] ) ) {
[22] Fix | Delete
$label = stripslashes($data['label']);
[23] Fix | Delete
} else if ( isset ( $ninja_forms_fields[$field_type]['default_label'] ) ) {
[24] Fix | Delete
$label = $ninja_forms_fields[$field_type]['default_label'];
[25] Fix | Delete
} else {
[26] Fix | Delete
$label = '';
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if( isset ( $data['label_pos'] ) ) {
[30] Fix | Delete
$label_pos = stripslashes($data['label_pos']);
[31] Fix | Delete
} else {
[32] Fix | Delete
$label_pos = '';
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
if ( isset( $plugin_settings['req_field_symbol'] ) ) {
[36] Fix | Delete
$req_symbol = $plugin_settings['req_field_symbol'];
[37] Fix | Delete
} else {
[38] Fix | Delete
$req_symbol = '';
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
if ( isset ( $data['req'] ) ) {
[42] Fix | Delete
$req = $data['req'];
[43] Fix | Delete
} else {
[44] Fix | Delete
$req = '';
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
if ( isset ( $data['display_label'] ) ) {
[48] Fix | Delete
$display_label = $data['display_label'];
[49] Fix | Delete
} else {
[50] Fix | Delete
$display_label = true;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$label_class = '';
[54] Fix | Delete
[55] Fix | Delete
$label_class = apply_filters( 'ninja_forms_label_class', $label_class, $field_id );
[56] Fix | Delete
[57] Fix | Delete
if ( $display_label ) {
[58] Fix | Delete
if ( $req == 1 && $req_symbol != '' && $label_pos != 'inside' ) {
[59] Fix | Delete
$req_span = "<span class='ninja-forms-req-symbol'>$req_symbol</span>";
[60] Fix | Delete
} else {
[61] Fix | Delete
$req_span = '';
[62] Fix | Delete
}
[63] Fix | Delete
?>
[64] Fix | Delete
<label for="ninja_forms_field_<?php echo $field_id;?>" id="ninja_forms_field_<?php echo $field_id;?>_label" class="<?php echo $label_class;?>"><?php echo $label;?> <?php echo $req_span;?>
[65] Fix | Delete
<?php
[66] Fix | Delete
if ( $label_pos != 'left' ) {
[67] Fix | Delete
do_action( 'ninja_forms_display_field_help', $field_id, $data );
[68] Fix | Delete
}
[69] Fix | Delete
?>
[70] Fix | Delete
</label>
[71] Fix | Delete
<?php
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
add_action('ninja_forms_display_field_label', 'ninja_forms_display_field_label', 10, 2);
[76] Fix | Delete
[77] Fix | Delete
[78] Fix | Delete
[79] Fix | Delete
function ninja_forms_display_label_inside( $data, $field_id ){
[80] Fix | Delete
global $ninja_forms_loading, $ninja_forms_processing;
[81] Fix | Delete
[82] Fix | Delete
if ( isset ( $ninja_forms_loading ) ) {
[83] Fix | Delete
$user_value = $ninja_forms_loading->get_field_value( $field_id );
[84] Fix | Delete
$field_row = $ninja_forms_loading->get_field_settings( $field_id );
[85] Fix | Delete
} else if ( isset ( $ninja_forms_processing ) ) {
[86] Fix | Delete
$user_value = $ninja_forms_processing->get_field_value( $field_id );
[87] Fix | Delete
$field_row = $ninja_forms_processing->get_field_settings( $field_id );
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
if ( isset ( $field_row['type'] ) ) {
[91] Fix | Delete
$field_type = $field_row['type'];
[92] Fix | Delete
} else {
[93] Fix | Delete
$field_type = '';
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
if ( isset( $data['label_pos'] ) ) {
[97] Fix | Delete
$label_pos = $data['label_pos'];
[98] Fix | Delete
} else {
[99] Fix | Delete
$label_pos = '';
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
// Get the required field symbol.
[103] Fix | Delete
$settings = nf_get_settings();
[104] Fix | Delete
if ( isset ( $settings['req_field_symbol'] ) ) {
[105] Fix | Delete
$req_symbol = $settings['req_field_symbol'];
[106] Fix | Delete
} else {
[107] Fix | Delete
$req_symbol = '*';
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
if ( isset ( $data['req'] ) and $data['req'] == 1 and $label_pos == 'inside' and ! isset ( $data['req_added'] ) ) {
[111] Fix | Delete
$data['label'] .= ' '.$req_symbol;
[112] Fix | Delete
$data['req_added'] = 1;
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
if ( isset( $data['label'] ) ) {
[116] Fix | Delete
$label = $data['label'];
[117] Fix | Delete
} else {
[118] Fix | Delete
$label = '';
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
if ( $field_type != '_list' ) {
[122] Fix | Delete
if ( $label_pos == 'inside' ) {
[123] Fix | Delete
$label = strip_tags( $label );
[124] Fix | Delete
[125] Fix | Delete
$data['label'] = $label;
[126] Fix | Delete
if ( isset ( $ninja_forms_loading ) ) {
[127] Fix | Delete
if ( !empty( $user_value ) )
[128] Fix | Delete
return $data;
[129] Fix | Delete
$ninja_forms_loading->update_field_value( $field_id, $label );
[130] Fix | Delete
} else {
[131] Fix | Delete
if ( $ninja_forms_processing->get_field_value( $field_id ) )
[132] Fix | Delete
return $data;
[133] Fix | Delete
$ninja_forms_processing->update_field_value( $field_id, $label );
[134] Fix | Delete
}
[135] Fix | Delete
}
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
return $data;
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
add_filter( 'ninja_forms_field', 'ninja_forms_display_label_inside', 5, 2 );
[142] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function