本文整理汇总了PHP中DiscussionModel::AddView方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussionModel::AddView方法的具体用法?PHP DiscussionModel::AddView怎么用?PHP DiscussionModel::AddView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussionModel
的用法示例。
在下文中一共展示了DiscussionModel::AddView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Gdn_Statistics_Tick_Handler
public function Gdn_Statistics_Tick_Handler($Sender, $Args)
{
$Path = Gdn::Request()->Post('Path');
$Args = Gdn::Request()->Post('Args');
parse_str($Args, $Args);
$ResolvedPath = trim(Gdn::Request()->Post('ResolvedPath'), '/');
$ResolvedArgs = @json_decode(Gdn::Request()->Post('ResolvedArgs'));
$DiscussionID = NULL;
$DiscussionModel = new DiscussionModel();
// Gdn::Controller()->SetData('Path', $Path);
// Gdn::Controller()->SetData('Args', $Args);
// Gdn::Controller()->SetData('ResolvedPath', $ResolvedPath);
// Gdn::Controller()->SetData('ResolvedArgs', $ResolvedArgs);
// Comment permalink
if ($ResolvedPath == 'vanilla/discussion/comment') {
$CommentID = GetValue('CommentID', $ResolvedArgs);
$CommentModel = new CommentModel();
$Comment = $CommentModel->GetID($CommentID);
$DiscussionID = GetValue('DiscussionID', $Comment);
} elseif ($ResolvedPath == 'vanilla/discussion/index') {
$DiscussionID = GetValue('DiscussionID', $ResolvedArgs, NULL);
} elseif ($ResolvedPath == 'vanilla/discussion/embed') {
$ForeignID = GetValue('vanilla_identifier', $Args);
if ($ForeignID) {
// This will be hit a lot so let's try caching it...
$Key = "DiscussionID.ForeignID.page.{$ForeignID}";
$DiscussionID = Gdn::Cache()->Get($Key);
if (!$DiscussionID) {
$Discussion = $DiscussionModel->GetForeignID($ForeignID, 'page');
$DiscussionID = GetValue('DiscussionID', $Discussion);
Gdn::Cache()->Store($Key, $DiscussionID, array(Gdn_Cache::FEATURE_EXPIRY, 1800));
}
}
}
if ($DiscussionID) {
$DiscussionModel->AddView($DiscussionID);
}
}
示例2: Gdn_Statistics_Tick_Handler
public function Gdn_Statistics_Tick_Handler($Sender, $Args)
{
$Path = GetValue('Path', $Args);
if (preg_match('`discussion\\/(\\d+)`i', $Path, $Matches)) {
$DiscussionID = $Matches[1];
} elseif (preg_match('`discussion\\/comment\\/(\\d+)`i', $Path, $Matches)) {
$CommentID = $Matches[1];
$CommentModel = new CommentModel();
$Comment = $CommentModel->GetID($CommentID);
$DiscussionID = GetValue('DiscussionID', $Comment);
}
if (isset($DiscussionID)) {
$DiscussionModel = new DiscussionModel();
$Discussion = $DiscussionModel->GetID($DiscussionID);
$DiscussionModel->AddView($DiscussionID, GetValue('CountViews', $Discussion));
}
}