Difference between revisions of "Extension talk:CurrentPages"

From Organic Design wiki
(The main functionality is all in the function called by ExtensionSetup)
 
(forgot to clear 24hr old info)
Line 5: Line 5:
 
$egCurrentPagesData = $data ? unserialize($data) : array();
 
$egCurrentPagesData = $data ? unserialize($data) : array();
  
# Add the current title data to the array
+
# If the hour has changed, clear any existing data out
# $egCurrentPagesData[ current hour (00-23) ][ requested title ] = view count
 
 
$hour = strftime('%H');
 
$hour = strftime('%H');
if (!isset($egCurrentPagesData[$hour])) $egCurrentPagesData[$hour] = array();
+
if (!isset($egCurrentPagesData[$hour]) || (isset($egCurrentPagesData['H']) && $egCurrentPagesData['H'] != $hour))
 +
$egCurrentPagesData[$hour] = array();
 +
$egCurrentPagesData['H'] = $hour;
 +
 
 +
# Increment the entry for current hour and title
 
$egCurrentPagesData[$hour][$title] = isset($egCurrentPagesData[$hour][$title]) ? $egCurrentPagesData[$hour][$title]+1 : 1;
 
$egCurrentPagesData[$hour][$title] = isset($egCurrentPagesData[$hour][$title]) ? $egCurrentPagesData[$hour][$title]+1 : 1;
  

Revision as of 01:08, 25 May 2008

The main functionality is all in the function called by ExtensionSetup,