本文整理汇总了PHP中AJXP_Node::hasMetaStore方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::hasMetaStore方法的具体用法?PHP AJXP_Node::hasMetaStore怎么用?PHP AJXP_Node::hasMetaStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::hasMetaStore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
}
}
示例4: switchAction
//.........这里部分代码省略.........
if (!is_array($res)) {
$url = $res;
} else {
list($hash, $url) = $res;
$newMeta = array("id" => $hash, "type" => "minisite");
if ($httpHash != null && $hash != $httpHash) {
$originalHash = $httpHash;
}
}
print $url;
} else {
$data = $this->accessDriver->makePublicletOptions($file, $httpVars["password"], $httpVars["expiration"], $httpVars["downloadlimit"], $this->repository);
$customData = array();
foreach ($httpVars as $key => $value) {
if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
$customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
}
}
if (count($customData)) {
$data["PLUGINS_DATA"] = $customData;
}
list($hash, $url) = $this->writePubliclet($data, $this->accessDriver, $this->repository);
$newMeta = array("id" => $hash, "type" => "file");
if (isset($httpVars["format"]) && $httpVars["format"] == "json") {
header("Content-type:application/json");
echo json_encode(array("element_id" => $hash, "publiclet_link" => $url));
} else {
header("Content-type:text/plain");
echo $url;
}
flush();
}
}
if ($newMeta != null && $ajxpNode->hasMetaStore() && !$ajxpNode->isRoot()) {
$this->addShareInMeta($ajxpNode, $newMeta["type"], $newMeta["id"], $originalHash);
}
AJXP_Controller::applyHook("msg.instant", array("<reload_shared_elements/>", ConfService::getRepository()->getId()));
// as the result can be quite small (e.g error code), make sure it's output in case of OB active.
flush();
break;
case "toggle_link_watch":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$watchValue = $httpVars["set_watch"] == "true" ? true : false;
$folder = false;
$shNode = new AJXP_Node($this->urlBase . $file);
if (isset($httpVars["element_type"]) && $httpVars["element_type"] == "folder") {
$folder = true;
$node = new AJXP_Node($this->baseProtocol . "://" . $httpVars["repository_id"] . "/");
} else {
$node = new AJXP_Node($this->urlBase . $file);
}
$this->getSharesFromMeta($shNode, $shares, false);
if (!count($shares)) {
break;
}
if (isset($httpVars["element_id"]) && isset($shares[$httpVars["element_id"]])) {
$elementId = $httpVars["element_id"];
} else {
$sKeys = array_keys($shares);
$elementId = $sKeys[0];
}
if ($this->watcher !== false) {
if (!$folder) {
if ($watchValue) {
$this->watcher->setWatchOnFolder($node, AuthService::getLoggedUser()->getId(), MetaWatchRegister::$META_WATCH_USERS_READ, array($elementId));
} else {