Redux_Validation_colorrgba

The Gravity Forms Advanced File Uploader Redux Validation colorrgba class.

Defined (1)

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

/inc/ReduxFramework/ReduxCore/inc/validation/colorrgba/validation_colorrgba.php  
  1. class Redux_Validation_colorrgba { 
  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 3.0.4 
  7. */ 
  8. function __construct( $parent, $field, $value, $current ) { 
  9.  
  10. $this->parent = $parent; 
  11. $this->field = $field; 
  12. $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' ); 
  13. $this->value = $value; 
  14. $this->current = $current; 
  15. //$this->validate(); 
  16.  
  17. //function 
  18.  
  19. /** 
  20. * Validate Color to RGBA 
  21. * Takes the user's input color value and returns it only if it's a valid color. 
  22. * @since ReduxFramework 3.0.3 
  23. */ 
  24. function validate_colorrgba( $color ) { 
  25. return $color; 
  26. //$color = $value['color']; 
  27. //$alpha = $value['alpha']; 
  28. $alpha = '1.0'; 
  29. if ( $color == "transparent" ) { 
  30. return $hidden; 
  31.  
  32. /** 
  33. $color = str_replace('#', '', $color); 
  34. if (strlen($color) == 3) { 
  35. $color = $color.$color; 
  36. if (preg_match('/^[a-f0-9]{6}$/i', $color)) { 
  37. $color = '#' . $color; 
  38.   
  39. */ 
  40.  
  41. return array( 'hex' => $color, 'alpha' => $alpha ); 
  42.  
  43. //function 
  44.  
  45. /** 
  46. * Field Render Function. 
  47. * Takes the vars and outputs the HTML for the field in the settings 
  48. * @since ReduxFramework 3.0.0 
  49. */ 
  50. function validate() { 
  51. $this->value = $this->validate_colorrgba( $this->value ); 
  52. /** 
  53. if(is_array($this->value)) { // If array 
  54. foreach($this->value as $k => $value) { 
  55. $this->value[$k] = $this->validate_colorrgba($value); 
  56. }//foreach 
  57. } else { // not array 
  58. $this->value = $this->validate_colorrgba($this->value); 
  59. } // END array check 
  60. */ 
  61.  
  62. //function