本文整理汇总了PHP中FLEXIUtilities::call_FC_Field_Func方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::call_FC_Field_Func方法的具体用法?PHP FLEXIUtilities::call_FC_Field_Func怎么用?PHP FLEXIUtilities::call_FC_Field_Func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::call_FC_Field_Func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
// Initialize some variables
$item =& $this->get('Item');
$params =& $item->parameters;
$fields =& $this->get('Extrafields');
$tags =& $item->tags;
$categories =& $item->categories;
$favourites = $item->favourites;
$favoured = $item->favoured;
// process the new plugins
JPluginHelper::importPlugin('content', 'image');
if (!FLEXI_J16GE) {
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, 0));
} else {
$dispatcher->trigger('onContentPrepare', array('com_content.article', &$item, &$params, 0));
}
$document = JFactory::getDocument();
// set document information
$document->setTitle($item->title);
$document->setName($item->alias);
$document->setDescription($item->metadesc);
$document->setMetaData('keywords', $item->metakey);
// prepare header lines
$document->setHeader($this->_getHeaderText($item, $params));
$pdf_format_fields = trim($params->get("pdf_format_fields"));
$pdf_format_fields = !$pdf_format_fields ? array() : preg_split("/[\\s]*,[\\s]*/", $pdf_format_fields);
$methodnames = array();
foreach ($pdf_format_fields as $pdf_format_field) {
@(list($fieldname, $methodname) = preg_split("/[\\s]*:[\\s]*/", $pdf_format_field));
$methodnames[$fieldname] = empty($methodname) ? 'display' : $methodname;
}
// IF no fields set then just print the item's description text
if (!count($pdf_format_fields)) {
echo $item->text;
return;
}
foreach ($fields as $field) {
if (!isset($methodnames[$field->name])) {
continue;
}
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
//$results = $dispatcher->trigger('onDisplayCoreFieldValue', array( &$field, $item, &$params, $tags, $categories, $favourites, $favoured ));
FLEXIUtilities::call_FC_Field_Func('core', 'onDisplayCoreFieldValue', array(&$field, $item, &$params, $tags, $categories, $favourites, $favoured));
} else {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $item ));
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
}
if (@$field->display) {
echo '<b>' . $field->label . '</b>: ';
echo $field->display . '<br /><br />';
}
}
}
示例2: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$option = JRequest::getVar('option');
//initialise variables
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$template = $mainframe->getTemplate();
$dispatcher = JDispatcher::getInstance();
$rev = JRequest::getInt('version', '', 'request');
$codemode = JRequest::getInt('codemode', 0);
$cparams = JComponentHelper::getParams('com_flexicontent');
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//a trick to avoid loosing general style in modal window
$css = 'body, td, th { font-size: 11px; } .novalue { color: gray; font-style: italic; }';
$document->addStyleDeclaration($css);
//Get data from the model
$model = $this->getModel();
$row = $this->get('Item');
$fields = $this->get('Extrafields');
$versions = $this->get('VersionList');
$tparams = $this->get('Typeparams');
// Create the type parameters
$tparams = FLEXI_J16GE ? new JRegistry($tparams) : new JParameter($tparams);
// Add html to field object trought plugins
foreach ($fields as $field) {
if ($field->value) {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $row ));
$fieldname = $field->iscore ? 'core' : $field->field_type;
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onDisplayFieldValue', array(&$field, $row));
} else {
$field->display = '<span class="novalue">' . JText::_('FLEXI_NO_VALUE') . '</span>';
}
if ($field->version) {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $row, $field->version, 'displayversion' ));
$fieldname = $field->iscore ? 'core' : $field->field_type;
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onDisplayFieldValue', array(&$field, $row, $field->version, 'displayversion'));
} else {
$field->displayversion = '<span class="novalue">' . JText::_('FLEXI_NO_VALUE') . '</span>';
}
}
//assign data to template
$this->assignRef('document', $document);
$this->assignRef('row', $row);
$this->assignRef('fields', $fields);
$this->assignRef('versions', $versions);
$this->assignRef('rev', $rev);
$this->assignRef('tparams', $tparams);
$this->assignRef('cparams', $cparams);
$this->assignRef('codemode', $codemode);
parent::display($tpl);
}
示例3: _displayForm
//.........这里部分代码省略.........
$site_default = substr(flexicontent_html::getSiteDefaultLang(), 0, 2);
$is_content_default_lang = $site_default == substr($item->language, 0, 2);
//$modify_untraslatable_values = $enable_translation_groups && !$is_content_default_lang; // && $item->lang_parent_id && $item->lang_parent_id!=$item->id;
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$fields = $this->get('Extrafields');
$item->fields =& $fields;
if ($print_logging_info) {
$fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$jcustom = $app->getUserState('com_flexicontent.edit.item.custom');
//print_r($jcustom);
foreach ($fields as $field) {
// a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
// NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
}
// b. Create field 's editing HTML (the form field)
// NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
if (!$field->iscore) {
if (isset($jcustom[$field->name])) {
$field->value = array();
foreach ($jcustom[$field->name] as $i => $_val) {
$field->value[$i] = $_val;
}
}
$is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
if ($is_editable) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayField', array(&$field, &$item));
if ($field->untranslatable) {
$field->html = '<div class="alert alert-info fc-small fc-iblock">' . JText::_('FLEXI_FIELD_VALUE_IS_NON_TRANSLATABLE') . '</div>' . "\n" . $field->html;
}
} else {
if ($field->valueseditable == 1) {
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>';
} else {
if ($field->valueseditable == 2) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>' . "\n" . $field->display;
} else {
if ($field->valueseditable == 3) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = $field->display;
} else {
if ($field->valueseditable == 4) {
$field->html = '';
$field->formhidden = 4;
}
}
}
}
}
}
// c. Create main text field, via calling the display function of the textarea field (will also check for tabs)
if ($field->field_type == 'maintext') {
if (isset($item->item_translations)) {
$shortcode = substr($item->language, 0, 2);
foreach ($item->item_translations as $lang_id => $t) {
if ($shortcode == $t->shortcode) {
continue;
}
示例4: display
//.........这里部分代码省略.........
$searchRegex = $w_regexp_highlight[$word_found];
$parts[$word_found] = preg_replace($searchRegex, '_fc_highlight_start_\\0_fc_highlight_end_', $part);
}
$result->text = implode($parts, " <br/> ");
$replace_count_total = 0;
// This is for LIKE %word% search for languages without spaces
if ($filter_word_like_any) {
if (strlen($word_found) <= 2) {
continue;
}
// Do not highlight too small words, since we do not consider spaces
foreach ($searchwords as $_word) {
$searchRegex = '#(' . preg_quote($_word, '#') . '[^\\s]*)#iu';
$result->text = preg_replace($searchRegex, '_fc_highlight_start_\\0_fc_highlight_end_', $result->text, 1, $replace_count);
if ($replace_count) {
$replace_count_total++;
}
}
}
$result->text = str_replace('_fc_highlight_start_', '<span class="highlight">', $result->text);
$result->text = str_replace('_fc_highlight_end_', '</span>', $result->text);
// Add some message about matches
/*if ( $state->get('match')=='any' ) {
$text_search_header = "<u><b>".JText::sprintf('Text Search matched at least %d %% (%d out of %d words)', $replace_count_total/count($searchwords) * 100, $replace_count_total, count($searchwords)).": </b></u><br/>";
} else if ( $state->get('match')=='all' ) {
$text_search_header = "<u><b>".JText::sprintf('Text Search (all %d words required)', count($searchwords)).": </b></u><br/>";
} else if ( $state->get('match')=='exact' ) {
$text_search_header = "<u><b>".JText::_('Text Search (exact phrase)').": </b></u><br/>";
} else if ( $state->get('match')=='natural_expanded' ) {
$text_search_header = "<u><b>".JText::_('Text Search (phrase, guessing related)').": </b></u><br/>";
} else if ( $state->get('match')=='natural' ) {
$text_search_header = "<u><b>".JText::_('Text Search (phrase)').": </b></u><br/>";
}
$result->text = $text_search_header . $result->text;*/
} else {
$parts = FLEXIadvsearchHelper::prepareSearchContent($result->text, $params->get('text_chars', 200), array());
$result->text = implode($parts, " <br/> ");
}
/*if ( !empty($result->fields_text) ) {
$result->text .= "<br/><u><b>".JText::_('Attribute filters matched')." : </b></u>";
$result->fields_text = str_replace('[span=highlight]', '<span class="highlight">', $result->fields_text);
$result->fields_text = str_replace('[/span]', '</span>', $result->fields_text);
$result->fields_text = str_replace('[br /]', '<br />', $result->fields_text);
$result->text .= $result->fields_text;
}*/
$result->text = str_replace('[[[', '<', $result->text);
$result->text = str_replace(']]]', '>', $result->text);
$result->created = $result->created ? JHTML::Date($result->created) : '';
$result->count = $i + 1;
}
}
$this->result = JText::sprintf('FLEXI_TOTALRESULTSFOUND', $total);
// ******************************************************************
// Create HTML of filters (-AFTER- getData of model have been called)
// ******************************************************************
foreach ($filters as $filter) {
$filter->parameters->set('display_label_filter_s', 0);
$filter->value = JRequest::getVar('filter_' . $filter->id, false);
//$fieldsearch = $app->getUserStateFromRequest( 'flexicontent.search.'.'filter_'.$filter->id, 'filter_'.$filter->id, array(), 'array' );
//echo "Field name: ".$filter->name; echo ":: ". 'filter_'.$filter->id ." :: value: "; print_r($filter->value); echo "<br/>\n";
$field_filename = $filter->iscore ? 'core' : $filter->field_type;
FLEXIUtilities::call_FC_Field_Func($field_filename, 'onAdvSearchDisplayFilter', array(&$filter, $filter->value, $form_id));
}
//echo "<pre>"; print_r($_GET); exit;
// Create links
$link = JRoute::_(FlexicontentHelperRoute::getSearchRoute(0, $menu_matches ? $menu->id : 0));
//$print_link = JRoute::_('index.php?view=search&pop=1&tmpl=component&print=1');
$curr_url = str_replace('&', '&', $_SERVER['REQUEST_URI']);
$print_link = $curr_url . (strstr($curr_url, '?') ? '&' : '?') . 'pop=1&tmpl=component&print=1';
$pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->assignRef('action', $link);
// $uri->toString()
$this->assignRef('print_link', $print_link);
$this->assignRef('contenttypes', $contenttypes);
$this->assignRef('filters', $filters);
$this->assignRef('results', $results);
$this->assignRef('lists', $lists);
$this->assignRef('params', $params);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('pageclass_sfx', $pageclass_sfx);
$this->assignRef('typeData', $typeData);
$this->assign('ordering', $state->get('ordering'));
$this->assign('searchword', $searchword);
$this->assign('searchphrase', $state->get('match'));
$this->assign('searchareas', $areas);
$this->assign('total', $total);
$this->assign('error', $error);
$this->assignRef('document', $document);
$this->assign('form_id', $form_id);
$this->assign('form_name', $form_name);
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
parent::display($tpl);
if ($print_logging_info) {
@($fc_run_times['template_render'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
}
示例5: display
//.........这里部分代码省略.........
// (a) Apply Content Type Customization to CORE fields (label, description, etc)
// (b) Create the edit html of the CUSTOM fields by triggering 'onDisplayField'
// *****************************************************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$fields = $this->get('Extrafields');
$item->fields =& $fields;
if ($print_logging_info) {
$fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$jcustom = $app->getUserState('com_flexicontent.edit.item.custom');
//print_r($jcustom);
foreach ($fields as $field) {
// a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
// NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
}
// b. Create field 's editing HTML (the form field)
// NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
if (!$field->iscore) {
if (isset($jcustom[$field->name])) {
$field->value = array();
foreach ($jcustom[$field->name] as $i => $_val) {
$field->value[$i] = $_val;
}
}
$is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
if ($is_editable) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayField', array(&$field, &$item));
if ($field->untranslatable) {
$field->html = (!isset($field->html) ? '<div class="fc-mssg-inline fc-warning" style="margin:0 4px 6px 4px; max-width: unset;">' . JText::_('FLEXI_PLEASE_PUBLISH_THIS_PLUGIN') . '</div><div class="clear"></div>' : '') . '<div class="alert alert-info fc-small fc-iblock" style="margin:0 4px 6px 4px; max-width: unset;">' . JText::_('FLEXI_FIELD_VALUE_IS_NON_TRANSLATABLE') . '</div>' . "\n" . (isset($field->html) ? '<div class="clear"></div>' . $field->html : '');
}
} else {
if ($field->valueseditable == 1) {
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>';
} else {
if ($field->valueseditable == 2) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>' . "\n" . $field->display;
} else {
if ($field->valueseditable == 3) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = $field->display;
} else {
if ($field->valueseditable == 4) {
$field->html = '';
$field->formhidden = 4;
}
}
}
}
}
}
// c. Create main text field, via calling the display function of the textarea field (will also check for tabs)
if ($field->field_type == 'maintext') {
if (isset($item->item_translations)) {
$shortcode = substr($item->language, 0, 2);
foreach ($item->item_translations as $lang_id => $t) {
if ($shortcode == $t->shortcode) {
continue;
}
示例6: remove
/**
* Logic to delete files
*
* @access public
* @return void
* @since 1.5
*/
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'file.php';
$user = JFactory::getUser();
$db = JFactory::getDBO();
$model = $this->getModel('file');
$file = $model->getFile();
$app = JFactory::getApplication();
$fieldid = JRequest::getVar('fieldid', 0);
$u_item_id = JRequest::getVar('u_item_id', 0);
$file_mode = JRequest::getVar('folder_mode', 0) ? 'folder_mode' : 'db_mode';
if ($file_mode == 'folder_mode') {
$filename = JRequest::getVar('filename');
$db->setQuery("SELECT * FROM #__flexicontent_fields WHERE id='" . $fieldid . "'");
$field = $db->loadObject();
$field->parameters = new JRegistry($field->attribs);
$field->item_id = $u_item_id;
$result = FLEXIUtilities::call_FC_Field_Func($field->field_type, 'removeOriginalFile', array(&$field, $filename));
if (!$result) {
JError::raiseWarning(100, JText::_('FLEXI_UNABLE_TO_CLEANUP_ORIGINAL_FILE') . ": " . $path);
$msg = '';
} else {
$msg = JText::_('FLEXI_FILES_DELETED');
}
$vc_start = mb_strrpos('?', $_SERVER['HTTP_REFERER']) ? '&' : '?';
$this->setRedirect($_SERVER['HTTP_REFERER'] . $vc_start . 'delfilename=' . base64_encode($filename), $msg);
return;
}
// calculate access
$candelete = $user->authorise('flexicontent.deletefile', 'com_flexicontent');
$candeleteown = $user->authorise('flexicontent.deleteownfile', 'com_flexicontent') && $file->uploaded_by == $user->get('id');
$is_authorised = $candelete || $candeleteown;
// check access
if (!$is_authorised) {
JError::raiseNotice(403, JText::_('FLEXI_ALERTNOTAUTH'));
$this->setRedirect('index.php?option=com_flexicontent&view=filemanager', '');
return;
}
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$model = $this->getModel('filemanager');
if (!is_array($cid) || count($cid) < 1) {
$msg = '';
JError::raiseWarning(500, JText::_('FLEXI_SELECT_ITEM_DELETE'));
} else {
if (!$model->candelete($cid)) {
JError::raiseWarning(500, JText::_('FLEXI_YOU_CANNOT_REMOVE_THIS_FILE'));
} else {
if (!$model->delete($cid)) {
$msg = JText::_('FLEXI_OPERATION_FAILED') . ' : ' . $model->getError();
if (FLEXI_J16GE) {
throw new Exception($msg, 500);
} else {
JError::raiseError(500, $msg);
}
}
$msg = count($cid) . ' ' . JText::_('FLEXI_FILES_DELETED');
$cache = JFactory::getCache('com_flexicontent');
$cache->clean();
}
}
$this->setRedirect('index.php?option=com_flexicontent&view=filemanager', $msg);
}
示例7: _displayForm
//.........这里部分代码省略.........
$start_microtime = microtime(true);
}
$fields = $this->get('Extrafields');
if ($print_logging_info) {
$fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
if ($print_logging_info) {
$start_microtime = microtime(true);
}
foreach ($fields as $field) {
// a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
// NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
}
// b. Create field 's editing HTML (the form field)
// NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
if (!$field->iscore) {
if (FLEXI_J16GE) {
$is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
} else {
if (FLEXI_ACCESS && $user->gid < 25) {
$is_editable = !$field->valueseditable || FAccess::checkAllContentAccess('com_content', 'submit', 'users', $user->gmid, 'field', $field->id);
} else {
$is_editable = 1;
}
}
if (!$is_editable) {
$field->html = '<div class="fc-mssg fc-warning">' . JText::_('FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>';
} else {
if ($modify_untraslatable_values && $field->untranslatable) {
$field->html = '<div class="fc-mssg fc-note">' . JText::_('FLEXI_FIELD_VALUE_IS_UNTRANSLATABLE') . '</div>';
} else {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayField', array(&$field, &$item));
}
}
}
// c. Create main text field, via calling the display function of the textarea field (will also check for tabs)
if ($field->field_type == 'maintext') {
if (isset($item->item_translations)) {
$shortcode = substr($item->language, 0, 2);
foreach ($item->item_translations as $lang_id => $t) {
if ($shortcode == $t->shortcode) {
continue;
}
$field->name = array('jfdata', $t->shortcode, 'text');
$field->value[0] = html_entity_decode($t->fields->text->value, ENT_QUOTES, 'UTF-8');
FLEXIUtilities::call_FC_Field_Func('textarea', 'onDisplayField', array(&$field, &$item));
$t->fields->text->tab_labels = $field->tab_labels;
$t->fields->text->html = $field->html;
unset($field->tab_labels);
unset($field->html);
}
}
$field->name = 'text';
// NOTE: We use the text created by the model and not the text retrieved by the CORE plugin code, which maybe overwritten with JoomFish/Falang data
$field->value[0] = $item->text;
// do not decode special characters this was handled during saving !
// Render the field's (form) HTML
FLEXIUtilities::call_FC_Field_Func('textarea', 'onDisplayField', array(&$field, &$item));
}
}
if ($print_logging_info) {
$fc_run_times['render_field_html'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// Tags used by the item
示例8: _getFiltered
/**
* Method to get the active filter result
*
* @access private
* @return string
* @since 1.5
*/
function _getFiltered(&$filter, $value, $return_sql = true)
{
$field_type = $filter->field_type;
// Sanitize filter values as integers for field that use integer values
if (in_array($field_type, array('createdby', 'modifiedby', 'type', 'categories', 'tags'))) {
$values = is_array($value) ? $value : array($value);
foreach ($values as $i => $v) {
$values[$i] = (int) $v;
}
}
switch ($field_type) {
case 'createdby':
$filter_query = ' AND i.created_by IN (' . implode(",", $values) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'modifiedby':
$filter_query = ' AND i.modified_by IN (' . implode(",", $values) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'type':
//$filter_query = ' AND ie.type_id IN ('. implode(",", $values) .')'; // no db quoting needed since these were typecasted to ints
$query = 'SELECT item_id' . ' FROM #__flexicontent_items_ext' . ' WHERE type_id IN (' . implode(",", $values) . ')';
//$filter_query = ' AND i.id IN (' . $query . ')';
break;
case 'state':
$stateids = array('PE' => -3, 'OQ' => -4, 'IP' => -5, 'P' => 1, 'U' => 0, 'A' => FLEXI_J16GE ? 2 : -1, 'T' => -2);
$values = is_array($value) ? $value : array($value);
$filt_states = array();
foreach ($values as $i => $v) {
if (isset($stateids[$v])) {
$filt_states[] = $stateids[$v];
}
}
$filter_query = !count($values) ? ' AND 0 ' : ' AND i.state IN (' . implode(",", $filt_states) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'categories':
//$filter_query = ' AND rel.catid IN ('. implode(",", $values) .')';
global $globalcats;
$cparams = $this->_params;
$display_subcats = $cparams->get('display_subcategories_items', 2);
// include subcategory items
$query_catids = array();
foreach ($values as $id) {
$query_catids[$id] = 1;
if ($display_subcats == 2 && !empty($globalcats[$id]->descendantsarray)) {
foreach ($globalcats[$id]->descendantsarray as $subcatid) {
$query_catids[$subcatid] = 1;
}
}
}
$query_catids = array_keys($query_catids);
$query = 'SELECT itemid' . ' FROM #__flexicontent_cats_item_relations' . ' WHERE catid IN (' . implode(",", $query_catids) . ')';
//$filter_query = ' AND i.id IN (' . $query . ')';
break;
case 'tags':
$query = 'SELECT itemid' . ' FROM #__flexicontent_tags_item_relations' . ' WHERE tid IN (' . implode(",", $values) . ')';
//$filter_query = ' AND i.id IN (' . $query . ')';
break;
default:
// Make sure plugin file of current file is loaded and then check if custom filtering function exists
$field_type_file = $filter->iscore ? 'core' : $field_type;
$path = JPATH_ROOT . DS . 'plugins' . DS . 'flexicontent_fields' . DS . strtolower($field_type_file) . (FLEXI_J16GE ? DS . strtolower($field_type_file) : "") . '.php';
if (file_exists($path)) {
require_once $path;
$method_exists = method_exists("plgFlexicontent_fields{$field_type_file}", "getFiltered");
}
// Use custom field filtering if 'getFiltered' plugin method exists, otherwise try to use our default filtering function
$filtered = !@$method_exists ? FlexicontentFields::getFiltered($filter, $value, $return_sql) : FLEXIUtilities::call_FC_Field_Func($field_type_file, 'getFiltered', array(&$filter, &$value, &$return_sql));
break;
}
if (!isset($filter_query)) {
if (isset($filtered)) {
// nothing to do
} else {
if (!isset($query)) {
$filtered = '';
echo "Unhandled case for filter: " . $field->name . " in 'FlexicontentModelCategory::getFiltered()', query variable not set<br/>\n";
} else {
if (!$return_sql) {
//echo "<br>GET FILTERED Items (cat model) -- [".$filter->name."] using in-query ids :<br>". $query."<br>\n";
$db = JFactory::getDBO();
$db->setQuery($query);
$filtered = $db->loadColumn();
if ($db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
}
} else {
if ($return_sql === 2) {
$db = JFactory::getDBO();
static $iids_tblname = array();
if (!isset($iids_tblname[$filter->id])) {
$iids_tblname[$filter->id] = 'fc_filter_iids_' . $filter->id;
//.........这里部分代码省略.........
示例9: onContentSearch
//.........这里部分代码省略.........
$andaccess .= ' AND c.access IN (0,' . $aid_list . ')';
$andaccess .= ' AND i.access IN (0,' . $aid_list . ')';
$select_access .= ', 1 AS has_access';
} else {
// Access Flags for: content type, main category, item
$aid_arr = JAccess::getAuthorisedViewLevels($user->id);
$aid_list = implode(",", $aid_arr);
$select_access .= ', ' . ' CASE WHEN ' . ' ty.access IN (' . $aid_list . ') AND ' . ' c.access IN (' . $aid_list . ') AND ' . ' i.access IN (' . $aid_list . ') ' . ' THEN 1 ELSE 0 END AS has_access';
}
// **********************************************************************************************************************************************************
// Create WHERE clause part for filtering by current active language, and current selected contend types ( !! although this is possible via a filter too ...)
// **********************************************************************************************************************************************************
$andlang = '';
if ($app->isSite() && (FLEXI_FISH || FLEXI_J16GE && $app->getLanguageFilter()) && $filter_lang) {
$andlang .= ' AND ( ie.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR ie.language="*" ' : '') . ' ) ';
}
// Filter by currently selected content types
$andcontenttypes = count($contenttypes) ? ' AND ie.type_id IN (' . implode(",", $contenttypes) . ') ' : '';
// ***********************************************************************
// Create the AND-WHERE clause parts for the currentl active Field Filters
// ***********************************************************************
$return_sql = 2;
$filters_where = array();
foreach ($filters as $field) {
// Get value of current filter, and SKIP it if value is EMPTY
$filtervalue = JRequest::getVar('filter_' . $field->id, '');
$empty_filtervalue_array = is_array($filtervalue) && !strlen(trim(implode('', $filtervalue)));
$empty_filtervalue_string = !is_array($filtervalue) && !strlen(trim($filtervalue));
if ($empty_filtervalue_array || $empty_filtervalue_string) {
continue;
}
// Call field filtering of advanced search to find items matching the field filter (an SQL SUB-QUERY is returned)
$field_filename = $field->iscore ? 'core' : $field->field_type;
$filtered = FLEXIUtilities::call_FC_Field_Func($field_filename, 'getFilteredSearch', array(&$field, &$filtervalue, &$return_sql));
// An empty return value means no matching values were found
$filtered = empty($filtered) ? ' AND 0 ' : $filtered;
// A string mean a subquery was returned, while an array means that item ids we returned
$filters_where[$field->id] = is_array($filtered) ? ' AND i.id IN (' . implode(',', $filtered) . ')' : $filtered;
/*if ($filters_where[$field->id]) {
echo "\n<br/>Filter:". $field->name ." : "; print_r($filtervalue);
echo "<br>".$filters_where[$field->id]."<br/>";
}*/
}
//echo "\n<br/><br/>Filters Active: ". count($filters_where)."<br/>";
//echo "<pre>"; print_r($filters_where);
//exit;
// ******************************************************
// Create Filters JOIN clauses and AND-WHERE clause parts
// ******************************************************
// JOIN clause - USED - to limit returned 'text' to the text of TEXT-SEARCHABLE only fields ... (NOT shared with filters)
if (!$txtmode) {
$onBasic_textsearch = $text_where;
$onAdvanced_textsearch = '';
$join_textsearch = '';
$join_textfields = '';
} else {
$onBasic_textsearch = '';
$onAdvanced_textsearch = $text_where;
$join_textsearch = ' JOIN #__flexicontent_advsearch_index as ts ON ts.item_id = i.id ' . (count($fields_text) ? 'AND ts.field_id IN (' . implode(',', array_keys($fields_text)) . ')' : '');
$join_textfields = ' JOIN #__flexicontent_fields as f ON f.id=ts.field_id';
}
// JOIN clauses ... (shared with filters)
$join_clauses = '' . ' JOIN #__categories AS c ON c.id = i.catid' . ' JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id';
$join_clauses_with_text = '' . ' JOIN #__categories AS c ON c.id = i.catid' . ' JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . $onBasic_textsearch . ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ($text_where ? $join_textsearch . $onAdvanced_textsearch . $join_textfields : '');
// AND-WHERE sub-clauses ... (shared with filters)
$where_conf = ' WHERE 1 ' . ' AND i.state IN (1,-5' . ($search_archived ? ',' . (FLEXI_J16GE ? 2 : -1) : '') . ') ' . ' AND c.published = 1 ' . ' AND ( i.publish_up = ' . $db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' )' . ' AND ( i.publish_down = ' . $db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' )' . $andaccess . $andlang . $andcontenttypes;
示例10: saveFields
//.........这里部分代码省略.........
$maintain_dbval = true;*/
} else {
if ($field->iscore) {
// (posted) CORE FIELDS: if not set maintain their DB value ...
if (isset($core_via_post[$field->name])) {
if (isset($data[$field->name])) {
$postdata[$field->name] = $data[$field->name];
} else {
$postdata[$field->name] = $field->value;
$maintain_dbval = true;
}
// (not posted) CORE FIELDS: get current value
} else {
// Get value from the updated item instead of old data
$postdata[$field->name] = $this->getCoreFieldValue($field, 0);
}
// OTHER CUSTOM FIELDS (not hidden and not untranslatable)
} else {
$postdata[$field->name] = @$data['custom'][$field->name];
}
}
// Unserialize values already serialized values, e.g. (a) if current values used are from DB or (b) are being imported from CSV file
if (!is_array($postdata[$field->name])) {
$postdata[$field->name] = strlen($postdata[$field->name]) ? array($postdata[$field->name]) : array();
}
foreach ($postdata[$field->name] as $i => $postdata_val) {
if (@unserialize($postdata_val) !== false || $postdata_val === 'b:0;') {
$postdata[$field->name][$i] = unserialize($postdata_val);
}
}
// Trigger plugin Event 'onBeforeSaveField'
if (!$field->iscore || isset($core_via_post[$field->name])) {
$field_type = $field->iscore ? 'core' : $field->field_type;
$result = FLEXIUtilities::call_FC_Field_Func($field_type, 'onBeforeSaveField', array(&$field, &$postdata[$field->name], &$files[$field->name], &$item));
if ($result === false) {
// Field requested to abort item saving
$this->setError(JText::sprintf('FLEXI_FIELD_VALUE_IS_INVALID', $field->label));
return 'abort';
}
// For CORE field get the modified data, which will be used for storing in DB (these will be re-bind later)
if (isset($core_via_post[$field->name])) {
$core_data_via_events[$field->name] = isset($postdata[$field->name][0]) ? $postdata[$field->name][0] : '';
// The validation may have skipped it !!
}
} else {
// Currently other CORE fields, these are skipped we will not call onBeforeSaveField() on them, neither rebind them
}
//$qindex[$field->name] = NULL;
//$result = FLEXIUtilities::call_FC_Field_Func($field_type, 'onBeforeSaveField', array( &$field, &$postdata[$field->name], &$files[$field->name], &$item, &$qindex[$field->name] ));
//if ($result===false) { ... }
// Get vstate property from the field object back to the data array ... in case it was modified, since some field may decide to prevent approval !
$data['vstate'] = $field->item_vstate;
}
//echo "<pre>"; print_r($postdata); echo "</pre>"; exit;
}
if ($print_logging_info) {
@($fc_run_times['fields_value_preparation'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
// **********************
// Empty per field TABLES
// **********************
$filterables = FlexicontentFields::getSearchFields('id', $indexer = 'advanced', null, null, $_load_params = true, 0, $search_type = 'filter');
$filterables = array_keys($filterables);
$filterables = array_flip($filterables);
$tbl_prefix = $app->getCfg('dbprefix') . 'flexicontent_advsearch_index_field_';
$query = "SELECT TABLE_NAME\n\t\t\tFROM INFORMATION_SCHEMA.TABLES\n\t\t\tWHERE TABLE_NAME LIKE '" . $tbl_prefix . "%'\n\t\t\t";
示例11: onIndexSearch
function onIndexSearch(&$field, &$post, &$item)
{
if ( !in_array($field->field_type, self::$field_types) ) return;
if ( !$field->issearch ) return;
FLEXIUtilities::call_FC_Field_Func('text', 'onIndexSearch', array(&$field, &$post, &$item));
return true;
}
示例12: index
//.........这里部分代码省略.........
$cnt += $max_items_per_query;
// Item is not needed, later and only if field uses item replacements then it will be loaded
$item = null;
// Items language is needed to do (if needed) special per language handling
$lang_query = "SELECT id, language" . " FROM #__content AS i " . " WHERE id IN (" . implode(', ', $query_itemids) . ")";
$db->setQuery($lang_query);
$items_data = $db->loadObjectList('id');
if ($indexer == 'basic') {
$searchindex = array();
// Add all query itemids to searchindex array so that it will be cleared even if zero fields are indexed
foreach ($query_itemids as $query_itemid) {
$searchindex[$query_itemid] = array();
}
} else {
// This will hold the SQL inserting new advanced search records for multiple item/values
$ai_query_vals = array();
$ai_query_vals_f = array();
// Current for advanced index only
}
// For current item: Loop though all searchable fields according to their type
foreach ($fieldids as $fieldid) {
// Must SHALLOW clone because we will be setting some properties , e.g. 'ai_query_vals', that we do not
$field = clone $fields[$fieldid];
// Indicate multiple items per query
$field->item_id = 0;
$field->query_itemids = $query_itemids;
$field->items_data = $items_data;
// Includes item langyage, which may be used for special per language handling
// Indicate that the indexing fuction should retrieve the values
$values = null;
// Add values to advanced search index
$fieldname = $field->iscore ? 'core' : $field->field_type;
if ($indexer == 'advanced') {
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onIndexAdvSearch', array(&$field, &$values, &$item));
//print_r($field->ai_query_vals);
if (isset($field->ai_query_vals)) {
foreach ($field->ai_query_vals as $query_val) {
$ai_query_vals[] = $query_val;
}
if (isset($filterables[$field->id])) {
// Current for advanced index only
foreach ($field->ai_query_vals as $query_val) {
$ai_query_vals_f[$field->id][] = $query_val;
}
}
}
//else echo "Not set for : ". $field->name;
} else {
if ($indexer == 'basic') {
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onIndexSearch', array(&$field, &$values, &$item));
foreach ($query_itemids as $query_itemid) {
if (@$field->search[$query_itemid]) {
$searchindex[$query_itemid][] = $field->search[$query_itemid];
}
}
}
}
}
// Create query that will update/insert data into the DB
unset($queries);
// make sure it is not set above
$queries = array();
if ($indexer == 'basic') {
if (count($searchindex)) {
// check for zero search index records
$query_vals = '';
示例13: onIndexAdvSearch
function onIndexAdvSearch(&$field, &$post, &$item) {
// execute the code only if the field type match the plugin type
if ( !in_array($field->field_type, self::$field_types) ) return;
if ( !$field->isadvsearch && !$field->isadvfilter ) return;
FLEXIUtilities::call_FC_Field_Func('text', 'onIndexAdvSearch', array(&$field, &$post, &$item));
return true;
}
示例14: onBeforeSaveField
function onBeforeSaveField(&$field, &$post, &$file, &$item)
{
if ($field->iscore != 1) {
return;
}
if (!is_array($post) && !strlen($post)) {
return;
}
if ($field->field_type == 'maintext') {
// field_type is not changed textarea so that field can handle this field type
FLEXIUtilities::call_FC_Field_Func('textarea', 'onBeforeSaveField', array(&$field, &$post, &$file, &$item));
}
}
示例15: _getFiltered
/**
* Method to get the active filter result
*
* @access private
* @return string
* @since 1.5
*/
function _getFiltered(&$filter, $value)
{
$field_type = $filter->field_type;
// Sanitize filter values as integers for field that use integer values
if (in_array($field_type, array('createdby', 'modifiedby', 'type', 'categories', 'tags'))) {
$values = is_array($value) ? $value : array($value);
foreach ($values as $i => $v) {
$values[$i] = (int) $v;
}
}
switch ($field_type) {
case 'createdby':
$filter_query = ' AND i.created_by IN (' . implode(",", $values) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'modifiedby':
$filter_query = ' AND i.modified_by IN (' . implode(",", $values) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'type':
//$filter_query = ' AND ie.type_id IN ('. implode(",", $values) .')'; // no db quoting needed since these were typecasted to ints
$query = 'SELECT item_id' . ' FROM #__flexicontent_items_ext' . ' WHERE type_id IN (' . implode(",", $values) . ')';
$filter_query = ' AND i.id IN (' . $query . ')';
break;
case 'state':
$stateids = array('PE' => -3, 'OQ' => -4, 'IP' => -5, 'P' => 1, 'U' => 0, 'A' => FLEXI_J16GE ? 2 : -1, 'T' => -2);
$values = is_array($value) ? $value : array($value);
$filt_states = array();
foreach ($values as $i => $v) {
if (isset($stateids[$v])) {
$filt_states[] = $stateids[$v];
}
}
$filter_query = !count($values) ? ' AND 1=0 ' : ' AND i.state IN (' . implode(",", $filt_states) . ')';
// no db quoting needed since these were typecasted to ints
break;
case 'categories':
//$filter_query = ' AND rel.catid IN ('. implode(",", $values) .')';
$query = 'SELECT itemid' . ' FROM #__flexicontent_cats_item_relations' . ' WHERE catid IN (' . implode(",", $values) . ')';
$filter_query = ' AND i.id IN (' . $query . ')';
break;
case 'tags':
$query = 'SELECT itemid' . ' FROM #__flexicontent_tags_item_relations' . ' WHERE tid IN (' . implode(",", $values) . ')';
$filter_query = ' AND i.id IN (' . $query . ')';
break;
default:
// Make sure plugin file of current file is loaded and then check if custom filtering function exists
$field_type_file = $filter->iscore ? 'core' : $field_type;
$path = JPATH_ROOT . DS . 'plugins' . DS . 'flexicontent_fields' . DS . strtolower($field_type_file) . (FLEXI_J16GE ? DS . strtolower($field_type_file) : "") . '.php';
if (file_exists($path)) {
require_once $path;
$method_exists = method_exists("plgFlexicontent_fields{$field_type_file}", "getFiltered");
}
// Use custom field filtering if 'getFiltered' plugin method exists, otherwise try to use our default filtering function
$filtered = !@$method_exists ? FlexicontentFields::getFiltered($filter, $value, $return_sql = true) : FLEXIUtilities::call_FC_Field_Func($field_type_file, 'getFiltered', array(&$filter, &$value));
// An empty return value means no matching values we found
$filtered = empty($filtered) ? ' AND 1=0' : $filtered;
// A string mean a subquery was returned, while an array means that item ids we returned
$filter_query = is_array($filtered) ? ' AND i.id IN (' . implode(',', $filtered) . ')' : $filtered;
break;
}
//echo "<br/>".$filter_query."<br/>";
return $filter_query;
}