本文整理汇总了PHP中Gdn::statistics方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn::statistics方法的具体用法?PHP Gdn::statistics怎么用?PHP Gdn::statistics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn
的用法示例。
在下文中一共展示了Gdn::statistics方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: analyticsTick
/**
* Handle the tracking of a page tick.
*/
public function analyticsTick()
{
$this->deliveryMethod(DELIVERY_METHOD_JSON);
$this->deliveryType(DELIVERY_TYPE_DATA);
Gdn::statistics()->tick();
Gdn::statistics()->fireEvent("AnalyticsTick");
$this->render();
}
示例2: securityToken
/**
* Get the security token.
*
* @param null|string $SetSecurityToken
* @return string
*/
protected function securityToken($SetSecurityToken = null)
{
static $SecurityToken = null;
if (!is_null($SetSecurityToken)) {
$SecurityToken = $SetSecurityToken;
}
if (is_null($SecurityToken)) {
$Request = array('VanillaID' => $this->VanillaID);
Gdn::statistics()->basicParameters($Request);
Gdn::statistics()->analytics('graph/getsecuritytoken.json', $Request, array('Success' => array($this, 'SecurityTokenCallback')));
}
return $SecurityToken;
}
示例3: verify
/**
* Verify connection credentials.
*
* @since 2.0.17
* @access public
*/
public function verify()
{
$CredentialsValid = Gdn::statistics()->validateCredentials();
$this->setData('StatisticsVerified', $CredentialsValid);
$this->render();
}
示例4:
Gdn::factoryInstall('Form', 'Gdn_Form', null, Gdn::FactoryInstance);
// Identity, Authenticator & Session.
Gdn::factoryInstall('Identity', 'Gdn_CookieIdentity');
Gdn::factoryInstall(Gdn::AliasSession, 'Gdn_Session');
Gdn::factoryInstall(Gdn::AliasAuthenticator, 'Gdn_Auth');
// Dispatcher.
Gdn::factoryInstall(Gdn::AliasRouter, 'Gdn_Router');
Gdn::factoryInstall(Gdn::AliasDispatcher, 'Gdn_Dispatcher', '', Gdn::FactorySingleton, [Gdn::addonManager()]);
// Smarty Templating Engine
Gdn::factoryInstall('Smarty', 'Smarty');
Gdn::factoryInstall('ViewHandler.tpl', 'Gdn_Smarty');
// Slice handler
Gdn::factoryInstall(Gdn::AliasSlice, 'Gdn_Slice');
// Remote Statistics
Gdn::factoryInstall('Statistics', 'Gdn_Statistics', null, Gdn::FactorySingleton);
Gdn::statistics();
// Regarding
Gdn::factoryInstall('Regarding', 'Gdn_Regarding', null, Gdn::FactorySingleton);
Gdn::regarding();
// Other objects.
Gdn::FactoryInstall('BBCodeFormatter', 'BBCode', null, Gdn::FactorySingleton);
Gdn::factoryInstall('Dummy', 'Gdn_Dummy');
/**
* Extension Startup
*
* Allow installed addons to execute startup and bootstrap procedures that they may have, here.
*/
// Bootstrapping.
foreach (Gdn::addonManager()->getEnabled() as $addon) {
/* @var Addon $addon */
if ($bootstrapPath = $addon->getSpecial('bootstrap')) {
示例5: settingsController_analyticsTick_create
/**
*
* @param Gdn_Controller $Sender
*/
public function settingsController_analyticsTick_create($Sender)
{
$Sender->deliveryMethod(DELIVERY_METHOD_JSON);
$Sender->deliveryType(DELIVERY_TYPE_DATA);
Gdn::statistics()->tick();
$this->fireEvent("AnalyticsTick");
$Sender->render();
}
示例6: base_render_before
/**
* Fire before every page render.
*
* @param Gdn_Controller $Sender
*/
public function base_render_before($Sender)
{
$Session = Gdn::session();
if ($Sender->MasterView == 'admin') {
if (val('Form', $Sender)) {
$Sender->Form->setStyles('bootstrap');
}
$Sender->CssClass = htmlspecialchars($Sender->CssClass);
$Sections = Gdn_Theme::section(null, 'get');
if (is_array($Sections)) {
foreach ($Sections as $Section) {
$Sender->CssClass .= ' Section-' . $Section;
}
}
// Get our plugin nav items.
$navAdapter = new NestedCollectionAdapter(DashboardNavModule::getDashboardNav());
$Sender->EventArguments['SideMenu'] = $navAdapter;
$Sender->fireEvent('GetAppSettingsMenuItems');
$Sender->removeJsFile('jquery.popup.js');
$Sender->addJsFile('vendors/jquery.checkall.min.js', 'dashboard');
$Sender->addJsFile('dashboard.js', 'dashboard');
$Sender->addJsFile('jquery.expander.js');
$Sender->addJsFile('settings.js', 'dashboard');
$Sender->addJsFile('vendors/tether.min.js', 'dashboard');
$Sender->addJsFile('vendors/bootstrap/util.js', 'dashboard');
$Sender->addJsFile('vendors/drop.min.js', 'dashboard');
$Sender->addJsFile('vendors/moment.min.js', 'dashboard');
$Sender->addJsFile('vendors/daterangepicker.js', 'dashboard');
$Sender->addJsFile('vendors/bootstrap/tooltip.js', 'dashboard');
$Sender->addJsFile('vendors/clipboard.min.js', 'dashboard');
$Sender->addJsFile('vendors/bootstrap/dropdown.js', 'dashboard');
$Sender->addJsFile('vendors/bootstrap/collapse.js', 'dashboard');
$Sender->addJsFile('vendors/bootstrap/modal.js', 'dashboard');
$Sender->addJsFile('vendors/icheck.min.js', 'dashboard');
$Sender->addJsFile('jquery.tablejenga.js', 'dashboard');
$Sender->addJsFile('jquery.fluidfixed.js', 'dashboard');
$Sender->addJsFile('vendors/prettify/prettify.js', 'dashboard');
$Sender->addJsFile('vendors/ace/ace.js', 'dashboard');
$Sender->addJsFile('vendors/ace/ext-searchbox.js', 'dashboard');
$Sender->addCssFile('vendors/tomorrow.css', 'dashboard');
}
// Check the statistics.
if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
Gdn::statistics()->check();
}
// Inform user of theme previewing
if ($Session->isValid()) {
$PreviewThemeFolder = htmlspecialchars($Session->getPreference('PreviewThemeFolder', ''));
$PreviewMobileThemeFolder = htmlspecialchars($Session->getPreference('PreviewMobileThemeFolder', ''));
$PreviewThemeName = htmlspecialchars($Session->getPreference('PreviewThemeName', $PreviewThemeFolder));
$PreviewMobileThemeName = htmlspecialchars($Session->getPreference('PreviewMobileThemeName', $PreviewMobileThemeFolder));
if ($PreviewThemeFolder != '') {
$Sender->informMessage(sprintf(t('You are previewing the %s desktop theme.'), wrap($PreviewThemeName, 'em')) . '<div class="PreviewThemeButtons">' . anchor(t('Apply'), 'settings/themes/' . $PreviewThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . ' ' . anchor(t('Cancel'), 'settings/cancelpreview/' . $PreviewThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . '</div>', 'DoNotDismiss');
}
if ($PreviewMobileThemeFolder != '') {
$Sender->informMessage(sprintf(t('You are previewing the %s mobile theme.'), wrap($PreviewMobileThemeName, 'em')) . '<div class="PreviewThemeButtons">' . anchor(t('Apply'), 'settings/mobilethemes/' . $PreviewMobileThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . ' ' . anchor(t('Cancel'), 'settings/cancelpreview/' . $PreviewMobileThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . '</div>', 'DoNotDismiss');
}
}
if ($Session->isValid()) {
$Confirmed = val('Confirmed', Gdn::session()->User, true);
if (UserModel::requireConfirmEmail() && !$Confirmed) {
$Message = formatString(t('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
$Sender->informMessage($Message, '');
}
}
// Add Message Modules (if necessary)
$MessageCache = Gdn::config('Garden.Messages.Cache', array());
$Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
$Exceptions = array('[Base]');
if (in_array($Sender->MasterView, array('', 'default'))) {
$Exceptions[] = '[NonAdmin]';
}
// SignIn popup is a special case
$SignInOnly = $Sender->deliveryType() == DELIVERY_TYPE_VIEW && $Location == 'Dashboard/entry/signin';
if ($SignInOnly) {
$Exceptions = array();
}
if ($Sender->MasterView != 'admin' && !$Sender->data('_NoMessages') && (val('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, false) || InArrayI($Location, $MessageCache))) {
$MessageModel = new MessageModel();
$MessageData = $MessageModel->getMessagesForLocation($Location, $Exceptions, $Sender->data('Category.CategoryID'));
foreach ($MessageData as $Message) {
$MessageModule = new MessageModule($Sender, $Message);
if ($SignInOnly) {
// Insert special messages even in SignIn popup
echo $MessageModule;
} elseif ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
$Sender->addModule($MessageModule);
}
}
$Sender->MessagesLoaded = '1';
// Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
}
if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
$Gdn_Statistics = Gdn::factory('Statistics');
$Gdn_Statistics->check($Sender);
//.........这里部分代码省略.........
示例7: base_render_before
/**
* Fire before every page render.
*
* @param Gdn_Controller $Sender
*/
public function base_render_before($Sender)
{
$Session = Gdn::session();
// Check the statistics.
if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
Gdn::statistics()->check();
}
// Enable theme previewing
if ($Session->isValid()) {
$PreviewThemeName = htmlspecialchars($Session->getPreference('PreviewThemeName', ''));
$PreviewThemeFolder = htmlspecialchars($Session->getPreference('PreviewThemeFolder', ''));
if ($PreviewThemeName != '') {
$Sender->Theme = $PreviewThemeName;
$Sender->informMessage(sprintf(t('You are previewing the %s theme.'), wrap($PreviewThemeName, 'em')) . '<div class="PreviewThemeButtons">' . anchor(t('Apply'), 'settings/themes/' . $PreviewThemeName . '/' . $Session->transientKey(), 'PreviewThemeButton') . ' ' . anchor(t('Cancel'), 'settings/cancelpreview/', 'PreviewThemeButton') . '</div>', 'DoNotDismiss');
}
}
if ($Session->isValid()) {
$Confirmed = val('Confirmed', Gdn::session()->User, true);
if (UserModel::requireConfirmEmail() && !$Confirmed) {
$Message = formatString(t('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
$Sender->informMessage($Message, '');
}
}
// Add Message Modules (if necessary)
$MessageCache = Gdn::config('Garden.Messages.Cache', array());
$Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
$Exceptions = array('[Base]');
if (in_array($Sender->MasterView, array('', 'default'))) {
$Exceptions[] = '[NonAdmin]';
}
// SignIn popup is a special case
$SignInOnly = $Sender->deliveryType() == DELIVERY_TYPE_VIEW && $Location == 'Dashboard/entry/signin';
if ($SignInOnly) {
$Exceptions = array();
}
if ($Sender->MasterView != 'admin' && !$Sender->data('_NoMessages') && (val('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, false) || InArrayI($Location, $MessageCache))) {
$MessageModel = new MessageModel();
$MessageData = $MessageModel->getMessagesForLocation($Location, $Exceptions, $Sender->data('Category.CategoryID'));
foreach ($MessageData as $Message) {
$MessageModule = new MessageModule($Sender, $Message);
if ($SignInOnly) {
// Insert special messages even in SignIn popup
echo $MessageModule;
} elseif ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
$Sender->addModule($MessageModule);
}
}
$Sender->MessagesLoaded = '1';
// Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
}
if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
$Gdn_Statistics = Gdn::factory('Statistics');
$Gdn_Statistics->check($Sender);
}
// Allow forum embedding
if ($Embed = c('Garden.Embed.Allow')) {
// Record the remote url where the forum is being embedded.
$RemoteUrl = c('Garden.Embed.RemoteUrl');
if (!$RemoteUrl) {
$RemoteUrl = GetIncomingValue('remote');
if ($RemoteUrl) {
saveToConfig('Garden.Embed.RemoteUrl', $RemoteUrl);
}
}
if ($RemoteUrl) {
$Sender->addDefinition('RemoteUrl', $RemoteUrl);
}
if ($remoteUrlFormat = c('Garden.Embed.RemoteUrlFormat')) {
$Sender->addDefinition('RemoteUrlFormat', $remoteUrlFormat);
}
// Force embedding?
if (!IsSearchEngine() && strtolower($Sender->ControllerName) != 'entry') {
if (IsMobile()) {
$forceEmbedForum = c('Garden.Embed.ForceMobile') ? '1' : '0';
} else {
$forceEmbedForum = c('Garden.Embed.ForceForum') ? '1' : '0';
}
$Sender->addDefinition('ForceEmbedForum', $forceEmbedForum);
$Sender->addDefinition('ForceEmbedDashboard', c('Garden.Embed.ForceDashboard') ? '1' : '0');
}
$Sender->addDefinition('Path', Gdn::request()->path());
$get = Gdn::request()->get();
unset($get['p']);
// kludge for old index.php?p=/path
$Sender->addDefinition('Query', http_build_query($get));
// $Sender->addDefinition('MasterView', $Sender->MasterView);
$Sender->addDefinition('InDashboard', $Sender->MasterView == 'admin' ? '1' : '0');
if ($Embed === 2) {
$Sender->addJsFile('vanilla.embed.local.js');
} else {
$Sender->addJsFile('embed_local.js');
}
} else {
$Sender->setHeader('X-Frame-Options', 'SAMEORIGIN');
}
//.........这里部分代码省略.........