本文整理汇总了PHP中AJXP_Node::removeMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::removeMetadata方法的具体用法?PHP AJXP_Node::removeMetadata怎么用?PHP AJXP_Node::removeMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::removeMetadata方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
//.........这里部分代码省略.........
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
//------------------------------------
//------------------------------------
// SAVE USER PREFERENCE
//------------------------------------
case "save_user_pref":
$userObject = AuthService::getLoggedUser();
$i = 0;
while (isset($httpVars["pref_name_" . $i]) && isset($httpVars["pref_value_" . $i])) {
示例2: handleNodeChange
/**
* @param AJXP_Node $fromNode
* @param AJXP_Node $toNode
* @param bool $copy
*/
public function handleNodeChange($fromNode = null, $toNode = null, $copy = false)
{
if ($fromNode == null) {
return;
}
if ($toNode == null) {
$fromNode->removeMetadata("etherpad", AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_GLOBAL, false);
} else {
if (!$copy) {
$toNode->copyOrMoveMetadataFromNode($fromNode, "etherpad", "move", AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_GLOBAL, false);
}
}
}
示例3: clearNodeMeta
/**
* @param AJXP_Node $node
*/
public function clearNodeMeta($node)
{
// Try to remove both scopes
$node->removeMetadata(AJXP_SHARED_META_NAMESPACE, true, AJXP_METADATA_SCOPE_REPOSITORY, true);
$node->removeMetadata(AJXP_SHARED_META_NAMESPACE, false, AJXP_METADATA_SCOPE_REPOSITORY, true);
}
示例4: 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();
}
示例5: 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());
}
}
}
示例6: 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;
}
}
示例7: nodeChangeBookmarkMetadata
/**
* @param AJXP_Node $fromNode
* @param AJXP_Node $toNode
* @param bool $copy
*/
public function nodeChangeBookmarkMetadata($fromNode = null, $toNode = null, $copy = false)
{
if ($copy || $fromNode == null) {
return;
}
$user = AuthService::getLoggedUser();
if ($user == null) {
return;
}
if (!isset(self::$loadedBookmarks)) {
self::$loadedBookmarks = $user->getBookmarks();
}
if ($toNode == null) {
$fromNode->removeMetadata("ajxp_bookmarked", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
} else {
$toNode->copyOrMoveMetadataFromNode($fromNode, "ajxp_bookmarked", "move", true, AJXP_METADATA_SCOPE_REPOSITORY, true);
}
AJXP_Controller::applyHook("msg.instant", array("<reload_bookmarks/>", $fromNode->getRepositoryId(), AuthService::getLoggedUser()->getId()));
}