| Current Path : /proc/thread-self/root/proc/thread-self/root/proc/1908984/root/proc/2411249/cwd/ |
| Current File : //proc/thread-self/root/proc/thread-self/root/proc/1908984/root/proc/2411249/cwd/languages.php.tar |
home/digilove/public_html/plugins/system/nnframework/fields/languages.php 0000644 00000002662 15235557772 0023113 0 ustar 00 <?php
/**
* Element: Languages
* Displays a select box of languages
*
* @package NoNumber Framework
* @version 14.11.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2014 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
class JFormFieldNN_Languages extends JFormField
{
public $type = 'Languages';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$client = $this->get('client', 'SITE');
jimport('joomla.language.helper');
$langs = JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true);
$options = array();
foreach ($langs as $lang)
{
if ($lang['value'])
{
$option = new stdClass;
$option->value = $lang['value'];
$option->text = $lang['text'] . ' [' . $lang['value'] . ']';
$options[] = $option;
}
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
home/digilove/public_html/administrator/components/com_languages/languages.php 0000644 00000001134 15235566424 0024143 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.tabstate');
if (!JFactory::getUser()->authorise('core.manage', 'com_languages'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
$controller = JControllerLegacy::getInstance('Languages');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
home/digilove/public_html/110/plugins/system/nnframework/fields/languages.php 0000644 00000002662 15235663625 0023407 0 ustar 00 <?php
/**
* Element: Languages
* Displays a select box of languages
*
* @package NoNumber Framework
* @version 14.11.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2014 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
class JFormFieldNN_Languages extends JFormField
{
public $type = 'Languages';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$client = $this->get('client', 'SITE');
jimport('joomla.language.helper');
$langs = JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true);
$options = array();
foreach ($langs as $lang)
{
if ($lang['value'])
{
$option = new stdClass;
$option->value = $lang['value'];
$option->text = $lang['text'] . ' [' . $lang['value'] . ']';
$options[] = $option;
}
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
home/digilove/public_html/administrator/components/com_languages/models/languages.php 0000644 00000012763 15241231317 0025423 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages Model Class
*
* @since 1.6
*/
class LanguagesModelLanguages extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'lang_id', 'a.lang_id',
'lang_code', 'a.lang_code',
'title', 'a.title',
'title_native', 'a.title_native',
'sef', 'a.sef',
'image', 'a.image',
'published', 'a.published',
'ordering', 'a.ordering',
'access', 'a.access', 'access_level',
'home', 'l.home',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = 'a.ordering', $direction = 'asc')
{
// Load the filter state.
$this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string'));
$this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd'));
$this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string'));
// Load the parameters.
$params = JComponentHelper::getParams('com_languages');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.published');
return parent::getStoreId($id);
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select all fields from the languages table.
$query->select($this->getState('list.select', 'a.*', 'l.home'))
->from($db->quoteName('#__languages') . ' AS a');
// Join over the asset groups.
$query->select('ag.title AS access_level')
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Select the language home pages.
$query->select('l.home AS home')
->join('LEFT', $db->quoteName('#__menu') . ' AS l ON l.language = a.lang_code AND l.home=1 AND l.language <> ' . $db->quote('*'));
// Filter on the published state.
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title.
$search = $this->getState('filter.search');
if (!empty($search))
{
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.title LIKE ' . $search . ')');
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
/**
* Set the published language(s).
*
* @param array $cid An array of language IDs.
* @param integer $value The value of the published state.
*
* @return boolean True on success, false otherwise.
*
* @since 1.6
*/
public function setPublished($cid, $value = 0)
{
return JTable::getInstance('Language')->publish($cid, $value);
}
/**
* Method to delete records.
*
* @param array $pks An array of item primary keys.
*
* @return boolean Returns true on success, false on failure.
*
* @since 1.6
*/
public function delete($pks)
{
// Sanitize the array.
$pks = (array) $pks;
// Get a row instance.
$table = JTable::getInstance('Language');
// Iterate the items to delete each one.
foreach ($pks as $itemId)
{
if (!$table->delete((int) $itemId))
{
$this->setError($table->getError());
return false;
}
}
// Clean the cache.
$this->cleanCache();
return true;
}
/**
* Custom clean cache method, 2 places for 2 clients.
*
* @param string $group Optional cache group name.
* @param integer $clientId Application client id.
*
* @return void
*
* @since 1.6
*/
protected function cleanCache($group = null, $clientId = 0)
{
parent::cleanCache('_system');
parent::cleanCache('com_languages');
}
}
home/digilove/public_html/administrator/components/com_languages/controllers/languages.php 0000644 00000003174 15242432612 0026504 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Languages controller Class.
*
* @since 1.6
*/
class LanguagesControllerLanguages extends JControllerAdmin
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Language', $prefix = 'LanguagesModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Method to save the submitted ordering values for records via AJAX.
*
* @return void
*
* @since 3.1
*/
public function saveOrderAjax()
{
// Check for request forgeries.
$this->checkToken();
$pks = (array) $this->input->post->get('cid', array(), 'int');
$order = (array) $this->input->post->get('order', array(), 'int');
// Remove zero PK's and corresponding order values resulting from input filter for PK
foreach ($pks as $i => $pk)
{
if ($pk === 0)
{
unset($pks[$i]);
unset($order[$i]);
}
}
// Get the model.
$model = $this->getModel();
// Save the ordering.
$return = $model->saveorder($pks, $order);
if ($return)
{
echo '1';
}
// Close the application.
JFactory::getApplication()->close();
}
}
home/digilove/public_html/administrator/components/com_languages/helpers/html/languages.php 0000644 00000004020 15243370265 0026541 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_languages
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Utility class working with languages
*
* @since 1.6
*/
abstract class JHtmlLanguages
{
/**
* Method to generate an information about the default language.
*
* @param boolean $published True if the language is the default.
*
* @return string HTML code.
*/
public static function published($published)
{
if (!$published)
{
return ' ';
}
return JHtml::_('image', 'menu/icon-16-default.png', JText::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true);
}
/**
* Method to generate an input radio button.
*
* @param integer $rowNum The row number.
* @param string $language Language tag.
*
* @return string HTML code.
*/
public static function id($rowNum, $language)
{
return '<input'
. ' type="radio"'
. ' id="cb' . $rowNum . '"'
. ' name="cid"'
. ' value="' . htmlspecialchars($language, ENT_COMPAT, 'UTF-8') . '"'
. ' onclick="Joomla.isChecked(this.checked);"'
. ' title="' . ($rowNum + 1) . '"'
. '/>';
}
/**
* Method to generate an array of clients.
*
* @return array of client objects.
*/
public static function clients()
{
return array(
JHtml::_('select.option', 0, JText::_('JSITE')),
JHtml::_('select.option', 1, JText::_('JADMINISTRATOR'))
);
}
/**
* Returns an array of published state filter options.
*
* @return string The HTML code for the select tag.
*
* @since 1.6
*/
public static function publishedOptions()
{
// Build the active state filter options.
$options = array();
$options[] = JHtml::_('select.option', '1', 'JPUBLISHED');
$options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED');
$options[] = JHtml::_('select.option', '-2', 'JTRASHED');
$options[] = JHtml::_('select.option', '*', 'JALL');
return $options;
}
}