当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::setSlug方法代码示例

本文整理汇总了PHP中Repository::setSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::setSlug方法的具体用法?PHP Repository::setSlug怎么用?PHP Repository::setSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository::setSlug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveRepository

 /**
  * Store a newly created repository
  *
  * @param Repository $repositoryObject
  * @param Boolean $update
  * @return int -1 if failed
  */
 public function saveRepository($repositoryObject, $update = false)
 {
     try {
         if ($update) {
             $repositoryObject->setSlug($this->uniquifySlug($repositoryObject->getSlug(), $repositoryObject->getUniqueId()));
         } else {
             $repositoryObject->setSlug($this->uniquifySlug($repositoryObject->getSlug()));
         }
         $repository_array = $this->repoToArray($repositoryObject);
         $options = $repository_array['options'];
         if ($repositoryObject->hasContentFilter()) {
             $options["content_filter"] = $repositoryObject->getContentFilter();
         }
         unset($repository_array['options']);
         if (!$update) {
             dibi::query('INSERT INTO [ajxp_repo]', $repository_array);
             foreach ($options as $k => $v) {
                 if (!is_string($v)) {
                     $v = '$phpserial$' . serialize($v);
                 }
                 dibi::query('INSERT INTO [ajxp_repo_options] ([uuid],[name],[val]) VALUES (%s,%s,%bin)', $repositoryObject->getUniqueId(), $k, $v);
             }
         } else {
             dibi::query('DELETE FROM [ajxp_repo] WHERE [uuid] = %s', $repositoryObject->getUniqueId());
             dibi::query('DELETE FROM [ajxp_repo_options] WHERE [uuid] = %s', $repositoryObject->getUniqueId());
             dibi::query('INSERT INTO [ajxp_repo]', $repository_array);
             foreach ($options as $k => $v) {
                 if (!is_string($v)) {
                     $v = '$phpserial$' . serialize($v);
                 }
                 dibi::query('INSERT INTO [ajxp_repo_options] ([uuid],[name],[val]) VALUES (%s,%s,%bin)', $repositoryObject->getUniqueId(), $k, $v);
             }
         }
     } catch (DibiException $e) {
         echo get_class($e), ': ', $e->getMessage(), "\n";
         exit(1);
         return -1;
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:46,代码来源:class.sqlConfDriver.php

示例2: createRepositoryFromArrayInst

 /**
  * See static method
  * @param string $index
  * @param array $repository
  * @return Repository
  */
 public function createRepositoryFromArrayInst($index, $repository)
 {
     $repo = new Repository($index, $repository["DISPLAY"], $repository["DRIVER"]);
     if (isset($repository["DISPLAY_ID"])) {
         $repo->setDisplayStringId($repository["DISPLAY_ID"]);
     }
     if (isset($repository["DESCRIPTION_ID"])) {
         $repo->setDescription($repository["DESCRIPTION_ID"]);
     }
     if (isset($repository["AJXP_SLUG"])) {
         $repo->setSlug($repository["AJXP_SLUG"]);
     }
     if (isset($repository["IS_TEMPLATE"]) && $repository["IS_TEMPLATE"]) {
         $repo->isTemplate = true;
         $repo->uuid = $index;
     }
     if (array_key_exists("DRIVER_OPTIONS", $repository) && is_array($repository["DRIVER_OPTIONS"])) {
         foreach ($repository["DRIVER_OPTIONS"] as $oName => $oValue) {
             $repo->addOption($oName, $oValue);
         }
     }
     // BACKWARD COMPATIBILITY!
     if (array_key_exists("PATH", $repository)) {
         $repo->addOption("PATH", $repository["PATH"]);
         $repo->addOption("CREATE", intval($repository["CREATE"]));
         $repo->addOption("RECYCLE_BIN", $repository["RECYCLE_BIN"]);
     }
     return $repo;
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:35,代码来源:class.ConfService.php

示例3: repoFromDb

 /**
  * Create a Repository object from a Database Result
  * 
  * The method expects the following schema:
  * CREATE TABLE ajxp_repo ( uuid VARCHAR(33) PRIMARY KEY, 
  * 							path VARCHAR(255), 
  * 							display VARCHAR(255), 
  * 							accessType VARCHAR(20), 
  * 							recycle VARCHAR(255) , 
  * 							bcreate BOOLEAN, -- For some reason 'create' is a reserved keyword
  * 							writeable BOOLEAN, 
  * 							enabled BOOLEAN );
  * 
  * Additionally, the options are stored in a separate table:
  * CREATE TABLE ajxp_repo_options ( oid INTEGER PRIMARY KEY, uuid VARCHAR(33), name VARCHAR(50), val VARCHAR(255) );
  * 
  * I recommend an index to increase performance of uuid lookups:
  * CREATE INDEX ajxp_repo_options_uuid_idx ON ajxp_repo_options ( uuid );
  * 
  * 
  * @param $result Result of a dibi::query() as array
  * @param $options_result Result of dibi::query() for options as array
  * @return Repository object
  */
 function repoFromDb($result, $options_result = array())
 {
     $repo = new Repository($result['id'], $result['display'], $result['accessType']);
     $repo->uuid = $result['uuid'];
     $repo->setOwnerData($result['parent_uuid'], $result['owner_user_id'], $result['child_user_id']);
     $repo->path = $result['path'];
     $repo->create = $result['bcreate'];
     $repo->writeable = $result['writeable'];
     $repo->writeable = true;
     $repo->enabled = $result['enabled'];
     $repo->recycle = "";
     $repo->setSlug($result['slug']);
     $repo->isTemplate = intval($result['isTemplate']) == 1 ? true : false;
     $repo->setInferOptionsFromParent(intval($result['inferOptionsFromParent']) == 1 ? true : false);
     foreach ($options_result as $k => $v) {
         if (strpos($v, '$phpserial$') !== false && strpos($v, '$phpserial$') === 0) {
             $v = unserialize(substr($v, strlen('$phpserial$')));
         } else {
             if ($k == "META_SOURCES") {
                 $v = unserialize($v);
             }
         }
         $repo->options[$k] = $v;
     }
     return $repo;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:50,代码来源:class.sqlConfDriver.php


注:本文中的Repository::setSlug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。