phpOpenTracker/phpOpenTracker API.php,1.46,1.47

Sebastian Bergmann <[email protected]> Fri, 27 Feb 2004 09:50:59 +0000
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7774/phpOpenTracker

Modified Files:
	API.php 
Log Message:
Flush.

Index: API.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** API.php	27 Feb 2004 09:01:29 -0000	1.46
--- API.php	27 Feb 2004 09:50:57 -0000	1.47
***************
*** 25,37 ****
  
  class phpOpenTracker_API {
      private $cache = null;
      private $configuration;
      private $container;
!     private static $apiCalls = array();
!     private static $instance = null;
!     private static $plugins = array();
  
      private function __construct() {
!         self::loadPlugins();
      }
  
--- 25,46 ----
  
  class phpOpenTracker_API {
+     private static $instance = null;
      private $cache = null;
      private $configuration;
      private $container;
!     private $apiCalls = array();
!     private $apiPlugins = array();
!     private $weekdays = array(
!       'sunday'    => 0,
!       'monday'    => 1,
!       'tuesday'   => 2,
!       'wednesday' => 3,
!       'thursday'  => 4,
!       'friday'    => 5,
!       'saturday'  => 6
!     );
  
      private function __construct() {
!         $this->loadPlugins();
      }
  
***************
*** 45,63 ****
  
      public static function get($parameters) {
!         $api = self::getInstance();
      }
  
      public static function plot($parameters) {
-         $api = self::getInstance();
      }
  
!     public static function pluginLoaded($pluginName) {
          return in_array(
            $pluginName,
!           self::$plugins
          );
      }
  
!     private static function loadPlugins() {
          if ($dir = @opendir(POT_API_PLUGIN_PATH)) {
              while (($file = @readdir($dir)) !== false) {
--- 54,83 ----
  
      public static function get($parameters) {
!         if (isset($this->apiCalls['get'][$parameters['api_call']])) {
!             $result = $this->apiCalls['get'][$parameters['api_call']]->run($parameters);
!         } else {
!             throw new phpOpenTracker_API_Exception(
!               sprintf(
!                 'Unknown API Call %s.',
! 
!                 $parameters['api_call']
!               )
!             );
!         }
! 
!         return $result;
      }
  
      public static function plot($parameters) {
      }
  
!     public function pluginLoaded($pluginName) {
          return in_array(
            $pluginName,
!           $this->apiPlugins
          );
      }
  
!     private function loadPlugins() {
          if ($dir = @opendir(POT_API_PLUGIN_PATH)) {
              while (($file = @readdir($dir)) !== false) {
***************
*** 66,70 ****
                      substr($file,  0, 1) != "#") {
                      if (@include(POT_API_PLUGIN_PATH . $file)) {
!                         self::$plugins[] = substr($file, 0, -4);
  
                          $class  = 'phpOpenTracker_API_Plugin_' . substr($file, 0, -4);
--- 86,90 ----
                      substr($file,  0, 1) != "#") {
                      if (@include(POT_API_PLUGIN_PATH . $file)) {
!                         $this->apiPlugins[] = substr($file, 0, -4);
  
                          $class  = 'phpOpenTracker_API_Plugin_' . substr($file, 0, -4);
***************
*** 72,77 ****
  
                          foreach ($plugin->apiCalls as $apiCall) {
!                             if (!isset(self::$apiCalls[$apiCall])) {
!                                 self::$apiCalls[$plugin->apiType][$apiCall] = $plugin;
                              } else {
                                  throw new phpOpenTracker_API_Exception(
--- 92,97 ----
  
                          foreach ($plugin->apiCalls as $apiCall) {
!                             if (!isset($this->apiCalls[$apiCall])) {
!                                 $this->apiCalls[$plugin->apiType][$apiCall] = $plugin;
                              } else {
                                  throw new phpOpenTracker_API_Exception(



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click