本文整理汇总了PHP中Lang::txt方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::txt方法的具体用法?PHP Lang::txt怎么用?PHP Lang::txt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::txt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefault
/**
* Method to set the home property for a list of items
*
* @since 1.6
*/
function setDefault()
{
// Check for request forgeries
Session::checkToken('request') or die(Lang::txt('JINVALID_TOKEN'));
// Get items to publish from the request.
$cid = Request::getVar('cid', array(), '', 'array');
$data = array('setDefault' => 1, 'unsetDefault' => 0);
$task = $this->getTask();
$value = \Hubzero\Utility\Arr::getValue($data, $task, 0, 'int');
if (empty($cid)) {
throw new Exception(Lang::txt($this->text_prefix . '_NO_ITEM_SELECTED'), 500);
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
\Hubzero\Utility\Arr::toInteger($cid);
// Publish the items.
if (!$model->setHome($cid, $value)) {
throw new Exception($model->getError(), 500);
} else {
if ($value == 1) {
$ntext = 'COM_MENUS_ITEMS_SET_HOME';
} else {
$ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
}
$this->setMessage(Lang::txts($ntext, count($cid)));
}
}
$this->setRedirect(Route::url('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
示例2: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
Request::setVar('hidemainmenu', true);
$isNew = $this->item->id == 0;
$canDo = TemplatesHelper::getActions();
Toolbar::title($isNew ? Lang::txt('COM_TEMPLATES_MANAGER_ADD_STYLE') : Lang::txt('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
Toolbar::apply('style.apply');
Toolbar::save('style.save');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
Toolbar::save2copy('style.save2copy');
}
if (empty($this->item->id)) {
Toolbar::cancel('style.cancel');
} else {
Toolbar::cancel('style.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
// Get the help information for the template item.
$lang = Lang::getRoot();
$help = $this->get('Help');
if ($lang->hasKey($help->url)) {
$debug = $lang->setDebug(false);
$url = Lang::txt($help->url);
$lang->setDebug($debug);
} else {
$url = null;
}
Toolbar::help('style');
//$help->key, false, $url);
}
示例3: publish
/**
* Method to set the publishing state for a row or list of rows in the database
* table. The method respects checked out rows by other users and will attempt
* to checkin rows that it can after adjustments are made.
*
* @param mixed An optional array of primary key values to update. If not
* set the instance property value is used.
* @param integer The publishing state. eg. [0 = unpublished, 1 = published]
* @param integer The user id of the user performing the operation.
* @return boolean True on success.
* @since 1.6
*/
public function publish($pks = null, $state = 1, $userId = 0)
{
// Initialise variables.
$k = $this->_tbl_key;
// Sanitize input.
\Hubzero\Utility\Arr::toInteger($pks);
$userId = (int) $userId;
$state = (int) $state;
// If there are no primary keys set check to see if the instance key is set.
if (empty($pks)) {
if ($this->{$k}) {
$pks = array($this->{$k});
} else {
$this->setError(Lang::txt('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
return false;
}
}
// Build the WHERE clause for the primary keys.
$where = $k . ' IN (' . implode(',', $pks) . ')';
// Update the publishing state for rows with the given primary keys.
$this->_db->setQuery('UPDATE ' . $this->_db->quoteName($this->_tbl) . ' SET ' . $this->_db->quoteName('state') . ' = ' . (int) $state . ' WHERE (' . $where . ')');
$this->_db->query();
// Check for a database error.
if ($this->_db->getErrorNum()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->{$k}, $pks)) {
$this->state = $state;
}
$this->setError('');
return true;
}
示例4: render
/**
* Generate macro output
*
* @return string
*/
public function render()
{
// check if we can render
if (!parent::canRender()) {
return \Lang::txt('[This macro is designed for Groups only]');
}
// get args
$args = $this->getArgs();
//array of filters
$filters = array('limit' => count($args) == 1 && is_numeric($args[0]) ? $args[0] : 12);
// get members
$members = $this->getGroupMembers($this->group, $filters);
//are we a group member
$isMember = in_array(\User::get('id'), $this->group->get('members')) ? true : false;
//get the members plugin access for this group
$memberAccess = \Hubzero\User\Group\Helper::getPluginAccess($this->group, 'members');
// make sure we can actually display for the current user
if ($memberAccess == 'anyone' || $memberAccess == 'registered' && !\User::isGuest() || $memberAccess == 'members' && $isMember) {
$html = $this->renderMembers($this->group, $members);
} else {
$html = '';
}
//return rendered events
return $html;
}
示例5: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
require_once dirname(__DIR__) . DS . 'models' . DS . 'poll.php';
$options = \Components\Poll\Models\Poll::all()->whereEquals('published', 1)->rows()->raw();
array_unshift($options, \Html::select('option', '0', '- ' . \Lang::txt('Select Poll') . ' -', 'id', 'title'));
return \Html::select('genericlist', $options, $control_name . '[' . $name . ']', 'class="inputbox"', 'id', 'title', $value, $control_name . $name);
}
示例6: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
Request::setVar('hidemainmenu', 1);
$isNew = empty($this->item->lang_id);
$canDo = LanguagesHelper::getActions();
Toolbar::title(Lang::txt($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'langmanager.png');
// If a new item, can save.
if ($isNew && $canDo->get('core.create')) {
Toolbar::save('language.save');
}
//If an existing item, allow to Apply and Save.
if (!$isNew && $canDo->get('core.edit')) {
Toolbar::apply('language.apply');
Toolbar::save('language.save');
}
// If an existing item, can save to a copy only if we have create rights.
if ($canDo->get('core.create')) {
Toolbar::save2new('language.save2new');
}
if ($isNew) {
Toolbar::cancel('language.cancel');
} else {
Toolbar::cancel('language.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
Toolbar::help('language');
}
示例7: render
/**
* Generate macro output
*
* @return string
*/
public function render()
{
// check if we can render
if (!parent::canRender()) {
return \Lang::txt('[This macro is designed for Groups only]');
}
// get args
$args = $this->getArgs();
// get details
$type = $this->_getType($args, 'all');
$limit = $this->_getLimit($args, 5);
$class = $this->_getClass($args);
//get resources
$groupResources = $this->_getResources($type, $limit);
$html = '<div class="resources ' . $class . '">';
foreach ($groupResources as $resource) {
$area = strtolower(preg_replace("/[^a-zA-Z0-9]/", '', $resource->area));
$resourceLink = \Route::url('index.php?option=com_resources&id=' . $resource->id);
$resourceTypeLink = \Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=resources&area=' . $area);
$html .= '<a href="' . $resourceLink . '"><strong>' . $resource->title . '</strong></a>';
$html .= '<p class="category"> in: <a href="' . $resourceTypeLink . '">' . $resource->area . '</a></p>';
$html .= '<p>' . \Hubzero\Utility\String::truncate($resource->itext) . '</p>';
}
$html .= '</div>';
return $html;
}
示例8: getInstance
/**
* Returns a reference to a Format object, only creating it
* if it doesn't already exist.
*
* @param string $type The format to load
* @return object Registry format handler
*/
public static function getInstance($type)
{
// Initialize static variable.
static $instances;
if (!isset($instances)) {
$instances = array();
}
// Sanitize format type.
$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));
// Only instantiate the object if it doesn't already exist.
if (!isset($instances[$type])) {
// Only load the file the class does not exist.
$class = __NAMESPACE__ . '\\Format\\' . $type;
if (!class_exists($class)) {
$path = __DIR__ . '/format/' . $type . '.php';
if (is_file($path)) {
include_once $path;
} else {
throw new Exception(Lang::txt('Format not found.'), 500, E_ERROR);
}
}
$instances[$type] = new $class();
}
return $instances[$type];
}
示例9: addToolbar
/**
* Display the toolbar.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
Request::setVar('hidemainmenu', 1);
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
$canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
Toolbar::apply('note.apply');
Toolbar::save('note.save');
}
if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
Toolbar::save2new('note.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
Toolbar::save2copy('note.save2copy');
}
if (empty($this->item->id)) {
Toolbar::cancel('note.cancel');
} else {
Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
Toolbar::help('note');
}
示例10: onGetCaptcha
/**
* Displays either a CAPTCHA image or form field
*
* @return string
*/
public function onGetCaptcha($error = '')
{
// make sure we have the needed recaptcha API keys
if (!$this->params->get('public') || !$this->params->get('private')) {
return '<p class="error">' . Lang::txt('PLG_HUBZERO_RECAPTCHA_API_NEEDED') . '</p>';
}
// recaptcha html structure
// this has support for users with js off
$html = '<label class=""> </label><div class="field-wrap">';
$html .= '<div class="g-recaptcha" data-type="' . $this->params->get('type', 'image') . '" data-theme="' . $this->params->get('theme', 'light') . '" data-sitekey="' . $this->params->get('public') . '"></div>
<noscript>
<div style="width: 302px; height: 352px;">
<div style="width: 302px; height: 352px; position: relative;">
<div style="width: 302px; height: 352px; position: absolute;">
<iframe src="' . static::$_jsFallbackUrl . $this->params->get('public') . '"
frameborder="0" scrolling="no"
style="width: 302px; height:352px; border-style: none;">
</iframe>
</div>
<div style="width: 250px; height: 80px; position: absolute; border-style: none;
bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
<textarea id="g-recaptcha-response" name="g-recaptcha-response"
class="g-recaptcha-response"
style="width: 250px; height: 80px; border: 1px solid #c1c1c1;
margin: 0px; padding: 0px; resize: none;" value="">
</textarea>
</div>
</div>
</div>
</noscript>
<script type="text/javascript" src="' . static::$_jsUrl . '?hl=' . $this->params->get('language', 'en') . '" async defer></script>';
$html .= '</div>';
return $html;
}
示例11: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = NewsfeedsHelper::getActions($state->get('filter.category_id'));
Toolbar::title(Lang::txt('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'newsfeeds.png');
if (count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
Toolbar::addNew('newsfeed.add');
}
if ($canDo->get('core.edit')) {
Toolbar::editList('newsfeed.edit');
}
if ($canDo->get('core.edit.state')) {
Toolbar::divider();
Toolbar::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
Toolbar::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
Toolbar::divider();
Toolbar::archiveList('newsfeeds.archive');
}
if ($canDo->get('core.admin')) {
Toolbar::checkin('newsfeeds.checkin');
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
Toolbar::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
Toolbar::divider();
} elseif ($canDo->get('core.edit.state')) {
Toolbar::trash('newsfeeds.trash');
Toolbar::divider();
}
if ($canDo->get('core.admin')) {
Toolbar::preferences('com_newsfeeds');
Toolbar::divider();
}
Toolbar::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
}
示例12: onCourse
/**
* Return data on a course view (this will be some form of HTML)
*
* @param object $course Current course
* @param object $offering Name of the component
* @param boolean $describe Return plugin description only?
* @return object
*/
public function onCourse($course, $offering, $describe = false)
{
$response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('default_access', 'registered')->set('display_menu_tab', false);
if ($describe) {
return $response;
}
if (!($active = Request::getVar('active'))) {
Request::setVar('active', $active = $this->_name);
}
if ($response->get('name') == $active) {
// Things we need from the form
$recvEmailOptionID = Request::getInt('memberoptionid', 0);
$recvEmailOptionValue = Request::getInt('recvpostemail', 0);
include_once __DIR__ . DS . 'memberoption.class.php';
switch ($action) {
case 'editmemberoptions':
$response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
break;
case 'savememberoptions':
$response->set('html', $this->save($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
break;
default:
$response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
break;
}
}
// Return the output
return $response;
}
示例13: onUsageDisplay
/**
* Event call for displaying usage data
*
* @param string $option Component name
* @param string $task Component task
* @param object $db JDatabase
* @param array $months Month names (Jan -> Dec)
* @param array $monthsReverse Month names in reverse (Dec -> Jan)
* @param string $enddate Time period
* @return string HTML
*/
public function onUsageDisplay($option, $task, $db, $months, $monthsReverse, $enddate)
{
// Check if our task is the area we want to return results for
if ($task) {
if (!in_array($task, $this->onUsageAreas()) && !in_array($task, array_keys($this->onUsageAreas()))) {
return '';
}
}
// Set some vars
$thisyear = date("Y");
$o = \Components\Usage\Helpers\Helper::options($db, $enddate, $thisyear, $monthsReverse, 'check_for_regiondata');
// Build HTML
$html = '<form method="post" action="' . Route::url('index.php?option=' . $option . '&task=' . $task) . '">' . "\n";
$html .= "\t" . '<fieldset class="filters">' . "\n";
$html .= "\t\t" . '<label>' . "\n";
$html .= "\t\t\t" . Lang::txt('PLG_USAGE_SHOW_DATA_FOR') . ': ' . "\n";
$html .= "\t\t\t" . '<select name="selectedPeriod" id="selectedPeriod">' . "\n";
$html .= $o;
$html .= "\t\t\t" . '</select>' . "\n";
$html .= "\t\t" . '</label> <input type="submit" value="' . Lang::txt('PLG_USAGE_VIEW') . '" />' . "\n";
$html .= "\t" . '</fieldset>' . "\n";
$html .= '</form>' . "\n";
$html .= \Components\Usage\Helpers\Helper::toplist($db, 10, 1, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 17, 2, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 11, 3, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 9, 4, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 12, 5, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 19, 6, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 18, 7, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 7, 8, $enddate);
// Return HTML
return $html;
}
示例14: displayTask
/**
* Display a list of uninstalled extensions
*
* @return void
*/
public function displayTask()
{
$model = new Models\Database();
// Get data from the model
$this->view->state = $model->getState();
$this->view->changeSet = $model->getItems();
$this->view->errors = $this->view->changeSet->check();
$this->view->results = $this->view->changeSet->getStatus();
$this->view->schemaVersion = $this->getSchemaVersion();
$this->view->updateVersion = $this->getUpdateVersion();
$this->view->filterParams = $this->getDefaultTextFilters();
$this->view->schemaVersion = $this->view->schemaVersion ? $this->view->schemaVersion : Lang::txt('JNONE');
$this->view->updateVersion = $this->view->updateVersion ? $this->view->updateVersion : Lang::txt('JNONE');
$this->view->pagination = $model->getPagination();
$this->view->errorCount = count($this->errors);
$errors = count($this->view->errors);
if ($this->view->schemaVersion != $this->view->changeSet->getSchema()) {
$this->view->errorCount++;
}
if (!$this->view->filterParams) {
$this->view->errorCount++;
}
if (version_compare($this->view->updateVersion, JVERSION) != 0) {
$this->view->errorCount++;
}
$this->view->ftp = \JClientHelper::setCredentialsFromRequest('ftp');
$showMessage = false;
if (is_object($this->view->state)) {
$message1 = $this->view->state->get('message');
$message2 = $this->view->state->get('extension_message');
$showMessage = $message1 || $message2;
}
$this->view->showMessage = $showMessage;
$this->view->display();
}
示例15: addSubmenu
/**
* Configure the Linkbar.
*
* @param string The name of the active view.
*/
public static function addSubmenu($vName)
{
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_INSTALLED_SITE'), Route::url('index.php?option=com_languages&view=installed&client=0'), $vName == 'installed');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_INSTALLED_ADMINISTRATOR'), Route::url('index.php?option=com_languages&view=installed&client=1'), $vName == 'installed');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_CONTENT'), Route::url('index.php?option=com_languages&view=languages'), $vName == 'languages');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_OVERRIDES'), Route::url('index.php?option=com_languages&view=overrides'), $vName == 'overrides');
}