本文整理汇总了PHP中FLEXIUtilities::getLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::getLanguages方法的具体用法?PHP FLEXIUtilities::getLanguages怎么用?PHP FLEXIUtilities::getLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::getLanguages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onDisplayFieldValue
public 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 $all_langs = null;
$props_type = $field->parameters->get('props_type');
if ($props_type == '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;
}
}
示例2: onDisplayFieldValue
public function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
static $all_langs = null;
$props_type = $field->parameters->get('props_type');
if ($props_type == '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;
} else {
if ($props_type == 'alias') {
$field->{$prop} = $item->{$props_type};
} else {
$field->{$prop} = $props_type;
}
}
}
示例3: display
function display($tpl = null)
{
global $globalcats;
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
//initialise variables
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$template = $app->isSite() ? !FLEXI_J16GE ? 'khepri' : (FLEXI_J30GE ? 'hathor' : 'bluestork') : $app->getTemplate();
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//get var
$filter_order = $app->getUserStateFromRequest($option . '.itemelement.filter_order', 'filter_order', 'i.ordering', 'cmd');
$filter_order_Dir = $app->getUserStateFromRequest($option . '.itemelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_state = $app->getUserStateFromRequest($option . '.itemelement.filter_state', 'filter_state', '*', 'word');
$filter_cats = $app->getUserStateFromRequest($option . '.itemelement.filter_cats', 'filter_cats', 0, 'int');
$filter_type = $app->getUserStateFromRequest($option . '.itemelement.filter_type', 'filter_type', 0, 'int');
if (FLEXI_FISH || FLEXI_J16GE) {
$filter_lang = $app->getUserStateFromRequest($option . '.itemelement.filter_lang', 'filter_lang', '', 'cmd');
}
$search = $app->getUserStateFromRequest($option . '.itemelement.search', 'search', '', 'string');
$search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search)));
//prepare the document
$document->setTitle(JText::_('FLEXI_SELECTITEM'));
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
$document->addStyleSheet(JURI::root() . 'administrator/templates/' . $template . (FLEXI_J16GE ? '/css/template.css' : '/css/general.css'));
//Get data from the model
$rows = $this->get('Data');
$types = $this->get('Typeslist');
$pageNav = $this->get('Pagination');
if (FLEXI_FISH || FLEXI_J16GE) {
$langs = FLEXIUtilities::getLanguages('code');
}
// build the categories select list for filter
$categories = $globalcats;
$lists['filter_cats'] = flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, 2, 'class="inputbox" size="1" onchange="submitform( );"', $actions_allowed = array('core.create'), true);
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$ordering = $lists['order'] == 'i.ordering';
//build type select list
$lists['filter_type'] = flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, true, 'class="inputbox" size="1" onchange="submitform( );"', 'filter_type');
// search filter
$lists['search'] = $search;
$state[] = JHTML::_('select.option', '', JText::_('FLEXI_SELECT_STATE'));
$state[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED'));
$state[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED'));
$state[] = JHTML::_('select.option', 'PE', JText::_('FLEXI_PENDING'));
$state[] = JHTML::_('select.option', 'OQ', JText::_('FLEXI_TO_WRITE'));
$state[] = JHTML::_('select.option', 'IP', JText::_('FLEXI_IN_PROGRESS'));
$state[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ARCHIVED'));
$lists['state'] = JHTML::_('select.genericlist', $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state);
if (FLEXI_FISH || FLEXI_J16GE) {
//build languages filter
$lists['filter_lang'] = flexicontent_html::buildlanguageslist('filter_lang', 'class="inputbox" onchange="submitform();"', $filter_lang, 2);
}
//assign data to template
if (FLEXI_FISH || FLEXI_J16GE) {
$this->assignRef('langs', $langs);
}
$this->assignRef('lists', $lists);
$this->assignRef('rows', $rows);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('ordering', $ordering);
$this->assignRef('filter_cats', $filter_cats);
parent::display($tpl);
}
示例4: loadFramework
/**
* Utility function to load each JS Frameworks once
*
* @param string $text
* @param int $nb
* @return string
* @since 1.5
*/
static function loadFramework($framework, $mode = '')
{
// Detect already loaded framework
static $_loaded = array();
if (isset($_loaded[$framework])) {
return $_loaded[$framework];
}
$_loaded[$framework] = false;
// Get frameworks that are configured to be loaded manually in frontend (e.g. via the Joomla template)
$app = JFactory::getApplication();
static $load_frameworks = null;
static $load_jquery = null;
if (!isset($load_frameworks[$framework])) {
$flexiparams = JComponentHelper::getParams('com_flexicontent');
//$load_frameworks = $flexiparams->get('load_frameworks', array('jQuery','image-picker','masonry','select2','inputmask','prettyCheckable','fancybox'));
//$load_frameworks = FLEXIUtilities::paramToArray($load_frameworks);
//$load_frameworks = array_flip($load_frameworks);
//$load_jquery = isset($load_frameworks['jQuery']) || !$app->isSite();
if ($load_jquery === null) {
$load_jquery = $flexiparams->get('loadfw_jquery', 1) == 1 || !$app->isSite();
}
$load_framework = $flexiparams->get('loadfw_' . strtolower(str_replace('-', '_', $framework)), 1);
$load_frameworks[$framework] = $load_framework == 1 || $load_framework == 2 && !$app->isSite();
}
// Set loaded flag
$_loaded[$framework] = $load_frameworks[$framework];
// Do not progress further if it is disabled
if (!$load_frameworks[$framework]) {
return false;
}
// Load Framework
$document = JFactory::getDocument();
$lib_path = '/components/com_flexicontent/librairies';
$js = "";
$css = "";
switch ($framework) {
case 'jQuery':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
break;
case 'mCSB':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/mCSB';
$document->addScript($framework_path . '/jquery.mCustomScrollbar.min.js');
$document->addStyleSheet($framework_path . '/jquery.mCustomScrollbar.css');
$js .= "\n\t\t\t\t\tjQuery(document).ready(function(){\n\t\t\t\t\t\tjQuery('.fc_add_scroller').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('.fc_add_scroller_horizontal').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\thorizontalScroll:true,\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t";
break;
case 'image-picker':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/image-picker';
$document->addScript($framework_path . '/image-picker.min.js');
$document->addStyleSheet($framework_path . '/image-picker.css');
break;
case 'masonry':
$framework_path = JURI::root(true) . $lib_path . '/masonry';
$document->addScript($framework_path . '/masonry.pkgd.min.js');
break;
case 'select2':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/select2';
$framework_folder = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'select2';
$document->addScript($framework_path . '/select2.min.js');
$document->addStyleSheet($framework_path . '/select2.css');
$user_lang = flexicontent_html::getUserCurrentLang();
if ($user_lang && $user_lang != 'en') {
// Try language shortcode
if (file_exists($framework_folder . DS . 'select2_locale_' . $user_lang . '.js')) {
$document->addScript($framework_path . '/select2_locale_' . $user_lang . '.js');
} else {
$languages = FLEXIUtilities::getLanguages($hash = 'shortcode');
$lang_code = isset($languages->{$user_lang}->code) ? $languages->{$user_lang}->code : false;
if ($lang_code && file_exists($framework_folder . DS . 'select2_locale_' . $lang_code . '.js')) {
$document->addScript($framework_path . '/select2_locale_' . $lang_code . '.js');
}
}
}
$js .= "\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').select2({\n\t\t\t\t\t\t\t/*hideSelectionFromResult: function(selectedObject) { selectedObject.removeClass('select2-result-selectable').addClass('select2-result-unselectable').addClass('select2-disabled'); return false; },*/\n\t\t\t\t\t\t\tminimumResultsForSearch: 10\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('div.use_select2_lib').each(function() {\n\t\t\t\t\t\t\tvar el_container = jQuery(this);\n\t\t\t\t\t\t\tvar el_select = el_container.next('select');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_label_text = el_select.attr('data-fc_label_text');\n\t\t\t\t\t\t\tif (!fc_label_text) fc_label_text = el_select.attr('fc_label_text');\n\t\t\t\t\t\t\tif (fc_label_text) {\n\t\t\t\t\t\t\t\tvar _label = (fc_label_text.length >= 30) ? fc_label_text.substring(0, 28) + '...' : fc_label_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_label fc_has_inner_label_select2',\n\t\t\t\t\t\t\t\t\t'text': _label\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field'));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_prompt_text = el_select.attr('data-fc_prompt_text');\n\t\t\t\t\t\t\tif (!fc_prompt_text) fc_prompt_text = el_select.attr('fc_prompt_text');\n\t\t\t\t\t\t\tif (fc_prompt_text) {\n\t\t\t\t\t\t\t\tvar _prompt = (fc_prompt_text.length >= 30) ? fc_prompt_text.substring(0, 28) + '...' : fc_prompt_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_prompt fc_has_inner_prompt_select2',\n\t\t\t\t\t\t\t\t\t'text': _prompt\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field')).hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = el_container.find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (val === null) {\n\t\t\t\t\t\t\t\t\t//el.addClass('fc_highlight_disabled');\n\t\t\t\t\t\t\t\t} else if (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('select2-open', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.hide();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected');\n\t\t\t\t\t\t\t\tels.addClass('select2-selected-highlight').addClass('select2-disabled').removeClass('select2-selected').removeClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on('select2-close', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.show();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected-highlight');\n\t\t\t\t\t\t\t\tels.removeClass('select2-selected-highlight').removeClass('select2-disabled').addClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\t('change', function() {\n\t\t\t\t\t\t\tvar el_select = jQuery(this);\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = jQuery(this).prev('div').find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('div.use_select2_lib.select2-container-multi input').on('keydown', function() {\n\t\t\t\t\t\t\tvar el = jQuery(this);\n\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\tvar val = el.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, 0);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('loaded open', function() {\n\t\t\t\t\t\t\tvar ul = jQuery('#select2-drop ul.select2-results');\n\t\t\t\t\t\t\tvar needsScroll= ul.prop('scrollHeight') > ul.prop('clientHeight');\n\t\t\t\t\t\t\tif (needsScroll) ul.css('overflow-y', 'scroll');\n\t\t\t\t\t\t\telse ul.css('overflow-y', 'auto');\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t";
break;
case 'inputmask':
if ($load_jquery) {
flexicontent_html::loadJQuery();
}
$framework_path = JURI::root(true) . $lib_path . '/inputmask';
$document->addScript($framework_path . '/jquery.inputmask.bundle.min.js');
// Extra inputmask declarations definitions, e.g. ...
//.........这里部分代码省略.........
示例5: _saveJFdata
/**
* Method to save Joomfish item translation data
*
* @access public
* @return boolean True on success
* @since 1.0
*/
function _saveJFdata(&$jfdata_arr, &$item)
{
//$user_currlang = flexicontent_html::getUserCurrentLang(); // user's -current- language
//$default_sitelang = substr(flexicontent_html::getSiteDefaultLang(),0,2); // site (frontend) -content- language
//$item_lang = substr($item->language ,0,2); // item language
$nn_content_tbl = FLEXI_J16GE ? 'falang_content' : 'jf_content';
$db = $this->_db;
$app = JFactory::getApplication();
$dbprefix = $app->getCfg('dbprefix');
$dbtype = $app->getCfg('dbtype');
if (in_array($dbtype, array('mysqli', 'mysql'))) {
$query = "UPDATE #__content SET title=" . $db->Quote($item->title) . ", alias=" . $db->Quote($item->alias) . ", introtext=" . $db->Quote($item->introtext) . ", `fulltext`=" . $db->Quote($item->fulltext) . ", images=" . $db->Quote($item->images) . ", metadesc=" . $db->Quote($item->metadesc) . ", metakey=" . $db->Quote($item->metakey) . ", publish_up=" . $db->Quote($item->publish_up) . ", publish_down=" . $db->Quote($item->publish_down) . ", attribs=" . $db->Quote($item->attribs) . " WHERE id=" . $db->Quote($item->id);
//echo $query."<br/>\n";
if (FLEXI_J16GE) {
//$query = $db->replacePrefix($query);
$query = str_replace("#__", $dbprefix, $query);
$db_connection = $db->getConnection();
} else {
$query = str_replace("#__", $dbprefix, $query);
$db_connection =& $db->_resource;
}
//echo "<pre>"; print_r($query); echo "\n\n";
if ($dbtype == 'mysqli') {
$result = mysqli_query($db_connection, $query);
if ($result === false) {
echo mysqli_error($db_connection);
return JError::raiseWarning(500, "error _saveJFdata():: " . mysqli_error($db_connection));
}
} else {
if ($dbtype == 'mysql') {
$result = mysql_query($query, $db_connection);
if ($result === false) {
return JError::raiseWarning(500, "error _saveJFdata():: " . mysql_error($db_connection));
}
} else {
$msg = 'unreachable code in _saveJFdata(): direct db query, unsupported DB TYPE';
if (FLEXI_J16GE) {
throw new Exception($msg, 500);
} else {
JError::raiseError(500, $msg);
}
}
}
}
$modified = $item->modified ? $item->modified : $item->created;
$modified_by = $item->modified_by ? $item->modified_by : $item->created_by;
$langs = FLEXIUtilities::getLanguages('shortcode');
// Get Joomfish active languages
foreach ($jfdata_arr as $shortcode => $jfdata) {
//echo $shortcode." : "; print_r($jfdata);
// Reconstruct (main)text field if it has splitted up e.g. to seperate editors per tab
if (@$jfdata['text'] && is_array($jfdata['text'])) {
$jfdata['text'][0] .= preg_match('#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i', $jfdata['text'][0]) == 0 ? "\n" . '<hr id="system-readmore" />' : "";
$tabs_text = '';
foreach ($jfdata['text'] as $tab_text) {
$tabs_text .= $tab_text;
}
$jfdata['text'] =& $tabs_text;
} else {
if (empty($jfdata['text'])) {
$jfdata['text'] = '';
}
}
// Search for the {readmore} tag and split the text up accordingly.
$pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
$tagPos = preg_match($pattern, $jfdata['text']);
if ($tagPos == 0) {
$jfdata['introtext'] = $jfdata['text'];
$jfdata['fulltext'] = '';
} else {
list($jfdata['introtext'], $jfdata['fulltext']) = preg_split($pattern, $jfdata['text'], 2);
$jfdata['fulltext'] = JString::strlen(trim($jfdata['fulltext'])) ? $jfdata['fulltext'] : '';
}
// Delete existing Joom!Fish translation data for the current item
$query = "DELETE FROM #__" . $nn_content_tbl . " WHERE language_id={$langs->{$shortcode}->id} AND reference_table='content' AND reference_id={$item->id}";
$db->setQuery($query);
$db->query();
// Apply new translation data
$translated_fields = array('title', 'alias', 'introtext', 'fulltext', 'metadesc', 'metakey');
foreach ($translated_fields as $fieldname) {
if (!strlen(@$jfdata[$fieldname])) {
continue;
}
//if ( !JString::strlen(trim(str_replace(" ", "", strip_tags(@$jfdata[$fieldname])))) ) continue; // skip empty content
//echo "<br/><b>#__".$nn_content_tbl."($fieldname) :</b><br/>";
$query = "INSERT INTO #__" . $nn_content_tbl . " (language_id, reference_id, reference_table, reference_field, value, original_value, original_text, modified, modified_by, published) " . "VALUES ( {$langs->{$shortcode}->id}, {$item->id}, 'content', '{$fieldname}', " . $db->Quote(@$jfdata[$fieldname]) . ", '" . md5($item->{$fieldname}) . "', " . $db->Quote($item->{$fieldname}) . ", '{$modified}', '{$modified_by}', 1)";
//echo $query."<br/>\n";
$db->setQuery($query);
$db->query();
}
}
return true;
}
示例6: 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;
}
}
示例7: display
/**
* Creates the Filemanagerview
*
* @since 1.0
*/
function display($tpl = null)
{
// Check for request forgeries
JRequest::checkToken('request') or jexit('Invalid Token');
flexicontent_html::loadJQuery();
flexicontent_html::loadFramework('select2');
JHTML::_('behavior.tooltip');
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
//initialise variables
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$params = JComponentHelper::getParams('com_flexicontent');
//$authorparams = flexicontent_db::getUserConfig($user->id);
$langs = FLEXIUtilities::getLanguages('code');
$fieldid = JRequest::getVar('field', null, 'request', 'int');
$client = $app->isAdmin() ? '../' : '';
//get vars
$filter_order = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_order', 'filter_order', 'f.filename', 'cmd');
$filter_order_Dir = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter', 'filter', 1, 'int');
$filter_lang = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_lang', 'filter_lang', '', 'string');
$filter_uploader = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_uploader', 'filter_uploader', 0, 'int');
$filter_url = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_url', 'filter_url', '', 'word');
$filter_secure = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_secure', 'filter_secure', '', 'word');
$filter_ext = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_ext', 'filter_ext', '', 'alnum');
$search = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.search', 'search', '', 'string');
$filter_item = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.item_id', 'item_id', '', 'int');
$u_item_id = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.u_item_id', 'u_item_id', 0, 'string');
$autoselect = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.autoselect', 'autoselect', 0, 'int');
$autoassign = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.autoassign', 'autoassign', 0, 'int');
$folder_mode = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.folder_mode', 'folder_mode', 0, 'int');
$folder_param = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.folder_param', 'folder_param', 'dir', 'string');
$append_item = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.append_item', 'append_item', 1, 'int');
$append_field = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.append_field', 'append_field', 1, 'int');
$targetid = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.targetid', 'targetid', '', 'string');
$thumb_w = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.thumb_w', 'thumb_w', 120, 'int');
$thumb_h = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.thumb_h', 'thumb_h', 90, 'int');
$search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search)));
$newfileid = JRequest::getInt('newfileid');
$newfilename = base64_decode(JRequest::getVar('newfilename', ''));
$delfilename = base64_decode(JRequest::getVar('delfilename', ''));
//add css and submenu to document
if ($app->isSite()) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontent.css');
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexi_shared.css');
// NOTE: this is imported by main Frontend CSS file
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
}
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
$document->addStyleSheet(JURI::root() . 'administrator/templates/system/css/system.css');
// include backend CSS template CSS file , access to backend folder may not be allowed but ...
if ($app->isSite()) {
$template = !FLEXI_J16GE ? 'khepri' : (FLEXI_J30GE ? 'hathor' : 'bluestork');
$document->addStyleSheet(JURI::root() . 'administrator/templates/' . $template . (FLEXI_J16GE ? '/css/template.css' : '/css/general.css'));
}
//a trick to avoid loosing general style in modal window
$css = 'body, td, th { font-size: 11px; }
a.striketext {
text-decoration: line-through;
color:red;
font-style:italic;
}
';
$document->addStyleDeclaration($css);
// Get User's Global Permissions
$perms = FlexicontentHelperPerm::getPerm();
// ***********************
// Get data from the model
// ***********************
$model = $this->getModel();
if (!$folder_mode) {
$rows = $this->get('Data');
$img_folder = '';
} else {
$rows = $model->getFilesFromPath($u_item_id, $fieldid, $append_item, $append_field, $folder_param);
$img_folder = $model->getFieldFolderPath($u_item_id, $fieldid, $append_item, $append_field, $folder_param);
$img_path = str_replace('\\', '/', $img_folder . DS . $newfilename);
$thumb = JURI::root() . 'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $img_path . '&w=' . $thumb_w . '&h=' . $thumb_h;
}
$upload_path_var = 'fc_upload_path_' . $fieldid . '_' . $u_item_id;
$app->setUserState($upload_path_var, $img_folder);
//echo $upload_path_var . "<br>";
//.........这里部分代码省略.........
示例8: display
/**
* Creates the item page
*
* @since 1.0
*/
function display($tpl = null)
{
// ********************************
// Initialize variables, flags, etc
// ********************************
global $globalcats;
$categories = $globalcats;
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$document = JFactory::getDocument();
$config = JFactory::getConfig();
$session = JFactory::getSession();
$user = JFactory::getUser();
$db = JFactory::getDBO();
$option = JRequest::getVar('option');
$nullDate = $db->getNullDate();
// Get the COMPONENT only parameters
// Get component parameters
$params = new JRegistry();
$cparams = JComponentHelper::getParams('com_flexicontent');
$params->merge($cparams);
$params = clone JComponentHelper::getParams('com_flexicontent');
// Some flags
$enable_translation_groups = flexicontent_db::useAssociations();
//$params->get("enable_translation_groups");
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
}
// *****************
// Load JS/CSS files
// *****************
// Add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION);
// Fields common CSS
$document->addStyleSheetVersion(JURI::root(true) . '/components/com_flexicontent/assets/css/flexi_form_fields.css', FLEXI_VERSION);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
flexicontent_html::loadFramework('flexi-lib');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VERSION);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VERSION);
// Add js function for custom code used by FLEXIcontent item form
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/itemscreen.js', FLEXI_VERSION);
// ***********************
// Get data from the model
// ***********************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$model = $this->getModel();
$item = $model->getItem();
$form = $this->get('Form');
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// ***************************
// Get Associated Translations
// ***************************
if ($enable_translation_groups) {
$langAssocs = $this->get('LangAssocs');
}
$langs = FLEXIUtilities::getLanguages('code');
// Get item id and new flag
$cid = $model->getId();
$isnew = !$cid;
// Create and set a unique item id for plugins that needed it
if ($cid) {
$unique_tmp_itemid = $cid;
} else {
$unique_tmp_itemid = $app->getUserState('com_flexicontent.edit.item.unique_tmp_itemid');
$unique_tmp_itemid = $unique_tmp_itemid ? $unique_tmp_itemid : date('_Y_m_d_h_i_s_', time()) . uniqid(true);
}
//print_r($unique_tmp_itemid);
JRequest::setVar('unique_tmp_itemid', $unique_tmp_itemid);
// Get number of subscribers
$subscribers = $model->getSubscribersCount();
// ******************
// Version Panel data
// ******************
// Get / calculate some version related variables
$versioncount = $model->getVersionCount();
$versionsperpage = $params->get('versionsperpage', 10);
$pagecount = (int) ceil($versioncount / $versionsperpage);
// Data need by version panel: (a) current version page, (b) currently active version
$current_page = 1;
$k = 1;
$allversions = $model->getVersionList();
foreach ($allversions as $v) {
if ($k > 1 && ($k - 1) % $versionsperpage == 0) {
$current_page++;
//.........这里部分代码省略.........
示例9: 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;
//.........这里部分代码省略.........
示例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: _displayForm
//.........这里部分代码省略.........
$start_microtime = microtime(true);
}
$model = $this->getModel();
// ** WE NEED TO get OR decide the Content Type, before we call the getItem
// ** We rely on typeid Request variable to decide type for new items so make sure this is set,
// ZERO means allow user to select type, but if user is only allowed a single type, then autoselect it!
if ($menu && isset($menu->query['typeid'])) {
JRequest::setVar('typeid', (int) $menu->query['typeid']);
// This also forces zero if value not set
}
$new_typeid = JRequest::getVar('typeid', 0, '', 'int');
if (!$new_typeid) {
$types = $model->getTypeslist($type_ids_arr = false, $check_perms = true);
if ($types && count($types) == 1) {
$new_typeid = $types[0]->id;
}
JRequest::setVar('typeid', $new_typeid);
$canCreateType = true;
}
$item = $this->get('Item');
if (FLEXI_J16GE) {
$form = $this->get('Form');
}
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// *********************************************************************************************************
// Get language stuff, and also load Template-Specific language file to override or add new language strings
// *********************************************************************************************************
if ($enable_translation_groups) {
$langAssocs = $this->get('LangAssocs');
}
if (FLEXI_FISH || FLEXI_J16GE) {
$langs = FLEXIUtilities::getLanguages('code');
}
if (FLEXI_FISH || FLEXI_J16GE) {
FLEXIUtilities::loadTemplateLanguageFile($item->parameters->get('ilayout', 'default'));
}
// ****************************************************************************************
// CHECK EDIT / CREATE PERMISSIONS (this is duplicate since it also done at the controller)
// ****************************************************************************************
// new item and ownership variables
$isnew = !$item->id;
$isOwner = $item->created_by == $user->get('id');
// create and set (into HTTP request) a unique item id for plugins that needed it
JRequest::setVar('unique_tmp_itemid', $item->id ? $item->id : date('_Y_m_d_h_i_s_', time()) . uniqid(true));
// Component / Menu Item parameters
$allowunauthorize = $params->get('allowunauthorize', 0);
// allow unauthorised user to submit new content
$unauthorized_page = $params->get('unauthorized_page', '');
// page URL for unauthorized users (via global configuration)
$notauth_itemid = $params->get('notauthurl', '');
// menu itemid (to redirect) when user is not authorized to create content
// Create captcha field or messages
if (FLEXI_J16GE) {
$use_captcha = $params->get('use_captcha', 1);
// 1 for guests, 2 for any user
$captcha_formop = $params->get('captcha_formop', 0);
// 0 for submit, 1 for submit/edit (aka always)
$display_captcha = $use_captcha >= 2 || $use_captcha == 1 && $user->guest;
$display_captcha = $display_captcha && ($isnew || $captcha_formop);
// Force using recaptcha
if ($display_captcha) {
// Try to force the use of recaptcha plugin
JFactory::getConfig()->set('captcha', 'recaptcha');
if (!$app->getCfg('captcha')) {
示例12: loadTemplateLanguageFile
/**
* Load Template-Specific language file to override or add new language strings
*
* @return object
* @since 1.5
*/
static function loadTemplateLanguageFile($tmplname = 'default', $view = '')
{
// Check that template name was given
$tmplname = empty($tmplname) ? 'default' : $tmplname;
// This is normally component/module/plugin name, we could use 'category', 'items', etc to have a view specific language file
// e.g. en/en.category.ini, but this is an overkill and make result into duplication of strings ... better all in one file
$extension = '';
// JRequest::get('view');
// Current language, we decided to use LL-CC (language-country) format mapping SEF shortcode, e.g. 'en' to 'en-GB'
$user_lang = flexicontent_html::getUserCurrentLang();
$languages = FLEXIUtilities::getLanguages($hash = 'shortcode');
if (!$user_lang || !isset($languages->{$user_lang}->code)) {
return;
}
// Language has been disabled
$language_tag = $languages->{$user_lang}->code;
// We will use template folder as BASE of language files instead of joomla's language folder
// Since FLEXIcontent templates are meant to be user-editable it makes sense to place language files inside them
$base_dir = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'templates' . DS . $tmplname;
// Final use joomla's API to load our template's language files -- (load english template language file then override with current language file)
JFactory::getLanguage()->load($extension, $base_dir, 'en-GB', $reload = true);
// Fallback to english language template file
JFactory::getLanguage()->load($extension, $base_dir, $language_tag, $reload = true);
// User's current language template file
}
示例13: display
/**
* Creates the Filemanager view
*
* @since 1.0
*/
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$option = JRequest::getCmd('option');
$view = JRequest::getVar('view');
$layout = JRequest::getVar('layout', 'default');
$db = JFactory::getDBO();
$user = JFactory::getUser();
$cparams = JComponentHelper::getParams('com_flexicontent');
//$authorparams = flexicontent_db::getUserConfig($user->id);
$langs = FLEXIUtilities::getLanguages('code');
flexicontent_html::loadJQuery();
flexicontent_html::loadFramework('select2');
JHTML::_('behavior.tooltip');
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
// Get filters
$count_filters = 0;
$_view = $view;
$filter_order = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_order', 'filter_order', 'f.filename', 'cmd');
$filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_lang = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_lang', 'filter_lang', '', 'string');
$filter_url = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_url', 'filter_url', '', 'word');
$filter_secure = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_secure', 'filter_secure', '', 'word');
$filter_ext = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_ext', 'filter_ext', '', 'alnum');
$filter_uploader = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_uploader', 'filter_uploader', '', 'int');
$filter_item = $app->getUserStateFromRequest($option . '.' . $_view . '.item_id', 'item_id', '', 'int');
if ($layout != 'image') {
if ($filter_lang) {
$count_filters++;
}
if ($filter_url) {
$count_filters++;
}
if ($filter_secure) {
$count_filters++;
}
}
if ($filter_ext) {
$count_filters++;
}
if ($filter_uploader) {
$count_filters++;
}
if ($filter_item) {
$count_filters++;
}
$scope = $app->getUserStateFromRequest($option . '.' . $_view . '.scope', 'scope', 1, 'int');
$search = $app->getUserStateFromRequest($option . '.' . $_view . '.search', 'search', '', 'string');
$search = $db->escape(trim(JString::strtolower($search)));
$filter_uploader = $filter_uploader ? $filter_uploader : '';
$filter_item = $filter_item ? $filter_item : '';
// **************************
// Add css and js to document
// **************************
if ($app->isSite()) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css');
} else {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css');
}
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
}
}
// *****************************
// Get user's global permissions
// *****************************
$perms = FlexicontentHelperPerm::getPerm();
// ************************
// Create Submenu & Toolbar
// ************************
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanFiles');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_FILEMANAGER');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'files');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
JToolBarHelper::deleteList('Are you sure?', 'filemanager.remove');
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
//.........这里部分代码省略.........
示例14: _displayForm
//.........这里部分代码省略.........
$canCreateType = true;
}
// FORCE model to load versioned data (URL specified version or latest version (last saved))
$version = JRequest::getVar('version', 0, 'request', 'int');
// Load specific item version (non-zero), 0 version: is unversioned data, -1 version: is latest version (=default for edit form)
$item = $model->getItem(null, $check_view_access = false, $no_cache = true, $force_version = $version != 0 ? $version : -1);
// -1 version means latest
// Replace component/menu 'params' with thee merged component/category/type/item/menu ETC ... parameters
$params =& $item->parameters;
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// Load permissions (used by form template)
$perms = $this->_getItemPerms($item);
// Create submit configuration (for new items) into the session, this is needed before creating the item form
$submitConf = $this->_createSubmitConf($item, $perms);
// Most core field are created via calling methods of the form (J2.5)
$form = $this->get('Form');
// is new item and ownership Flags
$isnew = !$item->id;
$isOwner = $item->created_by == $user->get('id');
// Get available types and the currently selected/requested type
$types = $model->getTypeslist();
$typesselected = $model->getTypesselected();
// Get type parameters, these are needed besides the 'merged' item parameters, e.g. to get Type's default layout
$tparams = $this->get('Typeparams');
$tparams = new JRegistry($tparams);
// *********************************************************************************************************
// Get language stuff, and also load Template-Specific language file to override or add new language strings
// *********************************************************************************************************
if ($enable_translation_groups) {
$langAssocs = $params->get('uselang_fe') == 1 ? $this->get('LangAssocs') : false;
}
$langs = FLEXIUtilities::getLanguages('code');
FLEXIUtilities::loadTemplateLanguageFile($params->get('ilayout', 'default'));
// *************************************
// Create captcha field via custom logic
// *************************************
// create and set (into HTTP request) a unique item id for plugins that needed it
if ($item->id) {
$unique_tmp_itemid = $item->id;
} else {
$unique_tmp_itemid = $app->getUserState('com_flexicontent.edit.item.unique_tmp_itemid');
$unique_tmp_itemid = $unique_tmp_itemid ? $unique_tmp_itemid : date('_Y_m_d_h_i_s_', time()) . uniqid(true);
}
//print_r($unique_tmp_itemid);
JRequest::setVar('unique_tmp_itemid', $unique_tmp_itemid);
// Component / Menu Item parameters
$allowunauthorize = $params->get('allowunauthorize', 0);
// allow unauthorised user to submit new content
$unauthorized_page = $params->get('unauthorized_page', '');
// page URL for unauthorized users (via global configuration)
$notauth_itemid = $params->get('notauthurl', '');
// menu itemid (to redirect) when user is not authorized to create content
// Create captcha field or messages
// Maybe some code can be removed by using Joomla's built-in form element (in XML file), instead of calling the captcha plugin ourselves
$use_captcha = $params->get('use_captcha', 1);
// 1 for guests, 2 for any user
$captcha_formop = $params->get('captcha_formop', 0);
// 0 for submit, 1 for submit/edit (aka always)
$display_captcha = $use_captcha >= 2 || $use_captcha == 1 && $user->guest;
$display_captcha = $display_captcha && ($isnew || $captcha_formop);
// Trigger the configured captcha plugin
if ($display_captcha) {
// Get configured captcha plugin
$c_plugin = $params->get('captcha', $app->getCfg('captcha'));
示例15: display
function display($tpl = null)
{
// ********************
// Initialise variables
// ********************
$app = JFactory::getApplication();
$jinput = $app->input;
$option = $jinput->get('option', '', 'cmd');
$view = $jinput->get('view', '', 'cmd');
$task = $jinput->get('task', '', 'cmd');
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$session = JFactory::getSession();
// Get model
$model = $this->getModel();
// Some flags
$has_zlib = function_exists("zlib_encode");
//version_compare(PHP_VERSION, '5.4.0', '>=');
// Get session information
$conf = $session->get('csvimport_config', "", 'flexicontent');
$conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : "");
$lineno = $session->get('csvimport_lineno', 999999, 'flexicontent');
$session->set('csvimport_parse_log', null, 'flexicontent');
// This is the flag if CSV file has been parsed (import form already submitted), thus to display the imported data
// **************************
// Add css and js to document
// **************************
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
flexicontent_html::loadFramework('flexi-lib');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH);
// *****************************
// Get user's global permissions
// *****************************
$perms = FlexicontentHelperPerm::getPerm();
// ************************
// Create Submenu & Toolbar
// ************************
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanImport');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_IMPORT');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'import');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$toolbar = JToolBar::getInstance('toolbar');
if (!empty($conf)) {
if ($task != 'processcsv') {
$ctrl_task = 'import.processcsv';
$import_btn_title = empty($lineno) ? 'FLEXI_IMPORT_START_TASK' : 'FLEXI_IMPORT_CONTINUE_TASK';
JToolBarHelper::custom($ctrl_task, 'save.png', 'save.png', $import_btn_title, $list_check = false);
}
$ctrl_task = 'import.clearcsv';
JToolBarHelper::custom($ctrl_task, 'cancel.png', 'cancel.png', 'FLEXI_IMPORT_CLEAR_TASK', $list_check = false);
} else {
$ctrl_task = 'import.initcsv';
JToolBarHelper::custom($ctrl_task, 'import.png', 'import.png', 'FLEXI_IMPORT_PREPARE_TASK', $list_check = false);
$ctrl_task = 'import.testcsv';
JToolBarHelper::custom($ctrl_task, 'test.png', 'test.png', 'FLEXI_IMPORT_TEST_FILE_FORMAT', $list_check = false);
}
//JToolBarHelper::Back();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
// Get types
$types = flexicontent_html::getTypesList($_type_ids = false, $_check_perms = false, $_published = true);
// Get Languages
$languages = FLEXIUtilities::getLanguages('code');
// Get categories
global $globalcats;
$categories = $globalcats;
// ************************************
// Decide layout to load: 'import*.php'
// ************************************
$this->setLayout('import');
$this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null;
// Execute the import task, load the log-like AJAX-based layout (import_process.php), to display results including any warnings
if (!empty($conf) && $task == 'processcsv') {
$this->assignRef('conf', $conf);
parent::display('process');
return;
} else {
if (!empty($conf)) {
//.........这里部分代码省略.........