Loading Please wait...

rewriteMapParser Class Reference
[Parser.Application Module.]

Rewrite Map Parser. More...

Inheritance diagram for rewriteMapParser:

Inheritance graph
[legend]
Collaboration diagram for rewriteMapParser:

Collaboration graph
[legend]

Public Member Functions

 parse ($filePath)
 match ($filePath, $fakePath)
 currentUrlPath ()
 matchCurrentUrlPath ($filePath)
 explode ($realPathStr)

Detailed Description

Rewrite Map Parser.

Definition at line 27 of file prs_rewrite.php.


Member Function Documentation

rewriteMapParser::parse ( filePath  ) 

Definition at line 28 of file prs_rewrite.php.

References $filePath, and perror().

Referenced by match().

00028                            {
00029     if(!file_exists($filePath)){
00030       perror('<code>zigmoyd.mvc.rewrite.parser</code><br />Failed to Parse '.$filePath.' as it doesn\t exist');
00031       return false;
00032     }
00033     if(!is_readable($filePath)){
00034       perror('<code>zigmoyd.mvc.rewrite.parser</code><br />Failed to Parse '.$filePath.' as its not readable');
00035       return false;
00036     }
00037     $content=file($filePath);
00038     foreach($content as $i => $line){
00039       if(!preg_match('~(.+)\s*\->\s*(.+)~', $line, $m)){
00040         perror('<code>zigmoyd.mvc.rewrite.parser</code><br />Failed to Parse '.$filePath.' unexpected format near line '.($i+1));
00041         return false;
00042       }else{
00043         $content[$i] = array('fake' => trim($m[1]), 'original' => trim($m[2]));
00044       }
00045     }
00046     return $content;
00047   }

Here is the call graph for this function:

rewriteMapParser::match ( filePath,
fakePath 
)

Definition at line 48 of file prs_rewrite.php.

References $filePath, and parse().

Referenced by matchCurrentUrlPath().

00048                                       {
00049     foreach(rewriteMapParser::parse($filePath) as $rule){
00050       if(preg_match('$'.trim(trim($rule['fake']), '/').'$',trim(trim($fakePath), '/'))){
00051         return trim(preg_replace('$'.trim(trim($rule['fake']), '/').'$', $rule['original'], trim(trim($fakePath), '/')), '/');
00052       }
00053     }
00054     return false;
00055   }

Here is the call graph for this function:

rewriteMapParser::currentUrlPath (  ) 

Definition at line 56 of file prs_rewrite.php.

References url_segment().

Referenced by matchCurrentUrlPath().

00056                            {
00057     return implode('/', url_segment(ZIG_URL_SEGMENT_PATH));
00058   }

Here is the call graph for this function:

rewriteMapParser::matchCurrentUrlPath ( filePath  ) 

Definition at line 59 of file prs_rewrite.php.

References $filePath, currentUrlPath(), and match().

Here is the call graph for this function:

rewriteMapParser::explode ( realPathStr  ) 

Definition at line 62 of file prs_rewrite.php.

References perror().

00062                                 {
00063     $explodedRealPath = explode('/', trim($realPathStr, '/'));
00064     if(!isset($explodedRealPath[0]))perror("<code>zigmoyd.mvc.rewrite.parser</code><br />Unexpected format of real path (Controller not Found)");
00065     if(!isset($explodedRealPath[1]))perror("<code>zigmoyd.mvc.rewrite.parser</code><br />Unexpected format of real path (Method Name not Found)");
00066     $ret = array($explodedRealPath[0], $explodedRealPath[1]);
00067     unset($explodedRealPath[0]);
00068     unset($explodedRealPath[1]);
00069     $args = array_values($explodedRealPath);
00070     return array($ret, $args);
00071   }

Here is the call graph for this function:


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

Generated on Mon Oct 27 23:53:11 2008 for zigmoyd.kdevelop by doxygen 1.5.6