Ejemplo n.º 1
0
 /**
  * Select library
  *
  * @return	object
  */
 public static function &fetch_library(&$registry, $contenttypeid)
 {
     if (self::$instance) {
         return self::$instance;
     }
     $types = vB_Types::instance();
     if (!($contenttypeid = $types->getContentTypeID($contenttypeid))) {
         return false;
     }
     $package = $types->getContentTypePackage($contenttypeid);
     $class = $types->getContentTypeClass($contenttypeid);
     $selectclass = "vB_Attachment_Upload_Displaybit_{$package}_{$class}";
     $path = DIR . '/packages/' . strtolower($package) . '/attach/' . strtolower($class) . '.php';
     if (file_exists($path)) {
         include_once $path;
         if (class_exists($selectclass)) {
             self::$instance = new $selectclass($registry, $contenttypeid);
             return self::$instance;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
	/**
	* Select library
	*
	* @return	object
	*/
	public static function &fetch_library(&$registry, $contenttypeid)
	{
		if (self::$instance)
		{
			return self::$instance;
		}

		require_once(DIR . '/includes/class_bootstrap_framework.php');
		require_once(DIR . '/vb/types.php');
		vB_Bootstrap_Framework::init();
		$types = vB_Types::instance();

		if (!($contenttypeid = $types->getContentTypeID($contenttypeid)))
		{
			return false;
		}

		$package = $types->getContentTypePackage($contenttypeid);
		$class = $types->getContentTypeClass($contenttypeid);

		$selectclass = "vB_Attachment_Upload_Displaybit_{$package}_{$class}";
		include_once(DIR . '/packages/' . strtolower($package) . '/attach/' . strtolower($class) . '.php');

		if (class_exists($selectclass))
		{
			self::$instance = new $selectclass($registry, $contenttypeid);
		}
		else
		{
			return false;
		}

		return self::$instance;
	}