Файловый менеджер - Редактировать - /home/digilove/public_html/41423/helpers.tar
Назад
association.php 0000644 00000003277 15232601366 0007606 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php'); JLoader::register('ContactHelperRoute', JPATH_SITE . '/components/com_contact/helpers/route.php'); JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php'); /** * Contact Component Association Helper * * @since 3.0 */ abstract class ContactHelperAssociation extends CategoryHelperAssociation { /** * Method to get the associations for a given item * * @param integer $id Id of the item * @param string $view Name of the view * * @return array Array of associations for the item * * @since 3.0 */ public static function getAssociations($id = 0, $view = null) { $jinput = JFactory::getApplication()->input; $view = $view === null ? $jinput->get('view') : $view; $id = empty($id) ? $jinput->getInt('id') : $id; if ($view === 'contact') { if ($id) { $associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = ContactHelperRoute::getContactRoute($item->id, (int) $item->catid, $item->language); } return $return; } } if ($view === 'category' || $view === 'categories') { return self::getCategoryAssociations($id, 'com_contact'); } return array(); } } category.php 0000644 00000001252 15232601366 0007076 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_contact * * @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; /** * Contact Component Category Tree * * @since 1.6 */ class ContactCategories extends JCategories { /** * Class constructor * * @param array $options Array of options * * @since 1.6 */ public function __construct($options = array()) { $options['table'] = '#__contact_details'; $options['extension'] = 'com_contact'; $options['statefield'] = 'published'; parent::__construct($options); } } index.html 0000644 00000000016 15232601366 0006542 0 ustar 00 <html></html> legacyrouter.php 0000644 00000013673 15232601366 0010000 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Legacy routing rules class from com_users * * @since 3.6 * @deprecated 4.0 */ class UsersRouterRulesLegacy implements JComponentRouterRulesInterface { /** * Constructor for this legacy router * * @param JComponentRouterAdvanced $router The router this rule belongs to * * @since 3.6 * @deprecated 4.0 */ public function __construct($router) { $this->router = $router; } /** * Preprocess the route for the com_users component * * @param array &$query An array of URL arguments * * @return void * * @since 3.6 * @deprecated 4.0 */ public function preprocess(&$query) { } /** * Build the route for the com_users component * * @param array &$query An array of URL arguments * @param array &$segments The URL arguments to use to assemble the subsequent URL. * * @return void * * @since 3.6 * @deprecated 4.0 */ public function build(&$query, &$segments) { // Declare static variables. static $items; static $default; static $registration; static $profile; static $login; static $remind; static $resend; static $reset; // Get the relevant menu items if not loaded. if (empty($items)) { // Get all relevant menu items. $items = $this->router->menu->getItems('component', 'com_users'); // Build an array of serialized query strings to menu item id mappings. foreach ($items as $item) { if (empty($item->query['view'])) { continue; } // Check to see if we have found the resend menu item. if (empty($resend) && $item->query['view'] === 'resend') { $resend = $item->id; continue; } // Check to see if we have found the reset menu item. if (empty($reset) && $item->query['view'] === 'reset') { $reset = $item->id; continue; } // Check to see if we have found the remind menu item. if (empty($remind) && $item->query['view'] === 'remind') { $remind = $item->id; continue; } // Check to see if we have found the login menu item. if (empty($login) && $item->query['view'] === 'login' && (empty($item->query['layout']) || $item->query['layout'] === 'default')) { $login = $item->id; continue; } // Check to see if we have found the registration menu item. if (empty($registration) && $item->query['view'] === 'registration') { $registration = $item->id; continue; } // Check to see if we have found the profile menu item. if (empty($profile) && $item->query['view'] === 'profile') { $profile = $item->id; } } // Set the default menu item to use for com_users if possible. if ($profile) { $default = $profile; } elseif ($registration) { $default = $registration; } elseif ($login) { $default = $login; } } if (!empty($query['view'])) { switch ($query['view']) { case 'reset': if ($query['Itemid'] = $reset) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'resend': if ($query['Itemid'] = $resend) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'remind': if ($query['Itemid'] = $remind) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'login': if ($query['Itemid'] = $login) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'registration': if ($query['Itemid'] = $registration) { unset($query['view']); } else { $query['Itemid'] = $default; } break; default: case 'profile': if (!empty($query['view'])) { $segments[] = $query['view']; } unset($query['view']); if ($query['Itemid'] = $profile) { unset($query['view']); } else { $query['Itemid'] = $default; } // Only append the user id if not "me". $user = JFactory::getUser(); if (!empty($query['user_id']) && ($query['user_id'] != $user->id)) { $segments[] = $query['user_id']; } unset($query['user_id']); break; } } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } } /** * Parse the segments of a URL. * * @param array &$segments The segments of the URL to parse. * @param array &$vars The URL attributes to be used by the application. * * @return void * * @since 3.6 * @deprecated 4.0 */ public function parse(&$segments, &$vars) { $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); } // Only run routine if there are segments to parse. if (count($segments) < 1) { return; } // Get the package from the route segments. $userId = array_pop($segments); if (!is_numeric($userId)) { $vars['view'] = 'profile'; return; } if (is_numeric($userId)) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__users')) ->where($db->quoteName('id') . ' = ' . (int) $userId); $db->setQuery($query); $userId = $db->loadResult(); } // Set the package id if present. if ($userId) { // Set the package id. $vars['user_id'] = (int) $userId; // Set the view to package if not already set. if (empty($vars['view'])) { $vars['view'] = 'profile'; } } else { JError::raiseError(404, JText::_('JGLOBAL_RESOURCE_NOT_FOUND')); } } } route.php 0000644 00000004600 15232601366 0006417 0 ustar 00 <?php /** * Project: 4SEO * * @package 4SEO * @copyright Copyright Weeblr llc - 2020-2024 * @author Yannick Gaultier - Weeblr llc * @license GNU General Public License version 3; see LICENSE.md * @version 6.2.0.2478 * @date 2024-10-03 */ namespace Weeblr\Forseo\Platform\Helpers; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Application\CMSApplicationInterface; use Joomla\CMS\Factory; use Weeblr\Wblib\Forseo\Wb; use Weeblr\Wblib\Forseo\Base; use Weeblr\Wblib\Forseo\System; // no direct access defined('_JEXEC') || defined('WBLIB_EXEC') || die; /** * Routing-related helpers */ class Route extends Base\Base { /** * @var \JMenu|\Joomla\CMS\Menu\AbstractMenu Local copy of menu object. */ private $menu = null; /** * @var CMSApplication|CMSApplicationInterface Local copy of * Joomla application. */ private $app = null; /** * Route constructor. Stores a ref to platform app and menu object. * * @throws \Exception */ public function __construct() { parent::__construct(); $this->app = Factory::getApplication(); } /** * Tries to get the value of a query variable from a menu item. * If variable not specified, the entire menu query is returned. * * @param int $menuItemId * @param string $varName * * @param string $default * * @return null|mixed */ public function getVarFromMenuItem($menuItemId, $varName = '', $default = '') { if (empty($menuItemId)) { return $default; } /** * WARNING: it is not possible to do app->getMenu() from the * onAfterInitialize event. It has to be at or after onAfterRoute or else * in some rare cases this will cause the remember me plugin to somewhat fail. * * See https://github.com/joomla/joomla-cms/issues/11541 * This will be fixed in a future Joomla release. */ $this->menu = empty($this->menu) ? $this->app->getMenu() : $this->menu; $menuItem = $this->menu->getItem($menuItemId); if (empty($menuItem)) { return $default; } $query = $menuItem->query; if ($menuItem->type === 'alias') { $newItem = $this->menu->getItem( $menuItem->getParams()->get('aliasoptions') ); if ($newItem) { $query = array_merge( $query, $newItem->query ); } } return empty($varName) ? $query : Wb\arrayGet( $query, $varName, $default ); } } fields.php 0000644 00000046764 15232603241 0006542 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_fields * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php'); /** * FieldsHelper * * @since 3.7.0 */ class FieldsHelper { private static $fieldsCache = null; private static $fieldCache = null; /** * Extracts the component and section from the context string which has to * be in the format component.context. * * @param string $contextString contextString * @param object $item optional item object * * @return array|null * * @since 3.7.0 */ public static function extract($contextString, $item = null) { $parts = explode('.', $contextString, 2); if (count($parts) < 2) { return null; } $component = $parts[0]; $eName = str_replace('com_', '', $component); $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php'); if (file_exists($path)) { $cName = ucfirst($eName) . 'Helper'; JLoader::register($cName, $path); if (class_exists($cName) && is_callable(array($cName, 'validateSection'))) { $section = call_user_func_array(array($cName, 'validateSection'), array($parts[1], $item)); if ($section) { $parts[1] = $section; } } } return $parts; } /** * Returns the fields for the given context. * If the item is an object the returned fields do have an additional field * "value" which represents the value for the given item. If the item has an * assigned_cat_ids field, then additionally fields which belong to that * category will be returned. * Should the value being prepared to be shown in an HTML context then * prepareValue must be set to true. No further escaping needs to be done. * The values of the fields can be overridden by an associative array where the keys * have to be a name and its corresponding value. * * @param string $context The context of the content passed to the helper * @param stdClass $item item * @param int|bool $prepareValue (if int is display event): 1 - AfterTitle, 2 - BeforeDisplay, 3 - AfterDisplay, 0 - OFF * @param array $valuesToOverride The values to override * * @return array * * @since 3.7.0 */ public static function getFields($context, $item = null, $prepareValue = false, array $valuesToOverride = null) { if (self::$fieldsCache === null) { // Load the model JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); self::$fieldsCache = JModelLegacy::getInstance('Fields', 'FieldsModel', array( 'ignore_request' => true) ); self::$fieldsCache->setState('filter.state', 1); self::$fieldsCache->setState('list.limit', 0); } if (is_array($item)) { $item = (object) $item; } if (JLanguageMultilang::isEnabled() && isset($item->language) && $item->language != '*') { self::$fieldsCache->setState('filter.language', array('*', $item->language)); } self::$fieldsCache->setState('filter.context', $context); self::$fieldsCache->setState('filter.assigned_cat_ids', array()); /* * If item has assigned_cat_ids parameter display only fields which * belong to the category */ if ($item && (isset($item->catid) || isset($item->fieldscatid))) { $assignedCatIds = isset($item->catid) ? $item->catid : $item->fieldscatid; if (!is_array($assignedCatIds)) { $assignedCatIds = explode(',', $assignedCatIds); } // Fields without any category assigned should show as well $assignedCatIds[] = 0; self::$fieldsCache->setState('filter.assigned_cat_ids', $assignedCatIds); } $fields = self::$fieldsCache->getItems(); if ($fields === false) { return array(); } if ($item && isset($item->id)) { if (self::$fieldCache === null) { self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); } $fieldIds = array_map( function ($f) { return $f->id; }, $fields ); $fieldValues = self::$fieldCache->getFieldValues($fieldIds, $item->id); $new = array(); foreach ($fields as $key => $original) { /* * Doing a clone, otherwise fields for different items will * always reference to the same object */ $field = clone $original; if ($valuesToOverride && key_exists($field->name, $valuesToOverride)) { $field->value = $valuesToOverride[$field->name]; } elseif ($valuesToOverride && key_exists($field->id, $valuesToOverride)) { $field->value = $valuesToOverride[$field->id]; } elseif (key_exists($field->id, $fieldValues)) { $field->value = $fieldValues[$field->id]; } if (!isset($field->value) || $field->value === '') { $field->value = $field->default_value; } $field->rawvalue = $field->value; // If boolean prepare, if int, it is the event type: 1 - After Title, 2 - Before Display, 3 - After Display, 0 - Do not prepare if ($prepareValue && (is_bool($prepareValue) || $prepareValue === (int) $field->params->get('display', '2'))) { JPluginHelper::importPlugin('fields'); $dispatcher = JEventDispatcher::getInstance(); // Event allow plugins to modify the output of the field before it is prepared $dispatcher->trigger('onCustomFieldsBeforePrepareField', array($context, $item, &$field)); // Gathering the value for the field $value = $dispatcher->trigger('onCustomFieldsPrepareField', array($context, $item, &$field)); if (is_array($value)) { $value = implode(' ', $value); } // Event allow plugins to modify the output of the prepared field $dispatcher->trigger('onCustomFieldsAfterPrepareField', array($context, $item, $field, &$value)); // Assign the value $field->value = $value; } $new[$key] = $field; } $fields = $new; } return $fields; } /** * Renders the layout file and data on the context and does a fall back to * Fields afterwards. * * @param string $context The context of the content passed to the helper * @param string $layoutFile layoutFile * @param array $displayData displayData * * @return NULL|string * * @since 3.7.0 */ public static function render($context, $layoutFile, $displayData) { $value = ''; /* * Because the layout refreshes the paths before the render function is * called, so there is no way to load the layout overrides in the order * template -> context -> fields. * If there is no override in the context then we need to call the * layout from Fields. */ if ($parts = self::extract($context)) { // Trying to render the layout on the component from the context $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => $parts[0], 'client' => 0)); } if ($value == '') { // Trying to render the layout on Fields itself $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => 'com_fields','client' => 0)); } return $value; } /** * PrepareForm * * @param string $context The context of the content passed to the helper * @param JForm $form form * @param object $data data. * * @return boolean * * @since 3.7.0 */ public static function prepareForm($context, JForm $form, $data) { // Extracting the component and section $parts = self::extract($context); if (! $parts) { return true; } $context = $parts[0] . '.' . $parts[1]; // When no fields available return here $fields = self::getFields($parts[0] . '.' . $parts[1], new JObject); if (! $fields) { return true; } $component = $parts[0]; $section = $parts[1]; $assignedCatids = isset($data->catid) ? $data->catid : (isset($data->fieldscatid) ? $data->fieldscatid : $form->getValue('catid')); // Account for case that a submitted form has a multi-value category id field (e.g. a filtering form), just use the first category $assignedCatids = is_array($assignedCatids) ? (int) reset($assignedCatids) : (int) $assignedCatids; if (!$assignedCatids && $formField = $form->getField('catid')) { $assignedCatids = $formField->getAttribute('default', null); // Choose the first category available $xml = new DOMDocument; $xml->loadHTML($formField->__get('input')); $options = $xml->getElementsByTagName('option'); if (!$assignedCatids && $firstChoice = $options->item(0)) { $assignedCatids = $firstChoice->getAttribute('value'); } $data->fieldscatid = $assignedCatids; } /* * If there is a catid field we need to reload the page when the catid * is changed */ if ($form->getField('catid') && $parts[0] != 'com_fields') { /* * Setting the onchange event to reload the page when the category * has changed */ $form->setFieldAttribute('catid', 'onchange', 'categoryHasChanged(this);'); // Preload spindle-wheel when we need to submit form due to category selector changed JFactory::getDocument()->addScriptDeclaration(" function categoryHasChanged(element) { var cat = jQuery(element); if (cat.val() == '" . $assignedCatids . "')return; Joomla.loadingLayer('show'); jQuery('input[name=task]').val('" . $section . ".reload'); Joomla.submitform('" . $section . ".reload', element.form); } jQuery( document ).ready(function() { Joomla.loadingLayer('load'); var formControl = '#" . $form->getFormControl() . "_catid'; if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} });" ); } // Getting the fields $fields = self::getFields($parts[0] . '.' . $parts[1], $data); if (!$fields) { return true; } $fieldTypes = self::getFieldTypes(); // Creating the dom $xml = new DOMDocument('1.0', 'UTF-8'); $fieldsNode = $xml->appendChild(new DOMElement('form'))->appendChild(new DOMElement('fields')); $fieldsNode->setAttribute('name', 'com_fields'); // Organizing the fields according to their group $fieldsPerGroup = array(0 => array()); foreach ($fields as $field) { if (!array_key_exists($field->type, $fieldTypes)) { // Field type is not available continue; } if (!array_key_exists($field->group_id, $fieldsPerGroup)) { $fieldsPerGroup[$field->group_id] = array(); } if ($path = $fieldTypes[$field->type]['path']) { // Add the lookup path for the field JFormHelper::addFieldPath($path); } if ($path = $fieldTypes[$field->type]['rules']) { // Add the lookup path for the rule JFormHelper::addRulePath($path); } $fieldsPerGroup[$field->group_id][] = $field; } // On the front, sometimes the admin fields path is not included JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/tables'); $model = JModelLegacy::getInstance('Groups', 'FieldsModel', array('ignore_request' => true)); $model->setState('filter.context', $context); /** * $model->getItems() would only return existing groups, but we also * have the 'default' group with id 0 which is not in the database, * so we create it virtually here. */ $defaultGroup = new \stdClass; $defaultGroup->id = 0; $defaultGroup->title = ''; $defaultGroup->description = ''; $iterateGroups = array_merge(array($defaultGroup), $model->getItems()); // Looping through the groups foreach ($iterateGroups as $group) { if (empty($fieldsPerGroup[$group->id])) { continue; } // Defining the field set /** @var DOMElement $fieldset */ $fieldset = $fieldsNode->appendChild(new DOMElement('fieldset')); $fieldset->setAttribute('name', 'fields-' . $group->id); $fieldset->setAttribute('addfieldpath', '/administrator/components/' . $component . '/models/fields'); $fieldset->setAttribute('addrulepath', '/administrator/components/' . $component . '/models/rules'); $label = $group->title; $description = $group->description; if (!$label) { $key = strtoupper($component . '_FIELDS_' . $section . '_LABEL'); if (!JFactory::getLanguage()->hasKey($key)) { $key = 'JGLOBAL_FIELDS'; } $label = $key; } if (!$description) { $key = strtoupper($component . '_FIELDS_' . $section . '_DESC'); if (JFactory::getLanguage()->hasKey($key)) { $description = $key; } } $fieldset->setAttribute('label', $label); $fieldset->setAttribute('description', strip_tags($description)); // Looping through the fields for that context foreach ($fieldsPerGroup[$group->id] as $field) { try { JFactory::getApplication()->triggerEvent('onCustomFieldsPrepareDom', array($field, $fieldset, $form)); /* * If the field belongs to an assigned_cat_id but the assigned_cat_ids in the data * is not known, set the required flag to false on any circumstance. */ if (!$assignedCatids && !empty($field->assigned_cat_ids) && $form->getField($field->name)) { $form->setFieldAttribute($field->name, 'required', 'false'); } } catch (Exception $e) { JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } // When the field set is empty, then remove it if (!$fieldset->hasChildNodes()) { $fieldsNode->removeChild($fieldset); } } // Loading the XML fields string into the form $form->load($xml->saveXML()); $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); if ((!isset($data->id) || !$data->id) && JFactory::getApplication()->input->getCmd('controller') == 'config.display.modules' && JFactory::getApplication()->isClient('site')) { // Modules on front end editing don't have data and an id set $data->id = JFactory::getApplication()->input->getInt('id'); } // Looping through the fields again to set the value if (!isset($data->id) || !$data->id) { return true; } foreach ($fields as $field) { $value = $model->getFieldValue($field->id, $data->id); if ($value === null) { continue; } if (!is_array($value) && $value !== '') { // Function getField doesn't cache the fields, so we try to do it only when necessary $formField = $form->getField($field->name, 'com_fields'); if ($formField && $formField->forceMultiple) { $value = (array) $value; } } // Setting the value on the field $form->setValue($field->name, 'com_fields', $value); } return true; } /** * Return a boolean if the actual logged in user can edit the given field value. * * @param stdClass $field The field * * @return boolean * * @since 3.7.0 */ public static function canEditFieldValue($field) { $parts = self::extract($field->context); return JFactory::getUser()->authorise('core.edit.value', $parts[0] . '.field.' . (int) $field->id); } /** * Return a boolean based on field (and field group) display / show_on settings * * @param stdClass $field The field * * @return boolean * * @since 3.8.7 */ public static function displayFieldOnForm($field) { $app = JFactory::getApplication(); // Detect if the field should be shown at all if ($field->params->get('show_on') == 1 && $app->isClient('administrator')) { return false; } elseif ($field->params->get('show_on') == 2 && $app->isClient('site')) { return false; } if (!self::canEditFieldValue($field)) { $fieldDisplayReadOnly = $field->params->get('display_readonly', '2'); if ($fieldDisplayReadOnly == '2') { // Inherit from field group display read-only setting $groupModel = JModelLegacy::getInstance('Group', 'FieldsModel', array('ignore_request' => true)); $groupDisplayReadOnly = $groupModel->getItem($field->group_id)->params->get('display_readonly', '1'); $fieldDisplayReadOnly = $groupDisplayReadOnly; } if ($fieldDisplayReadOnly == '0') { // Do not display field on form when field is read-only return false; } } // Display field on form return true; } /** * Gets assigned categories titles for a field * * @param stdClass[] $fieldId The field ID * * @return array Array with the assigned categories * * @since 3.7.0 */ public static function getAssignedCategoriesTitles($fieldId) { $fieldId = (int) $fieldId; if (!$fieldId) { return array(); } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('c.title')) ->from($db->quoteName('#__fields_categories', 'a')) ->join('INNER', $db->quoteName('#__categories', 'c') . ' ON a.category_id = c.id') ->where('field_id = ' . $fieldId); $db->setQuery($query); return $db->loadColumn(); } /** * Gets the fields system plugin extension id. * * @return integer The fields system plugin extension id. * * @since 3.7.0 */ public static function getFieldsPluginId() { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) ->where($db->quoteName('element') . ' = ' . $db->quote('fields')); $db->setQuery($query); try { $result = (int) $db->loadResult(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); $result = 0; } return $result; } /** * Configure the Linkbar. * * @param string $context The context the fields are used for * @param string $vName The view currently active * * @return void * * @since 3.7.0 */ public static function addSubmenu($context, $vName) { $parts = self::extract($context); if (!$parts) { return; } $component = $parts[0]; // Avoid nonsense situation. if ($component == 'com_fields') { return; } // Try to find the component helper. $eName = str_replace('com_', '', $component); $file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php'); if (!file_exists($file)) { return; } require_once $file; $cName = ucfirst($eName) . 'Helper'; if (class_exists($cName) && is_callable(array($cName, 'addSubmenu'))) { $lang = JFactory::getLanguage(); $lang->load($component, JPATH_ADMINISTRATOR) || $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component); $cName::addSubmenu('fields.' . $vName); } } /** * Loads the fields plugins and returns an array of field types from the plugins. * * The returned array contains arrays with the following keys: * - label: The label of the field * - type: The type of the field * - path: The path of the folder where the field can be found * * @return array * * @since 3.7.0 */ public static function getFieldTypes() { JPluginHelper::importPlugin('fields'); $eventData = JEventDispatcher::getInstance()->trigger('onCustomFieldsGetTypes'); $data = array(); foreach ($eventData as $fields) { foreach ($fields as $fieldDescription) { if (!array_key_exists('path', $fieldDescription)) { $fieldDescription['path'] = null; } if (!array_key_exists('rules', $fieldDescription)) { $fieldDescription['rules'] = null; } $data[$fieldDescription['type']] = $fieldDescription; } } return $data; } /** * Clears the internal cache for the custom fields. * * @return void * * @since 3.8.0 */ public static function clearFieldsCache() { self::$fieldCache = null; self::$fieldsCache = null; } } banner.php 0000644 00000001721 15234426005 0006524 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_banners * * @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; /** * Banner Helper Class * * @since 1.6 */ abstract class BannerHelper { /** * Checks if a URL is an image * * @param string $url The URL path to the potential image * * @return boolean True if an image of type bmp, gif, jp(e)g or png, false otherwise * * @since 1.6 */ public static function isImage($url) { return preg_match('#\.(?:bmp|gif|jpe?g|png)$#i', $url); } /** * Checks if a URL is a Flash file * * @param string $url The URL path to the potential flash file * * @return boolean True if an image of type bmp, gif, jp(e)g or png, false otherwise * * @since 1.6 */ public static function isFlash($url) { return preg_match('#\.swf$#i', $url); } } sj_newsletter.php 0000644 00000001566 15234426626 0010167 0 ustar 00 <?php /** * @version 1.0.0 * @package Com_Sj_newsletter * @author YouTech Company <contact@ytcvn.com> * @copyright Copyright (c) 2016 YouTech Company * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Class Sj_newsletterFrontendHelper * * @since 1.6 */ class Sj_newsletterFrontendHelper { /** * Get an instance of the named model * * @param string $name Model name * * @return null|object */ public static function getModel($name) { $model = null; // If the file exists, let's if (file_exists(JPATH_SITE . '/components/com_sj_newsletter/models/' . strtolower($name) . '.php')) { require_once JPATH_SITE . '/components/com_sj_newsletter/models/' . strtolower($name) . '.php'; $model = JModelLegacy::getInstance($name, 'Sj_newsletterModel'); } return $model; } } icon.php 0000644 00000004372 15234441447 0006223 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_weblinks * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Weblink Component HTML Helper. * * @since 1.5 */ class JHtmlIcon { /** * Create a link to create a new weblink * * @param mixed $weblink Unused * @param mixed $params Unused * * @return string */ public static function create($weblink, $params) { JHtml::_('bootstrap.tooltip'); $uri = JUri::getInstance(); $url = JRoute::_(WeblinksHelperRoute::getFormRoute(0, base64_encode($uri))); $text = JHtml::_('image', 'system/new.png', JText::_('JNEW'), null, true); $button = JHtml::_('link', $url, $text); return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_FORM_CREATE_WEBLINK') . '">' . $button . '</span>'; } /** * Create a link to edit an existing weblink * * @param object $weblink Weblink data * @param \Joomla\Registry\Registry $params Item params * @param array $attribs Unused * * @return string */ public static function edit($weblink, $params, $attribs = array()) { $uri = JUri::getInstance(); if ($params && $params->get('popup')) { return; } if ($weblink->state < 0) { return; } JHtml::_('bootstrap.tooltip'); $url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri)); $icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png'; $text = JHtml::_('image', 'system/'.$icon, JText::_('JGLOBAL_EDIT'), null, true); if ($weblink->state == 0) { $overlib = JText::_('JUNPUBLISHED'); } else { $overlib = JText::_('JPUBLISHED'); } $date = JHtml::_('date', $weblink->created); $author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author; $overlib .= '<br />'; $overlib .= $date; $overlib .= '<br />'; $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8'); $button = JHtml::_('link', JRoute::_($url), $text); return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>'; } } query.php 0000644 00000015411 15234441447 0006434 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_content * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Content Component Query Helper * * @since 1.5 */ class ContentHelperQuery { /** * Translate an order code to a field for primary category ordering. * * @param string $orderby The ordering code. * * @return string The SQL field(s) to order by. * * @since 1.5 */ public static function orderbyPrimary($orderby) { switch ($orderby) { case 'alpha' : $orderby = 'c.path, '; break; case 'ralpha' : $orderby = 'c.path DESC, '; break; case 'order' : $orderby = 'c.lft, '; break; default : $orderby = ''; break; } return $orderby; } /** * Translate an order code to a field for secondary category ordering. * * @param string $orderby The ordering code. * @param string $orderDate The ordering code for the date. * * @return string The SQL field(s) to order by. * * @since 1.5 */ public static function orderbySecondary($orderby, $orderDate = 'created') { $queryDate = self::getQueryDate($orderDate); switch ($orderby) { case 'date' : $orderby = $queryDate; break; case 'rdate' : $orderby = $queryDate . ' DESC '; break; case 'alpha' : $orderby = 'a.title'; break; case 'ralpha' : $orderby = 'a.title DESC'; break; case 'hits' : $orderby = 'a.hits DESC'; break; case 'rhits' : $orderby = 'a.hits'; break; case 'order' : $orderby = 'a.ordering'; break; case 'rorder' : $orderby = 'a.ordering DESC'; break; case 'author' : $orderby = 'author'; break; case 'rauthor' : $orderby = 'author DESC'; break; case 'front' : $orderby = 'a.featured DESC, fp.ordering, ' . $queryDate . ' DESC '; break; case 'random' : $orderby = JFactory::getDbo()->getQuery(true)->Rand(); break; case 'vote' : $orderby = 'a.id DESC '; if (JPluginHelper::isEnabled('content', 'vote')) { $orderby = 'rating_count DESC '; } break; case 'rvote' : $orderby = 'a.id ASC '; if (JPluginHelper::isEnabled('content', 'vote')) { $orderby = 'rating_count ASC '; } break; case 'rank' : $orderby = 'a.id DESC '; if (JPluginHelper::isEnabled('content', 'vote')) { $orderby = 'rating DESC '; } break; case 'rrank' : $orderby = 'a.id ASC '; if (JPluginHelper::isEnabled('content', 'vote')) { $orderby = 'rating ASC '; } break; default : $orderby = 'a.ordering'; break; } return $orderby; } /** * Translate an order code to a field for primary category ordering. * * @param string $orderDate The ordering code. * * @return string The SQL field(s) to order by. * * @since 1.6 */ public static function getQueryDate($orderDate) { $db = JFactory::getDbo(); switch ($orderDate) { case 'modified' : $queryDate = ' CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END'; break; // Use created if publish_up is not set case 'published' : $queryDate = ' CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END '; break; case 'unpublished' : $queryDate = ' CASE WHEN a.publish_down = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_down END '; break; case 'created' : default : $queryDate = ' a.created '; break; } return $queryDate; } /** * Get join information for the voting query. * * @param \Joomla\Registry\Registry $params An options object for the article. * * @return array A named array with "select" and "join" keys. * * @since 1.5 */ public static function buildVotingQuery($params = null) { if (!$params) { $params = JComponentHelper::getParams('com_content'); } $voting = $params->get('show_vote'); if ($voting) { // Calculate voting count $select = ' , ROUND(v.rating_sum / v.rating_count) AS rating, v.rating_count'; $join = ' LEFT JOIN #__content_rating AS v ON a.id = v.content_id'; } else { $select = ''; $join = ''; } return array('select' => $select, 'join' => $join); } /** * Method to order the intro articles array for ordering * down the columns instead of across. * The layout always lays the introtext articles out across columns. * Array is reordered so that, when articles are displayed in index order * across columns in the layout, the result is that the * desired article ordering is achieved down the columns. * * @param array &$articles Array of intro text articles * @param integer $numColumns Number of columns in the layout * * @return array Reordered array to achieve desired ordering down columns * * @since 1.6 * @deprecated 4.0 */ public static function orderDownColumns(&$articles, $numColumns = 1) { $count = count($articles); // Just return the same array if there is nothing to change if ($numColumns == 1 || !is_array($articles) || $count <= $numColumns) { $return = $articles; } // We need to re-order the intro articles array else { // We need to preserve the original array keys $keys = array_keys($articles); $maxRows = ceil($count / $numColumns); $numCells = $maxRows * $numColumns; $numEmpty = $numCells - $count; $index = array(); // Calculate number of empty cells in the array // Fill in all cells of the array // Put -1 in empty cells so we can skip later for ($row = 1, $i = 1; $row <= $maxRows; $row++) { for ($col = 1; $col <= $numColumns; $col++) { if ($numEmpty > ($numCells - $i)) { // Put -1 in empty cells $index[$row][$col] = -1; } else { // Put in zero as placeholder $index[$row][$col] = 0; } $i++; } } // Layout the articles in column order, skipping empty cells $i = 0; for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++) { for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++) { if ($index[$row][$col] != - 1) { $index[$row][$col] = $keys[$i]; $i++; } } } // Now read the $index back row by row to get articles in right row/col // so that they will actually be ordered down the columns (when read by row in the layout) $return = array(); $i = 0; for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++) { for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++) { $return[$keys[$i]] = $articles[$index[$row][$col]]; $i++; } } } return $return; } } html/filter.php 0000644 00000033674 15234446370 0007533 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php'); /** * Filter HTML Behaviors for Finder. * * @since 2.5 */ abstract class JHtmlFilter { /** * Method to generate filters using the slider widget and decorated * with the FinderFilter JavaScript behaviors. * * @param array $options An array of configuration options. [optional] * * @return mixed A rendered HTML widget on success, null otherwise. * * @since 2.5 */ public static function slider($options = array()) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $html = ''; $filter = null; // Get the configuration options. $filterId = array_key_exists('filter_id', $options) ? $options['filter_id'] : null; $activeNodes = array_key_exists('selected_nodes', $options) ? $options['selected_nodes'] : array(); $classSuffix = array_key_exists('class_suffix', $options) ? $options['class_suffix'] : ''; // Load the predefined filter if specified. if (!empty($filterId)) { $query->select('f.data, f.params') ->from($db->quoteName('#__finder_filters') . ' AS f') ->where('f.filter_id = ' . (int) $filterId); // Load the filter data. $db->setQuery($query); try { $filter = $db->loadObject(); } catch (RuntimeException $e) { return null; } // Initialize the filter parameters. if ($filter) { $filter->params = new Registry($filter->params); } } // Build the query to get the branch data and the number of child nodes. $query->clear() ->select('t.*, count(c.id) AS children') ->from($db->quoteName('#__finder_taxonomy') . ' AS t') ->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id') ->where('t.parent_id = 1') ->where('t.state = 1') ->where('t.access IN (' . $groups . ')') ->group('t.id, t.parent_id, t.state, t.access, t.ordering, t.title, c.parent_id') ->order('t.ordering, t.title'); // Limit the branch children to a predefined filter. if ($filter) { $query->where('c.id IN(' . $filter->data . ')'); } // Load the branches. $db->setQuery($query); try { $branches = $db->loadObjectList('id'); } catch (RuntimeException $e) { return null; } // Check that we have at least one branch. if (count($branches) === 0) { return null; } $branch_keys = array_keys($branches); $html .= JHtml::_('bootstrap.startAccordion', 'accordion', array('parent' => true, 'active' => 'accordion-' . $branch_keys[0]) ); // Load plugin language files. FinderHelperLanguage::loadPluginLanguage(); // Iterate through the branches and build the branch groups. foreach ($branches as $bk => $bv) { // If the multi-lang plugin is enabled then drop the language branch. if ($bv->title === 'Language' && JLanguageMultilang::isEnabled()) { continue; } // Build the query to get the child nodes for this branch. $query->clear() ->select('t.*') ->from($db->quoteName('#__finder_taxonomy') . ' AS t') ->where('t.parent_id = ' . (int) $bk) ->where('t.state = 1') ->where('t.access IN (' . $groups . ')') ->order('t.ordering, t.title'); // Self-join to get the parent title. $query->select('e.title AS parent_title') ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'e') . ' ON ' . $db->quoteName('e.id') . ' = ' . $db->quoteName('t.parent_id')); // Load the branches. $db->setQuery($query); try { $nodes = $db->loadObjectList('id'); } catch (RuntimeException $e) { return null; } // Translate node titles if possible. $lang = JFactory::getLanguage(); foreach ($nodes as $nk => $nv) { if (trim($nv->parent_title, '**') === 'Language') { $title = FinderHelperLanguage::branchLanguageTitle($nv->title); } else { $key = FinderHelperLanguage::branchPlural($nv->title); $title = $lang->hasKey($key) ? JText::_($key) : $nv->title; } $nodes[$nk]->title = $title; } // Adding slides $html .= JHtml::_('bootstrap.addSlide', 'accordion', JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL', JText::_(FinderHelperLanguage::branchSingular($bv->title)) . ' - ' . count($nodes) ), 'accordion-' . $bk ); // Populate the toggle button. $html .= '<button class="btn jform-rightbtn" type="button" onclick="jQuery(\'[id="tax-' . $bk . '"]\').each(function(){this.click();});"><span class="icon-checkbox-partial"></span> ' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button><hr/>'; // Populate the group with nodes. foreach ($nodes as $nk => $nv) { // Determine if the node should be checked. $checked = in_array($nk, $activeNodes) ? ' checked="checked"' : ''; // Build a node. $html .= '<div class="control-group">'; $html .= '<div class="controls">'; $html .= '<label class="checkbox">'; $html .= '<input type="checkbox" class="selector filter-node' . $classSuffix . '" value="' . $nk . '" name="t[]" id="tax-' . $bk . '"' . $checked . ' />'; $html .= $nv->title; $html .= '</label>'; $html .= '</div>'; $html .= '</div>'; } $html .= JHtml::_('bootstrap.endSlide'); } $html .= JHtml::_('bootstrap.endAccordion'); return $html; } /** * Method to generate filters using select box dropdown controls. * * @param FinderIndexerQuery $idxQuery A FinderIndexerQuery object. * @param array $options An array of options. * * @return mixed A rendered HTML widget on success, null otherwise. * * @since 2.5 */ public static function select($idxQuery, $options) { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $filter = null; // Get the configuration options. $classSuffix = $options->get('class_suffix', null); $showDates = $options->get('show_date_filters', false); // Try to load the results from cache. $cache = JFactory::getCache('com_finder', ''); $cacheId = 'filter_select_' . serialize(array($idxQuery->filter, $options, $groups, JFactory::getLanguage()->getTag())); // Check the cached results. if ($cache->contains($cacheId)) { $branches = $cache->get($cacheId); } else { $db = JFactory::getDbo(); $query = $db->getQuery(true); // Load the predefined filter if specified. if (!empty($idxQuery->filter)) { $query->select('f.data, ' . $db->quoteName('f.params')) ->from($db->quoteName('#__finder_filters') . ' AS f') ->where('f.filter_id = ' . (int) $idxQuery->filter); // Load the filter data. $db->setQuery($query); try { $filter = $db->loadObject(); } catch (RuntimeException $e) { return null; } // Initialize the filter parameters. if ($filter) { $filter->params = new Registry($filter->params); } } // Build the query to get the branch data and the number of child nodes. $query->clear() ->select('t.*, count(c.id) AS children') ->from($db->quoteName('#__finder_taxonomy') . ' AS t') ->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id') ->where('t.parent_id = 1') ->where('t.state = 1') ->where('t.access IN (' . $groups . ')') ->where('c.state = 1') ->where('c.access IN (' . $groups . ')') ->group($db->quoteName('t.id')) ->order('t.ordering, t.title'); // Limit the branch children to a predefined filter. if (!empty($filter->data)) { $query->where('c.id IN(' . $filter->data . ')'); } // Load the branches. $db->setQuery($query); try { $branches = $db->loadObjectList('id'); } catch (RuntimeException $e) { return null; } // Check that we have at least one branch. if (count($branches) === 0) { return null; } // Iterate through the branches and build the branch groups. foreach ($branches as $bk => $bv) { // If the multi-lang plugin is enabled then drop the language branch. if ($bv->title === 'Language' && JLanguageMultilang::isEnabled()) { continue; } // Build the query to get the child nodes for this branch. $query->clear() ->select('t.*') ->from($db->quoteName('#__finder_taxonomy') . ' AS t') ->where('t.parent_id = ' . (int) $bk) ->where('t.state = 1') ->where('t.access IN (' . $groups . ')') ->order('t.ordering, t.title'); // Self-join to get the parent title. $query->select('e.title AS parent_title') ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'e') . ' ON ' . $db->quoteName('e.id') . ' = ' . $db->quoteName('t.parent_id')); // Limit the nodes to a predefined filter. if (!empty($filter->data)) { $query->where('t.id IN(' . $filter->data . ')'); } // Load the branches. $db->setQuery($query); try { $branches[$bk]->nodes = $db->loadObjectList('id'); } catch (RuntimeException $e) { return null; } // Translate branch nodes if possible. $language = JFactory::getLanguage(); foreach ($branches[$bk]->nodes as $node_id => $node) { if (trim($node->parent_title, '**') === 'Language') { $title = FinderHelperLanguage::branchLanguageTitle($node->title); } else { $key = FinderHelperLanguage::branchPlural($node->title); $title = $language->hasKey($key) ? JText::_($key) : $node->title; } $branches[$bk]->nodes[$node_id]->title = $title; } // Add the Search All option to the branch. array_unshift($branches[$bk]->nodes, array('id' => null, 'title' => JText::_('COM_FINDER_FILTER_SELECT_ALL_LABEL'))); } // Store the data in cache. $cache->store($branches, $cacheId); } $html = ''; // Add the dates if enabled. if ($showDates) { $html .= JHtml::_('filter.dates', $idxQuery, $options); } $html .= '<div class="filter-branch' . $classSuffix . ' control-group clearfix">'; // Iterate through all branches and build code. foreach ($branches as $bk => $bv) { // If the multi-lang plugin is enabled then drop the language branch. if ($bv->title === 'Language' && JLanguageMultilang::isEnabled()) { continue; } $active = null; // Check if the branch is in the filter. if (array_key_exists($bv->title, $idxQuery->filters)) { // Get the request filters. $temp = JFactory::getApplication()->input->request->get('t', array(), 'array'); // Search for active nodes in the branch and get the active node. $active = array_intersect($temp, $idxQuery->filters[$bv->title]); $active = count($active) === 1 ? array_shift($active) : null; } // Build a node. $html .= '<div class="controls finder-selects">'; $html .= '<label for="tax-' . JFilterOutput::stringURLSafe($bv->title) . '" class="control-label">'; $html .= JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL', JText::_(FinderHelperLanguage::branchSingular($bv->title))); $html .= '</label>'; $html .= '<br />'; $html .= JHtml::_( 'select.genericlist', $branches[$bk]->nodes, 't[]', 'class="inputbox advancedSelect"', 'id', 'title', $active, 'tax-' . JFilterOutput::stringURLSafe($bv->title) ); $html .= '</div>'; } $html .= '</div>'; return $html; } /** * Method to generate fields for filtering dates * * @param FinderIndexerQuery $idxQuery A FinderIndexerQuery object. * @param array $options An array of options. * * @return mixed A rendered HTML widget on success, null otherwise. * * @since 2.5 */ public static function dates($idxQuery, $options) { $html = ''; // Get the configuration options. $classSuffix = $options->get('class_suffix', null); $loadMedia = $options->get('load_media', true); $showDates = $options->get('show_date_filters', false); if (!empty($showDates)) { // Build the date operators options. $operators = array(); $operators[] = JHtml::_('select.option', 'before', JText::_('COM_FINDER_FILTER_DATE_BEFORE')); $operators[] = JHtml::_('select.option', 'exact', JText::_('COM_FINDER_FILTER_DATE_EXACTLY')); $operators[] = JHtml::_('select.option', 'after', JText::_('COM_FINDER_FILTER_DATE_AFTER')); // Load the CSS/JS resources. if ($loadMedia) { JHtml::_('stylesheet', 'com_finder/dates.css', array('version' => 'auto', 'relative' => true)); } // Open the widget. $html .= '<ul id="finder-filter-select-dates">'; // Start date filter. $attribs['class'] = 'input-medium'; $html .= '<li class="filter-date' . $classSuffix . '">'; $html .= '<label for="filter_date1" class="hasTooltip" title ="' . JText::_('COM_FINDER_FILTER_DATE1_DESC') . '">'; $html .= JText::_('COM_FINDER_FILTER_DATE1'); $html .= '</label>'; $html .= '<br />'; $html .= JHtml::_( 'select.genericlist', $operators, 'w1', 'class="inputbox filter-date-operator advancedSelect"', 'value', 'text', $idxQuery->when1, 'finder-filter-w1' ); $html .= JHtml::_('calendar', $idxQuery->date1, 'd1', 'filter_date1', '%Y-%m-%d', $attribs); $html .= '</li>'; // End date filter. $html .= '<li class="filter-date' . $classSuffix . '">'; $html .= '<label for="filter_date2" class="hasTooltip" title ="' . JText::_('COM_FINDER_FILTER_DATE2_DESC') . '">'; $html .= JText::_('COM_FINDER_FILTER_DATE2'); $html .= '</label>'; $html .= '<br />'; $html .= JHtml::_( 'select.genericlist', $operators, 'w2', 'class="inputbox filter-date-operator advancedSelect"', 'value', 'text', $idxQuery->when2, 'finder-filter-w2' ); $html .= JHtml::_('calendar', $idxQuery->date2, 'd2', 'filter_date2', '%Y-%m-%d', $attribs); $html .= '</li>'; // Close the widget. $html .= '</ul>'; } return $html; } } html/index.html 0000644 00000000037 15234446370 0007515 0 ustar 00 <!DOCTYPE html><title></title> html/query.php 0000644 00000010755 15234446370 0007406 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Query HTML behavior class for Finder. * * @since 2.5 */ abstract class JHtmlQuery { /** * Method to get the explained (human-readable) search query. * * @param FinderIndexerQuery $query A FinderIndexerQuery object to explain. * * @return mixed String if there is data to explain, null otherwise. * * @since 2.5 */ public static function explained(FinderIndexerQuery $query) { $parts = array(); // Process the required tokens. foreach ($query->included as $token) { if ($token->required && (!isset($token->derived) || $token->derived == false)) { $parts[] = '<span class="query-required">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_REQUIRED', $token->term) . '</span>'; } } // Process the optional tokens. foreach ($query->included as $token) { if (!$token->required && (!isset($token->derived) || $token->derived == false)) { $parts[] = '<span class="query-optional">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_OPTIONAL', $token->term) . '</span>'; } } // Process the excluded tokens. foreach ($query->excluded as $token) { if (!isset($token->derived) || $token->derived === false) { $parts[] = '<span class="query-excluded">' . JText::sprintf('COM_FINDER_QUERY_TOKEN_EXCLUDED', $token->term) . '</span>'; } } // Process the start date. if ($query->date1) { $date = JFactory::getDate($query->date1)->format(JText::_('DATE_FORMAT_LC')); $datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' . strtoupper($query->when1)); $parts[] = '<span class="query-start-date">' . JText::sprintf('COM_FINDER_QUERY_START_DATE', $datecondition, $date) . '</span>'; } // Process the end date. if ($query->date2) { $date = JFactory::getDate($query->date2)->format(JText::_('DATE_FORMAT_LC')); $datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' . strtoupper($query->when2)); $parts[] = '<span class="query-end-date">' . JText::sprintf('COM_FINDER_QUERY_END_DATE', $datecondition, $date) . '</span>'; } // Process the taxonomy filters. if (!empty($query->filters)) { // Get the filters in the request. $t = JFactory::getApplication()->input->request->get('t', array(), 'array'); // Process the taxonomy branches. foreach ($query->filters as $branch => $nodes) { // Process the taxonomy nodes. $lang = JFactory::getLanguage(); foreach ($nodes as $title => $id) { // Translate the title for Types $key = FinderHelperLanguage::branchPlural($title); if ($lang->hasKey($key)) { $title = JText::_($key); } // Don't include the node if it is not in the request. if (!in_array($id, $t)) { continue; } // Add the node to the explanation. $parts[] = '<span class="query-taxonomy">' . JText::sprintf('COM_FINDER_QUERY_TAXONOMY_NODE', $title, JText::_(FinderHelperLanguage::branchSingular($branch))) . '</span>'; } } } // Build the interpreted query. return count($parts) ? JText::sprintf('COM_FINDER_QUERY_TOKEN_INTERPRETED', implode(JText::_('COM_FINDER_QUERY_TOKEN_GLUE'), $parts)) : null; } /** * Method to get the suggested search query. * * @param FinderIndexerQuery $query A FinderIndexerQuery object. * * @return mixed String if there is a suggestion, false otherwise. * * @since 2.5 */ public static function suggested(FinderIndexerQuery $query) { $suggested = false; // Check if the query input is empty. if (empty($query->input)) { return $suggested; } // Check if there were any ignored or included keywords. if (count($query->ignored) || count($query->included)) { $suggested = $query->input; // Replace the ignored keyword suggestions. foreach (array_reverse($query->ignored) as $token) { if (isset($token->suggestion)) { $suggested = str_ireplace($token->term, $token->suggestion, $suggested); } } // Replace the included keyword suggestions. foreach (array_reverse($query->included) as $token) { if (isset($token->suggestion)) { $suggested = str_ireplace($token->term, $token->suggestion, $suggested); } } // Check if we made any changes. if ($suggested == $query->input) { $suggested = false; } } return $suggested; } } item.php 0000644 00000014714 15234457233 0006232 0 ustar 00 <?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); /** * BDThemes Shortcode Ultimate * * @package Shortcode Ultimate Joomla 3.0 * @subpackage BDThemes Schortcodes * @copyright Copyright (C) 2011-2014 BDThemes Ltd. All rights reserved. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL * @author BDThemes * @author url http://bdthemes.com * */ class bdthemes_shortcodesHelperItem { function getCatTitle($catid) { // import com_content route helper require_once (JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php'); jimport('joomla.filesystem.file'); // prepare an array $results = array(); // generate the query $database = JFactory::getDBO(); // SQL query for slides $cat_query = ' SELECT `c`.`id` AS `id`, `c`.`title` AS `title` FROM #__categories AS `c` WHERE `c`.`id` IN ('.$catid.') ;'; // running query $database->setQuery($cat_query); // if results exists if( $datas = $database->loadObjectList() ) { // parsing data foreach($datas as $item) { // array with prepared image $results[$item->id] = array( 'id' => $item->id, 'title' => $item->title ); } } // return the results return $results; } // getData function function getData($id) { // import com_content route helper require_once (JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php'); jimport('joomla.filesystem.file'); // prepare an array $results = array(); // generate the query $database = JFactory::getDBO(); // SQL query for slides $query = ' SELECT `c`.`id` AS `id`, `c`.`catid` AS `cid`, `c`.`hits` AS `hits`, `c`.`images` AS `images`, `c`.`state` AS `state`, `c`.`title` AS `title`, `c`.`created` AS `created`, `c`.`introtext` AS `introtext` FROM #__content AS `c` WHERE `c`.`id` IN ('.$id.') ;'; // running query $database->setQuery($query); // if results exists if( $datas = $database->loadObjectList() ) { // parsing data foreach($datas as $item) { //$item->image = json_decode($item->images, true)['image_intro']; $images = json_decode($item->images); if (isset($images->image_fulltext)) { $images = htmlspecialchars($images->image_fulltext); } else { $images = ''; } if ($item->state == 1) { $cat1 = bdthemes_shortcodesHelperItem::getCatTitle($item->cid); $cat = $cat1[$item->cid]['title']; // array with prepared image $results[$item->id] = array( 'id' => $item->id, 'cid' => $item->cid, 'category' => $cat, 'hits' => $item->hits, 'image' => $images, 'title' => $item->title, 'introtext' => $item->introtext, 'created' => $item->created, 'link' => JRoute::_(ContentHelperRoute::getArticleRoute($item->id, $item->cid)) ); } else { return false; } } } // return the results return $results; } function getk2CatTitle($catid) { // jimport('joomla.filesystem.file'); require_once (JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php'); // prepare an array $results = array(); // generate the query $database = JFactory::getDBO(); // SQL query for slides $query = ' SELECT `c`.`id` AS `id`, `c`.`name` AS `name`, `c`.`published` AS `published` FROM #__k2_categories AS `c` WHERE `c`.`id` IN ('.$catid.') ;'; // running query $database->setQuery($query); // if results exists if( $datas = $database->loadObjectList() ) { // parsing data foreach($datas as $item) { // array with prepared image $results[$item->id] = array( 'id' => $item->id, 'title' => $item->name, 'published' => $item->published, ); } } // return the results return $results; }//end getItems function getDataK2($id) { // jimport('joomla.filesystem.file'); require_once (JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_k2'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php'); // prepare an array $results = array(); // generate the query $database = JFactory::getDBO(); // SQL query for slides $query = ' SELECT `c`.`id` AS `id`, `c`.`catid` AS `cid`, `c`.`created_by` AS `created_by`, `c`.`title` AS `title`, `c`.`hits` AS `hits`, `c`.`published` AS `published`, `c`.`created` AS `created`, `c`.`introtext` AS `introtext`, `c`.`fulltext` AS `fulltext`, `c`.alias AS `alias`, `cats`.alias AS `cat_alias` FROM #__k2_items AS `c` LEFT JOIN #__k2_categories AS `cats` ON cats.id = `c`.`id` WHERE `c`.`id` IN ('.$id.') ;'; // running query $database->setQuery($query); // if results exists if( $datas = $database->loadObjectList() ) { // parsing data foreach($datas as $item) { if (JFile::exists(JPATH_SITE.DIRECTORY_SEPARATOR.'media'.DIRECTORY_SEPARATOR.'k2'.DIRECTORY_SEPARATOR.'items'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.md5("Image".$item->id).'_XL.jpg')) { $item->image_large = JURI::base().'media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; } else { $item->image_large = ''; } // array with prepared image if ($item->published == 1) { $cat1 = bdthemes_shortcodesHelperItem::getk2CatTitle($item->cid); $cat = $cat1[$item->cid]['title']; $results[$item->id] = array( 'id' => $item->id, 'cid' => $item->cid, 'created_by' => $item->created_by, 'category' => $cat, 'hits' => $item->hits, 'image' => $item->image_large, 'title' => $item->title, 'introtext' => $item->introtext, 'fulltext' => $item->fulltext, 'created' => $item->created, 'link' => JRoute::_(K2HelperRoute::getItemRoute($item->id.':'.urlencode($item->alias), $item->cid.':'.urlencode($item->cat_alias))) ); } else { return false; } } } // return the results return $results; }//end getItems } // END ?>