src/Gelembjuk/Templating/TwigTemplating.php
protected function loadPluginsFromDirectory($dirpath) {
		if (!is_dir($dirpath)) {
			return false;
		}
		
		$contents = @scandir($dirpath);
		
		if (is_array($contents)) {
			foreach ($contents as $file) {
				if (substr($file,-4) == '.php') {
					$class = '\\' . substr($file,0,-4);
					
					if($class != '') {
						// is this secure enough?
						// we don't use autoloader as we don't know how taht plugins are stored
						require_once($dirpath.'/'.$file);
						
						try {
							$twig_object = new $class();
						
							if ($twig_object instanceof \Twig_Extension) {
								$this->addExtension($twig_object);
							}
						} catch (\Extension $e) {
						}
					}
				}
			}
		}
	}
protected function loadPluginsFromDirectory($dirpath) {
		if (!is_dir($dirpath)) {
			return false;
		}
		
		$contents = @scandir($dirpath);
		
		if (is_array($contents)) {
			foreach ($contents as $file) {
				if (substr($file,-4) == '.php') {
					$class = '\\' . substr($file,0,-4);
					
					if($class != '') {
						// is this secure enough?
						// we don't use autoloader as we don't know how taht plugins are stored
						require_once($dirpath.'/'.$file);
						
						try {
							$twig_object = new $class();
						
							if ($twig_object instanceof \Twig_Extension) {
								$this->addExtension($twig_object);
							}
						} catch (\Extension $e) {
						}
					}
				}
			}
		}
	}
Load plugins from a directory