本文整理汇总了PHP中Piwik_Common类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Common类的具体用法?PHP Piwik_Common怎么用?PHP Piwik_Common使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_Common类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: renderTable
protected function renderTable($table)
{
if (!$table instanceof Piwik_DataTable_Array) {
throw new Exception("RSS Feed only used on DataTable_Array");
}
$idSite = Piwik_Common::getRequestVar('idSite', 1);
$period = Piwik_Common::getRequestVar('period');
$currentUrl = Piwik_Url::getCurrentUrlWithoutFileName();
$piwikUrl = $currentUrl . "?module=Home&action=index&idSite=" . $idSite . "&period=" . $period;
$out = "";
$moreRecentFirst = array_reverse($table->getArray(), true);
foreach ($moreRecentFirst as $date => $subtable) {
$timestamp = $table->metaData[$date]['timestamp'];
$site = $table->metaData[$date]['site'];
$pudDate = date('r', $timestamp);
$dateUrl = date('Y-m-d', $timestamp);
$thisPiwikUrl = htmlentities($piwikUrl . "&date={$dateUrl}");
$siteName = $site->getName();
$title = $siteName . " on " . $date;
$out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
$out .= htmlspecialchars($this->renderDataTable($subtable));
$out .= "</description>\n\t</item>\n";
}
$header = $this->getRssHeader();
$footer = $this->getRssFooter();
return $this->output($header . $out . $footer);
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:27,代码来源:Rss.php
示例2: init
function init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable)
{
parent::init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable);
$this->setParametersToModify(array('date' => Piwik_Common::getRequestVar('date', 'last30', 'string')));
$this->disableShowAllViewsIcons();
$this->disableShowTable();
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:ChartEvolution.php
示例3: index
public function index()
{
Piwik::checkUserIsSuperUser();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
switch (Piwik_Common::getRequestVar('form')) {
case "formMaskLength":
$this->handlePluginState(Piwik_Common::getRequestVar("anonymizeIPEnable", 0));
$maskLength = Zend_Registry::get('config')->Tracker;
$maskLength->ip_address_mask_length = Piwik_Common::getRequestVar("maskLength", 1);
Zend_Registry::get('config')->Tracker = $maskLength->toArray();
break;
case "formDeleteSettings":
$deleteLogs = Zend_Registry::get('config')->Deletelogs;
$deleteLogs->delete_logs_enable = Piwik_Common::getRequestVar("deleteEnable", 0);
$deleteLogs->delete_logs_schedule_lowest_interval = Piwik_Common::getRequestVar("deleteLowestInterval", 7);
$deleteLogs->delete_logs_older_than = (int) Piwik_Common::getRequestVar("deleteOlderThan", 180) < 7 ? 7 : Piwik_Common::getRequestVar("deleteOlderThan", 180);
$deleteLogs->delete_max_rows_per_run = Piwik_Common::getRequestVar("deleteMaxRows", 100);
Zend_Registry::get('config')->Deletelogs = $deleteLogs->toArray();
break;
default:
//do nothing
break;
}
}
return $this->redirectToIndex('PrivacyManager', 'privacySettings', null, null, null, array('updated' => 1));
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:26,代码来源:Controller.php
示例4: activate
function activate()
{
Piwik::checkUserIsSuperUser();
$pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin');
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:Controller.php
示例5: main
public function main()
{
$this->idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
$this->processOnlyIdGoal = Piwik_Common::getRequestVar('idGoal', 0, 'string');
$this->isEcommerce = $this->processOnlyIdGoal == Piwik_Archive::LABEL_ECOMMERCE_ORDER;
$this->viewProperties['show_exclude_low_population'] = true;
$this->viewProperties['show_goals'] = true;
if (Piwik_Common::getRequestVar('documentationForGoalsPage', 0, 'int') == 1) {
$this->setReportDocumentation(Piwik_Translate('Goals_ConversionByTypeReportDocumentation', array('<br />', '<br />', '<a href="http://piwik.org/docs/tracking-goals-web-analytics/" target="_blank">', '</a>')));
}
$this->setMetricDocumentation('nb_visits', Piwik_Translate('Goals_ColumnVisits'));
if ($this->isEcommerce) {
$this->setMetricDocumentation('revenue_per_visit', Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('General_EcommerceOrders')));
$this->setColumnsTranslations(array('goal_%s_conversion_rate' => Piwik_Translate('Goals_ConversionRate'), 'goal_%s_nb_conversions' => Piwik_Translate('General_EcommerceOrders'), 'goal_%s_revenue' => Piwik_Translate('General_TotalRevenue'), 'goal_%s_revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit'), 'goal_%s_avg_order_revenue' => Piwik_Translate('General_AverageOrderValue'), 'goal_%s_items' => Piwik_Translate('General_PurchasedProducts')));
$this->setColumnsToDisplay(array('label', 'nb_visits', 'goal_%s_nb_conversions', 'goal_%s_revenue', 'goal_%s_conversion_rate', 'goal_%s_avg_order_revenue', 'goal_%s_items', 'goal_%s_revenue_per_visit'));
// Default sort column
$this->setSortedColumn('goal_ecommerceOrder_revenue', 'desc');
} else {
$this->setMetricDocumentation('revenue_per_visit', Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('Goals_EcommerceAndGoalsMenu')));
$this->setColumnsTranslations(array('goal_%s_conversion_rate' => Piwik_Translate('Goals_ConversionRate'), 'goal_%s_nb_conversions' => Piwik_Translate('Goals_Conversions'), 'goal_%s_revenue' => '%s ' . Piwik_Translate('Goals_ColumnRevenue'), 'goal_%s_revenue_per_visit' => '%s ' . Piwik_Translate('General_ColumnValuePerVisit'), 'nb_conversions' => Piwik_Translate('Goals_ColumnConversions'), 'conversion_rate' => Piwik_Translate('General_ColumnConversionRate'), 'revenue' => Piwik_Translate('Goals_ColumnRevenue'), 'revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit')));
$this->setColumnsToDisplay(array('label', 'nb_visits', 'goal_%s_nb_conversions', 'goal_%s_conversion_rate', 'goal_%s_revenue', 'goal_%s_revenue_per_visit', 'revenue_per_visit'));
// Default sort column
$columnsToDisplay = $this->getColumnsToDisplay();
$columnNbConversionsCurrentGoal = $columnsToDisplay[2];
if ($this->processOnlyIdGoal > 0 && strpos($columnNbConversionsCurrentGoal, '_nb_conversions') !== false) {
$this->setSortedColumn($columnNbConversionsCurrentGoal, 'desc');
}
}
parent::main();
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:30,代码来源:Goals.php
示例6: getSql
static function getSql($schema = 'Myisam')
{
if(!Piwik::isTimezoneSupportEnabled())
{
return array();
}
// @see http://bugs.php.net/46111
$timezones = timezone_identifiers_list();
$brokenTZ = array();
foreach ($timezones as $timezone) {
$testDate = "2008-08-19 13:00:00 " . $timezone;
if (!strtotime($testDate)) {
$brokenTZ[] = $timezone;
}
}
$timezoneList = '"'. implode('","', $brokenTZ) . '"';
return array(
'UPDATE '. Piwik_Common::prefixTable('site') .'
SET timezone = "UTC"
WHERE timezone IN ('. $timezoneList .')' => false,
'UPDATE `'. Piwik_Common::prefixTable('option') .'`
SET option_value = "UTC"
WHERE option_name = "SitesManager_DefaultTimezone"
AND option_value IN ('. $timezoneList .')' => false,
);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:0.9.1.php
示例7: update
static function update()
{
$config = Zend_Registry::get('config');
$salt = Piwik_Common::generateUniqId();
try {
if(isset($config->superuser->salt))
{
return;
}
if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
{
$superuser_info = $config->superuser->toArray();
$superuser_info['salt'] = $salt;
$config->superuser = $superuser_info;
$config->__destruct();
Piwik::createConfigObject();
return;
}
} catch(Exception $e) { }
throw new Piwik_Updater_UpdateErrorException("Edit config.ini.php and add below <code>[superuser]</code> the following line <br/><code>salt = $salt</code>");
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:0.5.2.php
示例8: update
static function update()
{
$obsoleteFiles = array(
PIWIK_INCLUDE_PATH . '/core/Db/Mysqli.php',
);
foreach($obsoleteFiles as $obsoleteFile)
{
if(file_exists($obsoleteFile))
{
@unlink($obsoleteFile);
}
}
$obsoleteDirectories = array(
PIWIK_INCLUDE_PATH . '/core/Db/Pdo',
);
foreach($obsoleteDirectories as $dir)
{
if(file_exists($dir))
{
Piwik::unlinkRecursive($dir, true);
}
}
// force regeneration of cache files
Piwik::setUserIsSuperUser();
$allSiteIds = Piwik_SitesManager_API::getInstance()->getAllSitesId();
Piwik_Common::regenerateCacheWebsiteAttributes($allSiteIds);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:0.6.2.php
示例9: getIdActionFromSegment
/**
* Convert segment expression to an action ID or an SQL expression.
*
* This method is used as a sqlFilter-callback for the segments of this plugin.
* Usually, these callbacks only return a value that should be compared to the
* column in the database. In this case, that doesn't work since multiple IDs
* can match an expression (e.g. "pageUrl=@foo").
*/
function getIdActionFromSegment($string, $sqlField, $matchType = '==')
{
// Field is visit_*_idaction_url or visit_*_idaction_name
$actionType = strpos($sqlField, '_name') === false ? Piwik_Tracker_Action::TYPE_ACTION_URL : Piwik_Tracker_Action::TYPE_ACTION_NAME;
// exact matches work by returning the id directly
if ($matchType == Piwik_SegmentExpression::MATCH_EQUAL || $matchType == Piwik_SegmentExpression::MATCH_NOT_EQUAL) {
$sql = Piwik_Tracker_Action::getSqlSelectActionId();
$bind = array($string, $string, $actionType);
$idAction = Piwik_FetchOne($sql, $bind);
// if the action is not found, we hack -100 to ensure it tries to match against an integer
// otherwise binding idaction_name to "false" returns some rows for some reasons (in case &segment=pageTitle==Větrnásssssss)
if (empty($idAction)) {
$idAction = -100;
}
return $idAction;
}
// now, we handle the cases =@ (contains) and !@ (does not contain)
// build the expression based on the match type
$sql = 'SELECT idaction FROM ' . Piwik_Common::prefixTable('log_action') . ' WHERE ';
switch ($matchType) {
case '=@':
// use concat to make sure, no %s occurs because some plugins use %s in their sql
$sql .= '( name LIKE CONCAT("%", ?, "%") AND type = ' . $actionType . ' )';
break;
case '!@':
$sql .= '( name NOT LIKE CONCAT("%", ?, "%") AND type = ' . $actionType . ' )';
break;
default:
throw new Exception("This match type is not available for action-segments.");
break;
}
return array('SQL' => $sql, 'bind' => $string);
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:41,代码来源:Actions.php
示例10: 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;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:Installation.php
示例11: getSql
static function getSql($schema = 'Myisam')
{
return array(
'CREATE TABLE `'. Piwik_Common::prefixTable('option') .'` (
idoption BIGINT NOT NULL AUTO_INCREMENT ,
option_name VARCHAR( 64 ) NOT NULL ,
option_value LONGTEXT NOT NULL ,
PRIMARY KEY ( idoption , option_name )
)' => false,
// 0.1.7 [463]
'ALTER IGNORE TABLE `'. Piwik_Common::prefixTable('log_visit') .'`
CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054',
// 0.1.7 [470]
'ALTER TABLE `'. Piwik_Common::prefixTable('logger_api_call') .'`
CHANGE `parameter_names_default_values` `parameter_names_default_values` TEXT,
CHANGE `parameter_values` `parameter_values` TEXT,
CHANGE `returned_value` `returned_value` TEXT' => false,
'ALTER TABLE `'. Piwik_Common::prefixTable('logger_error') .'`
CHANGE `message` `message` TEXT' => false,
'ALTER TABLE `'. Piwik_Common::prefixTable('logger_exception') .'`
CHANGE `message` `message` TEXT' => false,
'ALTER TABLE `'. Piwik_Common::prefixTable('logger_message') .'`
CHANGE `message` `message` TEXT' => false,
// 0.2.2 [489]
'ALTER IGNORE TABLE `'. Piwik_Common::prefixTable('site') .'`
CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054',
);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:0.2.10.php
示例12: 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');
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:ResetPasswordForm.php
示例13: render
public function render()
{
$this->shuffleCloud();
$return = array();
if (empty($this->wordsArray)) {
return array();
}
$maxValue = max($this->wordsArray);
foreach ($this->wordsArray as $word => $popularity) {
$wordTruncated = $word;
if (Piwik_Common::mb_strlen($word) > $this->truncatingLimit) {
$wordTruncated = Piwik_Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...';
}
// case hideFutureHoursWhenToday=1 shows hours with no visits
if ($maxValue == 0) {
$percent = 0;
} else {
$percent = $popularity / $maxValue * 100;
}
// CSS style value
$sizeRange = $this->getClassFromPercent($percent);
$return[$word] = array('word' => $word, 'wordTruncated' => $wordTruncated, 'value' => $popularity, 'size' => $sizeRange, 'percent' => $percent);
}
return $return;
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:25,代码来源:Cloud.php
示例14: authenticate
/**
* Authenticates user
*
* @return Piwik_Auth_Result
*/
public function authenticate()
{
$rootLogin = Piwik_Config::getInstance()->superuser['login'];
$rootPassword = Piwik_Config::getInstance()->superuser['password'];
$rootToken = Piwik_UsersManager_API::getInstance()->getTokenAuth($rootLogin, $rootPassword);
if (is_null($this->login)) {
if ($this->token_auth === $rootToken) {
return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, $this->token_auth);
}
$login = Piwik_FetchOne('SELECT login
FROM ' . Piwik_Common::prefixTable('user') . '
WHERE token_auth = ?', array($this->token_auth));
if (!empty($login)) {
return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS, $login, $this->token_auth);
}
} else {
if (!empty($this->login)) {
if ($this->login === $rootLogin && $this->getHashTokenAuth($rootLogin, $rootToken) === $this->token_auth || $rootToken === $this->token_auth) {
$this->setTokenAuth($rootToken);
return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, $this->token_auth);
}
$login = $this->login;
$userToken = Piwik_FetchOne('SELECT token_auth
FROM ' . Piwik_Common::prefixTable('user') . '
WHERE login = ?', array($login));
if (!empty($userToken) && ($this->getHashTokenAuth($login, $userToken) === $this->token_auth || $userToken === $this->token_auth)) {
$this->setTokenAuth($userToken);
return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS, $login, $userToken);
}
}
}
return new Piwik_Auth_Result(Piwik_Auth_Result::FAILURE, $this->login, $this->token_auth);
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:38,代码来源:Auth.php
示例15: getEvolutionGraph
public function getEvolutionGraph( $fetch = false, $columns = false)
{
$view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, "VisitFrequency.get");
if(empty($columns))
{
$columns = Piwik_Common::getRequestVar('columns');
}
$columns = !is_array($columns) ? array($columns) : $columns;
$view->setColumnsToDisplay($columns);
$view->setColumnsTranslations(array(
'nb_visits_returning' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'),
'nb_actions_returning' => Piwik_Translate('VisitFrequency_ColumnActionsByReturningVisits'),
'avg_time_on_site_returning' => Piwik_Translate('VisitFrequency_ColumnAverageVisitDurationForReturningVisitors'),
'bounce_rate_returning' => Piwik_Translate('VisitFrequency_ColumnBounceRateForReturningVisits'),
'nb_actions_per_visit_returning' => Piwik_Translate('VisitFrequency_ColumnAvgActionsPerReturningVisit'),
));
$doc = Piwik_Translate('VisitFrequency_ReturningVisitsDocumentation').'<br />'
. Piwik_Translate('General_BrokenDownReportDocumentation').'<br />'
. Piwik_Translate('VisitFrequency_ReturningVisitDocumentation');
$view->setReportDocumentation($doc);
return $this->renderView($view, $fetch);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Controller.php
示例16: check
/**
* Check for a newer version
*/
public static function check()
{
$lastTimeChecked = Piwik_GetOption(self::LAST_TIME_CHECKED);
if($lastTimeChecked === false
|| time() - self::CHECK_INTERVAL > $lastTimeChecked )
{
$parameters = array(
'piwik_version' => Piwik_Version::VERSION,
'php_version' => phpversion(),
'url' => Piwik_Url::getCurrentUrlWithoutQueryString(),
'trigger' => Piwik_Common::getRequestVar('module','','string'),
);
$url = self::PIWIK_HOST . "?" . http_build_query($parameters, '', '&');
$timeout = self::SOCKET_TIMEOUT;
try {
$latestVersion = Piwik::sendHttpRequest($url, $timeout);
Piwik_SetOption(self::LATEST_VERSION, $latestVersion);
} catch(Exception $e) {
// e.g., disable_functions = fsockopen; allow_url_open = Off
Piwik_SetOption(self::LATEST_VERSION, '');
}
Piwik_SetOption(self::LAST_TIME_CHECKED, time(), $autoload = 1);
}
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:UpdateCheck.php
示例17: addWriteToFile
function addWriteToFile()
{
Piwik_Common::mkdir(dirname($this->logToFileFilename));
$writerFile = new Zend_Log_Writer_Stream($this->logToFileFilename);
$writerFile->setFormatter($this->fileFormatter);
$this->addWriter($writerFile);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:Log.php
示例18: main
/**
* @see Piwik_ViewDataTable::main()
*/
public function main()
{
if ($this->mainAlreadyExecuted) {
return;
}
$this->mainAlreadyExecuted = true;
// If period=range, we force the sparkline to draw daily data points
$period = Piwik_Common::getRequestVar('period');
if ($period == 'range') {
$_GET['period'] = 'day';
}
$this->loadDataTableFromAPI();
// then revert the hack for potentially subsequent getRequestVar
$_GET['period'] = $period;
$values = $this->getValuesFromDataTable($this->dataTable);
$this->isDataAvailable = true;
if (empty($values)) {
$values = array_fill(0, 30, 0);
$this->isDataAvailable = false;
}
$graph = new Piwik_Visualization_Sparkline();
$graph->setValues($values);
$graph->main();
$this->view = $graph;
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:28,代码来源:Sparkline.php
示例19: buildView
protected function buildView()
{
// access control
$idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
Piwik_API_Request::reloadAuthUsingTokenAuth();
if (!Piwik::isUserHasViewAccess($idSite)) {
throw new Exception(Piwik_TranslateException('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idSite)));
}
// collect data
$this->parametersToModify['action'] = $this->currentControllerAction;
$this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
$this->graphData = $this->getGraphData();
// build view
$view = new Piwik_View($this->dataTableTemplate);
$view->width = $this->width;
$view->height = $this->height;
$view->chartDivId = $this->getUniqueIdViewDataTable() . "Chart";
$view->graphType = $this->graphType;
$view->data = $this->graphData;
$view->isDataAvailable = strpos($this->graphData, '"series":[]') === false;
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->properties = $this->getViewProperties();
$view->reportDocumentation = $this->getReportDocumentation();
return $view;
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:25,代码来源:GenerateGraphHTML.php
示例20: sendFeedback
/**
* send email to Piwik team and display nice thanks
*/
function sendFeedback()
{
$email = Piwik_Common::getRequestVar('email', '', 'string');
$body = Piwik_Common::getRequestVar('body', '', 'string');
$category = Piwik_Common::getRequestVar('category', '', 'string');
$nonce = Piwik_Common::getRequestVar('nonce', '', 'string');
$view = Piwik_View::factory('sent');
$view->feedbackEmailAddress = Zend_Registry::get('config')->General->feedback_email_address;
try {
$minimumBodyLength = 35;
if (strlen($body) < $minimumBodyLength) {
throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
}
if (!Piwik::isValidEmailString($email)) {
throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidEmail'));
}
if (preg_match('/https?:/i', $body)) {
throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls'));
}
if (!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce)) {
throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch'));
}
Piwik_Nonce::discardNonce('Piwik_Feedback.sendFeedback');
$mail = new Piwik_Mail();
$mail->setFrom(Piwik_Common::unsanitizeInputValue($email));
$mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
$mail->setSubject('[ Feedback form - Piwik ] ' . $category);
$mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Piwik_Version::VERSION . "\n" . 'IP: ' . Piwik_Common::getIpString() . "\n" . 'URL: ' . Piwik_Url::getReferer() . "\n");
@$mail->send();
} catch (Exception $e) {
$view->ErrorString = $e->getMessage();
$view->message = $body;
}
echo $view->render();
}
开发者ID:Gninety,项目名称:Microweber,代码行数:38,代码来源:Controller.php
注:本文中的Piwik_Common类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论