File manager - Edit - /home/opticamezl/www/newok/models.tar
Back
index.html 0000604 00000000037 15172661453 0006547 0 ustar 00 <!DOCTYPE html><title></title> searches.php 0000604 00000010650 15172661453 0007062 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_search * * @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; /** * Methods supporting a list of search terms. * * @since 1.6 */ class SearchModelSearches extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'search_term', 'a.search_term', 'hits', 'a.hits', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.hits', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); // Special state for toggle results button. $this->setState('show_results', $this->getUserStateFromRequest($this->context . '.show_results', 'show_results', 1, 'int')); // Load the parameters. $params = JComponentHelper::getParams('com_search'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('show_results'); $id .= ':' . $this->getState('filter.search'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.*' ) ); $query->from($db->quoteName('#__core_log_searches', 'a')); // Filter by search in title if ($search = $this->getState('filter.search')) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where($db->quoteName('a.search_term') . ' LIKE ' . $search); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.hits')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Override the parent getItems to inject optional data. * * @return mixed An array of objects on success, false on failure. * * @since 1.6 */ public function getItems() { $items = parent::getItems(); // Determine if number of results for search item should be calculated // by default it is `off` as it is highly query intensive if ($this->getState('show_results')) { JPluginHelper::importPlugin('search'); $app = JFactory::getApplication(); if (!class_exists('JSite')) { // This fools the routers in the search plugins into thinking it's in the frontend JLoader::register('JSite', JPATH_ADMINISTRATOR . '/components/com_search/helpers/site.php'); } foreach ($items as &$item) { $results = $app->triggerEvent('onContentSearch', array($item->search_term)); $item->returns = 0; foreach ($results as $result) { $item->returns += count($result); } } } return $items; } /** * Method to reset the search log table. * * @return boolean * * @since 1.6 */ public function reset() { $db = $this->getDbo(); $query = $db->getQuery(true) ->delete($db->quoteName('#__core_log_searches')); $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } return true; } } forms/filter_searches.xml 0000604 00000001566 15172661453 0011574 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_SEARCH_SEARCH_IN_PHRASE" description="COM_SEARCH_SEARCH_IN_PHRASE" hint="JSEARCH_FILTER" /> </fields> <fields name="list"> <field name="fullordering" type="list" onchange="this.form.submit();" default="a.hits ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.search_term ASC">COM_SEARCH_HEADING_SEARCH_TERM_ASC</option> <option value="a.search_term DESC">COM_SEARCH_HEADING_SEARCH_TERM_DESC</option> <option value="a.hits ASC">JGLOBAL_HITS_ASC</option> <option value="a.hits DESC">JGLOBAL_HITS_DESC</option> </field> <field name="limit" type="limitbox" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> sitemap.php 0000604 00000005462 15172674430 0006733 0 ustar 00 <?php /** * @package OSMap * @contact www.joomlashack.com, help@joomlashack.com * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. * @copyright 2016-2025 Joomlashack.com. All rights reserved. * @license https://www.gnu.org/licenses/gpl.html GNU/GPL * * This file is part of OSMap. * * OSMap is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * OSMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OSMap. If not, see <https://www.gnu.org/licenses/>. */ use Alledia\OSMap\Factory; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\CMS\Table\Table; defined('_JEXEC') or die(); class OSMapModelSitemap extends AdminModel { /** * @inheritDoc */ public function getTable($name = 'Sitemap', $prefix = 'OSMapTable', $options = []) { return Table::getInstance($name, $prefix, $options); } /** * @inheritDoc */ public function getForm($data = [], $loadData = true) { $form = $this->loadForm('com_osmap.sitemap', 'sitemap', ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } return $form; } /** * @inheritDoc */ protected function loadFormData() { $data = Factory::getApplication()->getUserState('com_osmap.edit.sitemap.data', []); if (empty($data)) { $data = $this->getItem(); // Load some defaults for new sitemap $id = $data->get('id'); if (empty($id)) { $data->set('published', 1); $data->set('created', Factory::getDate()->toSql()); } // Load the menus if ($id) { $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('*') ->from('#__osmap_sitemap_menus') ->where('sitemap_id = ' . $db->quote($id)) ->order('ordering'); $menus = $db->setQuery($query)->loadObjectList(); $data->menus = []; foreach ($menus as $menu) { $data->menus[$menu->menutype_id] = [ 'priority' => $menu->priority, 'changefreq' => $menu->changefreq ]; } } } return $data; } } sitemapitems.php 0000604 00000002631 15172712517 0007767 0 ustar 00 <?php /** * @package OSMap * @contact www.joomlashack.com, help@joomlashack.com * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. * @copyright 2016-2025 Joomlashack.com. All rights reserved. * @license https://www.gnu.org/licenses/gpl.html GNU/GPL * * This file is part of OSMap. * * OSMap is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * OSMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OSMap. If not, see <https://www.gnu.org/licenses/>. */ use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Table\Table; // phpcs:disable PSR1.Files.SideEffects defined('_JEXEC') or die(); // phpcs:enable PSR1.Files.SideEffects // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace class OSMapModelSitemapItems extends BaseDatabaseModel { public function getTable($name = 'SitemapItems', $prefix = 'OSMapTable', $options = []) { return Table::getInstance($name, $prefix, $options); } } sitemaps.php 0000604 00000013213 15172712517 0007106 0 ustar 00 <?php /** * @package OSMap * @contact www.joomlashack.com, help@joomlashack.com * @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved. * @copyright 2016-2025 Joomlashack.com. All rights reserved. * @license https://www.gnu.org/licenses/gpl.html GNU/GPL * * This file is part of OSMap. * * OSMap is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * OSMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OSMap. If not, see <https://www.gnu.org/licenses/>. */ use Alledia\OSMap\Factory; use Joomla\CMS\MVC\Model\ListModel; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols defined('_JEXEC') or die(); // phpcs:enable PSR1.Files.SideEffects.FoundWithSymbols // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace class OSMapModelSitemaps extends ListModel { public function __construct($config = []) { $config['filter_fields'] = [ 'published', 'default', 'sitemap.published', 'sitemap.name', 'sitemap.id', ]; parent::__construct($config); } /** * Publish/Unpublish method * * @param int|int[] $pks * @param int $value * * @return bool */ public function publish($pks, int $value = 1): bool { $db = $this->getDbo(); $pks = array_filter(array_map('intval', $pks)); $query = $db->getQuery(true) ->set('published = ' . $db->quote($value)) ->update('#__osmap_sitemaps') ->where(sprintf('id IN (%s)', join(',', $pks))); return $db->setQuery($query)->execute(); } /** * @param int|int[] $ids * * @return bool * @throws Exception */ public function delete($ids): bool { $ids = ArrayHelper::toInteger($ids); $db = $this->getDbo(); $query = $db->getQuery(true) ->delete('#__osmap_sitemaps') ->where(sprintf('id IN (%s)', join(',', $ids))); if ($db->setQuery($query)->execute()) { Factory::getApplication()->enqueueMessage('SITEMAPS: ' . $db->getAffectedRows()); $relatedTables = [ '#__osmap_sitemap_menus', '#__osmap_items_settings', ]; foreach ($relatedTables as $table) { $db->setQuery( $db->getQuery(true) ->delete($table) ->where('sitemap_id NOT IN (SELECT id FROM #__osmap_sitemaps)') )->execute(); } return true; } return false; } /** * @inheritDoc */ protected function getListQuery() { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('sitemap.*') ->from('#__osmap_sitemaps sitemap'); // Filter by publishing state $published = $this->getState('filter.published', ''); if ($published != '*') { if ($published != '') { $query->where('sitemap.published = ' . $db->quote($published)); } else { $query->where('sitemap.published >= 0'); } } else { $query->where('(sitemap.published = 0 OR sitemap.published = 1)'); } // Filter by default state $default = $this->getState('filter.default'); if ($default != '') { $query->where('sitemap.is_default = ' . (int)$default); } $search = $this->getState('filter.search'); if (!is_null($search)) { $query->where('sitemap.name LIKE ' . $db->quote('%' . $search . '%')); } $ordering = $this->getState('list.ordering'); $direction = $this->getState('list.direction'); $query->order($ordering . ' ' . $direction); return $query; } protected function populateState($ordering = 'sitemap.id', $direction = 'asc') { $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published'); $this->setState('filter.published', $published); $default = $this->getUserStateFromRequest($this->context . '.filter.default', 'filter_default'); $this->setState('filter.default', $default); parent::populateState($ordering, $direction); } /** * @inheritDoc * @throws Exception */ public function getItems() { if ($items = parent::getItems()) { $siteApp = Factory::getJoomlaClient('site'); $menus = $siteApp->getMenu()->getItems('component', 'com_osmap'); foreach ($items as $item) { $item->menuIdList = []; foreach ($menus as $menu) { $view = $menu->query['view'] ?? null; $mapId = $menu->query['id'] ?? null; if ( $mapId == $item->id && in_array($menu->query['view'], ['html', 'xml']) && empty($item->menuIdList[$view]) ) { $item->menuIdList[$view] = $menu->id; } } } } return $items; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings