function __construct($area, $joption, $extension, $setup = null, $cont_vars = array()) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gcloader.php'; if (phpversion('pdo') !== false and in_array('mysql', PDO::getAvailableDrivers())) { //good, we use PDO \GCore\Libs\Base::setConfig('db_adapter', 'joomla'); } else { \GCore\Libs\Base::setConfig('db_adapter', 'joomla'); } \GCore\C::set('EXTENSIONS_PATHS', array(dirname(__FILE__) . DS . 'admin' . DS . 'extensions' . DS => JPATH_SITE . DS . 'administrator' . DS . 'components' . DS, dirname(__FILE__) . DS . 'extensions' . DS => JPATH_SITE . DS . 'components' . DS)); \GCore\C::set('EXTENSIONS_URLS', array(\JFactory::getURI()->root() . 'libraries/cegcore/admin/extensions/' => \JFactory::getURI()->root() . 'administrator/components/', \JFactory::getURI()->root() . 'libraries/cegcore/extensions/' => \JFactory::getURI()->root() . 'components/')); \GCore\C::set('EXTENSIONS_NAMES', array('chronomigrator' => 'com_chronomigrator', 'chronoforms' => 'com_chronoforms5', 'chronoconnectivity' => 'com_chronoconnectivity5', 'chronoforums' => 'com_chronoforums', 'chronolistings' => 'com_chronolistings', 'chronocommunity' => 'com_chronocommunity', 'chronosearch' => 'com_chronosearch', 'chronocontact' => 'com_chronocontact', $extension => 'com_' . $joption)); //GCore\Libs\Url::$root_ext = array('components', 'com_'.$joption); \GCore\Bootstrap::initialize('joomla', array('component' => 'com_' . $joption, 'ext' => $extension)); $tvout = strlen(\GCore\Libs\Request::data('tvout', null)) > 0 ? \GCore\Libs\Request::data('tvout') : ''; $controller = \GCore\Libs\Request::data('cont', ''); $action = \GCore\Libs\Request::data('act', ''); if (is_callable($setup)) { $return_vars = $setup(); if (!empty($return_vars)) { $cont_vars = array_merge($cont_vars, $return_vars); } } if (isset($cont_vars['controller'])) { $controller = $cont_vars['controller']; } if (isset($cont_vars['action'])) { $action = $cont_vars['action']; } $cont_vars['_app_thread'] = 'gcore'; ob_start(); echo \GCore\Libs\AppJ::call($area, $extension, $controller, $action, $cont_vars); $output = ob_get_clean(); $output = \GCore\C::fix_urls($output); if ($tvout == 'ajax') { echo $output; $mainframe = \JFactory::getApplication(); $mainframe->close(); } else { ob_start(); $toolbar = \GCore\Helpers\Module::render(array('type' => 'toolbar', 'site' => 'admin', 'params' => '')); $messages = \GCore\Libs\AppJ::getSystemMessages(); echo \GCore\Libs\AppJ::getHeader(); if ($toolbar) { echo $toolbar; echo '<div style="clear:both;"></div>'; } echo $messages; //echo \GCore\Libs\AppJ::getHeader(); $system_output = ob_get_clean(); $system_output = \GCore\C::fix_urls($system_output); echo $system_output; echo $output; } }
public static function getApp($site = GCORE_SITE, $thread = 'gcore') { if (\GCore\C::get('GSITE_PLATFORM') == 'joomla') { $app = \GCore\Libs\AppJ::getInstance($site, $thread); } else { if (\GCore\C::get('GSITE_PLATFORM') == 'wordpress') { $app = \GCore\Libs\AppWp::getInstance($site, $thread); } else { if (\GCore\C::get('GSITE_PLATFORM') == '') { $app = \GCore\Libs\App::getInstance($site, $thread); } } } return $app; }