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


PHP Repository::getDescription方法代码示例

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


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

示例1: updateRepo

 public function updateRepo(Repository $repo, $crdate = null, $modate = null)
 {
     //add repository
     $r = new Database_Adapter_Elasticsearch_HTTPRequest($this->searchInstance . 'repo/' . $repo->id, \HTTP_Request2::METHOD_PUT);
     $repoData = array('id' => $repo->id, 'description' => $repo->getDescription(), 'tstamp' => gmdate('c', time()));
     if ($crdate == null) {
         $crdate = $this->getCrDate($repo);
     }
     if ($crdate !== null) {
         $repoData['crdate'] = gmdate('c', $crdate);
     }
     if ($modate == null) {
         $modate = $this->getMoDate($repo);
     }
     if ($modate !== null) {
         $repoData['modate'] = gmdate('c', $modate);
     }
     $r->setBody(json_encode((object) $repoData));
     $r->send();
     //add files
     //clean up before adding files; files might have been deleted
     $this->deleteRepoFiles($repo);
     foreach ($repo->getFiles() as $file) {
         $r = new Database_Adapter_Elasticsearch_HTTPRequest($this->searchInstance . 'file/?parent=' . $repo->id, \HTTP_Request2::METHOD_POST);
         $r->setBody(json_encode((object) array('name' => $file->getFilename(), 'extension' => $file->getExt(), 'content' => $file->isText() ? $file->getContent() : '')));
         $r->send();
     }
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:28,代码来源:Indexer.php

示例2: send

 /**
  * Call webhook URLs with our payload
  */
 public function send($event, Repository $repo)
 {
     if (count($this->config) == 0) {
         return;
     }
     /* slightly inspired by
        https://help.github.com/articles/post-receive-hooks */
     $payload = (object) array('event' => $event, 'author' => array('name' => $_SESSION['name'], 'email' => $_SESSION['email']), 'repository' => array('name' => $repo->getTitle(), 'url' => $repo->getLink('display', null, true), 'description' => $repo->getDescription(), 'owner' => $repo->getOwner()));
     foreach ($this->config as $url) {
         $req = new \HTTP_Request2($url);
         $req->setMethod(\HTTP_Request2::METHOD_POST)->setHeader('Content-Type: application/vnd.phorkie.webhook+json')->setBody(json_encode($payload));
         try {
             $response = $req->send();
             //FIXME log response codes != 200
         } catch (HTTP_Request2_Exception $e) {
             //FIXME log exceptions
         }
     }
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:22,代码来源:Webhook.php

示例3: repositoryToXML

 /**
  * @param string $repoId
  * @param Repository $repoObject
  * @param array $exposed
  * @param array $streams
  * @param AbstractAjxpUser $loggedUser
  * @param string $accessStatus
  * @return string
  * @throws Exception
  */
 public static function repositoryToXML($repoId, $repoObject, $exposed, $streams, $loggedUser, $accessStatus = "")
 {
     $statusString = " repository_type=\"" . $repoObject->getRepositoryType() . "\"";
     if (empty($accessStatus)) {
         $accessStatus = $repoObject->getAccessStatus();
     }
     if (!empty($accessStatus)) {
         $statusString .= " access_status=\"{$accessStatus}\" ";
     } else {
         if ($loggedUser != null) {
             $lastConnected = $loggedUser->getArrayPref("repository_last_connected", $repoId);
             if (!empty($lastConnected)) {
                 $statusString .= " last_connection=\"{$lastConnected}\" ";
             }
         }
     }
     $streamString = "";
     if (in_array($repoObject->accessType, $streams)) {
         $streamString = "allowCrossRepositoryCopy=\"true\"";
     }
     if ($repoObject->getUniqueUser()) {
         $streamString .= " user_editable_repository=\"true\" ";
     }
     if ($repoObject->hasContentFilter()) {
         $streamString .= " hasContentFilter=\"true\"";
     }
     $slugString = "";
     $slug = $repoObject->getSlug();
     if (!empty($slug)) {
         $slugString = "repositorySlug=\"{$slug}\"";
     }
     $isSharedString = "";
     $currentUserIsOwner = false;
     $ownerLabel = null;
     if ($repoObject->hasOwner()) {
         $uId = $repoObject->getOwner();
         if (AuthService::usersEnabled() && AuthService::getLoggedUser()->getId() == $uId) {
             $currentUserIsOwner = true;
         }
         $label = ConfService::getUserPersonalParameter("USER_DISPLAY_NAME", $uId, "core.conf", $uId);
         $ownerLabel = $label;
         $isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
     }
     if ($repoObject->securityScope() == "USER" || $currentUserIsOwner) {
         $streamString .= " userScope=\"true\"";
     }
     $descTag = "";
     $public = false;
     if (!empty($_SESSION["CURRENT_MINISITE"])) {
         $public = true;
     }
     $description = $repoObject->getDescription($public, $ownerLabel);
     if (!empty($description)) {
         $descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
     }
     $roleString = "";
     if ($loggedUser != null) {
         $merged = $loggedUser->mergedRole;
         $params = array();
         foreach ($exposed as $exposed_prop) {
             $metaOptions = $repoObject->getOption("META_SOURCES");
             if (!isset($metaOptions[$exposed_prop["PLUGIN_ID"]])) {
                 continue;
             }
             $value = $exposed_prop["DEFAULT"];
             if (isset($metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]])) {
                 $value = $metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]];
             }
             $value = $merged->filterParameterValue($exposed_prop["PLUGIN_ID"], $exposed_prop["NAME"], $repoId, $value);
             if ($value !== null) {
                 if ($value === true || $value === false) {
                     $value = $value === true ? "true" : "false";
                 }
                 $params[] = '<repository_plugin_param plugin_id="' . $exposed_prop["PLUGIN_ID"] . '" name="' . $exposed_prop["NAME"] . '" value="' . AJXP_Utils::xmlEntities($value) . '"/>';
                 $roleString .= str_replace(".", "_", $exposed_prop["PLUGIN_ID"]) . "_" . $exposed_prop["NAME"] . '="' . AJXP_Utils::xmlEntities($value) . '" ';
             }
         }
         $roleString .= 'acl="' . $merged->getAcl($repoId) . '"';
         if ($merged->hasMask($repoId)) {
             $roleString .= ' hasMask="true" ';
         }
     }
     return "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$statusString} {$streamString} {$slugString} {$isSharedString} {$roleString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:94,代码来源:class.AJXP_XMLWriter.php


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