phpDocumentor sessions
[ class tree: sessions ] [ index: sessions ] [ all elements ]

Class: Hit

Source Location: /qp_inc/sessions/model/_hit.class.php

Class Hit

Property Summary
integer   $agent_ID   The ID of the user agent entry in T_useragents.
string   $agent_name   The user agent name, eg "safari"
string   $agent_platform   The user agent platform, eg "mac"
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).
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.
mixed   $_extracted_keyphrase   Extracted from search referers:
mixed   $_extracted_serprank  
boolean   $_is_new_view   Is this a reload? This gets lazy-filled by is_new_view().
mixed   $_keyphrase  
string   $_remoteHost   The user's remote host.
mixed   $_serprank  

[ Top ]
Method Summary
static string   extract_keyphrase_from_referer()   Extract the keyphrase from a search engine referer url
static string   extract_serprank_from_referer()   Extract the "serp rank" from a search engine referer url
Hit   Hit()   Constructor
void   detect_admin_page()   Detect admin page
void   detect_referer()   Detect Referer (sic!).
void   detect_useragent()   Set $user_agent and detect the browser.
string   get_agent_name()   Get the User agent's name.
string   get_agent_platform()   Get the User agent's platform.
string   get_agent_type()   Get the User agent's type.
void   get_keyphrase()   Get the keyphrase from the referer
integer   get_referer_domain_ID()   Get referer_domain_ID (ID of the referer in T_basedomains).
string   get_remote_host()   Get the remote hostname.
void   get_serprank()   Get the serprank from the referer
string   get_user_agent()   Get the User agent's signature.
boolean   is_browser_reload()   Is this a browser reload (F5)?
boolean   is_firefox()   Is this Firefox?
boolean   is_gecko()   Is this Gecko?
boolean   is_lynx()   Is this Lynx?
boolean   is_macIE()   Is this MacIE?
boolean   is_new_view()   Determine if a hit is a new view (not reloaded or from a robot).
boolean   is_NS4()   Is this Netscape4?
boolean   is_opera()   Is this Opera?
boolean   is_safari()   Is this Safari?
boolean   is_winIE()   Is this WinIE?
boolean   log()   T-Tag: 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!
boolean   should_be_logged()   Tell if a HIT should be logged:

[ Top ]
Properties
integer   $agent_ID [line 152]

The ID of the user agent entry in T_useragents.

API Tags:
See:  Hit::get_agent_ID()
Access:  protected


[ Top ]
string   $agent_name [line 114]

The user agent name, eg "safari"

API Tags:
See:  Hit::get_agent_name()
Access:  protected


[ Top ]
string   $agent_platform [line 122]

The user agent platform, eg "mac"

API Tags:
See:  Hit::get_agent_platform()
Access:  protected


[ Top ]
string   $agent_type [line 144]

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'. 'rss'|'robot'|'browser'|'unknown'

API Tags:
See:  Hit::get_agent_type()
Access:  protected


[ Top ]
mixed   $ID [line 48]

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


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

Ignore this hit?


[ Top ]
string   $IP [line 98]

Remote address (IP).


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

Is the hit already logged?


[ Top ]
string   $referer [line 61]

The referer/referrer.


[ Top ]
integer   $referer_domain_ID [line 78]

The ID of the referer's base domain in T_basedomains


[ Top ]
string   $referer_type [line 71]

The type of referer.

Note: "spam" referers do not get logged. 'search'|'blacklist'|'referer'|'direct'|'spam'


[ Top ]
string   $user_agent [line 106]

The user agent.

API Tags:
See:  Hit::get_user_agent()
Access:  protected


[ Top ]
mixed   $_extracted_keyphrase = false [line 158]

Extracted from search referers:


[ Top ]
mixed   $_extracted_serprank = false [line 160]

[ Top ]
boolean   $_is_new_view [line 86]

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

API Tags:
Access:  protected


[ Top ]
mixed   $_keyphrase = NULL [line 159]

