本文整理汇总了PHP中AJXP_Node::getRealFile方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::getRealFile方法的具体用法?PHP AJXP_Node::getRealFile怎么用?PHP AJXP_Node::getRealFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::getRealFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateJpegsCallback
public function generateJpegsCallback($masterFile, $targetFile)
{
$unoconv = $this->getFilteredOption("UNOCONV");
if (!empty($unoconv)) {
$officeExt = array('xls', 'xlsx', 'ods', 'doc', 'docx', 'odt', 'ppt', 'pptx', 'odp', 'rtf');
} else {
$unoconv = false;
}
$extension = pathinfo($masterFile, PATHINFO_EXTENSION);
$node = new AJXP_Node($masterFile);
$masterFile = $node->getRealFile();
if (DIRECTORY_SEPARATOR == "\\") {
$masterFile = str_replace("/", "\\", $masterFile);
}
$wrappers = stream_get_wrappers();
$wrappers_re = '(' . join('|', $wrappers) . ')';
$isStream = preg_match("!^{$wrappers_re}://!", $targetFile) === 1;
if ($isStream) {
$backToStreamTarget = $targetFile;
$targetFile = tempnam(AJXP_Utils::getAjxpTmpDir(), "imagick_") . ".pdf";
}
$workingDir = dirname($targetFile);
$out = array();
$return = 0;
$tmpFileThumb = str_replace(".{$extension}", ".jpg", $targetFile);
if (DIRECTORY_SEPARATOR == "\\") {
$tmpFileThumb = str_replace("/", "\\", $tmpFileThumb);
}
if (!$this->extractAll) {
//register_shutdown_function("unlink", $tmpFileThumb);
} else {
@set_time_limit(90);
}
chdir($workingDir);
if ($unoconv !== false && in_array(strtolower($extension), $officeExt)) {
$unoDoc = preg_replace("/(-[0-9]+)?\\.jpg/", "_unoconv.pdf", $tmpFileThumb);
if (!is_file($unoDoc)) {
if (stripos(PHP_OS, "win") === 0) {
$unoconv = $this->pluginConf["UNOCONV"] . " -o " . escapeshellarg(basename($unoDoc)) . " -f pdf " . escapeshellarg($masterFile);
} else {
$unoconv = "HOME=/tmp " . $unoconv . " --stdout -f pdf " . escapeshellarg($masterFile) . " > " . escapeshellarg(basename($unoDoc));
}
exec($unoconv, $out, $return);
}
if (is_file($unoDoc)) {
$masterFile = basename($unoDoc);
}
}
if ($this->onTheFly) {
$pageNumber = strrchr($targetFile, "-");
$pageNumber = str_replace(array(".jpg", "-"), "", $pageNumber);
$pageLimit = "[" . $pageNumber . "]";
$this->extractAll = true;
} else {
if (!$this->useOnTheFly) {
$pageLimit = $this->extractAll ? "" : "[0]";
} else {
$pageLimit = "[0]";
if ($this->extractAll) {
$tmpFileThumb = str_replace(".jpg", "-0.jpg", $tmpFileThumb);
}
}
}
$customOptions = $this->getFilteredOption("IM_CUSTOM_OPTIONS");
$customEnvPath = $this->getFilteredOption("ADDITIONAL_ENV_PATH");
$viewerQuality = $this->getFilteredOption("IM_VIEWER_QUALITY");
$thumbQuality = $this->getFilteredOption("IM_THUMB_QUALITY");
if (empty($customOptions)) {
$customOptions = "";
}
if (!empty($customEnvPath)) {
putenv("PATH=" . getenv("PATH") . ":" . $customEnvPath);
}
$params = $customOptions . " " . ($this->extractAll ? $viewerQuality : $thumbQuality);
$cmd = $this->getFilteredOption("IMAGE_MAGICK_CONVERT") . " " . escapeshellarg($masterFile . $pageLimit) . " " . $params . " " . escapeshellarg($tmpFileThumb);
$this->logDebug("IMagick Command : {$cmd}");
session_write_close();
// Be sure to give the hand back
exec($cmd, $out, $return);
if (is_array($out) && count($out)) {
throw new AJXP_Exception(implode("\n", $out));
}
if (!$this->extractAll) {
rename($tmpFileThumb, $targetFile);
if ($isStream) {
$this->logDebug("Copy preview file to remote", $backToStreamTarget);
copy($targetFile, $backToStreamTarget);
unlink($targetFile);
}
} else {
if ($isStream) {
if (is_file(str_replace(".{$extension}", "", $targetFile))) {
$targetFile = str_replace(".{$extension}", "", $targetFile);
}
if (is_file($targetFile)) {
$this->logDebug("Copy preview file to remote", $backToStreamTarget);
copy($targetFile, $backToStreamTarget);
unlink($targetFile);
}
$this->logDebug("Searching for ", str_replace(".jpg", "-0.jpg", $tmpFileThumb));
//.........这里部分代码省略.........
示例2: 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]);
}
}
示例3: extractMimeHeaders
/**
* @param AJXP_Node $ajxpNode
* @param Boolean $isParent
*/
public function extractMimeHeaders(&$ajxpNode, $isParent = false)
{
if ($isParent) {
return;
}
$currentNode = $ajxpNode->getUrl();
$metadata = $ajxpNode->metadata;
$wrapperClassName = $ajxpNode->wrapperClassName;
$noMail = true;
if ($metadata["is_file"] && ($wrapperClassName == "imapAccessWrapper" || preg_match("/\\.eml\$/i", $currentNode))) {
$noMail = false;
}
if ($wrapperClassName == "imapAccessWrapper" && !$metadata["is_file"]) {
$metadata["mimestring"] = "Mailbox";
}
$parsed = parse_url($currentNode);
if ($noMail || isset($parsed["fragment"]) && strpos($parsed["fragment"], "attachments") === 0) {
EmlParser::$currentListingOnlyEmails = FALSE;
return;
}
if (EmlParser::$currentListingOnlyEmails === NULL) {
EmlParser::$currentListingOnlyEmails = true;
}
if ($wrapperClassName == "imapAccessWrapper") {
$cachedFile = AJXP_Cache::getItem("eml_remote", $currentNode, null, array("EmlParser", "computeCacheId"));
$realFile = $cachedFile->getId();
if (!is_file($realFile)) {
$cachedFile->getData();
// trigger loading!
}
} else {
$realFile = $ajxpNode->getRealFile();
}
$cacheItem = AJXP_Cache::getItem("eml_mimes", $realFile, array($this, "mimeExtractorCallback"));
$data = unserialize($cacheItem->getData());
$data["ajxp_mime"] = "eml";
$data["mimestring"] = "Email";
$metadata = array_merge($metadata, $data);
if ($wrapperClassName == "imapAccessWrapper" && $metadata["eml_attachments"] != "0" && strpos($_SERVER["HTTP_USER_AGENT"], "ajaxplorer-ios") !== false) {
$metadata["is_file"] = false;
$metadata["nodeName"] = basename($currentNode) . "#attachments";
}
$ajxpNode->metadata = $metadata;
}
示例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: setFileSize
/**
* This function initializes the size of the file
* @param AJXP_Node $nodeObject
*/
public function setFileSize($nodeObject)
{
$realpath = $nodeObject->getRealFile();
$realpath = realpath($realpath);
$this->file_size = filesize($realpath);
return;
}
示例6: extractImageMetadata
/**
* Enrich node metadata
* @param AJXP_Node $ajxpNode
*/
public function extractImageMetadata(&$ajxpNode)
{
$currentPath = $ajxpNode->getUrl();
$wrapperClassName = $ajxpNode->wrapperClassName;
$isImage = AJXP_Utils::is_image($currentPath);
$ajxpNode->is_image = $isImage;
if (!$isImage) {
return;
}
$setRemote = false;
$remoteWrappers = $this->getFilteredOption("META_EXTRACTION_REMOTEWRAPPERS");
if (is_string($remoteWrappers)) {
$remoteWrappers = explode(",", $remoteWrappers);
}
$remoteThreshold = $this->getFilteredOption("META_EXTRACTION_THRESHOLD");
if (in_array($wrapperClassName, $remoteWrappers)) {
if ($remoteThreshold != 0 && isset($ajxpNode->bytesize)) {
$setRemote = $ajxpNode->bytesize > $remoteThreshold;
} else {
$setRemote = true;
}
}
if ($isImage) {
if ($setRemote) {
$ajxpNode->image_type = "N/A";
$ajxpNode->image_width = "N/A";
$ajxpNode->image_height = "N/A";
$ajxpNode->readable_dimension = "";
} else {
$realFile = $ajxpNode->getRealFile();
list($width, $height, $type, $attr) = @getimagesize($realFile);
if ($this->getFilteredOption("EXIF_ROTATION")) {
require_once AJXP_INSTALL_PATH . "/plugins/editor.diaporama/PThumb.lib.php";
$pThumb = new PThumb($this->getFilteredOption["THUMBNAIL_QUALITY"], $this->getFilteredOption("EXIF_ROTATION"));
$orientation = $pThumb->exiforientation($realFile, false);
if ($pThumb->rotationsupported($orientation)) {
$ajxpNode->image_exif_orientation = $orientation;
if ($orientation > 4) {
$tmp = $height;
$height = $width;
$width = $tmp;
}
}
}
$ajxpNode->image_type = image_type_to_mime_type($type);
$ajxpNode->image_width = $width;
$ajxpNode->image_height = $height;
$ajxpNode->readable_dimension = $width . "px X " . $height . "px";
}
}
//$this->logDebug("CURRENT NODE IN EXTRACT IMAGE METADATA ", $ajxpNode);
}
示例7: retrieveMetadata
/**
* @abstract
* @param AJXP_Node $ajxpNode
* @param String $nameSpace
* @param bool|String $private
* @param int $scope
* @return array()
*/
public function retrieveMetadata($ajxpNode, $nameSpace, $private = false, $scope = AJXP_METADATA_SCOPE_REPOSITORY)
{
$path = $ajxpNode->getRealFile();
if (!file_exists($path)) {
return array();
}
if (!xattr_supported($path)) {
//throw new Exception("Filesystem does not support Extended Attributes!");
return array();
}
if ($private == AJXP_METADATA_ALLUSERS) {
$startKey = $this->getMetaKey($nameSpace, $scope, "");
$arrMeta = array();
$keyList = xattr_list($path);
foreach ($keyList as $k) {
if (strpos($k, $startKey) === 0) {
$mData = xattr_get($path, $k);
$decData = unserialize(base64_decode($mData));
if (is_array($decData)) {
$arrMeta = array_merge_recursive($arrMeta, $decData);
}
}
}
return $arrMeta;
} else {
$key = $this->getMetaKey($nameSpace, $scope, $this->getUserId($private, $ajxpNode));
$data = xattr_get($path, $key);
$data = unserialize(base64_decode($data));
if (empty($data) || !is_array($data)) {
return array();
}
return $data;
}
}
示例8: extractImageMetadata
/**
* Enrich node metadata
* @param AJXP_Node $ajxpNode
*/
public function extractImageMetadata(&$ajxpNode)
{
$currentPath = $ajxpNode->getUrl();
$wrapperClassName = $ajxpNode->wrapperClassName;
$isImage = AJXP_Utils::is_image($currentPath);
$ajxpNode->is_image = $isImage;
if (!$isImage) {
return;
}
$setRemote = false;
$remoteWrappers = $this->getFilteredOption("META_EXTRACTION_REMOTEWRAPPERS");
if (is_string($remoteWrappers)) {
$remoteWrappers = explode(",", $remoteWrappers);
}
$remoteThreshold = $this->getFilteredOption("META_EXTRACTION_THRESHOLD");
if (in_array($wrapperClassName, $remoteWrappers)) {
if ($remoteThreshold != 0 && isset($ajxpNode->bytesize)) {
$setRemote = $ajxpNode->bytesize > $remoteThreshold;
} else {
$setRemote = true;
}
}
if ($isImage) {
if ($setRemote) {
$ajxpNode->image_type = "N/A";
$ajxpNode->image_width = "N/A";
$ajxpNode->image_height = "N/A";
$ajxpNode->readable_dimension = "";
} else {
$realFile = $ajxpNode->getRealFile();
list($width, $height, $type, $attr) = @getimagesize($realFile);
$ajxpNode->image_type = image_type_to_mime_type($type);
$ajxpNode->image_width = $width;
$ajxpNode->image_height = $height;
$ajxpNode->readable_dimension = $width . "px X " . $height . "px";
}
}
//$this->logDebug("CURRENT NODE IN EXTRACT IMAGE METADATA ", $ajxpNode);
}
示例9: retrieveMetadata
/**
* @abstract
* @param AJXP_Node $ajxpNode
* @param String $nameSpace
* @param bool $private
* @param int $scope
*/
public function retrieveMetadata($ajxpNode, $nameSpace, $private = false, $scope = AJXP_METADATA_SCOPE_REPOSITORY)
{
$path = $ajxpNode->getRealFile();
if (!file_exists($path)) {
return array();
}
$key = $this->getMetaKey($nameSpace, $scope, $this->getUserId($private));
if (!xattr_supported($path)) {
//throw new Exception("Filesystem does not support Extended Attributes!");
return array();
}
$data = xattr_get($path, $key);
$data = unserialize(base64_decode($data));
if (empty($data) || !is_array($data)) {
return array();
}
return $data;
}