本文整理汇总了PHP中FLEXIUtilities::loadTemplateLanguageFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::loadTemplateLanguageFile方法的具体用法?PHP FLEXIUtilities::loadTemplateLanguageFile怎么用?PHP FLEXIUtilities::loadTemplateLanguageFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::loadTemplateLanguageFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decideLayout
/**
* Method to decide which item layout to use
*
* @access public
* @param int item identifier
*/
function decideLayout(&$params)
{
// *********************************************************************************
// Get category layout from configuration if not already set (e.g. via HTTP Request)
// *********************************************************************************
//echo "decideLayout: ". $this->_clayout ."<br/>";
$clayout = $this->_clayout;
if (!$clayout) {
// Decide to use mobile or normal category template layout
$useMobile = $params->get('use_mobile_layouts', 0);
if ($useMobile) {
$force_desktop_layout = $params->get('force_desktop_layout', 0);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
}
$desktop_clayout = $params->get('clayout', 'blog');
$clayout = !$useMobile ? $desktop_clayout : $params->get('clayout_mobile', $desktop_clayout);
}
// Get cached template data, without loading language file, (this will be done at the view)
$themes = flexicontent_tmpl::getTemplates(null);
// *********************************
// Verify the category layout exists
// *********************************
if (!isset($themes->category->{$clayout})) {
$cat_default_layout = 'blog';
// Layout default
$fixed_clayout = isset($themes->category->{$cat_default_layout}) ? $cat_default_layout : 'default';
JFactory::getApplication()->enqueueMessage("<small>Current category Layout (template) is '{$clayout}' does not exist<br/>- Please correct this in the URL or in Content Type configuration.<br/>- Using Template Layout: '{$fixed_clayout}'</small>", 'notice');
$clayout = $fixed_clayout;
FLEXIUtilities::loadTemplateLanguageFile($clayout);
// Manually load Template-Specific language file of back fall clayout
}
// *****************************************************************************************
// Finally set the clayout (template name) into model / category's parameters / HTTP Request
// *****************************************************************************************
$this->setCatLayout($clayout);
$params->set('clayout', $clayout);
JRequest::setVar('clayout', $clayout);
}
示例2: decideLayout
/**
* Method to decide which item layout to use
*
* @access public
* @param int item identifier
*/
function decideLayout(&$compParams, &$typeParams, &$itemParams)
{
// Decide to use mobile or normal item template layout
$useMobile = $compParams->get('use_mobile_layouts', 0);
if ($useMobile) {
$force_desktop_layout = $compParams->get('force_desktop_layout', 0);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
}
$_ilayout = $useMobile ? 'ilayout_mobile' : 'ilayout';
// Get item layout (... if not already set), from the configuration parameter (that was decided above)
$ilayout = $this->_ilayout == '__request__' ? JRequest::getVar($_ilayout, false) : false;
if (!$ilayout) {
$desktop_ilayout = $itemParams->get('ilayout', $typeParams->get('ilayout', 'default'));
$ilayout = !$useMobile ? $desktop_ilayout : $itemParams->get('ilayout_mobile', $typeParams->get('ilayout_mobile', $desktop_ilayout));
}
// Verify the layout is within allowed templates, that is Content Type 's default template OR Content Type allowed templates
$allowed_tmpls = $typeParams->get('allowed_ilayouts');
$type_default_layout = $typeParams->get('ilayout', 'default');
if (empty($allowed_tmpls)) {
$allowed_tmpls = array();
} else {
if (!is_array($allowed_tmpls)) {
$allowed_tmpls = explode("|", $allowed_tmpls);
}
}
// Verify the item layout is within templates: Content Type default template OR Content Type allowed templates
if ($ilayout != $type_default_layout && count($allowed_tmpls) && !in_array($ilayout, $allowed_tmpls)) {
$app->enqueueMessage("<small>Current item Layout (template) is '{$ilayout}':<br/>- This is neither the Content Type Default Template, nor does it belong to the Content Type allowed templates.<br/>- Please correct this in the URL or in Content Type configuration.<br/>- Using Content Type Default Template Layout: '{$type_default_layout}'</small>", 'notice');
$ilayout = $type_default_layout;
}
// Get cached template data, without loading language file, (this will be done at the view)
$themes = flexicontent_tmpl::getTemplates(null);
// Verify the item layout exists
if (!isset($themes->items->{$ilayout})) {
$fixed_ilayout = isset($themes->items->{$type_default_layout}) ? $type_default_layout : 'default';
$app->enqueueMessage("<small>Current Item Layout Template is '{$ilayout}' does not exist<br/>- Please correct this in the URL or in Content Type configuration.<br/>- Using Template Layout: '{$fixed_ilayout}'</small>", 'notice');
$ilayout = $fixed_ilayout;
FLEXIUtilities::loadTemplateLanguageFile($ilayout);
// Manually load Template-Specific language file of back fall ilayout
}
// Finally set the ilayout (template name) into model / item's parameters / HTTP Request
$this->setItemLayout($ilayout);
$itemParams->set('ilayout', $ilayout);
JRequest::setVar('ilayout', $ilayout);
}
示例3: display
function display($tpl = null)
{
// Initialise variables
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$user = JFactory::getUser();
$use_jquery_sortable = true;
$type = JRequest::getVar('type', 'items', '', 'word');
$folder = JRequest::getVar('folder', 'default', '', 'cmd');
$ismodal = JRequest::getVar('ismodal', 'default', '', 'int');
FLEXIUtilities::loadTemplateLanguageFile($folder);
//Get data from the model
$layout = $this->get('Data');
$conf = $this->get('LayoutConf');
$fields = $this->get('Fields');
$fbypos = $this->get('FieldsByPositions');
$used = $this->get('UsedFields');
$contentTypes = $this->get('TypesList');
//$fieldTypes = $this->get( 'FieldTypesList' );
$fieldTypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = false);
// Field types with content type ASSIGNMENT COUNTING
// Create CONTENT TYPE SELECTOR
foreach ($fields as $field) {
$field->type_ids = !empty($field->reltypes) ? explode(",", $field->reltypes) : array();
}
$options = array();
$options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL'));
foreach ($contentTypes as $contentType) {
$options[] = JHTML::_('select.option', $contentType->id, JText::_($contentType->name));
}
$fieldname = $elementid = 'content_type__au__';
$attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="use_select2_lib" ';
$content_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid);
// Create FIELD TYPE SELECTOR
$ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : ';
$fftypes = array();
$fftypes[] = array('value' => '', 'text' => JText::_('FLEXI_ALL'));
//$fftypes[] = array('value'=>'BV', 'text'=>$ALL . JText::_( 'FLEXI_BACKEND_FIELDS' ) );
//$fftypes[] = array('value'=>'C', 'text'=>$ALL . JText::_( 'FLEXI_CORE_FIELDS' ) );
//$fftypes[] = array('value'=>'NC', 'text'=>$ALL . JText::_( 'FLEXI_NON_CORE_FIELDS' ));
foreach ($fieldTypes as $field_group => $ft_types) {
$fftypes[] = $field_group;
foreach ($ft_types as $field_type => $ftdata) {
$fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly);
}
$fftypes[] = '';
}
$fieldname = $elementid = 'field_type__au__';
$attribs = ' class="use_select2_lib" onchange="filterFieldList(\'%s\', \'%s\', \'%s\');"';
$field_type_select = flexicontent_html::buildfieldtypeslist($fftypes, $fieldname, '', $_grouped ? 1 : 0, $attribs, $elementid);
if (isset($layout->positions)) {
$sort = array();
$jssort = array();
$idsort = array();
$sort[0] = 'sortablecorefields';
$sort[1] = 'sortableuserfields';
$i = 2;
$count = -1;
foreach ($layout->positions as $pos) {
$count++;
if (isset($layout->attributes[$count]) && isset($layout->attributes[$count]['readonly'])) {
continue;
}
$sort[$i] = 'sortable-' . $pos;
$idsort[$i] = $pos;
$i++;
}
foreach ($idsort as $k => $v) {
if ($k > 1) {
$jssort[] = 'storeordering(jQuery("#sortable-' . $v . '"))';
}
}
$positions = implode(',', $idsort);
$jssort = implode("; ", $jssort);
$sortable_ids = "#" . implode(",#", $sort);
$js = "\n\t\t\tjQuery(function() {\n\t\t\t\tmy = jQuery( \"{$sortable_ids}\" ).sortable({\n\t\t\t\t\tconnectWith: \"" . $sortable_ids . "\",\n\t\t\t\t\tupdate: function(event, ui) {\n\t\t\t\t\t\tif(ui.sender) {\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.sender));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.item).parent());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tinitordering();\n\t\t\t});\n\t\t\tfunction storeordering(parent_element) {\n\t\t\t\thidden_id = '#'+jQuery.trim(parent_element.attr('id').replace('sortable-',''));\n\t\t\t\tfields = new Array();\n\t\t\t\ti = 0;\n\t\t\t\tparent_element.children('li').each(function(){\n\t\t\t\t\tfields[i++] = jQuery(this).attr('id').replace('field_', '');\n\t\t\t\t});\n\t\t\t\tjQuery(hidden_id).val(fields.join(','))\n\t\t\t}\n\t\t\t";
$js .= '
var fieldListFilters = new Array( "content_type", "field_type" );
function filterFieldList (containerID, method, group)
{
var needed_classes = "";
for (i=0; i<fieldListFilters.length; i++)
{
filter_name = fieldListFilters[i];
var filter_val = jQuery("#" + filter_name + "_" + group).val();
if (filter_val) {
needed_classes += "."+filter_name+"_"+filter_val;
}
}
if (needed_classes) {
(method=="hide") ?
jQuery("#"+containerID).find("li").show().filter(":not("+needed_classes+")").hide() :
jQuery("#"+containerID).find("li").css({"color":"red"}).filter(":not("+needed_classes+")").css({"color":"black"});
} else {
(method=="hide") ?
jQuery("#"+containerID).find("li").show() :
//.........这里部分代码省略.........
示例4: getTemplates
static function getTemplates($lang_files = 'all')
{
$flexiparams = JComponentHelper::getParams('com_flexicontent');
$print_logging_info = $flexiparams->get('print_logging_info');
// Log content plugin and other performance information
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
if (!FLEXI_J30GE) {
// && FLEXI_CACHE , Ignore cache settings since XML parsing in J1.5/J2.5 is costly
// add the templates to templates cache
$tmplcache = JFactory::getCache('com_flexicontent_tmpl');
$tmplcache->setCaching(1);
// Force cache ON
$tmplcache->setLifeTime(24 * 3600);
// Set expire time (hard-code this to 1 day), since it is costly
$tmpls = $tmplcache->call(array('flexicontent_tmpl', 'parseTemplates'));
$cached = 1;
} else {
$tmpls = flexicontent_tmpl::parseTemplates();
$cached = 0;
}
// Load Template-Specific language file(s) to override or add new language strings
if ($lang_files == 'all') {
foreach ($tmpls->category as $tmpl => $d) {
FLEXIUtilities::loadTemplateLanguageFile($tmpl);
}
} else {
if (is_array($lang_files)) {
foreach ($lang_files as $tmpl) {
FLEXIUtilities::loadTemplateLanguageFile($tmpl);
}
} else {
if (is_string($lang_files)) {
FLEXIUtilities::loadTemplateLanguageFile($lang_files);
}
}
}
if ($print_logging_info) {
$fc_run_times[$cached ? 'templates_parsing_cached' : 'templates_parsing_noncached'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
return $tmpls;
}
示例5: _displayForm
//.........这里部分代码省略.........
}
// FORCE model to load versioned data (URL specified version or latest version (last saved))
$version = JRequest::getVar('version', 0, 'request', 'int');
// Load specific item version (non-zero), 0 version: is unversioned data, -1 version: is latest version (=default for edit form)
$item = $model->getItem(null, $check_view_access = false, $no_cache = true, $force_version = $version != 0 ? $version : -1);
// -1 version means latest
// Replace component/menu 'params' with thee merged component/category/type/item/menu ETC ... parameters
$params =& $item->parameters;
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// Load permissions (used by form template)
$perms = $this->_getItemPerms($item);
// Create submit configuration (for new items) into the session, this is needed before creating the item form
$submitConf = $this->_createSubmitConf($item, $perms);
// Most core field are created via calling methods of the form (J2.5)
$form = $this->get('Form');
// is new item and ownership Flags
$isnew = !$item->id;
$isOwner = $item->created_by == $user->get('id');
// Get available types and the currently selected/requested type
$types = $model->getTypeslist();
$typesselected = $model->getTypesselected();
// Get type parameters, these are needed besides the 'merged' item parameters, e.g. to get Type's default layout
$tparams = $this->get('Typeparams');
$tparams = new JRegistry($tparams);
// *********************************************************************************************************
// Get language stuff, and also load Template-Specific language file to override or add new language strings
// *********************************************************************************************************
if ($enable_translation_groups) {
$langAssocs = $params->get('uselang_fe') == 1 ? $this->get('LangAssocs') : false;
}
$langs = FLEXIUtilities::getLanguages('code');
FLEXIUtilities::loadTemplateLanguageFile($params->get('ilayout', 'default'));
// *************************************
// Create captcha field via custom logic
// *************************************
// create and set (into HTTP request) a unique item id for plugins that needed it
if ($item->id) {
$unique_tmp_itemid = $item->id;
} else {
$unique_tmp_itemid = $app->getUserState('com_flexicontent.edit.item.unique_tmp_itemid');
$unique_tmp_itemid = $unique_tmp_itemid ? $unique_tmp_itemid : date('_Y_m_d_h_i_s_', time()) . uniqid(true);
}
//print_r($unique_tmp_itemid);
JRequest::setVar('unique_tmp_itemid', $unique_tmp_itemid);
// Component / Menu Item parameters
$allowunauthorize = $params->get('allowunauthorize', 0);
// allow unauthorised user to submit new content
$unauthorized_page = $params->get('unauthorized_page', '');
// page URL for unauthorized users (via global configuration)
$notauth_itemid = $params->get('notauthurl', '');
// menu itemid (to redirect) when user is not authorized to create content
// Create captcha field or messages
// Maybe some code can be removed by using Joomla's built-in form element (in XML file), instead of calling the captcha plugin ourselves
$use_captcha = $params->get('use_captcha', 1);
// 1 for guests, 2 for any user
$captcha_formop = $params->get('captcha_formop', 0);
// 0 for submit, 1 for submit/edit (aka always)
$display_captcha = $use_captcha >= 2 || $use_captcha == 1 && $user->guest;
$display_captcha = $display_captcha && ($isnew || $captcha_formop);
// Trigger the configured captcha plugin
if ($display_captcha) {
// Get configured captcha plugin
$c_plugin = $params->get('captcha', $app->getCfg('captcha'));
// TODO add param to override default
示例6: display
function display($tpl = null)
{
//initialise variables
$mainframe = JFactory::getApplication();
$option = JRequest::getVar('option');
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$user = JFactory::getUser();
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
$use_jquery_sortable = true;
//FLEXI_J16GE ? true : false;
if ($use_jquery_sortable) {
flexicontent_html::loadJQuery();
} else {
// mootools sortable
$document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/sortables.js');
}
$type = JRequest::getVar('type', 'items', '', 'word');
$folder = JRequest::getVar('folder', 'default', '', 'cmd');
if (FLEXI_FISH || FLEXI_J16GE) {
FLEXIUtilities::loadTemplateLanguageFile($folder);
}
//Get data from the model
$layout = $this->get('Data');
$fields = $this->get('Fields');
$fbypos = $this->get('FieldsByPositions');
$used = $this->get('UsedFields');
$contentTypes = $this->get('ContentTypesList');
$fieldTypes = $this->get('FieldTypesList');
// Create CONTENT TYPE SELECTOR
foreach ($fields as $field) {
$field->type_ids = !empty($field->reltypes) ? explode(",", $field->reltypes) : array();
}
$options = array();
$options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL'));
foreach ($contentTypes as $contentType) {
$options[] = JHTML::_('select.option', $contentType->id, JText::_($contentType->name));
}
$fieldname = $elementid = 'content_type__au__';
$attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="fcfield_selectval" ';
$content_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid);
// Create FIELD TYPE SELECTOR
$options = array();
$options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL'));
foreach ($fieldTypes as $fieldType) {
$options[] = JHTML::_('select.option', $fieldType->type_name, $fieldType->field_name);
}
$fieldname = $elementid = 'field_type__au__';
$attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="fcfield_selectval" ';
$field_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid);
if (isset($layout->positions)) {
$sort = array();
$jssort = array();
$idsort = array();
$sort[0] = 'sortablecorefields';
$sort[1] = 'sortableuserfields';
$i = 2;
$count = -1;
foreach ($layout->positions as $pos) {
$count++;
if (isset($layout->attributes[$count]) && isset($layout->attributes[$count]['readonly'])) {
continue;
}
$sort[$i] = 'sortable-' . $pos;
$idsort[$i] = $pos;
$i++;
}
foreach ($idsort as $k => $v) {
if ($k > 1) {
$jssort[] = $use_jquery_sortable ? 'storeordering(jQuery("#sortable-' . $v . '"))' : 'results(' . $k . ',\'' . $v . '\')';
}
}
$positions = implode(',', $idsort);
$jssort = implode("; ", $jssort);
$sortable_ids = "#" . implode(",#", $sort);
if ($use_jquery_sortable) {
$js = "\n\t\t\t\tjQuery(function() {\n\t\t\t\t\tmy = jQuery( \"{$sortable_ids}\" ).sortable({\n\t\t\t\t\t\tconnectWith: \"" . $sortable_ids . "\",\n\t\t\t\t\t\tupdate: function(event, ui) {\n\t\t\t\t\t\t\tif(ui.sender) {\n\t\t\t\t\t\t\t\tstoreordering(jQuery(ui.sender));\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tstoreordering(jQuery(ui.item).parent());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tinitordering();\n\t\t\t\t});\n\t\t\t\tfunction storeordering(parent_element) {\n\t\t\t\t\thidden_id = '#'+jQuery.trim(parent_element.attr('id').replace('sortable-',''));\n\t\t\t\t\tfields = new Array();\n\t\t\t\t\ti = 0;\n\t\t\t\t\tparent_element.children('li').each(function(){\n\t\t\t\t\t\tfields[i++] = jQuery(this).attr('id').replace('field_', '');\n\t\t\t\t\t});\n\t\t\t\t\tjQuery(hidden_id).val(fields.join(','))\n\t\t\t\t}\n\t\t\t\t";
} else {
$js = "\n\t\t\t\tvar my = '';\n\t\t\t\twindow.addEvent('domready', function(){\n\t\t\t\t\tvar mySortables = new Sortables('.positions', {\n\t\t\t\t\t\tconstrain: false,\n\t\t\t\t\t\tclone: false,\n\t\t\t\t\t\trevert: true,\n\t\t\t\t\t\tonComplete: storeordering\n\t\t\t\t\t});\n\t\t\t\t\tmy = mySortables;\n\t\t\t\t\tstoreordering();\n\n\t\t\t\t\tvar slideaccess = new Fx.Slide('propvisible');\n\t\t\t\t\tvar slidenoaccess = new Fx.Slide('propnovisible');\n\t\t\t\t\tvar legend = \$\$('fieldset.tmplprop legend');\n\t\t\t\t\tslidenoaccess.hide();\n\t\t\t\t\tlegend.addEvent('click', function(ev) {\n\t\t\t\t\t\tlegend.toggleClass('open');\n\t\t\t\t\t\tslideaccess.toggle();\n\t\t\t\t\t\tslidenoaccess.toggle();\n\t\t\t\t\t});\n\n\n\t\t\t\t});\n\n\t\t\t\tfunction results(i, field) {\n\t\t\t\t\tvar res = my.serialize(i, function(element, index){\n\t\t\t\t\treturn element.getProperty('id').replace('field_','');\n\t\t\t\t}).join(',');\n\t\t\t\t\t\$(field).value = res;\n\t\t\t\t}\n\t\t\t\t";
}
$js .= '
var fieldListFilters = new Array( "content_type", "field_type" );
function filterFieldList (containerID, method, group)
{
var needed_classes = "";
for (i=0; i<fieldListFilters.length; i++)
{
filter_name = fieldListFilters[i];
var filter_val = jQuery("#" + filter_name + "_" + group).val();
if (filter_val) {
needed_classes += "."+filter_name+"_"+filter_val;
}
}
if (needed_classes) {
(method=="hide") ?
jQuery("#"+containerID).find("li").show().filter(":not("+needed_classes+")").hide() :
jQuery("#"+containerID).find("li").css({"color":"red"}).filter(":not("+needed_classes+")").css({"color":"black"});
} else {
//.........这里部分代码省略.........
示例7: display
/**
* Creates the page's display
*
* @since 1.0
*/
function display($tpl = null)
{
// Get Non-routing Categories, and Category Tree
global $globalnoroute, $globalcats;
if (!is_array($globalnoroute)) {
$globalnoroute = array();
}
//initialize variables
$dispatcher = JDispatcher::getInstance();
$app = JFactory::getApplication();
$session = JFactory::getSession();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$menus = $app->getMenu();
$menu = $menus->getActive();
$uri = JFactory::getURI();
$user = JFactory::getUser();
$aid = FLEXI_J16GE ? JAccess::getAuthorisedViewLevels($user->id) : (int) $user->get('aid');
// Get category and set category parameters as VIEW's parameters (category parameters are merged with component/page/author parameters already)
$category = $this->get('Category');
$params = $category->parameters;
if ($category->id && FLEXI_J16GE) {
$meta_params = new JRegistry($category->metadata);
} else {
$meta_params = false;
}
// Get various data from the model
$categories = $this->get('Childs');
// this will also count sub-category items is if 'show_itemcount' is enabled
$peercats = $this->get('Peers');
// this will also count sub-category items is if 'show_subcatcount_peercat' is enabled
$items = $this->get('Data');
$total = $this->get('Total');
$filters = $this->get('Filters');
if ($params->get('show_comments_count', 0)) {
$comments = $this->get('CommentsInfo');
} else {
$comments = null;
}
$alpha = $params->get('show_alpha', 1) ? $this->get('Alphaindex') : array();
// This is somwhat expensive so calculate it only if required
// Request variables, WARNING, must be loaded after retrieving items, because limitstart may have been modified
$limitstart = JRequest::getInt('limitstart');
$format = JRequest::getCmd('format', null);
// ********************************
// Load needed JS libs & CSS styles
// ********************************
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
//add css file
if (!$params->get('disablecss', '')) {
$document->addStyleSheet($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css');
$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
}
//allow css override
if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
$document->addStyleSheet($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css');
}
// ************************
// CATEGORY LAYOUT handling
// ************************
// (a) Decide to use mobile or normal category template layout
$useMobile = $params->get('use_mobile_layouts', 0);
if ($useMobile) {
$force_desktop_layout = $params->get('force_desktop_layout', 0);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
}
$_clayout = $useMobile ? 'clayout_mobile' : 'clayout';
// (b) Get from category parameters, allowing URL override
$clayout = JRequest::getCmd($_clayout, false);
if (!$clayout) {
$desktop_clayout = $params->get('clayout', 'blog');
$clayout = !$useMobile ? $desktop_clayout : $params->get('clayout_mobile', $desktop_clayout);
}
// (c) Get cached template data
$themes = flexicontent_tmpl::getTemplates($lang_files = array($clayout));
// (d) Verify the category layout exists
if (!isset($themes->category->{$clayout})) {
$fixed_clayout = 'blog';
$app->enqueueMessage("<small>Current Category Layout Template is '{$clayout}' does not exist<br>- Please correct this in the URL or in Content Type configuration.<br>- Using Template Layout: '{$fixed_clayout}'</small>", 'notice');
$clayout = $fixed_clayout;
if (FLEXI_FISH || FLEXI_J16GE) {
FLEXIUtilities::loadTemplateLanguageFile($clayout);
}
// Manually load Template-Specific language file of back fall clayout
}
// (e) finally set the template name back into the category's parameters
$params->set('clayout', $clayout);
// Get URL variables
$cid = JRequest::getInt('cid', 0);
$authorid = JRequest::getInt('authorid', 0);
//.........这里部分代码省略.........
示例8: getTemplates
static function getTemplates($lang_files = 'all')
{
static $tmpls = null;
if ($tmpls !== null) {
return $tmpls;
}
$flexiparams = JComponentHelper::getParams('com_flexicontent');
$print_logging_info = $flexiparams->get('print_logging_info');
$debug = JDEBUG || $print_logging_info;
// Log content plugin and other performance information
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
$apply_cache = FLEXI_CACHE;
if ($apply_cache) {
// Get templates from cache
$tmplcache = JFactory::getCache('com_flexicontent_tmpl');
// Get Joomla Cache of '...tmpl' Caching Group
$tmplcache->setCaching(1);
// Force cache ON
$tmplcache->setLifeTime(FLEXI_CACHE_TIME);
// Set expire time (default is 1 hour)
$tmpls = $tmplcache->call(array('flexicontent_tmpl', 'parseTemplates'));
// Check, clean, update cache if needed
$xml_modified = flexicontent_tmpl::checkXmlModified($tmpls);
if (!empty($xml_modified)) {
if ($debug) {
JFactory::getApplication()->enqueueMessage("Re-reading XMLs, XML file modified: " . print_r($xml_modified, true), 'message');
}
$tmplcache->clean();
$tmplcache->gc();
$tmpls = $tmplcache->call(array('flexicontent_tmpl', 'parseTemplates'));
}
} else {
$tmpls = flexicontent_tmpl::parseTemplates();
}
// Compile LESS to CSS, if files have been modified
flexicontent_tmpl::checkCompileLess($tmpls);
// Load Template-Specific language file(s) to override or add new language strings
if ($lang_files == 'all') {
foreach ($tmpls->category as $tmpl => $d) {
FLEXIUtilities::loadTemplateLanguageFile($tmpl);
}
} else {
if (is_array($lang_files)) {
foreach ($lang_files as $tmpl) {
FLEXIUtilities::loadTemplateLanguageFile($tmpl);
}
} else {
if (is_string($lang_files)) {
FLEXIUtilities::loadTemplateLanguageFile($lang_files);
}
}
}
if ($print_logging_info) {
$fc_run_times[$apply_cache ? 'templates_parsing_cached' : 'templates_parsing_noncached'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
return $tmpls;
}
示例9: display
/**
* Creates the page's display
*
* @since 1.0
*/
function display($tpl = null)
{
// Get Non-routing Categories, and Category Tree
global $globalnoroute, $globalcats;
if (!is_array($globalnoroute)) {
$globalnoroute = array();
}
//initialize variables
$dispatcher = JDispatcher::getInstance();
$app = JFactory::getApplication();
$session = JFactory::getSession();
$option = JRequest::getVar('option');
$format = JRequest::getCmd('format', 'html');
$document = JFactory::getDocument();
// Check for Joomla issue with system plugins creating JDocument in early events forcing it to be wrong type, when format as url suffix is enabled
if ($format && $document->getType() != strtolower($format)) {
echo '<div class="alert">WARNING: Document format should be: <b>' . $format . '</b> but current document is: <b>' . $document->getType() . '</b> <br/>Some system plugin may have forced current document type</div>';
}
$menus = $app->getMenu();
$menu = $menus->getActive();
$uri = JFactory::getURI();
$user = JFactory::getUser();
$aid = JAccess::getAuthorisedViewLevels($user->id);
// Get model
$model = $this->getModel();
// Get category and set category parameters as VIEW's parameters (category parameters are merged with component/page/author parameters already)
$category = $this->get('Category');
$params = $category->parameters;
if ($category->id) {
$meta_params = new JRegistry($category->metadata);
}
// Get various data from the model
$categories = $this->get('Childs');
// this will also count sub-category items is if 'show_itemcount' is enabled
$peercats = $this->get('Peers');
// this will also count sub-category items is if 'show_subcatcount_peercat' is enabled
$items = $this->get('Data');
$total = $this->get('Total');
$filters = $this->get('Filters');
if ($params->get('show_comments_count', 0)) {
$comments = $this->get('CommentsInfo');
} else {
$comments = null;
}
$alpha = $params->get('show_alpha', 1) ? $this->get('Alphaindex') : array();
// This is somwhat expensive so calculate it only if required
// Request variables, WARNING, must be loaded after retrieving items, because limitstart may have been modified
$limitstart = JRequest::getInt('limitstart');
// ********************************
// Load needed JS libs & CSS styles
// ********************************
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
// Add css files to the document <head> section (also load CSS joomla template override)
if (!$params->get('disablecss', '')) {
$document->addStyleSheetVersion($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
//$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
}
if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
$document->addStyleSheetVersion($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css', FLEXI_VHASH);
}
// ************************
// CATEGORY LAYOUT handling
// ************************
// (a) Decide to use mobile or normal category template layout
$useMobile = $params->get('use_mobile_layouts', 0);
if ($useMobile) {
$force_desktop_layout = $params->get('force_desktop_layout', 0);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
}
$_clayout = $useMobile ? 'clayout_mobile' : 'clayout';
// (b) Get from category parameters, allowing URL override
$clayout = JRequest::getCmd($_clayout, false);
if (!$clayout) {
$desktop_clayout = $params->get('clayout', 'blog');
$clayout = !$useMobile ? $desktop_clayout : $params->get('clayout_mobile', $desktop_clayout);
}
// (c) Get cached template data
$themes = flexicontent_tmpl::getTemplates($lang_files = array($clayout));
// (d) Verify the category layout exists
if (!isset($themes->category->{$clayout})) {
$fixed_clayout = 'blog';
$app->enqueueMessage("<small>Current Category Layout Template is '{$clayout}' does not exist<br>- Please correct this in the URL or in Content Type configuration.<br>- Using Template Layout: '{$fixed_clayout}'</small>", 'notice');
$clayout = $fixed_clayout;
FLEXIUtilities::loadTemplateLanguageFile($clayout);
// Manually load Template-Specific language file of back fall clayout
}
// (e) finally set the template name back into the category's parameters
$params->set('clayout', $clayout);
// Get URL variables
$layout_vars = flexicontent_html::getCatViewLayoutVars($model);
//.........这里部分代码省略.........
示例10: _displayForm
//.........这里部分代码省略.........
// ** WE NEED TO get OR decide the Content Type, before we call the getItem
// ** We rely on typeid Request variable to decide type for new items so make sure this is set,
// ZERO means allow user to select type, but if user is only allowed a single type, then autoselect it!
if ($menu && isset($menu->query['typeid'])) {
JRequest::setVar('typeid', (int) $menu->query['typeid']);
// This also forces zero if value not set
}
$new_typeid = JRequest::getVar('typeid', 0, '', 'int');
if (!$new_typeid) {
$types = $model->getTypeslist($type_ids_arr = false, $check_perms = true);
if ($types && count($types) == 1) {
$new_typeid = $types[0]->id;
}
JRequest::setVar('typeid', $new_typeid);
$canCreateType = true;
}
$item = $this->get('Item');
if (FLEXI_J16GE) {
$form = $this->get('Form');
}
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// *********************************************************************************************************
// Get language stuff, and also load Template-Specific language file to override or add new language strings
// *********************************************************************************************************
if ($enable_translation_groups) {
$langAssocs = $this->get('LangAssocs');
}
if (FLEXI_FISH || FLEXI_J16GE) {
$langs = FLEXIUtilities::getLanguages('code');
}
if (FLEXI_FISH || FLEXI_J16GE) {
FLEXIUtilities::loadTemplateLanguageFile($item->parameters->get('ilayout', 'default'));
}
// ****************************************************************************************
// CHECK EDIT / CREATE PERMISSIONS (this is duplicate since it also done at the controller)
// ****************************************************************************************
// new item and ownership variables
$isnew = !$item->id;
$isOwner = $item->created_by == $user->get('id');
// create and set (into HTTP request) a unique item id for plugins that needed it
JRequest::setVar('unique_tmp_itemid', $item->id ? $item->id : date('_Y_m_d_h_i_s_', time()) . uniqid(true));
// Component / Menu Item parameters
$allowunauthorize = $params->get('allowunauthorize', 0);
// allow unauthorised user to submit new content
$unauthorized_page = $params->get('unauthorized_page', '');
// page URL for unauthorized users (via global configuration)
$notauth_itemid = $params->get('notauthurl', '');
// menu itemid (to redirect) when user is not authorized to create content
// Create captcha field or messages
if (FLEXI_J16GE) {
$use_captcha = $params->get('use_captcha', 1);
// 1 for guests, 2 for any user
$captcha_formop = $params->get('captcha_formop', 0);
// 0 for submit, 1 for submit/edit (aka always)
$display_captcha = $use_captcha >= 2 || $use_captcha == 1 && $user->guest;
$display_captcha = $display_captcha && ($isnew || $captcha_formop);
// Force using recaptcha
if ($display_captcha) {
// Try to force the use of recaptcha plugin
JFactory::getConfig()->set('captcha', 'recaptcha');
if (!$app->getCfg('captcha')) {
$captcha_errmsg = '-- Please select <b>CAPTCHA Type</b> at global Joomla parameters';
} else {
if ($app->getCfg('captcha') != 'recaptcha') {