当前位置: 首页>>代码示例>>PHP>>正文


PHP printDebug函数代码示例

本文整理汇总了PHP中printDebug函数的典型用法代码示例。如果您正苦于以下问题:PHP printDebug函数的具体用法?PHP printDebug怎么用?PHP printDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了printDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLocation

 /**
  * Uses a GeoIP database to get a visitor's location based on their IP address.
  * 
  * This function will return different results based on the data used and based
  * on how the GeoIP module is configured.
  * 
  * If a region database is used, it may return the country code, region code,
  * city name, area code, latitude, longitude and postal code of the visitor.
  * 
  * Alternatively, only the country code may be returned for another database.
  * 
  * If your HTTP server is not configured to include all GeoIP information, some
  * information will not be available to Piwik.
  * 
  * @param array $info Must have an 'ip' field.
  * @return array
  */
 public function getLocation($info)
 {
     $ip = $this->getIpFromInfo($info);
     // geoip modules that are built into servers can't use a forced IP. in this case we try
     // to fallback to another version.
     $myIP = Piwik_IP::getIpFromHeader();
     if (!self::isSameOrAnonymizedIp($ip, $myIP) && (!isset($info['disable_fallbacks']) || !$info['disable_fallbacks'])) {
         printDebug("The request is for IP address: " . $info['ip'] . " but your IP is: {$myIP}. GeoIP Server Module (apache/nginx) does not support this use case... ");
         $fallbacks = array(Piwik_UserCountry_LocationProvider_GeoIp_Pecl::ID, Piwik_UserCountry_LocationProvider_GeoIp_Php::ID);
         foreach ($fallbacks as $fallbackProviderId) {
             $otherProvider = Piwik_UserCountry_LocationProvider::getProviderById($fallbackProviderId);
             if ($otherProvider) {
                 printDebug("Used {$fallbackProviderId} to detect this visitor IP");
                 return $otherProvider->getLocation($info);
             }
         }
         printDebug("FAILED to lookup the geo location of this IP address, as no fallback location providers is configured. We recommend to configure Geolocation PECL module to fix this error.");
         return false;
     }
     $result = array();
     foreach (self::$geoIpServerVars as $resultKey => $geoipVarName) {
         if (!empty($_SERVER[$geoipVarName])) {
             $result[$resultKey] = $_SERVER[$geoipVarName];
         }
     }
     foreach (self::$geoIpUtfServerVars as $resultKey => $geoipVarName) {
         if (!empty($_SERVER[$geoipVarName])) {
             $result[$resultKey] = utf8_encode($_SERVER[$geoipVarName]);
         }
     }
     $this->completeLocationResult($result);
     return $result;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:50,代码来源:ServerBased.php

示例2: writeListsToFile

function writeListsToFile($useragent, $majorArray, $minorArray)
{
    //$answer_data = serialize($majorArray);
    //$name_data = serialize($majorNamesArray);
    printDebug("LM: useragent: " . $useragent);
    printDebug("LM: major lines:" . count($majorArray));
    printDebug("LM: minor lines:" . count($minorArray));
    /*
    // test debug printout
    // use the global, match answers to names
    global $majorNamesArray;
    global $minorNamesArray;
      
    $lines = array();
    for ($i = 0; $i < count($majorArray); $i++) {
      $lines[$i] = $majorNamesArray[$i] . ": " . $majorArray[$i];
      printDebug("LM: " . $lines[$i]);
    }
    $j = count($majorArray);
    for ($i = 0; $i < count($minorArray); $i++) {
      $lines[$j] = $minorNamesArray[$i] . ": " . $minorArray[$i];
      printDebug("LM: " . $lines[$j]);
      $j++;
    }
    */
    //file_put_contents("your-file.txt", $lines);
}
开发者ID:kaputnikGo,项目名称:Mustard,代码行数:27,代码来源:listManager.php

示例3: checkHeader

 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function checkHeader($notification)
 {
     if (isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1' || isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1') {
         $exclude =& $notification->getNotificationObject();
         $exclude = true;
         printDebug("DoNotTrack found.");
         $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         header('Tk: 1');
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:DoNotTrack.php

示例4: init

 /**
  * initialize module with request datas
  * 
  * @param object request
  * @return void
  */
 function init(&$request, $o_tpl = null, $o_archive = null)
 {
     if (!is_a($o_tpl, "TemplateEngine")) {
         $o_tpl = null;
     }
     parent::init($request, $o_tpl);
     $date = $this->request->getDate();
     if (is_null($this->data)) {
         if (is_null($o_archive)) {
             $o_archive = DataModel::getArchive($this->site, $date, $this->request->getPeriod());
         }
         $this->data = new DataModel($o_archive, $this->request);
     }
     $d = new Date(getDateFromTimestamp(time()));
     if (($this->data->archive->date->get() == $d->get() || isset($this->disableCache)) && is_a($this->tpl, "TemplateEngine")) {
         printDebug("Current date asked is today's date, cache not activated<br>");
         $this->tpl->caching = 0;
     }
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:25,代码来源:ViewModule.class.php

示例5: checkHeader

 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 function checkHeader($notification)
 {
     if (isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1' || isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1') {
         $ua = Piwik_Tracker_Visit::getUserAgent($_REQUEST);
         if (strpos($ua, 'MSIE 10') !== false) {
             printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers...");
             return;
         }
         $exclude =& $notification->getNotificationObject();
         $exclude = true;
         printDebug("DoNotTrack found.");
         $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         header('Tk: 1');
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:22,代码来源:DoNotTrack.php

示例6: recordFunnelSteps

 function recordFunnelSteps($notification)
 {
     $info = $notification->getNotificationInfo();
     $idSite = $info['idSite'];
     printDebug('Looking for funnel steps');
     $funnels = Piwik_Funnels_API::getInstance()->getFunnels($idSite);
     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\t\t\t\t\t\t\t\t\t\t\t\t\tSET   idaction_url_next = ?\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE idsite = ? \n\t\t\t\t\t\t\t\t\t\t\t\t\tAND   idvisit = ? \n\t\t\t\t\t\t\t\t\t\t\t\t\tAND   idaction_url = ?\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND   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\t\t\t\t\t\t\t\t\t\t\t  FROM " . Piwik_Common::prefixTable('log_funnel_step') . " \n\t\t\t\t\t\t\t\t\t\t\t  WHERE idsite = ? \n\t\t\t\t\t\t\t\t\t\t\t  AND   idfunnel = ?\n\t\t\t\t\t\t\t\t\t\t\t  AND   idstep = ?\n\t\t\t\t\t\t\t\t\t\t\t  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\t\t\t\t\t\t\t\t\t(idvisit, idsite, idaction_url, url, \n\t\t\t\t\t\t\t\t\t idgoal, idfunnel, idstep, idlink_va, \n\t\t\t\t\t\t\t\t\t idaction_url_ref, server_time)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($idVisit, $idSite, $idActionUrl, $url, $funnel['idgoal'], $step['idfunnel'], $step['idstep'], $idLinkVisitAction, $idRefererAction, $datetimeServer));
                 }
             }
         }
     }
 }
开发者ID:jamesvl,项目名称:funnels,代码行数:38,代码来源:Funnels.php

示例7: getVisitorLocation

 /**
  * @param Piwik_Event_Notification $notification  notification object
  */
 public function getVisitorLocation($notification)
 {
     require_once PIWIK_INCLUDE_PATH . "/plugins/UserCountry/LocationProvider.php";
     $location =& $notification->getNotificationObject();
     $visitorInfo = $notification->getNotificationInfo();
     $id = Piwik_Common::getCurrentLocationProviderId();
     $provider = Piwik_UserCountry_LocationProvider::getProviderById($id);
     if ($provider === false) {
         $id = Piwik_UserCountry_LocationProvider_Default::ID;
         $provider = Piwik_UserCountry_LocationProvider::getProviderById($id);
         printDebug("GEO: no current location provider sent, falling back to default '{$id}' one.");
     }
     $location = $provider->getLocation($visitorInfo);
     // if we can't find a location, use default provider
     if ($location === false) {
         $defaultId = Piwik_UserCountry_LocationProvider_Default::ID;
         $provider = Piwik_UserCountry_LocationProvider::getProviderById($defaultId);
         $location = $provider->getLocation($visitorInfo);
         printDebug("GEO: couldn't find a location with Geo Module '{$id}', using Default '{$defaultId}' provider as fallback...");
         $id = $defaultId;
     }
     printDebug("GEO: Found IP location (provider '" . $id . "'): " . var_export($location, true));
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:26,代码来源:UserCountry.php

示例8: record

	/**
	 * Records in the DB the association between the visit and this action.
	 * 
	 * @param int idVisit is the ID of the current visit in the DB table log_visit
	 * @param int idRefererActionUrl is the ID of the last action done by the current visit. 
	 * @param int timeSpentRefererAction is the number of seconds since the last action was done. 
	 * 				It is directly related to idRefererActionUrl.
	 */
	 public function record( $idVisit, $visitorIdCookie, $idRefererActionUrl, $idRefererActionName, $timeSpentRefererAction)
	 {
		$this->loadIdActionNameAndUrl();
		
		$idActionName = in_array($this->getActionType(), array(Piwik_Tracker_Action::TYPE_ACTION_NAME, Piwik_Tracker_Action::TYPE_ACTION_URL))
							? (int)$this->getIdActionName()
							: null;
		$insert = array(
			'idvisit' => $idVisit, 
			'idsite' => $this->idSite, 
			'idvisitor' => $visitorIdCookie, 
			'server_time' => Piwik_Tracker::getDatetimeFromTimestamp($this->timestamp), 
			'idaction_url' => (int)$this->getIdActionUrl(), 
			'idaction_name' => $idActionName, 
			'idaction_url_ref' => $idRefererActionUrl, 
			'idaction_name_ref' => $idRefererActionName, 
			'time_spent_ref_action' => $timeSpentRefererAction
		);
		$customVariables = Piwik_Tracker_Visit::getCustomVariables($scope = 'page', $this->request);
		$insert = array_merge($insert, $customVariables);

		// Mysqli apparently does not like NULL inserts?
		$insertWithoutNulls = array();
		foreach($insert as $column => $value)
		{
			if(!is_null($value))
			{
				$insertWithoutNulls[$column] = $value;
			}
		}
		
		$fields = implode(", ", array_keys($insertWithoutNulls));
		$bind = array_values($insertWithoutNulls);
		$values = Piwik_Common::getSqlStringFieldsArray($insertWithoutNulls);

		$sql = "INSERT INTO ".Piwik_Common::prefixTable('log_link_visit_action'). " ($fields) VALUES ($values)";
		Piwik_Tracker::getDatabase()->query( $sql, $bind ); 
		
		$this->idLinkVisitAction = Piwik_Tracker::getDatabase()->lastInsertId(); 
		
		$info = array( 
			'idSite' => $this->idSite, 
			'idLinkVisitAction' => $this->idLinkVisitAction, 
			'idVisit' => $idVisit, 
			'idRefererActionUrl' => $idRefererActionUrl, 
			'idRefererActionName' => $idRefererActionName, 
			'timeSpentRefererAction' => $timeSpentRefererAction, 
		); 
		printDebug($insertWithoutNulls);

		/* 
		* send the Action object ($this)  and the list of ids ($info) as arguments to the event 
		*/ 
		Piwik_PostEvent('Tracker.Action.record', $this, $info);
	 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:63,代码来源:Action.php

示例9: endProcess

 protected function endProcess()
 {
     switch ($this->getState()) {
         case self::STATE_LOGGING_DISABLE:
             printDebug("Logging disabled, display transparent logo");
             $this->outputTransparentGif();
             break;
         case self::STATE_NO_GET_VARIABLE:
             printDebug("No get variables => piwik page");
             echo "<a href='index.php'>Piwik</a> is a free open source <a href='http://piwik.org'>web analytics</a> alternative to Google analytics.";
             break;
         case self::STATE_TO_REDIRECT_URL:
             $this->sendHeader('Location: ' . $this->getUrlToRedirect());
             break;
         case self::STATE_NOTHING_TO_NOTICE:
         default:
             printDebug("Nothing to notice => default behaviour");
             $this->outputTransparentGif();
             break;
     }
     printDebug("End of the page.");
     if ($GLOBALS['DEBUGPIWIK'] === true) {
         Piwik::printSqlProfilingReportLogStats(self::$db);
     }
     self::disconnectDb();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:26,代码来源:LogStats.php

示例10: handleTrackingApi

 /**
  * This method allows to set custom IP + server time when using Tracking API.
  * These two attributes can be only set by the Super User (passing token_auth).
  */
 protected function handleTrackingApi($request)
 {
     $shouldAuthenticate = Piwik_Config::getInstance()->Tracker['tracking_requests_require_authentication'];
     if ($shouldAuthenticate) {
         if (!$this->authenticateSuperUserOrAdmin($request)) {
             return;
         }
         printDebug("token_auth is authenticated!");
     } else {
         printDebug("token_auth authentication not required");
     }
     // Custom IP to use for this visitor
     $customIp = Piwik_Common::getRequestVar('cip', false, 'string', $request);
     if (!empty($customIp)) {
         $this->setForceIp($customIp);
     }
     // Custom server date time to use
     $customDatetime = Piwik_Common::getRequestVar('cdt', false, 'string', $request);
     if (!empty($customDatetime)) {
         $this->setForceDateTime($customDatetime);
     }
     // Forced Visitor ID to record the visit / action
     $customVisitorId = Piwik_Common::getRequestVar('cid', false, 'string', $request);
     if (!empty($customVisitorId)) {
         $this->setForceVisitorId($customVisitorId);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:31,代码来源:Tracker.php

示例11: loadTrackerPlugins

 protected function loadTrackerPlugins()
 {
     try {
         $pluginsTracker = Piwik_Tracker_Config::getInstance()->Plugins_Tracker;
         if (is_array($pluginsTracker) && count($pluginsTracker) != 0) {
             Piwik_PluginsManager::getInstance()->doNotLoadAlwaysActivatedPlugins();
             Piwik_PluginsManager::getInstance()->setPluginsToLoad($pluginsTracker['Plugins_Tracker']);
             printDebug("Loading plugins: { " . implode(",", $pluginsTracker['Plugins_Tracker']) . "}");
         }
     } catch (Exception $e) {
         printDebug("ERROR: " . $e->getMessage());
     }
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:13,代码来源:Tracker.php

示例12: showDebug

function showDebug($var, $trace = false, $exit = true)
{
    return printDebug($var, $trace, $exit);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:4,代码来源:functions.php

示例13: set_include_path

@ignore_user_abort(true);
if (@(include "Version.php") === false || !class_exists('Piwik_Version')) {
    set_include_path(PIWIK_INCLUDE_PATH . '/core' . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs' . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins' . PATH_SEPARATOR . get_include_path());
}
require_once "Common.php";
require_once "PluginsManager.php";
require_once "Tracker.php";
require_once "Tracker/Config.php";
require_once "Tracker/Action.php";
require_once "Cookie.php";
require_once "Tracker/Db.php";
require_once "Tracker/Visit.php";
require_once "Tracker/GoalManager.php";
session_cache_limiter('nocache');
ob_start();
if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
    date_default_timezone_set(date_default_timezone_get());
    require_once "core/ErrorHandler.php";
    require_once "core/ExceptionHandler.php";
    set_error_handler('Piwik_ErrorHandler');
    set_exception_handler('Piwik_ExceptionHandler');
    printDebug($_GET);
    Piwik_Tracker_Db::enableProfiling();
    Piwik::createConfigObject();
    Piwik::createLogObject();
}
$process = new Piwik_Tracker();
$process->main();
ob_end_flush();
printDebug($_COOKIE);
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:piwik.php

示例14: foreach

                        if (!$insertTagStmt->execute()) {
                            echo "***** Error : inserting timestamp {$v} for {$id} : " . $insertTagStmt->error . "\n";
                        }
                        foreach ($curNodeTags as $k => $v) {
                            if (!$insertTagStmt->execute()) {
                                echo "***** Error : inserting tag {$k} => {$v} for {$id} : " . $insertTagStmt->error . "\n";
                            }
                        }
                        $mysqli->commit();
                    }
                }
            }
            $curNodeAttrs = null;
            $curNodeTags = null;
        }
    }
}
$file = "change_file.osc";
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
    }
}
printDebug();
开发者ID:camomillle,项目名称:osmcamera,代码行数:30,代码来源:update_camera.php

示例15: put

 /**
  * Init the phpmv cookie used in logging. Called when no previous phpmv cookie detected.
  * 
  * @param string $uniqId Old uniqId if exists
  * 
  * @return string uniqId assigned
  */
 function put($uniqId = '')
 {
     printDebug("<br>=>Cookie is init on visitor (idcookie and last_visit_time)<br>");
     if ($uniqId == '') {
         $uniqId = md5(uniqid(rand()));
     }
     $this->setVar('idcookie', $uniqId);
     $this->setVar('last_visit_time', todayTime());
     return $uniqId;
 }
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:17,代码来源:Cookie.class.php


注:本文中的printDebug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。