本文整理汇总了PHP中FLEXIUtilities::paramToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::paramToArray方法的具体用法?PHP FLEXIUtilities::paramToArray怎么用?PHP FLEXIUtilities::paramToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::paramToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildEditLists
//.........这里部分代码省略.........
$skip_subtrees = $featured_cats_parent ? array($featured_cats_parent) : array();
$lists['cid'] = ($enable_cid_selector ? '' : '<label class="label" style="float:none; margin:0 6px 0 0 !important;">locked</label>') . flexicontent_cats::buildcatselect($cid_tree, $fieldname, $selectedcats, false, $attribs, true, true, $actions_allowed, $require_all = true, $skip_subtrees, $disable_subtrees = array(), $custom_options = array(), $disabled_cats);
} else {
if (count($selectedcats) > 1) {
foreach ($selectedcats as $catid) {
$cat_titles[$catid] = $globalcats[$catid]->title;
}
$lists['cid'] .= implode(', ', $cat_titles);
} else {
$lists['cid'] = false;
}
}
// Main category form field
$class = 'scat use_select2_lib';
if ($perms['multicat']) {
$class .= ' validate-catid';
} else {
$class .= ' required';
}
$attribs = 'class="' . $class . '"';
$fieldname = 'jform[catid]';
$enable_catid_selector = $isnew && !$params->get('catid_default') || !$isnew && empty($item->catid) || $perms['canchange_cat'];
if ($params->get('catid_allowed_parent')) {
$catid_tree = flexicontent_cats::getCategoriesTree($published_only = 1, $parent_id = $params->get('catid_allowed_parent'), $depth_limit = 0);
$disabled_cats = $params->get('catid_allowed_parent_disable', 1) ? array($params->get('catid_allowed_parent')) : array();
} else {
$catid_tree =& $categories;
$disabled_cats = array();
}
$lists['catid'] = false;
if (!empty($catid_tree)) {
$disabled = $enable_catid_selector ? '' : ' disabled="disabled"';
$attribs .= $disabled;
$lists['catid'] = ($enable_catid_selector ? '' : '<label class="label" style="float:none; margin:0 6px 0 0 !important;">locked</label>') . flexicontent_cats::buildcatselect($catid_tree, $fieldname, $item->catid, 2, $attribs, true, true, $actions_allowed, $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disabled_cats, $empty_errmsg = JText::_('FLEXI_FORM_NO_MAIN_CAT_ALLOWED'));
} else {
if (!$isnew && $item->catid) {
$lists['catid'] = $globalcats[$item->catid]->title;
}
}
//buid types selectlist
$class = 'required use_select2_lib';
$attribs = 'class="' . $class . '"';
$fieldname = 'jform[type_id]';
$elementid = 'jform_type_id';
$lists['type'] = flexicontent_html::buildtypesselect($types, $fieldname, $typesselected->id, 1, $attribs, $elementid, $check_perms = true);
// build version approval list
if ($params->get('allowdisablingcomments_fe')) {
// Set to zero if disabled or to "" (aka use default) for any other value. THIS WILL FORCE comment field use default Global/Category/Content Type setting or disable it,
// thus a per item commenting system cannot be selected. This is OK because it makes sense to have a different commenting system per CONTENT TYPE by not per Content Item
$isdisabled = !$params->get('comments') && strlen($params->get('comments'));
$fieldvalue = $isdisabled ? 0 : "";
$fieldname = 'jform[attribs][comments]';
$elementid = 'jform_attribs_comments';
/*
$options = array();
$options[] = JHTML::_('select.option', "", JText::_( 'FLEXI_DEFAULT_BEHAVIOR' ) );
$options[] = JHTML::_('select.option', 0, JText::_( 'FLEXI_DISABLE' ) );
$attribs = FLEXI_J16GE ? ' style ="float:none!important;" ' : '';
$lists['disable_comments'] = JHTML::_('select.radiolist', $options, $fieldname, $attribs, 'value', 'text', $fieldvalue, $elementid);
*/
$classes = !$prettycheckable_added ? '' : ' use_prettycheckable ';
$attribs = ' class="' . $classes . '" ';
$i = 1;
$options = array("" => JText::_('FLEXI_DEFAULT_BEHAVIOR'), 0 => JText::_('FLEXI_DISABLE'));
$lists['disable_comments'] = '';
foreach ($options as $option_id => $option_label) {
$checked = $option_id === $fieldvalue ? ' checked="checked"' : '';
$elementid_no = $elementid . '_' . $i;
if (!$prettycheckable_added) {
$lists['disable_comments'] .= '<label class="fccheckradio_lbl" for="' . $elementid_no . '">';
}
$extra_params = !$prettycheckable_added ? '' : ' data-labeltext="' . JText::_($option_label) . '" data-labelPosition="right" data-customClass="fcradiocheck"';
$lists['disable_comments'] .= ' <input type="radio" id="' . $elementid_no . '" data-element-grpid="' . $elementid . '" name="' . $fieldname . '" ' . $attribs . ' value="' . $option_id . '" ' . $checked . $extra_params . ' />';
if (!$prettycheckable_added) {
$lists['disable_comments'] .= ' ' . JText::_($option_label) . '</label>';
}
$i++;
}
}
// find user's allowed languages
$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed', null);
$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
if (!$isnew && $allowed_langs) {
$allowed_langs[] = $item->language;
}
// find globaly or per content type disabled languages
$disable_langs = $params->get('disable_languages_fe', array());
// Build languages list
if (FLEXI_J16GE || FLEXI_FISH) {
$item_lang = $item->language;
// Model has already set default language according to parameters
$langdisplay = $params->get('langdisplay_fe', 2);
$langconf = array();
$langconf['flags'] = $params->get('langdisplay_flags_fe', 1);
$langconf['texts'] = $params->get('langdisplay_texts_fe', 1);
$field_attribs = $langdisplay == 2 ? 'class="use_select2_lib"' : '';
$lists['languages'] = flexicontent_html::buildlanguageslist('jform[language]', $field_attribs, $item->language, $langdisplay, $allowed_langs, $published_only = 1, $disable_langs, $add_all = true, $langconf);
}
return $lists;
}
示例2: calculateItemMarkups
static function calculateItemMarkups($items, $params)
{
global $globalcats;
global $globalnoroute;
$globalnoroute = !is_array($globalnoroute) ? array() : $globalnoroute;
$db = JFactory::getDBO();
$user = JFactory::getUser();
$aids = JAccess::getAuthorisedViewLevels($user->id);
// **************************************
// Get configuration about markups to add
// **************************************
// Get addcss parameters
$mu_addcss_cats = $params->get('mu_addcss_cats', array('featured'));
$mu_addcss_cats = FLEXIUtilities::paramToArray($mu_addcss_cats);
$mu_addcss_acclvl = $params->get('mu_addcss_acclvl', array('needed_acc', 'obtained_acc'));
$mu_addcss_acclvl = FLEXIUtilities::paramToArray($mu_addcss_acclvl);
$mu_addcss_radded = $params->get('mu_addcss_radded', 0);
$mu_addcss_rupdated = $params->get('mu_addcss_rupdated', 0);
// Calculate addcss flags
$add_featured_cats = in_array('featured', $mu_addcss_cats);
$add_other_cats = in_array('other', $mu_addcss_cats);
$add_no_acc = in_array('no_acc', $mu_addcss_acclvl);
$add_free_acc = in_array('free_acc', $mu_addcss_acclvl);
$add_needed_acc = in_array('needed_acc', $mu_addcss_acclvl);
$add_obtained_acc = in_array('obtained_acc', $mu_addcss_acclvl);
// Get addtext parameters
$mu_addtext_cats = $params->get('mu_addtext_cats', 1);
$mu_addtext_acclvl = $params->get('mu_addtext_acclvl', array('no_acc', 'free_acc', 'needed_acc', 'obtained_acc'));
$mu_addtext_acclvl = FLEXIUtilities::paramToArray($mu_addtext_acclvl);
$mu_addtext_radded = $params->get('mu_addtext_radded', 1);
$mu_addtext_rupdated = $params->get('mu_addtext_rupdated', 1);
// Calculate addtext flags
$add_txt_no_acc = in_array('no_acc', $mu_addtext_acclvl);
$add_txt_free_acc = in_array('free_acc', $mu_addtext_acclvl);
$add_txt_needed_acc = in_array('needed_acc', $mu_addtext_acclvl);
$add_txt_obtained_acc = in_array('obtained_acc', $mu_addtext_acclvl);
$mu_add_condition_obtainded_acc = $params->get('mu_add_condition_obtainded_acc', 1);
$mu_no_acc_text = JText::_($params->get('mu_no_acc_text', 'FLEXI_MU_NO_ACC'));
$mu_free_acc_text = JText::_($params->get('mu_free_acc_text', 'FLEXI_MU_NO_ACC'));
// *******************************
// Prepare data needed for markups
// *******************************
// a. Get Featured categories and language filter their titles
$featured_cats_parent = $params->get('featured_cats_parent', 0);
$disabled_cats = $params->get('featured_cats_parent_disable', 1) ? array($featured_cats_parent) : array();
$featured_cats = array();
if ($add_featured_cats && $featured_cats_parent) {
$where[] = isset($globalcats[$featured_cats_parent]) ? 'id IN (' . $globalcats[$featured_cats_parent]->descendants . ')' : 'parent_id = ' . $featured_cats_parent;
if (!empty($disabled_cats)) {
$where[] = 'id NOT IN (' . implode(", ", $disabled_cats) . ')';
}
// optionally exclude category root of featured subtree
$query = 'SELECT c.id' . ' FROM #__categories AS c' . (count($where) ? ' WHERE ' . implode(' AND ', $where) : '');
$db->setQuery($query);
$featured_cats = $db->loadColumn();
$featured_cats = $featured_cats ? array_flip($featured_cats) : array();
foreach ($featured_cats as $featured_cat => $i) {
$featured_cats_titles[$featured_cat] = JText::_($globalcats[$featured_cat]->title);
}
}
// b. Get Access Level names (language filter them)
if ($add_needed_acc || $add_obtained_acc) {
if (FLEXI_J16GE) {
$db->setQuery('SELECT id, title FROM #__viewlevels');
$_arr = $db->loadObjectList();
$access_names = array(0 => 'Public');
// zero does not exist in J2.5+ but we set it for compatibility
foreach ($_arr as $o) {
$access_names[$o->id] = JText::_($o->title);
}
} else {
$access_names = array(0 => 'Public', 1 => 'Registered', 2 => 'Special', 3 => 'Privileged');
}
}
// c. Calculate creation time intervals
if ($mu_addcss_radded) {
$nowdate_secs = time();
$ra_timeframes = trim($params->get('mu_ra_timeframe_intervals', '24h,2d,7d,1m,3m,1y,3y'));
$ra_timeframes = preg_split("/\\s*,\\s*/u", $ra_timeframes);
$ra_names = trim($params->get('mu_ra_timeframe_names', 'FLEXI_24H_RA , FLEXI_2D_RA , FLEXI_7D_RA , FLEXI_1M_RA , FLEXI_3M_RA , FLEXI_1Y_RA , FLEXI_3Y_RA'));
$ra_names = preg_split("/\\s*,\\s*/u", $ra_names);
$unit_hour_map = array('h' => 1, 'd' => 24, 'm' => 24 * 30, 'y' => 24 * 365);
$unit_word_map = array('h' => 'hours', 'd' => 'days', 'm' => 'months', 'y' => 'years');
$unit_text_map = array('h' => 'FLEXI_MU_HOURS', 'd' => 'FLEXI_MU_DAYS', 'm' => 'FLEXI_MU_MONTHS', 'y' => 'FLEXI_MU_YEARS');
foreach ($ra_timeframes as $i => $timeframe) {
$unit = substr($timeframe, -1);
if (!isset($unit_hour_map[$unit])) {
echo "Improper timeframe ': " . $timeframe . "' for recently added content, please fix in configuration";
continue;
}
$timeframe = (int) $timeframe;
$ra_css_classes[$i] = '_item_added_within_' . $timeframe . $unit_word_map[$unit];
$ra_timeframe_secs[$i] = $timeframe * $unit_hour_map[$unit] * 3600;
$ra_timeframe_text[$i] = @$ra_names[$i] ? JText::_($ra_names[$i]) : JText::_('FLEXI_MU_ADDED') . JText::sprintf($unit_text_map[$unit], $timeframe);
}
}
// d. Calculate updated time intervals
if ($mu_addcss_rupdated) {
$nowdate_secs = time();
$ru_timeframes = trim($params->get('mu_ru_timeframe_intervals', '24h,2d,7d,1m,3m,1y,3y'));
//.........这里部分代码省略.........
示例3: display
//.........这里部分代码省略.........
if ($perms['multicat']) {
$class .= ' validate-catid';
} else {
$class .= ' required';
}
$attribs = 'class="' . $class . '"';
$fieldname = 'jform[catid]';
$enable_catid_selector = $isnew && !$tparams->get('catid_default') || !$isnew && empty($item->catid) || $perms['canchange_cat'];
if ($tparams->get('catid_allowed_parent')) {
$catid_tree = flexicontent_cats::getCategoriesTree($published_only = 1, $parent_id = $tparams->get('catid_allowed_parent'), $depth_limit = 0);
$disabled_cats = $tparams->get('catid_allowed_parent_disable', 1) ? array($tparams->get('catid_allowed_parent')) : array();
} else {
$catid_tree =& $categories;
$disabled_cats = array();
}
$lists['catid'] = false;
if (!empty($catid_tree)) {
$disabled = $enable_catid_selector ? '' : ' disabled="disabled"';
$attribs .= $disabled;
$lists['catid'] = ($enable_catid_selector ? '' : '<label class="label" style="float:none; margin:0 6px 0 0 !important;">locked</label>') . flexicontent_cats::buildcatselect($catid_tree, $fieldname, $item->catid, 2, $attribs, true, true, $actions_allowed, $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disabled_cats);
} else {
if (!$isnew && $item->catid) {
$lists['catid'] = $globalcats[$item->catid]->title;
}
}
//buid types selectlist
$class = 'required use_select2_lib';
$attribs = 'class="' . $class . '"';
$fieldname = 'jform[type_id]';
$elementid = 'jform_type_id';
$lists['type'] = flexicontent_html::buildtypesselect($types, $fieldname, $typesselected->id, 1, $attribs, $elementid, $check_perms = true);
//build languages list
$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed', null);
$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
if (!$isnew && $allowed_langs) {
$allowed_langs[] = $item->language;
}
// We will not use the default getInput() function of J1.6+ since we want to create a radio selection field with flags
// we could also create a new class and override getInput() method but maybe this is an overkill, we may do it in the future
$lists['languages'] = flexicontent_html::buildlanguageslist('jform[language]', 'class="use_select2_lib"', $item->language, 2, $allowed_langs);
// Label for current item state: published, unpublished, archived etc
switch ($item->state) {
case 0:
$published = JText::_('FLEXI_UNPUBLISHED');
break;
case 1:
$published = JText::_('FLEXI_PUBLISHED');
break;
case -1:
$published = JText::_('FLEXI_ARCHIVED');
break;
case -3:
$published = JText::_('FLEXI_PENDING');
break;
case -5:
$published = JText::_('FLEXI_IN_PROGRESS');
break;
case -4:
default:
$published = JText::_('FLEXI_TO_WRITE');
break;
}
// **************************************************************
// Handle Item Parameters Creation and Load their values for J1.5
// In J1.6+ we declare them in the item form XML file
// **************************************************************
示例4: getItems
//.........这里部分代码省略.........
// Single or Multi valued filter
if (isset($filter_values[0])) {
$in_values = array();
foreach ($filter_values as $val) {
$in_values[] = $db->Quote($val);
}
// Quote in case they are strings !!
$where_field_filters .= ' AND ' . $negate_op . ' (rel' . $filter_id . '.value IN (' . implode(',', $in_values) . ') ) ';
} else {
// Special case only one part of range provided ... must MATCH/INCLUDE empty values or NULL values ...
$value_empty = !strlen(@$filter_values[1]) && strlen(@$filter_values[2]) ? ' OR rel' . $filter_id . '.value="" OR rel' . $filter_id . '.value IS NULL ' : '';
if (strlen(@$filter_values[1]) || strlen(@$filter_values[2])) {
$where_field_filters .= ' AND ' . $negate_op . ' ( 1 ';
if (strlen(@$filter_values[1])) {
$where_field_filters .= ' AND (rel' . $filter_id . '.value >=' . $filter_values[1] . ') ';
}
if (strlen(@$filter_values[2])) {
$where_field_filters .= ' AND (rel' . $filter_id . '.value <=' . $filter_values[2] . $value_empty . ') ';
}
$where_field_filters .= ' )';
}
}
$join_field_filters .= ' JOIN #__flexicontent_fields_item_relations AS rel' . $filter_id . ' ON rel' . $filter_id . '.item_id=i.id AND rel' . $filter_id . '.field_id = ' . $filter_id;
}
}
}
if ($behaviour_filt == 1 || $behaviour_filt == 2) {
if (!$isflexi_itemview) {
return;
// current view is not item view ... , nothing to display
}
// 1. Get ids of dynamic filters
//$dynamic_filter_ids = preg_split("/[\s]*,[\s]*/", $dynamic_filters);
$dynamic_filter_ids = FLEXIUtilities::paramToArray($dynamic_filters, "/[\\s]*,[\\s]*/", "intval");
if (empty($dynamic_filter_ids)) {
echo "Please enter at least 1 field in Custom field filtering SCOPE, or set behaviour to static";
} else {
// 2. Get values of dynamic filters
$where2 = count($dynamic_filter_ids) > 1 ? ' AND field_id IN (' . implode(',', $dynamic_filter_ids) . ')' : ' AND field_id = ' . $dynamic_filter_ids[0];
// select the item ids related to current item via the relation fields
$query2 = 'SELECT DISTINCT value, field_id' . ' FROM #__flexicontent_fields_item_relations' . ' WHERE item_id = ' . (int) $id . $where2;
$db->setQuery($query2);
$curritem_vals = $db->loadObjectList();
//echo "<pre>"; print_r($curritem_vals); echo "</pre>";
// 3. Group values by field
$_vals = array();
foreach ($curritem_vals as $v) {
$_vals[$v->field_id][] = $v->value;
}
foreach ($dynamic_filter_ids as $filter_id) {
// Handle non-existent value by requiring that matching item do not have a value for this field either
if (!isset($_vals[$filter_id])) {
$where_field_filters .= ' AND reldyn' . $filter_id . '.value IS NULL';
} else {
$in_values = array();
foreach ($_vals[$filter_id] as $v) {
$in_values[] = $db->Quote($v);
}
$where_field_filters .= ' AND reldyn' . $filter_id . '.value IN (' . implode(',', $in_values) . ') ' . "\n";
}
$join_field_filters .= ' JOIN #__flexicontent_fields_item_relations AS reldyn' . $filter_id . ' ON reldyn' . $filter_id . '.item_id=i.id AND reldyn' . $filter_id . '.field_id = ' . $filter_id . "\n";
}
//echo "<pre>"."\n\n".$join_field_filters ."\n\n".$where_field_filters."</pre>";
}
}
if (empty($items_query)) {
示例5: onDisplayFieldValue
//.........这里部分代码省略.........
if (!$use_html) {
$value = nl2br(preg_replace("/(\r\n|\r|\n){3,}/", "\n\n", $value));
}
}
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;
default:
$separatorf = ' ';
break;
}
// Create field's HTML
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (!strlen($value) && !$is_ingroup) {
continue;
}
// Skip empty if not in field group
if (!strlen($value)) {
$field->{$prop}[$n++] = '';
continue;
}
// Add prefix / suffix
$field->{$prop}[$n] = $pretext . $value . $posttext;
$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
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
}
// ************
// Add OGP tags
// ************
if ($field->parameters->get('useogp', 0) && !empty($field->{$prop})) {
// Get ogp configuration
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
if (in_array($view, $ogpinview)) {
switch ($ogpusage) {
case 1:
$usagetype = 'title';
break;
case 2:
$usagetype = 'description';
break;
default:
$usagetype = '';
break;
}
if ($usagetype) {
$content_val = !$is_ingroup ? flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen) : flexicontent_html::striptagsandcut($opentag . implode($separatorf, $field->{$prop}) . $closetag, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:' . $usagetype . '" content="' . $content_val . '" />');
}
}
}
}
示例6: display
//.........这里部分代码省略.........
$_dataCol_wrongSize = false;
}*/
if ($_dataCol_wrongSize) {
$app->enqueueMessage("Joomla DB table: <b>'session'</b> has a <b>'data'</b> column with type: <b>'" . $_dataColType . "'</b>, instead of expected type <b>'mediumtext'</b>. Trying to import large data files may fail", "notice");
}
$formvals = array();
// Retrieve Basic configuration
$formvals['type_id'] = $model->getState('type_id');
$formvals['language'] = $model->getState('language');
$formvals['state'] = $model->getState('state');
$formvals['access'] = $model->getState('access');
// Main and secondary categories, tags
$formvals['maincat'] = $model->getState('maincat');
$formvals['maincat_col'] = $model->getState('maincat_col');
$formvals['seccats'] = $model->getState('seccats');
$formvals['seccats_col'] = $model->getState('seccats_col');
$formvals['tags_col'] = $model->getState('tags_col');
// Publication: Author/modifier
$formvals['created_by_col'] = $model->getState('created_by_col');
$formvals['modified_by_col'] = $model->getState('modified_by_col');
// Publication: META data
$formvals['metadesc_col'] = $model->getState('metadesc_col');
$formvals['metakey_col'] = $model->getState('metakey_col');
// Publication: dates
$formvals['modified_col'] = $model->getState('modified_col');
$formvals['created_col'] = $model->getState('modified_col');
$formvals['publish_up_col'] = $model->getState('publish_up_col');
$formvals['publish_down_col'] = $model->getState('publish_down_col');
// Advanced configuration
$formvals['ignore_unused_cols'] = $model->getState('ignore_unused_cols');
$formvals['id_col'] = $model->getState('id_col');
$formvals['items_per_step'] = $model->getState('items_per_step');
// CSV file format
$formvals['mval_separator'] = $model->getState('mval_separator');
$formvals['mprop_separator'] = $model->getState('mprop_separator');
$formvals['field_separator'] = $model->getState('field_separator');
$formvals['enclosure_char'] = $model->getState('enclosure_char');
$formvals['record_separator'] = $model->getState('record_separator');
$formvals['debug_records'] = $model->getState('debug_records');
// ******************
// Create form fields
// ******************
$lists['type_id'] = flexicontent_html::buildtypesselect($types, 'type_id', $formvals['type_id'], true, 'class="required use_select2_lib"', 'type_id');
$actions_allowed = array('core.create');
// Creating categorories tree for item assignment, we use the 'create' privelege
// build the main category select list
$attribs = 'class="use_select2_lib required"';
$fieldname = 'maincat';
$lists['maincat'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['maincat'], 2, $attribs, false, true, $actions_allowed);
// build the secondary categories select list
$class = "use_select2_lib";
$attribs = 'multiple="multiple" size="10" class="' . $class . '"';
$fieldname = 'seccats[]';
$lists['seccats'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['seccats'], false, $attribs, false, true, $actions_allowed, $require_all = true);
// build languages list
// Retrieve author configuration
$authorparams = flexicontent_db::getUserConfig($user->id);
$allowed_langs = $authorparams->get('langs_allowed', null);
$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
// We will not use the default getInput() function of J1.6+ since we want to create a radio selection field with flags
// we could also create a new class and override getInput() method but maybe this is an overkill, we may do it in the future
$lists['languages'] = flexicontent_html::buildlanguageslist('language', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_langcol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['language'], 6, $allowed_langs, $published_only = true, $disable_langs = null, $add_all = true, $conf = array('required' => true)) . '
<span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_langcol" style="display:none;">
' . JText::_('FLEXI_USE_LANGUAGE_COLUMN_TIP') . '
</span>';
$lists['states'] = flexicontent_html::buildstateslist('state', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_statecol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['state'], 2) . '<span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_statecol" style="display:none;">
' . JText::_('FLEXI_USE_STATE_COLUMN_TIP') . '
</span>';
// build access level filter
$access_levels = JHtml::_('access.assetgroups');
array_unshift($access_levels, JHtml::_('select.option', '0', "Use 'access' column"));
array_unshift($access_levels, JHtml::_('select.option', '', 'FLEXI_SELECT_ACCESS_LEVEL'));
$fieldname = 'access';
// make multivalue
$elementid = 'access';
$attribs = 'class="required use_select2_lib"';
$lists['access'] = JHTML::_('select.genericlist', $access_levels, $fieldname, $attribs, 'value', 'text', $formvals['access'], $elementid, $translate = true);
// Ignore warnings because component may not be installed
$warnHandlers = JERROR::getErrorHandling(E_WARNING);
JERROR::setErrorHandling(E_WARNING, 'ignore');
// Reset the warning handler(s)
foreach ($warnHandlers as $mode) {
JERROR::setErrorHandling(E_WARNING, $mode);
}
// ********************************************************************************
// Get field names (from the header line (row 0), and remove it form the data array
// ********************************************************************************
$file_field_types_list = '"image","file"';
$q = 'SELECT id, name, label, field_type FROM #__flexicontent_fields AS fi' . ' WHERE fi.field_type IN (' . $file_field_types_list . ')';
$db->setQuery($q);
$file_fields = $db->loadObjectList('name');
//assign data to template
$this->assignRef('model', $model);
$this->assignRef('lists', $lists);
$this->assignRef('user', $user);
$this->assignRef('cparams', $cparams);
$this->assignRef('file_fields', $file_fields);
$this->assignRef('formvals', $formvals);
parent::display($tpl);
}
示例7: display
//.........这里部分代码省略.........
// Main category form field
$class = 'scat use_select2_lib';
if ($perms['multicat']) {
$class .= ' validate-catid';
} else {
$class .= ' required';
}
$attribs = 'class="' . $class . '"';
$fieldname = FLEXI_J16GE ? 'jform[catid]' : 'catid';
$enable_catid_selector = $isnew && !$tparams->get('catid_default') || !$isnew && empty($item->catid) || $perms['canchange_cat'];
if ($tparams->get('catid_allowed_parent')) {
$catid_tree = flexicontent_cats::getCategoriesTree($published_only = 1, $parent_id = $tparams->get('catid_allowed_parent'), $depth_limit = 0);
} else {
$catid_tree =& $categories;
}
$lists['catid'] = false;
if (!empty($catid_tree)) {
$disabled = $enable_catid_selector ? '' : ' disabled="disabled"';
$attribs .= $disabled;
$lists['catid'] = ($enable_catid_selector ? '' : '<label class="label" style="float:none; margin:0 6px 0 0 !important;">locked</label>') . flexicontent_cats::buildcatselect($catid_tree, $fieldname, $item->catid, 2, $attribs, true, true, $actions_allowed);
} else {
if (!$isnew && $item->catid) {
$lists['catid'] = $globalcats[$item->catid]->title;
}
}
//buid types selectlist
$class = 'required use_select2_lib';
$attribs = 'class="' . $class . '"';
$fieldname = FLEXI_J16GE ? 'jform[type_id]' : 'type_id';
$elementid = FLEXI_J16GE ? 'jform_type_id' : 'type_id';
$lists['type'] = flexicontent_html::buildtypesselect($types, $fieldname, $typesselected->id, 1, $attribs, $elementid, $check_perms = true);
//build languages list
$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed', null);
$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
if (!$isnew && $allowed_langs) {
$allowed_langs[] = $item->language;
}
// We will not use the default getInput() function of J1.6+ since we want to create a radio selection field with flags
// we could also create a new class and override getInput() method but maybe this is an overkill, we may do it in the future
$language_fieldname = FLEXI_J16GE ? 'jform[language]' : 'language';
if (FLEXI_FISH || FLEXI_J16GE) {
$lists['languages'] = flexicontent_html::buildlanguageslist($language_fieldname, '', $item->language, 3, $allowed_langs);
}
// Label for current item state: published, unpublished, archived etc
switch ($item->state) {
case 0:
$published = JText::_('FLEXI_UNPUBLISHED');
break;
case 1:
$published = JText::_('FLEXI_PUBLISHED');
break;
case -1:
$published = JText::_('FLEXI_ARCHIVED');
break;
case -3:
$published = JText::_('FLEXI_PENDING');
break;
case -5:
$published = JText::_('FLEXI_IN_PROGRESS');
break;
case -4:
default:
$published = JText::_('FLEXI_TO_WRITE');
break;
}
// **************************************************************
示例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);
// 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.'" />');
}
}
}
//view
if ( !$field->{$prop} ) {
} else {
$tmp_val = unserialize($field->{$prop});
//var_dump($tmp_val);
$header_html = '<table class="flexitable">'
.'<thead>'
.'<tr>'
.'<th style="font-size:80%;">'.JText::_("Страна").'</th>'
.'<th style="font-size:80%;">'.JText::_("Наименование").'</th>'
.'<th style="font-size:80%;">'.JText::_("Форма выпуска").'</th>'
.'<th style="font-size:80%;">'.JText::_("Регистрационный №").'</th>'
.'<th style="font-size:80%;">'.JText::_("Дата окончания регистрации").'</th>'
.'</tr>'
.'</thead>'
.'<tbody>';
for($intA = 0; $intA < count($tmp_val['country']); $intA++){
$header_html .= '<tr>';
$header_html .= '<td>' . $tmp_val['country'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['naimen'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['vypusk'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['reg'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['date'][$intA] . '</td>';
$header_html .= '<tr>';
}
$header_html .= '</tbody>';
$header_html .= '</table>';
$field->{$prop} = $header_html;
//var_dump($field->{$prop});
//var_dump($field->value[0]);
}
}
示例9: sendNotificationEmails
function sendNotificationEmails(&$notify_vars, &$params, $manual_approval_request = 0)
{
$needs_version_reviewal = $notify_vars->needs_version_reviewal;
$needs_publication_approval = $notify_vars->needs_publication_approval;
$isnew = $notify_vars->isnew;
$notify_emails = $notify_vars->notify_emails;
$notify_text = $notify_vars->notify_text;
$before_cats = $notify_vars->before_cats;
$after_cats = $notify_vars->after_cats;
$oitem = $notify_vars->original_item;
if (!count($notify_emails)) {
return true;
}
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$use_versioning = $this->_cparams->get('use_versioning', 1);
// Get category titles of categories add / removed from the item
if (!$isnew) {
$cats_added_ids = array_diff(array_keys($after_cats), array_keys($before_cats));
foreach ($cats_added_ids as $cats_added_id) {
$cats_added_titles[] = $after_cats[$cats_added_id]->title;
}
$cats_removed_ids = array_diff(array_keys($before_cats), array_keys($after_cats));
foreach ($cats_removed_ids as $cats_removed_id) {
$cats_removed_titles[] = $before_cats[$cats_removed_id]->title;
}
$cats_altered = count($cats_added_ids) + count($cats_removed_ids);
$after_maincat = $this->get('catid');
}
// Get category titles in the case of new item or categories unchanged
if ($isnew || !$cats_altered) {
foreach ($after_cats as $after_cat) {
$cats_titles[] = $after_cat->title;
}
}
// **************
// CREATE SUBJECT
// **************
$srvname = preg_replace('#www\\.#', '', $_SERVER['SERVER_NAME']);
$url = parse_url($srvname);
$domain = !empty($url["host"]) ? $url["host"] : $url["path"];
$subject = '[' . $domain . '] - ';
if (!$manual_approval_request) {
// (a) ADD INFO of being new or updated
$subject .= JText::_($isnew ? 'FLEXI_NF_NEW_CONTENT_SUBMITTED' : 'FLEXI_NF_EXISTING_CONTENT_UPDATED') . " ";
// (b) ADD INFO about editor's name and username (or being guest)
$subject .= !$user->id ? JText::sprintf('FLEXI_NF_BY_GUEST') : JText::sprintf('FLEXI_NF_BY_USER', $user->get('name'), $user->get('username'));
// (c) (new items) ADD INFO for content needing publication approval
if ($isnew) {
$subject .= ": ";
$subject .= JText::_($needs_publication_approval ? 'FLEXI_NF_NEEDS_PUBLICATION_APPROVAL' : 'FLEXI_NF_NO_APPROVAL_NEEDED');
}
// (d) (existing items with versioning) ADD INFO for content needing version reviewal
if (!$isnew && $use_versioning) {
$subject .= ": ";
$subject .= JText::_($needs_version_reviewal ? 'FLEXI_NF_NEEDS_VERSION_REVIEWAL' : 'FLEXI_NF_NO_REVIEWAL_NEEDED');
}
} else {
$subject .= JText::_('FLEXI_APPROVAL_REQUEST');
}
// *******************
// CREATE MESSAGE BODY
// *******************
$nf_extra_properties = $params->get('nf_extra_properties', array('creator', 'modifier', 'created', 'modified', 'viewlink', 'editlinkfe', 'editlinkbe', 'introtext', 'fulltext'));
$nf_extra_properties = FLEXIUtilities::paramToArray($nf_extra_properties);
// ADD INFO for item title
$body = '<u>' . JText::_('FLEXI_NF_CONTENT_TITLE') . "</u>: ";
if (!$isnew) {
$_changed = $oitem->title != $this->get('title');
$body .= " [ " . JText::_($_changed ? 'FLEXI_NF_MODIFIED' : 'FLEXI_NF_UNCHANGED') . " ] : <br/>\r\n";
$body .= !$_changed ? "" : $oitem->title . " ==> ";
}
$body .= $this->get('title') . "<br/>\r\n<br/>\r\n";
// ADD INFO about state
$state_names = array(1 => 'FLEXI_PUBLISHED', -5 => 'FLEXI_IN_PROGRESS', 0 => 'FLEXI_UNPUBLISHED', -3 => 'FLEXI_PENDING', -4 => 'FLEXI_TO_WRITE', FLEXI_J16GE ? 2 : -1 => 'FLEXI_ARCHIVED', -2 => 'FLEXI_TRASHED');
$body .= '<u>' . JText::_('FLEXI_NF_CONTENT_STATE') . "</u>: ";
if (!$isnew) {
$_changed = $oitem->state != $this->get('state');
$body .= " [ " . JText::_($_changed ? 'FLEXI_NF_MODIFIED' : 'FLEXI_NF_UNCHANGED') . " ] : <br/>\r\n";
$body .= !$_changed ? "" : JText::_($state_names[$oitem->state]) . " ==> ";
}
$body .= JText::_($state_names[$this->get('state')]) . "<br/><br/>\r\n";
// ADD INFO for author / modifier
if (in_array('creator', $nf_extra_properties)) {
$body .= '<u>' . JText::_('FLEXI_NF_CREATOR_LONG') . "</u>: ";
if (!$isnew) {
$_changed = $oitem->created_by != $this->get('created_by');
$body .= " [ " . JText::_($_changed ? 'FLEXI_NF_MODIFIED' : 'FLEXI_NF_UNCHANGED') . " ] : <br/>\r\n";
$body .= !$_changed ? "" : $oitem->creator . " ==> ";
}
$body .= $this->get('creator') . "<br/>\r\n";
}
if (in_array('modifier', $nf_extra_properties) && !$isnew) {
$body .= '<u>' . JText::_('FLEXI_NF_MODIFIER_LONG') . "</u>: ";
$body .= $this->get('modifier') . "<br/>\r\n";
}
$body .= "<br/>\r\n";
// ADD INFO about creation / modification times. Use site's timezone !! we must
// (a) set timezone to be site's timezone then
//.........这里部分代码省略.........
示例10: onDisplayFieldValue
//.........这里部分代码省略.........
$multiple_image_usages = true;
$extra_prefix = 'fld' . $field->id . '_';
$field->using_default_value = true;
}
}
// Check for no values, and return empty display, otherwise assign (possibly) altered value array to back to the field
if (!count($values)) {
$field->{$prop} = '';
return;
}
$field->value = $values;
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$option = JRequest::getVar('option');
jimport('joomla.filesystem');
$isFeedView = JRequest::getCmd('format', null) == 'feed';
$isItemsManager = $app->isAdmin() && $view == 'items' && $option == 'com_flexicontent';
$isSite = $app->isSite();
// some parameter shortcuts
$uselegend = $field->parameters->get('uselegend', 1);
$usepopup = $field->parameters->get('usepopup', 1);
$popuptype = $field->parameters->get('popuptype', 1);
$popuptype_mobile = $field->parameters->get('popuptype_mobile', $popuptype);
// this defaults to desktop when empty
$popuptype = $useMobile ? $popuptype_mobile : $popuptype;
$grouptype = $field->parameters->get('grouptype', 1);
$grouptype = $multiple ? 0 : $grouptype;
// Field in gallery mode: Force grouping of images per field (current item)
// Needed by some js galleries
$thumb_w_s = $field->parameters->get('w_s', 120);
$thumb_h_s = $field->parameters->get('h_s', 90);
// Check and disable 'uselegend'
$legendinview = $field->parameters->get('legendinview', array(FLEXI_ITEMVIEW, 'category'));
$legendinview = FLEXIUtilities::paramToArray($legendinview);
if ($view == FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW, $legendinview)) {
$uselegend = 0;
}
if ($view == 'category' && !in_array('category', $legendinview)) {
$uselegend = 0;
}
if ($isItemsManager && !in_array('backend', $legendinview)) {
$uselegend = 0;
}
// Check and disable 'usepopup'
$popupinview = $field->parameters->get('popupinview', array(FLEXI_ITEMVIEW, 'category', 'backend'));
$popupinview = FLEXIUtilities::paramToArray($popupinview);
if ($view == FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW, $popupinview)) {
$usepopup = 0;
}
if ($view == 'category' && !in_array('category', $popupinview)) {
$usepopup = 0;
}
if ($view == 'module' && !in_array('module', $popupinview)) {
$usepopup = 0;
}
if ($isItemsManager && !in_array('backend', $popupinview)) {
$usepopup = 0;
}
// FORCE multibox popup in backend ...
if ($isItemsManager) {
$popuptype = 1;
}
// remaining parameters shortcuts
$showtitle = $field->parameters->get('showtitle', 0);
$showdesc = $field->parameters->get('showdesc', 0);
$linkto_url = $field->parameters->get('linkto_url', 0);
示例11: array
$template = $app->getTemplate();
$btn_class = FLEXI_J30GE ? 'btn' : 'fc_button';
$tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip';
$edit_item_txt = JText::_('FLEXI_EDIT_ITEM');
// hide dashboard buttons
$dashboard_buttons_hide = $this->params->get('dashboard_buttons_hide', array());
$dashboard_buttons_hide = FLEXIUtilities::paramToArray($dashboard_buttons_hide);
$sbtns = array_flip($dashboard_buttons_hide);
$skip_content_fieldset = isset($sbtns['items']) && isset($sbtns['additem']) && isset($sbtns['cats']) && isset($sbtns['addcat']) && isset($sbtns['comments']);
$skip_types_fieldset = isset($sbtns['types']) && isset($sbtns['addtype']) && isset($sbtns['fields']) && isset($sbtns['addfield']) && isset($sbtns['tags']) && isset($sbtns['addtag']) && isset($sbtns['files']);
$skip_contentviewing_fieldset = isset($sbtns['templates']) && isset($sbtns['index']) && isset($sbtns['stats']);
$skip_users_fieldset = isset($sbtns['users']) && isset($sbtns['adduser']) && isset($sbtns['groups']) && isset($sbtns['addgroup']);
$skip_expert_fieldset = isset($sbtns['import']) && isset($sbtns['plgfields']) && isset($sbtns['plgsystem']) && isset($sbtns['plgflexicontent']);
// disable dashboard sliders
$dashboard_sliders_disable = $this->params->get('dashboard_sliders_disable', array());
$dashboard_sliders_disable = FLEXIUtilities::paramToArray($dashboard_sliders_disable);
// Other options
$modal_item_edit = $this->params->get('dashboard_modal_item_edit', 1);
$onclick_modal_edit = $modal_item_edit ? 'onclick="var url = jQuery(this).attr(\'href\'); fc_showDialog(url, \'fc_modal_popup_container\'); return false;"' : '';
$disable_fc_logo = $this->params->get('dashboard_disable_fc_logo', 0);
$hide_fc_license_credits = $this->params->get('dashboard_hide_fc_license_credits', 1);
/* hide inside sliders */
// Get/Check PHP requiremenets
$php_lims = flexicontent_html::checkPHPLimits();
$ssliders = array_flip($dashboard_sliders_disable);
$skip_sliders = isset($sbtns['pending']) && isset($sbtns['revised']) && isset($sbtns['inprogress']) && isset($sbtns['draft']) && isset($sbtns['version']);
$skip_sliders = $skip_sliders && $this->dopostinstall && $this->allplgpublish && !$hide_fc_license_credits && !isset($php_lims['warning']);
// ensures the PHP version is correct
if (version_compare(PHP_VERSION, FLEXI_PHP_NEEDED, '<')) {
echo '<div class="fc-mssg fc-error">';
echo JText::sprintf('FLEXI_UPGRADE_PHP_VERSION_GE', FLEXI_PHP_NEEDED) . '<br/>';
示例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);
// 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.'" />');
}
}
}
}
示例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;
}
$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 = '';
//.........这里部分代码省略.........
示例14: onDisplayCoreFieldValue
//.........这里部分代码省略.........
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;
$dateformat = $field->parameters->get('date_format', '');
$customdate = $field->parameters->get('custom_date', '');
$dateformat = $dateformat ? $dateformat : $customdate;
$field->display = $pretext . JHTML::_('date', $item->modified, JText::_($dateformat)) . $posttext;
break;
case 'modifiedby':
// modified by
$field->value[] = $item->modified_by;
$field->display = $pretext . ($field->parameters->get('name_username', 1) == 2 ? $item->muname : $item->modifier) . $posttext;
break;
case 'title':
// title
$field->value[] = $item->title;
$field->display = $pretext . $item->title . $posttext;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 1);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
if ($useogp && $field->{$prop}) {
if (in_array($view, $ogpinview)) {
$content_val = flexicontent_html::striptagsandcut($field->display, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:title" content="' . $content_val . '" />');
}
}
break;
case 'hits':
// hits
$field->value[] = $item->hits;
$field->display = $pretext . $item->hits . $posttext;
break;
case 'type':
// document type
$field->value[] = $item->type_id;
$field->display = $pretext . JText::_($item->typename) . $posttext;
break;
case 'version':
// version
$field->value[] = $item->version;
$field->display = $pretext . $item->version . $posttext;
break;
case 'state':
// state
$field->value[] = $item->state;
$field->display = $pretext . flexicontent_html::stateicon($item->state, $field->parameters) . $posttext;
break;
case 'voting':
// voting button
if ($_vote === false) {
$vote =& $item->vote;
示例15: onDisplayFieldValue
//.........这里部分代码省略.........
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');
// 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;
}
// Get layout name
$viewlayout = $field->parameters->get('viewlayout', '');
$viewlayout = $viewlayout ? 'value_' . $viewlayout : 'value_default';
// Create field's HTML, using layout file
$field->{$prop} = array();
//$this->values = $values;
//$this->displayFieldValue( $prop, $viewlayout );
include self::getFormPath($this->fieldtypes[0], $viewlayout);
// Do not convert the array to string if field is in a group, and do not add: FIELD's opetag, closetag, value separator
if (!$is_ingroup) {
// Apply values separator
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
// Apply field 's opening / closing texts
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
// Add microdata once for all values, if field -- is NOT -- in a field group
if ($itemprop) {
$field->{$prop} = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop} . '</div>';
}
}
}
// ************
// Add OGP tags
// ************
if ($field->parameters->get('useogp', 0) && !empty($field->{$prop})) {
// Get ogp configuration
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
if (in_array($view, $ogpinview)) {
switch ($ogpusage) {
case 1:
$usagetype = 'title';
break;
case 2:
$usagetype = 'description';
break;
default:
$usagetype = '';
break;
}
if ($usagetype) {
$content_val = !$is_ingroup ? flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen) : flexicontent_html::striptagsandcut($opentag . implode($separatorf, $field->{$prop}) . $closetag, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:' . $usagetype . '" content="' . $content_val . '" />');
}
}
}
}