protected function init(&$plugin, $autocreate = true, $dispatcher = null)
	{
		$plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type);
		$plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name);

		$classNameL = 'plg' . $plugin->type . $plugin->name;
		$classNameN = 'Plugins\\' . ucfirst($plugin->type) . '\\' . ucfirst($plugin->name);

		// If the class exists, the file was already loaded
		if (!class_exists($classNameL) && !class_exists($classNameN))
		{
			$path = $this->path($plugin->type, $plugin->name) . DS . $plugin->name . '.php';

			if (file_exists($path))
			{
				require_once $path;

				if ($autocreate)
				{
					foreach (array($classNameL, $classNameN) as $className)
					{
						if (!class_exists($className))
						{
							continue;
						}

						// Makes sure we have an event dispatcher
						if (!($dispatcher instanceof DispatcherInterface))
						{
							$dispatcher = new Dispatcher();
						}

						// Instantiate and register the plugin.
						return new $className($dispatcher, (array) $plugin);
					}
				}
			}
		}

		return null;
	}
protected function init(&$plugin, $autocreate = true, $dispatcher = null)
	{
		$plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type);
		$plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name);

		$classNameL = 'plg' . $plugin->type . $plugin->name;
		$classNameN = 'Plugins\\' . ucfirst($plugin->type) . '\\' . ucfirst($plugin->name);

		// If the class exists, the file was already loaded
		if (!class_exists($classNameL) && !class_exists($classNameN))
		{
			$path = $this->path($plugin->type, $plugin->name) . DS . $plugin->name . '.php';

			if (file_exists($path))
			{
				require_once $path;

				if ($autocreate)
				{
					foreach (array($classNameL, $classNameN) as $className)
					{
						if (!class_exists($className))
						{
							continue;
						}

						// Makes sure we have an event dispatcher
						if (!($dispatcher instanceof DispatcherInterface))
						{
							$dispatcher = new Dispatcher();
						}

						// Instantiate and register the plugin.
						return new $className($dispatcher, (array) $plugin);
					}
				}
			}
		}

		return null;
	}
protected function init ( & $ plugin , $ autocreate = true , $ dispatcher = null ) { $ plugin -> type = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> type ) ; $ plugin -> name = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> name ) ; $ classNameL = 'plg' . $ plugin -> type . $ plugin -> name ; $ classNameN = 'Plugins\\' . ucfirst ( $ plugin -> type ) . '\\' . ucfirst ( $ plugin -> name ) ; // If the class exists, the file was already loaded if ( ! class_exists ( $ classNameL ) && ! class_exists ( $ classNameN ) ) { $ path = $ this -> path ( $ plugin -> type , $ plugin -> name ) . DS . $ plugin -> name . '.php' ; if ( file_exists ( $ path ) ) { require_once $ path ; if ( $ autocreate ) { foreach ( array ( $ classNameL , $ classNameN ) as $ className ) { if ( ! class_exists ( $ className ) ) { continue ; } // Makes sure we have an event dispatcher if ( ! ( $ dispatcher instanceof DispatcherInterface ) ) { $ dispatcher = new Dispatcher ( ) ; } // Instantiate and register the plugin. return new $ className ( $ dispatcher , ( array ) $ plugin ) ; } } } } return null ; }
Loads the plugin file.

@param   object   $plugin  The plugin data.
@return  boolean  True on success.
Loads the plugin file .