/**
  Load single plugin.
  
  @param[in] $compiler @ref TemplateCompilerEx instance
  @param[in] $node Optional @ref TemplateNodeEx instance
  @param[in] $plugin Plugin name
  @param[in] $pluginFile Plugin's full filename (optional)
  @param[in] $noThrow If @c true, no exception will be thrown on error (boolean @c false will be returned)
  @retval true Plugin has been loaded
  @retval false Plugin is invalid/non-existant
 */
 public function load(TemplateCompilerEx $compiler, $node, $plugin, $pluginFile = null, $noThrow = false)
 {
     // if already loaded, then abort
     if (isset($this->plugins[$plugin])) {
         return;
     }
     // sanity check
     TemplateUtils::checkIfAllowed($compiler, 'plugin', $plugin, $node);
     if (!$pluginFile) {
         $pluginFile = $this->findPlugin($plugin);
     }
     $className = 'Template' . $plugin . 'Plugin';
     if ($pluginFile === false || !(include_once $pluginFile) || !class_exists($className) || !TemplateUtils::doesImplement($className, 'ITemplatePlugin')) {
         if ($noThrow) {
             return false;
         }
         throw new TemplateError('Could not load plugin: "' . $plugin . '". Either file or main class does not exists, or is invalid', TemplateError::E_INVALID_PLUGIN);
     }
     // create instance and register handlers
     $pluginObj = new $className();
     $handlers = $pluginObj->providedHandlers();
     if (!isset($handlers['tags'])) {
         $handlers['tags'] = array();
     }
     if (!isset($handlers['filters'])) {
         $handlers['filters'] = array();
     }
     if (!isset($handlers['hooks'])) {
         $handlers['hooks'] = array();
     }
     $this->register($plugin, $pluginObj, 'tag', $handlers['tags']);
     $this->register($plugin, $pluginObj, 'filter', $handlers['filters']);
     // too special case after all
     $this->registerHooks($plugin, $pluginObj, $handlers['hooks']);
     $this->plugins[$plugin] = $pluginObj;
 }
 /**
  Tests the behaviour of @ref TemplateUtils::doesImplement.
 */
 public function testUtilsDoesImpl()
 {
     $this->assertTrue(TemplateUtils::doesImplement('ReflectionClass', 'Reflector'));
     $this->assertTrue(TemplateUtils::doesImplement(new ReflectionClass('stdClass'), 'Reflector'));
 }