本文整理汇总了PHP中FabrikString::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::translate方法的具体用法?PHP FabrikString::translate怎么用?PHP FabrikString::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::translate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupProperties
/**
* Make a group object to be used in the form view. Object contains
* group display properties
*
* @param object &$formModel form model
*
* @return object group display properties
*/
public function getGroupProperties(&$formModel)
{
$w = new FabrikWorker();
$input = $this->app->input;
$group = new stdClass();
$groupTable = $this->getGroup();
$params = $this->getParams();
$view = $input->get('view');
if (!isset($this->editable)) {
$this->editable = $formModel->isEditable();
}
if ($this->editable) {
// If all of the groups elements are not editable then set the group to uneditable
$elements = $this->getPublishedElements();
$editable = false;
foreach ($elements as $element) {
if ($element->canUse()) {
$editable = true;
}
}
if (!$editable) {
$this->editable = false;
}
}
$group->editable = $this->editable;
$group->canRepeat = $params->get('repeat_group_button', '0');
$showGroup = $params->def('repeat_group_show_first', '1');
$pages = $formModel->getPages();
$startPage = isset($formModel->sessionModel->last_page) ? $formModel->sessionModel->last_page : 0;
/**
* $$$ hugh - added array_key_exists for (I think!) corner case where group properties have been
* changed to remove (or change) paging, but user still has session state set. So it was throwing
* a PHP 'undefined index' notice.
*/
if (array_key_exists($startPage, $pages) && is_array($pages[$startPage]) && !in_array($groupTable->id, $pages[$startPage]) || $showGroup == -1 || $showGroup == 0 || $view == 'form' && $showGroup == -2 || $view == 'details' && $showGroup == -3) {
$groupTable->css .= ";display:none;";
}
$group->css = trim(str_replace(array("<br />", "<br>"), "", $groupTable->css));
$group->id = $groupTable->id;
$label = $input->getString('group' . $group->id . '_label', $groupTable->label);
if (JString::stristr($label, "{Add/Edit}")) {
$replace = $formModel->isNewRecord() ? FText::_('COM_FABRIK_ADD') : FText::_('COM_FABRIK_EDIT');
$label = str_replace("{Add/Edit}", $replace, $label);
}
$groupTable->label = $label;
$group->title = $w->parseMessageForPlaceHolder($groupTable->label, $formModel->data, false);
$group->title = FText::_($group->title);
$group->name = $groupTable->name;
$group->displaystate = $group->canRepeat == 1 && $formModel->isEditable() ? 1 : 0;
$group->maxRepeat = (int) $params->get('repeat_max');
$group->minRepeat = $params->get('repeat_min', '') === '' ? 1 : (int) $params->get('repeat_min', '');
$group->showMaxRepeats = $params->get('show_repeat_max', '0') == '1';
$group->minMaxErrMsg = $params->get('repeat_error_message', '');
$group->minMaxErrMsg = FText::_($group->minMaxErrMsg);
$group->canAddRepeat = $this->canAddRepeat();
$group->canDeleteRepeat = $this->canDeleteRepeat();
$group->intro = $text = FabrikString::translate($params->get('intro'));
$group->outro = FText::_($params->get('outro'));
$group->columns = $params->get('group_columns', 1);
$group->splitPage = $params->get('split_page', 0);
$group->showLegend = $this->showLegend($group);
$group->labels = $params->get('labels_above', -1);
$group->dlabels = $params->get('labels_above_details', -1);
if ($this->canRepeat()) {
$group->tmpl = $params->get('repeat_template', 'repeatgroup');
} else {
$group->tmpl = 'group';
}
return $group;
}
示例2: display
/**
* Display the template
*
* @param sting $tpl template
*
* @return void
*/
public function display($tpl = null)
{
if ($this->getLayout() == '_advancedsearch') {
$this->advancedSearch($tpl);
return;
}
$fbConfig = JComponentHelper::getParams('com_fabrik');
$profiler = JProfiler::getInstance('Application');
$app = JFactory::getApplication();
$input = $app->input;
$model = $this->getModel();
// Force front end templates
$tmpl = $model->getTmpl();
$this->_basePath = COM_FABRIK_FRONTEND . '/views';
$jTmplFolder = FabrikWorker::j3() ? 'tmpl' : 'tmpl25';
$this->addTemplatePath($this->_basePath . '/' . $this->_name . '/' . $jTmplFolder . '/' . $tmpl);
$root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
$this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/list/' . $tmpl);
$user = JFactory::getUser();
$document = JFactory::getDocument();
$item = $model->getTable();
$data = $model->render();
$w = new FabrikWorker();
// Add in some styling short cuts
$c = 0;
$form = $model->getFormModel();
$nav = $model->getPagination();
foreach ($data as $groupk => $group) {
$last_pk = '';
$last_i = 0;
$num_rows = 1;
foreach (array_keys($group) as $i) {
$o = new stdClass();
// $$$ rob moved merge wip code to FabrikModelTable::formatForJoins() - should contain fix for pagination
$o->data = $data[$groupk][$i];
$o->cursor = $num_rows + $nav->limitstart;
$o->total = $nav->total;
$o->id = 'list_' . $model->getRenderContext() . '_row_' . @$o->data->__pk_val;
$o->class = 'fabrik_row oddRow' . $c;
$data[$groupk][$i] = $o;
$c = 1 - $c;
$num_rows++;
}
}
$groups = $form->getGroupsHiarachy();
foreach ($groups as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$elementModel->setContext($groupModel, $form, $model);
$rowclass = $elementModel->setRowClass($data);
}
}
$this->rows = $data;
reset($this->rows);
// Cant use numeric key '0' as group by uses grouped name as key
$firstRow = current($this->rows);
$this->requiredFiltersFound = $model->getRequiredFiltersFound();
$this->advancedSearch = $model->getAdvancedSearchLink();
$this->advancedSearchURL = $model->getAdvancedSearchURL();
$this->nodata = empty($this->rows) || count($this->rows) == 1 && empty($firstRow) || !$this->requiredFiltersFound ? true : false;
$this->tableStyle = $this->nodata ? 'display:none' : '';
$this->emptyStyle = $this->nodata ? '' : 'display:none';
$params = $model->getParams();
if (!$this->access($model)) {
return false;
}
if (!class_exists('JSite')) {
require_once JPATH_ROOT . '/includes/application.php';
}
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$this->setTitle($w, $params, $model);
// Deprecated (keep in case people use them in old templates)
$this->table = new stdClass();
$this->table->label = FabrikString::translate($w->parseMessageForPlaceHolder($item->label, $_REQUEST));
$this->table->intro = $params->get('show_into', 1) == 0 ? '' : FabrikString::translate($w->parseMessageForPlaceHolder($item->introduction));
$this->table->outro = $params->get('show_outro', 1) == 0 ? '' : FabrikString::translate($w->parseMessageForPlaceHolder($params->get('outro')));
$this->table->id = $item->id;
$this->table->renderid = $model->getRenderContext();
$this->table->db_table_name = $item->db_table_name;
// End deprecated
$this->list = $this->table;
$this->list->class = $model->htmlClass();
$this->group_by = $item->group_by;
$this->form = new stdClass();
$this->form->id = $item->form_id;
$this->renderContext = $model->getRenderContext();
$this->formid = 'listform_' . $this->renderContext;
$form = $model->getFormModel();
$this->table->action = $model->getTableAction();
$this->showCSV = $model->canCSVExport();
$this->showCSVImport = $model->canCSVImport();
$this->toggleCols = $model->toggleCols();
//.........这里部分代码省略.........
示例3: parseIntroOutroPlaceHolders
/**
* Parse into and outro text
*
* @param string $text Text to parse
*
* @since 3.0.7
*
* @return string
*/
protected function parseIntroOutroPlaceHolders($text)
{
if (!$this->isEditable()) {
$remove = "/{new:\\s*.*?}/is";
$text = preg_replace($remove, '', $text);
$remove = "/{edit:\\s*.*?}/is";
$text = preg_replace($remove, '', $text);
$match = "/{details:\\s*.*?}/is";
$text = preg_replace_callback($match, array($this, '_getIntroOutro'), $text);
} else {
$match = $this->isNewRecord() ? 'new' : 'edit';
$remove = $this->isNewRecord() ? 'edit' : 'new';
$match = "/{" . $match . ":\\s*.*?}/is";
$remove = "/{" . $remove . ":\\s*.*?}/is";
$text = preg_replace_callback($match, array($this, '_getIntroOutro'), $text);
$text = preg_replace($remove, '', $text);
$text = preg_replace("/{details:\\s*.*?}/is", '', $text);
}
$w = new FabrikWorker();
$text = $w->parseMessageForPlaceHolder($text, $this->data, true);
// Jaanus: to remove content plugin code from intro and/or outro when plugins are not processed
$params = $this->getParams();
$jPlugins = (int) $params->get('process-jplugins', '2');
if ($jPlugins === 0 || $jPlugins === 2 && $this->isEditable()) {
$text = preg_replace("/{\\s*.*?}/i", '', $text);
}
$text = FabrikString::translate($text);
return $text;
}