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


PHP eZContentLanguage::setPrioritizedLanguages方法代码示例

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


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

示例1: testIssue19174

 /**
  * Regression test for issue {@see #19174 http://issues.ez.no/19174}
  */
 public function testIssue19174()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     // add a secondary language
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // create related objects
     $relatedObjectsIds = array($this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation());
     $xmlTextEn = "<embed href=\"ezobject://{$relatedObjectsIds[0]}\" /><link href=\"ezobject://{$relatedObjectsIds[1]}\">link</link>";
     $xmlTextFr = "<embed href=\"ezobject://{$relatedObjectsIds[2]}\" /><link href=\"ezobject://{$relatedObjectsIds[3]}\">link</link>";
     // Create an article in eng-GB, and embed related object one in the intro
     $article = new ezpObject('article', 2, 14, 1, 'eng-GB');
     $article->title = __METHOD__ . ' eng-GB';
     $article->intro = $xmlTextEn;
     $articleId = $article->publish();
     // Workaround as setting folder->name directly doesn't produce the expected result
     $article->addTranslation('fre-FR', array('title' => __METHOD__ . ' fre-FR', 'intro' => $xmlTextFr));
     $relatedObjects = eZContentObject::fetch($articleId)->relatedObjects(false, false, 0, false, array('AllRelations' => eZContentObject::RELATION_LINK | eZContentObject::RELATION_EMBED));
     self::assertEquals(4, count($relatedObjects));
     $expectedRelations = array_flip($relatedObjectsIds);
     foreach ($relatedObjects as $relatedObject) {
         if (isset($expectedRelations[$relatedObject->ID])) {
             unset($expectedRelations[$relatedObject->ID]);
         }
     }
     self::assertEquals(0, count($expectedRelations));
     $article->remove();
     $translation->removeThis();
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:33,代码来源:ezxmltexttype_regression.php

