本文整理汇总了PHP中flexicontent_html::getMobileDetector方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::getMobileDetector方法的具体用法?PHP flexicontent_html::getMobileDetector怎么用?PHP flexicontent_html::getMobileDetector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::getMobileDetector方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
// execute the code only if the field type match the plugin type
if (!in_array($field->field_type, self::$field_types)) {
return;
}
// Get isMobile / isTablet Flags
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
$field->label = JText::_($field->label);
// some parameter shortcuts
$target = $field->parameters->get('targetblank', 0);
$target_param = $target ? ' target="_blank"' : '';
$display_hits = $field->parameters->get('display_hits', 0);
$add_hits_img = $display_hits == 1 || $display_hits == 3;
$add_hits_txt = $display_hits == 2 || $display_hits == 3 || $isMobile;
$rel_nofollow = $field->parameters->get('add_rel_nofollow', 0) ? ' rel="nofollow"' : '';
// This is field 's MAIN value property
$link_usage = $field->parameters->get('link_usage', 0);
$default_link = $link_usage == 2 ? $field->parameters->get('default_value_link', '') : '';
// Optional value properties
$usetitle = $field->parameters->get('use_title', 0);
$title_usage = $field->parameters->get('title_usage', 0);
$default_title = $title_usage == 2 ? JText::_($field->parameters->get('default_value_title', '')) : '';
// Get field values
$values = $values ? $values : $field->value;
// DO NOT terminate yet if value is empty since a default value on empty may have been defined
// Handle default value loading, instead of empty value
if (empty($values) && !strlen($default_link)) {
$field->{$prop} = '';
return;
} else {
if (empty($values) && strlen($default_link)) {
$values = array();
$values[0]['link'] = JText::_($default_link);
$values[0]['title'] = JText::_($default_title);
$values[0]['hits'] = 0;
$values[0] = serialize($values[0]);
}
}
// Value handling parameters
$multiple = $field->parameters->get('allow_multiple', 1);
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
default:
$separatorf = ' ';
break;
}
// Optimization, do some stuff outside the loop
static $hits_icon = null;
if ($hits_icon === null && ($display_hits == 1 || $display_hits == 3)) {
$_attribs = $display_hits == 1 ? 'class="hasTip" title=":: %s ' . JText::_('FLEXI_HITS', true) . '"' : '';
$hits_icon = FLEXI_J16GE ? JHTML::image('components/com_flexicontent/assets/images/' . 'user.png', JText::_('FLEXI_HITS'), $_attribs) : JHTML::_('image.site', 'user.png', 'components/com_flexicontent/assets/images/', NULL, NULL, JText::_('FLEXI_HITS'), $_attribs);
}
// needed for backend display
//if ($display_hits)
// $isAdmin = JFactory::getApplication()->isAdmin();
// initialise property
//.........这里部分代码省略.........
示例2: 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);
}
示例3: 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);
}
示例4: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
$field->label = JText::_($field->label);
// Some variables
$is_ingroup = !empty($field->ingroup);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0);
$image_source = $field->parameters->get('image_source', 0);
// ***********************
// One time initialization
// ***********************
static $initialized = null;
static $app, $document, $option;
static $isMobile, $isTablet, $useMobile;
if ($initialized === null) {
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$option = JRequest::getVar('option');
jimport('joomla.filesystem');
// *****************************
// Get isMobile / isTablet Flags
// *****************************
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
// **********************************************
// Static FLAGS indicating if JS libs were loaded
// **********************************************
static $multiboxadded = false;
static $fancyboxadded = false;
static $gallerifficadded = false;
static $elastislideadded = false;
static $photoswipeadded = false;
// *****************************
// Current view variable / FLAGs
// *****************************
$realview = JRequest::getVar('view', FLEXI_ITEMVIEW);
$view = JRequest::getVar('flexi_callview', $realview);
$isFeedView = JRequest::getCmd('format', null) == 'feed';
$isItemsManager = $app->isAdmin() && $realview == 'items' && $option == 'com_flexicontent';
$isSite = $app->isSite();
// *************************************************
// TODO: implement MODES >= 2, and remove this CODE
// *************************************************
if ($image_source > 1) {
global $fc_folder_mode_err;
if (empty($fc_folder_mode_err[$field->id])) {
echo __FUNCTION__ . "(): folder-mode: " . $image_source . " not implemented please change image-source mode in image/gallery field with id: " . $field->id;
$fc_folder_mode_err[$field->id] = 1;
$image_source = 1;
}
}
$all_media = $field->parameters->get('list_all_media_files', 0);
$unique_thumb_method = $field->parameters->get('unique_thumb_method', 0);
$dir = $field->parameters->get('dir');
$dir_url = str_replace('\\', '/', $dir);
// Check if using folder of original content being translated
$of_usage = $field->untranslatable ? 1 : $field->parameters->get('of_usage', 0);
$u_item_id = $of_usage && $item->lang_parent_id && $item->lang_parent_id != $item->id ? $item->lang_parent_id : $item->id;
// FLAG to indicate if images are shared across fields, has the effect of adding field id to image thumbnails
$multiple_image_usages = !$image_source && $all_media && $unique_thumb_method == 0;
$extra_prefix = $multiple_image_usages ? 'fld' . $field->id . '_' : '';
$usealt = $field->parameters->get('use_alt', 1);
$alt_usage = $field->parameters->get('alt_usage', 0);
$default_alt = $alt_usage == 2 ? $field->parameters->get('default_alt', '') : '';
$usetitle = $field->parameters->get('use_title', 1);
$title_usage = $field->parameters->get('title_usage', 0);
$default_title = $title_usage == 2 ? JText::_($field->parameters->get('default_title', '')) : '';
$usedesc = $field->parameters->get('use_desc', 1);
$desc_usage = $field->parameters->get('desc_usage', 0);
$default_desc = $desc_usage == 2 ? $field->parameters->get('default_desc', '') : '';
$usecust1 = $field->parameters->get('use_cust1', 0);
$cust1_usage = $field->parameters->get('cust1_usage', 0);
$default_cust1 = $cust1_usage == 2 ? JText::_($field->parameters->get('default_cust1', '')) : '';
$usecust2 = $field->parameters->get('use_cust2', 0);
$cust2_usage = $field->parameters->get('cust2_usage', 0);
$default_cust2 = $cust2_usage == 2 ? JText::_($field->parameters->get('default_cust2', '')) : '';
// Separators / enclosing characters
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 0);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
//.........这里部分代码省略.........
示例5: 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);
//.........这里部分代码省略.........
示例6: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
// Some variables
$is_ingroup = !empty($field->ingroup);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 1);
static $langs = null;
if ($langs === null) {
$langs = FLEXIUtilities::getLanguages('code');
}
static $tooltips_added = false;
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
if (!$tooltips_added) {
FLEXI_J30GE ? JHtml::_('bootstrap.tooltip') : JHTML::_('behavior.tooltip');
$tooltips_added = true;
}
$field->label = JText::_($field->label);
$values = $values ? $values : $field->value;
// Check for no values and no default value, and return empty display
if (empty($values)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
// Microdata (classify the field values for search engines)
$itemprop = '';
//$field->parameters->get('microdata_itemprop');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
// some parameter shortcuts
$useicon = $field->parameters->get('useicon', 1);
$lowercase_filename = $field->parameters->get('lowercase_filename', 1);
$link_filename = $field->parameters->get('link_filename', 1);
$display_filename = $field->parameters->get('display_filename', 1);
$display_lang = $field->parameters->get('display_lang', 1);
$display_size = $field->parameters->get('display_size', 0);
$display_hits = $field->parameters->get('display_hits', 0);
$display_descr = $field->parameters->get('display_descr', 1);
$add_lang_img = $display_lang == 1 || $display_lang == 3;
$add_lang_txt = $display_lang == 2 || $display_lang == 3 || $isMobile;
$add_hits_img = $display_hits == 1 || $display_hits == 3;
$add_hits_txt = $display_hits == 2 || $display_hits == 3 || $isMobile;
$usebutton = $field->parameters->get('usebutton', 1);
$buttonsposition = $field->parameters->get('buttonsposition', 1);
$use_infoseptxt = $field->parameters->get('use_infoseptxt', 1);
$use_actionseptxt = $field->parameters->get('use_actionseptxt', 1);
$infoseptxt = $use_infoseptxt ? ' ' . $field->parameters->get('infoseptxt', '') . ' ' : ' ';
$actionseptxt = $use_actionseptxt ? ' ' . $field->parameters->get('actionseptxt', '') . ' ' : ' ';
$allowdownloads = $field->parameters->get('allowdownloads', 1);
$downloadstext = $allowdownloads == 2 ? $field->parameters->get('downloadstext', 'FLEXI_DOWNLOAD') : 'FLEXI_DOWNLOAD';
$downloadstext = JText::_($downloadstext);
$downloadsinfo = JText::_('FLEXI_FIELD_FILE_DOWNLOAD_INFO', true);
$allowview = $field->parameters->get('allowview', 0);
$viewtext = $allowview == 2 ? $field->parameters->get('viewtext', 'FLEXI_FIELD_FILE_VIEW') : 'FLEXI_FIELD_FILE_VIEW';
$viewtext = JText::_($viewtext);
$viewinfo = JText::_('FLEXI_FIELD_FILE_VIEW_INFO', true);
$allowshare = $field->parameters->get('allowshare', 0);
$sharetext = $allowshare == 2 ? $field->parameters->get('sharetext', 'FLEXI_FIELD_FILE_EMAIL_TO_FRIEND') : 'FLEXI_FIELD_FILE_EMAIL_TO_FRIEND';
$sharetext = JText::_($sharetext);
$shareinfo = JText::_('FLEXI_FIELD_FILE_EMAIL_TO_FRIEND_INFO', true);
$allowaddtocart = $field->parameters->get('use_downloads_manager', 0);
$addtocarttext = $allowaddtocart == 2 ? $field->parameters->get('addtocarttext', 'FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART') : 'FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART';
$addtocarttext = JText::_($addtocarttext);
$addtocartinfo = JText::_('FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART_INFO', true);
$noaccess_display = $field->parameters->get('noaccess_display', 1);
$noaccess_url_unlogged = $field->parameters->get('noaccess_url_unlogged', false);
$noaccess_url_logged = $field->parameters->get('noaccess_url_logged', false);
$noaccess_msg_unlogged = JText::_($field->parameters->get('noaccess_msg_unlogged', ''));
$noaccess_msg_logged = JText::_($field->parameters->get('noaccess_msg_logged', ''));
$noaccess_addvars = $field->parameters->get('noaccess_addvars', 0);
// Select appropriate messages depending if user is logged on
$noaccess_url = JFactory::getUser()->guest ? $noaccess_url_unlogged : $noaccess_url_logged;
$noaccess_msg = JFactory::getUser()->guest ? $noaccess_msg_unlogged : $noaccess_msg_logged;
// VERIFY downloads manager module is installed and enabled
static $mod_is_enabled = null;
//.........这里部分代码省略.........
示例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');
$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);
//.........这里部分代码省略.........
示例8: loadFramework
/**
* Utility function to load each JS Frameworks once
*
* @param string $text
* @param int $nb
* @return string
* @since 1.5
*/
static function loadFramework($framework, $mode = '', $params = null)
{
// Detect already loaded framework
static $_loaded = array();
if (isset($_loaded[$framework])) {
return $_loaded[$framework];
}
$_loaded[$framework] = false;
// Get frameworks that are configured to be loaded manually in frontend (e.g. via the Joomla template)
$app = JFactory::getApplication();
static $load_frameworks = null;
static $load_jquery = null;
if (!isset($load_frameworks[$framework])) {
$flexiparams = JComponentHelper::getParams('com_flexicontent');
//$load_frameworks = $flexiparams->get('load_frameworks', array('jQuery','image-picker','masonry','select2','inputmask','prettyCheckable','fancybox'));
//$load_frameworks = FLEXIUtilities::paramToArray($load_frameworks);
//$load_frameworks = array_flip($load_frameworks);
//$load_jquery = isset($load_frameworks['jQuery']) || !$app->isSite();
if ($load_jquery === null) {
$load_jquery = $flexiparams->get('loadfw_jquery', 1) == 1 || !$app->isSite();
}
$load_framework = $flexiparams->get('loadfw_' . strtolower(str_replace('-', '_', $framework)), 1);
$load_frameworks[$framework] = $load_framework == 1 || $load_framework == 2 && !$app->isSite();
}
// Set loaded flag
$_loaded[$framework] = $load_frameworks[$framework];
// Do not progress further if it is disabled
if (!$load_frameworks[$framework]) {
return false;
}
// Load Framework
$document = JFactory::getDocument();
$lib_path = '/components/com_flexicontent/librairies';
$js = "";
$css = "";
switch ($framework) {
case 'jQuery':
if ($load_jquery) {
flexicontent_html::loadJQuery(1, 1, 1, 1, $params);
}
break;
case 'mCSB':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/mCSB';
$document->addScript($framework_path . '/jquery.mCustomScrollbar.min.js');
$document->addStyleSheet($framework_path . '/jquery.mCustomScrollbar.css');
$js .= "\n\t\t\t\t\tjQuery(document).ready(function(){\n\t\t\t\t\t\tjQuery('.fc_add_scroller').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('.fc_add_scroller_horizontal').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\thorizontalScroll:true,\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t";
break;
case 'image-picker':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/image-picker';
$document->addScript($framework_path . '/image-picker.min.js');
$document->addStyleSheet($framework_path . '/image-picker.css');
break;
case 'masonry':
$framework_path = JURI::root(true) . $lib_path . '/masonry';
$document->addScript($framework_path . '/masonry.pkgd.min.js');
break;
case 'select2':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
// Replace chosen function (if loaded)
//JHtml::_('formbehavior.chosen', '#_some_iiidddd_');
$js .= "\n\t\t\t\tif (typeof jQuery.fn.chosen == 'function') { \n\t\t\t\t\tjQuery.fn.chosen_fc = jQuery.fn.chosen;\n\t\t\t\t\tjQuery.fn.chosen = function(){\n\t\t\t\t\t\tvar args = arguments;\n\t\t\t\t\t\tjQuery(this).each(function() {\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('use_select2_lib')) return;\n\t\t\t\t\t\t\tjQuery(this).chosen_fc(args);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t";
$ver = '3.5.4';
$framework_path = JURI::root(true) . $lib_path . '/select2';
$framework_folder = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'select2';
$document->addScriptVersion($framework_path . '/select2.min.js', $ver);
$document->addStyleSheetVersion($framework_path . '/select2.css', $ver);
$lang_code = flexicontent_html::getUserCurrentLang();
if ($lang_code && $lang_code != 'en') {
// Try language shortcode
if (file_exists($framework_folder . DS . 'select2_locale_' . $lang_code . '.js')) {
$document->addScriptVersion($framework_path . '/select2_locale_' . $lang_code . '.js', $ver);
} else {
$country_code = flexicontent_html::getUserCurrentLang($short_tag = false);
if ($country_code && file_exists($framework_folder . DS . 'select2_locale_' . $country_code . '.js')) {
$document->addScriptVersion($framework_path . '/select2_locale_' . $country_code . '.js', $ver);
}
}
}
// Disable select2 JS in mobile devices
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$js .= "\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\t" . ($isMobile ? "\n\t\t\t\t\t\tjQuery('select.use_select2_lib')\n\t\t\t\t\t\t\t//.filter(function(){return !jQuery(this).attr('multiple');})\n\t\t\t\t\t\t\t.removeClass('use_select2_lib').addClass('fc_isselect').addClass('fc_ismobile');" : "") . "\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').select2({\n\t\t\t\t\t\t\t/*hideSelectionFromResult: function(selectedObject) { selectedObject.removeClass('select2-result-selectable').addClass('select2-result-unselectable').addClass('select2-disabled'); return false; },*/\n\t\t\t\t\t\t\tminimumResultsForSearch: 10\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('div.use_select2_lib').each(function() {\n\t\t\t\t\t\t\tvar el_container = jQuery(this);\n\t\t\t\t\t\t\tvar el_select = el_container.next('select');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_label_text = el_select.attr('data-fc_label_text');\n\t\t\t\t\t\t\tif (!fc_label_text) fc_label_text = el_select.attr('fc_label_text');\n\t\t\t\t\t\t\tif (fc_label_text) {\n\t\t\t\t\t\t\t\tvar _label = (fc_label_text.length >= 30) ? fc_label_text.substring(0, 28) + '...' : fc_label_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_label fc_has_inner_label_select2',\n\t\t\t\t\t\t\t\t\t'text': _label\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field'));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_prompt_text = el_select.attr('data-fc_prompt_text');\n\t\t\t\t\t\t\tif (!fc_prompt_text) fc_prompt_text = el_select.attr('fc_prompt_text');\n\t\t\t\t\t\t\tif (fc_prompt_text) {\n\t\t\t\t\t\t\t\tvar _prompt = (fc_prompt_text.length >= 30) ? fc_prompt_text.substring(0, 28) + '...' : fc_prompt_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_prompt fc_has_inner_prompt_select2',\n\t\t\t\t\t\t\t\t\t'text': _prompt\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field')).hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = el_container.find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (val === null) {\n\t\t\t\t\t\t\t\t\t//el.addClass('fc_highlight_disabled');\n\t\t\t\t\t\t\t\t} else if (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('select2-open', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.hide();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected');\n\t\t\t\t\t\t\t\tels.addClass('select2-selected-highlight').addClass('select2-disabled').removeClass('select2-selected').removeClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on('select2-close', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.show();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected-highlight');\n\t\t\t\t\t\t\t\tels.removeClass('select2-selected-highlight').removeClass('select2-disabled').addClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\t('change', function() {\n\t\t\t\t\t\t\tvar el_select = jQuery(this);\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = jQuery(this).prev('div').find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('div.use_select2_lib.select2-container-multi input').on('keydown', function() {\n\t\t\t\t\t\t\tvar el = jQuery(this);\n\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\tvar val = el.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, 0);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('loaded open', function() {\n\t\t\t\t\t\t\tvar ul = jQuery('#select2-drop ul.select2-results');\n\t\t\t\t\t\t\tvar needsScroll= ul.prop('scrollHeight') > ul.prop('clientHeight');\n\t\t\t\t\t\t\tif (needsScroll) ul.css('overflow-y', 'scroll');\n\t\t\t\t\t\t\telse ul.css('overflow-y', 'auto');\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t";
break;
case 'inputmask':
//.........这里部分代码省略.........
示例9: display
/**
* Display the view
*/
function display($cachable = null, $urlparams = false)
{
// Debuging message
//JError::raiseNotice(500, 'IN display()'); // TOREMOVE
$CLIENT_CACHEABLE_PUBLIC = 1;
$CLIENT_CACHEABLE_PRIVATE = 2;
$jinput = JFactory::getApplication()->input;
$userid = JFactory::getUser()->get('id');
$cc = $jinput->get('cc', null);
$view = $jinput->get('view', '', 'cmd');
$layout = $jinput->get('layout', '', 'cmd');
// Access checking for --items-- viewing, will be handled by the items model, this is because THIS display() TASK is used by other views too
// in future it maybe moved here to the controller, e.g. create a special task item_display() for item viewing, or insert some IF bellow
// ///////////////////////
// Display case: ITEM FORM
// ///////////////////////
// Also a compatibility check: Layout is form and task is not set: this is new item submit ...
if ($jinput->get('layout', false) == "form" && !$jinput->get('task', false)) {
$jinput->set('browser_cachable', 0);
$jinput->set('task', 'add');
$this->add();
return;
}
// //////////////////////////////////////////////////////////////////////////
// Display case: FLEXIcontent frontend view (category, item, favourites, etc)
// //////////////////////////////////////////////////////////////////////////
// *******************
// Handle SERVER Cache
// *******************
// SHOW RECENT FAVOURED ITEMS IMMEDIATELY: do not cache the view
if ($view == 'favourites' || $view == 'category' && $layout == 'favs') {
$cachable = false;
} else {
if ($view == 'search' || $jinput->get('filter')) {
$cachable = false;
} else {
$cachable = true;
foreach ($_GET as $i => $v) {
if (substr($i, 0, 7) === "filter_") {
$cachable = false;
break;
}
}
}
}
// ********************
// Handle browser Cache
// ********************
if ($cc !== null) {
// Currently our plugin will ignore this and force 'private', because of risk to break 3rd party extensions doing cookie-based content per guest
$browser_cachable = $userid ? $CLIENT_CACHEABLE_PRIVATE : $CLIENT_CACHEABLE_PUBLIC;
} else {
$browser_cachable = 0;
}
// CASE: urlparams were explicitely given
if (!empty($urlparams)) {
$safeurlparams =& $urlparams;
} else {
$safeurlparams = array();
// Add menu URL variables
$menu = JFactory::getApplication()->getMenu()->getActive();
if ($menu) {
foreach ($menu->query as $_varname => $_ignore) {
$safeurlparams[$_varname] = 'STRING';
}
}
// Add any existing URL variables (=submitted via GET), ... we only need variable names, (so can use them unfiltered)
foreach ($_GET as $_varname => $_ignore) {
$safeurlparams[$_varname] = 'STRING';
}
}
// If component is serving different pages to logged users, this will avoid
// having users seeing same page after login/logout when conservative caching is used
if ($userid = JFactory::getUser()->get('id')) {
$jinput->set('__fc_user_id__', $userid);
$safeurlparams['__fc_user_id__'] = 'STRING';
}
$cparams = JComponentHelper::getParams('com_flexicontent');
$use_mobile_layouts = $cparams->get('use_mobile_layouts', 0);
$tabletSameAsDesktop = $cparams->get('force_desktop_layout', 0) == 1;
// If component is serving different pages for mobile devices, this will avoid
// having users seeing the same page regardless of being on desktop or mobile
$mobileDetector = flexicontent_html::getMobileDetector();
//$client = JFactory::getApplication()->client; $isMobile = $client->mobile;
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
if ($use_mobile_layouts && $isMobile && (!$isTablet || !$tabletSameAsDesktop)) {
$jinput->set('__fc_client__', 'Mobile');
$safeurlparams['__fc_client__'] = 'STRING';
}
// Moved code for browser's cache control to system plugin to do at the latest possible point
// =0, NOT user brower CACHEABLE
// >0, user browser CACHEABLE, ask browser to store and redisplay it, without revalidating
// *** Intermediary Cache control
// 1 means CACHEABLE, PUBLIC content, proxies can cache: 'Cache-Control:public'
// 2 means CACHEABLE, PRIVATE (logged user) content, proxies must not cache: 'Cache-Control:private'
// null will let default (Joomla website) HTTP headers, e.g. re-validate
//.........这里部分代码省略.........
示例10: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
// Get isMobile / isTablet Flags
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
// execute the code only if the field type match the plugin type
if (!in_array($field->field_type, self::$field_types)) {
return;
}
$field->label = JText::_($field->label);
static $multiboxadded = false;
static $fancyboxadded = false;
static $gallerifficadded = false;
static $elastislideadded = false;
static $photoswipeadded = false;
$values = $values ? $values : $field->value;
$view = JRequest::getVar('flexi_callview', JRequest::getVar('view', FLEXI_ITEMVIEW));
$multiple = $field->parameters->get('allow_multiple', 0);
$image_source = $field->parameters->get('image_source', 0);
if ($image_source > 1) {
global $fc_folder_mode_err;
if (empty($fc_folder_mode_err[$field->id])) {
echo __FUNCTION__ . "(): folder-mode: " . $image_source . " not implemented please change image-source mode in image/gallery field with id: " . $field->id;
$fc_folder_mode_err[$field->id] = 1;
$image_source = 1;
}
}
$all_media = $field->parameters->get('list_all_media_files', 0);
$unique_thumb_method = $field->parameters->get('unique_thumb_method', 0);
$dir = $field->parameters->get('dir');
$dir_url = str_replace('\\', '/', $dir);
// Check if using folder of original content being translated
$of_usage = $field->untranslatable ? 1 : $field->parameters->get('of_usage', 0);
$u_item_id = $of_usage && $item->lang_parent_id && $item->lang_parent_id != $item->id ? $item->lang_parent_id : $item->id;
// FLAG to indicate if images are shared across fields, has the effect of adding field id to image thumbnails
$multiple_image_usages = !$image_source && $all_media && $unique_thumb_method == 0;
$extra_prefix = $multiple_image_usages ? 'fld' . $field->id . '_' : '';
$usealt = $field->parameters->get('use_alt', 1);
$alt_usage = $field->parameters->get('alt_usage', 0);
$default_alt = $alt_usage == 2 ? $field->parameters->get('default_alt', '') : '';
$usetitle = $field->parameters->get('use_title', 1);
$title_usage = $field->parameters->get('title_usage', 0);
$default_title = $title_usage == 2 ? JText::_($field->parameters->get('default_title', '')) : '';
$usedesc = $field->parameters->get('use_desc', 1);
$desc_usage = $field->parameters->get('desc_usage', 0);
$default_desc = $desc_usage == 2 ? $field->parameters->get('default_desc', '') : '';
// Separators / enclosing characters
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 0);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
default:
$separatorf = ' ';
break;
}
// intro-full mode get their values from item's parameters
if ($image_source == -1) {
$values = array();
$_image_name = $view == 'item' ? 'full' : 'intro';
$_image_path = $item->images->get('image_' . $_image_name, '');
if ($_image_path) {
//.........这里部分代码省略.........
示例11: display
/**
* Display the view
*/
function display($cachable = null, $urlparams = false)
{
// Debuging message
//JError::raiseNotice(500, 'IN display()'); // TOREMOVE
$jinput = JFactory::getApplication()->input;
// Access checking for --items-- viewing, will be handled by the items model, this is because THIS display() TASK is used by other views too
// in future it maybe moved here to the controller, e.g. create a special task item_display() for item viewing, or insert some IF bellow
// Compatibility check: Layout is form and task is not set: this is new item submit ...
if ($jinput->get('layout', false) == "form" && !$jinput->get('task', false)) {
// 0 or 1, will allow browser to store without revalidating, null will let default (Joomla website) HTTP headers, e.g. re-validate
JFactory::getSession()->set('fc_cachable', 0, 'flexicontent');
$jinput->set('task', 'add');
$this->add();
} else {
// AVOID MAKING TOO LARGE: (case 1) SEARCH view or OTHER view with TEXT search active
if ($jinput->get('view') == 'search' || $jinput->get('filter')) {
$cachable = false;
} else {
$cachable = true;
foreach ($_GET as $i => $v) {
if (substr($i, 0, 7) === "filter_") {
$cachable = false;
break;
}
}
}
// CASE: urlparams were explicitely given
if (!empty($urlparams)) {
$safeurlparams =& $urlparams;
} else {
$safeurlparams = array();
// Add menu URL variables
$menu = JFactory::getApplication()->getMenu()->getActive();
if ($menu) {
foreach ($menu->query as $_varname => $_ignore) {
$safeurlparams[$_varname] = 'STRING';
}
}
// Add any existing URL variables (=submitted via GET), ... we only need variable names, (so can use them unfiltered)
foreach ($_GET as $_varname => $_ignore) {
$safeurlparams[$_varname] = 'STRING';
}
}
// If component is serving different pages to logged users, this will avoid
// having users seeing same page after login/logout when conservative caching is used
if ($userid = JFactory::getUser()->get('id')) {
$jinput->set('__fc_user_id__', $userid);
$safeurlparams['__fc_user_id__'] = 'STRING';
}
$cparams = JComponentHelper::getParams('com_flexicontent');
$use_mobile_layouts = $cparams->get('use_mobile_layouts', 0);
$tabletSameAsDesktop = $cparams->get('force_desktop_layout', 0) == 1;
// If component is serving different pages for mobile devices, this will avoid
// having users seeing the same page regardless of being on desktop or mobile
$mobileDetector = flexicontent_html::getMobileDetector();
//$client = JFactory::getApplication()->client; $isMobile = $client->mobile;
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
if ($use_mobile_layouts && $isMobile && (!$isTablet || !$tabletSameAsDesktop)) {
$jinput->set('__fc_client__', 'Mobile');
$safeurlparams['__fc_client__'] = 'STRING';
}
// Moved code for browser's cache control to system plugin to do at the latest possible point
// 0 or 1, will allow browser to store without revalidating, null will let default (Joomla website) HTTP headers, e.g. re-validate
JFactory::getSession()->set('fc_cachable', (int) $cachable, 'flexicontent');
//echo "cacheable: ".(int)$cachable." - " . print_r($safeurlparams, true) ."<br/>";
parent::display($cachable, $safeurlparams);
}
}
示例12: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
// Get isMobile / isTablet Flags
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
$field->label = JText::_($field->label);
// Some variables
$is_ingroup = !empty($field->ingroup);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0);
// Value handling parameters
$lang_filter_values = 0;
//$field->parameters->get( 'lang_filter_values', 1);
// some parameter shortcuts
$target = $field->parameters->get('targetblank', 0);
$target_param = $target ? ' target="_blank"' : '';
$display_hits = $field->parameters->get('display_hits', 0);
$add_hits_img = $display_hits == 1 || $display_hits == 3;
$add_hits_txt = $display_hits == 2 || $display_hits == 3 || $isMobile;
$rel_nofollow = $field->parameters->get('add_rel_nofollow', 0) ? ' rel="nofollow"' : '';
// URL value
$link_usage = $field->parameters->get('link_usage', 0);
$default_link = $link_usage == 2 ? $field->parameters->get('default_value_link', '') : '';
$default_link = $default_link ? JText::_($default_link) : '';
// URL title & linking text (optional)
$usetitle = $field->parameters->get('use_title', 0);
$title_usage = $field->parameters->get('title_usage', 0);
$default_title = $title_usage == 2 ? JText::_($field->parameters->get('default_value_title', '')) : '';
$default_title = $default_title ? JText::_($default_title) : '';
// Get field values
$values = $values ? $values : $field->value;
// Check for no values and no default value, and return empty display
if (empty($values)) {
if (!strlen($default_link)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
$values = array();
$values[0]['link'] = $default_link;
$values[0]['title'] = $default_title;
$values[0]['hits'] = 0;
$values[0] = serialize($values[0]);
}
// (* BECAUSE OF THIS, the value display loop expects unserialized values)
foreach ($values as &$value) {
// Compatibility for unserialized values or for NULL values in a field group
if (!is_array($value)) {
$v = !empty($value) ? @unserialize($value) : false;
$value = $v !== false || $v === 'b:0;' ? $v : array('link' => $value, 'title' => '', 'hits' => 0);
}
}
unset($value);
// Unset this or you are looking for trouble !!!, because it is a reference and reusing it will overwrite the pointed variable !!!
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
//.........这里部分代码省略.........
示例13: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
// execute the code only if the field type match the plugin type
if (!in_array($field->field_type, self::$field_types)) {
return;
}
static $langs = null;
if ($langs === null) {
$langs = FLEXIUtilities::getLanguages('code');
}
static $tooltips_added = false;
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
if (!$tooltips_added) {
FLEXI_J30GE ? JHtml::_('bootstrap.tooltip') : JHTML::_('behavior.tooltip');
$tooltips_added = true;
}
$field->label = JText::_($field->label);
$values = $values ? $values : $field->value;
if (empty($values)) {
$field->{$prop} = '';
return;
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
// some parameter shortcuts
$useicon = $field->parameters->get('useicon', 1);
$lowercase_filename = $field->parameters->get('lowercase_filename', 1);
$link_filename = $field->parameters->get('link_filename', 1);
$display_filename = $field->parameters->get('display_filename', 1);
$display_lang = $field->parameters->get('display_lang', 1);
$display_size = $field->parameters->get('display_size', 0);
$display_hits = $field->parameters->get('display_hits', 0);
$display_descr = $field->parameters->get('display_descr', 1);
$add_lang_img = $display_lang == 1 || $display_lang == 3;
$add_lang_txt = $display_lang == 2 || $display_lang == 3 || $isMobile;
$add_hits_img = $display_hits == 1 || $display_hits == 3;
$add_hits_txt = $display_hits == 2 || $display_hits == 3 || $isMobile;
$usebutton = $field->parameters->get('usebutton', 1);
$buttonsposition = $field->parameters->get('buttonsposition', 1);
$use_infoseptxt = $field->parameters->get('use_infoseptxt', 1);
$use_actionseptxt = $field->parameters->get('use_actionseptxt', 1);
$infoseptxt = $use_infoseptxt ? ' ' . $field->parameters->get('infoseptxt', '') . ' ' : ' ';
$actionseptxt = $use_actionseptxt ? ' ' . $field->parameters->get('actionseptxt', '') . ' ' : ' ';
$allowdownloads = $field->parameters->get('allowdownloads', 1);
$downloadstext = $allowdownloads == 2 ? $field->parameters->get('downloadstext', 'FLEXI_DOWNLOAD') : 'FLEXI_DOWNLOAD';
$downloadstext = JText::_($downloadstext);
$downloadsinfo = JText::_('FLEXI_FIELD_FILE_DOWNLOAD_INFO', true);
$allowview = $field->parameters->get('allowview', 0);
$viewtext = $allowview == 2 ? $field->parameters->get('viewtext', 'FLEXI_FIELD_FILE_VIEW') : 'FLEXI_FIELD_FILE_VIEW';
$viewtext = JText::_($viewtext);
$viewinfo = JText::_('FLEXI_FIELD_FILE_VIEW_INFO', true);
$allowshare = $field->parameters->get('allowshare', 0);
$sharetext = $allowshare == 2 ? $field->parameters->get('sharetext', 'FLEXI_FIELD_FILE_EMAIL_TO_FRIEND') : 'FLEXI_FIELD_FILE_EMAIL_TO_FRIEND';
$sharetext = JText::_($sharetext);
$shareinfo = JText::_('FLEXI_FIELD_FILE_EMAIL_TO_FRIEND_INFO', true);
$allowaddtocart = $field->parameters->get('use_downloads_manager', 0);
$addtocarttext = $allowaddtocart == 2 ? $field->parameters->get('addtocarttext', 'FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART') : 'FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART';
$addtocarttext = JText::_($addtocarttext);
$addtocartinfo = JText::_('FLEXI_FIELD_FILE_ADD_TO_DOWNLOADS_CART_INFO', true);
$noaccess_display = $field->parameters->get('noaccess_display', 1);
$noaccess_url_unlogged = $field->parameters->get('noaccess_url_unlogged', false);
$noaccess_url_logged = $field->parameters->get('noaccess_url_logged', false);
$noaccess_msg_unlogged = JText::_($field->parameters->get('noaccess_msg_unlogged', ''));
$noaccess_msg_logged = JText::_($field->parameters->get('noaccess_msg_logged', ''));
$noaccess_addvars = $field->parameters->get('noaccess_addvars', 0);
// Select appropriate messages depending if user is logged on
$noaccess_url = JFactory::getUser()->guest ? $noaccess_url_unlogged : $noaccess_url_logged;
$noaccess_msg = JFactory::getUser()->guest ? $noaccess_msg_unlogged : $noaccess_msg_logged;
// VERIFY downloads manager module is installed and enabled
static $mod_is_enabled = null;
if ($allowaddtocart && $mod_is_enabled === null) {
$db = JFactory::getDBO();
$query = "SELECT published FROM #__modules WHERE module = 'mod_flexidownloads' AND published = 1";
$db->setQuery($query);
$mod_is_enabled = $db->loadResult();
if (!$mod_is_enabled) {
$app = JFactory::getApplication();
//.........这里部分代码省略.........
示例14: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
// Get isMobile / isTablet Flags
static $isMobile = null;
static $isTablet = null;
static $useMobile = null;
if ($useMobile === null) {
$cparams = JComponentHelper::getParams('com_flexicontent');
$force_desktop_layout = $cparams->get('force_desktop_layout', 0);
//$start_microtime = microtime(true);
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();
$isTablet = $mobileDetector->isTablet();
$useMobile = $force_desktop_layout ? $isMobile && !$isTablet : $isMobile;
//$time_passed = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
//printf('<br/>-- [Detect Mobile: %.3f s] ', $time_passed/1000000);
}
$field->label = JText::_($field->label);
// Some variables
$is_ingroup = !empty($field->ingroup);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0);
// Value handling parameters
$lang_filter_values = 0;
//$field->parameters->get( 'lang_filter_values', 1);
// some parameter shortcuts
$target = $field->parameters->get('targetblank', 0);
$target_param = $target ? ' target="_blank"' : '';
$display_hits = $field->parameters->get('display_hits', 0);
$add_hits_img = $display_hits == 1 || $display_hits == 3;
$add_hits_txt = $display_hits == 2 || $display_hits == 3 || $isMobile;
$rel_nofollow = $field->parameters->get('add_rel_nofollow', 0) ? ' rel="nofollow"' : '';
// URL value
$link_usage = $field->parameters->get('link_usage', 0);
$default_link = $link_usage == 2 ? $field->parameters->get('default_value_link', '') : '';
$default_link = $default_link ? JText::_($default_link) : '';
// URL title & linking text (optional)
$usetitle = $field->parameters->get('use_title', 0);
$title_usage = $field->parameters->get('title_usage', 0);
$default_title = $title_usage == 2 ? JText::_($field->parameters->get('default_value_title', '')) : '';
$default_title = $default_title ? JText::_($default_title) : '';
// Get field values
$values = $values ? $values : $field->value;
// Check for no values and no default value, and return empty display
if (empty($values)) {
if (!strlen($default_link)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
$values = array();
$values[0]['link'] = $default_link;
$values[0]['title'] = $default_title;
$values[0]['hits'] = 0;
$values[0] = serialize($values[0]);
}
$unserialize_vals = true;
if ($unserialize_vals) {
// (* BECAUSE OF THIS, the value display loop expects unserialized values)
foreach ($values as &$value) {
// Compatibility for unserialized values or for NULL values in a field group
if (!is_array($value)) {
$v = !empty($value) ? @unserialize($value) : false;
$value = $v !== false || $v === 'b:0;' ? $v : array('link' => $value, 'title' => '', 'hits' => 0);
}
}
unset($value);
// Unset this or you are looking for trouble !!!, because it is a reference and reusing it will overwrite the pointed variable !!!
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
//.........这里部分代码省略.........