/** * TuiyoLocalize::initiate() * Initiates a language domain * @param mixed $domain * @param mixed $locale * @param mixed $encoding * @return */ public function initiate($domain, $locale, $encoding) { //Initialize gettText $locale = !empty($locale) ? $locale : TUIYO_DEFAULT_LOCALE; $domain = !empty($domain) ? $domain : 'system'; $encoding = !empty($encoding) ? $encoding : TUIYO_DEFAULT_ENCODING; putenv("LANG={$locale}"); if (!extension_loaded('gettext')) { TuiyoLoader::import("gettext.gettext", "elibrary", "inc"); T_setlocale(LC_ALL, $locale); T_bindtextdomain($domain, TUIYO_LOCALE); T_bind_textdomain_codeset($domain, $encoding); T_textdomain($domain); //return TRUE; } setlocale(LC_ALL, $locale); bindtextdomain($domain, TUIYO_LOCALE); bind_textdomain_codeset($domain, $encoding); textdomain($domain); $path = "components/com_tuiyo/locale/" . $locale; //Load the parameters for the site! if (!class_exists('JSite')) { $path = "../components/com_tuiyo/locale/" . $locale; } $GLOBALS['mainframe']->addMetaTag("locale", $locale); $GLOBALS['mainframe']->addCustomHeadTag('<link href="' . $path . '/LC_MESSAGES/system.client.json" lang="' . $locale . '" rel="gettext" />'); }
/** * TuiyoAPI::TuiyoAPI() * * @return */ public function TuiyoAPI() { TuiyoLoader::import("events.interfaces.idelegate"); TuiyoLoader::import("events.eventslistener"); TuiyoLoader::import("events.eventhandler"); TuiyoLoader::import("events.eventloader"); TuiyoLoader::import("events.delegate"); $GLOBALS["events"] = new TuiyoEventHandler(); self::$_loaded = TRUE; }
/** * TuiyoControllerProtocol::returnResponse() * Returns a response from the recent request * @return void */ private function returnResponse($status = 200, $body = '', $format = 'json') { $doc =& TuiyoAPI::get("document"); $docType =& $doc->getDOCTYPE(); $view =& $this->getView("protocol", empty($docType) || $docType == "html" ? $format : $docType); /** Response Formulator **/ TuiyoLoader::import("rest.response"); TuiyoLoader::import("rest.utility"); $view->display(); }
/** * Packages and downloads resources * TuiyoControllerResources::downloadResources() * * @return void */ public function downloadResources() { //Get JSON view $view = $this->getView("profile", "json"); $resp = array("code" => TUIYO_OK, "error" => null, "data" => ""); //Get Session Information $model = $this->getModel("resources"); $sData = ""; //$model->getSessionData( ); $user = TuiyoAPI::get("user", null); $fids = JRequest::getVar("fid"); //Get the resources class TuiyoLoader::import("user.uploads"); $myFiles = new TuiyoUploads("archive"); $queue = array(); foreach ($fids as $key => $fid) { if ($model->userCanDelete($user->id, $fid)) { $queue[] = $model->getFilePath($fid); } } $resourceLink = $myFiles->archiveFiles($user->id, $queue); $resp["extra"] = $resourceLink; //1. If user owns files add to archive queue; //2. Archives the files //3. Output response with download link saved in cache! //4. Download file from cache! return $view->encode($resp); }
/** * TuiyoInitiate::_loadErrorHandler() * * @return */ private function _loadErrorHandler() { TuiyoLoader::import('error.errorhandler'); TuiyoErrorHandler::getInstance(); }
/** * ****************************************************************** * Document object for the Tuiyo platform * * ****************************************************************** * @copyright : 2008 tuiyo Platform * * @license : http://platform.tuiyo.com/license BSD License * * @version : Release: $Id$ * * @link : http://platform.tuiyo.com/ * * @author : livingstone[at]drstonyhills[dot]com * * @access : Public * * @since : 1.0.0 alpha * * @package : tuiyo * * ****************************************************************** */ TuiyoLoader::import('response'); /** * TuiyoDocument * * @package tuiyo * @author Livingstone Fultang * @copyright 2009 * @version $Id$ * @access public */ class TuiyoDocument extends TuiyoResponse { private $_docBody = array(); private $_DOCTYPE = array(); private $_tmplVars = array(); private $_elements = array();
/** * TuiyoControllerProfile::extender() * Renders and profile Extender * @param mixed $profileID * @param mixed $extender * @return */ public function extender($profileID = NULL, $extender = NULL) { //You can view an extender directly by calling //view=profile&do=extender&name=twitter, Will sho just your twitter stream! $action = $this->getTask(); $action = strtolower($action); $method = strtolower(__FUNCTION__); //Reconstruct profile! if ($action === $method) { return $this->renderExtenalProfile(); } //echo __FUNCTION__ ; if (!is_null($extender) && !empty($extender)) { $extender = strtolower($extender); $xtProfile = ucfirst($extender) . "ProfileController"; $xtProfileCntrl = $extender . ".controllers." . $extender . "profile"; //Import the profile extender component TuiyoLoader::import($xtProfileCntrl, "component"); if (!class_exists($xtProfile)) { JError::raiseError(TUIYO_SERVER_ERROR, $xtProfile . " not found"); return false; } $xtProfileObject = new $xtProfile(); if (!method_exists($xtProfileObject, "render")) { JError::raiseError(TUIYO_SERVER_ERROR, $xtProfile . "::render() not found"); return false; } $externalProfile = $xtProfileObject->render(); //clean up unset($xtProfileObject); return $externalProfile; } }
* @license http://platform.tuiyo.com/license BSD License * @version Release: $Id$ * @link http://platform.tuiyo.com/ * @author livingstone[at]drstonyhills[dot]com * @access Public * @since 1.0.0 alpha * @package tuiyo */ /** * no direct access */ defined('TUIYO_EXECUTE') || die('Restricted access'); /** * Import Document */ TuiyoLoader::import('response.document'); /** * TuiyoJSON handling handling class * * @package tuiyo * @author Livingstone Fultang * @copyright 2009 * @version $Id$ * @access public */ class TuiyoJSON extends TuiyoDocument { private $parseTime = ''; private $_errors = array(); /** * TuiyoJSON::TuiyoJSON()
/** * TuiyoLoader::table() * Loads a library table * @param mixed $fileName * @param bool $createInstance * @param mixed $parameters * @return void */ public function table($fileName, $createInstance = true, $parameters = null) { TuiyoLoader::import($fileName, 'table'); $parameters = !is_null($parameters) ? $parameters : JFactory::getDBO(); if ($createInstance) { //Table File $tableClass = ucfirst(TUIYO_LIB) . 'Table' . ucfirst(self::$_loaded[$fileName]); //Had we loaded it before if (in_array($tableClass, self::$_stored["tables"])) { $object = self::$_stored["tables"][$tableClass]; if (is_object($object)) { return $object; } else { unset(self::$_stored["tables"][$tableClass]); TuiyoLoader::table($fileName, $createInstance, $parameters); } } $table = new $tableClass($parameters); self::$_stored["tables"][$tableClass] =& $table; return $table; } }
* @since : 1.0.0 alpha * * @package : tuiyo * * ****************************************************************** */ /** * no direct access */ defined('TUIYO_EXECUTE') || die('Restricted access'); /** * joomla CModel */ jimport('joomla.application.component.model'); /** * users uploads */ TuiyoLoader::import("user.uploads"); /** * TuiyoModelResources * * @package tuiyo * @author Livingstone Fultang * @copyright 2009 * @version $Id$ * @access public */ class TuiyoModelResources extends JModel { /** * Total number of items * @var integer */