示例2: modify

 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
 {
     $ret = '';
     switch ($operatorName) {
         case 'get_url_alias_by_lang':
             $node = eZContentObjectTreeNode::fetch($namedParameters['node_id'], $namedParameters['lang_code']);
             $originalPrioritizedLanguages = eZContentLanguage::prioritizedLanguageCodes();
             eZContentLanguage::setPrioritizedLanguages(array($namedParameters['lang_code']));
             $urlAlias = '';
             if (is_object($node)) {
                 $urlAlias = '/' . $node->urlAlias();
             }
             eZContentLanguage::setPrioritizedLanguages($originalPrioritizedLanguages);
             $ret = $urlAlias;
             break;
     }
     $operatorValue = $ret;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:18,代码来源:langHelper.php

示例3: testIssue17632

    /**
     * Regression test for issue {@see #17632 http://issues.ez.no/17632}
     *
     * In a multi language environment, a node fetched with a language other than the prioritized one(s) will return the
     * URL alias in the prioritized language
     */
    public function testIssue17632()
    {
        $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();

        $strNameEngGB = __FUNCTION__ . " eng-GB";
        $strNameFreFR = __FUNCTION__ . " fre-FR";

        // add a secondary language
        $locale = eZLocale::instance( 'fre-FR' );
        $translation = eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );

        // set the prioritize language list to contain english
        // ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'fre-FR' ) );
        eZContentLanguage::setPrioritizedLanguages( array( 'fre-FR' ) );

        // Create an object with data in fre-FR and eng-GB
        $folder = new ezpObject( 'folder', 2, 14, 1, 'eng-GB' );
        $folder->publish();

        // Workaround as setting folder->name directly doesn't produce the expected result
        $folder->addTranslation( 'eng-GB', array( 'name' => $strNameEngGB ) );
        $folder->addTranslation( 'fre-FR', array( 'name' => $strNameFreFR ) );

        $nodeId = $folder->main_node_id;

        // fetch the node with no default parameters. Should return the french URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId );
        self::assertEquals( 'testIssue17632-fre-FR' , $node->attribute( 'url_alias' ) );

        // fetch the node in english. Should return the english URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId, 'eng-GB' );
        self::assertEquals( 'testIssue17632-eng-GB' , $node->attribute( 'url_alias' ) );

        ezpINIHelper::restoreINISettings();
        eZContentLanguage::setPrioritizedLanguages( $bkpLanguages );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:42,代码来源:ezcontentobjecttreenode_regression.php

示例4: getPath

 function getPath($locale = null, $incomingLanguageList = null)
 {
     if ($this->Path !== null) {
         return $this->Path;
     }
     // Fetch path 'text' elements of correct parent path
     $path = array($this->Text);
     $id = (int) $this->Parent;
     $db = eZDB::instance();
     while ($id != 0) {
         $query = "SELECT parent, lang_mask, text FROM ezurlalias_ml WHERE id={$id}";
         if ($locale !== null && is_string($locale)) {
             // We also want to consider the prioritized language list for the
             // destination siteaccess, so that untranslated objects, are not
             // disregarded from the URL.
             if ($incomingLanguageList !== null) {
                 eZContentLanguage::setPrioritizedLanguages($incomingLanguageList);
             }
             $langMask = trim(eZContentLanguage::languagesSQLFilter('ezurlalias_ml', 'lang_mask'));
             $query .= " AND ({$langMask})";
         }
         $rows = $db->arrayQuery($query);
         if (count($rows) == 0) {
             if ($incomingLanguageList !== null) {
                 eZContentLanguage::clearPrioritizedLanguages();
             }
             break;
         }
         $result = eZURLAliasML::choosePrioritizedRow($rows);
         if ($incomingLanguageList !== null) {
             eZContentLanguage::clearPrioritizedLanguages();
         }
         if (!$result) {
             $result = $rows[0];
         }
         $id = (int) $result['parent'];
         array_unshift($path, $result['text']);
     }
     $this->Path = implode('/', $path);
     return $this->Path;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:41,代码来源:ezurlaliasml.php

示例5: initializePackage


//.........这里部分代码省略.........
         // ezcontentclass_name
         $updateSql = "UPDATE ezcontentclass_name\nSET\nlanguage_locale='{$primaryLanguageLocaleCode}'\nWHERE\nlanguage_locale='eng-GB'";
         $db->query($updateSql);
         // use high-level api, because it's impossible to update serialized names with direct sqls.
         // use direct access to 'NameList' to avoid unnecessary sql-requests and because
         // we do 'replacement' of existing language(with some 'id') with another language code.
         $contentClassList = eZContentClass::fetchList();
         foreach ($contentClassList as $contentClass) {
             $classAttributes = $contentClass->fetchAttributes();
             foreach ($classAttributes as $classAttribute) {
                 $classAttribute->NameList->setName($classAttribute->NameList->name('eng-GB'), $primaryLanguageLocaleCode);
                 $classAttribute->NameList->setAlwaysAvailableLanguage($primaryLanguageLocaleCode);
                 $classAttribute->NameList->removeName('eng-GB');
                 $classAttribute->store();
             }
             $contentClass->NameList->setName($contentClass->NameList->name('eng-GB'), $primaryLanguageLocaleCode);
             $contentClass->NameList->setAlwaysAvailableLanguage($primaryLanguageLocaleCode);
             $contentClass->NameList->removeName('eng-GB');
             $contentClass->NameList->setHasDirtyData(false);
             // to not update 'ezcontentclass_name', because we've already updated it.
             $contentClass->store();
         }
     }
     // Setup all languages
     foreach ($allLanguages as $languageObject) {
         $primaryLanguageObj = eZContentLanguage::fetchByLocale($languageObject->localeCode());
         // Add it if it is missing (most likely)
         if (!$primaryLanguageObj) {
             $primaryLanguageObj = eZContentLanguage::addLanguage($languageObject->localeCode(), $languageObject->internationalLanguageName());
         }
     }
     eZContentLanguage::expireCache();
     // Make sure priority list is changed to the new chosen languages
     eZContentLanguage::setPrioritizedLanguages($prioritizedLanguages);
     if ($siteType['existing_database'] != eZStepInstaller::DB_DATA_KEEP) {
         $user = eZUser::instance(14);
         // Must be initialized to make node assignments work correctly
         if (!is_object($user)) {
             $resultArray['errors'][] = array('code' => 'EZSW-020', 'text' => "Could not fetch administrator user object");
             return false;
         }
         // Make sure Admin is the currently logged in user
         // This makes sure all new/changed objects get this as creator
         $user->loginCurrent();
         // by default(if 'language_map' is not set) create all necessary languages
         $languageMap = isset($this->PersistenceList['package_info']) && isset($this->PersistenceList['package_info']['language_map']) ? $this->PersistenceList['package_info']['language_map'] : true;
         if (is_array($languageMap) && count($languageMap) > 0) {
             //
             // Create necessary languages and set them as "prioritized languages" to avoid
             // drawbacks in fetch functions, like eZContentObjectTreeNode::fetch().
             //
             $prioritizedLanguageObjects = eZContentLanguage::prioritizedLanguages();
             // returned objects
             foreach ($languageMap as $fromLanguage => $toLanguage) {
                 if ($toLanguage != 'skip') {
                     $prioritizedLanguageObjects[] = eZContentLanguage::fetchByLocale($toLanguage, true);
                 }
             }
             $prioritizedLanguageLocales = array();
             foreach ($prioritizedLanguageObjects as $language) {
                 $locale = $language->attribute('locale');
                 if (!in_array($locale, $prioritizedLanguageLocales)) {
                     $prioritizedLanguageLocales[] = $locale;
                 }
             }
             eZContentLanguage::setPrioritizedLanguages($prioritizedLanguageLocales);
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:67,代码来源:ezstep_create_sites.php

示例6: clearPrioritizedLanguages

 /**
  * Clears the prioritized language list set by eZContentLanguage::setPrioritizedLanguages and reloading
  * the list from INI settings.
  *
  * \static
  */
 static function clearPrioritizedLanguages()
 {
     eZContentLanguage::setPrioritizedLanguages(false);
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:10,代码来源:ezcontentlanguage.php

示例7: subTreeCountByNodeID

 static function subTreeCountByNodeID($params = array(), $nodeID)
 {
     if (!is_numeric($nodeID) and !is_array($nodeID)) {
         return null;
     }
     $language = isset($params['Language']) ? $params['Language'] : false;
     if ($language) {
         if (!is_array($language)) {
             $language = array($language);
         }
         eZContentLanguage::setPrioritizedLanguages($language);
     }
     $depth = isset($params['Depth']) && is_numeric($params['Depth']) ? $params['Depth'] : false;
     $depthOperator = isset($params['DepthOperator']) ? $params['DepthOperator'] : false;
     $pathStringCond = '';
     $notEqParentString = '';
     // If the node(s) doesn't exist we return null.
     if (!eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($pathStringCond, $notEqParentString, $nodeID, $depth, $depthOperator)) {
         return null;
     }
     $db = eZDB::instance();
     $ini = eZINI::instance();
     // Check for class filtering
     $classCondition = '';
     if (isset($params['ClassFilterType']) and isset($params['ClassFilterArray']) and ($params['ClassFilterType'] == 'include' or $params['ClassFilterType'] == 'exclude') and count($params['ClassFilterArray']) > 0) {
         $classCondition = '  ';
         $i = 0;
         $classCount = count($params['ClassFilterArray']);
         $classIDArray = array();
         foreach ($params['ClassFilterArray'] as $classID) {
             $originalClassID = $classID;
             // Check if classes are recerenced by identifier
             if (is_string($classID) && !is_numeric($classID)) {
                 $classID = eZContentClass::classIDByIdentifier($classID);
             }
             if (is_numeric($classID)) {
                 $classIDArray[] = $classID;
             } else {
                 eZDebugSetting::writeWarning('kernel-content-class', "Invalid class identifier in subTree() classfilterarray, classID : " . $originalClassID);
             }
         }
         if (count($classIDArray) > 0) {
             $classCondition .= " ezcontentobject.contentclass_id ";
             if ($params['ClassFilterType'] == 'include') {
                 $classCondition .= " IN ";
             } else {
                 $classCondition .= " NOT IN ";
             }
             $classIDString = implode(', ', $classIDArray);
             $classCondition .= ' ( ' . $classIDString . ' ) AND';
         }
     }
     // Main node check
     $mainNodeOnlyCond = '';
     if (isset($params['MainNodeOnly']) && $params['MainNodeOnly'] === true) {
         $mainNodeOnlyCond = 'ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id AND';
     }
     $languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     $objectNameLanguageFilter = eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
     if ($language) {
         eZContentLanguage::clearPrioritizedLanguages();
     }
     $objectNameFilter = isset($params['ObjectNameFilter']) ? $params['ObjectNameFilter'] : false;
     $attributeFilterParam = isset($params['AttributeFilter']) ? $params['AttributeFilter'] : false;
     $sortingInfo = array('sortCount' => 0, 'attributeJoinCount' => 0);
     $attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($attributeFilterParam, $sortingInfo, $language);
     if ($attributeFilter === false) {
         return null;
     }
     $objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString($objectNameFilter);
     $extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings($params['ExtendedAttributeFilter']);
     // Determine whether we should show invisible nodes.
     $ignoreVisibility = isset($params['IgnoreVisibility']) ? $params['IgnoreVisibility'] : false;
     $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(!$ignoreVisibility);
     $limitation = isset($params['Limitation']) && is_array($params['Limitation']) ? $params['Limitation'] : false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
     $query = "SELECT\n                        count( DISTINCT ezcontentobject_tree.node_id ) as count\n                  FROM\n                       ezcontentobject_tree\n                       INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id)\n                       INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n                       INNER JOIN ezcontentobject_name ON (\n                           ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND\n                           ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version\n                       )\n                       {$attributeFilter['from']}\n                       {$extendedAttributeFilter['tables']}\n                       {$sqlPermissionChecking['from']}\n                  WHERE {$pathStringCond}\n                        {$extendedAttributeFilter['joins']}\n                        {$mainNodeOnlyCond}\n                        {$classCondition}\n                        {$attributeFilter['where']}\n                        ezcontentclass.version=0 AND\n                        {$notEqParentString}\n                        {$objectNameLanguageFilter}\n                        {$showInvisibleNodesCond}\n                        {$sqlPermissionChecking['where']}\n                        {$objectNameFilterSQL}\n                        {$languageFilter} ";
     $server = count($sqlPermissionChecking['temp_tables']) > 0 ? eZDBInterface::SERVER_SLAVE : false;
     $nodeListArray = $db->arrayQuery($query, array(), $server);
     // cleanup temp tables
     $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
     return $nodeListArray[0]['count'];
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:84,代码来源:ezcontentobjecttreenode.php

示例8: fetchLatestTags

 /**
  * Fetches latest modified tags by specified parameters
  *
  * @static
  *
  * @param int|bool $parentTagID
  * @param int $limit
  * @param mixed $language
  *
  * @return array
  */
 public static function fetchLatestTags($parentTagID = false, $limit = 0, $language = false)
 {
     $parentTagID = (int) $parentTagID;
     $filterArray = array();
     $filterArray['main_tag_id'] = 0;
     $filterArray['id'] = array('!=', $parentTagID);
     if ($parentTagID > 0) {
         $filterArray['path_string'] = array('like', '%/' . $parentTagID . '/%');
     }
     if ($language) {
         if (!is_array($language)) {
             $language = array($language);
         }
         eZContentLanguage::setPrioritizedLanguages($language);
     }
     $result = eZTagsObject::fetchList($filterArray, array('offset' => 0, 'limit' => $limit), array('modified' => 'desc'));
     if ($language) {
         eZContentLanguage::clearPrioritizedLanguages();
     }
     if (is_array($result) && !empty($result)) {
         return array('result' => $result);
     }
     return array('result' => false);
 }
开发者ID:oki34,项目名称:eztags,代码行数:35,代码来源:eztagsfunctioncollection.php

示例9: testIssue23753

 /**
  * Regression test for issue {@see #23753 http://issues.ez.no/23753}
  *
  * In a multi language environment, an untranslated node fetched with default language will return the
  * full URL alias in the language of the node.
  */
 public function testIssue23753()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     $strNameEngGB = __FUNCTION__ . " eng-GB";
     $strNameFreFR = __FUNCTION__ . " fre-FR";
     // add a secondary language
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // set the prioritize language list to contain english
     eZContentLanguage::setPrioritizedLanguages(array('fre-FR', 'eng-GB'));
     // Create an object with data in fre-FR and eng-GB
     $folder = new ezpObject('folder', 2, 14, 1, 'eng-GB');
     $folder->publish();
     // Workaround as setting folder->name directly doesn't produce the expected result
     $folder->addTranslation('eng-GB', array('name' => $strNameEngGB));
     $folder->addTranslation('fre-FR', array('name' => $strNameFreFR));
     $article = new ezpObject('article', $folder->main_node_id, 14, 1, 'eng-GB');
     $article->publish();
     // Workaround as setting article->name directly doesn't produce the expected result
     $article->addTranslation('eng-GB', array('title' => $strNameEngGB));
     $nodeId = $article->main_node_id;
     // fetch the node with no default parameters. Should return the french URL Alias when applicable
     $node = eZContentObjectTreeNode::fetch($nodeId);
     self::assertEquals('testIssue23753-fre-FR/testIssue23753-eng-GB', $node->attribute('url_alias'));
     // fetch the node in english. Should return the full english URL Alias
     $node = eZContentObjectTreeNode::fetch($nodeId, 'eng-GB');
     self::assertEquals('testIssue23753-eng-GB/testIssue23753-eng-GB', $node->attribute('url_alias'));
     // Test that PathPrefix is correctly removed from UrlAlias
     ezpINIHelper::setINISetting('site.ini', 'SiteAccessSettings', 'PathPrefix', 'testIssue23753-fre-FR');
     $node = eZContentObjectTreeNode::fetch($nodeId);
     self::assertEquals('testIssue23753-eng-GB', $node->attribute('url_alias'));
     $folder->remove();
     $translation->removeThis();
     ezpINIHelper::restoreINISettings();
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:42,代码来源:ezcontentobjecttreenode_regression.php

示例10: createAndMultipleFilterSqlParts

 /**
  * Creates and returns SQL parts used in fetch functions
  *
  * @param array $params where 'tag_id' is an array of arrays; at least one tag ID from each array must match
  *
  * @return array
  */
 public function createAndMultipleFilterSqlParts($params)
 {
     $returnArray = array('tables' => '', 'joins' => '', 'columns' => '');
     if (!isset($params['tag_id'])) {
         return $returnArray;
     }
     if (is_array($params['tag_id'])) {
         $tagIDsArray = $params['tag_id'];
     } else {
         return $returnArray;
     }
     $returnArray['tables'] = " INNER JOIN eztags_attribute_link i1 ON (i1.object_id = ezcontentobject.id AND i1.objectattribute_version = ezcontentobject.current_version)\n                                   INNER JOIN eztags i2 ON (i1.keyword_id = i2.id)\n                                   INNER JOIN eztags_keyword i3 ON (i2.id = i3.keyword_id)";
     $dbStrings = array();
     $db = eZDB::instance();
     foreach ($tagIDsArray as $tagIDGroup) {
         $tagIDGroup = (array) $tagIDGroup;
         if (!isset($params['include_synonyms']) || isset($params['include_synonyms']) && (bool) $params['include_synonyms'] == true) {
             /** @var eZTagsObject[] $tags */
             $tags = eZTagsObject::fetchList(array('main_tag_id' => array($tagIDGroup)));
             if (is_array($tags)) {
                 foreach ($tags as $tag) {
                     $tagIDGroup[] = $tag->attribute('id');
                 }
             }
         }
         $dbStrings[] = "EXISTS (\n                SELECT 1\n                FROM\n                    eztags_attribute_link j1,\n                    ezcontentobject j2\n                WHERE " . $db->generateSQLINStatement($tagIDGroup, 'j1.keyword_id', false, true, 'int') . " AND j1.object_id = j2.id\n                AND j2.id = ezcontentobject.id\n                AND j1.objectattribute_version = j2.current_version\n            )";
     }
     $dbString = implode(" AND ", $dbStrings);
     if (isset($params['language'])) {
         $language = $params['language'];
         if (!is_array($language)) {
             $language = array($language);
         }
         eZContentLanguage::setPrioritizedLanguages($language);
     }
     $returnArray['joins'] = " {$dbString}\n                                  AND " . eZContentLanguage::languagesSQLFilter('i2') . " AND " . eZContentLanguage::sqlFilter('i3', 'i2') . " AND ";
     if (isset($params['language'])) {
         eZContentLanguage::clearPrioritizedLanguages();
     }
     return $returnArray;
 }
开发者ID:oki34,项目名称:eztags,代码行数:48,代码来源:eztagsattributefilter.php

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

示例12: array

        return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
    }
} else {
    if ($languageCode) {
        $foundInRequestedLanguage = true;
    }
}
// Hacky solution to tackle a bug in eZ Publish prior to version 4.5
// that always fetched url_alias in locale defined in site.ini.
// Not very happy about it, but it works
$urlAlias = $node->urlAlias();
if ($foundInRequestedLanguage) {
    $originalPrioritizedLanguages = eZContentLanguage::prioritizedLanguageCodes();
    eZContentLanguage::setPrioritizedLanguages(array($languageCode));
    $urlAlias = $node->urlAlias();
    eZContentLanguage::setPrioritizedLanguages($originalPrioritizedLanguages);
}
$tagsArray = array();
$keywordArray = array();
foreach ($node->dataMap() as $objectAttribute) {
    if ($objectAttribute->hasContent()) {
        if ($objectAttribute->attribute('data_type_string') == 'eztags') {
            $keywords = str_replace(' ', '', $objectAttribute->content()->keywordString());
            $keywords = explode('|#', $keywords);
            if (is_array($keywords) && !empty($keywords)) {
                $tagsArray = array_merge($tagsArray, $keywords);
            }
        } else {
            if ($objectAttribute->attribute('data_type_string') == 'ezkeyword') {
                $keywords = implode(',', $objectAttribute->content()->KeywordArray);
                $keywords = str_replace(' ', '', $keywords);
开发者ID:netgen,项目名称:ngpush,代码行数:31,代码来源:push_node.php


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