src/Web2All/Manager/Main.class.php
public function initClass($classname,$arguments=array(),$isplugin=true) 
  {
    // when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname);
    // we cannot use self::loadClass($classname); because it will break extending Main classes which
    // redefine the loadClass method. (we need late static binding)
    /*
     * If class cannot be found, include corresponding file
     */
    $this->loadClass($classname);
    
    /*
     * If $classname still doesn't exists, the class cannot be started
     */
    if (!class_exists($classname)) {
      throw new Exception("Class whith name '$classname' does not exists. Cannot initialise $classname",E_USER_ERROR);
    }
    
    /*
     * Start class and return object
     */
    $reflectionObj = new ReflectionClass($classname);
    if($reflectionObj->isSubclassOf('Web2All_Manager_Plugin') || $isplugin){
      // directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object
      // as first constructor param. Or the $isplugin is set true so force first param to
      // Web2All_Manager_Main object.
      array_unshift($arguments,$this);
    }elseif($reflectionObj->implementsInterface('Web2All_Manager_PluginInterface')){
      // class does not extend Web2All_Manager_Plugin, but the class still implements 
      // the Web2All_Manager_PluginInterface so we can call the setWeb2All method to 
      // init the object after construction.
      $obj=call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments);
      $obj->setWeb2All($this);
      return $obj;
    }
    return call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments);
  }
public function initClass($classname,$arguments=array(),$isplugin=true) 
  {
    // when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname);
    // we cannot use self::loadClass($classname); because it will break extending Main classes which
    // redefine the loadClass method. (we need late static binding)
    /*
     * If class cannot be found, include corresponding file
     */
    $this->loadClass($classname);
    
    /*
     * If $classname still doesn't exists, the class cannot be started
     */
    if (!class_exists($classname)) {
      throw new Exception("Class whith name '$classname' does not exists. Cannot initialise $classname",E_USER_ERROR);
    }
    
    /*
     * Start class and return object
     */
    $reflectionObj = new ReflectionClass($classname);
    if($reflectionObj->isSubclassOf('Web2All_Manager_Plugin') || $isplugin){
      // directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object
      // as first constructor param. Or the $isplugin is set true so force first param to
      // Web2All_Manager_Main object.
      array_unshift($arguments,$this);
    }elseif($reflectionObj->implementsInterface('Web2All_Manager_PluginInterface')){
      // class does not extend Web2All_Manager_Plugin, but the class still implements 
      // the Web2All_Manager_PluginInterface so we can call the setWeb2All method to 
      // init the object after construction.
      $obj=call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments);
      $obj->setWeb2All($this);
      return $obj;
    }
    return call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments);
  }
public function initClass ( $ classname , $ arguments = array ( ) , $ isplugin = true ) { // when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname);
 // we cannot use self::loadClass($classname); because it will break extending Main classes which
 // redefine the loadClass method. (we need late static binding)
 /*
     * If class cannot be found, include corresponding file
     */ $ this -> loadClass ( $ classname ) ; /*
     * If $classname still doesn't exists, the class cannot be started
     */ if ( ! class_exists ( $ classname ) ) { throw new Exception ( "Class whith name '$classname' does not exists. Cannot initialise $classname" , E_USER_ERROR ) ; } /*
     * Start class and return object
     */ $ reflectionObj = new ReflectionClass ( $ classname ) ; if ( $ reflectionObj -> isSubclassOf ( 'Web2All_Manager_Plugin' ) || $ isplugin ) { // directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object
 // as first constructor param. Or the $isplugin is set true so force first param to
 // Web2All_Manager_Main object.
 array_unshift ( $ arguments , $ this ) ; } elseif ( $ reflectionObj -> implementsInterface ( 'Web2All_Manager_PluginInterface' ) ) { // class does not extend Web2All_Manager_Plugin, but the class still implements 
 // the Web2All_Manager_PluginInterface so we can call the setWeb2All method to 
 // init the object after construction.
 $ obj = call_user_func_array ( array ( & $ reflectionObj , 'newInstance' ) , $ arguments ) ; $ obj -> setWeb2All ( $ this ) ; return $ obj ; } return call_user_func_array ( array ( & $ reflectionObj , 'newInstance' ) , $ arguments ) ; }
Initialize Web2All_Manager_Plugin
returns Web2All_Manager_Plugin object

@param string $classname
@param array $arguments
@param boolean $isplugin  Force the first constructor param to be the
Web2All_Manager_Main object. Set false for
automatically detection if this is required.
@return object
Initialize Web2All_Manager_Plugin returns Web2All_Manager_Plugin object