本文整理汇总了PHP中eZURLAliasML::fetchNodeIDByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::fetchNodeIDByPath方法的具体用法?PHP eZURLAliasML::fetchNodeIDByPath怎么用?PHP eZURLAliasML::fetchNodeIDByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::fetchNodeIDByPath方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchContentNode
public static function fetchContentNode($nodeID, $nodePath, $languageCode, $remoteID = false)
{
$contentNode = null;
if ($nodeID) {
if (!isset($languageCode)) {
$languageCode = false;
}
$contentNode = eZContentObjectTreeNode::fetch($nodeID, $languageCode);
} else {
if ($nodePath) {
$nodeID = eZURLAliasML::fetchNodeIDByPath($nodePath);
if ($nodeID) {
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
}
} else {
if ($remoteID) {
$contentNode = eZContentObjectTreeNode::fetchByRemoteID($remoteID);
}
}
}
if ($contentNode === null) {
$retVal = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
} else {
$retVal = array('result' => $contentNode);
}
return $retVal;
}
示例2: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case 'ngurl':
if (empty($namedParameters['siteaccess'])) {
return;
}
$ini = eZSiteAccess::getIni($namedParameters['siteaccess'], 'site.ini');
$destinationLocale = $ini->variable('RegionalSettings', 'ContentObjectLocale');
$siteLanguageList = $ini->variable('RegionalSettings', 'SiteLanguageList');
$nodeID = eZURLAliasML::fetchNodeIDByPath($operatorValue);
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeID, $destinationLocale, false);
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
if ($this->isModuleUrl($operatorValue) || $this->isCurrentLocaleAvailable($siteLanguageList)) {
$destinationUrl = $operatorValue;
} else {
$destinationUrl = '';
}
} else {
$destinationUrl = $destinationElement[0]->getPath($destinationLocale, $siteLanguageList);
}
$siteaccessUrlMapping = eZINI::instance('nglanguageswitcher.ini')->variable('LanguageSwitcher', 'SiteAccessUrlMapping');
$destinationUrl = eZURI::encodeURL($destinationUrl);
$operatorValue = rtrim($siteaccessUrlMapping[$namedParameters['siteaccess']], '/') . '/' . ltrim($destinationUrl, '/');
break;
}
}
示例3: fetchUrlAlias
public function fetchUrlAlias($nodeId = null, $path = null, $locale)
{
if (!$nodeId && !$path) {
return array('result' => false);
}
if (empty($locale) || !is_string($locale)) {
return array('result' => false);
}
if (is_numeric($nodeId)) {
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, $locale, false);
} else {
if (is_string($path)) {
$nodeId = eZURLAliasML::fetchNodeIDByPath($path);
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, $locale, false);
}
}
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
// Either no translation exists for $locale or $path was not pointing to a node
return array('result' => false);
}
$currentLanguageCodes = eZContentLanguage::prioritizedLanguageCodes();
array_unshift($currentLanguageCodes, $locale);
$currentLanguageCodes = array_unique($currentLanguageCodes);
$urlAlias = $destinationElement[0]->getPath($locale, $currentLanguageCodes);
return array('result' => $urlAlias);
}
示例4: fclose
}
}
fclose($handle);
} else {
$cli->output("Warning: Cannot open apache log-file '{$logFilePath}' for reading, please check permissions and try again.");
}
} else {
$cli->output("Warning: apache log-file '{$logFilePath}' doesn't exist, please check your ini-settings and try again.");
}
// Process the content of $pathHashCounter to transform it into $nodeIDHashCounter
foreach ($pathHashCounter as $path => $count) {
$nodeID = eZURLAliasML::fetchNodeIDByPath($path);
// Support for PathPrefix
for ($pathPrefixIndex = 0; !$nodeID && $pathPrefixIndex < $pathPrefixesCount; ++$pathPrefixIndex) {
// Try prepending each of the existing pathPrefixes, to see if one of them matches an existing node
$nodeID = eZURLAliasML::fetchNodeIDByPath($pathPrefixes[$pathPrefixIndex] . $path);
}
if ($nodeID) {
if (!isset($nodeIDHashCounter[$nodeID])) {
$nodeIDHashCounter[$nodeID] = $count;
} else {
$nodeIDHashCounter[$nodeID] += $count;
}
}
}
foreach ($nodeIDHashCounter as $nodeID => $count) {
if (eZContentObjectTreeNode::fetch($nodeID) != null) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
$counter->setAttribute('count', $count);
示例5: destinationUrl
/**
* Returns URL alias for the specified <var>$locale</var>
*
* @param string $url
* @param string $locale
* @return void
*/
public function destinationUrl()
{
$nodeId = $this->origUrl;
if (!is_numeric($this->origUrl)) {
$nodeId = eZURLAliasML::fetchNodeIDByPath($this->origUrl);
}
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, $this->destinationLocale, false);
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
// If the return of fetchByAction is empty, it can mean a couple
// of different things:
// Either we are looking at a module, and we should pass the
// original URL on
//
// Or we are looking at URL which does not exist in the
// destination siteaccess, for instance an untranslated object. In
// which case we will point to the root of the site, unless it is
// available as a fallback.
if ($this->isUrlPointingToModule($this->origUrl) || $this->isLocaleAvailableAsFallback()) {
// We have a module, we're keeping the orignal url.
$urlAlias = $this->origUrl;
} else {
// We probably have an untranslated object, which is not
// available with SiteLanguageList setting, we direct to root.
$urlAlias = '';
}
} else {
// Translated object found, forwarding to new URL.
$saIni = $this->getSiteAccessIni();
$siteLanguageList = $saIni->variable('RegionalSettings', 'SiteLanguageList');
$urlAlias = $destinationElement[0]->getPath($this->destinationLocale, $siteLanguageList);
$urlAlias .= $this->userParamString;
}
$this->baseDestinationUrl = rtrim($this->baseDestinationUrl, '/');
if ($GLOBALS['eZCurrentAccess']['type'] === eZSiteAccess::TYPE_URI) {
$finalUrl = $this->baseDestinationUrl . '/' . $this->destinationSiteAccess . '/' . $urlAlias;
} else {
$finalUrl = $this->baseDestinationUrl . '/' . $urlAlias;
}
return $finalUrl;
}
示例6: fetchNodeByTranslation
/**
* Attempts to fetch a possible node by translating the provided
* string/path to a node-number.
*
* @param string $nodePathString Eg. 'Folder1/file1.txt'
* @return eZContentObject Eg. the node of 'Folder1/file1.txt'
*/
protected function fetchNodeByTranslation($nodePathString)
{
// Get rid of possible extensions, remove .jpeg .txt .html etc..
$nodePathString = $this->fileBasename($nodePathString);
// Strip away last slash
if (strlen($nodePathString) > 0 and $nodePathString[strlen($nodePathString) - 1] === '/') {
$nodePathString = substr($nodePathString, 0, strlen($nodePathString) - 1);
}
if (strlen($nodePathString) > 0) {
$nodePathString = eZURLAliasML::convertPathToAlias($nodePathString);
}
$nodeID = eZURLAliasML::fetchNodeIDByPath($nodePathString);
if ($nodeID == 2) {
// added by @ds 2008-12-07 to fix problems with IE6 SP2
$ini = eZINI::instance('webdav.ini');
if ($ini->hasVariable('GeneralSettings', 'StartNode')) {
$nodeID = $ini->variable('GeneralSettings', 'StartNode');
}
} elseif ($nodeID) {
} else {
return false;
}
// Attempt to fetch the node.
$node = eZContentObjectTreeNode::fetch($nodeID);
// Return the node.
return $node;
}
示例7: fetchNodeByTranslation
function fetchNodeByTranslation( $nodePathString )
{
// Get rid of possible extensions, remove .jpeg .txt .html etc..
$nodePathString = $this->fileBasename( $nodePathString );
// Strip away last slash
if ( strlen( $nodePathString ) > 0 and
$nodePathString[strlen( $nodePathString ) - 1] == '/' )
{
$nodePathString = substr( $nodePathString, 0, strlen( $nodePathString ) - 1 );
}
if ( strlen( $nodePathString ) > 0 )
{
$nodePathString = eZURLAliasML::convertPathToAlias( $nodePathString );
}
// Attempt to get nodeID from the URL.
$nodeID = eZURLAliasML::fetchNodeIDByPath( $nodePathString );
if ( $nodeID )
{
$this->appendLogEntry( "NodeID: $nodeID", 'CS:fetchNodeByTranslation' );
}
else
{
$this->appendLogEntry( "No nodeID", 'CS:fetchNodeByTranslation' );
return false;
}
// Attempt to fetch the node.
$node = eZContentObjectTreeNode::fetch( $nodeID );
// Return the node.
return $node;
}
示例8: decodeNodeID
static function decodeNodeID($subtreeExpiryParameter)
{
$nodeID = false;
if (!is_numeric($subtreeExpiryParameter)) {
$nodePathString = '';
// clean up $subtreeExpiryParameter
$subtreeExpiryParameter = trim($subtreeExpiryParameter, '/');
$nodeID = false;
$subtree = $subtreeExpiryParameter;
if ($subtree == '') {
// 'subtree_expiry' is empty => use root node.
$nodeID = 2;
} else {
$nonAliasPath = 'content/view/full/';
if (strpos($subtree, $nonAliasPath) === 0) {
// 'subtree_expiry' is like 'content/view/full/2'
$nodeID = (int) substr($subtree, strlen($nonAliasPath));
} else {
// 'subtree_expiry' is url_alias
$nodeID = eZURLAliasML::fetchNodeIDByPath($subtree);
if (!$nodeID) {
eZDebug::writeError("Could not find path_string '{$subtree}' for 'subtree_expiry' node.", 'eZTemplateCacheBlock::subtreeExpiryCacheDir()');
} else {
$nodeID = (int) $nodeID;
}
}
}
} else {
$nodeID = (int) $subtreeExpiryParameter;
}
return $nodeID;
}
示例9: foreach
}
} else {
$cli->output("Warning: apache log-file '{$logFilePath}' doesn't exist, please check your ini-settings and try again.");
}
foreach ($nodeIDArray as $nodeID) {
$nodeObject = eZContentObjectTreeNode::fetch($nodeID);
if ($nodeObject != null) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
}
$counter->increase();
}
}
foreach ($pathArray as $path) {
$nodeID = eZURLAliasML::fetchNodeIDByPath($path);
if ($nodeID) {
$counter = eZViewCounter::fetch($nodeID);
if ($counter == null) {
$counter = eZViewCounter::create($nodeID);
}
$counter->increase();
}
}
$dt = new eZDateTime();
$fh = fopen($updateViewLogPath, "w");
if ($fh) {
fwrite($fh, "# Finished at " . $dt->toString() . "\n");
fwrite($fh, "# Last updated entry:" . "\n");
fwrite($fh, $lastLine . "\n");
fclose($fh);
示例10: findNodeFromPath
/**
* @param string $path
* @param MerckManualShowcase $app
* @return bool|eZContentObjectTreeNode
*/
public static function findNodeFromPath( $path, &$app )
{
/* We remove the publisher folder id at the beginning of the url as we already have it */
$path = preg_replace('#^/\d+/#', '/', $path );
$manualAppNode = eZContentObjectTreeNode::fetch( self::rootNodeId() );
$manualAppNodePathName = $manualAppNode->pathWithNames();
$tabNodePath = explode('/', substr($path, 1));
$remoteId = end($tabNodePath);
if(preg_match('/^[a-f0-9]{32}$/', $remoteId))
{
$nodeRemote = eZContentObjectTreeNode::fetchByRemoteID($remoteId);
if($nodeRemote instanceof eZContentObjectTreeNode)
{
$app->fullContext = 'topic';
return $nodeRemote;
}
}
$pathParts = explode('/', substr($path, 1));
if ( $pathParts[0] == 'table' )
{
$app->fullContext = 'table';
return eZContentObjectTreeNode::fetch($pathParts[1]);
}
// Url with topic
list($sectionName, $chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
// Url without topic
$matches = array();
if ( preg_match('/media-([a-z]+)/', $topicName, $matches) )
{
list($sectionName, $chapterName, $mediaType, $mediaName, $other) = $pathParts;
$topicName = null;
}
// Full section
if ( $sectionName != null && is_null( $chapterName ) && is_null( $topicName ) )
{
$app->fullContext = 'section';
$app->section = MerckManualFunctionCollection::fetchSection('url', $sectionName);
return eZContentObjectTreeNode::fetch(MerckManualShowcase::rootNodeId());
}
if ( $sectionName == 'about-us' )
{
list($chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
}
$path = $manualAppNodePathName;
// Full of chapter
if ( $chapterName )
{
$app->fullContext = 'chapter';
$path .= '/' . $chapterName;
}
// Full of topic
if ( $topicName )
{
$app->fullContext = 'topic';
$path .= '/' . $topicName;
}
$nodeId = eZURLAliasML::fetchNodeIDByPath($path);
if ( $nodeId )
{
if ( $mediaName )
{
$mediaType = str_replace('media-', '', $mediaType);
// Get media node
// Full of html table image
// /topic_name/(media-image-file)/oscar2/filename
if ( $mediaType == 'image-file' )
{
$app->fullContext = $mediaType;
$app->oscarFolder = $mediaName;
$app->mediaName = $other;
}
// Full of inline audio, video, image
elseif ( $mediaType )
{
// Construct the remote_id of the media folder
/* @type $dataMap eZContentObjectAttribute[] */
$contentObject = eZContentObject::fetchByNodeID($nodeId);
$dataMap = $contentObject->dataMap();
$publisherAttrContent = $dataMap['publisher']->content();
//.........这里部分代码省略.........
示例11: destinationUrl
/**
* Returns URL alias for the specified <var>$locale</var>
*
* @param string $url
* @param string $locale
* @return void
*/
public function destinationUrl()
{
$nodeId = $this->origUrl;
$urlAlias = '';
if (!is_numeric($this->origUrl)) {
if (!$this->isUrlPointingToModule($this->origUrl)) {
$this->origUrl = self::addPathPrefixIfNeeded($this->origUrl);
}
$nodeId = eZURLAliasML::fetchNodeIDByPath($this->origUrl);
}
$siteLanguageList = $this->getSiteAccessIni()->variable('RegionalSettings', 'SiteLanguageList');
// set prioritized languages of destination SA, and fetch corresponding (prioritized) URL alias
eZContentLanguage::setPrioritizedLanguages($siteLanguageList);
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, false, true);
eZContentLanguage::clearPrioritizedLanguages();
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
// If the return of fetchByAction is empty, it can mean a couple
// of different things:
// Either we are looking at a module, and we should pass the
// original URL on
//
// Or we are looking at URL which does not exist in the
// destination siteaccess, for instance an untranslated object. In
// which case we will point to the root of the site, unless it is
// available as a fallback.
if ($nodeId) {
$urlAlias = $this->origUrl;
// if applicable, remove destination PathPrefix from url
if (!self::removePathPrefixIfNeeded($this->getSiteAccessIni(), $urlAlias)) {
// If destination siteaccess has a PathPrefix but url is not matched,
// also check current SA's prefix, and remove if it matches.
self::removePathPrefixIfNeeded(eZINI::instance('site.ini'), $urlAlias);
}
} else {
if ($this->isUrlPointingToModule($this->origUrl)) {
$urlAlias = $this->origUrl;
}
}
} else {
// Translated object found, forwarding to new URL.
$urlAlias = $destinationElement[0]->getPath($this->destinationLocale, $siteLanguageList);
// if applicable, remove destination PathPrefix from url
self::removePathPrefixIfNeeded($this->getSiteAccessIni(), $urlAlias);
$urlAlias .= $this->userParamString;
}
$this->baseDestinationUrl = rtrim($this->baseDestinationUrl, '/');
$ini = eZINI::instance();
if ($GLOBALS['eZCurrentAccess']['type'] === eZSiteAccess::TYPE_URI && !($ini->variable('SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess') === "enabled" && $ini->variable('SiteSettings', 'DefaultAccess') == $this->destinationSiteAccess)) {
$finalUrl = $this->baseDestinationUrl . '/' . $this->destinationSiteAccess . '/' . $urlAlias;
} else {
$finalUrl = $this->baseDestinationUrl . '/' . $urlAlias;
}
if ($this->queryString != '') {
$finalUrl .= '?' . $this->queryString;
}
return $finalUrl;
}
示例12: findNodeFromPath
/**
* @param string $path
* @param MerckManualAbout $app
* @return eZContentObjectTreeNode
*/
public static function findNodeFromPath( $path, $app )
{
/* We remove the publisher folder id at the beginning of the url as we already have it */
$path = preg_replace('#^/\d+/#', '/', $path );
$aboutNode = eZContentObjectTreeNode::fetch( $app->rootNodeId() );
$pathParts = explode( '/', substr( $path, 1 ) );
$path = $aboutNode->attribute( 'url_alias' ) . '/' . $pathParts[0];
$nodeId = eZURLAliasML::fetchNodeIDByPath( $path );
if ( $nodeId )
{
$app->fullContext = 'topic';
return eZContentObjectTreeNode::fetch( $nodeId );
}
}
示例13: modify
/**
* @param $tpl eZTemplate
* @param $operatorName array
* @param $operatorParameters array
* @param $rootNamespace string
* @param $currentNamespace string
* @param $operatorValue mixed
* @param $namedParameters array
*
* @return mixed
*/
function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$ini = eZINI::instance('ocoperatorscollection.ini');
$appini = eZINI::instance('app.ini');
switch ($operatorName) {
case 'related_attribute_objects':
$object = $operatorValue;
$identifier = $namedParameters['identifier'];
$dataMap = $object instanceof eZContentObject || $object instanceof eZContentObjectTreeNode ? $object->attribute('data_map') : array();
$data = array();
if (isset($dataMap[$identifier])) {
$ids = $dataMap[$identifier] instanceof eZContentObjectAttribute ? explode('-', $dataMap[$identifier]->toString()) : array();
if (!empty($ids)) {
$data = eZContentObject::fetchList(true, array("id" => array($ids)));
}
}
$operatorValue = $data;
break;
case 'smart_override':
$identifier = $namedParameters['identifier'];
$view = $namedParameters['view'];
$node = $operatorValue;
$operatorValue = $this->findSmartTemplate($identifier, $view, $node);
break;
case 'parse_link_href':
$href = $operatorValue;
$hrefParts = explode(':', $href);
$hrefFirst = array_shift($hrefParts);
if (!in_array($hrefFirst, array('http', 'https', 'file', 'mailto', 'ftp'))) {
if (!empty($hrefFirst)) {
$nodeID = eZURLAliasML::fetchNodeIDByPath('/' . $hrefFirst);
if ($nodeID) {
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
if ($contentNode instanceof eZContentObjectTreeNode) {
$keyArray = array(array('node', $contentNode->attribute('node_id')), array('object', $contentNode->attribute('contentobject_id')), array('class_identifier', $contentNode->attribute('class_identifier')), array('class_group', $contentNode->attribute('object')->attribute('content_class')->attribute('match_ingroup_id_list')));
$tpl = new eZTemplate();
$ini = eZINI::instance();
$autoLoadPathList = $ini->variable('TemplateSettings', 'AutoloadPathList');
$extensionAutoloadPath = $ini->variable('TemplateSettings', 'ExtensionAutoloadPath');
$extensionPathList = eZExtension::expandedPathList($extensionAutoloadPath, 'autoloads/');
$autoLoadPathList = array_unique(array_merge($autoLoadPathList, $extensionPathList));
$tpl->setAutoloadPathList($autoLoadPathList);
$tpl->autoload();
$tpl->setVariable('node', $contentNode);
$tpl->setVariable('object', $contentNode->attribute('object'));
$tpl->setVariable('original_href', $href);
$res = new eZTemplateDesignResource();
$res->setKeys($keyArray);
$tpl->registerResource($res);
$result = trim($tpl->fetch('design:link/href.tpl'));
if (!empty($result)) {
$href = $result;
}
}
}
}
}
return $operatorValue = $href;
break;
case 'gmap_static_image':
try {
$cacheFileNames = array();
//@todo
$operatorValue = OCOperatorsCollectionsTools::gmapStaticImage($namedParameters['parameters'], $namedParameters['attribute'], $cacheFileNames);
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), 'gmap_static_image');
}
break;
case 'fa_class_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$node = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : $faIconIni->variable('ClassIcons', '_fallback');
if ($node instanceof eZContentObjectTreeNode) {
if ($faIconIni->hasVariable('ClassIcons', $node->attribute('class_identifier'))) {
$data = $faIconIni->variable('ClassIcons', $node->attribute('class_identifier'));
}
}
$operatorValue = $data;
break;
case 'fa_object_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$object = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : '';
if ($object instanceof eZContentObject) {
if ($faIconIni->hasVariable('ObjectIcons', $object->attribute('id'))) {
$data = $faIconIni->variable('ObjectIcons', $object->attribute('id'));
}
} else {
if ($faIconIni->hasVariable('ObjectIcons', $node)) {
//.........这里部分代码省略.........
示例14: uploadImage
/**
* Handles image upload operation
*
* @static
*/
public static function uploadImage()
{
$contentINI = eZINI::instance('ezstyleeditor.ini');
$rep = $contentINI->variable('StyleEditor', 'ImageRepository');
if (is_numeric($rep)) {
$contentNode = eZContentObjectTreeNode::fetch($rep);
} else {
$nodeID = eZURLAliasML::fetchNodeIDByPath($rep);
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
}
$upload = new eZContentUpload();
$location = false;
if (is_object($contentNode)) {
$location = $contentNode->attribute('node_id');
}
$http = eZHTTPTool::instance();
$fileName = '';
if ($http->hasPostVariable('FileName')) {
$fileName = $http->postVariable('FileName');
}
$success = $upload->handleUpload($result, 'File', $location, false, $fileName);
}