Public paste
Undefined
By: Guest | Date: Mar 27 2010 08:15 | Format: PHP | Expires: never | Size: 5.55 KB | Hits: 883

  1. Strict Standards: Only variables should be assigned by reference in ... on line 40
  2.         >> private function __construct()
  3.         >> ...
  4.         >>      self::$CONSTRUCTEUR =& ILLI_Constructeur::init($this);
  5.  
  6. Strict Standards: Only variables should be assigned by reference in ... on line 59
  7.         >> public static function init()
  8.         >> ...
  9.         >>      self::$SELF =& new self;
  10.  
  11.  
  12. <?PHP
  13.         FINAL CLASS ILLI
  14.         {
  15.        
  16.                 private static $SELF         = NULL;
  17.                 private static $CONSTRUCTEUR = NULL;
  18.                
  19.                 private function __clone(){}
  20.                
  21.                 private function __construct()
  22.                 {
  23.                         self::$CONSTRUCTEUR =& ILLI_Constructeur::init($this);
  24.                 }
  25.                
  26.                 public static function init()
  27.                 {
  28.                         set_include_path
  29.                         (
  30.                                 implode
  31.                                 (
  32.                                         PATH_SEPARATOR,
  33.                                         array
  34.                                         (
  35.                                             realpath(dirname(__FILE__).'/VENDOR'),
  36.                                             get_include_path()
  37.                                         )
  38.                                 )
  39.                         );
  40.                        
  41.                         if(is_null(self::$SELF))
  42.                                 self::$SELF =& new self;
  43.                                
  44.                         return self::$SELF;
  45.                 }
  46.                
  47.                 public function run()
  48.                 {
  49.                         self::$CONSTRUCTEUR->run($this);
  50.                 }
  51.                
  52.                 public function get_Constructeur()
  53.                 {
  54.                         return self::$CONSTRUCTEUR;
  55.                 }
  56.                
  57.         }
  58.  
  59. ?>
  60.  
  61.  
  62. Strict Standards: Assigning the return value of new by reference is deprecated in ... on line 115
  63.         >> public static function init(ILLI $ILLI)
  64.         >> ...
  65.         >> if(NULL === self::$SELF)
  66.         >>      self::$SELF =& new self;
  67.  
  68. <?PHP
  69.         FINAL CLASS ILLI_Constructeur
  70.         {
  71.                 private static $Instances     = NULL;
  72.                 private static $SELF          = NULL;
  73.                 private static $initialized   = FALSE;
  74.                 private static $executed      = FALSE;
  75.                
  76.                 private static $applicationProfile        = '';
  77.  
  78.                 private function __construct()
  79.                 {      
  80.                         self::$Instances = new ILLI_Container;
  81.                        
  82.                         self::set_Instance(new ILLI_Container_Configuration)
  83.                        
  84.                                 // register the accepted offset-types for all settings
  85.                        
  86.                                 // name of application
  87.                                 // this allows you to use a single-installation of ILLI for several apps; default is localhost
  88.                                 -> set_Rule('string','APPLICATION_PROFILE')
  89.                                
  90.                                 // min/max-php-version
  91.                                 -> set_Rule('string','PHP_MIN_VERSION', array('5.2'))
  92.                                 -> set_Rule('string','PHP_MAX_VERSION', array('6'))
  93.                                
  94.                                 // php-ini
  95.                                 -> set_Rule('array', 'PHP_INI')
  96.                                
  97.                                 // aparse incoming get-vars
  98.                                 // todo: move that into routing
  99.                                 -> set_Rule('array', 'CLEANVARS_GET')
  100.                                 // accepted vars, but hide for parsing
  101.                                 -> set_Rule('array', 'CLEANVARS_GET_IGNORE')
  102.                                 // allow ILLI to kill all unregistred vars
  103.                                 -> set_Rule('bool',  'CLEANVARS_GET_DISCARD_UNREGISTERED')
  104.                                 // allow only incoming get if client accept session-cookie
  105.                                 -> set_Rule('bool',  'CLEANVARS_GET_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')
  106.                                
  107.                                 // aparse incoming post-vars
  108.                                 // todo: move that into routing
  109.                                 -> set_Rule('array', 'CLEANVARS_POST')
  110.                                 // accepted vars, but hide for parsing
  111.                                 -> set_Rule('array', 'CLEANVARS_POST_IGNORE')
  112.                                 // allow ILLI to kill all unregistred vars
  113.                                 -> set_Rule('bool',  'CLEANVARS_POST_DISCARD_UNREGISTERED')
  114.                                 // allow only incoming post if client accept session-cookie
  115.                                 -> set_Rule('bool',  'CLEANVARS_POST_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')
  116.                                
  117.                                 // env-mode-tolerance; defaults are PRODUCTION and DEVELOPMENT
  118.                                 -> set_Rule('string','ENVIRONMENT_MODE', array('PRODUCTION','DEVELOPMENT'))
  119.                                
  120.                                 // url-deep-path; for root set = '/'
  121.                                 -> set_Rule('string','BASE_DEVELOPMENT')
  122.                                 -> set_Rule('string','BASE_PRODUCTION')
  123.                                
  124.                                 // select layout-dir for view
  125.                                 -> set_Rule('string','LAYOUT')
  126.                                
  127.                                 // show errors and exception only for defined i.p.
  128.                                 -> set_Rule('array', 'DEVELOPMENT_IP')
  129.                                
  130.                                 // will redirect all requests to self-repaired, clean uri
  131.                                 -> set_Rule('bool',  'FORWARD_TO_REPAIRED_URI')
  132.                                
  133.                                 // page-encoding; this is global for pageoutput and form-accepted-charset
  134.                                 -> set_Rule('string','ENCODING')
  135.                                
  136.                                 // set cache timeouts for filetypes
  137.                                 // @to0do: move that value into routing-table
  138.                                 -> set_Rule('array', 'CLIENT_CACHE_CONTROL_MAX_AGE')
  139.                                 -> set_Rule('array', 'CLIENT_CACHE_PRAGMA_CACHE');
  140.                 }
  141.                
  142.                
  143.                 public static function get_Instance($name)
  144.                 {
  145.                         if(!isset(self::$Instances->{'_'.$name}))
  146.                                 self::set_Instance(new $name);
  147.                                        
  148.                         return self::$Instances->{'_'.$name};
  149.                 }
  150.                
  151.                
  152.                 public static function set_Instance(ILLI_Container_Interface $instance)
  153.                 {
  154.                         try
  155.                         {
  156.                                 if(isset(self::$Instances->{'_'.get_class($instance)}))
  157.                                         throw new Exception
  158.                                                 (get_class($instance).' already initialized.');
  159.                         }
  160.                         catch(ILLI_Constructeur_Exception $e){$e->w();}
  161.                                                
  162.                         self::$Instances->{'_'.get_class($instance)} = $instance;                      
  163.                         return self::get_Instance(get_class($instance));
  164.                 }
  165.                
  166.                 /**
  167.                  * init Constructeur and ILLI-Instances
  168.                  *
  169.                  *
  170.                  */
  171.                 public static function init(ILLI $ILLI)
  172.                 {
  173.                         try
  174.                         {
  175.                                 if(FALSE === self::$initialized)
  176.                                         self::$initialized = TRUE;
  177.                                 else throw new ILLI_Constructeur_Exception
  178.                                         ('ILLI already initialized..');
  179.  
  180.                                 if(NULL === self::$SELF)
  181.                                         self::$SELF =& new self;
  182.                                        
  183.                                 //self::$SELF->setup();
  184.  
  185.                                 return self::$SELF;
  186.                         }
  187.                         catch(ILLI_Constructeur_Exception $e){$e->w();}
  188.                 }
  189.                
  190.                 /**
  191.                  * execute Constructeur and ILLI-Instances
  192.                  *
  193.                  *
  194.                  */
  195.                 public function run(ILLI $ILLI)
  196.                 {
  197.                         try
  198.                         {
  199.                                 if(FALSE === self::$initialized)
  200.                                         throw new ILLI_Constructeur_Exception
  201.                                                 ('ILLI not initialized..');
  202.  
  203.                                 if(FALSE === self::$executed)
  204.                                         self::$executed = TRUE;
  205.                                 else throw new ILLI_Constructeur_Exception
  206.                                         ('Can not execute ILLI again.');
  207.                         }
  208.                         catch(ILLI_Constructeur_Exception $e){$e->w();}
  209.  
  210.                         return self::$SELF;
  211.                 }
  212.         }