Location: PHPKode > projects > Gemibloo > Gemibloo1_0_alpha1/application/plugins/export/class.ExportFireeagle.php
<?php
	require_once(dirname(__FILE__).'/../../core/class/class.PluginExport.php');
	require_once(dirname(__FILE__).'/../../core/lib/class.Fireeagle.php');
	
	/**
	* ExportFireeagle class  (SINGLETON see http://en.wikipedia.org/wiki/Singleton_pattern)
	*
	*This class updates Yahoo! Fire Eagle account
	*
	* @author Olivier G <hide@address.com>
	* @version 1.0
	* @license http://opensource.org/licenses/gpl-license.php GNU Public License
	* @link http://gemibloo.fr
	*/	
	final class ExportFireeagle extends PluginExport{
		private static $_instance;
		
		/**
		* __construct
		*/
		private function __construct() {}
		/**
		* __clone
		*/
		private function __clone() {}
		/**
		* fGetInstance method
		*/
		public static function fGetInstance() 
		{
			if (!isset(self::$_instance)) {
				$c = __CLASS__;
				self::$_instance = new $c;
			}
			return self::$_instance;
		}//getInstance

		/**
		* fExport method.
		* 
		* Main method of the class. It uses Fireeagl php library to connect to FireEagle and
		* -update location with the location of the entry
		* It throws ExportException typed exceptions if something goes wrong.
		*/
		public function fExport(){//This method throw exception
			if( (strlen(FIREEAGLE_APP_TOKEN) != 0) && (strlen(FIREEAGLE_APP_SECRET) != 0) 
			&& (strlen(FIREEAGLE_USER_TOKEN) != 0)  && (strlen(FIREEAGLE_USER_SECRET) != 0) ){
				$this->_fInitialize();
				try{
					$fe = new FireEagle(FIREEAGLE_APP_TOKEN, FIREEAGLE_APP_SECRET, FIREEAGLE_USER_TOKEN, FIREEAGLE_USER_SECRET);
					$fe->update(array("lat" => $this->_lat, "lon" => $this->_lng));
					Log::fGetInstance()->fLog(Log::$TYPE['info'] ,__CLASS__, 'Location  changed to ('.$this->_lat.','.$this->_lng.')');
				}catch (Exception $e) {
					Log::fGetInstance()->fLog(Log::$TYPE['error'] ,__CLASS__, 'Location could not be updated');
				}
			}//if
		}//fExport
	}//ExportFireeagle
?>
Return current item: Gemibloo