当前位置: 首页>>代码示例>>PHP>>正文


PHP eZURLAliasML::fetchByAction方法代码示例

本文整理汇总了PHP中eZURLAliasML::fetchByAction方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::fetchByAction方法的具体用法?PHP eZURLAliasML::fetchByAction怎么用?PHP eZURLAliasML::fetchByAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZURLAliasML的用法示例。


在下文中一共展示了eZURLAliasML::fetchByAction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:26,代码来源:ezpLanguageSwitcherFunctionCollection.php

示例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;
     }
 }
开发者ID:netgen,项目名称:nglanguageswitcher,代码行数:27,代码来源:nglanguageswitchertemplatefunctions.php

示例3: runOperation

 function runOperation(&$node)
 {
     $target_parent_node_id = $this->target_id;
     if (empty($target_parent_node_id)) {
         if ($this->move_to_depth >= $node->attribute('depth')) {
             return false;
         }
         // Find the correct target node for the specified depth
         $path_array = $node->attribute('path_array');
         $target_parent_node_id = $path_array[$this->move_to_depth - 1];
     }
     $assigned_nodes = $node->attribute('object')->attribute('assigned_nodes');
     // Find the target node
     foreach ($assigned_nodes as $target_node) {
         if ($target_node->attribute('parent_node_id') == $target_parent_node_id) {
             $target_node_id = $target_node->attribute('node_id');
             // Make sure target node is not us
             if ($node->attribute('node_id') == $target_node_id) {
                 return false;
             }
             $urlalias_list = eZURLAliasML::fetchByAction('eznode', $node->attribute('node_id'));
             $target_node_urlalias_list = eZURLAliasML::fetchByAction('eznode', $target_node_id);
             // Sanity check, this should never happen
             if (!isset($target_node_urlalias_list[0])) {
                 eZDebug::writeError('Found no url alias records for node with id ' . $target_node_id, 'batchtool/nodemerge');
                 return false;
             }
             $target_node_urlalias_id = $target_node_urlalias_list[0]->attribute('id');
             $target_parent_urlalias_id = $target_node_urlalias_list[0]->attribute('parent');
             $db = eZDB::instance();
             $db->begin();
             // Make sure any children nodes are moved to the new node
             foreach ($node->attribute('children') as $child) {
                 moveNode($child, $target_node_id);
             }
             // Make sure any bookmarks are moved to the new node
             $bookmark_list = eZPersistentObject::fetchObjectList(eZContentBrowseBookmark::definition(), null, array('node_id' => $node->attribute('node_id')));
             foreach ($bookmark_list as $bookmark) {
                 $bookmark->setAttribute('node_id', $target_node_id);
                 $bookmark->store();
             }
             // Remove the node in question
             $node->removeNodeFromTree(true);
             // Set up url alias redirects to the new node
             foreach ($urlalias_list as $url_alias) {
                 $url_alias->setAttribute('action', 'eznode:' . $target_node_id);
                 $url_alias->setAttribute('action_type', 'eznode');
                 $url_alias->setAttribute('link', $target_node_urlalias_id);
                 $url_alias->setAttribute('is_original', 0);
                 $url_alias->store();
             }
             $db->commit();
             return true;
         }
     }
     return false;
 }
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:57,代码来源:nodemerge.php

示例4: 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;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:47,代码来源:ezplanguageswitcher.php

