当前位置: 首页>>代码示例>>PHP>>正文


PHP LanguagesHelper类代码示例

本文整理汇总了PHP中LanguagesHelper的典型用法代码示例。如果您正苦于以下问题:PHP LanguagesHelper类的具体用法?PHP LanguagesHelper怎么用?PHP LanguagesHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LanguagesHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since  1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     JFactory::getApplication()->input->set('hidemainmenu', 1);
     $isNew = empty($this->item->lang_id);
     $canDo = LanguagesHelper::getActions();
     JToolbarHelper::title(JText::_($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')) {
         JToolbarHelper::save('language.save');
     }
     //If an existing item, allow to Apply and Save.
     if (!$isNew && $canDo->get('core.edit')) {
         JToolbarHelper::apply('language.apply');
         JToolbarHelper::save('language.save');
     }
     // If an existing item, can save to a copy only if we have create rights.
     if ($canDo->get('core.create')) {
         JToolbarHelper::save2new('language.save2new');
     }
     if ($isNew) {
         JToolbarHelper::cancel('language.cancel');
     } else {
         JToolbarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_EDIT');
     $this->sidebar = JHtmlSidebar::render();
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:34,代码来源:view.html.php

示例2: refresh

 /**
  * Method for refreshing the cache in the database with the known language strings
  *
  * @return	boolean	True on success, Exception object otherwise
  *
  * @since		2.5
  */
 public function refresh()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     $app = JFactory::getApplication();
     $app->setUserState('com_languages.overrides.cachedtime', null);
     // Empty the database cache first
     try {
         $this->_db->setQuery('TRUNCATE TABLE ' . $this->_db->qn('#__overrider'));
         $this->_db->query();
     } catch (JDatabaseException $e) {
         return $e;
     }
     // Create the insert query
     $query = $this->_db->getQuery(true)->insert($this->_db->qn('#__overrider'))->columns('constant, string, file');
     // Initialize some variables
     $client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site';
     $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
     $base = constant('JPATH_' . strtoupper($client)) . DS;
     $path = $base . 'language' . DS . $language;
     $files = array();
     // Parse common language directory
     if (JFolder::exists($path)) {
         $files = JFolder::files($path, $language . '.*ini$', false, true);
     }
     // Parse language directories of components
     $path = $base . 'components';
     $files = array_merge($files, JFolder::files($path, $language . '.*ini$', 3, true));
     // Parse language directories of modules
     $path = $base . 'modules';
     $files = array_merge($files, JFolder::files($path, $language . '.*ini$', 3, true));
     // Parse language directories of templates
     $path = $base . 'templates';
     $files = array_merge($files, JFolder::files($path, $language . '.*ini$', 3, true));
     // Parse language directories of plugins
     $path = JPATH_ROOT . DS . 'plugins';
     $files = array_merge($files, JFolder::files($path, $language . '.*ini$', 3, true));
     // Parse all found ini files and add the strings to the database cache
     foreach ($files as $file) {
         $strings = LanguagesHelper::parseFile($file);
         if ($strings && count($strings)) {
             //$query->clear('values');
             $values = array();
             foreach ($strings as $key => $string) {
                 //$query->values($this->_db->q($key).','.$this->_db->q($string).','.$this->_db->q(JPath::clean($file)));
                 $values[] = '(' . $this->_db->q($key) . ',' . $this->_db->q($string) . ',' . $this->_db->q(JPath::clean($file)) . ')';
             }
             try {
                 $this->_db->setQuery($query . ' (constant, string, file) VALUES ' . implode(',', $values));
                 if (!$this->_db->query()) {
                     return new Exception($this->_db->getErrorMsg());
                 }
             } catch (JDatabaseException $e) {
                 return $e;
             }
         }
     }
     // Update the cached time
     $app->setUserState('com_languages.overrides.cachedtime.' . $client . '.' . $language, time());
     return true;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:67,代码来源:strings.php

示例3: 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');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:view.html.php

示例4: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     $canDo = LanguagesHelper::getActions();
     JToolBarHelper::title(JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'langmanager.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('language.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('language.edit');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.published') != 2) {
             JToolBarHelper::publishList('languages.publish');
             JToolBarHelper::unpublishList('languages.unpublish');
         }
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('languages.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_languages');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT');
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:36,代码来源:view.html.php

示例5: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     JRequest::setVar('hidemainmenu', 1);
     $isNew = empty($this->item->lang_id);
     $canDo = LanguagesHelper::getActions();
     JToolBarHelper::title(JText::_($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')) {
         JToolBarHelper::save('language.save', 'JTOOLBAR_SAVE');
     }
     //If an existing item, allow to Apply and Save.
     if (!$isNew && $canDo->get('core.edit')) {
         JToolBarHelper::apply('language.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('language.save', 'JTOOLBAR_SAVE');
     }
     // If an existing item, can save to a copy only if we have create rights.
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('language.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     if ($isNew) {
         JToolBarHelper::cancel('language.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_EDIT');
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:33,代码来源:view.html.php

示例6: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     $canDo = LanguagesHelper::getActions();
     JToolBarHelper::title(JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'langmanager.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('language.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('language.edit');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.published') != 2) {
             JToolBarHelper::publishList('languages.publish');
             JToolBarHelper::unpublishList('languages.unpublish');
         }
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('languages.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         // Add install languages link to the lang installer component
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Link', 'extension', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_languages');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT');
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:40,代码来源:view.html.php

示例7: refresh

 /**
  * Method for refreshing the cache in the database with the known language strings.
  *
  * @return  boolean  True on success, Exception object otherwise.
  *
  * @since		2.5
  */
 public function refresh()
 {
     JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php');
     $app = JFactory::getApplication();
     $app->setUserState('com_languages.overrides.cachedtime', null);
     // Empty the database cache first.
     try {
         $this->_db->setQuery('TRUNCATE TABLE ' . $this->_db->quoteName('#__overrider'));
         $this->_db->execute();
     } catch (RuntimeException $e) {
         return $e;
     }
     // Create the insert query.
     $query = $this->_db->getQuery(true)->insert($this->_db->quoteName('#__overrider'))->columns('constant, string, file');
     // Initialize some variables.
     $client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site';
     $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
     $base = constant('JPATH_' . strtoupper($client));
     $path = $base . '/language/' . $language;
     $files = array();
     // Parse common language directory.
     jimport('joomla.filesystem.folder');
     if (is_dir($path)) {
         $files = JFolder::files($path, $language . '.*ini$', false, true);
     }
     // Parse language directories of components.
     $files = array_merge($files, JFolder::files($base . '/components', $language . '.*ini$', 3, true));
     // Parse language directories of modules.
     $files = array_merge($files, JFolder::files($base . '/modules', $language . '.*ini$', 3, true));
     // Parse language directories of templates.
     $files = array_merge($files, JFolder::files($base . '/templates', $language . '.*ini$', 3, true));
     // Parse language directories of plugins.
     $files = array_merge($files, JFolder::files(JPATH_PLUGINS, $language . '.*ini$', 3, true));
     // Parse all found ini files and add the strings to the database cache.
     foreach ($files as $file) {
         $strings = LanguagesHelper::parseFile($file);
         if ($strings && count($strings)) {
             $query->clear('values');
             foreach ($strings as $key => $string) {
                 $query->values($this->_db->quote($key) . ',' . $this->_db->quote($string) . ',' . $this->_db->quote(JPath::clean($file)));
             }
             try {
                 $this->_db->setQuery($query);
                 $this->_db->execute();
             } catch (RuntimeException $e) {
                 return $e;
             }
         }
     }
     // Update the cached time.
     $app->setUserState('com_languages.overrides.cachedtime.' . $client . '.' . $language, time());
     return true;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:60,代码来源:strings.php

示例8: display

 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->ftp = $this->get('Ftp');
     $this->option = $this->get('Option');
     $this->pagination = $this->get('Pagination');
     $this->rows = $this->get('Data');
     $this->state = $this->get('State');
     $client = (int) $this->state->get('filter.client_id', 0);
     LanguagesHelper::addSubmenu('installed', $client);
     $this->addToolbar();
     parent::display($tpl);
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:15,代码来源:view.html.php

示例9: display

 /**
  * Displays the view.
  *
  * @param   string  $tpl  The name of the template file to parse.
  *
  * @return  void
  *
  * @since   2.5
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Overrides');
     $this->languages = $this->get('Languages');
     $this->pagination = $this->get('Pagination');
     LanguagesHelper::addSubmenu('overrides');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $this->addToolbar();
     parent::display($tpl);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:23,代码来源:view.html.php

示例10: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     $canDo = LanguagesHelper::getActions();
     JToolBarHelper::title(JText::_('COM_LANGUAGES_VIEW_INSTALLED_TITLE'), 'langmanager.png');
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::makeDefault('installed.setDefault');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_languages');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_INSTALLED');
 }
开发者ID:Nechoj23,项目名称:SVI-Homepage,代码行数:20,代码来源:view.html.php

示例11: display

 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     // Load the submenu.
     LanguagesHelper::addSubmenu(JRequest::getCmd('view', 'installed'));
     $view = JRequest::getCmd('view', 'languages');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     // Check for edit form.
     if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_languages&view=languages', false));
         return false;
     }
     parent::display();
     return $this;
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:28,代码来源:controller.php

示例12: addToolbar

 /**
  * Adds the page title and toolbar
  *
  * @return void
  *
  * @since	2.5
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $canDo = LanguagesHelper::getActions();
     JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'comments-2 langmanager');
     if ($canDo->get('core.edit')) {
         JToolbarHelper::apply('override.apply');
         JToolbarHelper::save('override.save');
     }
     // This component does not support Save as Copy
     if ($canDo->get('core.edit') && $canDo->get('core.create')) {
         JToolbarHelper::save2new('override.save2new');
     }
     if (empty($this->item->key)) {
         JToolbarHelper::cancel('override.cancel');
     } else {
         JToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:28,代码来源:view.html.php

示例13: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     $canDo = LanguagesHelper::getActions();
     JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'langmanager.png');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('language.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('language.edit');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.published') != 2) {
             JToolbarHelper::publishList('languages.publish');
             JToolbarHelper::unpublishList('languages.unpublish');
         }
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolbarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('languages.trash');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         // Add install languages link to the lang installer component
         $bar = JToolbar::getInstance('toolbar');
         $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
         JToolbarHelper::divider();
         JToolbarHelper::preferences('com_languages');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT');
     JHtmlSidebar::setAction('index.php?option=com_languages&view=languages');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
 }
开发者ID:RuDers,项目名称:JoomlaSQL,代码行数:43,代码来源:view.html.php

示例14: display

 /**
  * task to display the view
  */
 function display()
 {
     // Get the document object.
     $document =& JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'installed');
     $vFormat = $document->getType();
     $lName = JRequest::getWord('layout', 'default');
     // Get and render the view.
     if ($view =& $this->getView($vName, $vFormat)) {
         // Get the model for the view.
         $model =& $this->getModel($vName);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         $view->display();
         // Load the submenu.
         require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'languages.php';
         LanguagesHelper::addSubmenu($vName);
     }
 }
开发者ID:joebushi,项目名称:joomla,代码行数:26,代码来源:controller.php

示例15: defined

<?php

/**
 * @package		Joomla.Administrator
 * @subpackage	com_languages
 * @copyright	Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_HZEXEC_') or die;
Html::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Html::behavior('tooltip');
Html::behavior('formvalidation');
$canDo = LanguagesHelper::getActions();
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'language.cancel' || document.formvalidator.isValid($('#item-form'))) {
			Joomla.submitform(task, document.getElementById('item-form'));
		}
	}
</script>

<form action="<?php 
echo Route::url('index.php?option=com_languages&layout=edit&lang_id=' . (int) $this->item->lang_id);
?>
" method="post" name="adminForm" id="item-form" class="form-validate">
	<div class="grid">
		<div class="col span7">
			<fieldset class="adminform">
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:edit.php


注:本文中的LanguagesHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。