Class: Hit
Source Location: /blogs/inc/MODEL/sessions/_hit.class.php
Class Hit
|
A hit to a blog. NOTE: The internal function double_check_referer() uses the class Net_IDNA_php4 from /blogs/lib/_idna_convert.class.php. It's required() only, when needed. Located in /blogs/inc/MODEL/sessions/_hit.class.php [line 45] |
| 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. |
| 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! |
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'.
ID in DB, gets set when http://www.php.net/log was called and the hit was logged.
The ID of the referer's base domain in T_basedomains
The type of referer.
Note: "spam" referers do not get logged.
Is this a reload? This gets lazy-filled by is_new_view().
API Tags:| Access: | protected |
The user's remote host.
Use get_remote_host() to access it (lazy filled).
API Tags:| Access: | protected |
|
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
|
Set $user_agent and detect the browser.
This function also handles the relations with T_useragents and sets $agent_type.
|
Get the remote hostname.
Parameters:| $allow_nslookup: |
|
Is this a browser reload (F5)?
API Tags:
| Return: | true on reload, false if not. |
|
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())?! |
|
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 |
|
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() |
