library/core/class.pluginmanager.php
public function GetPluginInstance($AccessName, $AccessType = self::ACCESS_CLASSNAME, $Sender = NULL) {
      $ClassName = NULL;
      switch ($AccessType) {
         case self::ACCESS_PLUGINNAME:
            $ClassName = GetValue('ClassName', $this->GetPluginInfo($AccessName), FALSE);
         break;

         case self::ACCESS_CLASSNAME:
         default:
            $ClassName = $AccessName;
         break;
      }

      if (!class_exists($ClassName))
         throw new Exception("Tried to load plugin '{$ClassName}' from access name '{$AccessName}:{$AccessType}', but it doesn't exist.");

      if (!array_key_exists($ClassName, $this->Instances)) {
         $this->Instances[$ClassName] = (is_null($Sender)) ? new $ClassName() : new $ClassName($Sender);
         $this->Instances[$ClassName]->PluginInfo = $this->GetPluginInfo($AccessName, $AccessType);
      }

      return $this->Instances[$ClassName];
   }
public function GetPluginInstance($AccessName, $AccessType = self::ACCESS_CLASSNAME, $Sender = NULL) {
      $ClassName = NULL;
      switch ($AccessType) {
         case self::ACCESS_PLUGINNAME:
            $ClassName = GetValue('ClassName', $this->GetPluginInfo($AccessName), FALSE);
         break;

         case self::ACCESS_CLASSNAME:
         default:
            $ClassName = $AccessName;
         break;
      }

      if (!class_exists($ClassName))
         throw new Exception("Tried to load plugin '{$ClassName}' from access name '{$AccessName}:{$AccessType}', but it doesn't exist.");

      if (!array_key_exists($ClassName, $this->Instances)) {
         $this->Instances[$ClassName] = (is_null($Sender)) ? new $ClassName() : new $ClassName($Sender);
         $this->Instances[$ClassName]->PluginInfo = $this->GetPluginInfo($AccessName, $AccessType);
      }

      return $this->Instances[$ClassName];
   }
public function GetPluginInstance ( $ AccessName , $ AccessType = self :: ACCESS_CLASSNAME , $ Sender = NULL ) { $ ClassName = NULL ; switch ( $ AccessType ) { case self :: ACCESS_PLUGINNAME : $ ClassName = GetValue ( 'ClassName' , $ this -> GetPluginInfo ( $ AccessName ) , FALSE ) ; break ; case self :: ACCESS_CLASSNAME : default : $ ClassName = $ AccessName ; break ; } if ( ! class_exists ( $ ClassName ) ) throw new Exception ( "Tried to load plugin '{$ClassName}' from access name '{$AccessName}:{$AccessType}', but it doesn't exist." ) ; if ( ! array_key_exists ( $ ClassName , $ this -> Instances ) ) { $ this -> Instances [ $ ClassName ] = ( is_null ( $ Sender ) ) ? new $ ClassName ( ) : new $ ClassName ( $ Sender ) ; $ this -> Instances [ $ ClassName ] -> PluginInfo = $ this -> GetPluginInfo ( $ AccessName , $ AccessType ) ; } return $ this -> Instances [ $ ClassName ] ; }
Gets an instance of a given plugin.

@param string $AccessName The key of the plugin.
@param string $AccessType The type of key for the plugin which must be one of the following:
- Gdn_PluginManager::ACCESS_PLUGINNAME
- Gdn_PluginManager::ACCESS_CLASSNAME
@param mixed $Sender An object to pass to a new plugin instantiation.
@return Gdn_IPlugin The plugin instance.
Gets an instance of a given plugin .