本文整理汇总了PHP中FlexicontentFields::replaceFieldValue方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentFields::replaceFieldValue方法的具体用法?PHP FlexicontentFields::replaceFieldValue怎么用?PHP FlexicontentFields::replaceFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentFields
的用法示例。
在下文中一共展示了FlexicontentFields::replaceFieldValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: 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;
}
//.........这里部分代码省略.........
示例3: 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);
// Value handling parameters
$lang_filter_values = 0;
//$field->parameters->get( 'lang_filter_values', 1);
$clean_output = $field->parameters->get('clean_output', 0);
$encode_output = $field->parameters->get('encode_output', 0);
// Term Title
$title_label = JText::_($field->parameters->get('title_label', 'FLEXI_FIELD_TERMTITLE'));
$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) : '';
// Term (description) Text
$value_label = JText::_($field->parameters->get('value_label', 'FLEXI_FIELD_TERMTEXT'));
$value_usage = $field->parameters->get('default_value_use', 0);
$default_value = $value_usage == 2 ? $field->parameters->get('default_value', '') : '';
$default_value = $default_value ? JText::_($default_value) : '';
// 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_value)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
$values = array();
$values[0]['title'] = $default_title;
$values[0]['text'] = $default_value;
$values[0] = serialize($values[0]);
}
// ******************************************
// Language filter, clean output, encode HTML
// ******************************************
if ($clean_output) {
$ifilter = $clean_output == 1 ? JFilterInput::getInstance(null, null, 1, 1) : JFilterInput::getInstance();
}
if (1) {
// (* 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('title' => $value, 'text' => '');
}
if ($lang_filter_values) {
$value['title'] = JText::_($value['title']);
$value['text'] = JText::_($value['text']);
}
if ($clean_output) {
$value['title'] = $ifilter->clean($value['title'], 'string');
$value['text'] = $ifilter->clean($value['text'], 'string');
}
if ($encode_output) {
$value['title'] = htmlspecialchars($value['title'], ENT_QUOTES, 'UTF-8');
$value['text'] = htmlspecialchars($value['text'], ENT_QUOTES, 'UTF-8');
}
}
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;
//.........这里部分代码省略.........
示例4: onDisplayCoreFieldValue
function onDisplayCoreFieldValue(&$_field, &$_item, &$params, $_tags = null, $_categories = null, $_favourites = null, $_favoured = null, $_vote = null, $values = null, $prop = 'display')
{
// this function is a mess and need complete refactoring
// execute the code only if the field type match the plugin type
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
static $cat_links = array();
static $tag_links = array();
if (!is_array($_item)) {
$items = array(&$_item);
} else {
$items =& $_item;
}
// Prefix - Suffix - Separator parameters
// these parameters should be common so we will retrieve them from the first item instead of inside the loop
$item = reset($items);
if (is_object($_field)) {
$field = $_field;
} else {
$field = $item->fields[$_field];
}
$remove_space = $field->parameters->get('remove_space', 0);
$_pretext = $field->parameters->get('pretext', '');
$_posttext = $field->parameters->get('posttext', '');
$separatorf = $field->parameters->get('separatorf', 3);
$_opentag = $field->parameters->get('opentag', '');
$_closetag = $field->parameters->get('closetag', '');
$pretext_cacheable = $posttext_cacheable = $opentag_cacheable = $closetag_cacheable = false;
foreach ($items as $item) {
//if (!is_object($_field)) echo $item->id." - ".$_field ."<br/>";
if (is_object($_field)) {
$field = $_field;
} else {
$field = $item->fields[$_field];
}
if ($field->iscore != 1) {
continue;
}
$field->item_id = $item->id;
// Replace item properties or values of other fields
if (!$pretext_cacheable) {
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $_pretext, 'pretext', $pretext_cacheable);
if ($pretext && !$remove_space) {
$pretext = $pretext . ' ';
}
}
if (!$posttext_cacheable) {
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $_posttext, 'posttext', $posttext_cacheable);
if ($posttext && !$remove_space) {
$posttext = ' ' . $posttext;
}
}
if (!$opentag_cacheable) {
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $_opentag, 'opentag', $opentag_cacheable);
}
// used by some fields
if (!$closetag_cacheable) {
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $_closetag, 'closetag', $closetag_cacheable);
}
// used by some fields
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;
}
$field->value = array();
switch ($field->field_type) {
case 'created':
// created
$field->value[] = $item->created;
$dateformat = $field->parameters->get('date_format', '');
$customdate = $field->parameters->get('custom_date', '');
$dateformat = $dateformat ? $dateformat : $customdate;
$field->display = $pretext . JHTML::_('date', $item->created, JText::_($dateformat)) . $posttext;
break;
case 'createdby':
// created by
$field->value[] = $item->created_by;
$field->display = $pretext . ($field->parameters->get('name_username', 1) == 2 ? $item->cuname : $item->creator) . $posttext;
break;
case 'modified':
// modified
$field->value[] = $item->modified;
//.........这里部分代码省略.........
示例5: 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);
// Get field values
$values = $values ? $values : $field->value;
// Check for no values and not displaying ALL elements
$display_all = $field->parameters->get('display_all', 0) && !$is_ingroup;
// NOT supported inside fielgroup yet
if (empty($values) && !$display_all) {
if (!$is_ingroup) {
$field->{$prop} = '';
$field->display_index = '';
} else {
$field->{$prop} = array();
$field->display_index = 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;
}
// Value creation
$sql_mode = $field->parameters->get('sql_mode', 0);
$field_elements = $field->parameters->get('field_elements', '');
$text_or_value = $field->parameters->get('text_or_value', 2);
// image specific or image related variables
$imagedir = preg_replace('#^(/)*#', '', $field->parameters->get('imagedir'));
$imgpath = JURI::root(true) . '/' . $imagedir;
$tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip';
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;
}
// Get indexed element values
$elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props);
if (!$elements) {
if ($sql_mode) {
$field->{$prop} = JText::_('FLEXI_FIELD_INVALID_QUERY');
} else {
$field->{$prop} = JText::_('FLEXI_FIELD_INVALID_ELEMENTS');
}
return;
}
// Check for no elements found
if (empty($elements)) {
$field->{$prop} = '';
$field->display_index = '';
return;
}
// Handle case of FORM fields that each value is an array of values
// (e.g. selectmultiple, checkbox), and that multi-value input is also enabled
// we make sure that values should be an array of arrays
$values = $multiple && self::$valueIsArr ? $values : array($values);
// Create display of field
$field->{$prop} = array();
$display_index = array();
// Prepare for looping
if (!$values) {
$values = array();
}
if ($display_all) {
// non-selected value shortcuts
//.........这里部分代码省略.........
示例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: 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);
$view = JRequest::getVar('flexi_callview', JRequest::getVar('view', FLEXI_ITEMVIEW));
// Get field values
$values = $values ? $values : $field->value;
$values = !is_array($values) ? array($values) : $values;
// make sure values is an array
$isempty = !count($values) || !strlen($values[0]);
// detect empty value
if ($isempty) {
return;
}
// Optional display
$display_phone_label = $field->parameters->get('display_phone_label', 1);
$display_country_code = $field->parameters->get('display_phone_label', 1);
$display_area_code = $field->parameters->get('display_area_code', 1);
// Property Separators
$label_prefix = $field->parameters->get('label_prefix', '');
$label_suffix = $field->parameters->get('label_suffix', '');
$country_code_prefix = $field->parameters->get('country_code_prefix', '');
$separator_cc_phone1 = $field->parameters->get('separator_cc_phone1', '');
$separator_phone1_phone2 = $field->parameters->get('separator_phone1_phone2', '');
$separator_phone2_phone3 = $field->parameters->get('separator_phone2_phone3', '');
// Open/close tags (every value)
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
// Prefix/suffix (value list)
$field_prefix = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('field_prefix', ''), 'field_prefix');
$field_suffix = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('field_suffix', ''), 'field_suffix');
// initialise property
$field->{$prop} = array();
$n = 0;
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('label' => '', 'cc' => '', 'phone1' => $value, 'phone2' => '', 'phone3' => '');
}
if (empty($value['phone1']) && empty($value['phone2']) && empty($value['phone3']) && !$is_ingroup) {
continue;
}
// Skip empty values if not in field group
$field->{$prop}[] = '' . $opentag . ($display_phone_label ? $label_prefix . $value['label'] . $label_suffix : '') . ($display_country_code ? $country_code_prefix . $value['cc'] . $separator_cc_phone1 : '') . ($display_area_code ? $value['phone1'] . $separator_phone1_phone2 : '') . $value['phone2'] . $separator_phone2_phone3 . $value['phone3'] . $closetag;
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
if (!$is_ingroup) {
// Apply separator and open/close tags
if (count($field->{$prop})) {
$field->{$prop} = implode('', $field->{$prop});
$field->{$prop} = $field_prefix . $field->{$prop} . $field_suffix;
} else {
$field->{$prop} = '';
}
}
}
示例8: 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;
}
$field->label = JText::_($field->label);
// 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
$default_value_use = $field->parameters->get('default_value_use', 0);
$default_value = $default_value_use == 2 ? $field->parameters->get('default_value', '') : '';
if (empty($values) && !strlen($default_value)) {
$field->{$prop} = '';
return;
} else {
if (empty($values) && strlen($default_value)) {
$values = array($default_value);
}
}
// Value handling parameters
$multiple = $field->parameters->get('allow_multiple', 1);
// Language filter the values
$lang_filter_values = $field->parameters->get('lang_filter_values', 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;
}
// initialise property
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (!strlen($value)) {
continue;
}
$field->{$prop}[$n] = $pretext . ($lang_filter_values ? JText::_($value) : $value) . $posttext;
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
// Apply separator and open/close tags
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
// Add OGP Data
$useogp = $field->parameters->get('useogp', 0);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
if ($useogp && $field->{$prop}) {
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
if (in_array($view, $ogpinview)) {
switch ($ogpusage) {
case 1:
$usagetype = 'title';
break;
case 2:
$usagetype = 'description';
break;
default:
$usagetype = '';
//.........这里部分代码省略.........
示例9: 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;
$field->label = JText::_($field->label);
// Some variables
$document = JFactory::getDocument();
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
// 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
$default_value_use= $field->parameters->get( 'default_value_use', 0 ) ;
$default_value = ($default_value_use == 2) ? $field->parameters->get( 'default_value', '' ) : '';
if ( empty($values) && !strlen($default_value) ) {
$field->{$prop} = '';
return;
} else if ( empty($values) && strlen($default_value) ) {
$values = array($default_value);
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$opentag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'opentag', '' ), 'opentag' );
$closetag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'closetag', '' ), 'closetag' );
// some parameter shortcuts
$use_html = $field->parameters->get( 'use_html', 0 ) ;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 0);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
// Apply seperator and open/close tags
if ($values) {
$field->{$prop} = $use_html ? $values[0] : nl2br($values[0]);
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
if ($useogp && $field->{$prop}) {
if ( in_array($view, $ogpinview) ) {
switch ($ogpusage)
{
case 1: $usagetype = 'title'; break;
case 2: $usagetype = 'description'; break;
default: $usagetype = ''; break;
}
if ($usagetype) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
$document->addCustomTag('<meta property="og:'.$usagetype.'" content="'.$content_val.'" />');
}
}
}
}
示例10: 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();
//.........这里部分代码省略.........
示例11: 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;
//.........这里部分代码省略.........
示例12: 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;
}
$field->label = JText::_($field->label);
// initialize framework objects and other variables
$config = JFactory::getConfig();
$user = JFactory::getUser();
// 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
$date_source = $field->parameters->get('date_source', 0);
if ($date_source) {
static $nullDate, $never_date;
if ($nullDate == null) {
$nullDate = JFactory::getDBO()->getNullDate();
$never_date = '';
//JText::_('FLEXI_NEVER');
}
$_value = $date_source == 1 ? $item->publish_up : $item->publish_down;
if ($_value == $nullDate) {
$field->{$prop} = $date_source == 2 ? $never_date : '';
return;
}
$values = array($_value);
}
// Value handling parameters
$multiple = $field->parameters->get('allow_multiple', 1);
$date_allowtime = $field->parameters->get('date_allowtime', 1);
$use_editor_tz = $field->parameters->get('use_editor_tz', 0);
$use_editor_tz = $date_allowtime ? $use_editor_tz : 0;
$customdate = $field->parameters->get('custom_date', FLEXI_J16GE ? 'Y-m-d' : '%Y-%m-%d');
$dateformat = $field->parameters->get('date_format', $customdate);
$show_no_value = $field->parameters->get('show_no_value', 0);
$no_value_msg = $field->parameters->get('no_value_msg', 'FLEXI_NO_VALUE');
$display_tz_logged = $field->parameters->get('display_tz_logged', 2);
$display_tz_guests = $field->parameters->get('display_tz_guests', 2);
$display_tz_suffix = $field->parameters->get('display_tz_suffix', 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;
}
// Get timezone to use for displaying the date, this is a string for J2.5 and an (offset) number for J1.5
if (!$use_editor_tz) {
// Raw date output, ignore timezone (no timezone info is printed), NOTE: this is OLD BEHAVIOUR of this field
$tz_suffix_type = -1;
} else {
if ($user->id) {
$tz_suffix_type = $display_tz_logged;
} else {
$tz_suffix_type = $display_tz_guests;
}
}
$tz_info = '';
switch ($tz_suffix_type) {
default:
// including value -1 for raw for output, see above
// including value -1 for raw for output, see above
case 0:
$timezone = FLEXI_J16GE ? 'UTC' : 0;
//$tz_info = '';
break;
case 1:
$timezone = FLEXI_J16GE ? 'UTC' : 0;
//$tz_info = ' UTC+0';
break;
//.........这里部分代码省略.........
示例13: 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);
$view = JRequest::getVar('flexi_callview', JRequest::getVar('view', FLEXI_ITEMVIEW));
// Value handling parameters
$lang_filter_values = $field->parameters->get('lang_filter_values', 0);
$clean_output = $field->parameters->get('clean_output', 0);
$encode_output = $field->parameters->get('encode_output', 0);
$format_output = $field->parameters->get('format_output', 0);
if ($format_output == 1) {
$decimal_digits_displayed = (int) $field->parameters->get('decimal_digits_displayed', 2);
$decimal_digits_sep = $field->parameters->get('decimal_digits_sep', '.');
$decimal_thousands_sep = $field->parameters->get('decimal_thousands_sep', ',');
}
// Default value
$value_usage = $field->parameters->get('default_value_use', 0);
$default_value = $value_usage == 2 ? $field->parameters->get('default_value', '') : '';
$default_value = $default_value ? JText::_($default_value) : '';
// Get field values
$values = $values ? $values : $field->value;
// Load default value
if (empty($values)) {
if (!strlen($default_value)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
$values = array($default_value);
}
// Language filter, clean output, encode HTML
if ($clean_output) {
$ifilter = $clean_output == 1 ? JFilterInput::getInstance(null, null, 1, 1) : JFilterInput::getInstance();
}
if ($lang_filter_values || $clean_output || $encode_output || $format_output) {
// (* BECAUSE OF THIS, the value display loop expects unserialized values)
foreach ($values as &$value) {
if ($format_output == 1) {
$value = @number_format($value, $decimal_digits_displayed, $decimal_digits_sep, $decimal_thousands_sep);
$value = $value === NULL ? 0 : '';
}
if (!strlen($value)) {
continue;
}
// skip further actions
if ($lang_filter_values) {
$value = JText::_($value);
}
if ($clean_output) {
$value = $ifilter->clean($value, 'string');
}
if ($encode_output) {
$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
}
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');
$itemprop = $field->parameters->get('microdata_itemprop');
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;
}
//.........这里部分代码省略.........
示例14: onDisplayFieldValue
public function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
static $all_langs = null;
static $cat_links = array();
static $acclvl_names = null;
$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;
}
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;
}
$props_type = $field->parameters->get('props_type');
switch ($props_type) {
case 'language':
if ($all_langs === null) {
$all_langs = FLEXIUtilities::getLanguages($hash = 'code');
}
$lang_data = $all_langs->{$item->language};
$field->{$prop} = @$lang_data->title_native ? $lang_data->title_native : $lang_data->name;
break;
case 'alias':
$field->{$prop} = $item->{$props_type};
break;
case 'category':
$link_maincat = $field->parameters->get('link_maincat', 1);
if ($link_maincat) {
$maincatid = isset($item->maincatid) ? $item->maincatid : $item->catid;
// maincatid is used by item view
if (!isset($cat_links[$maincatid])) {
$maincat_slug = $item->maincatid ? $item->maincatid . ':' . $item->maincat_alias : $item->catid;
$cat_links[$maincatid] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($maincat_slug));
}
}
$maincat_title = !empty($item->maincat_title) ? $item->maincat_title : 'catid: ' . $item->catid;
$field->{$prop} = $link_maincat ? '<a class="fc_coreprop fc_maincat link_' . $field->name . '" href="' . $cat_links[$maincatid] . '">' . $maincat_title . '</a>' : $maincat_title;
break;
case 'access':
if ($acclvl_names === null) {
$acclvl_names = flexicontent_db::getAccessNames();
}
$field->{$prop} = isset($acclvl_names[$item->access]) ? $acclvl_names[$item->access] : 'unknown access level id: ' . $item->access;
break;
default:
$field->{$prop} = $props_type;
break;
}
if (strlen($field->{$prop})) {
$field->{$prop} = $opentag . $pretext . $field->{$prop} . $posttext . $closetag;
}
}
示例15: 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;
}
$field->label = JText::_($field->label);
// some parameter shortcuts
// This is field 's MAIN value property
$addr_usage = $field->parameters->get('default_value_use', 0);
$default_addr = $addr_usage == 2 ? $field->parameters->get('default_value', '') : '';
// 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_addr)) {
$field->{$prop} = '';
return;
} else {
if (empty($values) && strlen($default_addr)) {
$values = array();
$values[0]['addr'] = JText::_($default_addr);
$values[0]['text'] = JText::_($default_title);
$values[0] = serialize($values[0]);
}
}
$format = JRequest::getCmd('format', null);
// 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;
}
// initialise property
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (!strlen($value)) {
continue;
}
// Compatibility for old unserialized values
$value = @unserialize($value) !== false || $value === 'b:0;' ? unserialize($value) : $value;
if (is_array($value)) {
$addr = $value['addr'];
$text = $value['text'];
} else {
$addr = $value;
$text = '';
}
// If not using property or property is empty, then use default property value
// NOTE: default property values have been cleared, if (propertyname_usage != 2)
$text = $usetitle && strlen($text) ? $text : $default_title;
// Create cloacked email address with custom displayed text
if (strlen($text) && $usetitle) {
$field->{$prop}[] = $format != 'feed' ? $pretext . JHTML::_('email.cloak', $addr, 1, $text, 0) . $posttext : $pretext . '<a href="mailto:' . $addr . '" target="_blank">' . $text . '</a>' . $posttext;
} else {
$field->{$prop}[] = $format != 'feed' ? $pretext . JHTML::_('email.cloak', $addr) . $posttext : $pretext . '<a href="mailto:' . $addr . '" target="_blank">' . $addr . '</a>' . $posttext;
}
$n++;
}
// Apply seperator and open/close tags
if (count($field->{$prop})) {
$field->{$prop} = implode($separatorf, $field->{$prop});
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
//.........这里部分代码省略.........