本文整理汇总了PHP中AJXP_Node::mergeMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::mergeMetadata方法的具体用法?PHP AJXP_Node::mergeMetadata怎么用?PHP AJXP_Node::mergeMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::mergeMetadata方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractMeta
/**
*
* @param AJXP_Node $ajxpNode
*/
public function extractMeta(&$ajxpNode)
{
//if(isSet($_SESSION["SVN_COMMAND_RUNNING"]) && $_SESSION["SVN_COMMAND_RUNNING"] === true) return ;
$realDir = dirname($ajxpNode->getRealFile());
if (SvnManager::$svnListDir == $realDir) {
$entries = SvnManager::$svnListCache;
} else {
try {
SvnManager::$svnListDir = $realDir;
$entries = $this->svnListNode($realDir);
SvnManager::$svnListCache = $entries;
} catch (Exception $e) {
$this->logError("ExtractMeta", $e->getMessage());
}
}
$fileId = SystemTextEncoding::toUTF8(basename($ajxpNode->getUrl()));
if (isset($entries[$fileId])) {
$ajxpNode->mergeMetadata($entries[$fileId]);
}
}
示例2: 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);
}
示例3: nodeBookmarkMetadata
/**
* @param AJXP_Node $ajxpNode
* @return
*/
function nodeBookmarkMetadata(&$ajxpNode)
{
$user = AuthService::getLoggedUser();
if ($user == null) {
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"), true);
/*
* TESTING MULTIPLE OVERLAYS
$ajxpNode->mergeMetadata(array(
"overlay_icon" => "shared.png"
), true);
*/
}
}
}
示例4: extractMeta
/**
* @param AJXP_Node $ajxpNode
*/
public function extractMeta(&$ajxpNode)
{
$currentFile = $ajxpNode->getUrl();
if (!$ajxpNode->isLeaf() || preg_match("/\\.zip\\//", $currentFile)) {
return;
}
if (!preg_match("/\\.jpg\$|\\.jpeg\$|\\.tif\$|\\.tiff\$/i", $currentFile)) {
return;
}
$definitions = $this->getMetaDefinition();
if (!count($definitions)) {
return;
}
if (!function_exists("exif_read_data")) {
return;
}
//if(!exif_imagetype($currentFile)) return ;
$realFile = $ajxpNode->getRealFile();
$exif = @exif_read_data($realFile, 0, TRUE);
$iptc = $this->extractIPTC($realFile);
if ($exif === false) {
return;
}
$additionalMeta = array();
foreach ($definitions as $def => $label) {
list($exifSection, $exifName) = explode("-", $def);
if ($exifSection == "COMPUTED_GPS" && !isset($exif["COMPUTED_GPS"])) {
$exif['COMPUTED_GPS'] = $this->convertGPSData($exif);
}
if (isset($exif[$exifSection]) && isset($exif[$exifSection][$exifName])) {
$additionalMeta[$def] = $exif[$exifSection][$exifName];
}
if ($exifSection == "IPTC" && isset($iptc[$exifName])) {
$additionalMeta[$def] = $iptc[$exifName];
}
}
$ajxpNode->mergeMetadata($additionalMeta);
}
示例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: 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);
}
}
示例7: videoAlternateVersions
/**
* @param AJXP_Node $ajxpNode
*/
public function videoAlternateVersions(&$ajxpNode)
{
if (!preg_match('/\\.mpg$|\\.mp4$|\\.ogv$|\\.webm$/i', $ajxpNode->getLabel())) {
return;
}
if (file_exists(str_replace(".mpg", "_PREVIEW.mp4", $ajxpNode->getUrl()))) {
$ajxpNode->mergeMetadata(array("video_altversion_mp4" => str_replace(".mpg", "_PREVIEW.mp4", $ajxpNode->getPath())));
}
$rotating = array("mp4", "ogv", "webm");
foreach ($rotating as $ext) {
if (preg_match('/\\.' . $ext . '$/i', $ajxpNode->getLabel())) {
foreach ($rotating as $other) {
if ($other == $ext) {
continue;
}
if (file_exists(str_replace($ext, $other, $ajxpNode->getUrl()))) {
$ajxpNode->mergeMetadata(array("video_altversion_" . $other => str_replace($ext, $other, $ajxpNode->getPath())));
}
}
}
}
}
示例8: loadNodeInfo
/**
* @param AJXP_Node $ajxpNode
* @param bool $parentNode
* @param bool $details
* @return void
*/
public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
{
$nodeName = basename($ajxpNode->getPath());
$metaData = $ajxpNode->metadata;
if (!isset($metaData["is_file"])) {
$isLeaf = is_file($ajxpNode->getUrl()) || AJXP_Utils::isBrowsableArchive($nodeName);
$metaData["is_file"] = $isLeaf ? "1" : "0";
} else {
$isLeaf = $metaData["is_file"] == "1" ? true : false;
}
$metaData["filename"] = $ajxpNode->getPath();
if (RecycleBinManager::recycleEnabled() && $ajxpNode->getPath() == RecycleBinManager::getRelativeRecycle()) {
$mess = ConfService::getMessages();
$recycleIcon = $this->countFiles($ajxpNode->getUrl(), false, true) > 0 ? "trashcan_full.png" : "trashcan.png";
$metaData["icon"] = $recycleIcon;
$metaData["mimestring"] = $mess[122];
$ajxpNode->setLabel($mess[122]);
$metaData["ajxp_mime"] = "ajxp_recycle";
} else {
$mimeData = AJXP_Utils::mimeData($ajxpNode->getUrl(), !$isLeaf);
$metaData["mimestring_id"] = $mimeData[0];
//AJXP_Utils::mimetype($ajxpNode->getUrl(), "type", !$isLeaf);
$metaData["icon"] = $mimeData[1];
//AJXP_Utils::mimetype($nodeName, "image", !$isLeaf);
if ($metaData["icon"] == "folder.png") {
$metaData["openicon"] = "folder_open.png";
}
if (!$isLeaf) {
$metaData["ajxp_mime"] = "ajxp_folder";
}
}
//if ($lsOptions["l"]) {
$metaData["file_group"] = @filegroup($ajxpNode->getUrl()) || "unknown";
$metaData["file_owner"] = @fileowner($ajxpNode->getUrl()) || "unknown";
$crtPath = $ajxpNode->getPath();
$vRoots = $this->repository->listVirtualRoots();
if (!empty($crtPath)) {
if (!@$this->isWriteable($ajxpNode->getUrl())) {
$metaData["ajxp_readonly"] = "true";
}
if (isset($vRoots[ltrim($crtPath, "/")])) {
$metaData["ajxp_readonly"] = $vRoots[ltrim($crtPath, "/")]["right"] == "r" ? "true" : "false";
}
} else {
if (count($vRoots)) {
$metaData["ajxp_readonly"] = "true";
}
}
$fPerms = @fileperms($ajxpNode->getUrl());
if ($fPerms !== false) {
$fPerms = substr(decoct($fPerms), $isLeaf ? 2 : 1);
} else {
$fPerms = '0000';
}
$metaData["file_perms"] = $fPerms;
$datemodif = $this->date_modif($ajxpNode->getUrl());
$metaData["ajxp_modiftime"] = $datemodif ? $datemodif : "0";
$metaData["bytesize"] = 0;
if ($isLeaf) {
$metaData["bytesize"] = $this->filesystemFileSize($ajxpNode->getUrl());
}
$metaData["filesize"] = AJXP_Utils::roundSize($metaData["bytesize"]);
if (AJXP_Utils::isBrowsableArchive($nodeName)) {
$metaData["ajxp_mime"] = "ajxp_browsable_archive";
}
if ($details == "minimal") {
$miniMeta = array("is_file" => $metaData["is_file"], "filename" => $metaData["filename"], "bytesize" => $metaData["bytesize"], "ajxp_modiftime" => $metaData["ajxp_modiftime"]);
$ajxpNode->mergeMetadata($miniMeta);
} else {
$ajxpNode->mergeMetadata($metaData);
}
}
示例9: 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);
}
示例10: 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);
}
}
}
示例11: 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);
}
示例12: enrichNode
/**
* @param AJXP_Node $ajxpNode
* @return void
*/
public function enrichNode(&$ajxpNode)
{
// Try both
$aws = $this->getAwsService();
if ($aws == null) {
return;
}
if (isset(self::$metaCache[$ajxpNode->getPath()])) {
$data = self::$metaCache[$ajxpNode->getPath()];
} else {
AJXP_Logger::debug("Should retrieve metadata for " . $ajxpNode->getPath());
$response = $aws->get_object_metadata($this->bucketName, ltrim($ajxpNode->getPath(), "/"));
self::$metaCache[$ajxpNode->getPath()] = $response["Headers"];
$data = self::$metaCache[$ajxpNode->getPath()];
}
$allMeta = array();
foreach ($data as $amzKey => $value) {
$parts = explode("-", $amzKey);
$all[$parts[0]] = $value;
}
$ajxpNode->mergeMetadata($allMeta);
}