ID, 'pbpl-active', true ); $pbpl_select_value = esc_attr( $pbpl_select_value ); ?>
>
ID .'-options-verify', 'wppb_pbpl_save_post_options', false ); } /* * Function that saves the Meta Box option * * @since v.2.0 * */ function wppb_pbpl_save_meta_box_option( $post_id ) { if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; /* Verify our metabox nonce before current_user_can — save_post runs for every * post type and map_meta_cap warns if the CPT is unregistered. */ if( ! isset( $_POST['wppb_pbpl_save_post_options'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['wppb_pbpl_save_post_options'] ), 'wppb-pbpl-post-'. $post_id .'-options-verify' ) ) return; if( ! current_user_can( 'edit_post', $post_id ) ) return; if( isset( $_POST['pbpl-active'] ) && $_POST['pbpl-active'] == 'yes' ) update_post_meta( $post_id, 'pbpl-active', 'yes' ); else delete_post_meta( $post_id, 'pbpl-active' ); } add_action( 'save_post', 'wppb_pbpl_save_meta_box_option' ); /* * Function that activate or deactivate replacement of labels with placeholders in form * * @since v.2.0 * * @param array $form Contain the form args */ function wppb_pbpl_activate( $form ) { $pbpl_pb_moduleSettings = get_option( 'wppb_module_settings', 'not_found' ); if( ( $pbpl_pb_moduleSettings != 'not_found' && isset( $pbpl_pb_moduleSettings['wppb_multipleRegistrationForms'] ) && $pbpl_pb_moduleSettings['wppb_multipleRegistrationForms'] == 'show' ) || ( $pbpl_pb_moduleSettings != 'not_found' && isset( $pbpl_pb_moduleSettings['wppb_multipleEditProfileForms'] ) && $pbpl_pb_moduleSettings['wppb_multipleEditProfileForms'] == 'show' ) ) { if( ! empty( $form['ID'] ) ) { $pbpl_saved_value = get_post_meta( $form['ID'], 'pbpl-active', true ); if( $pbpl_saved_value != 'yes' ) { return; } else { wppb_pbpl_add_filters(); } } else { wppb_pbpl_add_filters(); } } else { wppb_pbpl_add_filters(); } } add_action( 'wppb_form_args_before_output', 'wppb_pbpl_activate' ); /* * Function that adds the necessary filters * * @since v.2.0 * */ function wppb_pbpl_add_filters() { add_filter( 'wppb_field_css_class', 'wppb_pbpl_field_css_class', 10, 1 ); add_filter( 'wppb_blog_details_field_css_class', 'wppb_pbpl_field_css_class', 10, 1 ); add_filter( 'wppb_extra_attribute', 'wppb_pbpl_extra_attribute', 10, 3 ); add_filter( 'wppb_woo_extra_attribute', 'wppb_pbpl_woo_extra_attribute', 10, 2 ); add_filter( 'wppb_extra_select_option', 'wppb_pbpl_extra_select_option', 10, 3 ); add_filter( 'wppb_select2_multiple_arguments', 'wppb_pbpl_select2_multiple_placeholder', 10, 3 ); } /* * Function that adds the necessary filters * * @since v.2.3.4 * */ function wppb_pbpl_extra_select_option( $option, $field, $item_title ) { $option = ''; return $option; } /* * Function that adds placeholder for Select2 Multiple field * * @since v.2.3.4 * */ function wppb_pbpl_select2_multiple_placeholder( $arguments, $form_location, $field ) { $arguments['placeholder'] = esc_attr( wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title'], true ) ) . ( $field['required'] == 'Yes' ? '*' : '' ); return $arguments; } /* * Function that adds placeholder for Recover Password form fields * * @since v.2.3.4 * */ function wppb_pbpl_recover_password( $extra_attr, $input_title, $input_type ) { $extra_attr .= ' placeholder="'. esc_attr( $input_title ) . '" '; return $extra_attr; } add_filter( 'wppb_recover_password_extra_attr', 'wppb_pbpl_recover_password', 10, 3 ); /** * Add necessary class to PMS Billing Fields and replace empty Option for Select Fields (placeholder) * */ function wppb_pms_add_classes ( $fields ) { $forms_settings = get_option( 'wppb_toolbox_forms_settings' ); if ( $forms_settings['placeholder-labels'] == 'yes' ) { foreach ( $fields as $field ) { if ( isset( $field['name'] ) && isset( $field['wrapper_class'] ) ) $fields[$field['name']]['wrapper_class'] .= ' pbpl-class'; if ( isset($field['options']) ) { $fields[$field['name']]['options'][''] = __( 'Select an option', 'profile-builder' ); } } } return $fields; } add_filter('pms_inv_get_invoice_fields', 'wppb_pms_add_classes' ); add_filter('pms_get_tax_extra_fields', 'wppb_pms_add_classes' ); /** * Add Placeholders to PMS Billing Fields * */ function wppb_pbpl_add_pms_fields_placeholder( $form_fields ) { $forms_settings = get_option( 'wppb_toolbox_forms_settings' ); if ( $forms_settings['placeholder-labels'] != 'yes' || !function_exists( 'pms_in_inv_get_invoice_fields' ) ) return $form_fields; $pms_billing_fields = pms_in_inv_get_invoice_fields(); foreach ($pms_billing_fields as $key => $data) { $required = ( isset( $data['required'] ) && $data['required'] == 1 ) ? ' *' : ''; if ( ($data['type'] == 'text' || $data['type'] == 'select_state' ) && strpos( $form_fields,'name="'. $key .'"' ) ) $form_fields = str_replace('name="'. $key .'"', 'name="'. $key .'"" placeholder="'. $data['label'] . $required .'"', $form_fields); } return $form_fields; } add_filter('wppb_output_fields_filter', 'wppb_pbpl_add_pms_fields_placeholder' ); /** * Add Placeholder to Resend Activation Email Form * */ function wppb_pbpl_resend_activation( $extra_attr, $input_title, $input_type ) { $extra_attr .= ' placeholder="'. esc_attr( $input_title ) . '" '; return $extra_attr; } add_filter( 'wppb_resend_activation_extra_attr', 'wppb_pbpl_resend_activation', 10, 3 ); /** * Add Placeholder to Blog Details Fields * */ function wppb_pbpl_blog_details( $placeholder, $field_slug, $label ){ if( $field_slug !== 'default_field_blog_url' && $field_slug !== 'default_field_blog_title' ) return $placeholder; return ' placeholder="'. esc_attr( $label ) . '" '; } add_filter( 'wppb_blog_details_field_placeholder', 'wppb_pbpl_blog_details', 10, 3 ); /** * Add Placeholder Labels classes * */ function wppb_pbpl_add_resend_activation_classes( $classes, $field ) { $forms_settings = get_option( 'wppb_toolbox_forms_settings' ); if ( $forms_settings['placeholder-labels'] == 'yes' ) $classes .= ' pbpl-class'; return $classes; } add_filter( 'wppb_resend_activation_extra_css_class', 'wppb_pbpl_add_resend_activation_classes', 20, 2); add_filter( 'wppb_login_field_extra_css_class', 'wppb_pbpl_add_resend_activation_classes', 20, 2); add_filter( 'wppb_recover_field_extra_css_class', 'wppb_pbpl_add_resend_activation_classes', 20, 2);