本文整理汇总了PHP中Piwik_Site类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site类的具体用法?PHP Piwik_Site怎么用?PHP Piwik_Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Site类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: removeHoursInFuture
protected function removeHoursInFuture($table, $idSite, $period, $date)
{
$site = new Piwik_Site($idSite);
if( $period == 'day'
&& ($date == 'today'
|| $date == Piwik_Date::factory('now', $site->getTimezone())->toString()))
{
$currentHour = Piwik_Date::factory('now', $site->getTimezone())->toString('G');
// If no data for today, this is an exception to the API output rule, as we normally return nothing:
// we shall return all hours of the day, with nb_visits = 0
if($table->getRowsCount() == 0)
{
for($hour = 0; $hour <= $currentHour; $hour++)
{
$table->addRowFromSimpleArray( array('label' => $hour, 'nb_visits' => 0));
}
return $table;
}
$idsToDelete = array();
foreach($table->getRows() as $id => $row)
{
$hour = $row->getColumn('label');
if($hour > $currentHour)
{
$idsToDelete[] = $id;
}
}
$table->deleteRows($idsToDelete);
}
return $table;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:33,代码来源:API.php
示例2: setDateTodayIfWebsiteCreatedToday
protected function setDateTodayIfWebsiteCreatedToday()
{
$date = Piwik_Common::getRequestVar('date', false);
if($date == 'today'
|| Piwik_Common::getRequestVar('period', false) == 'range')
{
return;
}
$websiteId = Piwik_Common::getRequestVar('idSite', false, 'int');
if ($websiteId)
{
$website = new Piwik_Site($websiteId);
$datetimeCreationDate = $this->site->getCreationDate()->getDatetime();
$creationDateLocalTimezone = Piwik_Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
$todayLocalTimezone = Piwik_Date::factory('now', $website->getTimezone())->toString('Y-m-d');
if( $creationDateLocalTimezone == $todayLocalTimezone )
{
Piwik::redirectToModule( 'CoreHome', 'index',
array( 'date' => 'today',
'idSite' => $websiteId,
'period' => Piwik_Common::getRequestVar('period'))
);
}
}
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Controller.php
示例3: __construct
/**
* Builds an array of Piwik_Archive of a given date range
*
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct(Piwik_Site $oSite, $strPeriod, $strDate, Piwik_Segment $segment)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate, $oSite->getTimezone());
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate, $segment->getString());
$archive->setSegment($segment);
$this->archives[] = $archive;
}
}
开发者ID:Gninety,项目名称:Microweber,代码行数:17,代码来源:IndexedByDate.php
示例4: __construct
/**
* Builds an array of Piwik_Archive of a given date range
*
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct(Piwik_Site $oSite, $strPeriod, $strDate)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate);
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate);
$archive->prepareArchive();
$timestamp = $archive->getTimestampStartDate();
$this->archives[$timestamp] = $archive;
}
ksort($this->archives);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:19,代码来源:IndexedByDate.php
示例5: getDefaultIndexView
protected function getDefaultIndexView()
{
$view = new Piwik_View('Home/templates/index.tpl');
$this->setGeneralVariablesView($view);
$site = new Piwik_Site($view->idSite);
$minDate = $site->getCreationDate();
$view->minDateYear = $minDate->toString('Y');
$view->minDateMonth = $minDate->toString('m');
$view->minDateDay = $minDate->toString('d');
$view->basicHtmlView = false;
$view->content = '';
return $view;
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:Controller.php
示例6: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = Piwik_View::factory('DisplayJavascriptCode');
$this->setGeneralVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$site = new Piwik_Site($idSite);
$view->displaySiteName = $site->getName();
$view->jsTag = $jsTag;
echo $view->render();
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:Controller.php
示例7: generate
public function generate()
{
Piwik::checkUserIsSuperUser();
$nonce = Piwik_Common::getRequestVar('form_nonce', '', 'string', $_POST);
if(Piwik_Common::getRequestVar('choice', 'no') != 'yes' ||
!Piwik_Nonce::verifyNonce('Piwik_VisitorGenerator.generate', $nonce))
{
Piwik::redirectToModule('VisitorGenerator', 'index');
}
Piwik_Nonce::discardNonce('Piwik_VisitorGenerator.generate');
$daysToCompute = Piwik_Common::getRequestVar('daysToCompute', 1, 'int');
// get idSite from POST with fallback to GET
$idSite = Piwik_Common::getRequestVar('idSite', false, 'int', $_GET);
$idSite = Piwik_Common::getRequestVar('idSite', $idSite, 'int', $_POST);
Piwik::setMaxExecutionTime(0);
$timer = new Piwik_Timer;
$time = time() - ($daysToCompute-1)*86400;
// Update site.ts_created if we generate visits on days before the website was created
$site = new Piwik_Site($idSite);
$minGeneratedDate = Piwik_Date::factory($time);
if($minGeneratedDate->isEarlier($site->getCreationDate()))
{
// direct access to the website table (bad practise but this is a debug / dev plugin)
Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"),
array('ts_created' => $minGeneratedDate->getDatetime()),
"idsite = $idSite");
}
$nbActionsTotal = 0;
while($time <= time())
{
$nbActionsTotalThisDay = $this->generateVisits($time, $idSite);
$time += 86400;
$nbActionsTotal += $nbActionsTotalThisDay;
}
// Init view
$view = Piwik_View::factory('generate');
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$view->assign('timer', $timer);
$view->assign('days', $daysToCompute);
$view->assign('nbActionsTotal', $nbActionsTotal);
$view->assign('nbRequestsPerSec', round($nbActionsTotal / $timer->getTime(),0));
echo $view->render();
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:Controller.php
示例8: setDateTodayIfWebsiteCreatedToday
protected function setDateTodayIfWebsiteCreatedToday()
{
$date = Piwik_Common::getRequestVar('date', false);
$date = Piwik_Date::factory($date);
if ($date->isToday()) {
return;
}
$websiteId = Piwik_Common::getRequestVar('idSite', false);
if ($websiteId) {
$website = new Piwik_Site($websiteId);
if ($website->getCreationDate()->isToday()) {
Piwik::redirectToModule('CoreHome', 'index', array('date' => 'today', 'idSite' => $websiteId, 'period' => Piwik_Common::getRequestVar('period')));
}
}
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:15,代码来源:Controller.php
示例9: removeHoursInFuture
protected function removeHoursInFuture($table, $idSite, $period, $date)
{
$site = new Piwik_Site($idSite);
if ($period == 'day' && ($date == 'today' || $date == Piwik_Date::factory('now', $site->getTimezone())->toString())) {
$currentHour = Piwik_Date::factory('now', $site->getTimezone())->toString('G');
$idsToDelete = array();
foreach ($table->getRows() as $id => $row) {
$hour = $row->getColumn('label');
if ($hour > $currentHour) {
$idsToDelete[] = $id;
}
}
$table->deleteRows($idsToDelete);
}
return $table;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:16,代码来源:API.php
示例10: setColumnsToDisplay
public function setColumnsToDisplay($columnsNames)
{
$newColumnsNames = array();
$goals = array();
$idSite = $this->getIdSite();
if ($idSite) {
$goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
$ecommerceGoal = array('idgoal' => Piwik_Archive::LABEL_ECOMMERCE_ORDER, 'name' => Piwik_Translate('Goals_EcommerceOrder'));
$site = new Piwik_Site($idSite);
//Case Ecommerce report table
if ($this->isEcommerce) {
$goals = array($ecommerceGoal);
} elseif ($site->isEcommerceEnabled()) {
$goals = array_merge(array($ecommerceGoal), $goals);
}
}
foreach ($columnsNames as $columnName) {
if (in_array($columnName, array('goal_%s_conversion_rate', 'goal_%s_nb_conversions', 'goal_%s_revenue_per_visit', 'goal_%s_revenue', 'goal_%s_avg_order_revenue', 'goal_%s_items'))) {
foreach ($goals as $goal) {
$idgoal = $goal['idgoal'];
// Columns names are escaped in smarty via | escape:'html'
$goal['name'] = Piwik_Common::unsanitizeInputValue($goal['name']);
if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal && !$this->isEcommerce) {
continue;
}
$name = Piwik_Translate($this->getColumnTranslation($columnName), $goal['name']);
$columnNameGoal = str_replace('%s', $idgoal, $columnName);
$this->setColumnTranslation($columnNameGoal, $name);
$this->setDynamicMetricDocumentation($columnName, $columnNameGoal, $goal['name'], $goal['idgoal']);
if (strpos($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);
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:45,代码来源:Goals.php
示例11: getRank
function getRank()
{
$idSite = Piwik_Common::getRequestVar('idSite');
$site = new Piwik_Site($idSite);
$url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));
if (!empty($url) && strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
$url = 'http://' . $url;
}
if (empty($url) || !Piwik_Common::isLookLikeUrl($url)) {
$url = $site->getMainUrl();
}
$dataTable = Piwik_SEO_API::getInstance()->getRank($url);
$view = Piwik_View::factory('index');
$view->urlToRank = Piwik_SEO_RankChecker::extractDomainFromUrl($url);
$renderer = Piwik_DataTable_Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:19,代码来源:Controller.php
示例12: getAll
/**
* Returns a report displaying the total visits, actions and revenue, as
* well as the evolution of these values, of all existing sites over a
* specified period of time.
*
* If the specified period is not a 'range', this function will calculcate
* evolution metrics. Evolution metrics are metrics that display the
* percent increase/decrease of another metric since the last period.
*
* This function will merge the result of the archive query so each
* row in the result DataTable will correspond to the metrics of a single
* site. If a date range is specified, the result will be a
* DataTable_Array, but it will still be merged.
*
* @param string $period The period type to get data for.
* @param string $date The date(s) to get data for.
* @param string $segment The segments to get data for.
*/
public function getAll($period, $date, $segment = false)
{
Piwik::checkUserHasSomeViewAccess();
$isGoalPluginEnabled = Piwik_Common::isGoalPluginEnabled();
// get site data for every viewable site and cache them
if (Piwik::isUserIsSuperUser()) {
$sites = Piwik_SitesManager_API::getInstance()->getAllSites();
Piwik_Site::setSites($sites);
} else {
$sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess();
Piwik_Site::setSitesFromArray($sites);
}
// build the archive type used to query archive data
$archive = Piwik_Archive::build('all', $period, $date, $segment);
// determine what data will be displayed
$fieldsToGet = array('nb_visits', 'nb_actions');
if ($isGoalPluginEnabled) {
$revenueMetric = Piwik_Goals::getRecordName('revenue');
$fieldsToGet[] = $revenueMetric;
}
// get the data
$dataTable = $archive->getDataTableFromNumeric($fieldsToGet);
// get rid of the DataTable_Array that is created by the IndexedBySite archive type
$dataTable = $dataTable->mergeChildren();
// if the period isn't a range & a lastN/previousN date isn't used, we get the same
// data for the last period to show the evolution of visits/actions/revenue
if ($period != 'range' && !preg_match('/(last|previous)([0-9]*)/', $date, $regs)) {
if (strpos($date, ',')) {
$rangePeriod = new Piwik_Period_Range($period, $date);
$lastStartDate = Piwik_Period_Range::removePeriod($period, $rangePeriod->getDateStart(), $n = 1);
$lastEndDate = Piwik_Period_Range::removePeriod($period, $rangePeriod->getDateEnd(), $n = 1);
$strLastDate = "{$lastStartDate},{$lastEndDate}";
} else {
$strLastDate = Piwik_Period_Range::removePeriod($period, Piwik_Date::factory($date), $n = 1)->toString();
}
$pastArchive = Piwik_Archive::build('all', $period, $strLastDate, $segment);
$pastData = $pastArchive->getDataTableFromNumeric($fieldsToGet);
$pastData = $pastData->mergeChildren();
// use past data to calculate evolution percentages
$this->calculateEvolutionPercentages($dataTable, $pastData, $fieldsToGet);
}
// move the site id to a metadata column
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'idsite'));
// set the label of each row to the site name
$getNameFor = array('Piwik_Site', 'getNameFor');
$dataTable->filter('ColumnCallbackReplace', array('label', $getNameFor));
// rename the revenue column from the metric name to 'revenue'
if ($isGoalPluginEnabled) {
$mapping = array($revenueMetric => 'revenue');
$dataTable->filter('ReplaceColumnNames', array($mapping));
}
// Ensures data set sorted, for Metadata output
$dataTable->filter('Sort', array('nb_visits', 'desc', $naturalSort = false));
return $dataTable;
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:73,代码来源:API.php
示例13: tearDown
public function tearDown()
{
parent::tearDown();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache();
Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
$tempTableName = Piwik_Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME);
Piwik_Query("DROP TABLE IF EXISTS " . $tempTableName);
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:PrivacyManagerTest.php
示例14: addTopMenu
public function addTopMenu()
{
$tooltip = false;
try {
$idSite = Piwik_Common::getRequestVar('idSite');
$tooltip = Piwik_Translate('Dashboard_TopLinkTooltip', Piwik_Site::getNameFor($idSite));
} catch (Exception $ex) {
// if no idSite parameter, show no tooltip
}
$urlParams = array('module' => 'CoreHome', 'action' => 'index');
Piwik_AddTopMenu('General_Dashboard', $urlParams, true, 1, $isHTML = false, $tooltip);
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:12,代码来源:Dashboard.php
示例15: getRank
function getRank()
{
$idSite = Piwik_Common::getRequestVar('idSite');
$site = new Piwik_Site($idSite);
$url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));
if(empty($url) || @parse_url($url) === false)
{
$url = $site->getMainUrl();
}
$dataTable = Piwik_SEO_API::getInstance()->getRank($url);
$view = Piwik_View::factory('index');
$view->urlToRank = $url;
$renderer = Piwik_DataTable_Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:22,代码来源:Controller.php
示例16: checkUserHasAdminAccess
public static function checkUserHasAdminAccess($idSites)
{
if (!self::$superUser) {
$websitesAccess = self::$idSitesAdmin;
} else {
$websitesAccess = Piwik_SitesManager_API::getInstance()->getAllSitesId();
}
$idSites = Piwik_Site::getIdSitesFromIdSitesString($idSites);
foreach ($idSites as $idsite) {
if (!in_array($idsite, $websitesAccess)) {
throw new Exception("checkUserHasAdminAccess Fake exception // string not to be tested");
}
}
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:14,代码来源:FakeAccess.php
示例17: getDividend
/**
* Returns the difference between the column in the specific row and its
* sister column in the past DataTable.
*
* @param Piwik_DataTable_Row $row
* @return int|float
*/
protected function getDividend($row)
{
$currentValue = $row->getColumn($this->columnValueToRead);
// if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
// we don't add the new column
if ($currentValue === false && $this->isRevenueEvolution && !Piwik_Site::isEcommerceEnabledFor($row->getColumn('label'))) {
return false;
}
$pastRow = $this->getPastRowFromCurrent($row);
if ($pastRow) {
$pastValue = $pastRow->getColumn($this->columnValueToRead);
} else {
$pastValue = 0;
}
return $currentValue - $pastValue;
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:23,代码来源:CalculateEvolutionFilter.php
示例18: setSparklinesAndNumbers
protected function setSparklinesAndNumbers($view)
{
$view->urlSparklineNbVisits = $this->getUrlSparkline('getEvolutionGraph', array('columns' => $view->displayUniqueVisitors ? array('nb_visits', 'nb_uniq_visitors') : array('nb_visits')));
$view->urlSparklineNbPageviews = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_pageviews', 'nb_uniq_pageviews')));
$view->urlSparklineNbDownloads = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_downloads', 'nb_uniq_downloads')));
$view->urlSparklineNbOutlinks = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_outlinks', 'nb_uniq_outlinks')));
$view->urlSparklineAvgVisitDuration = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_on_site')));
$view->urlSparklineMaxActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('max_actions')));
$view->urlSparklineActionsPerVisit = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions_per_visit')));
$view->urlSparklineBounceRate = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('bounce_rate')));
$idSite = Piwik_Common::getRequestVar('idSite');
$displaySiteSearch = Piwik_Site::isSiteSearchEnabledFor($idSite);
if ($displaySiteSearch) {
$view->urlSparklineNbSearches = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_searches', 'nb_keywords')));
}
$view->displaySiteSearch = $displaySiteSearch;
$dataTableVisit = self::getVisitsSummary();
$dataRow = $dataTableVisit->getRowsCount() == 0 ? new Piwik_DataTable_Row() : $dataTableVisit->getFirstRow();
$dataTableActions = Piwik_Actions_API::getInstance()->get($idSite, Piwik_Common::getRequestVar('period'), Piwik_Common::getRequestVar('date'), Piwik_Common::getRequestVar('segment', false));
$dataActionsRow = $dataTableActions->getRowsCount() == 0 ? new Piwik_DataTable_Row() : $dataTableActions->getFirstRow();
$view->nbUniqVisitors = (int) $dataRow->getColumn('nb_uniq_visitors');
$nbVisits = (int) $dataRow->getColumn('nb_visits');
$view->nbVisits = $nbVisits;
$view->nbPageviews = (int) $dataActionsRow->getColumn('nb_pageviews');
$view->nbUniquePageviews = (int) $dataActionsRow->getColumn('nb_uniq_pageviews');
$view->nbDownloads = (int) $dataActionsRow->getColumn('nb_downloads');
$view->nbUniqueDownloads = (int) $dataActionsRow->getColumn('nb_uniq_downloads');
$view->nbOutlinks = (int) $dataActionsRow->getColumn('nb_outlinks');
$view->nbUniqueOutlinks = (int) $dataActionsRow->getColumn('nb_uniq_outlinks');
$view->averageVisitDuration = $dataRow->getColumn('avg_time_on_site');
$nbBouncedVisits = $dataRow->getColumn('bounce_count');
$view->bounceRate = Piwik::getPercentageSafe($nbBouncedVisits, $nbVisits);
$view->maxActions = (int) $dataRow->getColumn('max_actions');
$view->nbActionsPerVisit = $dataRow->getColumn('nb_actions_per_visit');
if ($displaySiteSearch) {
$view->nbSearches = (int) $dataActionsRow->getColumn('nb_searches');
$view->nbKeywords = (int) $dataActionsRow->getColumn('nb_keywords');
}
// backward compatibility:
// show actions if the finer metrics are not archived
$view->showOnlyActions = false;
if ($dataActionsRow->getColumn('nb_pageviews') + $dataActionsRow->getColumn('nb_downloads') + $dataActionsRow->getColumn('nb_outlinks') == 0 && $dataRow->getColumn('nb_actions') > 0) {
$view->showOnlyActions = true;
$view->nbActions = $dataRow->getColumn('nb_actions');
$view->urlSparklineNbActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions')));
}
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:47,代码来源:Controller.php
示例19: renderReport
public function renderReport($processedReport)
{
$isGoalPluginEnabled = Piwik_Common::isGoalPluginEnabled();
$prettyDate = $processedReport['prettyDate'];
$reportData = $processedReport['reportData'];
$evolutionMetrics = array();
$multiSitesAPIMetrics = Piwik_MultiSites_API::getApiMetrics($enhanced = true);
foreach ($multiSitesAPIMetrics as $metricSettings) {
$evolutionMetrics[] = $metricSettings[Piwik_MultiSites_API::METRIC_EVOLUTION_COL_NAME_KEY];
}
// no decimal for all metrics to shorten SMS content (keeps the monetary sign for revenue metrics)
$reportData->filter('ColumnCallbackReplace', array(array_merge(array_keys($multiSitesAPIMetrics), $evolutionMetrics), create_function('$value', '
return preg_replace_callback (
FLOAT_REGEXP,
create_function (
\'$matches\',
\'return round($matches[0]);\'
),
$value
);
')));
// evolution metrics formatting :
// - remove monetary, percentage and white spaces to shorten SMS content
// (this is also needed to be able to test $value != 0 and see if there is an evolution at all in SMSReport.tpl)
// - adds a plus sign
$reportData->filter('ColumnCallbackReplace', array($evolutionMetrics, create_function('$value', '
$matched = preg_match(FLOAT_REGEXP, $value, $matches);
return $matched ? sprintf("%+d",$matches[0]) : $value;
')));
$dataRows = $reportData->getRows();
$reportMetadata = $processedReport['reportMetadata'];
$reportRowsMetadata = $reportMetadata->getRows();
$siteHasECommerce = array();
foreach ($reportRowsMetadata as $rowMetadata) {
$idSite = $rowMetadata->getColumn('idsite');
$siteHasECommerce[$idSite] = Piwik_Site::isEcommerceEnabledFor($idSite);
}
$smarty = new Piwik_Smarty();
$smarty->assign("isGoalPluginEnabled", $isGoalPluginEnabled);
$smarty->assign("reportRows", $dataRows);
$smarty->assign("reportRowsMetadata", $reportRowsMetadata);
$smarty->assign("prettyDate", $prettyDate);
$smarty->assign("siteHasECommerce", $siteHasECommerce);
$smarty->assign("displaySiteName", $processedReport['metadata']['action'] == 'getAll');
$this->rendering .= $smarty->fetch(PIWIK_USER_PATH . '/plugins/MobileMessaging/templates/SMSReport.tpl');
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:46,代码来源:Sms.php
示例20: getGoals
/**
* Returns all Goals for a given website, or list of websites
*
* @param string|array $idSite Array or Comma separated list of website IDs to request the goals for
* @return array Array of Goal attributes
*/
public function getGoals($idSite)
{
if (!is_array($idSite)) {
$idSite = Piwik_Site::getIdSitesFromIdSitesString($idSite);
}
Piwik::checkUserHasViewAccess($idSite);
$goals = Piwik_FetchAll("SELECT * \n\t\t\t\t\t\t\t\tFROM " . Piwik_Common::prefixTable('goal') . " \n\t\t\t\t\t\t\t\tWHERE idsite IN (" . implode(", ", $idSite) . ")\n\t\t\t\t\t\t\t\t\tAND deleted = 0");
$cleanedGoals = array();
foreach ($goals as &$goal) {
if ($goal['match_attribute'] == 'manually') {
unset($goal['pattern']);
unset($goal['pattern_type']);
unset($goal['case_sensitive']);
}
$cleanedGoals[$goal['idgoal']] = $goal;
}
return $cleanedGoals;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:24,代码来源:API.php
注:本文中的Piwik_Site类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论