本文整理汇总了PHP中Piwik_Common::getCacheWebsiteAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Common::getCacheWebsiteAttributes方法的具体用法?PHP Piwik_Common::getCacheWebsiteAttributes怎么用?PHP Piwik_Common::getCacheWebsiteAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Common
的用法示例。
在下文中一共展示了Piwik_Common::getCacheWebsiteAttributes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGoalDefinitions
public static function getGoalDefinitions($idSite)
{
$websiteAttributes = Piwik_Common::getCacheWebsiteAttributes($idSite);
if (isset($websiteAttributes['goals'])) {
return $websiteAttributes['goals'];
}
return array();
}
示例2: recordFunnelSteps
function recordFunnelSteps($notification)
{
$info = $notification->getNotificationInfo();
$idSite = $info['idSite'];
printDebug('Looking for funnel steps');
$websiteAttributes = Piwik_Common::getCacheWebsiteAttributes($idSite);
if (isset($websiteAttributes['funnels'])) {
$funnels = $websiteAttributes['funnels'];
printDebug('got funnel steps');
} else {
$funnels = array();
}
if (count($funnels) > 0) {
$idVisit = $info['idVisit'];
$idLinkVisitAction = $info['idLinkVisitAction'];
$idRefererAction = $info['idRefererAction'];
$action = $notification->getNotificationObject();
$actionName = $action->getActionName();
$sanitizedUrl = $action->getActionUrl();
$actionUrl = htmlspecialchars_decode($sanitizedUrl);
$idActionUrl = $action->getIdActionUrl();
$url = Piwik_Common::getRequestVar('url', '', 'string', $action->getRequest());
printDebug("idActionUrl" . $idActionUrl . " idSite " . $idSite . " idVisit " . $idVisit . " idRefererAction " . $idRefererAction);
# Is this the next action for a recorded funnel step?
$previous_step_action = Piwik_Query("UPDATE " . Piwik_Common::prefixTable('log_funnel_step') . "\n SET idaction_url_next = ?\n WHERE idsite = ? \n AND idvisit = ? \n AND idaction_url = ?\n AND idaction_url_next is null", array($idActionUrl, $idSite, $idVisit, $idRefererAction));
}
foreach ($funnels as &$funnel) {
$steps = $funnel['steps'];
foreach ($steps as &$step) {
if ($step['url'] == $actionUrl or $step['name'] == $actionName) {
printDebug("Matched Goal Funnel " . $funnel['idfunnel'] . " Step " . $step['idstep'] . "(name: " . $step['name'] . ", url: " . $step['url'] . "). ");
$serverTime = time();
$datetimeServer = Piwik_Tracker::getDatetimeFromTimestamp($serverTime);
// Look to see if this step has already been recorded for this visit
$exists = Piwik_FetchOne("SELECT idlink_va\n FROM " . Piwik_Common::prefixTable('log_funnel_step') . " \n WHERE idsite = ? \n AND idfunnel = ?\n AND idstep = ?\n AND idvisit = ?", array($idSite, $funnel['idfunnel'], $step['idstep'], $idVisit));
// Record it if not
if (!$exists) {
printDebug("Recording...");
Piwik_Query("INSERT INTO " . Piwik_Common::prefixTable('log_funnel_step') . "\n (idvisit, idsite, idaction_url, url, \n idgoal, idfunnel, idstep, idlink_va, \n idaction_url_ref, server_time)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($idVisit, $idSite, $idActionUrl, $url, $funnel['idgoal'], $step['idfunnel'], $step['idstep'], $idLinkVisitAction, $idRefererAction, $datetimeServer));
}
}
}
}
}
示例3: authenticateSuperUserOrAdmin
protected function authenticateSuperUserOrAdmin($request)
{
$tokenAuth = $this->getTokenAuth();
if (!$tokenAuth) {
return false;
}
$superUserLogin = Piwik_Config::getInstance()->superuser['login'];
$superUserPassword = Piwik_Config::getInstance()->superuser['password'];
if (md5($superUserLogin . $superUserPassword) == $tokenAuth) {
$this->authenticated = true;
return true;
}
// Now checking the list of admin token_auth cached in the Tracker config file
$idSite = Piwik_Common::getRequestVar('idsite', false, 'int', $request);
if (!empty($idSite) && $idSite > 0) {
$website = Piwik_Common::getCacheWebsiteAttributes($idSite);
$adminTokenAuth = $website['admin_token_auth'];
if (in_array($tokenAuth, $adminTokenAuth)) {
$this->authenticated = true;
return true;
}
}
printDebug("WARNING! token_auth = {$tokenAuth} is not valid, Super User / Admin was NOT authenticated");
return false;
}
示例4: isHostKnownAliasHost
protected function isHostKnownAliasHost($urlHost)
{
$websiteData = Piwik_Common::getCacheWebsiteAttributes($this->idsite);
if (isset($websiteData['hosts'])) {
$canonicalHosts = array();
foreach ($websiteData['hosts'] as $host) {
$canonicalHosts[] = str_replace('www.', '', $host);
}
$canonicalHost = str_replace('www.', '', $urlHost);
if (in_array($canonicalHost, $canonicalHosts)) {
return true;
}
}
return false;
}
示例5: excludeQueryParametersFromUrl
static public function excludeQueryParametersFromUrl($originalUrl, $idSite)
{
$website = Piwik_Common::getCacheWebsiteAttributes( $idSite );
$originalUrl = Piwik_Common::unsanitizeInputValue($originalUrl);
$originalUrl = self::cleanupString($originalUrl);
$parsedUrl = @parse_url($originalUrl);
if(empty($parsedUrl['query']))
{
return $originalUrl;
}
$campaignTrackingParameters = Piwik_Common::getCampaignParameters();
$campaignTrackingParameters = array_merge(
$campaignTrackingParameters[0], // campaign name parameters
$campaignTrackingParameters[1] // campaign keyword parameters
);
$excludedParameters = isset($website['excluded_parameters'])
? $website['excluded_parameters']
: array();
$parametersToExclude = array_merge( $excludedParameters,
self::$queryParametersToExclude,
$campaignTrackingParameters);
$parametersToExclude = array_map('strtolower', $parametersToExclude);
$queryParameters = Piwik_Common::getArrayFromQueryString($parsedUrl['query']);
$validQuery = '';
$separator = '&';
foreach($queryParameters as $name => $value)
{
if(!in_array(strtolower($name), $parametersToExclude))
{
if (is_array($value))
{
foreach ($value as $param)
{
if($param === false)
{
$validQuery .= $name.'[]'.$separator;
}
else
{
$validQuery .= $name.'[]='.$param.$separator;
}
}
}
else if($value === false)
{
$validQuery .= $name.$separator;
}
else
{
$validQuery .= $name.'='.$value.$separator;
}
}
}
$parsedUrl['query'] = substr($validQuery,0,-strlen($separator));
$url = Piwik_Common::getParseUrlReverse($parsedUrl);
printDebug('Excluding parameters "'.implode(',',$excludedParameters).'" from URL');
if($originalUrl != $url)
{
printDebug(' Before was "'.$originalUrl.'"');
printDebug(' After is "'.$url.'"');
}
return $url;
}
示例6: logResults
/** Logger hook: log number of results, if available */
public function logResults($notification)
{
$action = $notification->getNotificationObject();
$idaction = $action->getIdActionUrl();
// load site config from tracker cache
$info = $notification->getNotificationInfo();
$idsite = $info['idSite'];
$site = Piwik_Common::getCacheWebsiteAttributes($idsite);
$site['idsite'] = $idsite;
// search results passed via JS tracker
$data = Piwik_Common::getRequestVar('data', '');
$data = Piwik_Common::unsanitizeInputValue($data);
$data = json_decode($data, true);
$resultCount = false;
if (isset($data['SiteSearch_Results'])) {
$resultCount = intval($data['SiteSearch_Results']);
}
if (!empty($site['sitesearch_url']) && !empty($site['sitesearch_parameter'])) {
// check whether action is a site search
$url = preg_quote($site['sitesearch_url'], '/');
$param = preg_quote($site['sitesearch_parameter'], '/');
$regex = '/' . $url . '(.*)(&|\\?)' . $param . '=(.*?)(&|$)/i';
$actionUrl = $action->getActionUrl();
if (preg_match($regex, $actionUrl, $matches)) {
require_once PIWIK_INCLUDE_PATH . '/plugins/SiteSearch/Archive.php';
require_once PIWIK_INCLUDE_PATH . '/plugins/SiteSearch/Db.php';
Piwik_SiteSearch_Archive::logAction(array('idaction' => $idaction, 'name' => $actionUrl), $site['idsite'], $site, $resultCount);
}
}
}
示例7: isHostKnownAliasHost
public static function isHostKnownAliasHost($urlHost, $idSite)
{
$websiteData = Piwik_Common::getCacheWebsiteAttributes($idSite);
if (isset($websiteData['hosts'])) {
$canonicalHosts = array();
foreach ($websiteData['hosts'] as $host) {
$canonicalHosts[] = str_replace('www.', '', mb_strtolower($host, 'UTF-8'));
}
$canonicalHost = str_replace('www.', '', mb_strtolower($urlHost, 'UTF-8'));
if (in_array($canonicalHost, $canonicalHosts)) {
return true;
}
}
return false;
}
示例8: detectSiteSearch
protected function detectSiteSearch($originalUrl)
{
$website = Piwik_Common::getCacheWebsiteAttributes($this->idSite);
if (empty($website['sitesearch'])) {
printDebug("Internal 'Site Search' tracking is not enabled for this site. ");
return false;
}
$actionName = $url = $categoryName = $count = false;
$doTrackUrlForSiteSearch = !empty(Piwik_Config::getInstance()->Tracker['action_sitesearch_record_url']);
$originalUrl = self::cleanupUrl($originalUrl);
// Detect Site search from Tracking API parameters rather than URL
$searchKwd = Piwik_Common::getRequestVar(self::PARAMETER_NAME_SEARCH_KEYWORD, '', 'string', $this->request);
if (!empty($searchKwd)) {
$actionName = $searchKwd;
if ($doTrackUrlForSiteSearch) {
$url = $originalUrl;
}
$isCategoryName = Piwik_Common::getRequestVar(self::PARAMETER_NAME_SEARCH_CATEGORY, false, 'string', $this->request);
if (!empty($isCategoryName)) {
$categoryName = $isCategoryName;
}
$isCount = Piwik_Common::getRequestVar(self::PARAMETER_NAME_SEARCH_COUNT, -1, 'int', $this->request);
if ($this->isValidSearchCount($isCount)) {
$count = $isCount;
}
}
if (empty($actionName)) {
$parsedUrl = @parse_url($originalUrl);
// Detect Site Search from URL query parameters
if (!empty($parsedUrl['query']) || !empty($parsedUrl['fragment'])) {
// array($url, $actionName, $categoryName, $count);
$searchInfo = $this->detectSiteSearchFromUrl($website, $parsedUrl);
if (!empty($searchInfo)) {
list($url, $actionName, $categoryName, $count) = $searchInfo;
}
}
}
if (empty($actionName)) {
printDebug("(this is not a Site Search request)");
return false;
}
printDebug("Detected Site Search keyword '{$actionName}'. ");
if (!empty($categoryName)) {
printDebug("- Detected Site Search Category '{$categoryName}'. ");
}
if ($count !== false) {
printDebug("- Search Results Count was '{$count}'. ");
}
if ($url != $originalUrl) {
printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '{$originalUrl}', now is '{$url}'");
}
if (!empty($categoryName) || $count !== false) {
$this->setActionSearchMetadata($categoryName, $count);
}
return array($actionName, $url);
}