Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  mod_stats
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Helper for mod_stats
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  mod_stats
  17.  * @since       1.5
  18.  */
  19. {
  20.     public static function &getList(&$params)
  21.     {
  22.         $app    JFactory::getApplication();
  23.         $db        JFactory::getDbo();
  24.         $rows    array();
  25.         $query    $db->getQuery(true);
  26.  
  27.         $serverinfo $params->get('serverinfo');
  28.         $siteinfo    $params->get('siteinfo');
  29.         $counter    $params->get('counter');
  30.         $increase    $params->get('increase');
  31.  
  32.         $i 0;
  33.         if ($serverinfo)
  34.         {
  35.             $rows[$inew stdClass;
  36.             $rows[$i]->title    JText::_('MOD_STATS_OS');
  37.             $rows[$i]->data        substr(php_uname()07);
  38.             $i++;
  39.  
  40.             $rows[$inew stdClass;
  41.             $rows[$i]->title    JText::_('MOD_STATS_PHP');
  42.             $rows[$i]->data    phpversion();
  43.             $i++;
  44.  
  45.             $rows[$inew stdClass;
  46.             $rows[$i]->title JText::_($db->name);
  47.             $rows[$i]->data    $db->getVersion();
  48.             $i++;
  49.  
  50.             $rows[$inew stdClass;
  51.             $rows[$i]->title    JTEXT::_('MOD_STATS_TIME');
  52.             $rows[$i]->data    JHtml::_('date''now''H:i');
  53.             $i++;
  54.  
  55.             $rows[$inew stdClass;
  56.             $rows[$i]->title    JText::_('MOD_STATS_CACHING');
  57.             $rows[$i]->data    $app->getCfg('caching'JText::_('JENABLED'):JText::_('JDISABLED');
  58.             $i++;
  59.  
  60.             $rows[$inew stdClass;
  61.             $rows[$i]->title    JText::_('MOD_STATS_GZIP');
  62.             $rows[$i]->data    $app->getCfg('gzip'JText::_('JENABLED'):JText::_('JDISABLED');
  63.             $i++;
  64.         }
  65.  
  66.         if ($siteinfo)
  67.         {
  68.             $query->select('COUNT(id) AS count_users')
  69.                 ->from('#__users');
  70.             $db->setQuery($query);
  71.             $users $db->loadResult();
  72.  
  73.             $query->clear()
  74.                 ->select('COUNT(id) AS count_items')
  75.                 ->from('#__content')
  76.                 ->where('state = 1');
  77.             $db->setQuery($query);
  78.             $items $db->loadResult();
  79.  
  80.             $query->clear()
  81.                 ->select('COUNT(id) AS count_links ')
  82.                 ->from('#__weblinks')
  83.                 ->where('state = 1');
  84.             $db->setQuery($query);
  85.             $links $db->loadResult();
  86.  
  87.             if ($users)
  88.             {
  89.                 $rows[$inew stdClass;
  90.                 $rows[$i]->title    JText::_('MOD_STATS_USERS');
  91.                 $rows[$i]->data    $users;
  92.                 $i++;
  93.             }
  94.  
  95.             if ($items)
  96.             {
  97.                 $rows[$inew stdClass;
  98.                 $rows[$i]->title    JText::_('MOD_STATS_ARTICLES');
  99.                 $rows[$i]->data    $items;
  100.                 $i++;
  101.             }
  102.  
  103.             if ($links)
  104.             {
  105.                 $rows[$inew stdClass;
  106.                 $rows[$i]->title    JText::_('MOD_STATS_WEBLINKS');
  107.                 $rows[$i]->data    $links;
  108.                 $i++;
  109.             }
  110.         }
  111.  
  112.         if ($counter)
  113.         {
  114.             $query->clear()
  115.                 ->select('SUM(hits) AS count_hits')
  116.                 ->from('#__content')
  117.                 ->where('state = 1');
  118.             $db->setQuery($query);
  119.             $hits $db->loadResult();
  120.  
  121.             if ($hits)
  122.             {
  123.                 $rows[$inew stdClass;
  124.                 $rows[$i]->title    JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
  125.                 $rows[$i]->data    $hits $increase;
  126.             }
  127.         }
  128.  
  129.         return $rows;
  130.     }
  131. }

Documentation generated on Tue, 19 Nov 2013 15:04:19 +0100 by phpDocumentor 1.4.3