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


PHP eZContentLanguage::definition方法代码示例

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


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

示例1: fetchList

 /**
  * Fetches the list of the languages used on the site.
  *
  * \param forceReloading Optional. If true, the list will be fetched from database even if it is cached in memory.
  *                       Default value is false.
  * \return Array of the eZContentLanguage objects of languages used on the site.
  * \static
  */
 static function fetchList($forceReloading = false)
 {
     if (isset($GLOBALS['eZContentLanguageList']) && $forceReloading === false) {
         return $GLOBALS['eZContentLanguageList'];
     }
     $cachePath = eZSys::cacheDirectory() . '/ezcontentlanguage_cache.php';
     $clusterFileHandler = eZClusterFileHandler::instance($cachePath);
     if ($forceReloading || !$clusterFileHandler->fileExists($cachePath)) {
         $languages = eZPersistentObject::fetchObjectList(eZContentLanguage::definition());
         $clusterFileHandler->fileStoreContents($cachePath, serialize($languages), 'content', 'php');
     } else {
         $languages = unserialize($clusterFileHandler->fetchContents());
         // If for some reason unserialize operation fails, we force the cache file to regenerate
         // See http://issues.ez.no/18613
         if ($languages === false) {
             eZDebug::writeError("An error occurred while reading content language cache file {$cachePath}. File is being re-generated", __METHOD__);
             return self::fetchList(true);
         }
     }
     unset($GLOBALS['eZContentLanguageList']);
     unset($GLOBALS['eZContentLanguageMask']);
     $GLOBALS['eZContentLanguageList'] = array();
     $mask = 1;
     // we want have 0-th bit set too!
     foreach ($languages as $language) {
         $GLOBALS['eZContentLanguageList'][$language->attribute('id')] = $language;
         $mask += $language->attribute('id');
     }
     $GLOBALS['eZContentLanguageMask'] = $mask;
     return $GLOBALS['eZContentLanguageList'];
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:39,代码来源:ezcontentlanguage.php

示例2: fetchList

    /**
     * Fetches the list of the languages used on the site.
     *
     * \param forceReloading Optional. If true, the list will be fetched from database even if it is cached in memory.
     *                       Default value is false.
     * \return Array of the eZContentLanguage objects of languages used on the site.
     * \static
     */
    static function fetchList( $forceReloading = false )
    {
        if( isset( $GLOBALS['eZContentLanguageList'] ) && $forceReloading === false )
            return $GLOBALS['eZContentLanguageList'];

        $cachePath = eZSys::cacheDirectory() . '/ezcontentlanguage_cache.php';
        $clusterFileHandler = eZClusterFileHandler::instance( $cachePath );

        if( $forceReloading || !$clusterFileHandler->fileExists( $cachePath ) )
        {
            $languages = eZPersistentObject::fetchObjectList( eZContentLanguage::definition() );
            $clusterFileHandler->fileStoreContents( $cachePath, serialize( $languages ), 'content', 'php' );
        }
        else
            $languages = unserialize( $clusterFileHandler->fetchContents() );

        unset( $GLOBALS['eZContentLanguageList'] );
        unset( $GLOBALS['eZContentLanguageMask'] );
        $GLOBALS['eZContentLanguageList'] = array();
        $mask = 1; // we want have 0-th bit set too!
        foreach ( $languages as $language )
        {
            $GLOBALS['eZContentLanguageList'][$language->attribute( 'id' )] = $language;
            $mask += $language->attribute( 'id' );
        }

        $GLOBALS['eZContentLanguageMask'] = $mask;

        return $GLOBALS['eZContentLanguageList'];
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:38,代码来源:ezcontentlanguage.php


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