本文整理汇总了PHP中Lang::txts方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::txts方法的具体用法?PHP Lang::txts怎么用?PHP Lang::txts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::txts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notes
/**
* Displays a note icon.
*
* @param integer $count The number of notes for the user
* @param integer $userId The user ID
*
* @return string A link to a modal window with the user notes
*
* @since 2.5
*/
public static function notes($count, $userId)
{
if (empty($count)) {
return '';
}
$title = Lang::txts('COM_USERS_N_USER_NOTES', $count);
return '<a class="modal state notes"' . ' href="' . Route::url('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $userId) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 450}}" title="' . $title . '"><span>' . Lang::txt('COM_USERS_NOTES') . '</span></a>';
}
示例2: onContentBeforeDelete
/**
* Don't allow categories to be deleted if they contain items or subcategories with items
*
* @param string $context The context for the content passed to the plugin.
* @param object $data The data relating to the content that was deleted.
* @return boolean
*/
public function onContentBeforeDelete($context, $data)
{
// Skip plugin if we are deleting something other than categories
if ($context != 'com_categories.category') {
return true;
}
// Check if this function is enabled.
if (!$this->params->def('check_categories', 1)) {
return true;
}
$extension = Request::getString('extension');
// Default to true if not a core extension
$result = true;
$tableInfo = array('com_content' => array('table_name' => '#__content'), 'com_newsfeeds' => array('table_name' => '#__newsfeeds'));
// Now check to see if this is a known core extension
if (isset($tableInfo[$extension])) {
// Get table name for known core extensions
$table = $tableInfo[$extension]['table_name'];
// See if this category has any content items
$count = $this->_countItemsInCategory($table, $data->get('id'));
// Return false if db error
if ($count === false) {
$result = false;
} else {
// Show error if items are found in the category
if ($count > 0) {
$msg = Lang::txt('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) . Lang::txts('COM_CATEGORIES_N_ITEMS_ASSIGNED', $count);
Notify::warning(403, $msg);
$result = false;
}
// Check for items in any child categories (if it is a leaf, there are no child categories)
if (!$data->isLeaf()) {
$count = $this->_countItemsInChildren($table, $data->get('id'), $data);
if ($count === false) {
$result = false;
} elseif ($count > 0) {
$msg = Lang::txt('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) . Lang::txts('COM_CATEGORIES_HAS_SUBCATEGORY_ITEMS', $count);
Notify::warning(403, $msg);
$result = false;
}
}
}
return $result;
}
}
示例3: duplicate
/**
* Method to clone an existing module.
* @since 1.6
*/
public function duplicate()
{
// Check for request forgeries
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Initialise variables.
$pks = Request::getVar('cid', array(), 'post', 'array');
\Hubzero\Utility\Arr::toInteger($pks);
try {
if (empty($pks)) {
throw new Exception(Lang::txt('COM_MODULES_ERROR_NO_MODULES_SELECTED'));
}
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(Lang::txts('COM_MODULES_N_MODULES_DUPLICATED', count($pks)));
} catch (Exception $e) {
Notify::error($e->getMessage());
}
$this->setRedirect(Route::url('index.php?option=com_modules&view=modules', false));
}
示例4: delete
/**
* Method for deleting one or more overrides
*
* @return void
*
* @since 2.5
*/
public function delete()
{
// Check for request forgeries
Session::checkToken() or die(Lang::txt('JINVALID_TOKEN'));
// Get items to dlete from the request
$cid = Request::getVar('cid', array(), '', 'array');
if (!is_array($cid) || count($cid) < 1) {
$this->setMessage(Lang::txt($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning');
} else {
// Get the model
$model = $this->getModel('overrides');
// Remove the items
if ($model->delete($cid)) {
$this->setMessage(Lang::txts($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
} else {
$this->setMessage($model->getError());
}
}
$this->setRedirect(Route::url('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
示例5: delete
/**
* Removes an item
*/
public function delete()
{
// Check for request forgeries
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = Request::getVar('cid', array(), '', 'array');
if (!is_array($cid) || count($cid) < 1) {
Notify::error(Lang::txt('COM_MENUS_NO_MENUS_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
\Hubzero\Utility\Arr::toInteger($cid);
// Remove the items.
if (!$model->delete($cid)) {
$this->setMessage($model->getError());
} else {
$this->setMessage(Lang::txts('COM_MENUS_N_MENUS_DELETED', count($cid)));
}
}
$this->setRedirect('index.php?option=com_menus&view=menus');
}
示例6: delete
/**
* Method to remove a record.
*/
public function delete()
{
// Check for request forgeries.
Session::checkToken() or exit(Lang::txt('JInvalid_Token'));
// Initialise variables.
$ids = Request::getVar('cid', array(), '', 'array');
if (!User::authorise('core.admin', $this->option)) {
throw new Exception(Lang::txt('JERROR_ALERTNOAUTHOR'), 403);
} elseif (empty($ids)) {
throw new Exception(Lang::txt('COM_USERS_NO_LEVELS_SELECTED'), 500);
} else {
// Get the model.
$model = $this->getModel();
\Hubzero\Utility\Arr::toInteger($ids);
// Remove the items.
if (!$model->delete($ids)) {
throw new Exception($model->getError(), 500);
} else {
$this->setMessage(Lang::txts('COM_USERS_N_LEVELS_DELETED', count($ids)));
}
}
$this->setRedirect('index.php?option=com_users&view=levels');
}
示例7: upload
/**
* Upload a file
*
* @since 1.5
*/
function upload()
{
$params = Component::params('com_media');
// Check for request forgeries
if (!Session::checkToken(['get', 'post'], true)) {
$response = array('status' => '0', 'error' => Lang::txt('JINVALID_TOKEN'));
echo json_encode($response);
return;
}
// Get the user
$log = JLog::getInstance('upload.error.php');
// Get some data from the request
$file = Request::getVar('Filedata', '', 'files', 'array');
$folder = Request::getVar('folder', '', '', 'path');
$return = Request::getVar('return-url', null, 'post', 'base64');
if ($_SERVER['CONTENT_LENGTH'] > $params->get('upload_maxsize', 0) * 1024 * 1024 || $_SERVER['CONTENT_LENGTH'] > (int) ini_get('upload_max_filesize') * 1024 * 1024 || $_SERVER['CONTENT_LENGTH'] > (int) ini_get('post_max_size') * 1024 * 1024 || $_SERVER['CONTENT_LENGTH'] > (int) ini_get('memory_limit') * 1024 * 1024) {
$response = array('status' => '0', 'error' => Lang::txt('COM_MEDIA_ERROR_WARNFILETOOLARGE'));
echo json_encode($response);
return;
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
// Make the filename safe
$file['name'] = Filesystem::clean($file['name']);
if (isset($file['name'])) {
// The request is valid
$err = null;
$filepath = \Hubzero\Filesystem\Util::normalizePath(COM_MEDIA_BASE . '/' . $folder . '/' . strtolower($file['name']));
if (!MediaHelper::canUpload($file, $err)) {
$log->addEntry(array('comment' => 'Invalid: ' . $filepath . ': ' . $err));
$response = array('status' => '0', 'error' => Lang::txt($err));
echo json_encode($response);
return;
}
// Trigger the onContentBeforeSave event.
$object_file = new \Hubzero\Base\Object($file);
$object_file->filepath = $filepath;
$result = Event::trigger('content.onContentBeforeSave', array('com_media.file', &$object_file, true));
if (in_array(false, $result, true)) {
// There are some errors in the plugins
$log->addEntry(array('comment' => 'Errors before save: ' . $filepath . ' : ' . implode(', ', $object_file->getErrors())));
$response = array('status' => '0', 'error' => Lang::txts('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
echo json_encode($response);
return;
}
if (Filesystem::exists($filepath)) {
// File exists
$log->addEntry(array('comment' => 'File exists: ' . $filepath . ' by user_id ' . User::get('id')));
$response = array('status' => '0', 'error' => Lang::txt('COM_MEDIA_ERROR_FILE_EXISTS'));
echo json_encode($response);
return;
} elseif (!User::authorise('core.create', 'com_media')) {
// File does not exist and user is not authorised to create
$log->addEntry(array('comment' => 'Create not permitted: ' . $filepath . ' by user_id ' . User::get('id')));
$response = array('status' => '0', 'error' => Lang::txt('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'));
echo json_encode($response);
return;
}
$file = (array) $object_file;
if (!Filesystem::upload($file['tmp_name'], $file['filepath'])) {
// Error in upload
$log->addEntry(array('comment' => 'Error on upload: ' . $filepath));
$response = array('status' => '0', 'error' => Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE'));
echo json_encode($response);
return;
} else {
// Trigger the onContentAfterSave event.
Event::trigger('content.onContentAfterSave', array('com_media.file', &$object_file, true));
$log->addEntry(array('comment' => $folder));
$response = array('status' => '1', 'error' => Lang::txt('COM_MEDIA_UPLOAD_COMPLETE', substr($file['filepath'], strlen(COM_MEDIA_BASE))));
echo json_encode($response);
return;
}
} else {
$response = array('status' => '0', 'error' => Lang::txt('COM_MEDIA_ERROR_BAD_REQUEST'));
echo json_encode($response);
return;
}
}
示例8: delete
/** Deletes and returns correctly.
*
* @return void
* @since 2.5.12
*/
public function delete()
{
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = Request::getVar('cid', array(), '', 'array');
$extension = Request::getVar('extension', null);
if (!is_array($cid) || count($cid) < 1) {
Notify::error(Lang::txt($this->text_prefix . '_NO_ITEM_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
\Hubzero\Utility\Arr::toInteger($cid);
// Remove the items.
if ($model->delete($cid)) {
$this->setMessage(Lang::txts($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
} else {
$this->setMessage($model->getError());
}
}
$this->setRedirect(Route::url('index.php?option=' . $this->option . '&extension=' . $extension, false));
}
示例9: array
echo Html::asset('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true);
?>
<?php
}
?>
</td>
<td class="center priority-4">
<?php
if ($item->assigned > 0) {
?>
<span class="state yes" title="<?php
echo Lang::txts('COM_TEMPLATES_ASSIGNED', $item->assigned);
?>
">
<span class="text"><?php
echo Lang::txts('COM_TEMPLATES_ASSIGNED', $item->assigned);
?>
</span>
</span>
<?php
} else {
?>
 
<?php
}
?>
</td>
<td class="priority-5 center">
<?php
echo (int) $item->id;
?>
示例10: relative
/**
* Function to convert a static time into a relative measurement
*
* @param string $date The date to convert
* @param string $unit The optional unit of measurement to return
* if the value of the diff is greater than one
* @param string $time An optional time to compare to, defaults to now
* @return string The converted time string
*/
public function relative($unit = null, $time = null)
{
if (is_null($time)) {
// Get now
$time = new self('now');
}
// Get the difference in seconds between now and the time
$diff = strtotime($time) - strtotime($this);
// Less than a minute
if ($diff < 60) {
return \Lang::txt('JLIB_HTML_DATE_RELATIVE_LESSTHANAMINUTE');
}
// Round to minutes
$diff = round($diff / 60);
// 1 to 59 minutes
if ($diff < 60 || $unit == 'minute') {
return \Lang::txts('JLIB_HTML_DATE_RELATIVE_MINUTES', $diff);
}
// Round to hours
$diff = round($diff / 60);
// 1 to 23 hours
if ($diff < 24 || $unit == 'hour') {
return \Lang::txts('JLIB_HTML_DATE_RELATIVE_HOURS', $diff);
}
// Round to days
$diff = round($diff / 24);
// 1 to 6 days
if ($diff < 7 || $unit == 'day') {
return \Lang::txts('JLIB_HTML_DATE_RELATIVE_DAYS', $diff);
}
// Round to weeks
$diff = round($diff / 7);
// 1 to 4 weeks
if ($diff <= 4 || $unit == 'week') {
return \Lang::txts('JLIB_HTML_DATE_RELATIVE_WEEKS', $diff);
}
// [!] HUBZERO - Added months
// Round to months
/*$diff = round($diff / 4);
// 1 to 12 months
if ($diff <= 12 || $unit == 'month')
{
return \Lang::txt('%s months ago', $diff);
}*/
// [!] HUBZERO - Changed default to format "% days ago"
// Over a month, return the absolute time
$text = $this->_ago(strtotime($this), strtotime($time));
$parts = explode(' ', $text);
$text = $parts[0] . ' ' . $parts[1];
$text .= $parts[2] ? ' ' . $parts[2] . ' ' . $parts[3] : '';
return sprintf('%s ago', $text);
}
示例11: count
echo $this->module->module;
?>
">
<?php
if (count($this->unapproved) > 0) {
?>
<div class="pending-users">
<a href="<?php
echo Route::url('index.php?option=com_users&view=users&filter.approved=0');
?>
">
<span class="count"><?php
echo count($this->unapproved);
?>
</span>
<?php
echo Lang::txts('MOD_USERS_REQUIRE_APPROVAL', count($this->unapproved));
?>
</a>
</div>
<?php
} else {
?>
<div class="none"><?php
echo Lang::txt('MOD_USERS_ALL_CLEAR');
?>
</div>
<?php
}
?>
</div>
示例12: approve
/**
* Method to approve users
*
* @return void
*/
public function approve()
{
// Check for request forgeries.
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Initialise variables.
$ids = Request::getVar('cid', array(), '', 'array');
if (empty($ids)) {
throw new Exception(Lang::txt('COM_USERS_USERS_NO_ITEM_SELECTED'), 500);
} else {
// Get the model.
$model = $this->getModel();
// Change the state of the records.
if (!$model->approve($ids)) {
throw new Exception($model->getError(), 500);
} else {
$this->setMessage(Lang::txts('COM_USERS_N_USERS_APPROVED', count($ids)));
}
}
$this->setRedirect('index.php?option=com_users&view=users');
}
示例13: delete
/**
* Deletes paths from the current path
*
* @since 1.5
*/
public function delete()
{
Session::checkToken(['get', 'post']);
// Get some data from the request
$tmpl = Request::getCmd('tmpl');
$paths = Request::getVar('rm', array(), '', 'array');
$folder = Request::getVar('folder', '', '', 'path');
$redirect = 'index.php?option=com_media&folder=' . $folder;
if ($tmpl == 'component') {
// We are inside the iframe
$redirect .= '&view=mediaList&tmpl=component';
}
$this->setRedirect($redirect);
// Nothing to delete
if (empty($paths)) {
return true;
}
// Authorize the user
if (!$this->authoriseUser('delete')) {
return false;
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
// Initialise variables.
$ret = true;
foreach ($paths as $path) {
if ($path !== Filesystem::clean($path)) {
// filename is not safe
$filename = htmlspecialchars($path, ENT_COMPAT, 'UTF-8');
Notify::warning(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FILE_WARNFILENAME', substr($filename, strlen(COM_MEDIA_BASE))));
continue;
}
$fullPath = Filesystem::cleanPath(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $folder, $path)));
$object_file = new \Hubzero\Base\Object(array('filepath' => $fullPath));
if (is_file($fullPath)) {
// Trigger the onContentBeforeDelete event.
$result = Event::trigger('content.onContentBeforeDelete', array('com_media.file', &$object_file));
if (in_array(false, $result, true)) {
// There are some errors in the plugins
Notify::warning(Lang::txts('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
continue;
}
$ret &= Filesystem::delete($fullPath);
// Trigger the onContentAfterDelete event.
Event::trigger('content.onContentAfterDelete', array('com_media.file', &$object_file));
$this->setMessage(Lang::txt('COM_MEDIA_DELETE_COMPLETE', substr($fullPath, strlen(COM_MEDIA_BASE))));
} elseif (is_dir($fullPath)) {
$contents = Filesystem::files($fullPath, '.', true, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html'));
if (empty($contents)) {
// Trigger the onContentBeforeDelete event.
$result = Event::trigger('content.onContentBeforeDelete', array('com_media.folder', &$object_file));
if (in_array(false, $result, true)) {
// There are some errors in the plugins
Notify::warning(Lang::txts('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
continue;
}
$ret &= Filesystem::deleteDirectory($fullPath);
// Trigger the onContentAfterDelete event.
Event::trigger('content.onContentAfterDelete', array('com_media.folder', &$object_file));
$this->setMessage(Lang::txt('COM_MEDIA_DELETE_COMPLETE', substr($fullPath, strlen(COM_MEDIA_BASE))));
} else {
// This makes no sense...
Notify::warning(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_NOT_EMPTY', substr($fullPath, strlen(COM_MEDIA_BASE))));
}
}
}
return $ret;
}
示例14: create
/**
* Create a folder
*
* @param string $path Path of the folder to create
* @since 1.5
*/
public function create()
{
// Check for request forgeries
Session::checkToken(['get', 'post']);
$folder = Request::getCmd('foldername', '');
$folderCheck = Request::getVar('foldername', null, '', 'string', JREQUEST_ALLOWRAW);
$parent = Request::getVar('folderbase', '', '', 'path');
$this->setRedirect('index.php?option=com_media&folder=' . $parent . '&tmpl=' . Request::getCmd('tmpl', 'index'));
if (strlen($folder) > 0) {
if (!User::authorise('core.create', 'com_media')) {
// User is not authorised to delete
Notify::warning(Lang::txt('JLIB_APPLICATION_ERROR_CREATE_NOT_PERMITTED'));
return false;
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
Request::setVar('folder', $parent);
if ($folderCheck !== null && $folder !== $folderCheck) {
$this->setMessage(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_CREATE_FOLDER_WARNDIRNAME'));
return false;
}
$path = \Hubzero\Filesystem\Util::normalizePath(COM_MEDIA_BASE . '/' . $parent . '/' . $folder);
if (!is_dir($path) && !is_file($path)) {
// Trigger the onContentBeforeSave event.
$object_file = new \Hubzero\Base\Object(array('filepath' => $path));
$result = Event::trigger('content.onContentBeforeSave', array('com_media.folder', &$object_file, true));
if (in_array(false, $result, true)) {
// There are some errors in the plugins
Notify::warning(Lang::txts('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
return false;
}
Filesystem::makeDirectory($path);
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
Filesystem::write($path . "/index.html", $data);
// Trigger the onContentAfterSave event.
Event::trigger('content.onContentAfterSave', array('com_media.folder', &$object_file, true));
$this->setMessage(Lang::txt('COM_MEDIA_CREATE_COMPLETE', substr($path, strlen(COM_MEDIA_BASE))));
}
Request::setVar('folder', $parent ? $parent . '/' . $folder : $folder);
}
}
示例15: array
echo Html::sliders('start', 'database-sliders', array('useCookie' => 1));
?>
<?php
} else {
?>
<p class="warning"><?php
echo Lang::txt('COM_INSTALLER_MSG_DATABASE_ERRORS');
?>
</p>
<?php
echo Html::sliders('start', 'database-sliders', array('useCookie' => 1));
?>
<?php
$panelName = Lang::txts('COM_INSTALLER_MSG_N_DATABASE_ERROR_PANEL', $this->errorCount);
?>
<?php
echo Html::sliders('panel', $panelName, 'error-panel');
?>
<fieldset class="panelform">
<ul>
<?php
if (!$this->filterParams) {
?>
<li><?php
echo Lang::txt('COM_INSTALLER_MSG_DATABASE_FILTER_ERROR');
?>
<?php
}
?>