Source for file class.modrewritebase.php

Documentation is available at class.modrewritebase.php

  1. <?php
  2. /**
  3.  * Includes base mod rewrite class.
  4.  *
  5.  * @author      Murat Purc <murat@purc.de>
  6.  * @date        24.09.2008
  7.  * @package     Contenido
  8.  * @subpackage  ModRewrite
  9.  */
  10.  
  11.  
  12. if(!defined('CON_FRAMEWORK')) {
  13.     die('Illegal call');
  14. }
  15.  
  16.  
  17. /**
  18.  * Abstract base mod rewrite class.
  19.  *
  20.  * Provides some common features such as common debugging, globals/configuration
  21.  * access for childs.
  22.  *
  23.  * @author      Murat Purc <murat@purc.de>
  24.  * @date        24.09.2008
  25.  * @package     Contenido
  26.  * @subpackage  ModRewrite
  27.  */
  28. abstract class ModRewriteBase {
  29.  
  30.     /**
  31.      * Debugger instance
  32.      *
  33.      * @var  Contenido_mpDebug 
  34.      */
  35.     protected static $_oDebug;
  36.  
  37.     /**
  38.      * Globals instance
  39.      *
  40.      * @var mpGlobals 
  41.      */
  42.     protected static $_oGlobals;
  43.  
  44.  
  45.     /**
  46.      * Initialization, is to call at least once by an child.
  47.      */
  48.     protected static function initialize({
  49.         self::$_oDebug   Contenido_mpDebug::getInstance();
  50.         self::$_oGlobals mpGlobals::getInstance();
  51.     }
  52.  
  53.  
  54.     /**
  55.      * Returns enabled state of mod rewrite plugin
  56.      *
  57.      * @return  bool 
  58.      */
  59.     public static function isEnabled(){
  60.         return (self::getConfig('use'0== 1true false;
  61.     }
  62.  
  63.  
  64.     /**
  65.      * Returns configuration of mod rewrite, content of gobal $cfg['mod_rewrite']
  66.      *
  67.      * @param   string  $key  Name of configuration key
  68.      * @return  mixed   Desired value mr configuration, either the full configuration
  69.      *                   or one of the desired subpart
  70.      */
  71.     public static function getConfig($key=null$default=null{
  72.         $aCfg self::$_oGlobals->get('cfg/mod_rewrite');
  73.         if ($key == null{
  74.             return $aCfg;
  75.         elseif ((string) $key !== ''{
  76.             return (isset($aCfg[$key])) $aCfg[$key$default;
  77.         else {
  78.             return $default;
  79.         }
  80.     }
  81.  
  82. }

Documentation generated on Tue, 25 Nov 2008 22:07:22 +0100 by phpDocumentor 1.4.1