本文整理汇总了PHP中FText类的典型用法代码示例。如果您正苦于以下问题:PHP FText类的具体用法?PHP FText怎么用?PHP FText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display
*
* @param string $tmpl Template
*
* @return void
*/
public function display($tmpl = 'default')
{
$srcs = FabrikHelperHTML::framework();
$app = JFactory::getApplication();
$input = $app->input;
FabrikHelperHTML::script($srcs);
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$visualization = $model->getVisualization();
$pluginParams = $model->getPluginParams();
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel');
$plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
$plugin->_row = $visualization;
if ($visualization->published == 0) {
return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED'));
}
// Plugin is basically a model
$pluginTask = $input->get('plugintask', 'render', 'request');
// @FIXME cant set params directly like this, but I think plugin model setParams() is not right
$plugin->_params = $pluginParams;
$tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
$plugin->{$pluginTask}($this);
$this->plugin = $plugin;
$viewName = $this->getName();
$this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl);
$root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
$this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl);
$ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css';
if (JFile::exists($ab_css_file)) {
JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true);
}
echo parent::display();
}
示例2: getRSSFeed
/**
* Get RSS News feed
*
* @return string
*/
public function getRSSFeed()
{
// Get RSS parsed object
$rssDoc = JSimplepieFactory::getFeedParser('http://feeds.feedburner.com/fabrik', 86400);
if ($rssDoc == false) {
$output = FText::_('Error: Feed not retrieved');
} else {
// Channel header and link
$title = $rssDoc->get_title();
$link = $rssDoc->get_link();
$output = '<table class="adminlist">';
$output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . FText::_($title) . '</th></tr>';
$items = array_slice($rssDoc->get_items(), 0, 3);
$numItems = count($items);
if ($numItems == 0) {
$output .= '<tr><th>' . FText::_('No news items found') . '</th></tr>';
} else {
$k = 0;
for ($j = 0; $j < $numItems; $j++) {
$item = $items[$j];
$output .= '<tr><td class="row' . $k . '">';
$output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
$output .= '<br />' . $item->get_date('Y-m-d');
if ($item->get_description()) {
$description = $this->_truncateText($item->get_description(), 50);
$output .= '<br />' . $description;
}
$output .= '</td></tr>';
$k = 1 - $k;
}
}
$output .= '</table>';
}
return $output;
}
示例3: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
$app = JFactory::getApplication();
if ($this->element['package']) {
$package = $app->setUserState('com_fabrik.package', $this->element['package']);
}
$db = FabrikWorker::getDbo(true);
$query = $db->getQuery(true);
$query->select('id AS value, label AS ' . $db->quote('text') . ', published');
$query->from('#__{package}_forms');
if (!$this->element['showtrashed']) {
$query->where('published <> -2');
}
$query->order('published DESC, label ASC');
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as &$row) {
switch ($row->published) {
case '0':
$row->text .= ' [' . FText::_('JUNPUBLISHED') . ']';
break;
case '-2':
$row->text .= ' [' . FText::_('JTRASHED') . ']';
break;
}
}
$o = new stdClass();
$o->value = '';
$o->text = '';
array_unshift($rows, $o);
return $rows;
}
示例4: getInput
/**
* Get the input
*
* @return string
*/
protected function getInput()
{
$iframeid = $this->id . '_iframe';
$app = JFactory::getApplication();
$input = $app->input;
$cid = $input->get('id', array(0), 'array');
$cid = FArrayHelper::getValue($cid, 0);
// $$$ hugh - when creating a new form, no 'cid' ... not sure what to do, so just set it to 0. Should
// prolly just return something like 'available after save' ?
$c = isset($this->form->repeatCounter) ? (int) $this->form->repeatCounter : 0;
$href = COM_FABRIK_LIVESITE . 'index.php?option=com_fabrik&task=plugin.pluginAjax&plugin=twitter';
$href .= '&g=form&method=authenticateAdmin&tmpl=component&formid=' . $cid . '&repeatCounter=' . $c;
$clearjs = '$(\'jform_params_twitter_oauth_token-' . $c . '\').value = \'\';';
$clearjs .= '$(\'jform_params_twitter_oauth_token_secret-' . $c . '\').value = \'\';';
$clearjs .= '$(\'jform_params_twitter_oauth_user-' . $c . '\').value = \'\';';
$clearjs .= "return false;";
$src = COM_FABRIK_LIVESITE . 'components/com_fabrik/libs/abraham-twitteroauth/images/lighter.png';
$winOpts = 'width=800,height=460,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
$js = "window.open('{$href}', 'twitterwins', '" . $winOpts . "');return false;";
$parsedUrl = parse_url(JUri::root());
$origin = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
$str = "\n<script type='text/javascript'>\nwindow.addEventListener('message', function(event) {\n\tif (~event.origin.indexOf('" . $origin . "')) {\n\t\tjQuery(event.data).each(function (i, k) {\n\t\t\tjQuery(k[0]).val(k[1]);\n\t\t});\n\t} else {\n\t\treturn;\n\t}\n});\n</script>\n";
$str .= '<a href="#" onclick="' . $js . '">';
$str .= '<img src="' . $src . '" alt="Sign in with Twitter"/></a>';
$str .= " | <button class=\"button btn\" href=\"#\" onclick=\"{$clearjs}\">";
$str .= FText::_('PLG_FORM_TWITTER_CLEAR_CREDENTIALS') . "</button><br/>";
$str .= "<br /><input type=\"hidden\" readonly=\"readonly\" name=\"" . $this->name . "\" id=\"" . $this->id . "\" value=\"" . $this->value . "\" />";
return $str;
}
示例5: getGroups
/**
* Method to get the list of groups and elements
* grouped by group and element.
*
* @return array The field option objects as a nested array in groups.
*/
protected function getGroups()
{
$app = JFactory::getApplication();
$input = $app->input;
$db = FabrikWorker::getDbo(true);
$query = $db->getQuery(true);
$query->select('form_id')->from($db->quoteName('#__{package}_formgroup') . ' AS fg')->join('LEFT', '#__{package}_elements AS e ON e.group_id = fg.group_id')->where('e.id = ' . $input->getInt('elementid'));
$db->setQuery($query);
$formId = $db->loadResult();
$formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel');
$formModel->setId($formId);
$rows = array();
$rows[FText::_('COM_FABRIK_GROUPS')] = array();
$rows[FText::_('COM_FABRIK_ELEMENTS')] = array();
// Get available element types
$groups = $formModel->getGroupsHiarachy();
foreach ($groups as $groupModel) {
$group = $groupModel->getGroup();
$label = $group->name;
$value = 'fabrik_trigger_group_group' . $group->id;
$rows[FText::_('COM_FABRIK_GROUPS')][] = JHTML::_('select.option', $value, $label);
$elementModels = $groupModel->getMyElements();
foreach ($elementModels as $elementModel) {
$label = $elementModel->getFullName(false, false);
$value = 'fabrik_trigger_element_' . $elementModel->getFullName(true, false);
$rows[FText::_('COM_FABRIK_ELEMENTS')][] = JHTML::_('select.option', $value, $label);
}
}
reset($rows);
asort($rows[FText::_('COM_FABRIK_ELEMENTS')]);
return $rows;
}
示例6: doRequest
/**
* Send sms
*
* @param string $method post/get
* @param string $url url to request
* @param string $vars querystring vars to post
* @param string $auth auth
* @param string $callback method
*
* @return mixed data or curl error
*/
public static function doRequest($method, $url, $vars, $auth = '', $callback = false)
{
if (!function_exists('curl_init')) {
throw new RuntimeException(FText::_('COM_FABRIK_ERR_CURL_NOT_INSTALLED'));
return;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
}
if (!empty($auth)) {
curl_setopt($ch, CURLOPT_USERPWD, $auth);
}
$data = curl_exec($ch);
curl_close($ch);
if ($data) {
if ($callback) {
return call_user_func($callback, $data);
} else {
return $data;
}
} else {
return curl_error($ch);
}
}
示例7: renderListData
/**
* Shows the data formatted for the list view
*
* @param string $data Elements data
* @param stdClass &$thisRow All the data in the lists current row
* @param array $opts Rendering options
*
* @return string formatted value
*/
public function renderListData($data, stdClass &$thisRow, $opts = array())
{
$params = $this->getParams();
$tz_offset = $params->get('gmt_or_local', '0') == '0';
$data = JHTML::_('date', $data, FText::_($params->get('timestamp_format', 'DATE_FORMAT_LC2')), $tz_offset);
return parent::renderListData($data, $thisRow, $opts);
}
示例8: render
/**
* Render uploaded image
*
* @param object &$model Element model
* @param object &$params Element params
* @param string $file Row data for this element
* @param object $thisRow All row's data
*
* @return void
*/
public function render(&$model, &$params, $file, $thisRow = null)
{
$src = str_replace("\\", "/", COM_FABRIK_LIVESITE . $file);
$ext = JString::strtolower(JFile::getExt($file));
if (!JPluginHelper::isEnabled('content', 'jw_allvideos')) {
$this->output = FText::_('PLG_ELEMENT_FILEUPLOAD_INSTALL_ALL_VIDEOS');
return;
}
$extra = array();
$extra[] = $src;
if ($this->inTableView || $params->get('fu_show_image') < 2) {
$extra[] = $params->get('thumb_max_width');
$extra[] = $params->get('thumb_max_height');
} else {
$extra[] = $params->get('fu_main_max_width');
$extra[] = $params->get('fu_main_max_height');
}
$src = implode('|', $extra);
switch ($ext) {
case 'flv':
$this->output = "{flvremote}{$src}{/flvremote}";
break;
case '3gp':
$this->output = "{3gpremote}{$src}{/3gpremote}";
break;
case 'divx':
$this->output = "{divxremote}{$src}{/divxremote}";
break;
}
}
示例9: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$model = $this->getModel();
$j3 = FabrikWorker::j3();
$app = JFactory::getApplication();
$input = $app->input;
$usersConfig = JComponentHelper::getParams('com_fabrik');
$id = $input->get('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)));
$model->setId($id);
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
$this->id = $id;
$this->row = $this->get('Visualization');
$this->rows = $this->get('Rows');
$this->containerId = $this->get('ContainerId');
$this->calName = $this->get('VizName');
$this->params = $model->getParams();
$tpl = $j3 ? 'bootstrap' : $tpl;
$this->_setPath('template', JPATH_SITE . '/plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tpl);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tpl . '/template.css');
$ref = $model->getJSRenderContext();
$js = "var {$ref} = new fbVisApprovals('approvals_" . $id . "');\n";
$js .= "Fabrik.addBlock('" . $ref . "', {$ref});\n";
$js .= $model->getFilterJs();
$srcs = FabrikHelperHTML::framework();
$srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
$srcs['Approvals'] = 'plugins/fabrik_visualization/approvals/approvals.js';
FabrikHelperHTML::iniRequireJs($model->getShim());
FabrikHelperHTML::script($srcs, $js);
$text = $this->loadTemplate();
FabrikHelperHTML::runContentPlugins($text);
echo $text;
}
示例10: chooseAddEvent
/**
* Choose which list to add an event to
*
* @return void
*/
public function chooseAddEvent()
{
$app = JFactory::getApplication();
$input = $app->input;
$this->setLayout('chooseAddEvent');
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$rows = $model->getEventLists();
$model->getVisualization();
$options = array();
$options[] = JHTML::_('select.option', '', FText::_('PLG_VISUALIZATION_FULLCALENDAR_PLEASE_SELECT'));
$model->getEvents();
$attribs = 'class="inputbox" size="1" ';
$options = array_merge($options, $rows);
$this->_eventTypeDd = JHTML::_('select.genericlist', $options, 'event_type', $attribs, 'value', 'text', '', 'fabrik_event_type');
/*
* Tried loading in iframe and as an ajax request directly - however
* in the end decided to set a call back to the main calendar object (via the package manager)
* to load up the new add event form
*/
$ref = $model->getJSRenderContext();
$script = array();
$script[] = "document.id('fabrik_event_type').addEvent('change', function(e) {";
$script[] = "var fid = e.target.get('value');";
$script[] = "var o = ({'id':'','listid':fid,'rowid':0});";
$script[] = "o.title = Joomla.JText._('PLG_VISUALIZATION_FULLCALENDAR_ADD_EVENT');";
$script[] = "Fabrik.blocks['" . $ref . "'].addEvForm(o);";
$script[] = "Fabrik.Windows.chooseeventwin.close();";
$script[] = "});";
echo '<h2>' . FText::_('PLG_VISUALIZATION_FULLCALENDAR_PLEASE_CHOOSE_AN_EVENT_TYPE') . ':</h2>';
echo $this->_eventTypeDd;
FabrikHelperHTML::addScriptDeclaration(implode("\n", $script));
}
示例11: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$app = JFactory::getApplication();
$input = $app->input;
$j3 = FabrikWorker::j3();
$srcs = FabrikHelperHTML::framework();
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$this->row = $model->getVisualization();
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
$this->js = $this->get('JS');
$viewName = $this->getName();
$params = $model->getParams();
$this->params = $params;
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
$plugin = $pluginManager->getPlugIn('slideshow', 'visualization');
$this->showFilters = $model->showFilters();
$this->filters = $this->get('Filters');
$this->filterFormURL = $this->get('FilterFormURL');
$this->params = $model->getParams();
$this->containerId = $this->get('ContainerId');
$srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
if ($this->get('RequiredFiltersFound')) {
$srcs['Slideshow2'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.js';
$mode = $params->get('slideshow_viz_type', 1);
switch ($mode) {
case 1:
break;
case 2:
$srcs['Kenburns'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.kenburns.js';
break;
case 3:
$srcs['Push'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.push.js';
break;
case 4:
$srcs['Fold'] = 'components/com_fabrik/libs/slideshow2/js/slideshow.fold.js';
break;
default:
break;
}
JHTML::stylesheet('components/com_fabrik/libs/slideshow2/css/slideshow.css');
$srcs['SlideShow'] = 'plugins/fabrik_visualization/slideshow/slideshow.js';
}
FabrikHelperHTML::slimbox();
FabrikHelperHTML::iniRequireJs($model->getShim());
FabrikHelperHTML::script($srcs, $this->js);
//FabrikHelperHTML::slimbox();
$tpl = $j3 ? 'bootstrap' : 'default';
$tpl = $params->get('slideshow_viz_layout', $tpl);
$tmplpath = $model->pathBase . 'slideshow/views/slideshow/tmpl/' . $tpl;
$this->_setPath('template', $tmplpath);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/slideshow/views/slideshow/tmpl/' . $tpl . '/template.css');
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/slideshow/views/slideshow/tmpl/' . $tpl . '/custom.css');
echo parent::display();
}
示例12: updateDatabase
/**
* Attempt to alter the db structure to match the form's current status
*
* @return null
*/
public function updateDatabase()
{
// Check for request forgeries
JSession::checkToken() or die('Invalid Token');
$this->setRedirect('index.php?option=com_fabrik&view=forms');
$this->getModel()->updateDatabase();
$this->setMessage(FText::_('COM_FABRIK_DATABASE_UPDATED'));
}
示例13: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
if ((int) $this->form->getValue('form') === 0) {
return '<input class="readonly" size="60" value="' . FText::_('COM_FABRIK_FIELD_ASSIGN_GROUP_TO_FORM_FIRST') . '" type="readonly" />';
} else {
return parent::getInput();
}
}
示例14: check
/**
* Overloaded check function
*
* @return bool
*/
public function check()
{
if (trim($this->name) == '') {
$this->_error = FText::_("YOUR GROUP MUST CONTAIN A NAME");
return false;
}
return true;
}
示例15: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$input = $app->input;
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
$srcs = FabrikHelperHTML::framework();
FabrikHelperHTML::styleSheet('plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/src/nv.d3.css');
$srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
$srcs['AdvancedSearch'] = 'media/com_fabrik/js/advanced-search.js';
$lib = COM_FABRIK_LIVESITE . 'plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/';
$document->addScript($lib . 'lib/d3.v2.js');
$document->addScript($lib . 'nv.d3.js');
$document->addScript($lib . 'src/tooltip.js');
$document->addScript($lib . 'lib/fisheye.js');
$document->addScript($lib . 'src/utils.js');
$document->addScript($lib . 'src/models/legend.js');
$document->addScript($lib . 'src/models/axis.js');
$document->addScript($lib . 'src/models/scatter.js');
$document->addScript($lib . 'src/models/line.js');
$document->addScript($lib . 'src/models/lineChart.js');
$document->addScript($lib . 'src/models/multiBar.js');
$document->addScript($lib . 'src/models/multiBarChart.js');
$this->row = $model->getVisualization();
$this->requiredFiltersFound = $model->getRequiredFiltersFound();
$params = $model->getParams();
$js = $model->js();
FabrikHelperHTML::addScriptDeclaration($js);
$this->params = $params;
$viewName = $this->getName();
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel');
$plugin = $pluginManager->getPlugIn('calendar', 'visualization');
$this->params = $params;
$this->postText = $model->postText;
$this->assign('containerId', $this->get('ContainerId'));
$this->assign('filters', $this->get('Filters'));
$this->showFilters = $model->showFilters();
$this->assign('filterFormURL', $this->get('FilterFormURL'));
$tpl = $params->get('nvd3_chart_layout', $tpl);
$this->_setPath('template', JPATH_ROOT . '/plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl . '/template.css');
// Assign something to Fabrik.blocks to ensure we can clear filters
$ref = $model->getJSRenderContext();
$js = "{$ref} = {};";
$js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});";
$js .= $model->getFilterJs();
FabrikHelperHTML::iniRequireJs($model->getShim());
FabrikHelperHTML::script($srcs, $js);
$text = $this->loadTemplate();
FabrikHelperHTML::runContentPlugins($text);
echo $text;
}