コード例 #1
0
ファイル: hook.php プロジェクト: atikahmed/joomla-probid
 /**
  * Call hook function
  *
  * @param string $hookname  Hook function name
  * @param array  $args      List of arguments
  *
  * @return mixed  Returns the function result, or FALSE on error.
  */
 function _($hookname, $args = array())
 {
     //load custom hook
     T3Hook::_load();
     //find hook function
     $themes = T3Common::get_active_themes();
     foreach ($themes as $theme) {
         $func = $theme[0] . "_" . $theme[1] . "_" . $hookname;
         if (function_exists($func)) {
             return call_user_func_array($func, $args);
         }
     }
     if (function_exists($hookname)) {
         return call_user_func_array($hookname, $args);
     }
     if (function_exists("T3Hook::{$hookname}")) {
         return call_user_func_array("T3Hook::{$hookname}", $args);
     }
     return false;
 }
コード例 #2
0
ファイル: cache.php プロジェクト: ashanrupasinghe/slbcv2
 /**
  * Get theme key from active layout & active themes
  *
  * @return mixed   NULL if devmode or keycode string
  */
 public static function getThemeKey()
 {
     $t3cache = T3Cache::getT3Cache();
     if ($t3cache->_devmode) {
         return null;
     }
     //no cache in devmode
     $themes = T3Common::get_active_themes();
     $layout = T3Common::get_active_layout();
     $string = 'theme-infos-' . $layout;
     if (is_array($themes)) {
         $string .= serialize($themes);
     }
     return $string;
 }
コード例 #3
0
ファイル: jat3.php プロジェクト: ashanrupasinghe/slbcv2
 /**
  * Implement after route event
  *
  * @return null
  */
 function onAfterRoute()
 {
     // Load t3 language file for front-end & template admin.
     //$this->loadLanguage(null, JPATH_ADMINISTRATOR);
     //this language should be loaded by joomla
     $lang = JFactory::getLanguage();
     $lang->load('plg_system_jat3', JPATH_ADMINISTRATOR);
     t3import('core.framework');
     $app = JFactory::getApplication('administrator');
     if ($app->isAdmin()) {
         t3import('core.admin.util');
         // Clean cache if there's something changed backend
         if (JRequest::getCmd('jat3action') || in_array(JRequest::getCmd('task'), array('save', 'delete', 'remove', 'apply', 'publish', 'unpublish'))) {
             if (JRequest::getCmd('jat3action')) {
                 //if template parameter updated => clear cache
                 t3import('core.cache');
                 T3Cache::clean(2);
             } else {
                 $params = T3Common::get_template_based_params();
                 $cache = $params->get('cache');
                 if ($cache) {
                     //if other update: clear cache if cache is enabled
                     t3import('core.cache');
                     T3Cache::clean(1);
                 }
             }
         }
         if (JAT3_AdminUtil::checkPermission()) {
             if (JAT3_AdminUtil::checkCondition_for_Menu()) {
                 JHTML::stylesheet(JURI::root() . T3_CORE . '/element/assets/css/japaramhelper.css');
                 JHTML::script(JURI::root() . T3_CORE . '/element/assets/js/japaramhelper.js', true);
             }
             if (JRequest::getCmd('jat3type') == 'plugin') {
                 $action = JRequest::getCmd('jat3action');
                 t3import('core.ajax');
                 $obj = new JAT3_Ajax();
                 if ($action && method_exists($obj, $action)) {
                     jimport('joomla.filesystem.folder');
                     jimport('joomla.filesystem.file');
                     $obj->{$action}();
                 }
                 return;
             }
             //Load moontools library
             JHtml::_('behavior.framework');
             if (!T3Common::detect()) {
                 return;
             }
             JAT3_AdminUtil::loadStyle();
             JAT3_AdminUtil::loadScipt();
             return;
         } elseif (JRequest::getCmd('jat3type') == 'plugin') {
             $result['error'] = 'Session has expired. Please login before continuing.';
             echo json_encode($result);
             exit;
         }
         return;
     }
     if (!$app->isAdmin() && T3Common::detect()) {
         $action = JRequest::getCmd('jat3action');
         // Process request ajax like action - public
         if ($action) {
             t3import('core.ajaxsite');
             if (method_exists('T3AjaxSite', $action)) {
                 T3AjaxSite::$action();
                 $app->close();
                 //exit after finish action
             }
         }
         // Load core library
         T3Framework::t3_init($this->plgParams);
         // Init T3Engine
         // Get list templates
         $themes = T3Common::get_active_themes();
         $path = T3Path::getInstance();
         // Path in t3 engine
         // Active themes path
         if ($themes && count($themes)) {
             foreach ($themes as $theme) {
                 if ($theme[0] == 'engine') {
                     $path->addPath($theme[0] . '.' . $theme[1], T3Path::path(T3_BASE . '/base-themes/' . $theme[1]), T3Path::url(T3_BASE . '/base-themes/' . $theme[1]));
                 } elseif ($theme[0] == 'template') {
                     $path->addPath($theme[0] . '.' . $theme[1], T3Path::path(T3_TEMPLATE), T3Path::url(T3_TEMPLATE));
                 } else {
                     $themepath = T3Path::path(T3_TEMPLATE) . DS . 'themes';
                     // Check if template use newest folder structure or not
                     // If themes folder is exists in template folder, consider as template use newst folder structure
                     if (@is_dir($themepath)) {
                         $path->addPath($theme[0] . '.' . $theme[1], T3Path::path(T3_TEMPLATE) . DS . 'themes' . DS . $theme[1], T3Path::url(T3_TEMPLATE) . "/themes/{$theme[1]}");
                     } else {
                         // Compatible: if template use older folder structure, try to use it
                         $path->addPath($theme[0] . '.' . $theme[1], T3Path::path(T3_TEMPLATE) . DS . $theme[0] . DS . 'themes' . DS . $theme[1], T3Path::url(T3_TEMPLATE) . "/{$theme[0]}/themes/{$theme[1]}");
                     }
                 }
             }
         }
         // Disable editor if website is access by iphone & handheld
         $device = T3Common::mobile_device_detect();
         if ($device == 'iphone' || $device == 'handheld') {
             $config = JFactory::getConfig();
             $config->set('editor', 'none');
         }
         T3Framework::init_layout();
     }
 }
