public function test_addDirectory_shouldImportOverExistingTranslations() { $translator = new Translator(new JsonFileLoader(), array(__DIR__ . '/Loader/fixtures/dir1')); $this->assertEquals('Hello', $translator->translate('General_test2')); $translator->addDirectory(__DIR__ . '/Loader/fixtures/dir2'); $this->assertEquals('Hello 2', $translator->translate('General_test2')); }
public function getSparklines() { $idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER; $view = new View('@Ecommerce/getSparklines'); $view->onlyConversionOverview = false; $view->conversionsOverViewEnabled = true; if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { $goalDefinition['name'] = $this->translator->translate('Goals_Ecommerce'); $goalDefinition['allow_multiple'] = true; } else { $goals = GoalsApi::getInstance()->getGoals($this->idSite); if (!isset($goals[$idGoal])) { Piwik::redirectToModule('Goals', 'index', array('idGoal' => null)); } $goalDefinition = $goals[$idGoal]; } $this->setGeneralVariablesView($view); $goal = $this->getMetricsForGoal($idGoal); foreach ($goal as $name => $value) { $view->{$name} = $value; } if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { $goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART); foreach ($goal as $name => $value) { $name = 'cart_' . $name; $view->{$name} = $value; } } $view->idGoal = $idGoal; $view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple']; return $view->render(); }
private function getLongErrorMessage() { $message = '<p>'; if (SettingsServer::isWindows()) { $message .= $this->translator->translate( 'Installation_SystemCheckWinPdoAndMysqliHelp', array('<br /><br /><code>extension=php_mysqli.dll</code><br /><code>extension=php_pdo.dll</code><br /><code>extension=php_pdo_mysql.dll</code><br />') ); } else { $message .= $this->translator->translate( 'Installation_SystemCheckPdoAndMysqliHelp', array( '<br /><br /><code>--with-mysqli</code><br /><code>--with-pdo-mysql</code><br /><br />', '<br /><br /><code>extension=mysqli.so</code><br /><code>extension=pdo.so</code><br /><code>extension=pdo_mysql.so</code><br />' ) ); } $message .= $this->translator->translate('Installation_RestartWebServer') . '<br/><br/>'; $message .= $this->translator->translate('Installation_SystemCheckPhpPdoAndMysqli', array( '<a style="color:red" href="http://php.net/pdo">', '</a>', '<a style="color:red" href="http://php.net/mysqli">', '</a>', )); $message .= '</p>'; return $message; }
public function execute() { $isPiwikInstalling = !Config::getInstance()->existsLocalConfig(); if ($isPiwikInstalling) { // Skip the diagnostic if Piwik is being installed return array(); } $label = $this->translator->translate('Installation_DatabaseAbilities'); $optionTable = Common::prefixTable('option'); $testOptionNames = array('test_system_check1', 'test_system_check2'); $loadDataInfile = false; $errorMessage = null; try { $loadDataInfile = Db\BatchInsert::tableInsertBatch($optionTable, array('option_name', 'option_value'), array(array($testOptionNames[0], '1'), array($testOptionNames[1], '2')), $throwException = true); } catch (\Exception $ex) { $errorMessage = str_replace("\n", "<br/>", $ex->getMessage()); } // delete the temporary rows that were created Db::exec("DELETE FROM `{$optionTable}` WHERE option_name IN ('" . implode("','", $testOptionNames) . "')"); if ($loadDataInfile) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, 'LOAD DATA INFILE')); } $comment = sprintf('LOAD DATA INFILE<br/>%s<br/>%s', $this->translator->translate('Installation_LoadDataInfileUnavailableHelp', array('LOAD DATA INFILE', 'FILE')), $this->translator->translate('Installation_LoadDataInfileRecommended')); if ($errorMessage) { $comment .= sprintf('<br/><strong>%s:</strong> %s<br/>%s', $this->translator->translate('General_Error'), $errorMessage, 'Troubleshooting: <a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/troubleshooting/%23faq_194">FAQ on piwik.org</a>'); } return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckWriteDirs'); $result = new DiagnosticResult($label); $directories = Filechecks::checkDirectoriesWritable($this->getDirectories()); $error = false; foreach ($directories as $directory => $isWritable) { if ($isWritable) { $status = DiagnosticResult::STATUS_OK; } else { $status = DiagnosticResult::STATUS_ERROR; $error = true; } $result->addItem(new DiagnosticResultItem($status, $directory)); } if ($error) { $longErrorMessage = $this->translator->translate('Installation_SystemCheckWriteDirsHelp'); $longErrorMessage .= '<ul>'; foreach ($directories as $directory => $isWritable) { if (!$isWritable) { $longErrorMessage .= sprintf('<li><pre>chmod a+w %s</pre></li>', $directory); } } $longErrorMessage .= '</ul>'; $result->setLongErrorMessage($longErrorMessage); } return array($result); }
private function setManageVariables(View $view) { $view->isSuperUser = Piwik::hasUserSuperUserAccess(); $mobileMessagingAPI = API::getInstance(); $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement(); $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided(); $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement; $view->strHelpAddPhone = $this->translator->translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array($this->translator->translate('General_Settings'), $this->translator->translate('MobileMessaging_SettingsMenu'))); $view->creditLeft = 0; $view->provider = ''; if ($view->credentialSupplied && $view->accountManagedByCurrentUser) { $view->provider = $mobileMessagingAPI->getSMSProvider(); $view->creditLeft = $mobileMessagingAPI->getCreditLeft(); } $view->smsProviders = SMSProvider::$availableSMSProviders; // construct the list of countries from the lang files $countries = array(); foreach ($this->regionDataProvider->getCountryList() as $countryCode => $continentCode) { if (isset(CountryCallingCodes::$countryCallingCodes[$countryCode])) { $countries[$countryCode] = array('countryName' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode), 'countryCallingCode' => CountryCallingCodes::$countryCallingCodes[$countryCode]); } } $view->countries = $countries; $view->defaultCountry = Common::getCountry(LanguagesManager::getLanguageCodeForCurrentUser(), true, IP::getIpFromHeader()); $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers(); $this->setBasicVariablesView($view); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckSettings'); $result = new DiagnosticResult($label); foreach ($this->getRequiredSettings() as $setting) { list($settingName, $requiredValue) = explode('=', $setting); $currentValue = (int) ini_get($settingName); if ($currentValue != $requiredValue) { $status = DiagnosticResult::STATUS_ERROR; $comment = sprintf( '%s <br/><br/><em>%s</em><br/><em>%s</em><br/>', $setting, $this->translator->translate('Installation_SystemCheckPhpSetting', array($setting)), $this->translator->translate('Installation_RestartWebServer') ); } else { $status = DiagnosticResult::STATUS_OK; $comment = $setting; } $result->addItem(new DiagnosticResultItem($status, $comment)); } return array($result); }
/** * Renders and echo's HTML that displays the Piwik promo video. */ public function getPromoVideo() { $view = new View('@CoreHome/getPromoVideo'); $view->shareText = $this->translator->translate('CoreHome_SharePiwikShort'); $view->shareTextLong = $this->translator->translate('CoreHome_SharePiwikLong'); $view->promoVideoUrl = 'https://www.youtube.com/watch?v=OslfF_EH81g'; return $view->render(); }
public function render() { $footerMessage = null; if (Common::getRequestVar('widget', false) && Piwik::hasUserSuperUserAccess()) { $footerMessage = $this->translator->translate('CoreHome_OnlyForSuperUserAccess'); } return $this->renderTemplate('getDonateForm', array('footerMessage' => $footerMessage)); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckGDFreeType'); if (SettingsServer::isGdExtensionEnabled()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } $comment = sprintf('%s<br />%s', $this->translator->translate('Installation_SystemCheckGDFreeType'), $this->translator->translate('Installation_SystemCheckGDHelp')); return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckPageSpeedDisabled'); if (!$this->isPageSpeedEnabled()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } $comment = $this->translator->translate('Installation_SystemCheckPageSpeedWarn', array('(eg. Apache, Nginx or IIS)')); return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckUpdateHttps'); if (CoreUpdater\Controller::isUpdatingOverHttps()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } $comment = $this->translator->translate('Installation_SystemCheckUpdateHttpsNotSupported'); return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { $label = $this->translator->translate('SitesManager_Timezone'); if (SettingsServer::isTimezoneSupportEnabled()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } $comment = sprintf('%s<br />%s.', $this->translator->translate('SitesManager_AdvancedTimezoneSupportNotFound'), '<a href="http://php.net/manual/en/datetime.installation.php" rel="noreferrer" target="_blank">Timezone PHP documentation</a>'); return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function ecommerceReport() { if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('CustomVariables')) { throw new Exception("Ecommerce Tracking requires that the plugin Custom Variables is enabled. Please enable the plugin CustomVariables (or ask your admin)."); } $view = $this->getGoalReportView($idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); $view->displayFullReport = false; $view->headline = $this->translator->translate('General_EvolutionOverPeriod'); return $view->render(); }
public function updatePiwik($https = true) { // Simulate that the update over HTTPS fails if ($https) { // The actual error message depends on the OS, the HTTP method etc. // This is what I get on my machine, but it doesn't really matter throw new ArchiveDownloadException(new \Exception('curl_exec: SSL certificate problem: Invalid certificate chain. Hostname requested was: piwik.org'), array()); } // Simulate that the update over HTTP succeeds return array($this->translator->translate('CoreUpdater_DownloadingUpdateFromX', ''), $this->translator->translate('CoreUpdater_UnpackingTheUpdate'), $this->translator->translate('CoreUpdater_VerifyingUnpackedFiles'), $this->translator->translate('CoreUpdater_InstallingTheLatestVersion')); }
public function renderReportMenu(Report $report) { Piwik::checkUserHasSomeViewAccess(); $this->checkSitePermission(); $report->checkIsEnabled(); $menuTitle = $report->getMenuTitle(); if (empty($menuTitle)) { throw new Exception('This report is not supposed to be displayed in the menu, please define a $menuTitle in your report.'); } $menuTitle = $this->translator->translate($menuTitle); $content = $this->renderReportWidget($report); return View::singleReport($menuTitle, $content); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckTracker'); $trackerStatus = Common::getRequestVar('trackerStatus', 0, 'int'); if ($trackerStatus == 0) { $status = DiagnosticResult::STATUS_OK; $comment = ''; } else { $status = DiagnosticResult::STATUS_WARNING; $comment = sprintf('%s<br />%s<br />%s', $trackerStatus, $this->translator->translate('Installation_SystemCheckTrackerHelp'), $this->translator->translate('Installation_RestartWebServer')); } return array(DiagnosticResult::singleResult($label, $status, $comment)); }
private function getHelpMessage($missingExtension) { $messages = array( 'zlib' => 'Installation_SystemCheckZlibHelp', 'SPL' => 'Installation_SystemCheckSplHelp', 'iconv' => 'Installation_SystemCheckIconvHelp', 'json' => 'Installation_SystemCheckWarnJsonHelp', 'mbstring' => 'Installation_SystemCheckMbstringHelp', 'Reflection' => 'Required extension that is built in PHP, see http://www.php.net/manual/en/book.reflection.php', ); return $this->translator->translate($messages[$missingExtension]); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckMemoryLimit'); SettingsServer::raiseMemoryLimitIfNecessary(); $memoryLimit = SettingsServer::getMemoryLimitValue(); $comment = $memoryLimit . 'M'; if ($memoryLimit >= $this->minimumMemoryLimit) { $status = DiagnosticResult::STATUS_OK; } else { $status = DiagnosticResult::STATUS_WARNING; $comment .= sprintf('<br />%s<br />%s', $this->translator->translate('Installation_SystemCheckMemoryLimitHelp'), $this->translator->translate('Installation_RestartWebServer')); } return array(DiagnosticResult::singleResult($label, $status, $comment)); }
public function execute() { $label = $this->translator->translate('Installation_SystemCheckOpenURL'); $httpMethod = Http::getTransportMethod(); if ($httpMethod) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $httpMethod)); } $canAutoUpdate = Filechecks::canAutoUpdate(); $comment = $this->translator->translate('Installation_SystemCheckOpenURLHelp'); if (!$canAutoUpdate) { $comment .= '<br/>' . $this->translator->translate('Installation_SystemCheckAutoUpdateHelp'); } return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { global $piwik_minimumPHPVersion; $actualVersion = PHP_VERSION; $label = sprintf('%s >= %s', $this->translator->translate('Installation_SystemCheckPhp'), $piwik_minimumPHPVersion); if ($this->isPhpVersionValid($piwik_minimumPHPVersion, $actualVersion)) { $status = DiagnosticResult::STATUS_OK; $comment = $actualVersion; } else { $status = DiagnosticResult::STATUS_ERROR; $comment = sprintf('%s: %s', $this->translator->translate('General_Error'), $this->translator->translate('General_Required', array($label))); } return array(DiagnosticResult::singleResult($label, $status, $comment)); }
/** * Loads all required data from Intl plugin * * TODO: instead of going directly through Translator, there should be a specific class * that gets needed characters (ie, NumberFormatSource). The default implementation * can use the Translator. This will make it easier to unit test NumberFormatter, * w/o needing the Piwik Environment. * * @return NumberFormatter */ public function __construct(Translator $translator) { $this->patternNumber = $translator->translate('Intl_NumberFormatNumber'); $this->patternCurrency = $translator->translate('Intl_NumberFormatCurrency'); $this->patternPercent = $translator->translate('Intl_NumberFormatPercent'); $this->symbolPlus = $translator->translate('Intl_NumberSymbolPlus'); $this->symbolMinus = $translator->translate('Intl_NumberSymbolMinus'); $this->symbolPercent = $translator->translate('Intl_NumberSymbolPercent'); $this->symbolGroup = $translator->translate('Intl_NumberSymbolGroup'); $this->symbolDecimal = $translator->translate('Intl_NumberSymbolDecimal'); }
public function execute() { $label = $this->translator->translate('Installation_Filesystem'); if (!Filesystem::checkIfFileSystemIsNFS()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); } $isPiwikInstalling = !Config::getInstance()->existsLocalConfig(); if ($isPiwikInstalling) { $help = 'Installation_NfsFilesystemWarningSuffixInstall'; } else { $help = 'Installation_NfsFilesystemWarningSuffixAdmin'; } $comment = sprintf('%s<br />%s', $this->translator->translate('Installation_NfsFilesystemWarning'), $this->translator->translate($help)); return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
public function execute() { $label = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsWritable'); $file = new File(PIWIK_DOCUMENT_ROOT . '/piwik.js'); if ($file->hasWriteAccess()) { return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, '')); } $comment = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsNotWritable'); if (!SettingsServer::isWindows()) { $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/piwik.js'); $command = "<br/><code> chmod +w {$realpath}<br/> chown " . Filechecks::getUserAndGroup() . " " . $realpath . "</code><br />"; $comment .= $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsMakeWritable', $command); } return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); }
private function processPasswordChange($userLogin) { $alias = Common::getRequestVar('alias'); $email = Common::getRequestVar('email'); $newPassword = false; $password = Common::getRequestvar('password', false); $passwordBis = Common::getRequestvar('passwordBis', false); if (!empty($password) || !empty($passwordBis)) { if ($password != $passwordBis) { throw new Exception($this->translator->translate('Login_PasswordsDoNotMatch')); } $newPassword = $password; } // UI disables password change on invalid host, but check here anyway if (!Url::isValidHost() && $newPassword !== false) { throw new Exception("Cannot change password with untrusted hostname!"); } APIUsersManager::getInstance()->updateUser($userLogin, $newPassword, $email, $alias); if ($newPassword !== false) { $newPassword = Common::unsanitizeInputValue($newPassword); } // logs the user in with the new password if ($newPassword !== false) { $sessionInitializer = new SessionInitializer(); $auth = StaticContainer::get('Piwik\\Auth'); $auth->setLogin($userLogin); $auth->setPassword($password); $sessionInitializer->initSession($auth, $rememberMe = false); } }
private function verifyDecompressedArchive($extractedArchiveDirectory) { $someExpectedFiles = array('/config/global.ini.php', '/index.php', '/core/Piwik.php', '/piwik.php', '/plugins/API/API.php'); foreach ($someExpectedFiles as $file) { if (!is_file($extractedArchiveDirectory . $file)) { throw new Exception($this->translator->translate('CoreUpdater_ExceptionArchiveIncomplete', $file)); } } }
private function setManageVariables(View $view) { $view->isSuperUser = Piwik::hasUserSuperUserAccess(); $mobileMessagingAPI = API::getInstance(); $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement(); $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided(); $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement; $view->strHelpAddPhone = $this->translator->translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array($this->translator->translate('General_Settings'), $this->translator->translate('MobileMessaging_SettingsMenu'))); $view->creditLeft = 0; $currentProvider = ''; if ($view->credentialSupplied && $view->accountManagedByCurrentUser) { $currentProvider = $mobileMessagingAPI->getSMSProvider(); $view->creditLeft = $mobileMessagingAPI->getCreditLeft(); } $view->delegateManagementOptions = array(array('key' => '0', 'value' => Piwik::translate('General_No'), 'description' => Piwik::translate('General_Default') . '. ' . Piwik::translate('MobileMessaging_Settings_LetUsersManageAPICredential_No_Help')), array('key' => '1', 'value' => Piwik::translate('General_Yes'), 'description' => Piwik::translate('MobileMessaging_Settings_LetUsersManageAPICredential_Yes_Help'))); $providers = array(); $providerOptions = array(); foreach (SMSProvider::findAvailableSmsProviders() as $provider) { if (empty($currentProvider)) { $currentProvider = $provider->getId(); } $providers[$provider->getId()] = $provider->getDescription(); $providerOptions[$provider->getId()] = $provider->getId(); } $view->provider = $currentProvider; $view->smsProviders = $providers; $view->smsProviderOptions = $providerOptions; $defaultCountry = Common::getCountry(LanguagesManager::getLanguageCodeForCurrentUser(), true, IP::getIpFromHeader()); $view->defaultCallingCode = ''; // construct the list of countries from the lang files $countries = array(array('key' => '', 'value' => '')); foreach ($this->regionDataProvider->getCountryList() as $countryCode => $continentCode) { if (isset(CountryCallingCodes::$countryCallingCodes[$countryCode])) { if ($countryCode == $defaultCountry) { $view->defaultCallingCode = CountryCallingCodes::$countryCallingCodes[$countryCode]; } $countries[] = array('key' => CountryCallingCodes::$countryCallingCodes[$countryCode], 'value' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode)); } } $view->countries = $countries; $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers(); $this->setBasicVariablesView($view); }
protected function getRangeFormat($short = false) { $maxDifference = 'D'; if ($this->getDateStart()->toString('y') != $this->getDateEnd()->toString('y')) { $maxDifference = 'Y'; } elseif ($this->getDateStart()->toString('m') != $this->getDateEnd()->toString('m')) { $maxDifference = 'M'; } return $this->translator->translate(sprintf('Intl_Format_Interval_%s_%s', $short ? 'Short' : 'Long', $maxDifference)); }
public function getEvolutionGraph(array $columns = array(), $idGoal = false, array $defaultColumns = array()) { if (empty($columns)) { $columns = Common::getRequestVar('columns', false); if (false !== $columns) { $columns = Piwik::getArrayFromApiParameter($columns); } } if (false !== $columns) { $columns = !is_array($columns) ? array($columns) : $columns; } if (empty($idGoal)) { $idGoal = Common::getRequestVar('idGoal', false, 'string'); } $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.get'); $view->requestConfig->request_parameters_to_modify['idGoal'] = $idGoal; $nameToLabel = $this->goalColumnNameToLabel; if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { $nameToLabel['nb_conversions'] = 'General_EcommerceOrders'; } elseif ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) { $nameToLabel['nb_conversions'] = $this->translator->translate('General_VisitsWith', $this->translator->translate('Goals_AbandonedCart')); $nameToLabel['conversion_rate'] = $nameToLabel['nb_conversions']; $nameToLabel['revenue'] = $this->translator->translate('Goals_LeftInCart', $this->translator->translate('General_ColumnRevenue')); $nameToLabel['items'] = $this->translator->translate('Goals_LeftInCart', $this->translator->translate('Goals_Products')); } $selectableColumns = array('nb_conversions', 'conversion_rate', 'revenue'); if ($this->site->isEcommerceEnabled()) { $selectableColumns[] = 'items'; $selectableColumns[] = 'avg_order_revenue'; } foreach (array_merge($columns ? $columns : array(), $selectableColumns) as $columnName) { $columnTranslation = ''; // find the right translation for this column, eg. find 'revenue' if column is Goal_1_revenue foreach ($nameToLabel as $metric => $metricTranslation) { if (strpos($columnName, $metric) !== false) { $columnTranslation = $this->translator->translate($metricTranslation); break; } } if (!empty($idGoal) && isset($this->goals[$idGoal])) { $goalName = $this->goals[$idGoal]['name']; $columnTranslation = "{$columnTranslation} (" . $this->translator->translate('Goals_GoalX', "{$goalName}") . ")"; } $view->config->translations[$columnName] = $columnTranslation; } if (!empty($columns)) { $view->config->columns_to_display = $columns; } elseif (empty($view->config->columns_to_display) && !empty($defaultColumns)) { $view->config->columns_to_display = $defaultColumns; } $view->config->selectable_columns = $selectableColumns; $langString = $idGoal ? 'Goals_SingleGoalOverviewDocumentation' : 'Goals_GoalsOverviewDocumentation'; $view->config->documentation = $this->translator->translate($langString, '<br />'); return $this->renderView($view); }
protected function initPluginModification($nonceName) { Piwik::checkUserHasSuperUserAccess(); $nonce = Common::getRequestVar('nonce', null, 'string'); if (!Nonce::verifyNonce($nonceName, $nonce)) { throw new \Exception($this->translator->translate('General_ExceptionNonceMismatch')); } Nonce::discardNonce($nonceName); $pluginName = Common::getRequestVar('pluginName', null, 'string'); return $pluginName; }