[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/net/linkparser.class.php" ); 4 5 6 /** 7 * \ingroup Net 8 * 9 * Identifies the right kind of url, based on the format of our links. This class is only taken 10 * into use when custom urls are enabled, and it basically loops through all provided regular expressions 11 * and a given HTTP request to check which one of them is the matching one. The matching engine (converting 12 * from *_link_format format to a valid regexp) is provided by the LinkParser class. 13 * 14 * Once ready, it will call the LinkFormatMatcher::getParameters() to retrieve the right parameters 15 * for the request (the core does not understand this kind of requests, and this class acts as some sort 16 * of a filter that parses an incoming nicer link, gets the information based on a regexp and puts it back to 17 * the request in a more "normal" format) 18 * 19 * Users or plugin developers should never need to use this class directly. 20 * 21 * @see LinkParser 22 */ 23 class LinkFormatMatcher 24 { 25 26 var $_request; 27 var $_formats; 28 var $_params; 29 30 /** 31 * @param request 32 * @param formats 33 */ 34 function LinkFormatMatcher( $request, $formats ) 35 { 36 $this->_request = $request; 37 $this->_formats = $formats; 38 } 39 40 /** 41 * @return 42 */ 43 function identify() 44 { 45 foreach( $this->_formats as $key => $format ) { 46 $lp = new LinkParser( $format ); 47 $params = $lp->parseLink( $this->_request ); 48 if( $params ) { 49 // return the key assigned to the format that matched 50 $this->_params = $params; 51 return $key; 52 } 53 } 54 } 55 56 function getParameters() 57 { 58 return $this->_params; 59 } 60 } 61 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |