本文整理汇总了PHP中JTable::hit方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::hit方法的具体用法?PHP JTable::hit怎么用?PHP JTable::hit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::hit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHit
/**
* Test for hit method - should always return true if there is no hits column.
*
* @return void
*
* @since 12.3
*/
public function testHit()
{
$this->object->load(array('id1' => 25, 'id2' => 50));
$this->assertTrue($this->object->hit());
$object2 = new TableDbTestComposite(TestCaseDatabase::$driver);
$object2->load(array('id1' => 25, 'id2' => 50));
$this->assertEquals(6, $object2->hits);
}
示例2: hit
/**
* Override parent's behavior as we need to assign badge history when a post is being read.
*
**/
public function hit($pk = null)
{
$ip = JRequest::getVar('REMOTE_ADDR', '', 'SERVER');
$my = JFactory::getUser();
if (!empty($ip) && !empty($this->id)) {
$token = md5($ip . $this->id);
$session = JFactory::getSession();
$exists = $session->get($token, false);
if ($exists) {
return true;
}
$session->set($token, 1);
}
$state = parent::hit();
if ($this->published == DISCUSS_ID_PUBLISHED && $my->id != $this->user_id) {
// @task: Assign badge
DiscussHelper::getHelper('Badges')->assign('easydiscuss.read.discussion', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_READ_POST', $this->title));
// EasySocial integrations
DiscussHelper::getHelper('EasySocial')->assignBadge('read.question', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_READ_POST', $this->title));
// AUP Integrations
DiscussHelper::getHelper('Aup')->assign(DISCUSS_POINTS_VIEW_DISCUSSION, $my->id, $this->title);
}
return $state;
}
示例3: hit
/**
* Make sure hits are user and session sensitive
*/
public function hit($pk = null)
{
$session = JFactory::getSession();
if ($session->get('view-video-' . $this->id, false) == false) {
parent::hit();
//@since 4.1 we dump the info into video stats
$statsModel = CFactory::getModel('stats');
$statsModel->addVideoStats($this->id, 'view');
}
$session->set('view-video-' . $this->id, true);
}
示例4: hit
/**
* Override parent's hit method as we don't really want to
* carefully increment it every time a photo is viewed.
* */
public function hit($pk = null)
{
$session = JFactory::getSession();
if ($session->get('photo-view-' . $this->id, false) == false) {
parent::hit();
$session->set('photo-view-' . $this->id, true);
//@rule: We need to test if the album for this photo also has the hits.
// otherwise it would not tally when photo has large hits but not the album.
// The album hit() will take care of the album hits session correctly.
$album = JTable::getInstance('Album', 'CTable');
$album->load($this->albumid);
$album->hit();
}
}
示例5: hit
/**
* Override parent's hit method as we don't really want to
* carefully increment it every time a photo is viewed.
* */
public function hit($pk = null)
{
$session = JFactory::getSession();
if ($session->get('album-view-' . $this->id, false) == false) {
parent::hit();
$session->set('album-view-' . $this->id, true);
}
}
示例6: addHit
/**
* Override parent's hit behavior
*
* @since 1.0
* @access public
* @return boolean
*/
public function addHit()
{
$ip = JRequest::getVar('REMOTE_ADDR', '', 'SERVER');
if (!empty($ip) && !empty($this->id)) {
$token = md5($ip . $this->id . $this->_tbl);
$session = JFactory::getSession();
$exists = $session->get($token, false);
if ($exists) {
return true;
}
$session->set($token, 1);
}
return parent::hit();
}
示例7: hit
/**
* Make sure hits are user and session sensitive
*/
public function hit($pk = null)
{
$session = JFactory::getSession();
if ($session->get('view-event-' . $this->id, false) == false) {
parent::hit();
//@since 4.1 when a there is a new view in event, dump the data into event stats
$statsModel = CFactory::getModel('stats');
$statsModel->addEventStats($this->id, 'view');
}
$session->set('view-event-' . $this->id, true);
}