示例5: testSetLangMaskAlwaysAvailable

 public function testSetLangMaskAlwaysAvailable()
 {
     $nodeID = mt_rand();
     // Create an ezurlalias_ml entry
     $url = eZURLAliasML::create(__FUNCTION__ . $nodeID, "eznode:" . $nodeID, 0, 2);
     $url->store();
     // Update lang_mask by setting always available,
     eZURLAliasML::setLangMaskAlwaysAvailable(2, "eznode", $nodeID);
     // Verify that language mask was increased to 3.
     $urls = eZURLAliasML::fetchByAction('eznode', $nodeID);
     self::assertEquals(3, (int) $urls[0]->attribute('lang_mask'));
     // Update lang_mask by removing always available,
     eZURLAliasML::setLangMaskAlwaysAvailable(false, "eznode", $nodeID);
     // Verify that language mask was reduced back to 2.
     $urls = eZURLAliasML::fetchByAction('eznode', $nodeID);
     self::assertEquals(2, (int) $urls[0]->attribute('lang_mask'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:17,代码来源:urlaliasml_test.php

示例6: updateSubTreePath

 function updateSubTreePath($updateParent = true, $nodeMove = false)
 {
     $changeCount = 0;
     $nodeID = $this->attribute('node_id');
     $parentNodeID = $this->attribute('parent_node_id');
     // Avoid recursion due to database inconsistencies
     if ($nodeID === $parentNodeID) {
         eZDebug::writeError("Parent node ID equals node ID for node: {$nodeID}. The node cannot be a parent of itself!", __METHOD__);
         return false;
     }
     // Only set name if current node is not the content root
     $ini = eZINI::instance('content.ini');
     $contentRootID = $ini->variable('NodeSettings', 'RootNode');
     $obj = $this->object();
     $alwaysMask = $obj->attribute('language_mask') & 1;
     $languages = $obj->allLanguages();
     $nameList = array();
     $initialLanguageID = $obj->attribute('initial_language_id');
     $pathIdentificationName = false;
     foreach ($languages as $language) {
         $nodeName = '';
         if ($nodeID != $contentRootID) {
             $objClass = $obj->attribute('content_class');
             $nodeName = $objClass->urlAliasName($obj, false, $language->attribute('locale'));
             $nodeName = eZURLAliasFilter::processFilters($nodeName, $language, $this);
             $nodeName = eZURLAliasML::convertToAlias($nodeName, 'node_' . $nodeID);
             $nodeName = $this->adjustPathElement($nodeName, $nodeMove);
             // Compatibility mode:
             // Store name for the 'path_identification_string' column.
             if ($initialLanguageID == $language->attribute('id')) {
                 $pathIdentificationName = eZURLAliasML::convertToAliasCompat($nodeName, 'node_' . $nodeID);
             }
         }
         $nameList[] = array('text' => $nodeName, 'language' => $language);
     }
     $parentActionName = "eznode";
     $parentActionValue = $parentNodeID;
     $parentElementID = false;
     $existingElements = eZURLAliasML::fetchByAction("eznode", $nodeID);
     $existingElementID = null;
     if (count($existingElements) > 0) {
         $existingElementID = $existingElements[0]->attribute('id');
         $parentElementID = $existingElements[0]->attribute('parent');
     }
     // If we have parent element it means the node is already published
     // and we have to see if it has been moved
     if ($parentNodeID != 1 and $updateParent) {
         $parents = eZURLAliasML::fetchByAction("eznode", $parentNodeID);
         if (count($parents) == 0) {
             $parentNode = $this->fetchParent();
             if (!$parentNode) {
                 return false;
             }
             $result = $parentNode->updateSubTreePath();
             if (!$result) {
                 return false;
             }
             $parents = eZURLAliasML::fetchByAction($parentActionName, $parentActionValue);
             if (count($parents) == 0) {
                 return false;
             }
             $oldParentElementID = $parentElementID;
             foreach ($parents as $paren) {
                 $parentElementID = 0;
                 if ($paren->attribute('text') != '') {
                     $parentElementID = (int) $paren->attribute('link');
                     break;
                 }
             }
         } else {
             $oldParentElementID = $parentElementID;
             $parentElementID = 0;
             foreach ($parents as $paren) {
                 if ($paren->attribute('text') != '') {
                     $parentElementID = (int) $paren->attribute('link');
                     break;
                 }
             }
         }
     } else {
     }
     $this->updatePathIdentificationString($pathIdentificationName);
     $languageID = $obj->attribute('initial_language_id');
     $cleanup = false;
     foreach ($nameList as $nameEntry) {
         $text = $nameEntry['text'];
         $language = $nameEntry['language'];
         $result = eZURLAliasML::storePath($text, 'eznode:' . $nodeID, $language, false, $alwaysMask, $parentElementID, $cleanup);
         if ($result['status'] === true) {
             $changeCount++;
         }
     }
     return $changeCount;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:94,代码来源:ezcontentobjecttreenode.php

示例7: logError

     $newSourceWildcard = $rowsw[0]['destination_url'];
     if (!preg_match("#^(.*)\\{1\\}\$#", $newSourceWildcard, $matches)) {
         logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $rowsw[0]['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $newSourceWildcard = $matches[1];
     $sourceWildcard = $newSourceWildcard;
 }
 $toPathSQL = $db->escapeString($toPath);
 $query = "SELECT * FROM ezurlalias WHERE source_url = '{$toPathSQL}' AND is_wildcard = 0 AND forward_to_id = 0";
 $rowsw = $db->arrayQuery($query);
 if (count($rowsw) > 0) {
     list($action, $alwaysAvailable) = decodeAction($rowsw[0]['destination_url']);
     list($actionType, $actionValue) = explode(":", $action, 2);
     $elements = eZURLAliasML::fetchByAction($actionType, $actionValue);
     if ($elements) {
         $toPath = $elements[0]->getPath();
     }
 }
 $elements = eZURLAliasML::fetchByPath($toPath);
 if (count($elements) == 0) {
     // Referenced url does not exist
     logError("The referenced path '{$toPath}' can not be found among the new URL alias entries, url entry ID is " . $row['id']);
     list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
     continue;
 }
 // Fetch the ID of the element to redirect to.
 $linkID = $elements[0]->attribute('id');
 $action = $elements[0]->attribute('action');
 if ($action == 'nop:') {
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:updateniceurls.php

示例8: generateNodeListCache

    /**
     * Generates caches for all the urls of nodes in $nodeList.
     *
     * The associative array must have on of these entries:
     * - node_id - ID of the node
     * - path_identification_string - The path_identification_string from the node table, is used to fetch the node ID if node_id is missing.
     *
     * @param array $nodeList An array with node entries, each entry is either the node ID or an associative array.
     */
    public function generateNodeListCache( $nodeList )
    {
        $db = eZDB::instance();

        foreach ( $nodeList as $uri )
        {
            if ( is_array( $uri ) )
            {
                if ( !isset( $uri['node_id'] ) )
                {
                    eZDebug::writeError( "node_id is not set for uri entry " . var_export( $uri ) . ", will need to perform extra query to get node_id" );
                    $node = eZContentObjectTreeNode::fetchByURLPath( $uri['path_identification_string'] );
                    $nodeID = (int)$node->attribute( 'node_id' );
                }
                else
                {
                    $nodeID = (int)$uri['node_id'];
                }
            }
            else
            {
                $nodeID = (int)$uri;
            }
            $elements = eZURLAliasML::fetchByAction( 'eznode', $nodeID, true, true, true );
            foreach ( $elements as $element )
            {
                $path = $element->getPath();
                $this->cacheURL( '/' . $path );
            }
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:40,代码来源:ezstaticcache.php

示例9: 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;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:64,代码来源:ezplanguageswitcher.php

示例10: generateNodeListCache

 /**
  * Generates caches for all the urls of nodes in $nodeList.
  *
  * The associative array must have on of these entries:
  * - node_id - ID of the node
  * - path_identification_string - The path_identification_string from the node table, is used to fetch the node ID if node_id is missing.
  *
  * @param array $nodeList An array with node entries, each entry is either the node ID or an associative array.
  */
 public function generateNodeListCache($nodeList)
 {
     $delay = eZINI::instance('staticcache.ini')->variable('CacheSettings', 'CronjobCacheClear') == 'enabled';
     /*
     echo "\n\nNodeList:<br />\n\n";
     print_r($nodeList); //die();
     */
     /*
     foreach ($nodeList as $node)
     {
         $nodeID = (int)$node;
         $elements = eZURLAliasML::fetchByAction( 'eznode', $nodeID, true, true, true );
         foreach ( $elements as $element )
         {
             $path = $element->getPath();
             $nodeListUrls[]='/' . $path;
         }
     }
     echo '<pre>'; print_r($nodeListUrls); echo '</pre>'."\n\n\n";
     die();
     */
     $db = eZDB::instance();
     foreach ($nodeList as $uri) {
         if (is_array($uri)) {
             if (!isset($uri['node_id'])) {
                 eZDebug::writeError("node_id is not set for uri entry " . var_export($uri) . ", will need to perform extra query to get node_id");
                 $node = eZContentObjectTreeNode::fetchByURLPath($uri['path_identification_string']);
                 $nodeID = (int) $node->attribute('node_id');
             } else {
                 $nodeID = (int) $uri['node_id'];
             }
         } else {
             $nodeID = (int) $uri;
         }
         $elements = eZURLAliasML::fetchByAction('eznode', $nodeID, true, true, true);
         foreach ($elements as $element) {
             $path = $element->getPath();
             // print_r("cacheUrl: $path <hr/>\n\n");
             $this->cacheURL('/' . $path, false, false, $delay);
         }
     }
     //die();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:52,代码来源:ezecosystemstaticcache.php

示例11: nodeId2Urls

 private function nodeId2Urls($nodeId)
 {
     $return = array();
     $elements = eZURLAliasML::fetchByAction('eznode', $nodeId, false, false, true);
     foreach ($elements as $element) {
         $return[] = '/' . $element->getPath();
     }
     if ($this->purgeSystemUrls) {
         $return[] = '/content/view/full/' . $nodeId;
     }
     return $return;
 }
开发者ID:yannschepens,项目名称:mugo_varnish,代码行数:12,代码来源:StaticCacheMugoVarnish.php


注:本文中的eZURLAliasML::fetchByAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。