? GR0V Shell

GR0V shell

Linux www.koreapackagetour.com 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64

Path : /home/admin/domains/happytokorea.net/public_html/test/plugins/josetta_ext/k2item/
File Upload :
Current File : /home/admin/domains/happytokorea.net/public_html/test/plugins/josetta_ext/k2item/k2item.php

<?php
/**
 * @version     $Id: k2item.php 1743 2012-10-24 15:48:18Z lefteris.kavadas $
 * @package     K2
 * @author      JoomlaWorks http://www.joomlaworks.net
 * @copyright   Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
 * @license     GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

defined('_JEXEC') or die;

// include K2Base Josetta plugin, which shares many methods and thus is used as a base class
require_once JPATH_PLUGINS . '/josetta_ext/k2item/classes/basek2plugin.php';

class plgJosetta_extK2item extends plgJosetta_extBaseK2Plugin
{

	protected $_context = 'com_k2_item';
	protected $_defaultTable = 'K2Item';

	public function onJosettaGetTypes()
	{
		$this->loadLanguages();
		$item = array(self::$this->_context => 'K2 ' . JText::_('K2_ITEMS'));
		$items[] = $item;
		return $items;
	}

	public function onJosettaLoadItem($context, $id = '')
	{

		if ((!empty($context) && ($context != $this->_context)) || (empty($id)))
		{
			return null;
		}
		$item = parent::onJosettaLoadItem($context, $id);

		// Merge introtext and fulltext
		$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;

		// Get tags
		K2Model::addIncludePath(JPATH_SITE . '/components/com_k2/models');
		JLoader::register('K2HelperUtilities', JPATH_SITE . '/components/com_k2/helpers/utilities.php');
		$model = K2Model::getInstance('Item', 'K2Model');
		$tags = $model->getItemTags($item->id);
		$tmp = array();
		foreach ($tags as $tag)
		{
			$tmp[] = $tag->name;
		}
		$item->tags = implode(', ', $tmp);

		// Get extra fields
		$extraFields = $model->getItemExtraFields($item->extra_fields);
		$html = '';
		if (count($extraFields))
		{
			$html .= '<ul>';
			foreach ($extraFields as $key => $extraField)
			{
				$html .= '<li class="type' . ucfirst($extraField->type) . ' group' . $extraField->group
					. '">
                <span class="itemExtraFieldsLabel">' . $extraField->name . ':</span>
                <span class="itemExtraFieldsValue">' . $extraField->value . '</span>
            </li>';
			}
			$html .= '</ul>';
		}
		$item->extra_fields = $html;

		// Return the item
		return $item;
	}

	/**
	 * Save an item after it has been translated
	 * This will be called by Josetta when a user clicks
	 * the Save button. The context is passed so
	 * that each plugin knows if it must process the data or not
	 *
	 * if $item->reference_id is empty, this is
	 * a new item, otherwise we are updating the item
	 *
	 * $item->data contains the fields entered by the user
	 * that needs to be saved
	 *
	 *@param context type
	 *@param data in form of array
	 *
	 *return table id if data is inserted
	 *
	 *return false if error occurs
	 *
	 */

	public function onJosettaSaveItem($context, $item, &$errors)
	{

		if (($context != $this->_context))
		{
			return;
		}

		// load languages for form and error messages
		$this->loadLanguages();

		require_once JPATH_PLUGINS . '/josetta_ext/k2item/models/item.php';
		$k2ItemModel = new JosettaK2ModelItem();

		$savedItemId = $k2ItemModel->save($item);

		if (empty($savedItemId))
		{
			// make sure errors are displayed
			JosettaHelper::enqueueMessages($k2ItemModel->getErrors());
			return false;
		}

		return $savedItemId;

	}

}

T1KUS90T
  root-grov@210.1.60.28:~$