aliroJoomla.php

Go to the documentation of this file.
00001 <?php
00002 
00008 define ('JPATH_ADMINISTRATOR', _ALIRO_ADMIN_PATH);
00009 define ('_JEXEC', 1);
00010 define( 'JREQUEST_NOTRIM', _MOS_NOTRIM );
00011 define( 'JREQUEST_ALLOWRAW' , _MOS_ALLOWRAW );
00012 define( 'JREQUEST_ALLOWHTML', _MOS_ALLOWHTML );
00013 
00014 define ('_J_ALLOWHTML', _MOS_ALLOWHTML);
00015 
00016 class aliroJoomla extends aliroFriendlyBase {
00017     public function getValue ($property) {
00018         $parts = explode('.', $property);
00019         $p = count($parts) > 1 ? $parts[1] : $parts[0];
00020         return $this->getCfg($p);
00021     }
00022 }
00023 
00024 function jimport () {}
00025 
00026 class JApplicationHelper {
00027     public static function getPath ($name) {
00028         $mainframe = mosMainFrame::getInstance();
00029         return $mainframe->getPath($name);
00030     }
00031 }
00032 
00033 class JFactory {
00034     public static function getDBO () {
00035         return joomlaDatabase::getInstance();
00036     }
00037     public static function getconfig () {
00038         return new aliroJoomla();
00039     }
00040 }
00041 
00042 class JRequest {
00043     public static function getvar ($name, $default=null, $arr='default', $type='none', $flags=0) {
00044         $mapname = array ('POST' => '_POST', 'GET' => '_GET', 'REQUEST' => '_REQUEST');
00045         $arr = strtoupper($arr);
00046         eval('$source =& '."$$mapname[$arr];");
00047         $result = aliroRequest::getInstance()->getParam($source, $name, $default, $flags);
00048         if ('params' == $name) {
00049             $p = new aliroParameters($result);
00050             return $p->asPost();
00051         }
00052         else return $result;
00053     }
00054 }
00055 
00056 class JError {
00057     public static function raiseWarning ($number, $text) {
00058         aliroRequest::getInstance()->setErrorMessage($text, _ALIRO_ERROR_WARN);
00059     }
00060     public static function raiseNotice ($number, $text) {
00061         aliroRequest::getInstance()->setErrorMessage($text, _ALIRO_ERROR_INFORM);
00062     }
00063     public static function isError ($object) {
00064         return is_a($object, 'JException') OR is_a($object, 'JError') OR is_a($object, 'Exception');
00065     }
00066 }
00067 
00068 class JALanguage {
00069     private static $instance = __CLASS__;
00070     public $translations = array();
00071     private function __construct () {
00072         $cname = _ALIRO_COMPONENT_NAME;
00073         $lang = _JOOMLA_LANGUAGE;
00074         $fp = @fopen(_ALIRO_CURRENT_PATH."/components/$cname/$lang.$cname.ini", 'rb');
00075         if ($fp) while (!feof($fp)) {
00076             $line = fgets($fp);
00077             if ($line AND '#' == $line[0]) continue;
00078             $assigns = explode('=',$line);
00079             if (2 == count($assigns)) $this->translations[trim($assigns[0])] = trim($assigns[1]);
00080         }           
00081     }
00082     public static function getInstance () {
00083         return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
00084     }
00085 }
00086 
00087 class JText {
00088     public static function _($string) {
00089         $language = JALanguage::getInstance();
00090         return isset($language->translations[$string]) ? $language->translations[$string] : $string;
00091     }
00092 }
00093 
00094 class JToolBar {
00095     public function __construct ($name) {
00096     }
00097     public function appendButton ($mode, $image, $text, $task, $extended, $listprompt) {
00098         aliroAdminToolbar::getInstance()->addToToolBar ($task, $text, $image, $image, $extended, $listprompt);
00099     }
00100     public function render () {}
00101 }
00102 
00103 class JParameter extends aliroParameters {}
00104     
00105 class JDatabase extends aliroDatabase {
00106     protected static $instance = 'JDatabase';
00107     public function __construct ($options) {
00108         $this->database = new aliroDatabaseHandler ($options['host'], $options['user'], $options['password'], $options['database'], $options['prefix'], true);
00109     }
00110     public static function getInstance () {
00111         $options = func_get_arg(0);
00112         if (!is_object(self::$instance)) self::$instance = new self::$instance($options);
00113         if (self::$instance->getErrorNum()) {
00114             $result = new JException(T_('Database credentials invalid in JDatabasae'));
00115             return $result;
00116         }
00117         return self::$instance;
00118     }   
00119 }
00120 
00121 class JException {
00122     public function __construct ($message) {
00123     }
00124 }

Generated on Thu Apr 17 13:03:26 2008 for ALIRO by  doxygen 1.5.5