/**
  * updateStats function.
  * 
  * @access public
  * @return void
  */
 function updateStats()
 {
     global $wpsd_update_cache;
     $wpsd_update_cache = true;
     $dao = new WPSDTrendsDao();
     $factory = new WPSDStatsFactory();
     for ($i = 1; $i <= $factory->last; $i++) {
         // Update stats.
         $dao->update($i, $factory->getStats($i));
     }
 }
Example #2
0
	<td><?php 
    echo '<img src="' . WPSD_PLUGIN_URL . '/resources/images/icons/' . $icon . '.png" alt="' . $icon . ' icon" />';
    ?>
</td>
	<td<?php 
    echo $alt_count % 2 == 0 ? ' class="alternate"' : '';
    ?>
><?php 
    echo $html1;
    ?>
</td>
	<td<?php 
    echo $alt_count % 2 == 0 ? ' class="alternate"' : '';
    ?>
><?php 
    echo $html2;
    ?>
</td>
</tr>
<?php 
    $alt_count++;
}
// Start loading.
wpsd_load_stats();
$dao = new WPSDTrendsDao();
$factory = new WPSDStatsFactory();
// Update stats.
for ($i = 1; $i <= $factory->last; $i++) {
    $dao->update($i, $factory->getStats($i));
}
die;
 /**
  * doExport function.
  * 
  * @access public
  * @return void
  */
 function doExport()
 {
     if (isset($_POST['wpsd_export_excel_btn'])) {
         $dao = new WPSDTrendsDao();
         $factory = new WPSDStatsFactory();
         $export = new WPSDExcel();
         // Update stats.
         for ($i = 1; $i <= $factory->last; $i++) {
             $rows = $dao->getStats($i);
             if (null != $rows) {
                 foreach ($rows as $r) {
                     if (null != $r) {
                         $export->addRow(array($r->wpsd_trends_date, $factory->getStatsType($i), $r->wpsd_trends_stats));
                     }
                 }
             }
         }
         $export->downloadFile();
         die;
     } else {
         if (isset($_POST['wpsd_export_google_btn'])) {
             /* if(version_compare(phpversion(), '5', '>=')) { // check for php 5.
             				
             				set_time_limit ( 600 ); // 10 min time limit.
             				
             				$dao = new WPSDTrendsDao();
             
             				$factory = new WPSDStatsFactory();
             								
             				// Zend library include path
             				set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/..') . '/util/google');
             					
             				include_once(realpath(dirname(__FILE__) . '/..') . '/util/google/spreadsheet/Google_Spreadsheet.php');
             					
             				include_once(realpath(dirname(__FILE__) . '/..') . '/util/WPSDGoogleSpreadsheet.php');
             			} */
         }
     }
 }