本文整理汇总了PHP中Piwik_Translate函数的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Translate函数的具体用法?PHP Piwik_Translate怎么用?PHP Piwik_Translate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Translate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
Piwik::checkUserIsSuperUser();
$plugins = array();
$listPlugins = array_merge(Piwik_PluginsManager::getInstance()->readPluginsDirectory(), Piwik_Config::getInstance()->Plugins['Plugins']);
$listPlugins = array_unique($listPlugins);
foreach ($listPlugins as $pluginName) {
$oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName);
$plugins[$pluginName] = array('activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName), 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName));
}
Piwik_PluginsManager::getInstance()->loadPluginTranslations();
$loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
foreach ($loadedPlugins as $oPlugin) {
$pluginName = $oPlugin->getPluginName();
$plugins[$pluginName]['info'] = $oPlugin->getInformation();
}
foreach ($plugins as $pluginName => &$plugin) {
if (!isset($plugin['info'])) {
$plugin['info'] = array('description' => '<strong><em>' . Piwik_Translate('CorePluginsAdmin_PluginCannotBeFound') . '</strong></em>', 'version' => Piwik_Translate('General_Unknown'));
}
}
$view = Piwik_View::factory('manage');
$view->pluginsName = $plugins;
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
if (!Piwik_Config::getInstance()->isFileWritable()) {
$view->configFileNotWritable = true;
}
echo $view->render();
}
示例2: getReportMetadata
public function getReportMetadata($notification)
{
$reports = &$notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('VisitorInterest_WidgetLengths'),
'module' => 'VisitorInterest',
'action' => 'getNumberOfVisitsPerVisitDuration',
'dimension' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'),
'metrics' => array( 'nb_visits' ),
'processedMetrics' => false,
'constantRowsCount' => true,
'documentation' => Piwik_Translate('VisitorInterest_WidgetLengthsDocumentation')
.'<br />'.Piwik_Translate('General_ChangeTagCloudView'),
'order' => 15
);
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('VisitorInterest_WidgetPages'),
'module' => 'VisitorInterest',
'action' => 'getNumberOfVisitsPerPage',
'dimension' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'),
'metrics' => array( 'nb_visits' ),
'processedMetrics' => false,
'constantRowsCount' => true,
'documentation' => Piwik_Translate('VisitorInterest_WidgetPagesDocumentation')
.'<br />'.Piwik_Translate('General_ChangeTagCloudView'),
'order' => 20
);
}
示例3: Piwik_CountryTranslate
/**
* Returns the translated country name for a given country code
*
* @param string $label country code
* @return string Country name
*/
function Piwik_CountryTranslate($label)
{
if ($label == 'xx') {
return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8');
}
return html_entity_decode(Piwik_Translate('UserCountry_country_' . $label), ENT_COMPAT, 'UTF-8');
}
示例4: sendFeedback
/**
* send email to Piwik team and display nice thanks
*/
function sendFeedback()
{
$body = Piwik_Common::getRequestVar('body', '', 'string');
$email = Piwik_Common::getRequestVar('email', '', 'string');
$view = new Piwik_View('Feedback/templates/sent.tpl');
try {
$minimumBodyLength = 35;
if (strlen($body) < $minimumBodyLength) {
throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength));
}
if (!Piwik::isValidEmailString($email)) {
throw new Exception(Piwik_Translate('UsersManager_ExceptionInvalidEmail'));
}
if (strpos($body, 'http://') !== false) {
throw new Exception("The message cannot contain a URL, to avoid spams messages.");
}
$mail = new Piwik_Mail();
$mail->setFrom($email);
$mail->addTo('hello@piwik.org', 'Piwik Team');
$mail->setSubject('[ Feedback form - Piwik ]');
$mail->setBodyText($body);
@$mail->send();
} catch (Exception $e) {
$view->ErrorString = $e->getMessage();
$view->message = $body;
}
echo $view->render();
}
示例5: index
function index()
{
Piwik::checkUserIsNotAnonymous();
$view = Piwik_View::factory('Settings');
$view->isSuperUser = Piwik::isUserIsSuperUser();
$mobileMessagingAPI = Piwik_MobileMessaging_API::getInstance();
$view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement();
$view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided();
$view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement;
$view->strHelpAddPhone = Piwik_Translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array(Piwik_Translate('UserSettings_SubmenuSettings'), Piwik_Translate('MobileMessaging_SettingsMenu')));
if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
$view->provider = $mobileMessagingAPI->getSMSProvider();
$view->creditLeft = $mobileMessagingAPI->getCreditLeft();
}
$view->smsProviders = Piwik_MobileMessaging_SMSProvider::$availableSMSProviders;
// construct the list of countries from the lang files
$countries = array();
foreach (Piwik_Common::getCountriesList() as $countryCode => $continentCode) {
if (isset(Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode])) {
$countries[$countryCode] = array('countryName' => Piwik_CountryTranslate($countryCode), 'countryCallingCode' => Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode]);
}
}
$view->countries = $countries;
$view->defaultCountry = Piwik_Common::getCountry(Piwik_LanguagesManager::getLanguageCodeForCurrentUser(), true, Piwik_IP::getIpFromHeader());
$view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
echo $view->render();
}
示例6: init
function init()
{
$infos = Piwik_Installation_Controller::getSystemInformation();
$adapters = array();
foreach($infos['adapters'] as $adapter => $port)
{
$adapters[$adapter] = $adapter;
}
$formElements = array(
array('text', 'host', Piwik_Translate('Installation_DatabaseSetupServer'), 'value='.'localhost'),
array('text', 'username', Piwik_Translate('Installation_DatabaseSetupLogin')),
array('password', 'password', Piwik_Translate('Installation_DatabaseSetupPassword')),
array('text', 'dbname', Piwik_Translate('Installation_DatabaseSetupDatabaseName')),
array('text', 'tables_prefix', Piwik_Translate('Installation_DatabaseSetupTablePrefix'), 'value='.'piwik_'),
array('select', 'adapter', Piwik_Translate('Installation_DatabaseSetupAdapter'), $adapters),
);
$this->addElements( $formElements );
$formRules = array();
foreach($formElements as $row)
{
if($row[1] != 'password' && $row[1] != 'tables_prefix')
{
$formRules[] = array($row[1], Piwik_Translate('General_Required', $row[2]), 'required');
}
}
$this->addRules( $formRules );
$this->addElement('submit', 'submit', Piwik_Translate('Installation_SubmitGo'));
}
示例7: setColumnsToDisplay
public function setColumnsToDisplay($columnsNames)
{
$newColumnsNames = array();
$goals = array();
$idSite = $this->getIdSite();
if ($idSite) {
$goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
}
foreach ($columnsNames as $columnName) {
if (in_array($columnName, array('goal_%s_conversion_rate', 'goal_%s_nb_conversions', 'goal_%s_revenue_per_visit'))) {
foreach ($goals as $goal) {
$idgoal = $goal['idgoal'];
if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal) {
continue;
}
$name = Piwik_Translate($this->getColumnTranslation($columnName), $goal['name']);
$columnNameGoal = str_replace('%s', $idgoal, $columnName);
$this->setColumnTranslation($columnNameGoal, $name);
if (strstr($columnNameGoal, '_rate') === false && $this->processOnlyIdGoal == Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW) {
continue;
}
if (strstr($columnNameGoal, '_revenue') !== false) {
$this->columnsToRevenueFilter[] = $columnNameGoal;
} else {
$this->columnsToConversionFilter[] = $columnNameGoal;
}
$newColumnsNames[] = $columnNameGoal;
}
} else {
$newColumnsNames[] = $columnName;
}
}
parent::setColumnsToDisplay($newColumnsNames);
}
示例8: Piwik_getSubnetName
/**
* Piwik - Open source web analytics
*
* @link https://github.com/pklaus/IntranetSubNetwork
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
*
* @package Piwik_IntranetSubNetwork
*/
function Piwik_getSubnetName($in)
{
if (empty($in)) {
return Piwik_Translate('General_Unknown');
}
return $in;
}
示例9: init
function init()
{
HTML_QuickForm2_Factory::registerRule('checkValidFilename', 'Piwik_Installation_FormDatabaseSetup_Rule_checkValidFilename');
$checkUserPrivilegesClass = 'Piwik_Installation_FormDatabaseSetup_Rule_checkUserPrivileges';
HTML_QuickForm2_Factory::registerRule('checkUserPrivileges', $checkUserPrivilegesClass);
$availableAdapters = Piwik_Db_Adapter::getAdapters();
$adapters = array();
foreach ($availableAdapters as $adapter => $port) {
$adapters[$adapter] = $adapter;
}
$this->addElement('text', 'host')->setLabel(Piwik_Translate('Installation_DatabaseSetupServer'))->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupServer')));
$user = $this->addElement('text', 'username')->setLabel(Piwik_Translate('Installation_DatabaseSetupLogin'));
$user->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupLogin')));
$requiredPrivileges = Piwik_Installation_FormDatabaseSetup_Rule_checkUserPrivileges::getRequiredPrivilegesPretty();
$user->addRule('checkUserPrivileges', Piwik_Translate('Installation_InsufficientPrivileges', $requiredPrivileges . '<br/><br/>') . Piwik_Translate('Installation_InsufficientPrivilegesHelp'));
$this->addElement('password', 'password')->setLabel(Piwik_Translate('Installation_DatabaseSetupPassword'));
$item = $this->addElement('text', 'dbname')->setLabel(Piwik_Translate('Installation_DatabaseSetupDatabaseName'));
$item->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupDatabaseName')));
$item->addRule('checkValidFilename', Piwik_Translate('General_NotValid', Piwik_Translate('Installation_DatabaseSetupDatabaseName')));
$this->addElement('text', 'tables_prefix')->setLabel(Piwik_Translate('Installation_DatabaseSetupTablePrefix'))->addRule('checkValidFilename', Piwik_Translate('General_NotValid', Piwik_Translate('Installation_DatabaseSetupTablePrefix')));
$this->addElement('select', 'adapter')->setLabel(Piwik_Translate('Installation_DatabaseSetupAdapter'))->loadOptions($adapters)->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupAdapter')));
$this->addElement('submit', 'submit', array('value' => Piwik_Translate('General_Next') . ' »', 'class' => 'submit'));
// default values
$this->addDataSource(new HTML_QuickForm2_DataSource_Array(array('host' => '127.0.0.1', 'tables_prefix' => 'piwik_')));
}
示例10: Piwik_CountryTranslate
function Piwik_CountryTranslate($label)
{
if ($label == 'xx') {
return Piwik_Translate('General_Unknown');
}
return Piwik_Translate('UserCountry_country_' . $label);
}
示例11: dispatch
function dispatch($notification = null)
{
if($notification)
{
$exception = $notification->getNotificationObject();
$message = $exception->getMessage();
}
else
{
$message = '';
}
Piwik_Translate::getInstance()->loadCoreTranslation();
Piwik_PostEvent('Installation.startInstallation', $this);
$step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
$controller = $this->getInstallationController();
if(in_array($step, array_keys($controller->getInstallationSteps())) || $step == 'saveLanguage')
{
$controller->$step($message);
}
else
{
Piwik::exitWithErrorMessage(Piwik_Translate('Installation_NoConfigFound'));
}
exit;
}
示例12: init
function init()
{
$this->addElement('text', 'form_login')
->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('General_Username')));
$password = $this->addElement('password', 'form_password');
$password->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_Password')));
$passwordBis = $this->addElement('password', 'form_password_bis');
$passwordBis->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordRepeat')));
$passwordBis->addRule('eq', Piwik_Translate( 'Login_PasswordsDoNotMatch'), $password);
$this->addElement('text', 'form_token')
->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordResetToken')));
$this->addElement('hidden', 'form_nonce');
$this->addElement('submit', 'submit');
$resetToken = Piwik_Common::getRequestVar('token', '', 'string');
if(!empty($resetToken)) {
// default values
$this->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'form_token' => $resetToken,
)));
$this->attributes['action'] = 'index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified( array('token' => null) );
}
}
示例13: getVisitorLog
public function getVisitorLog($fetch = false)
{
// If previous=1 is set, user clicked previous
// we can't deal with previous so we force display of the first page
if (Piwik_Common::getRequestVar('previous', 0, 'int') == 1) {
$_GET['maxIdVisit'] = '';
}
$view = Piwik_ViewDataTable::factory();
$view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsDetails');
$view->disableGenericFilters();
$view->disableSort();
$view->setTemplate("Live/templates/visitorLog.tpl");
$view->setSortedColumn('idVisit', 'ASC');
$view->disableSearchBox();
$view->setLimit(20);
$view->disableOffsetInformation();
$view->disableExcludeLowPopulation();
// disable the tag cloud, pie charts, bar chart icons
$view->disableShowAllViewsIcons();
// disable the button "show more datas"
$view->disableShowAllColumns();
// disable the RSS feed
$view->disableShowExportAsRssFeed();
// disable all row actions
if ($view instanceof Piwik_ViewDataTable_HtmlTable) {
$view->disableRowActions();
}
$view->setReportDocumentation(Piwik_Translate('Live_VisitorLogDocumentation', array('<br />', '<br />')));
$view->setCustomParameter('dataTablePreviousIsFirst', 1);
$view->setCustomParameter('filterEcommerce', Piwik_Common::getRequestVar('filterEcommerce', 0, 'int'));
$view->setCustomParameter('pageUrlNotDefined', Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL')));
return $this->renderView($view, $fetch);
}
示例14: index
public function index()
{
Piwik::checkUserIsNotAnonymous();
$view = Piwik_View::factory('index');
$this->setGeneralVariablesView($view);
$view->currentUserEmail = Piwik::getCurrentUserEmail();
$availableReports = Piwik_API_API::getInstance()->getReportMetadata($this->idSite);
$reportsByCategory = array();
foreach ($availableReports as $report) {
$reportsByCategory[$report['category']][] = $report;
}
unset($reportsByCategory['API']);
$reports = Piwik_PDFReports_API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
$reportsById = array();
foreach ($reports as &$report) {
$report['additional_emails'] = str_replace(',', "\n", $report['additional_emails']);
$report['reports'] = explode(',', str_replace('.', '_', $report['reports']));
$reportsById[$report['idreport']] = $report;
}
$view->downloadOutputType = Piwik_PDFReports_API::OUTPUT_DOWNLOAD;
$columnsCount = 2;
$view->newColumnAfter = ceil(count($reportsByCategory) / $columnsCount);
$view->reportsByCategory = $reportsByCategory;
$view->reportsJSON = Piwik_Common::json_encode($reportsById);
$view->periods = array_merge(array('never' => Piwik_Translate('General_Never')), Piwik_PDFReports_API::getPeriodToFrequency());
$view->defaultFormat = Piwik_PDFReports::DEFAULT_FORMAT;
$view->formats = Piwik_ReportRenderer::$availableReportRenderers;
$view->aggregateReportsFormats = Piwik_PDFReports_API::getAggregateReportsFormats();
$view->reports = $reports;
$view->language = Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
echo $view->render();
}
示例15: init
function init()
{
$resetToken = Piwik_Common::getRequestVar('token', '', 'string');
$formElements = array(
array('text', 'form_login'),
array('password', 'form_password'),
array('password', 'form_password_bis'),
array('text', 'form_token'),
);
$this->addElements( $formElements );
$defaults = array(
'form_token' => $resetToken,
);
$this->setDefaults($defaults);
$formRules = array(
array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('General_Username')), 'required'),
array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'),
array('form_password_bis', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordRepeat')), 'required'),
array('form_token', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordResetToken')), 'required'),
array('form_password', Piwik_Translate( 'Login_PasswordsDoNotMatch'), 'fieldHaveSameValue', 'form_password_bis'),
);
$this->addRules( $formRules );
$this->addElement('submit', 'submit');
}