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


PHP AJXP_Node::setMetadata方法代码示例

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


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

示例1: setNodeMeta

 /**
  * @param AJXP_Node $node
  * @param array $meta
  * @param bool $private
  */
 public function setNodeMeta($node, $meta, $private = true)
 {
     $otherScope = !$private;
     $otherScopeMeta = $node->retrieveMetadata(AJXP_SHARED_META_NAMESPACE, $otherScope, AJXP_METADATA_SCOPE_REPOSITORY, true);
     // The scope has changed. Let's clear the old value
     if (count($otherScopeMeta)) {
         $node->removeMetadata(AJXP_SHARED_META_NAMESPACE, $otherScope, AJXP_METADATA_SCOPE_REPOSITORY, true);
     }
     $node->setMetadata(AJXP_SHARED_META_NAMESPACE, $meta, $private, AJXP_METADATA_SCOPE_REPOSITORY, true);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:15,代码来源:class.ShareMetaManager.php

示例2: updateMetaShort

 protected function updateMetaShort($file, $elementId, $shortUrl)
 {
     $driver = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("access");
     $streamData = $driver->detectStreamWrapper(false);
     $baseUrl = $streamData["protocol"] . "://" . ConfService::getRepository()->getId();
     $node = new AJXP_Node($baseUrl . $file);
     if ($node->hasMetaStore()) {
         $metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
         if ($elementId != -1) {
             if (!is_array($metadata["element"][$elementId])) {
                 $metadata["element"][$elementId] = array();
             }
             $metadata["element"][$elementId]["short_form_url"] = $shortUrl;
         } else {
             $metadata['short_form_url'] = $shortUrl;
         }
         $node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:19,代码来源:class.BitlyShortener.php

示例3: updateMetaShort

 protected function updateMetaShort($file, $elementId, $shortUrl)
 {
     $context = new UserSelection(ConfService::getRepository());
     $baseUrl = $context->currentBaseUrl();
     $node = new AJXP_Node($baseUrl . $file);
     if ($node->hasMetaStore()) {
         $metadata = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
         if ($elementId != -1) {
             if (!is_array($metadata["element"][$elementId])) {
                 $metadata["element"][$elementId] = array();
             }
             $metadata["element"][$elementId]["short_form_url"] = $shortUrl;
         } else {
             if (isset($metadata["shares"])) {
                 $key = array_pop(array_keys($metadata["shares"]));
                 $metadata["shares"][$key]["short_form_url"] = $shortUrl;
             } else {
                 $metadata['short_form_url'] = $shortUrl;
             }
         }
         $node->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY);
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:23,代码来源:class.BitlyShortener.php

示例4: loadWatchesFromMeta

 /**
  * @param String $watchType
  * @param String $currentUserId
  * @param AJXP_Node $node
  * @param array|bool $watchMeta
  * @param array|bool $usersMeta
  * @return array
  */
 private function loadWatchesFromMeta($watchType, $currentUserId, $node, $watchMeta = false, $usersMeta = false)
 {
     $IDS = array();
     if ($usersMeta !== false) {
         if ($watchType == self::$META_WATCH_CHANGE && isset($usersMeta[self::$META_WATCH_USERS_CHANGE])) {
             $usersMeta = $usersMeta[self::$META_WATCH_USERS_CHANGE];
         } else {
             if ($watchType == self::$META_WATCH_READ && isset($usersMeta[self::$META_WATCH_USERS_READ])) {
                 $usersMeta = $usersMeta[self::$META_WATCH_USERS_READ];
             } else {
                 $usersMeta = null;
             }
         }
     }
     if (!empty($watchMeta) && is_array($watchMeta)) {
         foreach ($watchMeta as $id => $type) {
             if ($type == $watchType || $type == self::$META_WATCH_BOTH) {
                 $IDS[] = $id;
             }
         }
     }
     if (!empty($usersMeta) && is_array($usersMeta)) {
         foreach ($usersMeta as $id => $targetUsers) {
             if (in_array($currentUserId, $targetUsers)) {
                 $IDS[] = $id;
             }
         }
     }
     if (count($IDS)) {
         $changes = false;
         foreach ($IDS as $index => $id) {
             if ($currentUserId == $id && !AJXP_SERVER_DEBUG) {
                 // In non-debug mode, do not send notifications to watcher!
                 unset($IDS[$index]);
                 continue;
             }
             if (!AuthService::userExists($id)) {
                 unset($IDS[$index]);
                 if (is_array($watchMeta)) {
                     $changes = true;
                     $watchMeta[$id] = AJXP_VALUE_CLEAR;
                 }
             } else {
                 // Make sure the user is still authorized on this node, otherwise remove it.
                 $uObject = ConfService::getConfStorageImpl()->createUserObject($id);
                 $acl = $uObject->mergedRole->getAcl($node->getRepositoryId());
                 $isOwner = $node->getRepository()->getOwner() == $uObject->getId();
                 if (!$isOwner && (empty($acl) || strpos($acl, "r") === FALSE)) {
                     unset($IDS[$index]);
                     if (is_array($watchMeta)) {
                         $changes = true;
                         $watchMeta[$id] = AJXP_VALUE_CLEAR;
                     }
                 }
             }
         }
         if ($changes) {
             $node->setMetadata(self::$META_WATCH_NAMESPACE, $watchMeta, false, AJXP_METADATA_SCOPE_REPOSITORY);
         }
     }
     return $IDS;
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:70,代码来源:class.MetaWatchRegister.php

示例5: switchAction


//.........这里部分代码省略.........
         //	BOOKMARK BAR
         //------------------------------------
         case "get_bookmarks":
             $bmUser = null;
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $bmUser = AuthService::getLoggedUser();
             } else {
                 if (!AuthService::usersEnabled()) {
                     $confStorage = ConfService::getConfStorageImpl();
                     $bmUser = $confStorage->createUserObject("shared");
                 }
             }
             if ($bmUser == null) {
                 AJXP_XMLWriter::header();
                 AJXP_XMLWriter::close();
             }
             $driver = ConfService::loadRepositoryDriver();
             if (!is_a($driver, "AjxpWrapperProvider")) {
                 $driver = false;
             }
             if (isset($httpVars["bm_action"]) && isset($httpVars["bm_path"])) {
                 $bmPath = AJXP_Utils::decodeSecureMagic($httpVars["bm_path"]);
                 if ($httpVars["bm_action"] == "add_bookmark") {
                     $title = "";
                     if (isset($httpVars["bm_title"])) {
                         $title = AJXP_Utils::decodeSecureMagic($httpVars["bm_title"]);
                     }
                     if ($title == "" && $bmPath == "/") {
                         $title = ConfService::getCurrentRootDirDisplay();
                     }
                     $bmUser->addBookMark($bmPath, $title);
                     if ($driver) {
                         $node = new AJXP_Node($driver->getResourceUrl($bmPath));
                         $node->setMetadata("ajxp_bookmarked", array("ajxp_bookmarked" => "true"), true, AJXP_METADATA_SCOPE_REPOSITORY, true);
                     }
                 } else {
                     if ($httpVars["bm_action"] == "delete_bookmark") {
                         $bmUser->removeBookmark($bmPath);
                         if ($driver) {
                             $node = new AJXP_Node($driver->getResourceUrl($bmPath));
                             $node->removeMetadata("ajxp_bookmarked", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
                         }
                     } else {
                         if ($httpVars["bm_action"] == "rename_bookmark" && isset($httpVars["bm_title"])) {
                             $title = AJXP_Utils::decodeSecureMagic($httpVars["bm_title"]);
                             $bmUser->renameBookmark($bmPath, $title);
                         }
                     }
                 }
                 AJXP_Controller::applyHook("msg.instant", array("<reload_bookmarks/>", ConfService::getRepository()->getId()));
                 if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                     $bmUser->save("user");
                     AuthService::updateUser($bmUser);
                 } else {
                     if (!AuthService::usersEnabled()) {
                         $bmUser->save("user");
                     }
                 }
             }
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::writeBookmarks($bmUser->getBookmarks(), true, isset($httpVars["format"]) ? $httpVars["format"] : "legacy");
             AJXP_XMLWriter::close();
             break;
             //------------------------------------
             //	SAVE USER PREFERENCE
             //------------------------------------
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:67,代码来源:class.AbstractConfDriver.php

示例6: nodeSharedMetadata

 /**
  * @param AJXP_Node $ajxpNode
  * @return void
  */
 public function nodeSharedMetadata(&$ajxpNode)
 {
     if (empty($this->accessDriver) || $this->accessDriver->getId() == "access.imap") {
         return;
     }
     $metadata = $ajxpNode->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
     if (count($metadata)) {
         $eType = $ajxpNode->isLeaf() ? "file" : "repository";
         if (isset($metadata["minisite"])) {
             $eType = "minisite";
         }
         if (is_array($metadata["element"])) {
             $updateMeta = false;
             foreach ($metadata["element"] as $elementId => $elementData) {
                 if (!self::sharedElementExists($eType, $elementId)) {
                     unset($metadata["element"][$elementId]);
                     $updateMeta = true;
                     return;
                 }
             }
             if (!count($metadata["element"])) {
                 $metadata = array();
                 $updateMeta = true;
             }
             if ($updateMeta) {
                 if (count($metadata) == 0) {
                     $ajxpNode->removeMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
                 } else {
                     $ajxpNode->setMetadata("ajxp_shared", $metadata, true, AJXP_METADATA_SCOPE_REPOSITORY, true);
                 }
             }
         } else {
             if (!self::sharedElementExists($eType, $metadata["element"])) {
                 $ajxpNode->removeMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
                 return;
             }
         }
         $merge = array("ajxp_shared" => "true", "overlay_icon" => "shared.png", "overlay_class" => "icon-share-sign");
         if ($eType == "minisite") {
             $merge["ajxp_shared_minisite"] = $metadata["minisite"];
         }
         $ajxpNode->mergeMetadata($merge, true);
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:48,代码来源:class.ShareCenter.php

示例7: getSharesFromMeta

 /**
  * @param AJXP_Node $node
  * @param Array $shares
  * @param bool $updateIfNotExists
  */
 public function getSharesFromMeta($node, &$shares, $updateIfNotExists = false)
 {
     $meta = $node->retrieveMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
     // NEW FORMAT
     if (isset($meta["shares"])) {
         $shares = array();
         $update = false;
         foreach ($meta["shares"] as $hashOrRepoId => $shareData) {
             if (!$updateIfNotExists || $this->getShareStore()->shareExists($shareData["type"], $hashOrRepoId)) {
                 $shares[$hashOrRepoId] = $shareData;
             } else {
                 $update = true;
             }
         }
         if ($update) {
             if (count($shares) > 0) {
                 $meta["shares"] = $shares;
                 $node->setMetadata("ajxp_shared", $meta, true, AJXP_METADATA_SCOPE_REPOSITORY, true);
             } else {
                 $node->removeMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
             }
         }
         return;
     }
     // OLD FORMAT
     if (isset($meta["minisite"])) {
         $type = "minisite";
     } else {
         $type = "detect";
     }
     $els = array();
     if (is_string($meta["element"])) {
         $els[] = $meta["element"];
     } else {
         if (is_array($meta["element"])) {
             $els = $meta["element"];
         }
     }
     if ($updateIfNotExists) {
         $update = false;
         $shares = array();
         foreach ($els as $hashOrRepoId => $additionalData) {
             if (is_string($additionalData)) {
                 $hashOrRepoId = $additionalData;
                 $additionalData = array();
             }
             if ($type == "detect") {
                 if (ConfService::getRepositoryById($hashOrRepoId) != null) {
                     $type = "repository";
                 } else {
                     $type = "file";
                 }
             }
             if ($this->getShareStore()->shareExists($type, $hashOrRepoId)) {
                 $shares[$hashOrRepoId] = array_merge($additionalData, array("type" => $type));
             } else {
                 $update = true;
             }
         }
         if ($update) {
             if (count($shares) > 0) {
                 unset($meta["element"]);
                 if (isset($meta["minisite"])) {
                     unset($meta["minisite"]);
                 }
                 $meta["shares"] = $shares;
                 $node->setMetadata("ajxp_shared", $meta, true, AJXP_METADATA_SCOPE_REPOSITORY, true);
             } else {
                 $node->removeMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
             }
         }
     } else {
         $shares = $els;
     }
 }
开发者ID:saydulk,项目名称:pydio-core,代码行数:80,代码来源:class.ShareCenter.php

示例8: nodeBookmarkMetadata

 /**
  * @param AJXP_Node $ajxpNode
  * @return void
  */
 public function nodeBookmarkMetadata(&$ajxpNode)
 {
     $user = AuthService::getLoggedUser();
     if ($user == null) {
         return;
     }
     $metadata = $ajxpNode->retrieveMetadata("ajxp_bookmarked", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
     if (is_array($metadata) && count($metadata)) {
         $ajxpNode->mergeMetadata(array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png", "overlay_class" => "icon-bookmark-empty"), true);
         return;
     }
     if (!isset(self::$loadedBookmarks)) {
         self::$loadedBookmarks = $user->getBookmarks();
     }
     foreach (self::$loadedBookmarks as $bm) {
         if ($bm["PATH"] == $ajxpNode->getPath()) {
             $ajxpNode->mergeMetadata(array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png", "overlay_class" => "icon-bookmark-empty"), true);
             $ajxpNode->setMetadata("ajxp_bookmarked", array("ajxp_bookmarked" => "true"), true, AJXP_METADATA_SCOPE_REPOSITORY, true);
         }
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:25,代码来源:class.AJXP_ClientDriver.php

示例9: loadWatchesFromMeta

 /**
  * @param String $watchType
  * @param String $currentUserId
  * @param AJXP_Node $node
  * @param array|bool $watchMeta
  * @param array|bool $usersMeta
  * @return array
  */
 private function loadWatchesFromMeta($watchType, $currentUserId, $node, $watchMeta = false, $usersMeta = false)
 {
     $IDS = array();
     if ($usersMeta !== false) {
         if ($watchType == self::$META_WATCH_CHANGE && isset($usersMeta[self::$META_WATCH_USERS_CHANGE])) {
             $usersMeta = $usersMeta[self::$META_WATCH_USERS_CHANGE];
         } else {
             if ($watchType == self::$META_WATCH_READ && isset($usersMeta[self::$META_WATCH_USERS_READ])) {
                 $usersMeta = $usersMeta[self::$META_WATCH_USERS_READ];
             } else {
                 $usersMeta = null;
             }
         }
     }
     if (!empty($watchMeta) && is_array($watchMeta)) {
         foreach ($watchMeta as $id => $type) {
             if ($type == $watchType || $type == self::$META_WATCH_BOTH) {
                 $IDS[] = $id;
             }
         }
     }
     if (!empty($usersMeta) && is_array($usersMeta)) {
         foreach ($usersMeta as $id => $targetUsers) {
             if (in_array($currentUserId, $targetUsers)) {
                 $IDS[] = $id;
             }
         }
     }
     if (count($IDS)) {
         $changes = false;
         foreach ($IDS as $index => $id) {
             if ($currentUserId == $id && !AJXP_SERVER_DEBUG) {
                 // In non-debug mode, do not send notifications to watcher!
                 unset($IDS[$index]);
                 continue;
             }
             if (!AuthService::userExists($id)) {
                 $changes = true;
                 unset($watchMeta[$id]);
                 unset($IDS[$index]);
             }
         }
         if ($changes) {
             $node->setMetadata(self::$META_WATCH_NAMESPACE, $watchMeta, false, AJXP_METADATA_SCOPE_REPOSITORY);
         }
     }
     return $IDS;
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:56,代码来源:class.MetaWatchRegister.php

示例10: editMeta

 public function editMeta($actionName, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$actionName])) {
         return;
     }
     if (is_a($this->accessDriver, "demoAccessDriver")) {
         throw new Exception("Write actions are disabled in demo mode!");
     }
     $repo = $this->accessDriver->repository;
     $user = AuthService::getLoggedUser();
     if (!AuthService::usersEnabled() && $user != null && !$user->canWrite($repo->getId())) {
         throw new Exception("You have no right on this action.");
     }
     $selection = new UserSelection();
     $selection->initFromHttpVars($httpVars);
     $currentFile = $selection->getUniqueFile();
     $urlBase = $this->accessDriver->getResourceUrl($currentFile);
     $ajxpNode = new AJXP_Node($urlBase);
     $newValues = array();
     $def = $this->getMetaDefinition();
     $ajxpNode->setDriver($this->accessDriver);
     AJXP_Controller::applyHook("node.before_change", array(&$ajxpNode));
     foreach ($def as $key => $data) {
         if (isset($httpVars[$key])) {
             $newValues[$key] = AJXP_Utils::decodeSecureMagic($httpVars[$key]);
         } else {
             if (!isset($original)) {
                 $original = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
             }
             if (isset($original) && isset($original[$key])) {
                 $newValues[$key] = $original[$key];
             }
         }
     }
     $ajxpNode->setMetadata("users_meta", $newValues, false, AJXP_METADATA_SCOPE_GLOBAL);
     AJXP_Controller::applyHook("node.meta_change", array($ajxpNode));
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::writeNodesDiff(array("UPDATE" => array($ajxpNode->getPath() => $ajxpNode)), true);
     AJXP_XMLWriter::close();
 }
开发者ID:biggtfish,项目名称:cms,代码行数:40,代码来源:class.UserMetaManager.php


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