예제 #1
0
 /**
  * Returns client location info
  * 
  * 
  * @param string $ip
  * @return array
  */
 public static function getClientInfoLocation($ip = NULL)
 {
     if (self::$clientInfoLocation == null) {
         self::$clientInfoLocation = unserialize(file_get_contents(self::GEOPLUGIN_URL . self::findClientIP($ip)));
     }
     return self::$clientInfoLocation;
 }
예제 #2
0
 /**
  * 
  * Changes the used plugin
  * 
  * @param string $provider The provider plugin name
  * @param string $format The data return format
  */
 public static function getPlugin($provider = NULL, $format = NULL, $api_key = NULL)
 {
     self::$plugins = array_diff(scandir(__DIR__ . '/plugins/'), array('..', '.'));
     if (isset($api_key)) {
         self::$api_key = $api_key;
     }
     if (in_array($provider . ".php", self::$plugins)) {
         require __DIR__ . '/plugins/' . $provider . '.php';
         if (in_array($format, $plugin['accepted_formats'])) {
             self::$return_format = $format;
         } else {
             self::$return_format = $plugin['default_accepted_format'];
         }
         self::$provider = $plugin;
     }
 }