Changeset 2068 for trunk/modules/kobot
- Timestamp:
- 02/16/2008 07:20:36 PM (9 months ago)
- Files:
-
- 1 modified
-
trunk/modules/kobot/libraries/Kobot.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/kobot/libraries/Kobot.php
r2067 r2068 104 104 } 105 105 106 public function __get($key) 107 { 108 if (isset($this->$key)) 109 { 110 return $this->$key; 111 } 112 } 113 106 114 public function default_responses() 107 115 { … … 135 143 $this->set_trigger('^info ([^\s]+)$', array($this, 'trigger_info')); 136 144 145 // Set the "uptime" timer for 60 minutes 146 $this->set_timer(60 * 60, array($this, 'timer_uptime')); 147 137 148 foreach ($this->dropped as $cmd) 138 149 { 139 150 // Drop all requested commands 140 151 $this->set_response($cmd, array($this, 'response_drop')); 141 }142 }143 144 public function __get($key)145 {146 if (isset($this->$key))147 {148 return $this->$key;149 152 } 150 153 } … … 665 668 } 666 669 670 /** 671 * Default timers. 672 */ 673 674 protected function timer_uptime() 675 { 676 // Uptime array 677 $uptime = array(); 678 679 // Timespan array 680 $timespan = date::timespan((int) $this->stats['start']); 681 682 // Skip all the empty starting intervals 683 $skip = TRUE; 684 685 foreach ($timespan as $interval => $amount) 686 { 687 if ($amount > 0 OR $skip === FALSE) 688 { 689 // Stop skipping intervals 690 $skip = FALSE; 691 692 // Only add amounts that are greater than 0 693 $uptime[$interval] = $amount.' '.$interval; 694 } 695 } 696 // Add "and" before the last amount 697 $uptime[$interval] = 'and '.$uptime[$interval]; 698 699 // Log the uptime 700 $this->log(1, 'Uptime: '.implode(' ', $uptime)); 701 } 702 667 703 } // End Kobot
