作者:a4tunad
项目:piwi
public function configureView(ViewDataTable $view)
{
$view->config->title = $this->name;
$view->config->show_search = false;
$view->config->show_exclude_low_population = false;
$view->config->addTranslation('label', Piwik::translate("UserSettings_OperatingSystemFamily"));
}
作者:carriercom
项目:piwi
public function configureAdminMenu(MenuAdmin $menu)
{
$hasSuperUserAcess = Piwik::hasUserSuperUserAccess();
$isAnonymous = Piwik::isUserIsAnonymous();
$isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled();
$pluginsUpdateMessage = '';
$themesUpdateMessage = '';
if ($hasSuperUserAcess && $isMarketplaceEnabled) {
$marketplace = new Marketplace();
$pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
$themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
if (!empty($pluginsHavingUpdate)) {
$pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
}
if (!empty($themesHavingUpdate)) {
$themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
}
}
$menu->add('CorePluginsAdmin_MenuPlatform', null, "", !$isAnonymous, $order = 7);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), $hasSuperUserAcess, $order = 1);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), $hasSuperUserAcess, $order = 3);
if ($isMarketplaceEnabled) {
$menu->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !$isAnonymous, $order = 5);
}
}
作者:bossrabbi
项目:piwi
public function setupTestEnvironment($environment)
{
Piwik::addAction("MySQLMetadataProvider.createDao", function (&$dao) {
require_once dirname(__FILE__) . "/tests/Mocks/MockDataAccess.php";
$dao = new Mocks\MockDataAccess();
});
}
作者:CaptainShar
项目:SSAD_Projec
protected function retrieveFileLocations()
{
if (!empty($this->plugins)) {
/**
* Triggered when gathering the list of all JavaScript files needed by Piwik
* and its plugins.
*
* Plugins that have their own JavaScript should use this event to make those
* files load in the browser.
*
* JavaScript files should be placed within a **javascripts** subdirectory in your
* plugin's root directory.
*
* _Note: While you are developing your plugin you should enable the config setting
* `[Development] disable_merged_assets` so JavaScript files will be reloaded immediately
* after every change._
*
* **Example**
*
* public function getJsFiles(&$jsFiles)
* {
* $jsFiles[] = "plugins/MyPlugin/javascripts/myfile.js";
* $jsFiles[] = "plugins/MyPlugin/javascripts/anotherone.js";
* }
*
* @param string[] $jsFiles The JavaScript files to load.
*/
Piwik::postEvent('AssetManager.getJavaScriptFiles', array(&$this->fileLocations), null, $this->plugins);
}
$this->addThemeFiles();
}
作者:imreFito
项目:piwi
function init()
{
HTML_QuickForm2_Factory::registerRule('checkValidFilename', 'Piwik\\Plugins\\Installation\\FormDatabaseSetup_Rule_checkValidFilename');
$checkUserPrivilegesClass = 'Piwik\\Plugins\\Installation\\Rule_checkUserPrivileges';
HTML_QuickForm2_Factory::registerRule('checkUserPrivileges', $checkUserPrivilegesClass);
$availableAdapters = Adapter::getAdapters();
$adapters = array();
foreach ($availableAdapters as $adapter => $port) {
$adapters[$adapter] = $adapter;
}
$types = array('InnoDB' => 'InnoDB');
$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 = Rule_checkUserPrivileges::getRequiredPrivilegesPretty();
$user->addRule('checkUserPrivileges', Piwik::translate('Installation_InsufficientPrivilegesMain', $requiredPrivileges . '<br/><br/>') . Piwik::translate('Installation_InsufficientPrivilegesHelp'));
$this->addElement('password', 'password')->setLabel(Piwik::translate('General_Password'));
$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('select', 'type')->setLabel(Piwik::translate('Installation_DatabaseSetupDatabaseEngine'))->loadOptions($types)->addRule('required', Piwik::translate('General_Required', Piwik::translate('Installation_DatabaseSetupDatabaseEngine')));
$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_')));
}
作者:KiwiJuice
项目:handball-dacha
static function update($schema = 'Myisam')
{
// force regeneration of cache files following #648
Piwik::setUserIsSuperUser();
$allSiteIds = API::getInstance()->getAllSitesId();
Cache::regenerateCacheWebsiteAttributes($allSiteIds);
}
作者:carriercom
项目:piwi
/**
* Constructor.
*/
public function __construct()
{
Piwik::postTestEvent("MySQLMetadataProvider.createDao", array(&$this->dataAccess));
if ($this->dataAccess === null) {
$this->dataAccess = new MySQLMetadataDataAccess();
}
}
作者:CaptainShar
项目:SSAD_Projec
public function registerWidgets()
{
if (PluginManager::getInstance()->isPluginActivated('UserCountry')) {
WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap');
WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap');
}
}
作者:carriercom
项目:piwi
protected function unprefixColumns(&$columns)
{
$columns = Piwik::getArrayFromApiParameter($columns);
foreach ($columns as &$column) {
$column = str_replace(self::COLUMN_SUFFIX, "", $column);
}
}
作者:FluentDevelopmen
项目:piwi
public function configureView(ViewDataTable $view)
{
$this->addBaseDisplayProperties($view);
$this->addPresentationFilters($view);
$view->config->title = $this->name;
$view->config->addTranslation('label', Piwik::translate('Intl_PeriodYear'));
}
作者:andrzejewsk
项目:plugin-AnonymousPiwikUsageMeasuremen
public function setUp()
{
parent::setUp();
$self = $this;
Piwik::addAction('API.Request.dispatch.end', function (&$return, $extra) use($self) {
if ($extra['module'] !== 'Events') {
return;
}
/** @var DataTable $return*/
// we make sure processed result is the same at any time
foreach ($return as &$value) {
$value->setColumn('sum_event_value', '2');
$value->setColumn('max_event_value', '2');
$value->setColumn('min_event_value', '2');
$value->setColumn('sum_daily_nb_uniq_visitors', '2');
$value->setColumn('avg_event_value', '2');
if ($value->isSubtableLoaded()) {
$subtable = $value->getSubtable();
foreach ($subtable->getRows() as $row) {
$row->setColumn('sum_event_value', '2');
$row->setColumn('max_event_value', '2');
$row->setColumn('min_event_value', '2');
$row->setColumn('sum_daily_nb_uniq_visitors', '2');
$row->setColumn('avg_event_value', '2');
}
}
}
});
}
作者:CaptainShar
项目:SSAD_Projec
/**
* DataTable filter callback that returns the HTML prefix for a label in the
* 'getAll' report based on the row's referrer type.
*
* @param int $referrerType The referrer type.
* @return string
*/
public function setGetAllHtmlPrefix($referrerType)
{
// get singular label for referrer type
$indexTranslation = '';
switch ($referrerType) {
case Common::REFERRER_TYPE_DIRECT_ENTRY:
$indexTranslation = 'Referrers_DirectEntry';
break;
case Common::REFERRER_TYPE_SEARCH_ENGINE:
$indexTranslation = 'General_ColumnKeyword';
break;
case Common::REFERRER_TYPE_WEBSITE:
$indexTranslation = 'Referrers_ColumnWebsite';
break;
case Common::REFERRER_TYPE_CAMPAIGN:
$indexTranslation = 'Referrers_ColumnCampaign';
break;
default:
// case of newsletter, partners, before Piwik 0.2.25
$indexTranslation = 'General_Others';
break;
}
$label = strtolower(Piwik::translate($indexTranslation));
// return html that displays it as grey & italic
return '<span class="datatable-label-category"><em>(' . $label . ')</em></span>';
}
作者:piwi
项目:piwi
protected function retrieveFileLocations()
{
/**
* Triggered when gathering the list of all stylesheets (CSS and LESS) needed by
* Piwik and its plugins.
*
* Plugins that have stylesheets should use this event to make those stylesheets
* load.
*
* Stylesheets should be placed within a **stylesheets** subdirectory in your plugin's
* root directory.
*
* **Example**
*
* public function getStylesheetFiles(&$stylesheets)
* {
* $stylesheets[] = "plugins/MyPlugin/stylesheets/myfile.less";
* $stylesheets[] = "plugins/MyPlugin/stylesheets/myotherfile.css";
* }
*
* @param string[] &$stylesheets The list of stylesheet paths.
*/
Piwik::postEvent('AssetManager.getStylesheetFiles', array(&$this->fileLocations));
$this->addThemeFiles();
}
作者:emersonmatsumot
项目:piwi
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$menu->addManageItem('UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), $order = 2);
$menu->addManageItem('UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), $order = 3);
}
}
作者:piwi
项目:piwi
protected function configureSegmentsFor($segmentNameSuffix)
{
$numCustomVariables = CustomVariables::getNumUsableCustomVariables();
$segment = new Segment();
$segment->setType('dimension');
$segment->setSegment('customVariable' . $segmentNameSuffix);
$segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
$segment->setUnionOfSegments($this->getSegmentColumns('customVariable' . $segmentNameSuffix, $numCustomVariables));
$this->addSegment($segment);
$segment = new Segment();
$segment->setType('dimension');
$segment->setSegment('customVariablePage' . $segmentNameSuffix);
$segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
$segment->setUnionOfSegments($this->getSegmentColumns('customVariablePage' . $segmentNameSuffix, $numCustomVariables));
$this->addSegment($segment);
$segmentSuffix = 'v';
if (strtolower($segmentNameSuffix) === 'name') {
$segmentSuffix = 'k';
}
for ($i = 1; $i <= $numCustomVariables; $i++) {
$segment = new Segment();
$segment->setSegment('customVariable' . $segmentNameSuffix . $i);
$segment->setSqlSegment('log_visit.custom_var_' . $segmentSuffix . $i);
$segment->setName(Piwik::translate('CustomVariables_ColumnCustomVariable' . $segmentNameSuffix) . ' ' . $i . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
$this->addSegment($segment);
$segment = new Segment();
$segment->setSegment('customVariablePage' . $segmentNameSuffix . $i);
$segment->setSqlSegment('log_link_visit_action.custom_var_' . $segmentSuffix . $i);
$segment->setName(Piwik::translate('CustomVariables_ColumnCustomVariable' . $segmentNameSuffix) . ' ' . $i . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
$this->addSegment($segment);
}
}
作者:piwi
项目:piwi
public static function configure(WidgetConfig $config)
{
$config->setCategoryId('About Piwik');
$config->setName('Installation_SystemCheck');
$config->setOrder(16);
$config->setIsEnabled(Piwik::hasUserSuperUserAccess());
}
作者:brienomatt
项目:elmsl
function getTopMenuTranslationKey()
{
// if MobileMessaging is not activated, display 'Email reports'
if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging')) {
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
if (Piwik::isUserIsAnonymous()) {
return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
}
try {
$reports = API::getInstance()->getReports();
$reportCount = count($reports);
// if there are no reports and the mobile account is
// - not configured: display 'Email reports'
// - configured: display 'Email & SMS reports'
if ($reportCount == 0) {
return APIMobileMessaging::getInstance()->areSMSAPICredentialProvided() ? self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY : self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
} catch (\Exception $e) {
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
$anyMobileReport = false;
foreach ($reports as $report) {
if ($report['type'] == MobileMessaging::MOBILE_TYPE) {
$anyMobileReport = true;
break;
}
}
// if there is at least one sms report, display 'Email & SMS reports'
if ($anyMobileReport) {
return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
}
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
作者:cem
项目:piwi
protected function getMetricsDocumentation()
{
$metrics = parent::getMetricsDocumentation();
$metrics['nb_visits'] = Piwik::translate('General_ColumnUniquePageviewsDocumentation');
$metrics['bounce_rate'] = Piwik::translate('General_ColumnPageBounceRateDocumentation');
return $metrics;
}
作者:mgou-ne
项目:piwi
public function getProvider()
{
if (isset($this->details['location_provider'])) {
return $this->details['location_provider'];
}
return Piwik::translate('General_Unknown');
}
作者:ankygoya
项目:piwi
/**
* @return array
*/
protected function getFooterMessageExplanationMissingMetrics()
{
$metrics = sprintf("'%s', '%s' %s '%s'", Piwik::translate('General_ColumnNbVisits'), Piwik::translate('General_ColumnNbUniqVisitors'), Piwik::translate('General_And'), Piwik::translate('General_ColumnNbUsers'));
$messageStart = Piwik::translate('CustomVariables_MetricsAreOnlyAvailableForVisitScope', array($metrics, "'visit'"));
$messageEnd = Piwik::translate('CustomVariables_MetricsNotAvailableForPageScope', array("'page'", '\'-\''));
return $messageStart . ' ' . $messageEnd;
}