コード例 #4
0
ファイル: common.php プロジェクト: ashanrupasinghe/slbcv2
 /**
  * Get active themes info
  *
  * @return array   Themes information
  */
 public static function get_active_themes_info()
 {
     $key = T3Cache::getThemeKey();
     $t3cache = T3Cache::getT3Cache();
     $themes_info = $t3cache->getObject($key);
     if ($themes_info && isset($themes_info['layout']) && $themes_info['layout']) {
         return $themes_info;
     }
     $themes = T3Common::get_active_themes();
     $themes[] = array('engine', 'default');
     $themes_info = null;
     foreach ($themes as $theme) {
         //$theme_info = T3Common::get_themes (implode('.', $theme));
         $theme_info = T3Common::get_theme_info($theme);
         if (!$theme_info) {
             continue;
         }
         if (!$themes_info) {
             $themes_info = $theme_info;
         } else {
             //merge info
             $themes_info = T3Common::merge_info($theme_info, $themes_info);
         }
     }
     //Get layout if tmpl is not component
     $themes_info['layout'] = null;
     $tmpl = JRequest::getCmd('tmpl');
     if ($tmpl != 'component') {
         $themes_info['layout'] = T3Common::get_layout_info();
     }
     $t3cache->storeObject($themes_info, $key);
     return $themes_info;
 }
