本文整理汇总了PHP中AJXP_Node::retrieveMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::retrieveMetadata方法的具体用法?PHP AJXP_Node::retrieveMetadata怎么用?PHP AJXP_Node::retrieveMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::retrieveMetadata方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: getWatchesOnNode
/**
* @param AJXP_Node $node
* @param String $watchType
* @param String $userId
* @return array
*/
public function getWatchesOnNode($node, $watchType, $userId = null)
{
if ($userId == null) {
$currentUserId = "shared";
if (AuthService::getLoggedUser() != null) {
$currentUserId = AuthService::getLoggedUser()->getId();
}
} else {
$currentUserId = $userId;
}
$meta = $node->retrieveMetadata(self::$META_WATCH_NAMESPACE, false, AJXP_METADATA_SCOPE_REPOSITORY);
$usersMeta = false;
if ($currentUserId != 'shared') {
$usersMeta = $node->retrieveMetadata(self::$META_WATCH_USERS_NAMESPACE, false, AJXP_METADATA_SCOPE_REPOSITORY);
}
return $this->loadWatchesFromMeta($watchType, $currentUserId, $node, $meta, $usersMeta);
}
示例4: extractMeta
/**
*
* @param AJXP_Node $ajxpNode
* @param bool $contextNode
* @param bool $details
* @return void
*/
public function extractMeta(&$ajxpNode, $contextNode = false, $details = false)
{
$metadata = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
if (empty($metadata)) {
$metadata = array();
}
$ajxpNode->mergeMetadata($metadata);
}
示例5: mergeMeta
/**
* @param AJXP_Node $ajxpNode
*/
public function mergeMeta($ajxpNode)
{
$ajxpNode->mergeMetadata(array("ajxp_has_comments_feed" => "true"));
if ($ajxpNode->retrieveMetadata(AJXP_META_SPACE_COMMENTS, false) != null) {
}
}
示例6: compositeShareFromMetaWithScope
/**
* @param AJXP_Node $node
* @param string $scope
* @return CompositeShare[]
*/
protected function compositeShareFromMetaWithScope($node, $scope = "private")
{
if ($scope !== AJXP_METADATA_ALLUSERS) {
$scope = $scope == "private";
}
$meta = $node->retrieveMetadata(AJXP_SHARED_META_NAMESPACE, $scope, AJXP_METADATA_SCOPE_REPOSITORY, true);
$shares = array();
$composites = array();
if (!isset($meta["shares"])) {
return $shares;
}
foreach ($meta["shares"] as $id => $shareData) {
$type = $shareData["type"];
if ($type == "repository") {
if (!isset($shares[$id])) {
$shares[$id] = array("repository" => $id, "links" => array());
}
} else {
if ($type == "minisite" || $type == "ocs_remote") {
$link = $this->shareStore->loadShareObject($id);
if (!empty($link)) {
$link->setAdditionalMeta($shareData);
$linkRepoId = $link->getRepositoryId();
if (empty($linkRepoId)) {
continue;
}
if (!isset($shares[$linkRepoId])) {
$shares[$linkRepoId] = array("repository" => $linkRepoId, "links" => array());
}
$shares[$linkRepoId]["links"][] = $link;
}
}
}
}
foreach ($shares as $repoId => $repoData) {
$composite = new CompositeShare($node, $repoId);
foreach ($repoData["links"] as $link) {
$composite->addLink($link);
}
$composites[] = $composite;
}
return $composites;
}
示例7: copyOrMoveMetadataFromNode
/**
* @param AJXP_Node $originalNode
* @param string $nameSpace
* @param string $operation
* @param bool $private
* @param int $scope
* @param bool $indexable
* @return array()
*/
public function copyOrMoveMetadataFromNode($originalNode, $nameSpace, $operation = "move", $private = false, $scope = AJXP_METADATA_SCOPE_REPOSITORY, $indexable = false)
{
if ($this->getMetaStore() == false || $this->getMetaStore()->inherentMetaMove()) {
return array();
}
$metaData = $originalNode->retrieveMetadata($nameSpace, $private, $scope, $indexable);
if (isset($metaData) && !empty($metaData)) {
$this->setMetadata($nameSpace, $metaData, $private, $scope, $indexable);
if ($operation == "move") {
$originalNode->removeMetadata($nameSpace, $private, $scope, $indexable);
}
return $metaData;
}
return array();
}
示例8: updateNodeSharedData
/**
*
* Hooked to node.change, this will update the index
* if $oldNode = null => create node $newNode
* if $newNode = null => delete node $oldNode
* Else copy or move oldNode to newNode.
*
* @param AJXP_Node $oldNode
*/
public function updateNodeSharedData($oldNode)
{
if (empty($this->accessDriver) || $this->accessDriver->getId() == "access.imap") {
return;
}
if ($oldNode == null || !$oldNode->hasMetaStore()) {
return;
}
$metadata = $oldNode->retrieveMetadata("ajxp_shared", true);
if (count($metadata) && !empty($metadata["element"])) {
// TODO
// Make sure node info is loaded, to check if it's a dir or a file.
// Maybe could be directly embedded in metadata, to avoid having to load here.
$oldNode->loadNodeInfo();
try {
$type = $oldNode->isLeaf() ? "file" : "repository";
$elementIds = array();
if ($type == "file") {
if (!is_array($metadata["element"])) {
$elementIds[] = $metadata["element"];
} else {
$elementIds = array_keys($metadata["element"]);
}
} else {
$elementIds[] = $metadata["element"];
}
foreach ($elementIds as $elementId) {
self::deleteSharedElement($type, $elementId, AuthService::getLoggedUser());
}
$oldNode->removeMetadata("ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
} catch (Exception $e) {
$this->logError("Exception", $e->getMessage(), $e->getTrace());
}
}
}
示例9: 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;
}
}
示例10: extractMeta
/**
*
* @param AJXP_Node $ajxpNode
* @param bool $contextNode
* @param bool $details
* @return void
*/
public function extractMeta(&$ajxpNode, $contextNode = false, $details = false)
{
//$metadata = $this->metaStore->retrieveMetadata($ajxpNode, "users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
$metadata = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
if (count($metadata)) {
// @todo : Should be UTF8-IZED at output only !!??
// array_map(array("SystemTextEncoding", "toUTF8"), $metadata);
}
$metadata["meta_fields"] = $this->options["meta_fields"];
$metadata["meta_labels"] = $this->options["meta_labels"];
$metadata["meta_types"] = $this->options["meta_types"];
$ajxpNode->mergeMetadata($metadata);
}
示例11: 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);
}
}
}
示例12: extractMeta
/**
*
* @param AJXP_Node $ajxpNode
* @param bool $contextNode
* @param bool $details
* @return void
*/
public function extractMeta(&$ajxpNode, $contextNode = false, $details = false)
{
$metadata = $ajxpNode->retrieveMetadata("users_meta", false, AJXP_METADATA_SCOPE_GLOBAL);
if (count($metadata)) {
// @todo : Should be UTF8-IZED at output only !!??
// array_map(array("SystemTextEncoding", "toUTF8"), $metadata);
}
if (empty($metadata)) {
$metadata = array();
}
$ajxpNode->mergeMetadata($metadata);
}