コード例 #1
0
ファイル: attach.php プロジェクト: 0hyeah/yurivn
 /**
  * Select library
  *
  * @return	object
  */
 public static function &fetch_library(&$registry, $contenttypeid, $categoryid = 0, $values = array())
 {
     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_Store_{$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, $categoryid, $values);
             return self::$instance;
         }
     }
     return false;
 }
コード例 #2
0
ファイル: attach.php プロジェクト: hungnv0789/vhtm
	/**
	* Select library
	*
	* @return	object
	*/
	public static function &fetch_library(&$registry, $contenttypeid, $categoryid, $values)
	{
		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_Store_{$package}_{$class}";
		include_once(DIR . '/packages/' . strtolower($package) . '/attach/' . strtolower($class) . '.php');
		if (class_exists($selectclass))
		{
			self::$instance = new $selectclass($registry, $contenttypeid, $categoryid, $values);
		}
		else
		{
			exit;
			return false;
		}

		return self::$instance;
	}