本文整理汇总了PHP中Piwik\Common::getRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::getRandomString方法的具体用法?PHP Common::getRandomString怎么用?PHP Common::getRandomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Common
的用法示例。
在下文中一共展示了Common::getRandomString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
protected function write(array $record)
{
switch ($record['level']) {
case Logger::EMERGENCY:
case Logger::ALERT:
case Logger::CRITICAL:
case Logger::ERROR:
$context = Notification::CONTEXT_ERROR;
break;
case Logger::WARNING:
$context = Notification::CONTEXT_WARNING;
break;
default:
$context = Notification::CONTEXT_INFO;
break;
}
$message = $record['level_name'] . ': ' . htmlentities($record['message']);
$notification = new Notification($message);
$notification->context = $context;
$notification->flags = 0;
try {
Manager::notify(Common::getRandomString(), $notification);
} catch (Zend_Session_Exception $e) {
// Can happen if this handler is enabled in CLI
// Silently ignore the error.
}
}
示例2: PiwikTracker
<?php
// Script that creates 100 websites, then outputs a IMG that records a pageview in each website
// Used initially to test how to handle cookies for this use case (see http://dev.piwik.org/trac/ticket/409)
use Piwik\Common;
use Piwik\FrontController;
use Piwik\Piwik;
use Piwik\Plugins\SitesManager\API;
exit;
define('PIWIK_INCLUDE_PATH', '../..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
require_once PIWIK_INCLUDE_PATH . "/libs/PiwikTracker/PiwikTracker.php";
FrontController::getInstance()->init();
Piwik::setUserHasSuperUserAccess();
$count = 100;
for ($i = 0; $i <= $count; $i++) {
$id = API::getInstance()->addSite(Common::getRandomString(), 'http://piwik.org');
$t = new PiwikTracker($id, 'http://localhost/trunk/piwik.php');
echo $id . " <img width=100 height=10 border=1 src='" . $t->getUrlTrackPageView('title') . "'><br/>";
}