Mailinglist
 All Data Structures Files Functions Variables Pages
Public Member Functions | Private Member Functions | Private Attributes
MailinglistHeader Class Reference

class MailinglistHeader More...

Public Member Functions

 __construct ($str)
 __construct() More...
 
 get_atom ()
 get_atom() More...
 
 get_dot_atom ()
 get_dot_atom() More...
 
 get_token ()
 get_token() More...
 
 get_value ()
 get_value() More...
 
 skip_ws ()
 Skip White Space. More...
 
 skip_cws ()
 Skip Comments or whitespace. More...
 
 skip_comment ()
 Skip Comment. More...
 
 get_char ()
 get_char() More...
 
 push_back ($char)
 push_back() More...
 

Private Member Functions

 get_chunk ($chars)
 get_chunk() More...
 

Private Attributes

 $header
 The header being processed. More...
 

Detailed Description

class MailinglistHeader

a helper class for parsing EMail Headers

todo update nameing conventions.

Definition at line 113 of file MailinglistMessage.class.php.

Constructor & Destructor Documentation

__construct (   $str)

__construct()

Parameters
$strString with value of header to process

Definition at line 121 of file MailinglistMessage.class.php.

121  {
122  $this->header = $str;
123  }

Member Function Documentation

get_atom ( )

get_atom()

Get an atom.

Definition at line 130 of file MailinglistMessage.class.php.

References get_chunk(), mailinglist_message_rfc2047(), and skip_ws().

Referenced by get_dot_atom().

130  {
131  static $atext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'*+-/=?^_`{}|~";
132  $this->skip_ws();
133  $str = $this->get_chunk($atext);
134  $str = mailinglist_message_rfc2047($str);
135  return $str;
136  }
mailinglist_message_rfc2047($string)
mailinglist_message_rfc2047()
skip_ws()
Skip White Space.
get_chunk($chars)
get_chunk()

Here is the call graph for this function:

Here is the caller graph for this function:

get_char ( )

get_char()

Get a character from the header being processed

Definition at line 244 of file MailinglistMessage.class.php.

Referenced by get_chunk(), get_dot_atom(), get_value(), skip_comment(), and skip_cws().

244  {
245  if (!empty($this->header)) {
246  $char = $this->header[0];
247  $this->header = substr($this->header, 1);
248  return $char;
249  }
250  else {
251  return FALSE;
252  }
253  }

Here is the caller graph for this function:

get_chunk (   $chars)
private

get_chunk()

get a chunck of characters belonging to a class

Definition at line 189 of file MailinglistMessage.class.php.

References get_char().

Referenced by get_atom(), and get_token().

189  {
190  $token = "";
191  while (!empty($this->header) && strpos($chars, $this->header[0]) !== FALSE) {
192  $token .= $this->get_char();
193  }
194  return $token;
195  }

Here is the call graph for this function:

Here is the caller graph for this function:

get_dot_atom ( )

get_dot_atom()

get a dotted atom.

Definition at line 143 of file MailinglistMessage.class.php.

References get_atom(), and get_char().

143  {
144  $atom = $this->get_atom();
145  while ($this->header[0] == '.') {
146  $atom += $this->get_char();
147  $atom += $this->get_atom();
148  }
149  return $atom;
150  }

Here is the call graph for this function:

get_token ( )

get_token()

Definition at line 156 of file MailinglistMessage.class.php.

References get_chunk(), and skip_ws().

Referenced by get_value().

156  {
157  static $ttext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'*+-^_`{}|~.";
158  $this->skip_ws();
159  return $this->get_chunk($ttext);
160  }
skip_ws()
Skip White Space.
get_chunk($chars)
get_chunk()

Here is the call graph for this function:

Here is the caller graph for this function:

get_value ( )

get_value()

Get a value ( token / qstring )

Definition at line 166 of file MailinglistMessage.class.php.

References get_char(), get_token(), and skip_ws().

166  {
167  $this->skip_ws();
168  if ($this->header[0] == '"') {
169  $token = "";
170  $this->get_char();
171  while (($char = $this->get_char()) != '"' && $char !== FALSE) {
172  if ($char == '\\') {
173  $char = $this->get_char();
174  }
175  $token .= $char;
176  }
177  return $token;
178  }
179  else{
180  return $this->get_token();
181  }
182  }
skip_ws()
Skip White Space.

Here is the call graph for this function:

push_back (   $char)

push_back()

push a character/string back into header

Definition at line 259 of file MailinglistMessage.class.php.

References $header.

259  {
260  $this->header = $char . $this->header;
261  }
$header
The header being processed.
skip_comment ( )

Skip Comment.

Assumes the leading ( has already been removed by production calling us.

Production Name: comment

Definition at line 228 of file MailinglistMessage.class.php.

References get_char().

Referenced by skip_cws().

228  {
229  while (($char = $this->get_char()) != ')') {
230  if ($char == '\\') {
231  $this->get_char(); // Quoted char, so ignore the next
232  }
233  elseif ($char == '(') {
234  $this->skip_comment(); // Nested comment
235  }
236  }
237  }

Here is the call graph for this function:

Here is the caller graph for this function:

skip_cws ( )

Skip Comments or whitespace.

Production name: CFWS

Definition at line 212 of file MailinglistMessage.class.php.

References get_char(), and skip_comment().

212  {
213  while (ctype_space($char = $this->header[0]) || $char == '(') {
214  $this->get_char();
215  if ($char == '(') {
216  $this->skip_comment();
217  }
218  }
219  }

Here is the call graph for this function:

skip_ws ( )

Skip White Space.

Production Name: FWS, *WSP

Definition at line 201 of file MailinglistMessage.class.php.

Referenced by get_atom(), get_token(), and get_value().

201  {
202  while (ctype_space($this->header[0])) {
203  $this->header = substr($this->header, 1);
204  }
205  }

Here is the caller graph for this function:

Field Documentation

$header
private

The header being processed.

Definition at line 114 of file MailinglistMessage.class.php.

Referenced by push_back().


The documentation for this class was generated from the following file: