Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
email.inc
1 <?php
18 require_once SQ_ATTRIBUTES_PATH.'/text/text.inc';
19 require_once SQ_FUDGE_PATH.'/general/www.inc';
20 
36 {
37 
38 
46  function Asset_Attribute_Email($attributeid=0, $value=null)
47  {
48  $this->Asset_Attribute_Text($attributeid, $value);
49  $this->_params['max_length'] = 0; // can't have a max length for an email address
50 
51  }//end constructor
52 
53 
64  function setEditParams(&$node)
65  {
66  if (!parent::setEditParams($node)) return false;
67  $this->_edit_params['height'] = 1; // can only ever be one line high
68  return true;
69 
70  }//end setEditParams()
71 
72 
81  function process($prefix)
82  {
83  if (!isset($_REQUEST[$prefix])) return false;
84  $value = (string) $_REQUEST[$prefix];
85 
86  if ($this->value !== $value && $this->setValue($value)) {
87  $this->processed = true;
88  } else {
89  $this->processed = false;
90  }
91 
92  }//end process()
93 
94 
102  function validateValue($value)
103  {
104  $value = trim($value);
105  if ($value == '') return true;
106  $new_value = (string)$value;
107  if ($new_value != $value) return false;
108  if (!valid_email($value)) return false;
109  return true;
110 
111  }//end validateValue()
112 
113 
114 }//end class
115 
116 ?>