本文整理汇总了PHP中Piwik\Piwik类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik类的具体用法?PHP Piwik怎么用?PHP Piwik使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureView
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"));
}
示例2: configureAdminMenu
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);
}
}
示例3: setupTestEnvironment
public function setupTestEnvironment($environment)
{
Piwik::addAction("MySQLMetadataProvider.createDao", function (&$dao) {
require_once dirname(__FILE__) . "/tests/Mocks/MockDataAccess.php";
$dao = new Mocks\MockDataAccess();
});
}
示例4: retrieveFileLocations
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();
}
示例5: init
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_')));
}
示例6: update
static function update($schema = 'Myisam')
{
// force regeneration of cache files following #648
Piwik::setUserIsSuperUser();
$allSiteIds = API::getInstance()->getAllSitesId();
Cache::regenerateCacheWebsiteAttributes($allSiteIds);
}
示例7: __construct
/**
* Constructor.
*/
public function __construct()
{
Piwik::postTestEvent("MySQLMetadataProvider.createDao", array(&$this->dataAccess));
if ($this->dataAccess === null) {
$this->dataAccess = new MySQLMetadataDataAccess();
}
}
示例8: registerWidgets
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');
}
}
示例9: unprefixColumns
protected function unprefixColumns(&$columns)
{
$columns = Piwik::getArrayFromApiParameter($columns);
foreach ($columns as &$column) {
$column = str_replace(self::COLUMN_SUFFIX, "", $column);
}
}
示例10: configureView
public function configureView(ViewDataTable $view)
{
$this->addBaseDisplayProperties($view);
$this->addPresentationFilters($view);
$view->config->title = $this->name;
$view->config->addTranslation('label', Piwik::translate('Intl_PeriodYear'));
}
示例11: setUp
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');
}
}
}
});
}
示例12: setGetAllHtmlPrefix
/**
* 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>';
}
示例13: retrieveFileLocations
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();
}
示例14: configureAdminMenu
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);
}
}
示例15: configureSegmentsFor
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);
}
}