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


PHP Translate::getLanguageLoaded方法代码示例

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


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

示例1: completeKey

 protected function completeKey($cacheKey)
 {
     $pluginManager = PluginManager::getInstance();
     $pluginNames = $pluginManager->getLoadedPluginsName();
     $cacheKey = $cacheKey . md5(implode('', $pluginNames)) . Translate::getLanguageLoaded();
     return $cacheKey;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:7,代码来源:PluginAwareStaticCache.php

示例2: getEnglishTranslationForFeatureName

 private function getEnglishTranslationForFeatureName($featureName)
 {
     if (Translate::getLanguageLoaded() == 'en') {
         return $featureName;
     }
     $translationKeyForFeature = Translate::findTranslationKeyForTranslation($featureName);
     return Piwik::translate($translationKeyForFeature, array(), 'en');
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:API.php

示例3: getEnglishTranslationForFeatureName

 private function getEnglishTranslationForFeatureName($featureName)
 {
     $loadedLanguage = Translate::getLanguageLoaded();
     if ($loadedLanguage == 'en') {
         return $featureName;
     }
     $translationKeyForFeature = $this->findTranslationKeyForFeatureName($featureName);
     if (!empty($translationKeyForFeature)) {
         Translate::reloadLanguage('en');
         $featureName = Piwik::translate($translationKeyForFeature);
         Translate::reloadLanguage($loadedLanguage);
         return $featureName;
     }
     return $featureName;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:15,代码来源:API.php

示例4: get

 public function get($idSite, $period, $date, $apiModule, $apiAction, $graphType = false, $outputType = API::GRAPH_OUTPUT_INLINE, $columns = false, $labels = false, $showLegend = true, $width = false, $height = false, $fontSize = API::DEFAULT_FONT_SIZE, $legendFontSize = false, $aliasedGraph = true, $idGoal = false, $colors = false, $textColor = API::DEFAULT_TEXT_COLOR, $backgroundColor = API::DEFAULT_BACKGROUND_COLOR, $gridColor = API::DEFAULT_GRID_COLOR, $idSubtable = false, $legendAppendMetric = true, $segment = false)
 {
     Piwik::checkUserHasViewAccess($idSite);
     // Health check - should we also test for GD2 only?
     if (!SettingsServer::isGdExtensionEnabled()) {
         throw new Exception('Error: To create graphs in Piwik, please enable GD php extension (with Freetype support) in php.ini,
         and restart your web server.');
     }
     $useUnicodeFont = array('am', 'ar', 'el', 'fa', 'fi', 'he', 'ja', 'ka', 'ko', 'te', 'th', 'zh-cn', 'zh-tw');
     $languageLoaded = Translate::getLanguageLoaded();
     $font = self::getFontPath(self::DEFAULT_FONT);
     if (in_array($languageLoaded, $useUnicodeFont)) {
         $unicodeFontPath = self::getFontPath(self::UNICODE_FONT);
         $font = file_exists($unicodeFontPath) ? $unicodeFontPath : $font;
     }
     // save original GET to reset after processing. Important for API-in-API-call
     $savedGET = $_GET;
     try {
         $apiParameters = array();
         if (!empty($idGoal)) {
             $apiParameters = array('idGoal' => $idGoal);
         }
         // Fetch the metadata for given api-action
         $metadata = APIMetadata::getInstance()->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $languageLoaded, $period, $date, $hideMetricsDoc = false, $showSubtableReports = true);
         if (!$metadata) {
             throw new Exception('Invalid API Module and/or API Action');
         }
         $metadata = $metadata[0];
         $reportHasDimension = !empty($metadata['dimension']);
         $constantRowsCount = !empty($metadata['constantRowsCount']);
         $isMultiplePeriod = Period::isMultiplePeriod($date, $period);
         if (!$reportHasDimension && !$isMultiplePeriod) {
             throw new Exception('The graph cannot be drawn for this combination of \'date\' and \'period\' parameters.');
         }
         if (empty($legendFontSize)) {
             $legendFontSize = (int) $fontSize + self::DEFAULT_LEGEND_FONT_SIZE_OFFSET;
         }
         if (empty($graphType)) {
             if ($isMultiplePeriod) {
                 $graphType = StaticGraph::GRAPH_TYPE_BASIC_LINE;
             } else {
                 if ($constantRowsCount) {
                     $graphType = StaticGraph::GRAPH_TYPE_VERTICAL_BAR;
                 } else {
                     $graphType = StaticGraph::GRAPH_TYPE_HORIZONTAL_BAR;
                 }
             }
             $reportUniqueId = $metadata['uniqueId'];
             if (isset(self::$DEFAULT_GRAPH_TYPE_OVERRIDE[$reportUniqueId][$isMultiplePeriod])) {
                 $graphType = self::$DEFAULT_GRAPH_TYPE_OVERRIDE[$reportUniqueId][$isMultiplePeriod];
             }
         } else {
             $availableGraphTypes = StaticGraph::getAvailableStaticGraphTypes();
             if (!in_array($graphType, $availableGraphTypes)) {
                 throw new Exception(Piwik::translate('General_ExceptionInvalidStaticGraphType', array($graphType, implode(', ', $availableGraphTypes))));
             }
         }
         $width = (int) $width;
         $height = (int) $height;
         if (empty($width)) {
             $width = self::$DEFAULT_PARAMETERS[$graphType][self::WIDTH_KEY];
         }
         if (empty($height)) {
             $height = self::$DEFAULT_PARAMETERS[$graphType][self::HEIGHT_KEY];
         }
         // Cap width and height to a safe amount
         $width = min($width, self::MAX_WIDTH);
         $height = min($height, self::MAX_HEIGHT);
         $reportColumns = array_merge(!empty($metadata['metrics']) ? $metadata['metrics'] : array(), !empty($metadata['processedMetrics']) ? $metadata['processedMetrics'] : array(), !empty($metadata['metricsGoal']) ? $metadata['metricsGoal'] : array(), !empty($metadata['processedMetricsGoal']) ? $metadata['processedMetricsGoal'] : array());
         $ordinateColumns = array();
         if (empty($columns)) {
             $ordinateColumns[] = empty($reportColumns[self::DEFAULT_ORDINATE_METRIC]) ? key($metadata['metrics']) : self::DEFAULT_ORDINATE_METRIC;
         } else {
             $ordinateColumns = explode(',', $columns);
             foreach ($ordinateColumns as $column) {
                 if (empty($reportColumns[$column])) {
                     throw new Exception(Piwik::translate('ImageGraph_ColumnOrdinateMissing', array($column, implode(',', array_keys($reportColumns)))));
                 }
             }
         }
         $ordinateLabels = array();
         foreach ($ordinateColumns as $column) {
             $ordinateLabels[$column] = $reportColumns[$column];
         }
         // sort and truncate filters
         $defaultFilterTruncate = self::$DEFAULT_PARAMETERS[$graphType][self::TRUNCATE_KEY];
         switch ($graphType) {
             case StaticGraph::GRAPH_TYPE_3D_PIE:
             case StaticGraph::GRAPH_TYPE_BASIC_PIE:
                 if (count($ordinateColumns) > 1) {
                     // pChart doesn't support multiple series on pie charts
                     throw new Exception("Pie charts do not currently support multiple series");
                 }
                 $_GET['filter_sort_column'] = reset($ordinateColumns);
                 $this->setFilterTruncate($defaultFilterTruncate);
                 break;
             case StaticGraph::GRAPH_TYPE_VERTICAL_BAR:
             case StaticGraph::GRAPH_TYPE_BASIC_LINE:
                 if (!$isMultiplePeriod && !$constantRowsCount) {
                     $this->setFilterTruncate($defaultFilterTruncate);
//.........这里部分代码省略.........
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:101,代码来源:API.php

示例5: languageAware

 public static function languageAware($cacheId)
 {
     return $cacheId . '-' . Translate::getLanguageLoaded();
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:4,代码来源:CacheId.php

示例6: completeKey

 protected function completeKey($cacheKey)
 {
     return $cacheKey . Translate::getLanguageLoaded();
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:4,代码来源:LanguageAwareStaticCache.php


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