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


PHP eZContentLanguage::prioritizedLanguageCodes方法代码示例

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


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

示例3: 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

示例4: 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

示例5: canInstantiateLanguages

 function canInstantiateLanguages()
 {
     if (is_array($this->CanInstantiateLanguages)) {
         return array_intersect(eZContentLanguage::prioritizedLanguageCodes(), $this->CanInstantiateLanguages);
     }
     return array();
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:7,代码来源:ezcontentclass.php

示例6: fetchPrioritizedLanguageCodes

 public static function fetchPrioritizedLanguageCodes()
 {
     $languageCodes = eZContentLanguage::prioritizedLanguageCodes();
     if ($languageCodes === null) {
         $result = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
     } else {
         $result = array('result' => $languageCodes);
     }
     return $result;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:10,代码来源:ezcontentfunctioncollection.php

示例7: 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

示例8: array

if (!$node instanceof eZContentObjectTreeNode) {
    $node = eZContentObjectTreeNode::fetch((int) $nodeID);
    if (!$node instanceof eZContentObjectTreeNode) {
        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 {
开发者ID:netgen,项目名称:ngpush,代码行数:31,代码来源:push_node.php


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