ReduxFramework_password

The Gravity Forms Advanced File Uploader ReduxFramework password class.

Defined (1)

The class is defined in the following location(s).

/inc/ReduxFramework/ReduxCore/inc/fields/password/field_password.php  
  1. class ReduxFramework_password { 
  2.  
  3. /** 
  4. * Field Constructor. 
  5. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function 
  6. * @since ReduxFramework 1.0.1 
  7. */ 
  8. function __construct( $field = array(), $value = '', $parent ) { 
  9. $this->parent = $parent; 
  10. $this->field = $field; 
  11. $this->value = $value; 
  12.  
  13. /** 
  14. * Field Render Function. 
  15. * Takes the vars and outputs the HTML for the field in the settings 
  16. * @since ReduxFramework 1.0.1 
  17. */ 
  18. function render() { 
  19. if ( ! empty( $this->field['username'] ) && $this->field['username'] === true ) { 
  20. $this->_render_combined_field(); 
  21. } else { 
  22. $this->_render_single_field(); 
  23.  
  24. /** 
  25. * This will render a combined User/Password field 
  26. * @since ReduxFramework 3.0.9 
  27. * @example 
  28. * <code> 
  29. * array( 
  30. * 'id' => 'smtp_account',  
  31. * 'type' => 'password',  
  32. * 'username' => true,  
  33. * 'title' => 'SMTP Account',  
  34. * 'placeholder' => array('username' => 'Username') 
  35. * ) 
  36. * </code> 
  37. */ 
  38. private function _render_combined_field() { 
  39.  
  40. $defaults = array( 
  41. 'username' => '',  
  42. 'password' => '',  
  43. 'placeholder' => array( 
  44. 'password' => __( 'Password', 'redux-framework' ),  
  45. 'username' => __( 'Username', 'redux-framework' ) 
  46. ); 
  47.  
  48. $this->value = wp_parse_args( $this->value, $defaults ); 
  49.  
  50. if ( ! empty( $this->field['placeholder'] ) ) { 
  51. if ( is_array( $this->field['placeholder'] ) ) { 
  52. if ( ! empty( $this->field['placeholder']['password'] ) ) { 
  53. $this->value['placeholder']['password'] = $this->field['placeholder']['password']; 
  54. if ( ! empty( $this->field['placeholder']['username'] ) ) { 
  55. $this->value['placeholder']['username'] = $this->field['placeholder']['username']; 
  56. } else { 
  57. $this->value['placeholder']['password'] = $this->field['placeholder']; 
  58.  
  59. // Username field 
  60. echo '<input type="text" autocomplete="off" placeholder="' . $this->value['placeholder']['username'] . '" id="' . $this->field['id'] . '[username]" name="' . $this->field['name'] . $this->field['name_suffix'] . '[username]' . '" value="' . esc_attr( $this->value['username'] ) . '" class="' . $this->field['class'] . '" /> '; 
  61.  
  62. // Password field 
  63. echo '<input type="password" autocomplete="off" placeholder="' . $this->value['placeholder']['password'] . '" id="' . $this->field['id'] . '[password]" name="' . $this->field['name'] . $this->field['name_suffix'] . '[password]' . '" value="' . esc_attr( $this->value['password'] ) . '" class="' . $this->field['class'] . '" />'; 
  64.  
  65. /** 
  66. * This will render a single Password field 
  67. * @since ReduxFramework 3.0.9 
  68. * @example 
  69. * <code> 
  70. * array( 
  71. * 'id' => 'smtp_password',  
  72. * 'type' => 'password',  
  73. * 'title' => 'SMTP Password' 
  74. * ) 
  75. * </code> 
  76. */ 
  77. private function _render_single_field() { 
  78. echo '<input type="password" id="' . $this->field['id'] . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" value="' . esc_attr( $this->value ) . '" class="' . $this->field['class'] . '" />';