コード例 #5
0
ファイル: jat3.php プロジェクト: rlee1962/diylegalcenter
 function onAfterRoute()
 {
     t3import('core.framework');
     $app = JFactory::getApplication('administrator');
     if ($app->isAdmin()) {
         t3import('core.admin.util');
         //Clean cache if there's something changed backend
         if (JRequest::getCmd('jat3action') || in_array(JRequest::getCmd('task'), array('save', 'delete', 'remove', 'apply', 'publish', 'unpublish'))) {
             if (JRequest::getCmd('jat3action')) {
                 //if template parameter updated => clear cache
                 t3_import('core/cache');
                 T3Cache::clean(2);
             } else {
                 $params = T3Common::get_template_based_params();
                 $cache = $params->get('cache');
                 if ($cache) {
                     //if other update: clear cache if cache is enabled
                     t3_import('core/cache');
                     T3Cache::clean(1);
                 }
             }
         }
         if (JAT3_AdminUtil::checkPermission()) {
             if (JAT3_AdminUtil::checkCondition_for_Menu()) {
                 JHTML::stylesheet('', JURI::root() . T3_CORE . '/element/assets/css/japaramhelper.css');
                 JHTML::script('', JURI::root() . T3_CORE . '/element/assets/js/japaramhelper.js', true);
             }
             if (JRequest::getCmd('jat3type') == 'plugin') {
                 $action = JRequest::getCmd('jat3action');
                 t3import('core.ajax');
                 $obj = new JAT3_Ajax();
                 if ($action && method_exists($obj, $action)) {
                     $obj->{$action}();
                 }
                 return;
             }
             if (!T3Common::detect()) {
                 return;
             }
             JAT3_AdminUtil::loadStyle();
             JAT3_AdminUtil::loadScipt();
             return;
         } elseif (JRequest::getCmd('jat3type') == 'plugin') {
             $result['error'] = 'Session has expired. Please login before continuing.';
             echo json_encode($result);
             exit;
         }
         return;
     }
     if (!$app->isAdmin() && T3Common::detect()) {
         $action = JRequest::getCmd('jat3action');
         //process request ajax like action - public
         if ($action) {
             t3import('core.ajaxsite');
             if (method_exists('T3AjaxSite', $action)) {
                 T3AjaxSite::$action();
                 $app->close();
                 //exit after finish action
             }
         }
         //load core library
         T3Framework::t3_init($this->plgParams);
         //Init T3Engine
         //get list templates
         $themes = T3Common::get_active_themes();
         $path = T3Path::getInstance();
         //path in t3 engine
         //active themes path
         if ($themes && count($themes)) {
             foreach ($themes as $theme) {
                 $path->addPath($theme[0] . '.' . $theme[1], T3Path::path(T3_TEMPLATE) . DS . $theme[0] . DS . 'themes' . DS . $theme[1], T3Path::url(T3_TEMPLATE) . "/{$theme[0]}/themes/{$theme[1]}");
             }
         }
         //add default & base theme path
         //if isRTL, auto add rtl theme
         if (T3Common::isRTL() && is_dir(T3Path::path(T3_TEMPLATE_CORE . '/themes/default-rtl'))) {
             $path->addPath('core.default-rtl', T3Path::path(T3_TEMPLATE_CORE . '/themes/default-rtl'), T3Path::url(T3_TEMPLATE_CORE . '/themes/default-rtl'));
         }
         $path->addPath('template.default', T3Path::path(T3_TEMPLATE), T3Path::url(T3_TEMPLATE));
         if (T3Common::isRTL() && is_dir(T3Path::path(T3_BASETHEME . '-rtl'))) {
             $path->addPath('engine.default-rtl', T3Path::path(T3_BASETHEME . '-rtl'), T3Path::url(T3_BASETHEME . '-rtl'));
         }
         $path->addPath('engine.default', T3Path::path(T3_BASETHEME), T3Path::url(T3_BASETHEME));
         T3Framework::init_layout();
     }
 }
コード例 #6
0
ファイル: head.php プロジェクト: ashanrupasinghe/slbcv2
 /**
  * Execute css/js optimizing base on joomla document object
  *
  * @return void
  */
 public static function proccess()
 {
     $document = JFactory::getDocument();
     $urlPath = new T3Path();
     //proccess stylesheets
     $themes = T3Common::get_active_themes();
     //$themes[] = array('core', 'default'); //default now move to template root folder
     //$themes[] = array('engine', 'default');
     $themes = array_reverse($themes);
     $scripts = array();
     $css_urls = array();
     $css_urls['site'] = array();
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1]] = array();
     }
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1] . '-browser'] = array();
     }
     if (T3Common::isRTL()) {
         foreach ($themes as $theme) {
             $css_urls[$theme[0] . '.' . $theme[1] . '-rtl'] = array();
         }
     }
     //$bname = T3Common::getBrowserSortName();
     //$bver = T3Common::getBrowserMajorVersion();
     $optimize_css = T3Parameter::_getParam('optimize_css', 2);
     $optimize_js = T3Parameter::_getParam('optimize_js', 2);
     foreach ($document->_styleSheets as $strSrc => $strAttr) {
         $path = T3Head::cleanUrl($strSrc);
         if (!$path || !preg_match('#\\.css$#', $path)) {
             //External url
             $css_urls['site'][] = array('', $strSrc);
             continue;
         }
         $intemplate = false;
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $path)) {
             $path = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $path);
             $intemplate = true;
         }
         $paths = array();
         //$paths[] = array ('', $path, $strSrc); //The third element is the original url
         $paths[] = array('', $path);
         // Fix when source code in subfolder
         //if ($intemplate) {
         //only load other css files if in T3v2 template
         $ext = '';
         if (preg_match('#\\.[^.]+$#', $path, $matches)) {
             $ext = $matches[0];
         }
         //if ($ext) {
         //$paths[] = array('-browser', str_replace($ext, "-$bname$ext", $path));
         //$paths[] = array('-browser', str_replace($ext, "-$bname$bver$ext", $path));
         //if (T3Common::isRTL()) {
         //$paths[] = array('-rtl', str_replace($ext, "-rtl$ext", $path));
         //$paths[] = array('-rtl', str_replace($ext, "-$bname-rtl$ext", $path));
         //$paths[] = array('-rtl', str_replace($ext, "-$bname$bver-rtl$ext", $path));
         //}
         //}
         if ($ext && T3Common::isRTL()) {
             $paths[] = array('-rtl', str_replace($ext, "-rtl{$ext}", $path));
         }
         //}
         foreach ($paths as $path) {
             //
             if ($intemplate) {
                 $urls = $urlPath->get($path[1], true);
                 if ($urls) {
                     foreach ($urls as $theme => $url) {
                         $url[] = $strAttr;
                         $css_urls[$theme . $path[0]][$url[0]] = $url;
                     }
                 }
             } else {
                 if (is_file(T3Path::path($path[1]))) {
                     $css_urls['site'][T3Path::path($path[1])] = array(T3Path::path($path[1]), count($path) > 2 ? $path[2] : T3Path::url($path[1]), $strAttr);
                     //use original url ($path[2]) if exists
                 }
             }
         }
     }
     // Remove current stylesheets
     $document->_styleSheets = array();
     foreach ($document->_scripts as $strSrc => $strType) {
         $srcurl = T3Head::cleanUrl($strSrc);
         if (!$srcurl || !preg_match('#\\.js$#', $srcurl)) {
             $scrips[] = array('', $strSrc);
             continue;
         }
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $srcurl)) {
             //in template
             $srcurl = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $srcurl);
             $path = str_replace('/', DS, $srcurl);
             $url = $urlPath->get($path);
             if ($url) {
                 $scrips[] = $url;
             }
         } else {
             // Don't read file content => keep original link
             if ($optimize_js < 1) {
                 $scrips[] = array('', $strSrc);
                 continue;
             }
             $path = str_replace('/', DS, $srcurl);
             $scrips[] = array(JPATH_SITE . DS . $path, JURI::base(true) . '/' . $srcurl);
         }
     }
     //remove current scripts
     $document->_scripts = array();
     $tmp_css_urls = false;
     do {
         $tmp_css_urls = T3Head::optimizecss($css_urls);
     } while ($tmp_css_urls === false);
     $css_urls = $tmp_css_urls;
     //if ($url) $css_urls = array(array(array('', $url)));
     //re-add stylesheet to head
     foreach ($css_urls as $urls) {
         foreach ($urls as $url) {
             if (count($url) > 2) {
                 $attrs = $url[2];
                 $document->addStylesheet($url[1], $attrs['mime'], $attrs['media'], $attrs['attribs']);
             } else {
                 $document->addStylesheet($url[1]);
             }
         }
     }
     $tmp_scrips = false;
     do {
         $tmp_scrips = T3Head::optimizejs($scrips);
     } while ($tmp_scrips === false);
     $scrips = $tmp_scrips;
     //re-add stylesheet to head
     foreach ($scrips as $url) {
         $document->addScript($url[1]);
     }
 }
コード例 #7
0
ファイル: common.php プロジェクト: rlee1962/diylegalcenter
 function get_active_themes_info()
 {
     global $mainframe;
     //$key = T3Parameter::getKey ('themes-info',2);
     $key = T3Cache::getThemeKey();
     $themes_info = T3Cache::get_object($key);
     //force cache
     if ($themes_info && isset($themes_info['layout']) && $themes_info['layout']) {
         return $themes_info;
     }
     $themes = T3Common::get_active_themes();
     $themes[] = array('engine', 'default');
     $themes_info = null;
     foreach ($themes as $theme) {
         //$theme_info = T3Common::get_themes (implode('.', $theme));
         $theme_info = T3Common::get_theme_info($theme);
         if (!$theme_info) {
             continue;
         }
         if (!$themes_info) {
             $themes_info = $theme_info;
         } else {
             //merge info
             $themes_info = T3Common::merge_info($theme_info, $themes_info);
         }
     }
     //Get layout if tmpl is not component
     $themes_info['layout'] = null;
     $tmpl = JRequest::getCmd('tmpl');
     if ($tmpl != 'component') {
         $themes_info['layout'] = T3Common::get_layout_info();
     }
     T3Cache::store_object($themes_info, $key);
     return $themes_info;
 }
コード例 #8
0
ファイル: head.php プロジェクト: rlee1962/diylegalcenter
 function proccess()
 {
     $document =& JFactory::getDocument();
     //proccess stylesheets
     $themes = T3Common::get_active_themes();
     //$themes[] = array('core', 'default'); //default now move to template root folder
     //$themes[] = array('engine', 'default');
     $themes = array_reverse($themes);
     $scripts = array();
     $css_urls = array();
     $css_urls['site'] = array();
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1]] = array();
     }
     foreach ($themes as $theme) {
         $css_urls[$theme[0] . '.' . $theme[1] . '-browser'] = array();
     }
     if (T3Common::isRTL()) {
         foreach ($themes as $theme) {
             $css_urls[$theme[0] . '.' . $theme[1] . '-rtl'] = array();
         }
     }
     $bname = T3Common::getBrowserSortName();
     $bver = T3Common::getBrowserMajorVersion();
     $optimize_css = T3Parameter::get('optimize_css', 2);
     $optimize_js = T3Parameter::get('optimize_js', 2);
     foreach ($document->_styleSheets as $strSrc => $strAttr) {
         $path = T3Head::cleanUrl($strSrc);
         if (!$path) {
             //External url
             $css_urls['site'][] = array('', $strSrc);
             continue;
         }
         $intemplate = false;
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $path)) {
             $path = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $path);
             $intemplate = true;
         }
         /*
         if (!$intemplate && $optimize_css < 2) // don't read file content => keep original link
         {
         	$css_urls['site'][] = array ('', $strSrc);
         	continue;
         }
         */
         $paths = array();
         $paths[] = array('', $path, $strSrc);
         //The third element is the original url
         //if ($intemplate) {
         //only load other css files if in T3v2 template
         $ext = '';
         if (preg_match('#\\.[^.]+$#', $path, $matches)) {
             $ext = $matches[0];
         }
         //$file_info = pathinfo($path);
         //$ext = $file_info['extension'];
         if ($ext) {
             $paths[] = array('-browser', str_replace($ext, "-{$bname}{$ext}", $path));
             $paths[] = array('-browser', str_replace($ext, "-{$bname}{$bver}{$ext}", $path));
             if (T3Common::isRTL()) {
                 $paths[] = array('-rtl', str_replace($ext, "-rtl{$ext}", $path));
                 $paths[] = array('-rtl', str_replace($ext, "-{$bname}-rtl{$ext}", $path));
                 $paths[] = array('-rtl', str_replace($ext, "-{$bname}{$bver}-rtl{$ext}", $path));
             }
         }
         //}
         foreach ($paths as $path) {
             //
             if ($intemplate) {
                 if ($urls = T3Path::get($path[1], true)) {
                     foreach ($urls as $theme => $url) {
                         $css_urls[$theme . $path[0]][$url[0]] = $url;
                     }
                 }
             } else {
                 if (is_file(T3Path::path($path[1]))) {
                     $css_urls['site'][T3Path::path($path[1])] = array(T3Path::path($path[1]), count($path) > 2 ? $path[2] : T3Path::url($path[1]));
                 }
                 //use original url ($path[2]) if exists
             }
         }
     }
     //remove current stylesheets
     $document->_styleSheets = array();
     foreach ($document->_scripts as $strSrc => $strType) {
         $srcurl = T3Head::cleanUrl($strSrc);
         if (!$srcurl) {
             $scrips[] = array('', $strSrc);
             continue;
         }
         if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $srcurl)) {
             //in template
             $srcurl = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $srcurl);
             $path = str_replace('/', DS, $srcurl);
             if ($url = T3Path::get($path)) {
                 $scrips[] = $url;
             }
         } else {
             if ($optimize_js < 1) {
                 $scrips[] = array('', $strSrc);
                 continue;
             }
             $path = str_replace('/', DS, $srcurl);
             $scrips[] = array(JPATH_SITE . DS . $path, JURI::base(true) . '/' . $srcurl);
         }
     }
     //remove current scripts
     $document->_scripts = array();
     $css_urls = T3Head::optimizecss($css_urls);
     //if ($url) $css_urls = array(array(array('', $url)));
     //re-add stylesheet to head
     foreach ($css_urls as $urls) {
         foreach ($urls as $url) {
             $document->addStylesheet($url[1]);
         }
     }
     $scrips = T3Head::optimizejs($scrips);
     //re-add stylesheet to head
     foreach ($scrips as $url) {
         $document->addScript($url[1]);
     }
 }