/** * Get profile key from active profile & default profile * * @return mixed NULL if devmode or keycode string */ public static function getProfileKey() { $t3cache = T3Cache::getT3Cache(); if ($t3cache->_devmode) { return null; } //no cache in devmode $profile = T3Common::get_active_profile() . '-' . T3Common::get_default_profile(); $string = 'profile-' . $profile; return $string; }
/** * Get active profile name * * @return string */ public static function get_active_profile() { // @todo improve way to select profile static $profile = null; if ($profile) { return $profile; } $lang = JFactory::getLanguage(); $lang = strtolower($lang->getTag()); $params = T3Common::get_template_based_params(); $pages_profile = strtolower($params->get('pages_profile')); $profile = ''; //Get active profile by pages //$menu = JSite::getMenu(); $menu = JFactory::getApplication()->getMenu(); $menuid = T3Common::getItemid(); while ($menuid && !$profile) { // Check there is assignment with current language and menu $regex = '/(^|,|\\>|\\n)\\s*' . $lang . '#' . $menuid . '(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } // Check there is assignment with default language and menu $regex = '/(^|,|\\>|\\n)\\s*' . $menuid . '(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } $menuitem = $menu->getItem($menuid); $menuid = $menuitem && isset($menuitem->parent) ? $menuitem->parent : 0; } //Get profile by component name(such as com_content) $comname = JRequest::getCmd('option'); if ($comname) { // Check there is assignment with current language and component $regex = '/(^|,|\\>|\\n)\\s*' . $lang . '#' . $comname . '\\s*(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } // Check there is assingment with default language and component $regex = '/(^|,|\\>|\\n)\\s*' . $comname . '\\s*(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } } //Get profile by page name (such as home) if (JRequest::getCmd('view') == 'frontpage') { $regex = '/(^|,|\\>|\\n)\\s*home(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } } // Check there is assingmnet for current language $regex = '/(^|,|\\>|\\n)\\s*' . $lang . '(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } //Get active profile from user setting $profile = T3Common::get_default_profile(); return $profile; }
function getProfileKey() { $t3cache = T3Cache::getInstance(); if ($t3cache->_devmode) { return null; } //no cache in devmode $profile = T3Common::get_active_profile() . '-' . T3Common::get_default_profile(); return md5('profile-' . $profile); }
function get_active_profile() { static $profile = null; if ($profile) { return $profile; } $params = T3Common::get_template_based_params(); $pages_profile = strtolower($params->get('pages_profile')); $profile = ''; //Get profile by component name(such as com_content) $comname = JRequest::getCmd('option'); if ($comname) { $regex = '/(^|,|\\>|\\n)\\s*' . $comname . '\\s*(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } } //Get active profile by pages $menu =& JSite::getMenu(); $menuid = T3Common::getItemid(); while ($menuid && !$profile) { $regex = '/(^|,|\\>|\\n)\\s*' . $menuid . '(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } $menuitem = $menu->getItem($menuid); $menuid = $menuitem && isset($menuitem->parent) ? $menuitem->parent : 0; } //Get profile by page name (such as home) if (JRequest::getCmd('view') == 'frontpage') { $regex = '/(^|,|\\>|\\n)\\s*home(,[^=]*)?=([^\\<\\n]*)/'; if (preg_match($regex, $pages_profile, $matches)) { $profile = $matches[3]; if (T3Common::profile_exists($profile)) { return $profile; } } } //Get active profile from user setting $profile = T3Common::get_default_profile(); return $profile; }
<?php /* # ------------------------------------------------------------------------ # JA T3v2 Plugin - Template framework for Joomla 1.5 # ------------------------------------------------------------------------ # Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved. # @license - GNU/GPL V2, http://www.gnu.org/licenses/gpl2.html. For details # on licensing, Please Read Terms of Use at http://www.joomlart.com/terms_of_use.html. # Author: JoomlArt.com # Websites: http://www.joomlart.com - http://www.joomlancers.com. # ------------------------------------------------------------------------ */ $profiles = T3Common::get_profiles(); $currprofiles = T3Common::get_default_profile(); if (count($profiles) < 2) { return; } ?> <h3><?php echo JText::_('Profile'); ?> </h3> <div class="ja-box-usertools"> <ul class="ja-usertools-profile clearfix"> <?php foreach ($profiles as $profile) { if (strtolower($profile) == 'home') { continue;