Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/tag.php.tar
Назад
home/wuectly/www/libraries/cms/html/tag.php 0000604 00000011101 15245602024 0014770 0 ustar 00 <?php /** * @package Joomla.Libraries * @subpackage HTML * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_PLATFORM') or die; use Joomla\Utilities\ArrayHelper; /** * Utility class for tags * * @since 3.1 */ abstract class JHtmlTag { /** * Cached array of the tag items. * * @var array * @since 3.1 */ protected static $items = array(); /** * Returns an array of tags. * * @param array $config An array of configuration options. By default, only * published and unpublished categories are returned. * * @return array * * @since 3.1 */ public static function options($config = array('filter.published' => array(0, 1))) { $hash = md5(serialize($config)); if (!isset(static::$items[$hash])) { $config = (array) $config; $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id, a.title, a.level') ->from('#__tags AS a') ->where('a.parent_id > 0'); // Filter on the published state if (isset($config['filter.published'])) { if (is_numeric($config['filter.published'])) { $query->where('a.published = ' . (int) $config['filter.published']); } elseif (is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } // Filter on the language if (isset($config['filter.language'])) { if (is_string($config['filter.language'])) { $query->where('a.language = ' . $db->quote($config['filter.language'])); } elseif (is_array($config['filter.language'])) { foreach ($config['filter.language'] as &$language) { $language = $db->quote($language); } $query->where('a.language IN (' . implode(',', $config['filter.language']) . ')'); } } $query->order('a.lft'); $db->setQuery($query); $items = $db->loadObjectList(); // Assemble the list options. static::$items[$hash] = array(); foreach ($items as &$item) { $repeat = ($item->level - 1 >= 0) ? $item->level - 1 : 0; $item->title = str_repeat('- ', $repeat) . $item->title; static::$items[$hash][] = JHtml::_('select.option', $item->id, $item->title); } } return static::$items[$hash]; } /** * Returns an array of tags. * * @param array $config An array of configuration options. By default, only published and unpublished tags are returned. * * @return array Tag data * * @since 3.1 */ public static function tags($config = array('filter.published' => array(0, 1))) { $hash = md5(serialize($config)); $config = (array) $config; $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id, a.title, a.level, a.parent_id') ->from('#__tags AS a') ->where('a.parent_id > 0'); // Filter on the published state if (isset($config['filter.published'])) { if (is_numeric($config['filter.published'])) { $query->where('a.published = ' . (int) $config['filter.published']); } elseif (is_array($config['filter.published'])) { $config['filter.published'] = ArrayHelper::toInteger($config['filter.published']); $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')'); } } $query->order('a.lft'); $db->setQuery($query); $items = $db->loadObjectList(); // Assemble the list options. static::$items[$hash] = array(); foreach ($items as &$item) { $repeat = ($item->level - 1 >= 0) ? $item->level - 1 : 0; $item->title = str_repeat('- ', $repeat) . $item->title; static::$items[$hash][] = JHtml::_('select.option', $item->id, $item->title); } return static::$items[$hash]; } /** * This is just a proxy for the formbehavior.ajaxchosen method * * @param string $selector DOM id of the tag field * @param boolean $allowCustom Flag to allow custom values * * @return void * * @since 3.1 */ public static function ajaxfield($selector = '#jform_tags', $allowCustom = true) { // Get the component parameters $params = JComponentHelper::getParams('com_tags'); $minTermLength = (int) $params->get('min_term_length', 3); $displayData = array( 'minTermLength' => $minTermLength, 'selector' => $selector, 'allowCustom' => JFactory::getUser()->authorise('core.create', 'com_tags') ? $allowCustom : false, ); JLayoutHelper::render('joomla.html.tag', $displayData); return; } } home/wuectly/www/components/com_tags/models/tag.php 0000604 00000021432 15245617131 0016547 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_tags * * @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; use Joomla\Utilities\ArrayHelper; /** * Tags Component Tag Model * * @since 3.1 */ class TagsModelTag extends JModelList { /** * The tags that apply. * * @var object * @since 3.1 */ protected $tag = null; /** * The list of items associated with the tags. * * @var array * @since 3.1 */ protected $items = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 3.1 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'core_content_id', 'c.core_content_id', 'core_title', 'c.core_title', 'core_type_alias', 'c.core_type_alias', 'core_checked_out_user_id', 'c.core_checked_out_user_id', 'core_checked_out_time', 'c.core_checked_out_time', 'core_catid', 'c.core_catid', 'core_state', 'c.core_state', 'core_access', 'c.core_access', 'core_created_user_id', 'c.core_created_user_id', 'core_created_time', 'c.core_created_time', 'core_modified_time', 'c.core_modified_time', 'core_ordering', 'c.core_ordering', 'core_featured', 'c.core_featured', 'core_language', 'c.core_language', 'core_hits', 'c.core_hits', 'core_publish_up', 'c.core_publish_up', 'core_publish_down', 'c.core_publish_down', 'core_images', 'c.core_images', 'core_urls', 'c.core_urls', 'match_count', ); } parent::__construct($config); } /** * Method to get a list of items for a list of tags. * * @return mixed An array of objects on success, false on failure. * * @since 3.1 */ public function getItems() { // Invoke the parent getItems method to get the main list $items = parent::getItems(); if (!empty($items)) { foreach ($items as $item) { $item->link = TagsHelperRoute::getItemRoute( $item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router ); // Get display date switch ($this->state->params->get('tag_list_show_date')) { case 'modified': $item->displayDate = $item->core_modified_time; break; case 'created': $item->displayDate = $item->core_created_time; break; default: case 'published': $item->displayDate = ($item->core_publish_up == 0) ? $item->core_created_time : $item->core_publish_up; break; } } } return $items; } /** * Method to build an SQL query to load the list data of all items with a given tag. * * @return string An SQL query * * @since 3.1 */ protected function getListQuery() { $tagId = $this->getState('tag.id') ? : ''; $typesr = $this->getState('tag.typesr'); $orderByOption = $this->getState('list.ordering', 'c.core_title'); $includeChildren = $this->state->params->get('include_children', 0); $orderDir = $this->getState('list.direction', 'ASC'); $matchAll = $this->getState('params')->get('return_any_or_all', 1); $language = $this->getState('tag.language'); $stateFilter = $this->getState('tag.state'); // Optionally filter on language if (empty($language)) { $language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all'); } $tagsHelper = new JHelperTags; $query = $tagsHelper->getTagItemsQuery($tagId, $typesr, $includeChildren, $orderByOption, $orderDir, $matchAll, $language, $stateFilter); if ($this->state->get('list.filter')) { $query->where($this->_db->quoteName('c.core_title') . ' LIKE ' . $this->_db->quote('%' . $this->state->get('list.filter') . '%')); } return $query; } /** * 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 3.1 */ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') { $app = JFactory::getApplication(); // Load the parameters. $params = $app->isClient('administrator') ? JComponentHelper::getParams('com_tags') : $app->getParams(); $this->setState('params', $params); // Load state from the request. $ids = (array) $app->input->get('id', array(), 'string'); if (count($ids) == 1) { $ids = explode(',', $ids[0]); } $ids = ArrayHelper::toInteger($ids); // Remove zero values resulting from bad input $ids = array_filter($ids); $pkString = implode(',', $ids); $this->setState('tag.id', $pkString); // Get the selected list of types from the request. If none are specified all are used. $typesr = $app->input->get('types', array(), 'array'); if ($typesr) { // Implode is needed because the array can contain a string with a coma separated list of ids $typesr = implode(',', $typesr); // Sanitise $typesr = explode(',', $typesr); $typesr = ArrayHelper::toInteger($typesr); $this->setState('tag.typesr', $typesr); } $language = $app->input->getString('tag_list_language_filter'); $this->setState('tag.language', $language); // List state information $format = $app->input->getWord('format'); if ($format === 'feed') { $limit = $app->get('feed_limit'); } else { $limit = $params->get('display_num', $app->get('list_limit', 20)); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $limit, 'uint'); } $this->setState('list.limit', $limit); $offset = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $offset); $itemid = $pkString . ':' . $app->input->get('Itemid', 0, 'int'); $orderCol = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); $orderCol = !$orderCol ? $this->state->params->get('tag_list_orderby', 'c.core_title') : $orderCol; if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'c.core_title'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_order_direction', 'filter_order_Dir', '', 'string'); $listOrder = !$listOrder ? $this->state->params->get('tag_list_orderby_direction', 'ASC') : $listOrder; if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $this->setState('tag.state', 1); // Optional filter text $filterSearch = $app->getUserStateFromRequest('com_tags.tag.list.' . $itemid . '.filter_search', 'filter-search', '', 'string'); $this->setState('list.filter', $filterSearch); } /** * Method to get tag data for the current tag or tags * * @param integer $pk An optional ID * * @return object * * @since 3.1 */ public function getItem($pk = null) { if (!isset($this->item)) { $this->item = false; if (empty($pk)) { $pk = $this->getState('tag.id'); } // Get a level row instance. $table = JTable::getInstance('Tag', 'TagsTable'); $idsArray = explode(',', $pk); // Attempt to load the rows into an array. foreach ($idsArray as $id) { try { $table->load($id); // Check published state. if ($published = $this->getState('tag.state')) { if ($table->published != $published) { continue; } } if (!in_array($table->access, JFactory::getUser()->getAuthorisedViewLevels())) { continue; } // Convert the JTable to a clean JObject. $properties = $table->getProperties(1); $this->item[] = ArrayHelper::toObject($properties, 'JObject'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } } } if (!$this->item) { return JError::raiseError(404, JText::_('COM_TAGS_TAG_NOT_FOUND')); } return $this->item; } /** * Increment the hit counter. * * @param integer $pk Optional primary key of the article to increment. * * @return boolean True if successful; false otherwise and internal error set. * * @since 3.2 */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('tag.id'); $table = JTable::getInstance('Tag', 'TagsTable'); $table->hit($pk); // Load the table data for later $table->load($pk); if (!$table->hasPrimaryKey()) { JError::raiseError(404, JText::_('COM_TAGS_TAG_NOT_FOUND')); } } return true; } } home/wuectly/www/libraries/fof/form/field/tag.php 0000604 00000011633 15245617171 0016065 0 ustar 00 <?php /** * @package FrameworkOnFramework * @subpackage form * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('FOF_INCLUDED') or die; JFormHelper::loadFieldClass('tag'); /** * Form Field class for FOF * Tag Fields * * @package FrameworkOnFramework * @since 2.1 */ class FOFFormFieldTag extends JFormFieldTag implements FOFFormField { protected $static; protected $repeatable; /** @var FOFTable The item being rendered in a repeatable form field */ public $item; /** @var int A monotonically increasing number, denoting the row number in a repeatable view */ public $rowid; /** * Method to get certain otherwise inaccessible properties from the form field object. * * @param string $name The property name for which to the the value. * * @return mixed The property value or null. * * @since 2.0 */ public function __get($name) { switch ($name) { case 'static': if (empty($this->static)) { $this->static = $this->getStatic(); } return $this->static; break; case 'repeatable': if (empty($this->repeatable)) { $this->repeatable = $this->getRepeatable(); } return $this->repeatable; break; default: return parent::__get($name); } } /** * Method to get a list of tags * * @return array The field option objects. * * @since 3.1 */ protected function getOptions() { $options = array(); $published = $this->element['published']? $this->element['published'] : array(0,1); $db = FOFPlatform::getInstance()->getDbo(); $query = $db->getQuery(true) ->select('DISTINCT a.id AS value, a.path, a.title AS text, a.level, a.published, a.lft') ->from('#__tags AS a') ->join('LEFT', $db->quoteName('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); if ($this->item instanceof FOFTable) { $item = $this->item; } else { $item = $this->form->getModel()->getItem(); } if ($item instanceof FOFTable) { // Fake value for selected tags $keyfield = $item->getKeyName(); $content_id = $item->$keyfield; $type = $item->getContentType(); $selected_query = $db->getQuery(true); $selected_query ->select('tag_id') ->from('#__contentitem_tag_map') ->where('content_item_id = ' . (int) $content_id) ->where('type_alias = ' . $db->quote($type)); $db->setQuery($selected_query); $this->value = $db->loadColumn(); } // Filter language if (!empty($this->element['language'])) { $query->where('a.language = ' . $db->quote($this->element['language'])); } $query->where($db->qn('a.lft') . ' > 0'); // Filter to only load active items // Filter on the published state if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } elseif (is_array($published)) { FOFUtilsArray::toInteger($published); $query->where('a.published IN (' . implode(',', $published) . ')'); } $query->order('a.lft ASC'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { return false; } // Prepare nested data if ($this->isNested()) { $this->prepareOptionsNested($options); } else { $options = JHelperTags::convertPathsToNames($options); } return $options; } /** * Get the rendering of this field type for static display, e.g. in a single * item view (typically a "read" task). * * @since 2.0 * * @return string The field HTML */ public function getStatic() { $class = $this->element['class'] ? (string) $this->element['class'] : ''; $translate = $this->element['translate'] ? (string) $this->element['translate'] : false; $options = $this->getOptions(); $html = ''; foreach ($options as $option) { $html .= '<span>'; if ($translate == true) { $html .= JText::_($option->text); } else { $html .= $option->text; } $html .= '</span>'; } return '<span id="' . $this->id . '" class="' . $class . '">' . $html . '</span>'; } /** * Get the rendering of this field type for a repeatable (grid) display, * e.g. in a view listing many item (typically a "browse" task) * * @since 2.1 * * @return string The field HTML */ public function getRepeatable() { $class = $this->element['class'] ? (string) $this->element['class'] : ''; $translate = $this->element['translate'] ? (string) $this->element['translate'] : false; $options = $this->getOptions(); $html = ''; foreach ($options as $option) { $html .= '<span>'; if ($translate == true) { $html .= JText::_($option->text); } else { $html .= $option->text; } $html .= '</span>'; } return '<span class="' . $this->id . ' ' . $class . '">' . $html . '</span>'; } } home/wuectly/www/administrator/components/com_tags/controllers/tag.php 0000604 00000002774 15245654237 0022532 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_tags * * @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; /** * The Tag Controller * * @since 3.1 */ class TagsControllerTag extends JControllerForm { /** * Method to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 3.1 */ protected function allowAdd($data = array()) { $user = JFactory::getUser(); return $user->authorise('core.create', 'com_tags'); } /** * Method to check if you can edit a record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 3.1 */ protected function allowEdit($data = array(), $key = 'id') { // Since there is no asset tracking and no categories, revert to the component permissions. return parent::allowEdit($data, $key); } /** * Method to run batch operations. * * @param object $model The model. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 3.1 */ public function batch($model = null) { $this->checkToken(); // Set the model $model = $this->getModel('Tag'); // Preset the redirect $this->setRedirect('index.php?option=com_tags&view=tags'); return parent::batch($model); } } home/wuectly/www/administrator/components/com_tags/models/tag.php 0000604 00000023277 15245657610 0021446 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_tags * * @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; use Joomla\Registry\Registry; use Joomla\String\StringHelper; /** * Tags Component Tag Model * * @since 3.1 */ class TagsModelTag extends JModelAdmin { /** * @var string The prefix to use with controller messages. * @since 3.1 */ protected $text_prefix = 'COM_TAGS'; /** * @var string The type alias for this content type. * @since 3.2 */ public $typeAlias = 'com_tags.tag'; /** * Allowed batch commands * * @var array * @since 3.7.0 */ protected $batch_commands = array( 'assetgroup_id' => 'batchAccess', 'language_id' => 'batchLanguage', ); /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 3.1 */ protected function canDelete($record) { if (empty($record->id) || $record->published != -2) { return false; } return parent::canDelete($record); } /** * Method to get a table object, load it if necessary. * * @param string $type The table name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A JTable object * * @since 3.1 */ public function getTable($type = 'Tag', $prefix = 'TagsTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Auto-populate the model state. * * @note Calling getState in this method will result in recursion. * * @return void * * @since 3.1 */ protected function populateState() { $app = JFactory::getApplication('administrator'); $parentId = $app->input->getInt('parent_id'); $this->setState('tag.parent_id', $parentId); // Load the User state. $pk = $app->input->getInt('id'); $this->setState($this->getName() . '.id', $pk); // Load the parameters. $params = JComponentHelper::getParams('com_tags'); $this->setState('params', $params); } /** * Method to get a tag. * * @param integer $pk An optional id of the object to get, otherwise the id from the model state is used. * * @return mixed Tag data object on success, false on failure. * * @since 3.1 */ public function getItem($pk = null) { if ($result = parent::getItem($pk)) { // Prime required properties. if (empty($result->id)) { $result->parent_id = $this->getState('tag.parent_id'); } // Convert the metadata field to an array. $registry = new Registry($result->metadata); $result->metadata = $registry->toArray(); // Convert the images field to an array. $registry = new Registry($result->images); $result->images = $registry->toArray(); // Convert the urls field to an array. $registry = new Registry($result->urls); $result->urls = $registry->toArray(); // Convert the modified date to local user time for display in the form. $tz = new DateTimeZone(JFactory::getApplication()->get('offset')); if ((int) $result->modified_time) { $date = new JDate($result->modified_time); $date->setTimezone($tz); $result->modified_time = $date->toSql(true); } else { $result->modified_time = null; } } return $result; } /** * Method to get the row form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure * * @since 3.1 */ public function getForm($data = array(), $loadData = true) { $jinput = JFactory::getApplication()->input; // Get the form. $form = $this->loadForm('com_tags.tag', 'tag', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } $user = JFactory::getUser(); if (!$user->authorise('core.edit.state', 'com_tags' . $jinput->get('id'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is a record you can edit. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 3.1 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_tags.edit.tag.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_tags.tag', $data); return $data; } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 3.1 */ public function save($data) { $dispatcher = JEventDispatcher::getInstance(); $table = $this->getTable(); $input = JFactory::getApplication()->input; $pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState($this->getName() . '.id'); $isNew = true; $context = $this->option . '.' . $this->name; // Include the plugins for the save events. JPluginHelper::importPlugin($this->events_map['save']); // Load the row if saving an existing tag. if ($pk > 0) { $table->load($pk); $isNew = false; } // Set the new parent id if parent id not matched OR while New/Save as Copy . if ($table->parent_id != $data['parent_id'] || $data['id'] == 0) { $table->setLocation($data['parent_id'], 'last-child'); } if (isset($data['images']) && is_array($data['images'])) { $registry = new Registry($data['images']); $data['images'] = (string) $registry; } if (isset($data['urls']) && is_array($data['urls'])) { $registry = new Registry($data['urls']); $data['urls'] = (string) $registry; } // Alter the title for save as copy if ($input->get('task') == 'save2copy') { $origTable = $this->getTable(); $origTable->load($input->getInt('id')); if ($data['title'] == $origTable->title) { list($title, $alias) = $this->generateNewTitle($data['parent_id'], $data['alias'], $data['title']); $data['title'] = $title; $data['alias'] = $alias; } elseif ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } $data['published'] = 0; } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } // Bind the rules. if (isset($data['rules'])) { $rules = new JAccessRules($data['rules']); $table->setRules($rules); } // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the before save event. $result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } // Trigger the after save event. $dispatcher->trigger($this->event_after_save, array($context, &$table, $isNew)); // Rebuild the path for the tag: if (!$table->rebuildPath($table->id)) { $this->setError($table->getError()); return false; } // Rebuild the paths of the tag's children: if (!$table->rebuild($table->id, $table->lft, $table->level, $table->path)) { $this->setError($table->getError()); return false; } $this->setState($this->getName() . '.id', $table->id); // Clear the cache $this->cleanCache(); return true; } /** * Method rebuild the entire nested set tree. * * @return boolean False on failure or error, true otherwise. * * @since 3.1 */ public function rebuild() { // Get an instance of the table object. $table = $this->getTable(); if (!$table->rebuild()) { $this->setError($table->getError()); return false; } // Clear the cache $this->cleanCache(); return true; } /** * Method to save the reordered nested set tree. * First we save the new order values in the lft values of the changed ids. * Then we invoke the table rebuild to implement the new ordering. * * @param array $idArray An array of primary key ids. * @param integer $lftArray The lft value * * @return boolean False on failure or error, True otherwise * * @since 3.1 */ public function saveorder($idArray = null, $lftArray = null) { // Get an instance of the table object. $table = $this->getTable(); if (!$table->saveorder($idArray, $lftArray)) { $this->setError($table->getError()); return false; } // Clear the cache $this->cleanCache(); return true; } /** * Method to change the title & alias. * * @param integer $parentId The id of the parent. * @param string $alias The alias. * @param string $title The title. * * @return array Contains the modified title and alias. * * @since 3.1 */ protected function generateNewTitle($parentId, $alias, $title) { // Alter the title & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias, 'parent_id' => $parentId))) { $title = ($table->title != $title) ? $title : StringHelper::increment($title); $alias = StringHelper::increment($alias, 'dash'); } return array($title, $alias); } } home/wuectly/www/layouts/joomla/html/batch/tag.php 0000604 00000001477 15245662155 0016326 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage Layout * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Layout variables * --------------------- * None */ ?> <label id="batch-tag-lbl" for="batch-tag-id" class="modalTooltip" title="<?php echo JHtml::_('tooltipText', 'JLIB_HTML_BATCH_TAG_LABEL', 'JLIB_HTML_BATCH_TAG_LABEL_DESC'); ?>"> <?php echo JText::_('JLIB_HTML_BATCH_TAG_LABEL'); ?> </label> <select name="batch[tag]" class="inputbox" id="batch-tag-id"> <option value=""><?php echo JText::_('JLIB_HTML_BATCH_TAG_NOCHANGE'); ?></option> <?php echo JHtml::_('select.options', JHtml::_('tag.tags', array('filter.published' => array(1))), 'value', 'text'); ?> </select> home/wuectly/www/libraries/f0f/form/field/tag.php 0000604 00000011633 15245673051 0015765 0 ustar 00 <?php /** * @package FrameworkOnFramework * @subpackage form * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // Protect from unauthorized access defined('F0F_INCLUDED') or die; JFormHelper::loadFieldClass('tag'); /** * Form Field class for F0F * Tag Fields * * @package FrameworkOnFramework * @since 2.1 */ class F0FFormFieldTag extends JFormFieldTag implements F0FFormField { protected $static; protected $repeatable; /** @var F0FTable The item being rendered in a repeatable form field */ public $item; /** @var int A monotonically increasing number, denoting the row number in a repeatable view */ public $rowid; /** * Method to get certain otherwise inaccessible properties from the form field object. * * @param string $name The property name for which to the the value. * * @return mixed The property value or null. * * @since 2.0 */ public function __get($name) { switch ($name) { case 'static': if (empty($this->static)) { $this->static = $this->getStatic(); } return $this->static; break; case 'repeatable': if (empty($this->repeatable)) { $this->repeatable = $this->getRepeatable(); } return $this->repeatable; break; default: return parent::__get($name); } } /** * Method to get a list of tags * * @return array The field option objects. * * @since 3.1 */ protected function getOptions() { $options = array(); $published = $this->element['published']? $this->element['published'] : array(0,1); $db = F0FPlatform::getInstance()->getDbo(); $query = $db->getQuery(true) ->select('DISTINCT a.id AS value, a.path, a.title AS text, a.level, a.published, a.lft') ->from('#__tags AS a') ->join('LEFT', $db->quoteName('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); if ($this->item instanceof F0FTable) { $item = $this->item; } else { $item = $this->form->getModel()->getItem(); } if ($item instanceof F0FTable) { // Fake value for selected tags $keyfield = $item->getKeyName(); $content_id = $item->$keyfield; $type = $item->getContentType(); $selected_query = $db->getQuery(true); $selected_query ->select('tag_id') ->from('#__contentitem_tag_map') ->where('content_item_id = ' . (int) $content_id) ->where('type_alias = ' . $db->quote($type)); $db->setQuery($selected_query); $this->value = $db->loadColumn(); } // Filter language if (!empty($this->element['language'])) { $query->where('a.language = ' . $db->quote($this->element['language'])); } $query->where($db->qn('a.lft') . ' > 0'); // Filter to only load active items // Filter on the published state if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } elseif (is_array($published)) { F0FUtilsArray::toInteger($published); $query->where('a.published IN (' . implode(',', $published) . ')'); } $query->order('a.lft ASC'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { return false; } // Prepare nested data if ($this->isNested()) { $this->prepareOptionsNested($options); } else { $options = JHelperTags::convertPathsToNames($options); } return $options; } /** * Get the rendering of this field type for static display, e.g. in a single * item view (typically a "read" task). * * @since 2.0 * * @return string The field HTML */ public function getStatic() { $class = $this->element['class'] ? (string) $this->element['class'] : ''; $translate = $this->element['translate'] ? (string) $this->element['translate'] : false; $options = $this->getOptions(); $html = ''; foreach ($options as $option) { $html .= '<span>'; if ($translate == true) { $html .= JText::_($option->text); } else { $html .= $option->text; } $html .= '</span>'; } return '<span id="' . $this->id . '" class="' . $class . '">' . $html . '</span>'; } /** * Get the rendering of this field type for a repeatable (grid) display, * e.g. in a view listing many item (typically a "browse" task) * * @since 2.1 * * @return string The field HTML */ public function getRepeatable() { $class = $this->element['class'] ? (string) $this->element['class'] : ''; $translate = $this->element['translate'] ? (string) $this->element['translate'] : false; $options = $this->getOptions(); $html = ''; foreach ($options as $option) { $html .= '<span>'; if ($translate == true) { $html .= JText::_($option->text); } else { $html .= $option->text; } $html .= '</span>'; } return '<span class="' . $this->id . ' ' . $class . '">' . $html . '</span>'; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка