Source for file strings.php
Documentation is available at strings.php
* @package Joomla.Administrator
* @subpackage com_languages
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Languages Strings Model
* @package Joomla.Administrator
* @subpackage com_languages
* Method for refreshing the cache in the database with the known language strings
* @return boolean True on success, Exception object otherwise
require_once JPATH_COMPONENT.
'/helpers/languages.php';
$app->setUserState('com_languages.overrides.cachedtime', null);
// Empty the database cache first
$this->_db->setQuery('TRUNCATE TABLE '.
$this->_db->quoteName('#__overrider'));
catch
(RuntimeException $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');
$path =
$base .
'/language/' .
$language;
// Parse common language directory
jimport('joomla.filesystem.folder');
$files =
JFolder::files($path, $language.
'.*ini$', false, true);
// Parse language directories of components
// Parse language directories of modules
// Parse language directories of templates
// Parse language directories of plugins
// Parse all found ini files and add the strings to the database cache
foreach ($files as $file)
if ($strings &&
count($strings))
foreach ($strings as $key =>
$string)
$query->values($this->_db->quote($key).
','.
$this->_db->quote($string).
','.
$this->_db->quote(JPath::clean($file)));
$this->_db->setQuery($query);
catch
(RuntimeException $e)
// Update the cached time
$app->setUserState('com_languages.overrides.cachedtime.'.
$client.
'.'.
$language, time());
* Method for searching language strings
* @return array Array of resuls on success, Exception object otherwise
$limitstart =
$input->getInt('more');
$searchstring =
$this->_db->quote('%' .
$input->getString('searchstring') .
'%');
// Create the search query
$query =
$this->_db->getQuery(true)
->select('constant, string, file')
->from($this->_db->quoteName('#__overrider'));
if ($input->get('searchtype') ==
'constant')
$query->where('constant LIKE '.
$searchstring);
$query->where('string LIKE '.
$searchstring);
// Consider the limitstart according to the 'more' parameter and load the results
$this->_db->setQuery($query, $limitstart, 10);
$results['results'] =
$this->_db->loadObjectList();
// Check whether there are more results than already loaded
$this->_db->setQuery($query);
if ($this->_db->loadResult() >
$limitstart +
10)
// If this is set a 'More Results' link will be displayed in the view
$results['more'] =
$limitstart +
10;
catch
(RuntimeException $e)
Documentation generated on Tue, 19 Nov 2013 15:14:36 +0100 by phpDocumentor 1.4.3