[ Top ]
string   $_remoteHost [line 131]

The user's remote host.

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

API Tags:
Access:  protected


[ Top ]
mixed   $_serprank = NULL [line 161]

[ Top ]
Methods
static method extract_keyphrase_from_referer  [line 940]

  static string extract_keyphrase_from_referer( string $ref  )

Extract the keyphrase from a search engine referer url

Typically http://google.com?s=keyphraz returns keyphraz

Parameters:
string   $ref:  referer

API Tags:
Return:  keyphrase


[ Top ]
static method extract_serprank_from_referer  [line 994]

  static string extract_serprank_from_referer( string $ref  )

Extract the "serp rank" from a search engine referer url

Typically http://google.com?s=keyphraz&start=18 returns 18

Parameters:
string   $ref:  referer

API Tags:
Return:  keyphrase


[ Top ]
Constructor Hit  [line 169]

  Hit Hit( )

Constructor

This may INSERT a basedomain and a useragent but NOT the HIT itself!



[ Top ]
detect_admin_page  [line 195]

  void detect_admin_page( )

Detect admin page



[ Top ]
detect_referer  [line 216]

  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 387]

  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_agent_name  [line 776]

  string get_agent_name( )

Get the User agent's name.



[ Top ]
get_agent_platform  [line 791]

  string get_agent_platform( )

Get the User agent's platform.



[ Top ]
get_agent_type  [line 806]

  string get_agent_type( )

Get the User agent's type.



[ Top ]
get_keyphrase  [line 694]

  void get_keyphrase( )

Get the keyphrase from the referer



[ Top ]
get_referer_domain_ID  [line 336]

  integer get_referer_domain_ID( )

Get referer_domain_ID (ID of the referer in T_basedomains).


API Tags:
Return:  (may be NULL, but should never).


[ Top ]
get_remote_host  [line 822]

  string get_remote_host( [ $allow_nslookup = false]  )

Get the remote hostname.

Parameters:
   $allow_nslookup: 


[ Top ]
get_serprank  [line 715]

  void get_serprank( )

Get the serprank from the referer



[ Top ]
get_user_agent  [line 738]

  string get_user_agent( )

Get the User agent's signature.


API Tags:
Return:  False, if not provided or empty, if it included tags.


[ Top ]
is_browser_reload  [line 919]

  boolean is_browser_reload( )

Is this a browser reload (F5)?


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


[ Top ]
is_firefox  [line 1020]

  boolean is_firefox( )

Is this Firefox?



[ Top ]
is_gecko  [line 1031]

  boolean is_gecko( )

Is this Gecko?



[ Top ]
is_lynx  [line 1009]

  boolean is_lynx( )

Is this Lynx?



[ Top ]
is_macIE  [line 1053]

  boolean is_macIE( )

Is this MacIE?



[ Top ]
is_new_view  [line 867]

  boolean is_new_view( )

Determine if a hit is a new view (not reloaded 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 ]
is_NS4  [line 1086]

  boolean is_NS4( )

Is this Netscape4?



[ Top ]
is_opera  [line 1075]

  boolean is_opera( )

Is this Opera?



[ Top ]
is_safari  [line 1064]

  boolean is_safari( )

Is this Safari?



[ Top ]
is_winIE  [line 1042]

  boolean is_winIE( )

Is this WinIE?



[ Top ]
log  [line 544]

  boolean log( )

T-Tag: 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().

It will call Hitlist::dbprune() to do the automatic pruning of old hits in case of auto_prune_stats_mode == "page".


API Tags:
Return:  true if the hit gets logged; false if not
Uses:  Log::record_the_hit()


[ Top ]
record_the_hit  [line 617]

  void record_the_hit( )

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

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


API Tags:
Usedby:  basic_antispam_plugin::double_check_referer()


[ Top ]
should_be_logged  [line 585]

  boolean should_be_logged( )

Tell if a HIT should be logged:



[ Top ]