b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.8) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: Hit

Source Location: /blogs/inc/MODEL/sessions/_hit.class.php

Class Hit

Property Summary
integer   $agent_ID   The ID of the user agent entry in T_useragents.
string   $agent_type   The user agent type.
mixed   $ID   ID in DB, gets set when http://www.php.net/log was called and the hit was logged.
boolean   $ignore   Ignore this hit?
string   $IP   Remote address (IP).
integer|NULL   $is_gecko  
integer|NULL   $is_lynx  
integer|NULL   $is_macIE  
integer|NULL   $is_NS4  
integer|NULL   $is_opera  
integer|NULL   $is_winIE  
boolean   $logged   Is the hit already logged?
string   $referer   The referer/referrer.
integer   $referer_domain_ID   The ID of the referer's base domain in T_basedomains
string   $referer_type   The type of referer.
string   $user_agent   The user agent.
boolean   $_is_new_view   Is this a reload? This gets lazy-filled by is_new_view().
string   $_remoteHost   The user's remote host.

[ Top ]
Method Summary
Hit   Hit()   Constructor
void   detect_referer()   Detect Referer (sic!).
void   detect_useragent()   Set $user_agent and detect the browser.
string   get_remote_host()   Get the remote hostname.
string   get_user_agent()   Get the User agent's signature.
boolean   is_browser_reload()   Is this a browser reload (F5)?
boolean   is_good_hit()   Is this a good hit? This means "no spam".
boolean   is_new_view()   Determine if a hit is a new view (not reloaded, (internally) ignored or from a robot).
boolean   log()   Log a hit on a blog page / rss feed.
void   record_the_hit()   This records the hit. You should not call this directly, but Hit::log() instead!

[ Top ]
Properties
integer   $agent_ID [line 129]

The ID of the user agent entry in T_useragents.


[ Top ]
string   $agent_type = 'unknown' [line 123]

The user agent type.

The default setting ('unknown') is taken for new entries (into T_useragents), that are not detected as 'rss', 'robot' or 'browser'.


[ Top ]
mixed   $ID [line 50]

ID in DB, gets set when http://www.php.net/log was called and the hit was logged.


[ Top ]
boolean   $ignore = false [line 93]

Ignore this hit?


[ Top ]
string   $IP [line 99]

Remote address (IP).


[ Top ]
integer|NULL   $is_gecko [line 135]

[ Top ]
integer|NULL   $is_lynx [line 134]

[ Top ]
integer|NULL   $is_macIE [line 137]

[ Top ]
integer|NULL   $is_NS4 [line 139]

[ Top ]
integer|NULL   $is_opera [line 138]

[ Top ]
integer|NULL   $is_winIE [line 136]

[ Top ]
boolean   $logged = false [line 56]

Is the hit already logged?


[ Top ]
string   $referer [line 63]

The referer/referrer.


[ Top ]
integer   $referer_domain_ID = 0 [line 79]

The ID of the referer's base domain in T_basedomains


[ Top ]
string   $referer_type [line 72]

The type of referer.

Note: "spam" referers do not get logged.


[ Top ]
string   $user_agent [line 105]

The user agent.


[ Top ]
boolean   $_is_new_view [line 87]

Is this a reload? This gets lazy-filled by is_new_view().

API Tags:
Access:  protected


[ Top ]
string   $_remoteHost [line 113]

The user's remote host.

Use get_remote_host() to access it (lazy filled).

API Tags:
Access:  protected


[ Top ]
Methods
Constructor Hit  [line 146]

  Hit Hit( )

Constructor



[ Top ]
detect_referer  [line 197]

  void detect_referer( )

Detect Referer (sic!).

Due to potential non-thread safety with getenv() (fallback), we'd better do this early.

referer_type: enum('search', 'blacklist', 'referer', 'direct'); 'spam' gets used internally



[ Top ]
detect_useragent  [line 288]

  void detect_useragent( )

Set $user_agent and detect the browser.

This function also handles the relations with T_useragents and sets $agent_type.



[ Top ]
get_remote_host  [line 484]

  string get_remote_host( [ $allow_nslookup = false]  )

Get the remote hostname.

Parameters:
   $allow_nslookup: 


[ Top ]
get_user_agent  [line 473]

  string get_user_agent( )

Get the User agent's signature.



[ Top ]
is_browser_reload  [line 593]

  boolean is_browser_reload( )

Is this a browser reload (F5)?


API Tags:
Return:  true on reload, false if not.


[ Top ]
is_good_hit  [line 582]

  boolean is_good_hit( )

Is this a good hit? This means "no spam".



[ Top ]
is_new_view  [line 529]

  boolean is_new_view( )

Determine if a hit is a new view (not reloaded, (internally) ignored or from a robot).

'Reloaded' means: visited before from the same user (in a session) or from same IP/user_agent in the last reloadpage_timeout seconds.

This gets queried by the Item objects before incrementing its view count (if the Item gets viewed in total ($dispmore)).


Information Tags:
Todo:  fplanque>> if this is only useful to display who's online or view counts, provide option to disable all those resource consuming gadgets. (Those gadgets should be plugins actually, and they should enable this query only if needed) blueyed>> Move functionality to Plugin (with a hook in Item::content())?!

[ Top ]
log  [line 398]

  boolean log( )

Log a hit on a blog page / rss feed.

This function should be called at the end of the page, otherwise if the page is displaying previous hits, it may display the current one too.

The hit will not be logged in special occasions, see $ignore and is_good_hit().


API Tags:
Return:  true if the hit gets logged; false if not


[ Top ]
record_the_hit  [line 440]

  void record_the_hit( )

This records the hit. You should not call this directly, but Hit::log() instead!

However, if a Plugin registers the Plugin::AppendHitLog(), it could be necessary to call this as a shutdown function.

It will call Hitlist::dbprune() to do the automatic pruning of old hits.


API Tags:
Usedby:  basic_antispam_plugin::double_check_referer()


[ Top ]

Documentation generated on Tue, 18 Dec 2007 23:15:47 +0100 by phpDocumentor 1.4.0