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


PHP JTable::hit方法代码示例

本文整理汇总了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);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:15,代码来源:JTableTest.php

示例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;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:28,代码来源:post.php

示例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);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:14,代码来源:video.php

示例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();
     }
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:18,代码来源:photo.php

示例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);
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:12,代码来源:album.php

示例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();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:21,代码来源:table.php

示例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);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:14,代码来源:event.php


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