| Current Path : /proc/thread-self/root/var/tmp/ |
| Current File : //proc/thread-self/root/var/tmp/phpDr15Uw |
accesslevel.php 0000644 00000004714 15232574454 0007567 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
use RegularLabs\Library\Field;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_AccessLevel extends Field
{
public $type = 'AccessLevel';
public function getAjaxRaw(Registry $attributes)
{
$name = $attributes->get('name', $this->type);
$id = $attributes->get('id', strtolower($name));
$value = $attributes->get('value', []);
$size = $attributes->get('size');
$multiple = $attributes->get('multiple');
$options = $this->getOptions(
(bool) $attributes->get('show_all'),
(bool) $attributes->get('use_names')
);
return $this->selectList($options, $name, $value, $id, $size, $multiple);
}
protected function getAccessLevels($use_names = false)
{
$value = $use_names ? 'a.title' : 'a.id';
$query = $this->db->getQuery(true)
->select($value . ' as value, a.title as text')
->from('#__viewlevels AS a')
->group('a.id')
->order('a.ordering ASC');
$this->db->setQuery($query);
return $this->db->loadObjectList();
}
protected function getInput()
{
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$show_all = $this->get('show_all');
$use_names = $this->get('use_names');
return $this->selectListAjax(
$this->type, $this->name, $this->value, $this->id,
compact('size', 'multiple', 'show_all', 'use_names')
);
}
protected function getOptions($show_all = false, $use_names = false)
{
$options = $this->getAccessLevels($use_names);
if ($show_all)
{
$option = (object) [];
$option->value = -1;
$option->text = '- ' . JText::_('JALL') . ' -';
$option->disable = '';
array_unshift($options, $option);
}
return $options;
}
}
agents.php 0000644 00000016011 15232574454 0006550 0 ustar 00 <?php
/**
* Element: Agents
* Displays a multiselectbox of different browsers
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_Agents extends JFormField
{
public $type = 'Agents';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$group = $this->get('group');
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$agents = array();
switch ($group)
{
/* OS */
case 'os':
$agents[] = array('Windows (' . JText::_('JALL') . ')', 'Windows');
$agents[] = array('Windows 8', 'Windows nt 6.2');
$agents[] = array('Windows 7', 'Windows nt 6.1');
$agents[] = array('Windows Vista', 'Windows nt 6.0');
$agents[] = array('Windows Server 2003', 'Windows nt 5.2');
$agents[] = array('Windows XP', 'Windows nt 5.1');
$agents[] = array('Windows 2000 sp1', 'Windows nt 5.01');
$agents[] = array('Windows 2000', 'Windows nt 5.0');
$agents[] = array('Windows NT 4.0', 'Windows nt 4.0');
$agents[] = array('Windows Me', 'Win 9x 4.9');
$agents[] = array('Windows 98', 'Windows 98');
$agents[] = array('Windows 95', 'Windows 95');
$agents[] = array('Windows CE', 'Windows ce');
$agents[] = array('Mac OS (' . JText::_('JALL') . ')', '#(Mac OS|Mac_PowerPC|Macintosh)#');
$agents[] = array('Mac OSX (' . JText::_('JALL') . ')', 'Mac OS X');
$agents[] = array('Mac OSX Mountain Lion', 'Mac OS X 10.8');
$agents[] = array('Mac OSX Lion', 'Mac OS X 10.7');
$agents[] = array('Mac OSX Snow Leopard', 'Mac OS X 10.6');
$agents[] = array('Mac OSX Leopard', 'Mac OS X 10.5');
$agents[] = array('Mac OSX Tiger', 'Mac OS X 10.4');
$agents[] = array('Mac OSX Panther', 'Mac OS X 10.3');
$agents[] = array('Mac OSX Jaguar', 'Mac OS X 10.2');
$agents[] = array('Mac OSX Puma', 'Mac OS X 10.1');
$agents[] = array('Mac OSX Cheetah', 'Mac OS X 10.0');
$agents[] = array('Mac OS (classic)', '#(Mac_PowerPC|Macintosh)#');
$agents[] = array('Linux', '#(Linux|X11)#');
$agents[] = array('Open BSD', 'OpenBSD');
$agents[] = array('Sun OS', 'SunOS');
$agents[] = array('QNX', 'QNX');
$agents[] = array('BeOS', 'BeOS');
$agents[] = array('OS/2', 'OS/2');
break;
/* Browsers */
case 'browsers':
$agents[] = array('Chrome (' . JText::_('JALL') . ')', 'Chrome');
$agents[] = array('Chrome 38', 'Chrome/38.');
$agents[] = array('Chrome 37', 'Chrome/37.');
$agents[] = array('Chrome 36', 'Chrome/36.');
$agents[] = array('Chrome 35', 'Chrome/35.');
$agents[] = array('Chrome 34', 'Chrome/34.');
$agents[] = array('Chrome 33', 'Chrome/33.');
$agents[] = array('Chrome 32', 'Chrome/32.');
$agents[] = array('Chrome 31', 'Chrome/31.');
$agents[] = array('Chrome 30', 'Chrome/30.');
//$agents[] = array('Chrome 31-40', '#Chrome/(3[1-9]|40)\.#');
$agents[] = array('Chrome 21-30', '#Chrome/(2[1-9]|30)\.#');
$agents[] = array('Chrome 11-20', '#Chrome/(1[1-9]|20)\.#');
$agents[] = array('Chrome 1-10', '#Chrome/([1-9]|10)\.#');
$agents[] = array('Firefox (' . JText::_('JALL') . ')', 'Firefox');
$agents[] = array('Firefox 34', 'Firefox/34.');
$agents[] = array('Firefox 33', 'Firefox/33.');
$agents[] = array('Firefox 32', 'Firefox/32.');
$agents[] = array('Firefox 31', 'Firefox/31.');
$agents[] = array('Firefox 30', 'Firefox/30.');
$agents[] = array('Firefox 29', 'Firefox/29.');
$agents[] = array('Firefox 28', 'Firefox/28.');
$agents[] = array('Firefox 27', 'Firefox/27.');
$agents[] = array('Firefox 26', 'Firefox/26.');
$agents[] = array('Firefox 25', 'Firefox/25.');
$agents[] = array('Firefox 24', 'Firefox/24.');
$agents[] = array('Firefox 23', 'Firefox/23.');
$agents[] = array('Firefox 22', 'Firefox/22.');
$agents[] = array('Firefox 21', 'Firefox/21.');
$agents[] = array('Firefox 21-30', '#Firefox/(2[1-9]|30)\.#');
$agents[] = array('Firefox 11-20', '#Firefox/(1[1-9]|20)\.#');
$agents[] = array('Firefox 1-10', '#Firefox/([1-9]|10)\.#');
$agents[] = array('Internet Explorer (' . JText::_('JALL') . ')', 'MSIE');
$agents[] = array('Internet Explorer 11', 'MSIE 11'); // missing MSIE is added to agent string in assingnments/agents.php
$agents[] = array('Internet Explorer 10.6', 'MSIE 10.6');
$agents[] = array('Internet Explorer 10.0', 'MSIE 10.0');
$agents[] = array('Internet Explorer 10', 'MSIE 10.');
$agents[] = array('Internet Explorer 9', 'MSIE 9.');
$agents[] = array('Internet Explorer 8', 'MSIE 8.');
$agents[] = array('Internet Explorer 7', 'MSIE 7.');
$agents[] = array('Internet Explorer 1-6', '#MSIE [1-6]\.#');
$agents[] = array('Opera (' . JText::_('JALL') . ')', 'Opera');
$agents[] = array('Opera 26', 'Opera/26.');
$agents[] = array('Opera 25', 'Opera/25.');
$agents[] = array('Opera 24', 'Opera/24.');
$agents[] = array('Opera 23', 'Opera/23.');
$agents[] = array('Opera 22', 'Opera/22.');
$agents[] = array('Opera 21', 'Opera/21.');
$agents[] = array('Opera 11-20', '#Opera/(1[1-9]|20)\.#');
$agents[] = array('Opera 1-10', '#Opera/([1-9]|10)\.#');
$agents[] = array('Safari (' . JText::_('JALL') . ')', 'Safari');
//$agents[] = array('Safari 8', '#Version/8\..*Safari/#');
//$agents[] = array('Safari 7', '#Version/7\..*Safari/#');
$agents[] = array('Safari 6', '#Version/6\..*Safari/#');
$agents[] = array('Safari 5', '#Version/5\..*Safari/#');
$agents[] = array('Safari 4', '#Version/4\..*Safari/#');
$agents[] = array('Safari 1-3', '#Version/[1-3]\..*Safari/#');
break;
/* Mobile browsers */
case 'mobile':
$agents[] = array(JText::_('JALL'), 'mobile');
$agents[] = array('Android', 'Android');
$agents[] = array('Blackberry', 'Blackberry');
$agents[] = array('IE Mobile', 'IEMobile');
$agents[] = array('iPad', 'iPad');
$agents[] = array('iPhone', 'iPhone');
$agents[] = array('iPod Touch', 'iPod');
$agents[] = array('NetFront', 'NetFront');
$agents[] = array('Nokia', 'NokiaBrowser');
$agents[] = array('Opera Mini', 'Opera Mini');
$agents[] = array('Opera Mobile', 'Opera Mobi');
$agents[] = array('UC Browser', 'UC Browser');
break;
}
$options = array();
foreach ($agents as $agent)
{
$option = JHtml::_('select.option', $agent['1'], $agent['0']);
$options[] = $option;
}
$size = (int) $this->get('size');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, 1);
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
ajax.php 0000644 00000012727 15232574454 0006224 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Field;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Ajax extends Field
{
public $type = 'Ajax';
protected function getInput()
{
RL_Document::loadMainDependencies();
$class = $this->get('class', 'btn');
if ($this->get('disabled'))
{
return $this->getButton($class . ' disabled', 'disabled');
}
$loading = 'jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-refresh icon-spin");';
$success = '
jQuery("#' . $this->id . '").removeClass("btn-warning").addClass("btn-success");
jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-ok");
if(data){
jQuery("#message_' . $this->id . '").addClass("alert alert-success alert-noclose alert-inline").html(data);
}
';
$error = '
jQuery("#' . $this->id . '").removeClass("btn-success").addClass("btn-warning");
jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-warning");
if(data){
let error = data;
if(data.statusText) {
error = data.statusText;
if(data.responseText.test(/<blockquote>/)) {
error = data.responseText.replace(/^[.\\\\s\\\\S]*?<blockquote>([.\\\\s\\\\S]*?)<\\\\/blockquote>[.\\\\s\\\\S]*$/gm, "$1");
}
}
jQuery("#message_' . $this->id . '").addClass("alert alert-danger alert-noclose alert-inline").html(error);
}';
if ($this->get('success-disabled'))
{
$success .= '
jQuery("#' . $this->id . '").disabled = true;
jQuery("#' . $this->id . '").addClass("disabled");
jQuery("#' . $this->id . '").attr("onclick", "return false;");
';
}
if ($this->get('success-text') || $this->get('error-text'))
{
$success_text = $this->get('success-text', $this->get('text'));
$error_text = $this->get('error-text', $this->get('text'));
$success .= '
jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($success_text)) . '");
';
$error .= '
jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($error_text)) . '");
';
}
$query = '';
$url_query = $this->get('url-query');
if ($url_query)
{
$name_prefix = $this->form->getFormControl() . '\\\[' . $this->group . '\\\]';
$id_prefix = $this->form->getFormControl() . '_' . $this->group . '_';
$query_parts = [];
$url_query = explode(',', $url_query);
foreach ($url_query as $url_query_part)
{
[$key, $id] = explode(':', $url_query_part);
$el_name = 'document.querySelector("input[name=' . $name_prefix . '\\\[' . $id . '\\\]]:checked")';
$el_id = 'document.querySelector("#' . $id_prefix . $id . '")';
$query_parts[] = '`&' . $key . '=`'
. ' + encodeURI(' . $el_name . ' ? ' . $el_name . '.value : (' . $el_id . ' ? ' . $el_id . '.value' . ' : ""))';
}
$query = '+' . implode('+', $query_parts);
}
$script = 'function loadAjax' . $this->id . '() {
' . $loading . '
jQuery("#message_' . $this->id . '").attr("class", "").html("");
RegularLabsScripts.loadajax(
`' . addslashes($this->get('url')) . '`' . $query . ',
`
if(data == "" || data.substring(0,1) == "+") {
data = data.trim().replace(/^[+]/, "");
' . $success . '
} else {
data = data.trim().replace(/^[-]/, "");
' . $error . '
}`,
`' . $error . '`
);
}';
$script = preg_replace('#\s*\n\s*#', ' ', $script);
JFactory::getDocument()->addScriptDeclaration($script);
$attributes = 'onclick="loadAjax' . $this->id . '();return false;"';
return $this->getButton($class, $attributes);
}
private function getButton($class = 'btn', $attributes = '')
{
$icon = $this->get('icon', '')
? 'icon-' . $this->get('icon', '')
: '';
return
'<button id="' . $this->id . '" class="' . $class . '"'
. ' title="' . JText::_($this->get('description')) . '"'
. ' ' . $attributes . '>'
. '<span class="' . $icon . '"></span> '
. '<span>' . JText::_($this->get('text', $this->get('label'))) . '</span>'
. '</button>'
. '<div id="message_' . $this->id . '"></div>';
}
}
akeebasubs.php 0000644 00000003171 15232574454 0007377 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
// No direct access to this file
//
defined('_JEXEC') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
class JFormFieldAkeebaSubs extends ListField
{
/**
* Method to get a list of options for a list input.
*
* @return array An array of options.
*/
protected function getOptions()
{
if (!NRFramework\Extension::isInstalled('akeebasubs'))
{
return;
}
$lists = $this->getLevels();
if (!count($lists))
{
return;
}
$options = array();
foreach ($lists as $option)
{
$options[] = HTMLHelper::_('select.option', $option->id, $option->name);
}
return array_merge(parent::getOptions(), $options);
}
/**
* Retrieve all Akeeba Subscription Levels
*
* @return array Subscription Levels
*/
private function getLevels()
{
// Get a db connection.
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
->from('#__akeebasubs_levels AS l')
->where('l.enabled > -1')
->order('l.title, l.akeebasubs_level_id');
$db->setQuery($query);
return $db->loadObjectList();
}
} zoo.php 0000644 00000012324 15232574454 0006101 0 ustar 00 <?php
/**
* Element: ZOO
* Displays a multiselectbox of available ZOO categories
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_ZOO extends JFormField
{
public $type = 'ZOO';
private $params = null;
private $db = null;
private $max_list_count = 0;
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('zoo'))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_ZOO')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'zoo_' . ($group == 'applications' ? 'application' : 'category'), $tables))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_ZOO')) . '</fieldset>';
}
$parameters = nnParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group)
{
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__zoo_category AS c')
->where('c.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$show_ignore = $this->get('show_ignore');
$options = array();
if ($show_ignore)
{
if (in_array('-1', $this->value))
{
$this->value = array('-1');
}
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_IGNORE') . ' -', 'value', 'text', 0);
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
$query->clear()
->select('a.id, a.name')
->from('#__zoo_application AS a')
->order('a.name, a.id');
$this->db->setQuery($query);
$apps = $this->db->loadObjectList();
foreach ($apps as $i => $app)
{
$query->clear()
->select('c.id, c.parent AS parent_id, c.name AS title, c.published')
->from('#__zoo_category AS c')
->where('c.application_id = ' . (int) $app->id)
->where('c.published > -1')
->order('c.ordering, c.name');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
if ($i)
{
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
// establish the hierarchy of the menu
// TODO: use node model
$children = array();
if ($items)
{
// first pass - collect children
foreach ($items as $v)
{
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
// second pass - get an indent list of the items
$list = JHtml::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
// assemble items to the array
$options[] = JHtml::_('select.option', 'app' . $app->id, '[' . $app->name . ']', 'value', 'text', 0);
foreach ($list as $item)
{
$item->treename = ' ' . str_replace('  - ', ' ', $item->treename);
$item->treename = nnText::prepareSelectItem($item->treename, $item->published);
$option = JHtml::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
$option->level = 1;
$options[] = $option;
}
}
return $options;
}
function getItems()
{
$query = $this->db->getQuery(true)
->select('i.id, i.name, a.name as app, i.state as published')
->from('#__zoo_item AS i')
->join('LEFT', '#__zoo_application AS a ON a.id = i.application_id')
->where('i.state > -1')
->order('i.name, i.priority, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = $item->name . ' [' . $item->id . '] [' . $item->app . ']';
$item->name = nnText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
assignmentselection.php 0000644 00000003232 15232574454 0011346 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use NRFramework\HTML;
class JFormFieldAssignmentSelection extends ListField
{
/**
* Assignment options
*
* @var array
*/
protected $options = array(
0 => 'JDISABLED',
1 => 'NR_INCLUDE',
2 => 'NR_EXCLUDE'
);
/**
* Return options list to field
*
* @return array
*/
protected function getOptions()
{
foreach ($this->options as $key => $value)
{
$options[] = HTMLHelper::_('select.option', $key, Text::_($value));
}
return array_merge(parent::getOptions(), $options);
}
/**
* Setup field with predefined classes and load its media files
*
* @param SimpleXMLElement $element
* @param String $value
* @param String $group
*
* @return SimpleXMLElement
*/
public function setup(SimpleXMLElement $element, $value, $group = NULL)
{
$return = parent::setup($element, $value, $group);
HTMLHelper::_('jquery.framework');
HTML::script('plg_system_nrframework/assignmentselection.js');
HTML::stylesheet('plg_system_nrframework/assignmentselection.css');
$this->class = 'assignmentselection chzn-color-state';
return $return;
}
} block.php 0000644 00000004263 15232574454 0006367 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
// No direct access to this file
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
require_once dirname(__DIR__) . '/helpers/field.php';
###### Note ######
# This field is deprecated. Use NR_Well instead
###### Note ######
class JFormFieldNR_Block extends NRFormField
{
/**
* The field type.
*
* @var string
*/
public $type = 'nr_block';
protected function getLabel()
{
return '';
}
/**
* Method to render the input field
*
* @return string
*/
protected function getInput()
{
HTMLHelper::stylesheet('plg_system_nrframework/fields.css', false, true);
$title = $this->get('label');
$description = $this->get('description');
$class = $this->get('class');
$showclose = $this->get('showclose', 0);
$start = $this->get('start', 0);
$end = $this->get('end', 0);
$info = $this->get("html", null);
if ($info)
{
$info = str_replace("{{", "<", $info);
$info = str_replace("}}", ">", $info);
}
$html = array();
if ($start || !$end)
{
$html[] = '</div>';
if (strpos($class, 'alert') !== false)
{
$html[] = '<div class="alert ' . $class . '">';
}
else
{
$html[] = '<div class="well nr-well' . $class . '">';
}
if ($title)
{
$html[] = '<h4>' . $this->prepareText($title) . '</h4>';
}
if ($description)
{
$html[] = '<div class="well-desc">' . $this->prepareText($description) . $info . '</div>';
}
$html[] = '<div><div>';
}
if (!$start && !$end)
{
$html[] = '</div>';
}
return '</div>' . implode('', $html);
}
} checkbox.php 0000644 00000005425 15232574454 0007064 0 ustar 00 <?php
/**
* Element: Checkbox
* Displays options as checkboxes
*
* @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_Checkbox extends JFormField
{
public $type = 'Checkbox';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$showcheckall = $this->get('showcheckall', 0);
$checkall = ($this->value == '*');
if (!$checkall)
{
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
}
$options = array();
foreach ($this->element->children() as $option)
{
if ($option->getName() != 'option')
{
continue;
}
$text = trim((string) $option);
$hasval = 0;
if (isset($option['value']))
{
$val = (string) $option['value'];
$disabled = (int) $option['disabled'];
$hasval = 1;
}
if ($hasval)
{
$option = '<input type="checkbox" class="nn_' . $this->id . '" id="' . $this->id . $val . '" name="' . $this->name . '[]" value="' . $val . '"';
if ($checkall || in_array($val, $this->value))
{
$option .= ' checked="checked"';
}
if ($disabled)
{
$option .= ' disabled="disabled"';
}
$option .= ' /> <label for="' . $this->id . $val . '" class="checkboxes">' . JText::_($text) . '</label>';
}
else
{
$option = '<label style="clear:both;"><strong>' . JText::_($text) . '</strong></label>';
}
$options[] = $option;
}
$options = implode('', $options);
if ($showcheckall)
{
$checkers = array();
if ($showcheckall)
{
$checkers[] = '<input id="nn_checkall_' . $this->id . '" type="checkbox" onclick=" nnScripts.checkAll( this, \'nn_' . $this->id . '\' );" /> ' . JText::_('JALL');
$js = "
jQuery(document).ready(function() {
nnScripts.initCheckAlls('nn_checkall_" . $this->id . "', 'nn_" . $this->id . "');
});
";
JFactory::getDocument()->addScriptDeclaration($js);
}
$options = implode(' ', $checkers) . '<br />' . $options;
}
$options .= '<input type="hidden" id="' . $this->id . 'x" name="' . $this->name . '' . '[]" value="x" checked="checked" />';
$html = array();
$html[] = '<fieldset id="' . $this->id . '" class="checkbox">';
$html[] = $options;
$html[] = '</fieldset>';
return implode('', $html);
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
codeeditor.php 0000644 00000004625 15232574454 0007420 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Editor\Editor as JEditor;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Plugin\PluginHelper as JPluginHelper;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Field;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_CodeEditor extends Field
{
public $type = 'CodeEditor';
protected function getInput()
{
$width = $this->get('width', '100%');
$height = $this->get('height', 400);
$syntax = $this->get('syntax', 'html');
$editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');
if (empty($editor_plugin))
{
return
'<textarea name="' . $this->name . '" style="'
. 'width:' . (strpos($width, '%') ? $width : $width . 'px') . ';'
. 'height:' . (strpos($height, '%') ? $height : $height . 'px') . ';'
. '" id="' . $this->id . '">' . $this->value . '</textarea>';
}
RL_Document::script('regularlabs/codemirror.min.js');
RL_Document::stylesheet('regularlabs/codemirror.min.css');
JFactory::getDocument()->addScriptDeclaration("
jQuery(document).ready(function($) {
RegularLabsCodeMirror.init('" . $this->id . "');
});
");
JFactory::getDocument()->addStyleDeclaration("
#rl_codemirror_" . $this->id . " .CodeMirror {
height: " . $height . "px;
min-height: " . min($height, '100') . "px;
}
");
return '<div class="rl_codemirror" id="rl_codemirror_' . $this->id . '">'
. JEditor::getInstance('codemirror')->display(
$this->name, htmlentities($this->value),
$width, $height,
80, 10,
false,
$this->id, null, null,
['markerGutter' => false, 'activeLine' => true, 'syntax' => $syntax]
)
. '</div>';
}
}
color.php 0000644 00000003036 15232574454 0006410 0 ustar 00 <?php
/**
* Element: Color
* Displays a textfield with a color picker
*
* @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;
jimport('joomla.form.formfield');
class JFormFieldNN_Color extends JFormField
{
public $type = 'Color';
protected function getInput()
{
$field = new nnFieldColor;
return $field->getInput($this->name, $this->id, $this->value, $this->element->attributes());
}
}
class nnFieldColor
{
function getInput($name, $id, $value, $params)
{
$this->name = $name;
$this->id = $id;
$this->value = $value;
$this->params = $params;
$class = trim('nn_color minicolors ' . $this->get('class'));
$disabled = $this->get('disabled') ? ' disabled="disabled"' : '';
JHtml::stylesheet('nnframework/color.min.css', false, true);
JFactory::getDocument()->addScriptVersion(JURI::root(true) . '/media/nnframework/js/color.min.js');
$this->value = strtolower(strtoupper(preg_replace('#[^a-z0-9]#si', '', $this->value)));
return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="' . $class . '" value="' . $this->value . '"' . $disabled . '>';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
components.php 0000644 00000006320 15232574454 0007456 0 ustar 00 <?php
/**
* Element: Components
* Displays a list of components with check boxes
*
* @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_Components extends JFormField
{
public $type = 'Components';
private $params = null;
private $db = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$frontend = $this->get('frontend', 1);
$admin = $this->get('admin', 1);
$size = (int) $this->get('size');
if (!$frontend && !$admin)
{
return '';
}
$components = $this->getComponents($frontend, $admin);
$options = array();
foreach ($components as $component)
{
$options[] = JHtml::_('select.option', $component->element, $component->name);
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, 1);
}
function getComponents($frontend = 1, $admin = 1)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$query = $this->db->getQuery(true)
->select('e.name, e.element')
->from('#__extensions AS e')
->where('e.type = ' . $this->db->quote('component'))
->where('e.name != ""')
->where('e.element != ""')
->group('e.element')
->order('e.element, e.name');
$this->db->setQuery($query);
$components = $this->db->loadObjectList();
$comps = array();
$lang = JFactory::getLanguage();
foreach ($components as $i => $component)
{
// return if there is no main component folder
if (!($frontend && JFolder::exists(JPATH_SITE . '/components/' . $component->element))
&& !($admin && JFolder::exists(JPATH_ADMINISTRATOR . '/components/' . $component->element))
)
{
continue;
}
// return if there is no views folder
if (!($frontend && JFolder::exists(JPATH_SITE . '/components/' . $component->element . '/views'))
&& !($admin && JFolder::exists(JPATH_ADMINISTRATOR . '/components/' . $component->element . '/views'))
)
{
continue;
}
if (!empty($component->element))
{
// Load the core file then
// Load extension-local file.
$lang->load($component->element . '.sys', JPATH_BASE, null, false, false)
|| $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, null, false, false)
|| $lang->load($component->element . '.sys', JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, $lang->getDefault(), false, false);
}
$component->name = JText::_(strtoupper($component->name));
$comps[preg_replace('#[^a-z0-9_]#i', '', $component->name . '_' . $component->element)] = $component;
}
ksort($comps);
return $comps;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
conditionselection.php 0000644 00000010725 15232574454 0011171 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Field;
use RegularLabs\Library\ShowOn as RL_ShowOn;
use RegularLabs\Library\StringHelper as RL_String;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_ConditionSelection extends Field
{
public $type = 'ConditionSelection';
protected function closeShowOn()
{
return RL_ShowOn::close();
}
protected function getInput()
{
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$use_main_switch = $this->get('use_main_switch', 1);
$showclose = $this->get('showclose', 0);
$html = [];
if ( ! $label)
{
if ($use_main_switch)
{
$html[] = $this->closeShowOn();
}
$html[] = $this->closeShowOn();
return '</div>' . implode('', $html);
}
$label = RL_String::html_entity_decoder(JText::_($label));
$html[] = '</div>';
if ($use_main_switch)
{
$html[] = $this->openShowOn('show_conditions:1[OR]show_assignments:1[OR]' . $param_name . ':1,2');
}
$class = 'well well-small rl_well';
if ($this->value === 1)
{
$class .= ' alert-success';
}
else if ($this->value === 2)
{
$class .= ' alert-error';
}
$html[] = '<div class="' . $class . '">';
$user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();
if ($showclose && $user->authorise('core.admin'))
{
$html[] = '<button type="button" class="close" aria-label="Close">×</button>';
}
$html[] = '<div class="control-group">';
$html[] = '<div class="control-label">';
$html[] = '<label><h4>' . $label . '</h4></label>';
$html[] = '</div>';
$html[] = '<div class="controls">';
$html[] = '<fieldset id="' . $this->id . '" class="radio btn-group">';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 0)"';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (( ! $this->value) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 1)"';
$html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';
$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 2)"';
$onclick .= ' onload="RegularLabsForm.setToggleTitleClass(this, ' . $this->value . ', 7)"';
$html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '>';
$html[] = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';
$html[] = '</fieldset>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '<div class="clearfix"> </div>';
$html[] = $this->openShowOn($param_name . ':1,2');
$html[] = '<div><div>';
return '</div>' . implode('', $html);
}
protected function getLabel()
{
return '';
}
protected function openShowOn($condition = '')
{
if ( ! $condition)
{
return $this->closeShowon();
}
$formControl = $this->get('form', $this->formControl);
$formControl = $formControl == 'root' ? '' : $formControl;
if ($this->group)
{
$formControl .= '[' . $this->group . ']';
}
return RL_ShowOn::open($condition, $formControl);
}
}
content.php 0000644 00000004132 15232574454 0006742 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
require_once dirname(__DIR__) . '/helpers/groupfield.php';
class JFormFieldNR_Content extends NRFormGroupField
{
public $type = 'Content';
public function getCategories()
{
$extension = isset($this->element['extension']) ? (string) $this->element['extension'] : 'com_content';
$query = $this->db->getQuery(true)
->select('COUNT(c.id)')
->from('#__categories AS c')
->where('c.extension = ' . $this->db->quote($extension))
->where('c.parent_id > 0')
->where('c.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
$options = array();
if ($this->get('show_ignore'))
{
if (in_array('-1', $this->value))
{
$this->value = array('-1');
}
$options[] = HTMLHelper::_('select.option', '-1', '- ' . Text::_('NR_IGNORE') . ' -', 'value', 'text', 0);
$options[] = HTMLHelper::_('select.option', '-', ' ', 'value', 'text', 1);
}
$query->clear('select')
->select('c.id, c.title as name, c.level, c.published, c.language')
->order('c.lft');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
$options = array_merge($options, $this->getOptionsByList($list, array('language'), -1));
return $options;
}
public function getItems()
{
$query = $this->db->getQuery(true)
->select('COUNT(i.id)')
->from('#__content AS i')
->where('i.access > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
$query->clear('select')
->select('i.id, i.title as name, i.language, c.title as cat, i.access as published')
->join('LEFT', '#__categories AS c ON c.id = i.catid')
->order('i.title, i.ordering, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, array('language', 'cat', 'id'));
}
}
customfieldkey.php 0000644 00000003050 15232574455 0010316 0 ustar 00 <?php
/**
* Element: Custom Field Key
* Displays a custom key field (use in combination with customfieldvalue)
*
* @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_CustomFieldKey extends JFormField
{
public $type = 'CustomFieldKey';
private $params = null;
protected function getLabel()
{
$this->params = $this->element->attributes();
$label = ($this->get('label') ? $this->get('label') : '');
$size = ($this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '');
$class = ($this->get('class') ? 'class="' . $this->get('class') . '"' : 'class="text_area"');
$this->value = htmlspecialchars(html_entity_decode($this->value, ENT_QUOTES), ENT_QUOTES);
$html = '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . ' />';
$html = '<label for="' . $this->id . '" style="margin-top: -5px;">' . $html . '</label>';
return $html;
}
protected function getInput()
{
return '<div style="display:none;"><div><div>';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
customfieldvalue.php 0000644 00000002652 15232574455 0010651 0 ustar 00 <?php
/**
* Element: Custom Field Value
* Displays a custom key field (use in combination with customfieldkey)
*
* @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_CustomFieldValue extends JFormField
{
public $type = 'CustomFieldValue';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
$label = ($this->get('label') ? $this->get('label') : '');
$size = ($this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '');
$class = ($this->get('class') ? 'class="' . $this->get('class') . '"' : 'class="text_area"');
$this->value = htmlspecialchars(html_entity_decode($this->value, ENT_QUOTES), ENT_QUOTES);
return '</div></div></div><input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . ' />';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
datetime.php 0000644 00000002570 15232574455 0007071 0 ustar 00 <?php
/**
* Element: DateTime
* Element to display the date and time
*
* @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_DateTime extends JFormField
{
public $type = 'DateTime';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
$label = $this->get('label');
$format = $this->get('format');
$date = JFactory::getDate();
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
$date->setTimeZone($tz);
if ($format)
{
if (strpos($format, '%') !== false)
{
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
$format = nnText::dateToDateFormat($format);
}
$html = $date->format($format, 1);
}
else
{
$html = $date->format('', 1);
}
if ($label)
{
$html = JText::sprintf($label, $html);
}
return '</div><div>' . $html;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
dependency.php 0000644 00000005527 15232574455 0007420 0 ustar 00 <?php
/**
* Element: Dependency
* Displays an error if given file is not found
*
* @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;
jimport('joomla.form.formfield');
class JFormFieldNN_Dependency extends JFormField
{
public $type = 'Dependency';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('jquery.framework');
JFactory::getDocument()->addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
$file = $this->get('file');
if (!$file)
{
$path = ($this->get('path') == 'site') ? '' : '/administrator';
$label = $this->get('label');
$file = $this->get('alias', $label);
$file = preg_replace('#[^a-z-]#', '', strtolower($file));
$extension = $this->get('extension');
switch ($extension)
{
case 'com';
$file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
break;
case 'mod';
$file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
break;
case 'plg_editors-xtd';
$file = '/plugins/editors-xtd/' . $file . '.xml';
break;
default:
$file = '/plugins/system/' . $file . '.xml';
break;
}
$label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')';
}
else
{
$label = $this->get('label', 'the main extension');
}
nnFieldDependency::setMessage($file, $label);
return '';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
class nnFieldDependency
{
static function setMessage($file, $name)
{
jimport('joomla.filesystem.file');
$file = str_replace('\\', '/', $file);
if (strpos($file, '/administrator') === 0)
{
$file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
}
else
{
$file = JPATH_SITE . '/' . $file;
}
$file = str_replace('//', '/', $file);
$file_alt = preg_replace('#(com|mod)_([a-z-_]+\.)#', '\2', $file);
if (!JFile::exists($file) && !JFile::exists($file_alt))
{
$msg = JText::sprintf('NN_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
$message_set = 0;
$messageQueue = JFactory::getApplication()->getMessageQueue();
foreach ($messageQueue as $queue_message)
{
if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg)
{
$message_set = 1;
break;
}
}
if (!$message_set)
{
JFactory::getApplication()->enqueueMessage($msg, 'error');
}
}
}
}
easyblog.php 0000644 00000004657 15232574455 0007112 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
use RegularLabs\Library\FieldGroup;
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_EasyBlog extends FieldGroup
{
public $type = 'EasyBlog';
public function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__easyblog_category AS c')
->where('c.published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$query->clear('select')
->select('c.id, c.parent_id, c.title, c.published')
->order('c.ordering, c.title');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
return $this->getOptionsTreeByList($items);
}
public function getItems()
{
$query = $this->db->getQuery(true)
->select('i.id, i.title as name, c.title as cat, i.published')
->from('#__easyblog_post AS i')
->join('LEFT', '#__easyblog_category AS c ON c.id = i.category_id')
->where('i.published > -1')
->order('i.title, c.title, i.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list, ['cat', 'id']);
}
public function getTags()
{
$query = $this->db->getQuery(true)
->select('t.alias as id, t.title as name')
->from('#__easyblog_tag AS t')
->where('t.published > -1')
->where('t.title != ' . $this->db->quote(''))
->group('t.title')
->order('t.title');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
protected function getInput()
{
$error = $this->missingFilesOrTables(['categories' => 'category', 'items' => 'post', 'tags' => 'tag']);
return $error ?: $this->getSelectList();
}
}
editor.php 0000644 00000002176 15232574455 0006565 0 ustar 00 <?php
/**
* Element: Editor
* Displays an HTML editor text field
*
* @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_Editor extends JFormField
{
public $type = 'Editor';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
$width = $this->get('width', '100%');
$height = $this->get('height', 400);
$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// Get an editor object.
$editor = JFactory::getEditor();
$html = $editor->display($this->name, $this->value, $width, $height, true, $this->id);
return '</div><div>' . $html;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
field.php 0000644 00000003625 15232574455 0006362 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Field;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Field extends Field
{
public $type = 'Field';
public function getFields()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT a.id, a.name, a.type, a.title')
->from('#__fields AS a')
->where('a.state = 1')
->order('a.name');
$db->setQuery($query);
$fields = $db->loadObjectList();
$options = [];
$options[] = JHtml::_('select.option', '', '- ' . JText::_('RL_SELECT_FIELD') . ' -');
foreach ($fields as &$field)
{
// Skip our own subfields type. We won't have subfields in subfields.
if ($field->type == 'subfields' || $field->type == 'repeatable')
{
continue;
}
$options[] = JHtml::_('select.option', $field->name, ($field->title . ' (' . $field->type . ')'));
}
if ($this->get('show_custom'))
{
$options[] = JHtml::_('select.option', 'custom', '- ' . JText::_('RL_CUSTOM') . ' -');
}
return $options;
}
protected function getInput()
{
$options = $this->getFields();
return $this->selectListSimple($options, $this->name, $this->value, $this->id);
}
}
filelist.php 0000644 00000004532 15232574455 0007110 0 ustar 00 <?php
/**
* Element: Filelist
*
* @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;
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
JFormHelper::loadFieldClass('list');
class JFormFieldNN_FileList extends JFormFieldList
{
public $type = 'FileList';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
return parent::getInput();
}
protected function getOptions()
{
$options = array();
$path = $this->get('folder');
if (!is_dir($path))
{
$path = JPATH_ROOT . '/' . $path;
}
// Prepend some default options based on field attributes.
if (!$this->get('hidenone', 0))
{
$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}
if (!$this->get('hidedefault', 0))
{
$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}
// Get a list of files in the search path with the given filter.
$files = JFolder::files($path, $this->get('filter'));
// Build the options list from the list of files.
if (is_array($files))
{
foreach ($files as $file)
{
// Check to see if the file is in the exclude mask.
if ($this->get('exclude'))
{
if (preg_match(chr(1) . $this->get('exclude') . chr(1), $file))
{
continue;
}
}
// If the extension is to be stripped, do it.
if ($this->get('stripext', 1))
{
$file = JFile::stripExt($file);
}
$label = $file;
if ($this->get('language_prefix'))
{
$label = JText::_($this->get('language_prefix') . strtoupper($label));
}
$options[] = JHtml::_('select.option', $file, $label);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
flexicontent.php 0000644 00000005576 15232574455 0010010 0 ustar 00 <?php
/**
* Element: FlexiContent
* Displays a multiselectbox of available Flexicontent Tags / Types
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_FlexiContent extends JFormField
{
public $type = 'FlexiContent';
private $params = null;
private $db = null;
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('flexicontent'))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
}
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group)
{
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
function getTags()
{
$query = $this->db->getQuery(true)
->select('t.name as id, t.name')
->from('#__flexicontent_tags AS t')
->where('t.published = 1')
->order('t.name');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptions($list);
}
function getTypes()
{
$query = $this->db->getQuery(true)
->select('t.id, t.name')
->from('#__flexicontent_types AS t')
->where('t.published = 1')
->order('t.name, t.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptions($list);
}
function getOptions($list)
{
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
form2content.php 0000644 00000002332 15232574455 0007711 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
use RegularLabs\Library\FieldGroup;
defined('_JEXEC') or die;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Form2Content extends FieldGroup
{
public $default_group = 'Projects';
public $type = 'Form2Content';
public function getProjects()
{
$query = $this->db->getQuery(true)
->select('t.id, t.title as name')
->from('#__f2c_project AS t')
->where('t.published = 1')
->order('t.title, t.id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
return $this->getOptionsByList($list);
}
protected function getInput()
{
$error = $this->missingFilesOrTables(['projects' => 'project'], '', 'f2c');
return $error ?: $this->getSelectList();
}
}
geo.php 0000644 00000003026 15232574455 0006044 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
require_once JPATH_PLUGINS . '/system/nrframework/helpers/fieldlist.php';
class JFormFieldNR_Geo extends NRFormFieldList
{
private $list;
protected function getInput()
{
if ($this->get('detect_visitor_country', false) && empty($this->value) && $countryCode = \NRFramework\Helpers\Geo::getVisitorCountryCode())
{
$this->value = $countryCode;
}
return parent::getInput();
}
protected function getOptions()
{
switch ($this->get('geo'))
{
case 'continents':
$this->list = \NRFramework\Continents::getContinentsList();
$selectLabel = 'NR_SELECT_CONTINENT';
break;
default:
$this->list = \NRFramework\Countries::getCountriesList();
$selectLabel = 'NR_SELECT_COUNTRY';
break;
}
if ($this->get('use_label_as_value', false))
{
$this->list = array_combine($this->list, $this->list);
}
$options = array();
if ($this->get("showselect", 'true') === 'true')
{
$options[] = HTMLHelper::_('select.option', "", "- " . Text::_($selectLabel) . " -");
}
foreach ($this->list as $key => $value)
{
$options[] = HTMLHelper::_('select.option', $key, $value);
}
return array_merge(parent::getOptions(), $options);
}
} grouplevel.php 0000644 00000003604 15232574455 0007460 0 ustar 00 <?php
/**
* Element: Group Level
* Displays a select box of backend group levels
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_GroupLevel extends JFormField
{
public $type = 'GroupLevel';
private $params = null;
private $db = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
$show_all = $this->get('show_all');
$attribs = 'class="inputbox"';
$options = $this->getUserGroups();
if ($show_all)
{
$option = new stdClass;
$option->value = -1;
$option->text = '- ' . JText::_('JALL') . ' -';
$option->disable = '';
array_unshift($options, $option);
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple, $attribs);
}
protected function getUserGroups()
{
// Get the user groups from the database.
$query = $this->db->getQuery(true)
->select('a.id as value, a.title as text, a.parent_id AS parent')
->from('#__usergroups AS a')
->select('COUNT(DISTINCT b.id) AS level')
->join('LEFT', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt')
->group('a.id')
->order('a.lft ASC');
$this->db->setQuery($query);
return $this->db->loadObjectList();
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
header.php 0000644 00000006401 15232574455 0006522 0 ustar 00 <?php
/**
* Element: Header
* Displays a title with a bunch of extras, like: description, image, versioncheck
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_Header extends JFormField
{
public $type = 'Header';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$title = $this->get('label');
$description = $this->get('description');
$xml = $this->get('xml');
$url = $this->get('url');
if ($description)
{
// variables
$v1 = $this->get('var1');
$v2 = $this->get('var2');
$v3 = $this->get('var3');
$v4 = $this->get('var4');
$v5 = $this->get('var5');
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
}
if ($title)
{
$title = JText::_($title);
}
if ($description)
{
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
if ($description['0'] != '<')
{
$description = '<p>' . $description . '</p>';
}
}
if (!$xml && $this->form->getValue('element'))
{
if ($this->form->getValue('folder'))
{
$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
else
{
$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
}
if ($xml)
{
$xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
$version = 0;
if ($xml && isset($xml['version']))
{
$version = $xml['version'];
}
if ($version)
{
if (strpos($version, 'PRO') !== false)
{
$version = str_replace('PRO', '', $version);
$version .= ' <small style="color:green">[PRO]</small>';
}
else if (strpos($version, 'FREE') !== false)
{
$version = str_replace('FREE', '', $version);
$version .= ' <small style="color:green">[FREE]</small>';
}
if ($title)
{
$title .= ' v';
}
else
{
$title = JText::_('Version') . ' ';
}
$title .= $version;
}
}
$html = array();
if ($title)
{
if ($url)
{
$title = '<a href="' . $url . '" target="_blank" title="' . preg_replace('#<[^>]*>#', '', $title) . '">' . $title . '</a>';
}
$html[] = '<h4>' . nnText::html_entity_decoder($title) . '</h4>';
}
if ($description)
{
$html[] = $description;
}
if ($url)
{
$html[] = '<p><a href="' . $url . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a></p>';
}
return '</div><div>' . implode('', $html);
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
header_library.php 0000644 00000003637 15232574455 0010256 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text as JText;
require_once __DIR__ . '/header.php';
class JFormFieldRL_Header_Library extends JFormFieldRL_Header
{
protected function getInput()
{
$extensions = [
'Add to Menu',
'Advanced Module Manager',
'Advanced Template Manager',
'Articles Anywhere',
'Articles Field',
'Better Preview',
'Better Trash',
'Cache Cleaner',
'CDN for Joomla!',
'Components Anywhere',
'Conditional Content',
'Content Templater',
'DB Replacer',
'Dummy Content',
'Email Protector',
'GeoIP',
'IP Login',
'Keyboard Shortcuts',
'Modals',
'Modules Anywhere',
'Quick Index',
'Regular Labs Extension Manager',
'ReReplacer',
'Simple User Notes',
'Sliders',
'Snippets',
'Sourcerer',
'Tabs',
'Tooltips',
'What? Nothing!',
];
$list = '<ul><li>' . implode('</li><li>', $extensions) . '</li></ul>';
$attributes = $this->element->attributes();
$warning = '';
if (isset($attributes['warning']))
{
$warning = '<div class="alert alert-danger">' . JText::_($attributes['warning']) . '</div>';
}
$this->element->attributes()['description'] = JText::sprintf($attributes['description'], $warning, $list);
return parent::getInput();
}
}
hikashop.php 0000644 00000012264 15232574455 0007104 0 ustar 00 <?php
/**
* Element: HikaShop
* Displays a multiselectbox of available HikaShop categories / products
*
* @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;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_HikaShop extends JFormField
{
public $type = 'HikaShop';
private $params = null;
private $db = null;
private $max_list_count = 0;
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('hikashop'))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'hikashop_' . ($group == 'products' ? 'product' : 'category'), $tables))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</fieldset>';
}
$parameters = nnParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group)
{
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
function getCategories()
{
$query = $this->db->getQuery(true)
->select('COUNT(*)')
->from('#__hikashop_category AS c')
->where('c.category_published > -1');
$this->db->setQuery($query);
$total = $this->db->loadResult();
if ($total > $this->max_list_count)
{
return -1;
}
$show_ignore = $this->get('show_ignore');
$query->clear()
->select('c.category_id')
->from('#__hikashop_category AS c')
->where('c.category_type = ' . $this->db->quote('root'));
$this->db->setQuery($query);
$root = $this->db->loadResult();
$query->clear()
->select('c.category_id as id, c.category_parent_id AS parent_id, c.category_name AS title, c.category_published as published')
->from('#__hikashop_category AS c')
->where('c.category_type = ' . $this->db->quote('product'))
->where('c.category_published > -1')
->order('c.category_ordering, c.category_name');
$this->db->setQuery($query);
$items = $this->db->loadObjectList();
// establish the hierarchy of the menu
// TODO: use node model
$children = array();
// first pass - collect children
foreach ($items as $v)
{
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
// second pass - get an indent list of the items
$list = JHtml::_('menu.treerecurse', (int) $root, '', array(), $children, 9999, 0, 0);
// assemble items to the array
$options = array();
if ($show_ignore)
{
if (in_array('-1', $this->value))
{
$this->value = array('-1');
}
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_IGNORE') . ' -', 'value', 'text', 0);
$options[] = JHtml::_('select.option', '-', ' ', 'value', 'text', 1);
}
foreach ($list as $item)
{
$item->treename = nnText::prepareSelectItem($item->treename, $item->published, '', 1);
$options[] = JHtml::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
}
return $options;
}
function getProducts()
{
$query = $this->db->getQuery(true)
->select('p.product_id as id, p.product_name AS name, c.category_name AS cat, p.product_published AS published')
->from('#__hikashop_product AS p')
->join('LEFT', '#__hikashop_product_category AS x ON x.product_id = p.product_id')
->join('LEFT', '#__hikashop_category AS c ON c.category_id = x.category_id')
->where('p.product_published > -1')
->order('p.product_name, p.product_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = $item->name . ' [' . $item->id . ']' . ($item->cat ? ' [' . $item->cat . ']' : '');
$item->name = nnText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
icons.php 0000644 00000006163 15232574455 0006412 0 ustar 00 <?php
/**
* Element: Radio Images
* Displays a list of radio items and the images you can chose from
*
* @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_Icons extends JFormField
{
public $type = 'Icons';
private $params = null;
protected function getInput()
{
$this->params = $this->element->attributes();
$value = !is_array($this->value) ? explode(',', $this->value) : $this->value;
$classes = array(
'nonumber icon-contenttemplater',
'home',
'user',
'locked',
'comments',
'comments-2',
'out',
'plus',
'pencil',
'pencil-2',
'file',
'file-add',
'file-remove',
'copy',
'folder',
'folder-2',
'picture',
'pictures',
'list-view',
'power-cord',
'cube',
'puzzle',
'flag',
'tools',
'cogs',
'cog',
'equalizer',
'wrench',
'brush',
'eye',
'star',
'calendar',
'calendar-2',
'help',
'support',
'warning',
'checkmark',
'mail',
'mail-2',
'drawer',
'drawer-2',
'box-add',
'box-remove',
'search',
'filter',
'camera',
'play',
'music',
'grid-view',
'grid-view-2',
'menu',
'thumbs-up',
'thumbs-down',
'plus-2',
'minus-2',
'key',
'quote',
'quote-2',
'database',
'location',
'zoom-in',
'zoom-out',
'health',
'wand',
'refresh',
'vcard',
'clock',
'compass',
'address',
'feed',
'flag-2',
'pin',
'lamp',
'chart',
'bars',
'pie',
'dashboard',
'lightning',
'move',
'printer',
'color-palette',
'camera-2',
'cart',
'basket',
'broadcast',
'screen',
'tablet',
'mobile',
'users',
'briefcase',
'download',
'upload',
'bookmark',
'out-2'
);
$html = array();
if ($this->get('show_none'))
{
$checked = (in_array('0', $value) ? ' checked="checked"' : '');
$html[] = '<fieldset>';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '"' . ' value="0"' . $checked . '/>';
$html[] = '<label for="' . $this->id . '0">' . JText::_('NN_NO_ICON') . '</label>';
$html[] = '</fieldset>';
}
foreach ($classes as $i => $class)
{
$checked = (in_array($class, $value) ? ' checked="checked"' : '');
$html[] = '<fieldset class="pull-left">';
$html[] = '<input type="radio" id="' . $this->id . $class . '" name="' . $this->name . '"'
. ' value="' . htmlspecialchars($class, ENT_COMPAT, 'UTF-8') . '"' . $checked . '/>';
$html[] = '<label for="' . $this->id . $class . '" class="btn btn-small"><span class="icon-' . $class . '"></span></label>';
$html[] = '</fieldset>';
}
return '<div id="' . $this->id . '" class="btn-group radio nn_icon_group">' . implode('', $html) . '</div>';
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
isinstalled.php 0000644 00000002055 15232574455 0007606 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 23.7.24631
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Extension as RL_Extension;
use RegularLabs\Library\Field;
jimport('joomla.form.formfield');
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_IsInstalled extends Field
{
public $type = 'IsInstalled';
protected function getInput()
{
$is_installed = RL_Extension::isInstalled($this->get('extension'), $this->get('extension_type'), $this->get('folder'));
return '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . (int) $is_installed . '">';
}
protected function getLabel()
{
return '';
}
}