public function execute() { SPLang::load('com_sobipro.check'); $task = $this->_task = strlen($this->_task) ? $this->_task : $this->_defTask; // this is need to delete all old cache after installation if (SPRequest::int('init')) { SPFactory::cache()->cleanAll(); } switch ($this->_task) { case 'view': $this->view(); break; case 'download': $this->download(); break; default: if (method_exists($this, $this->_task)) { SPFactory::mainframe()->cleanBuffer()->customHeader(); $this->{$task}(); exit; } else { Sobi::Error('requirements', 'Task not found', SPC::WARNING, 404, __LINE__, __FILE__); exit; } break; } }
protected function getFunctionsLabel() { if (isset($this->params->interpreter)) { $interpreter = explode('.', $this->params->interpreter); $function = array_pop($interpreter); $obj = SPFactory::Instance(implode('.', $interpreter)); self::$functionsLabel = $obj->{$function}(self::$sid, self::$section); } elseif (isset($this->params->text)) { if (isset($this->params->loadTextFile)) { SPLang::load($this->params->loadTextFile); } self::$functionsLabel = Sobi::Txt($this->params->text); } }
/** * @return array */ public function struct() { if (!$this->dependency) { return parent::struct(true); } $selected = $this->getRaw(); if (isset($this->_fData->options)) { $path = SPConfig::unserialize($this->_fData->options); } else { return null; } $selectedPath = array(); $options = json_decode(SPFs::read(SOBI_PATH . '/etc/fields/select-list/definitions/' . str_replace('.xml', '.json', $this->dependencyDefinition)), true); if (isset($options['translation'])) { SPLang::load($options['translation']); $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($selected)); } if (count($path) && isset($options['translation'])) { foreach ($path as $step) { $selectedPath[$step] = $selected = Sobi::Txt(strtoupper($options['prefix']) . '.' . strtoupper($step)); } } $this->cleanCss(); return array('_complex' => 1, '_data' => $selected, '_attributes' => array('class' => $this->cssClass), '_options' => array('path' => count($selectedPath) ? $selectedPath : $path)); }
/** * @param string $message * @param bool $translate * @param string $type * @param bool $display * @return SPMessage */ public function &setMessage($message, $translate = true, $type = 'warning', $display = true) { if ($translate && !$this->langLoaded) { SPLang::load('com_sobipro.messages'); $this->langLoaded = true; } if ($type == 'message') { $type = 'info'; } if (is_array($message) && !is_string($message)) { foreach ($message as $msg) { $this->setMessage($msg['text'], $translate, $msg['type'], $display); } } $messageText = $translate ? Sobi::Txt(strtoupper($type) . '.' . $message) : $message; if ($display) { $this->messages[$type][$message] = $messageText; } $this->current = array('message' => $messageText, 'type' => $type, 'section' => array('id' => Sobi::Section(), 'name' => Sobi::Section(true))); $this->storeMessages(); return $this; }
protected function getState() { $state = SPFactory::cache()->getVar('system_state'); if (!$state) { SPLang::load('com_sobipro.messages'); $state = array(); $state['accelerator'] = array('type' => Sobi::Cfg('cache.l3_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.l3_enabled', true) ? Sobi::Txt('ACCELERATOR_ENABLED') : Sobi::Txt('ACCELERATOR_DISABLED')); $state['xml-optimiser'] = array('type' => Sobi::Cfg('cache.xml_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.xml_enabled', true) ? Sobi::Txt('XML_CACHE_ENABLED') : Sobi::Txt('XML_CACHE_DISABLED')); $state['javascript-cache'] = array('type' => Sobi::Cfg('cache.include_js_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_js_files', false) ? Sobi::Txt('JS_CACHE_ENABLED') : Sobi::Txt('JS_CACHE_DISABLED')); $state['css-cache'] = array('type' => Sobi::Cfg('cache.include_css_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_css_files', false) ? Sobi::Txt('CSS_CACHE_ENABLED') : Sobi::Txt('CSS_CACHE_DISABLED')); $state['display-errors'] = array('type' => Sobi::Cfg('debug.display_errors', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.display_errors', false) ? Sobi::Txt('DISPLAY_ERRORS_ENABLED') : Sobi::Txt('DISPLAY_ERRORS_DISABLED')); $state['debug-level'] = array('type' => Sobi::Cfg('debug.level', 0) > 2 ? 'warning' : 'success', 'label' => Sobi::Cfg('debug.level', 0) > 2 ? Sobi::Txt('DEBUG_LEVEL_TOO_HIGH') : Sobi::Txt('DEBUG_LEVEL_OK')); $state['debug-xml'] = array('type' => Sobi::Cfg('debug.xml_raw', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.xml_raw', false) ? Sobi::Txt('DEBUG_XML_ENABLED') : Sobi::Txt('DEBUG_XML_DISABLED')); // uasort( $state, array( $this, 'sortMessages' ) ); $messages = SPFactory::message()->getSystemMessages(); $content = null; if (count($messages)) { foreach ($messages as $message) { $url = Sobi::Url(array('sid' => $message['section']['id'])); $url = "<a href=\"{$url}\">{$message['section']['name']}</a> "; $message['section']['link'] = $url; $message['type-text'] = ucfirst(Sobi::Txt($message['type'])); $state['messages'][] = $message; } } SPFactory::cache()->addVar($state, 'system_state'); } return $state; }
/** * @param $xpath */ protected function loadLanguage($xpath) { $files = $xpath->query('/definition/header/file[@type="language"]'); if ($files->length) { foreach ($files as $file) { SPLang::load($file->attributes->getNamedItem('filename')->nodeValue); } } }
/** * @param DOMNodeList $xml * @return void */ protected function xmlHeader($xml) { foreach ($xml as $node) { /** @var DOMNode $node */ switch ($node->nodeName) { case 'script': SPFactory::header()->addJsCode($node->nodeValue); break; case 'style': SPFactory::header()->addCSSCode($node->nodeValue); break; case 'language': SPLang::load($node->nodeValue); break; case 'file': switch ($node->attributes->getNamedItem('type')->nodeValue) { case 'style': $this->loadCSSFile($node->attributes->getNamedItem('filename')->nodeValue, false); break; case 'script': $this->loadJsFile($node->attributes->getNamedItem('filename')->nodeValue, false); break; case 'language': SPLang::load($node->attributes->getNamedItem('filename')->nodeValue); break; } break; case 'title': $this->setTitle($node->attributes->getNamedItem('value')->nodeValue); break; } } }
public function __construct() { static $loaded = false; if ($loaded) { return true; } $jConfig = JFactory::getConfig(); defined('DS') || define('DS', DIRECTORY_SEPARATOR); require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php'; if (method_exists($jConfig, 'getValue')) { Sobi::Init(JPATH_SITE, JFactory::getConfig()->getValue('config.language')); } else { Sobi::Init(JPATH_SITE, JFactory::getConfig()->get('config.language')); } if (!defined('SOBI_CMS')) { define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15')); } SPLoader::loadClass('mlo.input'); define('SOBIPRO_ADM', true); define('SOBI_ADM_PATH', JPATH_ADMINISTRATOR . '/components/com_sobipro'); $adm = str_replace(JPATH_ROOT, null, JPATH_ADMINISTRATOR); define('SOBI_ADM_FOLDER', $adm); define('SOBI_ADM_LIVE_PATH', $adm . '/components/com_sobipro'); SPLang::load('com_sobipro.sys'); $head = SPFactory::header(); if (SOBI_CMS == 'joomla3') { $head->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jmenu')); } else { $head->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jmenu', 'jquery-migrate')); } if (SOBI_CMS != 'joomla3') { $head->addCssFile('bootstrap.bootstrap')->addJsFile(array('bootstrap'))->addCSSCode(' #jform_request_SOBI_SELECT_SECTION-lbl { margin-top: 8px; } #jform_request_cid-lbl { margin-top: 8px; } #jform_request_eid-lbl { margin-top: 18px; } #jform_request_sid-lbl { margin-top: 20px; } #jform_request_sptpl-lbl { margin-top: 8px; } .typeahead-width { width: 320px; } '); } else { $head->addCSSCode(' .typeahead-width { width: 70%; } '); } // Joomla! 1.5 $this->cid = SPRequest::arr('cid'); // Joomla! 1.6+ if (!(count($this->cid) && is_numeric($this->cid[0]))) { $this->cid = SPRequest::int('id', 0); } $this->determineTask(); $strings = array('objects' => array('entry' => Sobi::Txt('OTYPE_ENTRY'), 'category' => Sobi::Txt('OTYPE_CATEGORY'), 'section' => Sobi::Txt('OTYPE_SECTION')), 'labels' => array('category' => Sobi::Txt('SOBI_SELECT_CATEGORY'), 'entry' => Sobi::Txt('SOBI_SELECT_ENTRY')), 'task' => $this->task); $strings = json_encode($strings); $head->addJsCode("SPJmenuFixTask( '{$this->taskName}' );")->addJsFile('bootstrap.typeahead')->addJsCode("var SPJmenuStrings = {$strings}"); if ($this->task != 'list.date') { if (SOBI_CMS == 'joomla3') { $head->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( "#spCalendar" ).parent().parent().css( "display", "none" ); } );'); } else { $head->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( "#spCalendar" ).parent().css( "display", "none" ); } );'); } } else { $head->addCSSCode('.SobiProCalendar .chzn-container {width: 100px!important; } '); $head->addCSSCode('.SobiProCalendar select {width: inherit;} '); } $head->send(); parent::__construct(); $loaded = true; }
public static function LoadLang($lang) { SPLang::load($lang); }