本文整理汇总了PHP中JFactory::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getLanguage方法的具体用法?PHP JFactory::getLanguage怎么用?PHP JFactory::getLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchHead
public static function fetchHead($params, $module)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$template = $mainframe->getTemplate();
JHTML::_('behavior.framework');
$language = JFactory::getLanguage();
$mapApi = 'http://maps.google.com/maps/api/js?sensor=true&language=' . $language->getTag();
if ($params->get('weather')) {
$mapApi .= '&libraries=weather';
}
$document->addScript($mapApi);
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/js/default.js')) {
$document->addScript(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/js/default.js');
} else {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/btbase64.min.js');
if ($params->get('enable-custom-infobox')) {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/infobox.js');
}
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/default.js');
}
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/css/styles.css')) {
$document->addStyleSheet(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/css/style.css');
} else {
$document->addStyleSheet(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/css/style.css');
}
}
示例2: getFolderList
/**
* Image Manager Popup
*
* @param string $listFolder The image directory to display
* @since 1.5
*/
function getFolderList($base = null)
{
global $mainframe;
// Get some paths from the request
if (empty($base)) {
$base = JA_WORKING_DATA_FOLDER;
}
// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', 4, true);
// Load appropriate language files
$lang =& JFactory::getLanguage();
$lang->load(JRequest::getCmd('option'), JPATH_ADMINISTRATOR);
$document =& JFactory::getDocument();
$document->setTitle(JText::_('Insert Image'));
// Build the array of select options for the folder list
$options[] = JHTML::_('select.option', "", "/");
foreach ($folders as $folder) {
$folder = str_replace(JA_WORKING_DATA_FOLDER, "", $folder);
$value = substr($folder, 1);
$text = str_replace(DS, "/", $folder);
$options[] = JHTML::_('select.option', $value, $text);
}
// Sort the folder list array
if (is_array($options)) {
sort($options);
}
// Create the drop-down folder select list
$list = JHTML::_('select.genericlist', $options, 'folderlist', "class=\"inputbox\" size=\"1\" onchange=\"ImageManager.setFolder(this.options[this.selectedIndex].value)\" ", 'value', 'text', $base);
return $list;
}
示例3: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$language = JFactory::getLanguage();
// create a unique id
$id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
// add javascript if element has parameters
if ($node->attributes('parameters')) {
$document = JFactory::getDocument();
$document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");');
}
// path to directory
$path = WF_EDITOR_EXTENSIONS . DS . 'filesystem';
$filter = '\\.xml$';
$files = JFolder::files($path, $filter, false, true);
$options = array();
if (!$node->attributes('exclude_default')) {
$options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
}
if (is_array($files)) {
foreach ($files as $file) {
// load language file
$language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
$xml = JApplicationHelper::parseXMLInstallFile($file);
$options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
}
}
return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
}
示例4: getGroups
/**
* Method to get the list of template style options
* grouped by template.
* Use the client attribute to specify a specific client.
* Use the template attribute to specify a specific template
*
* @return array The field option objects as a nested array in groups.
*
* @since 11.1
*/
protected function getGroups()
{
// Initialize variables.
$groups = array();
$lang = JFactory::getLanguage();
// Get the client and client_id.
$clientName = $this->element['client'] ? (string) $this->element['client'] : 'site';
$client = JApplicationHelper::getClientInfo($clientName, true);
// Get the template.
$template = (string) $this->element['template'];
// Get the database object and a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Build the query.
$query->select('s.id, s.title, e.name as name, s.template');
$query->from('#__template_styles as s');
$query->where('s.client_id = ' . (int) $client->id);
$query->order('template');
$query->order('title');
if ($template)
{
$query->where('s.template = ' . $db->quote($template));
}
$query->join('LEFT', '#__extensions as e on e.element=s.template');
$query->where('e.enabled=1');
// Set the query and load the styles.
$db->setQuery($query);
$styles = $db->loadObjectList();
// Build the grouped list array.
if ($styles)
{
foreach ($styles as $style)
{
$template = $style->template;
$lang->load('tpl_' . $template . '.sys', $client->path, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path, $lang->getDefault(), false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, $lang->getDefault(), false, false);
$name = JText::_($style->name);
// Initialize the group if necessary.
if (!isset($groups[$name]))
{
$groups[$name] = array();
}
$groups[$name][] = JHtml::_('select.option', $style->id, $style->title);
}
}
// Merge any additional groups in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}
示例5: getOptions
public function getOptions()
{
// Must load admin language files
$lang = JFactory::getLanguage();
$lang->load("com_jevents", JPATH_ADMINISTRATOR);
$views = array();
include_once JPATH_ADMINISTRATOR . "/components/com_jevents/jevents.defines.php";
$exceptions_values = (string) $this->element['except'] ? (string) $this->element['except'] : "";
$exceptions = array();
$exceptions = explode(',', $exceptions_values);
foreach (JEV_CommonFunctions::getJEventsViewList((string) $this->element["viewtype"]) as $viewfile) {
if (in_array($viewfile, $exceptions)) {
continue;
}
$views[] = JHTML::_('select.option', $viewfile, $viewfile);
}
sort($views);
if ($this->menu != 'hide') {
$task = JRequest::getVar('task');
if ($task == "params.edit") {
unset($views['global']);
} else {
array_unshift($views, JHTML::_('select.option', 'global', JText::_('USE_GLOBAL')));
}
}
return $views;
}
示例6: getOptions
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*
* @since 11.4
*/
protected function getOptions()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select('c.id, c.country, c.country_jtext');
$query->from('`#__tj_country` AS c');
$query->where('c.com_quick2cart = 1');
$query->order($db->escape('c.ordering ASC'));
$db->setQuery($query);
// Get all countries.
$countries = $db->loadObjectList();
$options = array();
// Load lang file for countries
$lang = JFactory::getLanguage();
$lang->load('tjgeo.countries', JPATH_SITE, null, false, true);
foreach ($countries as $c) {
if ($lang->hasKey(strtoupper($c->country_jtext))) {
$c->country = JText::_($c->country_jtext);
}
$options[] = JHtml::_('select.option', $c->id, $c->country);
}
if (!$this->loadExternally) {
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
}
return $options;
}
示例7: getItems
/**
* Gets menu items by attribute
*
* @param string $attributes The field name
* @param string $values The value of the field
* @param boolean $firstonly If true, only returns the first item found
*
* @return array
*/
public function getItems($attributes, $values, $firstonly = false)
{
$attributes = (array) $attributes;
$values = (array) $values;
$app = JApplication::getInstance('site');
if ($app->isSite()) {
// Filter by language if not set
if (($key = array_search('language', $attributes)) === false) {
if ($app->getLanguageFilter()) {
$attributes[] = 'language';
$values[] = array(JFactory::getLanguage()->getTag(), '*');
}
} elseif ($values[$key] === null) {
unset($attributes[$key]);
unset($values[$key]);
}
// Filter by access level if not set
if (($key = array_search('access', $attributes)) === false) {
$attributes[] = 'access';
$values[] = JFactory::getUser()->getAuthorisedViewLevels();
} elseif ($values[$key] === null) {
unset($attributes[$key]);
unset($values[$key]);
}
}
return parent::getItems($attributes, $values, $firstonly);
}
示例8: pagination_list_render
function pagination_list_render($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = null;
if ($list['start']['active']) {
$html .= "<div class=\"page-button\"><div class=\"start\">" . $list['start']['data'] . "</div></div>";
} else {
$html .= "<div class=\"page-button off\"><div class=\"start\">" . $list['start']['data'] . "</div></div>";
}
if ($list['previous']['active']) {
$html .= "<div class=\"page-button\"><div class=\"prev\">" . $list['previous']['data'] . "</div></div>";
} else {
$html .= "<div class=\"page-button\"><div class=\"prev\">" . $list['previous']['data'] . "</div></div>";
}
$html .= "\n<div class=\"pages\"><div class=\"page\">";
foreach ($list['pages'] as $page) {
$html .= $page['data'];
}
$html .= "\n</div></div>";
if ($list['next']['active']) {
$html .= "<div class=\"page-button\"><div class=\"next\">" . $list['next']['data'] . "</div></div>";
} else {
$html .= "<div class=\"page-button off\"><div class=\"next\">" . $list['next']['data'] . "</div></div>";
}
if ($list['end']['active']) {
$html .= "<div class=\"page-button\"><div class=\"end\">" . $list['end']['data'] . "</div></div>";
} else {
$html .= "<div class=\"page-button off\"><div class=\"end\">" . $list['end']['data'] . "</div></div>";
}
return $html;
}
示例9: display
/**
* Display the view
*/
public function display($tpl = null)
{
$params = JComponentHelper::getParams('com_tz_pinboard');
$img_size = $params->get('portfolio_image_size');
$this->assign('img_size', $img_size);
if (JRequest::getCmd('task') != 'lists') {
JFactory::getLanguage()->load('com_content');
if ($this->getLayout() == 'pagebreak') {
// TODO: This is really dogy - should change this one day.
$eName = JRequest::getVar('e_name');
$eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_CONTENT_PAGEBREAK_DOC_TITLE'));
$this->assignRef('eName', $eName);
parent::display($tpl);
return;
}
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = TZ_PinboardHelper::getActions($this->state->get('filter.category_id'));
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->assign('listsGroup', $this->get('FieldsGroup'));
$this->assign('listsTags', $this->get('Tags'));
$this->assign('listAttach', $this->get('Attachment'));
$this->assign('listEdit', $this->get('FieldsContent'));
$this->addToolbar();
}
parent::display($tpl);
}
示例10: mapslist
/**
* Creates a list of maps.
*
* @return array An array containing the maps that can be selected.
*
* @since 2.5
*/
public static function mapslist()
{
$lang = JFactory::getLanguage();
// Load the finder types.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('title AS text, id AS value');
$query->from($db->quoteName('#__finder_taxonomy'));
$query->where($db->quoteName('parent_id') . ' = 1');
$query->order('ordering, title ASC');
$db->setQuery($query);
try {
$rows = $db->loadObjectList();
} catch (RuntimeException $e) {
return;
}
// Compile the options.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('COM_FINDER_MAPS_BRANCHES'));
foreach ($rows as $row) {
$key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text)) ? FinderHelperLanguage::branchPlural($row->text) : $row->text;
$string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key));
$options[] = JHtml::_('select.option', $row->value, $string);
}
return $options;
}
示例11: quickiconButton
function quickiconButton($link, $image, $text)
{
global $mainframe;
$lang =& JFactory::getLanguage();
$template = $mainframe->getTemplate();
?>
<div style="float:<?php
echo $lang->isRTL() ? 'right' : 'left';
?>
;">
<div class="icon">
<a href="<?php
echo $link;
?>
">
<?php
echo JHTML::_('image.site', $image, '/templates/' . $template . '/images/header/', NULL, NULL, $text);
?>
<span><?php
echo $text;
?>
</span></a>
</div>
</div>
<?php
}
示例12: __construct
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
if (!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('system', 'hikashopuser');
if (version_compare(JVERSION, '2.5', '<')) {
jimport('joomla.html.parameter');
$this->params = new JParameter($plugin->params);
} else {
$this->params = new JRegistry($plugin->params);
}
}
$app = JFactory::getApplication();
$this->cart = $app->getUserState('com_hikashop.cart_id');
$this->wishlist = $app->getUserState('com_hikashop.wishlist_id');
$this->currency = $app->getUserState('com_hikashop.currency_id');
$this->entries = $app->getUserState('com_hikashop.entries_fields');
$this->checkout_fields_ok = $app->getUserState('com_hikashop.checkout_fields_ok', 0);
$this->checkout_fields = $app->getUserState('com_hikashop.checkout_fields');
$app = JFactory::getApplication();
if ($app->isAdmin() && @$_GET['option'] == 'com_plugins' && @$_GET['view'] == 'plugin' && (@$_GET['layout'] == 'edit' || @$_GET['task'] == 'edit')) {
$lang = JFactory::getLanguage();
$lang->load('com_hikashop', JPATH_SITE, null, true);
}
}
示例13: postflight
public function postflight(){
define('_FM_COM', 'com_profiles');
if(!defined('DS')) define('DS',DIRECTORY_SEPARATOR);
$lang = JFactory::getLanguage();
define('_MY_LANGUAGE',$lang->getTag());
define('_CLOSE_HREF','index.php');
$ABSOLUTE_URI = (getenv('HTTPS') == 'on') ? substr_replace( str_replace("http://", "https://", JURI::base() ), '', -1, 1) : substr_replace(JURI::base(), '', -1, 1) . "/";
define('_FM_ABSOLUTE_URI',$ABSOLUTE_URI);
define('_FM_HOME_URL', "index.php?option="._FM_COM."&format=raw");
define('_FM_HOME_FOLDER','components/'._FM_COM.'/filemanager');
define('_FM_HOME_DIR', JPATH_ROOT . '/administrator/components/'._FM_COM.'/filemanager');
define('_FM_LANGUAGE_DIR', _FM_HOME_DIR. DS.'languages');
define('_FM_COOKIE_EXPIRE', time()+60*60*24*60);
// Define Peer
define('_FM_PEER','joomla');
require_once _FM_HOME_DIR . DS . 'classes'.DS.'file.php';
require_once _FM_HOME_DIR . DS . 'classes'.DS.'text.php';
require_once _FM_HOME_DIR . DS .'includes'.DS.'version.php';
$infoTemplates = _FM_HOME_DIR . DS ."languages" . DS . "info";
$infoPath = $infoTemplates . DS . _MY_LANGUAGE . ".php" ;
if(!MFile::is($infoPath)){
$infoPath = $infoTemplates . DS . "en-GB.php";
}
$isWelcome = 1;
$jed = null;
$version=null;
require_once $infoPath;
} //EOF install
示例14: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = TemplatesHelper::getActions();
JToolBarHelper::title($isNew ? JText::_('COM_TEMPLATES_MANAGER_ADD_STYLE') : JText::_('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
// If not checked out, can save the item.
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('style.apply');
JToolBarHelper::save('style.save');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('style.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('style.cancel');
} else {
JToolBarHelper::cancel('style.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
// Get the help information for the template item.
$lang = JFactory::getLanguage();
$help = $this->get('Help');
if ($lang->hasKey($help->url)) {
$debug = $lang->setDebug(false);
$url = JText::_($help->url);
$lang->setDebug($debug);
} else {
$url = null;
}
JToolBarHelper::help($help->key, false, $url);
}
示例15: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 1.6
*/
protected function getOptions()
{
$lang = JFactory::getLanguage();
$options = array();
$type = $this->form->getValue('db_type');
// Some database drivers share DDLs; point these drivers to the correct parent
if ($type == 'mysqli') {
$type = 'mysql';
} elseif ($type == 'sqlsrv') {
$type = 'sqlazure';
}
// Get a list of files in the search path with the given filter.
$files = JFolder::files(JPATH_INSTALLATION . '/sql/' . $type, '^sample.*\\.sql$');
// Add option to not install sample data.
$options[] = JHtml::_('select.option', '', JHtml::_('tooltip', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE_DESC'), '', '', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE')));
// Build the options list from the list of files.
if (is_array($files)) {
foreach ($files as $file) {
$options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_' . ($file = JFile::stripExt($file)) . '_SET') ? JHtml::_('tooltip', JText::_('INSTL_' . strtoupper($file = JFile::stripExt($file)) . '_SET_DESC'), '', '', JText::_('INSTL_' . ($file = JFile::stripExt($file)) . '_SET')) : $file);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}