Spade

Mini Shell

Directory:~$ /home/lmsyaran/www/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/www/joomla4/com_jamegafilter.tar

index.html000064400000000054151164267360006553 0ustar00<html><body
bgcolor="#FFFFFF"></body></html>jamegafilter.php000064400000003155151164267360007726
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

if (!defined('DS')) {
	define('DS', DIRECTORY_SEPARATOR);
}

if (!JFactory::getUser()->authorise('core.manage',
'com_jamegafilter'))
{
    throw new
JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'),
403);
}

JLoader::register('JaMegafilterHelper',
__DIR__.'/helper.php');
JLoader::register('JFormFieldJaMegafilter_FilterFields',
__DIR__.'/models/fields/jamegafilter_filterfields.php');

$app = JFactory::getApplication();
$input = $app->input;
$params = JComponentHelper::getParams('com_jamegafilter');
$cronToken = $params->get('crontoken');
$view = $input->get('view');

if (!$cronToken) {
   
$app->enqueueMessage(JText::_('COM_JAMEGAFILTER_NEED_CRON_BEFORE_USE'),
'error');
    if ($view !== 'cron') {
       
$app->redirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
    }
}

$controller = JControllerLegacy::getInstance('JaMegafilter');
$controller->execute($input->getCmd('task'));

// Redirect if set by the controller
$controller->redirect();
helper.php000064400000004210151164267360006544 0ustar00<?php
/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */
//No direct to access this file.
defined('_JEXEC') or die('Restricted access');

jimport('joomla.filesystem.folder');

class JaMegafilterHelper
{
	static function getSupportedComponentList() {
		if (JFolder::exists(JPATH_PLUGINS.'/jamegafilter/')) {
			$path = JPATH_PLUGINS.'/jamegafilter/';
			$folders = JFolder::folders($path);
			return $folders;
		}
		
		return array();
	}
	
	static function getComponentStatus($component)
	{
		$db = JFactory::getDbo();
		$q = 'select enabled from #__extensions where
type="component" and element =
"'.$component.'"';
		$db->setQuery($q);
		$status = $db->loadResult();
		if($status) {
			return true;
		} else {
			return false;
		}
	}
	
	static function hasMegafilterModule() {
		$template = JFactory::getApplication()->getTemplate();
		$file = JPATH_SITE . '/templates/' . $template .
'/templateDetails.xml';
		$xml = simplexml_load_file($file); 	
		$positions = array();
		foreach	($xml->positions->children() as $p) {
			$positions[] = (string) $p;
		}
		
		$modules = JModuleHelper::getModuleList();
		$i = 0;
		foreach ($modules as $module) {
			if ($module->module === 'mod_jamegafilter' &&
$module->menuid > 0 ) {
				$i++;
			}
		}
		return $i;
	}
	
	static function addSubmenu($vName)
	{
		JHtmlSidebar::addEntry(
			JText::_('COM_JAMEGAFILTER_FILTERS'),
			'index.php?option=com_jamegafilter&view=defaults',
			$vName == 'defaults'
		);
		JHtmlSidebar::addEntry(
			JText::_('COM_JAMEGAFILTER_CRON'),
			'index.php?option=com_jamegafilter&view=cron',
			$vName == 'cron'
		);
	}
}base.php000064400000005530151164267360006205 0ustar00<?php
/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */
//No direct to access this file.
defined('_JEXEC') or die('Restricted access');

class BaseFilterHelper {
	const ALL = '-1';
	const NONE = '0';
	const INCLUDE_ROOT = '1';

	function __construct($params = array()){
		if (!empty($params)) {
			$this->params =
$this->buildFilterParams($params['filterfields']);
		}
	}

	function buildFilterParams($data) {
		$params = array();
		foreach ($data as $value) {
			if (!is_array($value)) continue;

			foreach ($value as $v) {
				$params[] = $v;
			}
		}

		return $params;
	}
	
	public function checkPublished($field) {
		foreach ($this->params AS $param) {
			if (isset($param['field']) && $field ==
$param['field']) {
				if ($param['published'] || $param['sort']) {
					return 1;
				}
			}
		}
		return 0;
	}
	
	public function checkDisplayOnFO($field) {
		foreach ($this->params AS $param) {
			if (isset($param['field']) && $field ==
$param['field']) {
				if ($param['showoff']) {
					return 1;
				}
			}
		}
		return 0;
	}
	
	public function getFieldConfig($field) {
		foreach ($this->params AS $param) {
			if (isset($param['field']) && $field ==
$param['field']) {
				return $param;
			}
		}
	}

	public function generateThumb($itemId, $img, $type)
	{
		if ($this->_params->get('generate_thumb')) {
			if (preg_match('/^(http|https):\/\//', $img)) {
				return $img;
			}

			$file = JPATH_ROOT . '/' . trim($img, '/');
			if (!JFile::exists($file)) {
				return '';
			}

			$width = (int) $this->_params->get('thumb_width', 300);
			$width = $width < 100 ? 100 : $width;
			$height = (int) $this->_params->get('thumb_height',
300);
			$height = $height < 100 ? 100 : $height;

			$info = pathinfo($file);
			$name = "{$info['filename']}_{$width}x{$height}_";
			$name .= md5(JFilterOutput::stringURLSafe($img) . '-' .
$itemId);
			
			$thumb = 'images/megafilter-thumb/' . $type . '/' .
$name . '.' . $info['extension'];
			$thumbPath = JPATH_ROOT . '/' . $thumb;
			if (JFile::exists($thumbPath)) {
				return $thumb;
			}

			$image = new \Gumlet\ImageResize($file);
			$image->resizeToBestFit($width, $height);

			JFolder::create(JPATH_ROOT . '/images/megafilter-thumb/' .
$type);
			$image->save($thumbPath);

			return $thumb;
		}

		return $img;
	}

}controller.php000064400000001520151164267360007451 0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class JaMegafilterController extends JControllerLegacy
{
	/**
	 * The default view for the display method.
	 *
	 * @var string
	 * @since 12.2
	 */
	protected $default_view = 'defaults';
}
access.xml000064400000001416151164267360006544 0ustar00<?xml
version="1.0" encoding="utf-8" ?>
<access component="com_jamegafilter">
    <section name="component">
        <action name="core.admin"
title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
        <action name="core.options"
title="JACTION_OPTIONS"
description="JACTION_OPTIONS_COMPONENT_DESC" />
        <action name="core.manage"
title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC" />
        <action name="jamegafilter.create"
title="JACTION_CREATE"
description="JACTION_CREATE_COMPONENT_DESC" />
        <action name="jamegafilter.delete"
title="JACTION_DELETE"
description="JACTION_DELETE_COMPONENT_DESC" />
        <action name="jamegafilter.edit"
title="JACTION_EDIT"
description="JACTION_EDIT_COMPONENT_DESC" />
    </section>
</access>
config.xml000064400000000723151164267360006550 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<config>
    
    <fieldset
        name="permissions"
        label="JCONFIG_PERMISSIONS_LABEL"
        description="JCONFIG_PERMISSIONS_DESC"
    >

        <field
            name="rules"
            type="rules"
            label="JCONFIG_PERMISSIONS_LABEL"
            validate="rules"
            filter="rules"
            component="com_jamegafilter"
            section="component"
        />
    </fieldset>
</config>
sql/index.html000064400000000054151164267360007352
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>sql/updates/index.html000064400000000054151164267360011017
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>sql/updates/mysql/index.html000064400000000054151164267360012164
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>sql/uninstall.mysql.utf8.sql000064400000000047151164267360012142
0ustar00DROP TABLE IF EXISTS
`#__jamegafilter`;sql/install.mysql.utf8.sql000064400000000532151164267360011576
0ustar00DROP TABLE IF EXISTS `#__jamegafilter`;

CREATE TABLE `#__jamegafilter` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `title` VARCHAR(255) NOT NULL,
    `published` INT(1) NOT NULL DEFAULT '1',
    `params` MEDIUMTEXT NOT NULL,
    `type` VARCHAR(255) NOT NULL,
    PRIMARY KEY (`id`)
)

ENGINE =MyISAM
AUTO_INCREMENT =0
DEFAULT CHARSET =utf8;
assets/gumlet-image-resize/ImageResize.php000064400000055647151164267360014673
0ustar00<?php
namespace Gumlet;

/**
 * @package    php-image-resize
 *
 * @copyright 
https://github.com/gumlet/php-image-resize/blob/master/Licence.md
 * @license    MIT
 */

defined('_JEXEC') or die;


use Exception;

/**
 * PHP class to resize and scale images
 */
class ImageResize
{
    const CROPTOP = 1;
    const CROPCENTRE = 2;
    const CROPCENTER = 2;
    const CROPBOTTOM = 3;
    const CROPLEFT = 4;
    const CROPRIGHT = 5;
    const CROPTOPCENTER = 6;
    const IMG_FLIP_HORIZONTAL = 0;
    const IMG_FLIP_VERTICAL = 1;
    const IMG_FLIP_BOTH = 2;

    public $quality_jpg = 85;
    public $quality_webp = 85;
    public $quality_png = 6;
    public $quality_truecolor = true;
    public $gamma_correct = true;

    public $interlace = 1;

    public $source_type;

    protected $source_image;

    protected $original_w;
    protected $original_h;

    protected $dest_x = 0;
    protected $dest_y = 0;

    protected $source_x;
    protected $source_y;

    protected $dest_w;
    protected $dest_h;

    protected $source_w;
    protected $source_h;

    protected $source_info;
    
    protected $filters = [];

    /**
     * Create instance from a strng
     *
     * @param string $image_data
     * @return ImageResize
     * @throws ImageResizeException
     */
    public static function createFromString($image_data)
    {
        if (empty($image_data) || $image_data === null) {
            throw new ImageResizeException('image_data must not be
empty');
        }
        $resize = new
self('data://application/octet-stream;base64,' .
base64_encode($image_data));
        return $resize;
    }


    /**
     * Add filter function for use right before save image to file.
     *
     * @param callable $filter
     * @return $this
     */
    public function addFilter(callable $filter)
    {
        $this->filters[] = $filter;
        return $this;
    }

    /**
     * Apply filters.
     *
     * @param $image resource an image resource identifier
     * @param $filterType filter type and default value is
IMG_FILTER_NEGATE
     */
    protected function applyFilter($image, $filterType = IMG_FILTER_NEGATE)
    {
        foreach ($this->filters as $function) {
            $function($image, $filterType);
        }
    }

    /**
     * Loads image source and its properties to the instanciated object
     *
     * @param string $filename
     * @return ImageResize
     * @throws ImageResizeException
     */
    public function __construct($filename)
    {
        if (!defined('IMAGETYPE_WEBP')) {
            define('IMAGETYPE_WEBP', 18);
        }
        if ($filename === null || empty($filename) || (substr($filename, 0,
5) !== 'data:' && !is_file($filename))) {
            throw new ImageResizeException('File does not
exist');
        }

        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        if (strstr(finfo_file($finfo, $filename), 'image') ===
false) {
            throw new ImageResizeException('Unsupported file
type');
        }

        if (!$image_info = getimagesize($filename, $this->source_info))
{
            $image_info = getimagesize($filename);
        }

        if (!$image_info) {
            throw new ImageResizeException('Could not read
file');
        }

        list(
            $this->original_w,
            $this->original_h,
            $this->source_type
        ) = $image_info;

        switch ($this->source_type) {
        case IMAGETYPE_GIF:
            $this->source_image = imagecreatefromgif($filename);
            break;

        case IMAGETYPE_JPEG:
            $this->source_image =
$this->imageCreateJpegfromExif($filename);

            // set new width and height for image, maybe it has changed
            $this->original_w = imagesx($this->source_image);
            $this->original_h = imagesy($this->source_image);

            break;

        case IMAGETYPE_PNG:
            $this->source_image = imagecreatefrompng($filename);
            break;

        case IMAGETYPE_WEBP:
            if (version_compare(PHP_VERSION, '5.5.0',
'<')) {
                throw new ImageResizeException('For WebP support PHP
>= 5.5.0 is required');
            }
            $this->source_image = imagecreatefromwebp($filename);
            break;

        default:
            throw new ImageResizeException('Unsupported image
type');
        }

        if (!$this->source_image) {
            throw new ImageResizeException('Could not load
image');
        }

        return $this->resize($this->getSourceWidth(),
$this->getSourceHeight());
    }

    // http://stackoverflow.com/a/28819866
    public function imageCreateJpegfromExif($filename)
    {
        $img = imagecreatefromjpeg($filename);

        if (!function_exists('exif_read_data') ||
!isset($this->source_info['APP1'])  ||
strpos($this->source_info['APP1'], 'Exif') !== 0) {
            return $img;
        }

        try {
            $exif = @exif_read_data($filename);
        } catch (Exception $e) {
            $exif = null;
        }

        if (!$exif || !isset($exif['Orientation'])) {
            return $img;
        }

        $orientation = $exif['Orientation'];

        if ($orientation === 6 || $orientation === 5) {
            $img = imagerotate($img, 270, null);
        } elseif ($orientation === 3 || $orientation === 4) {
            $img = imagerotate($img, 180, null);
        } elseif ($orientation === 8 || $orientation === 7) {
            $img = imagerotate($img, 90, null);
        }

        if ($orientation === 5 || $orientation === 4 || $orientation === 7)
{
            if(function_exists('imageflip')) {
                imageflip($img, IMG_FLIP_HORIZONTAL);
            } else {
                $this->imageFlip($img, IMG_FLIP_HORIZONTAL);
            }
        }

        return $img;
    }

    /**
     * Saves new image
     *
     * @param string $filename
     * @param string $image_type
     * @param integer $quality
     * @param integer $permissions
     * @param boolean $exact_size
     * @return static
     */
    public function save($filename, $image_type = null, $quality = null,
$permissions = null, $exact_size = false)
    {
        $image_type = $image_type ?: $this->source_type;
        $quality = is_numeric($quality) ? (int) abs($quality) : null;

        switch ($image_type) {
        case IMAGETYPE_GIF:
            if( !empty($exact_size) && is_array($exact_size) ){
                $dest_image = imagecreatetruecolor($exact_size[0],
$exact_size[1]);
            } else{
                $dest_image =
imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
            }

            $background = imagecolorallocatealpha($dest_image, 255, 255,
255, 1);
            imagecolortransparent($dest_image, $background);
            imagefill($dest_image, 0, 0, $background);
            imagesavealpha($dest_image, true);
            break;

        case IMAGETYPE_JPEG:
            if( !empty($exact_size) && is_array($exact_size) ){
                $dest_image = imagecreatetruecolor($exact_size[0],
$exact_size[1]);
                $background = imagecolorallocate($dest_image, 255, 255,
255);
                imagefilledrectangle($dest_image, 0, 0, $exact_size[0],
$exact_size[1], $background);
            } else{
                $dest_image =
imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
                $background = imagecolorallocate($dest_image, 255, 255,
255);
                imagefilledrectangle($dest_image, 0, 0,
$this->getDestWidth(), $this->getDestHeight(), $background);
            }
            break;

        case IMAGETYPE_WEBP:
            if (version_compare(PHP_VERSION, '5.5.0',
'<')) {
                throw new ImageResizeException('For WebP support PHP
>= 5.5.0 is required');
            }
            if( !empty($exact_size) && is_array($exact_size) ){
                $dest_image = imagecreatetruecolor($exact_size[0],
$exact_size[1]);
                $background = imagecolorallocate($dest_image, 255, 255,
255);
                imagefilledrectangle($dest_image, 0, 0, $exact_size[0],
$exact_size[1], $background);
            } else{
                $dest_image =
imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
                $background = imagecolorallocate($dest_image, 255, 255,
255);
                imagefilledrectangle($dest_image, 0, 0,
$this->getDestWidth(), $this->getDestHeight(), $background);
            }
            break;

        case IMAGETYPE_PNG:
            if (!$this->quality_truecolor &&
!imageistruecolor($this->source_image)) {
                if( !empty($exact_size) && is_array($exact_size) ){
                    $dest_image = imagecreate($exact_size[0],
$exact_size[1]);
                } else{
                    $dest_image = imagecreate($this->getDestWidth(),
$this->getDestHeight());
                }
            } else {
                if( !empty($exact_size) && is_array($exact_size) ){
                    $dest_image = imagecreatetruecolor($exact_size[0],
$exact_size[1]);
                } else{
                    $dest_image =
imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
                }
            }

            imagealphablending($dest_image, false);
            imagesavealpha($dest_image, true);

            $background = imagecolorallocatealpha($dest_image, 255, 255,
255, 127);
            imagecolortransparent($dest_image, $background);
            imagefill($dest_image, 0, 0, $background);
            break;
        }

        imageinterlace($dest_image, $this->interlace);

        if ($this->gamma_correct) {
            imagegammacorrect($this->source_image, 2.2, 1.0);
        }

        if( !empty($exact_size) && is_array($exact_size) ) {
            if ($this->getSourceHeight() <
$this->getSourceWidth()) {
                $this->dest_x = 0;
                $this->dest_y = ($exact_size[1] -
$this->getDestHeight()) / 2;
            }
            if ($this->getSourceHeight() >
$this->getSourceWidth()) {
                $this->dest_x = ($exact_size[0] -
$this->getDestWidth()) / 2;
                $this->dest_y = 0;
            }
        }
        
        imagecopyresampled(
            $dest_image,
            $this->source_image,
            $this->dest_x,
            $this->dest_y,
            $this->source_x,
            $this->source_y,
            $this->getDestWidth(),
            $this->getDestHeight(),
            $this->source_w,
            $this->source_h
        );
        
        if ($this->gamma_correct) {
            imagegammacorrect($dest_image, 1.0, 2.2);
        }


        $this->applyFilter($dest_image);

        switch ($image_type) {
        case IMAGETYPE_GIF:
            imagegif($dest_image, $filename);
            break;

        case IMAGETYPE_JPEG:
            if ($quality === null || $quality > 100) {
                $quality = $this->quality_jpg;
            }

            imagejpeg($dest_image, $filename, $quality);
            break;

        case IMAGETYPE_WEBP:
            if (version_compare(PHP_VERSION, '5.5.0',
'<')) {
                throw new ImageResizeException('For WebP support PHP
>= 5.5.0 is required');
            }
            if ($quality === null) {
                $quality = $this->quality_webp;
            }

            imagewebp($dest_image, $filename, $quality);
            break;

        case IMAGETYPE_PNG:
            if ($quality === null || $quality > 9) {
                $quality = $this->quality_png;
            }

            imagepng($dest_image, $filename, $quality);
            break;
        }

        if ($permissions) {
            chmod($filename, $permissions);
        }

        imagedestroy($dest_image);

        return $this;
    }

    /**
     * Convert the image to string
     *
     * @param int $image_type
     * @param int $quality
     * @return string
     */
    public function getImageAsString($image_type = null, $quality = null)
    {
        $string_temp = tempnam(sys_get_temp_dir(), '');

        $this->save($string_temp, $image_type, $quality);

        $string = file_get_contents($string_temp);

        unlink($string_temp);

        return $string;
    }

    /**
     * Convert the image to string with the current settings
     *
     * @return string
     */
    public function __toString()
    {
        return $this->getImageAsString();
    }

    /**
     * Outputs image to browser
     * @param string $image_type
     * @param integer $quality
     */
    public function output($image_type = null, $quality = null)
    {
        $image_type = $image_type ?: $this->source_type;

        header('Content-Type: ' .
image_type_to_mime_type($image_type));

        $this->save(null, $image_type, $quality);
    }

    /**
     * Resizes image according to the given short side (short side
proportional)
     *
     * @param integer $max_short
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resizeToShortSide($max_short, $allow_enlarge = false)
    {
        if ($this->getSourceHeight() < $this->getSourceWidth()) {
            $ratio = $max_short / $this->getSourceHeight();
            $long = $this->getSourceWidth() * $ratio;

            $this->resize($long, $max_short, $allow_enlarge);
        } else {
            $ratio = $max_short / $this->getSourceWidth();
            $long = $this->getSourceHeight() * $ratio;

            $this->resize($max_short, $long, $allow_enlarge);
        }

        return $this;
    }

    /**
     * Resizes image according to the given long side (short side
proportional)
     *
     * @param integer $max_long
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resizeToLongSide($max_long, $allow_enlarge = false)
    {
        if ($this->getSourceHeight() > $this->getSourceWidth()) {
            $ratio = $max_long / $this->getSourceHeight();
            $short = $this->getSourceWidth() * $ratio;

            $this->resize($short, $max_long, $allow_enlarge);
        } else {
            $ratio = $max_long / $this->getSourceWidth();
            $short = $this->getSourceHeight() * $ratio;

            $this->resize($max_long, $short, $allow_enlarge);
        }

        return $this;
    }

    /**
     * Resizes image according to the given height (width proportional)
     *
     * @param integer $height
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resizeToHeight($height, $allow_enlarge = false)
    {
        $ratio = $height / $this->getSourceHeight();
        $width = $this->getSourceWidth() * $ratio;

        $this->resize($width, $height, $allow_enlarge);

        return $this;
    }

    /**
     * Resizes image according to the given width (height proportional)
     *
     * @param integer $width
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resizeToWidth($width, $allow_enlarge = false)
    {
        $ratio  = $width / $this->getSourceWidth();
        $height = $this->getSourceHeight() * $ratio;

        $this->resize($width, $height, $allow_enlarge);

        return $this;
    }

    /**
     * Resizes image to best fit inside the given dimensions
     *
     * @param integer $max_width
     * @param integer $max_height
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resizeToBestFit($max_width, $max_height, $allow_enlarge
= false)
    {
        if ($this->getSourceWidth() <= $max_width &&
$this->getSourceHeight() <= $max_height && $allow_enlarge ===
false) {
            return $this;
        }

        $ratio  = $this->getSourceHeight() / $this->getSourceWidth();
        $width = $max_width;
        $height = $width * $ratio;

        if ($height > $max_height) {
            $height = $max_height;
            $width = $height / $ratio;
        }

        return $this->resize($width, $height, $allow_enlarge);
    }

    /**
     * Resizes image according to given scale (proportionally)
     *
     * @param integer|float $scale
     * @return static
     */
    public function scale($scale)
    {
        $width  = $this->getSourceWidth() * $scale / 100;
        $height = $this->getSourceHeight() * $scale / 100;

        $this->resize($width, $height, true);

        return $this;
    }

    /**
     * Resizes image according to the given width and height
     *
     * @param integer $width
     * @param integer $height
     * @param boolean $allow_enlarge
     * @return static
     */
    public function resize($width, $height, $allow_enlarge = false)
    {
        if (!$allow_enlarge) {
            // if the user hasn't explicitly allowed enlarging,
            // but either of the dimensions are larger then the original,
            // then just use original dimensions - this logic may need
rethinking

            if ($width > $this->getSourceWidth() || $height >
$this->getSourceHeight()) {
                $width  = $this->getSourceWidth();
                $height = $this->getSourceHeight();
            }
        }

        $this->source_x = 0;
        $this->source_y = 0;

        $this->dest_w = $width;
        $this->dest_h = $height;

        $this->source_w = $this->getSourceWidth();
        $this->source_h = $this->getSourceHeight();

        return $this;
    }

    /**
     * Crops image according to the given width, height and crop position
     *
     * @param integer $width
     * @param integer $height
     * @param boolean $allow_enlarge
     * @param integer $position
     * @return static
     */
    public function crop($width, $height, $allow_enlarge = false, $position
= self::CROPCENTER)
    {
        if (!$allow_enlarge) {
            // this logic is slightly different to resize(),
            // it will only reset dimensions to the original
            // if that particular dimenstion is larger

            if ($width > $this->getSourceWidth()) {
                $width  = $this->getSourceWidth();
            }

            if ($height > $this->getSourceHeight()) {
                $height = $this->getSourceHeight();
            }
        }

        $ratio_source = $this->getSourceWidth() /
$this->getSourceHeight();
        $ratio_dest = $width / $height;

        if ($ratio_dest < $ratio_source) {
            $this->resizeToHeight($height, $allow_enlarge);

            $excess_width = ($this->getDestWidth() - $width) /
$this->getDestWidth() * $this->getSourceWidth();

            $this->source_w = $this->getSourceWidth() -
$excess_width;
            $this->source_x = $this->getCropPosition($excess_width,
$position);

            $this->dest_w = $width;
        } else {
            $this->resizeToWidth($width, $allow_enlarge);

            $excess_height = ($this->getDestHeight() - $height) /
$this->getDestHeight() * $this->getSourceHeight();

            $this->source_h = $this->getSourceHeight() -
$excess_height;
            $this->source_y = $this->getCropPosition($excess_height,
$position);

            $this->dest_h = $height;
        }

        return $this;
    }

    /**
     * Crops image according to the given width, height, x and y
     *
     * @param integer $width
     * @param integer $height
     * @param integer $x
     * @param integer $y
     * @return static
     */
    public function freecrop($width, $height, $x = false, $y = false)
    {
        if ($x === false || $y === false) {
            return $this->crop($width, $height);
        }
        $this->source_x = $x;
        $this->source_y = $y;
        if ($width > $this->getSourceWidth() - $x) {
            $this->source_w = $this->getSourceWidth() - $x;
        } else {
            $this->source_w = $width;
        }

        if ($height > $this->getSourceHeight() - $y) {
            $this->source_h = $this->getSourceHeight() - $y;
        } else {
            $this->source_h = $height;
        }

        $this->dest_w = $width;
        $this->dest_h = $height;

        return $this;
    }

    /**
     * Gets source width
     *
     * @return integer
     */
    public function getSourceWidth()
    {
        return $this->original_w;
    }

    /**
     * Gets source height
     *
     * @return integer
     */
    public function getSourceHeight()
    {
        return $this->original_h;
    }

    /**
     * Gets width of the destination image
     *
     * @return integer
     */
    public function getDestWidth()
    {
        return $this->dest_w;
    }

    /**
     * Gets height of the destination image
     * @return integer
     */
    public function getDestHeight()
    {
        return $this->dest_h;
    }

    /**
     * Gets crop position (X or Y) according to the given position
     *
     * @param integer $expectedSize
     * @param integer $position
     * @return float|integer
     */
    protected function getCropPosition($expectedSize, $position =
self::CROPCENTER)
    {
        $size = 0;
        switch ($position) {
        case self::CROPBOTTOM:
        case self::CROPRIGHT:
            $size = $expectedSize;
            break;
        case self::CROPCENTER:
        case self::CROPCENTRE:
            $size = $expectedSize / 2;
            break;
        case self::CROPTOPCENTER:
            $size = $expectedSize / 4;
            break;
        }
        return $size;
    }

    /**
     *  Flips an image using a given mode if PHP version is lower than 5.5
     *
     * @param  resource $image
     * @param  integer  $mode
     * @return null
     */
    public function imageFlip($image, $mode)
    {
        switch($mode) {
            case self::IMG_FLIP_HORIZONTAL: {
                $max_x = imagesx($image) - 1;
                $half_x = $max_x / 2;
                $sy = imagesy($image);
                $temp_image = imageistruecolor($image)?
imagecreatetruecolor(1, $sy): imagecreate(1, $sy);
                for ($x = 0; $x < $half_x; ++$x) {
                    imagecopy($temp_image, $image, 0, 0, $x, 0, 1, $sy);
                    imagecopy($image, $image, $x, 0, $max_x - $x, 0, 1,
$sy);
                    imagecopy($image, $temp_image, $max_x - $x, 0, 0, 0, 1,
$sy);
                }
                break;
            }
            case self::IMG_FLIP_VERTICAL: {
                $sx = imagesx($image);
                $max_y = imagesy($image) - 1;
                $half_y = $max_y / 2;
                $temp_image = imageistruecolor($image)?
imagecreatetruecolor($sx, 1): imagecreate($sx, 1);
                for ($y = 0; $y < $half_y; ++$y) {
                    imagecopy($temp_image, $image, 0, 0, 0, $y, $sx, 1);
                    imagecopy($image, $image, 0, $y, 0, $max_y - $y, $sx,
1);
                    imagecopy($image, $temp_image, 0, $max_y - $y, 0, 0,
$sx, 1);
                }
                break;
            }
            case self::IMG_FLIP_BOTH: {
                $sx = imagesx($image);
                $sy = imagesy($image);
                $temp_image = imagerotate($image, 180, 0);
                imagecopy($image, $temp_image, 0, 0, 0, 0, $sx, $sy);
                break;
            }
            default:
                return null;
        }
        imagedestroy($temp_image);
    }

    /**
     * Enable or not the gamma color correction on the image, enabled by
default
     *
     * @param bool $enable
     * @return static
     */
    public function gamma($enable = true)
    {
        $this->gamma_correct = $enable;

        return $this;
    }
}
assets/gumlet-image-resize/ImageResizeException.php000064400000000456151164267360016536
0ustar00<?php
namespace Gumlet;

/**
 * @package    php-image-resize
 *
 * @copyright 
https://github.com/gumlet/php-image-resize/blob/master/Licence.md
 * @license    MIT
 */

defined('_JEXEC') or die;


/**
 * PHP Exception used in the ImageResize class
 */
class ImageResizeException extends \Exception
{
}
assets/asset.php000064400000001632151164267360007713 0ustar00<?php
/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */
//No direct to access this file.
defined('_JEXEC') or die('Restricted access');

$doc = JFactory::getDocument();
$doc->addScript(JUri::root(true).'/administrator/components/com_jamegafilter/assets/js/jquery-ui.min.js');
$doc->addStyleSheet(JUri::root(true).'/administrator/components/com_jamegafilter/assets/css/style.css');

assets/js/jquery-ui.min.js000064400000160615151164267360011560 0ustar00/*!
jQuery UI - v1.12.1 - 2016-11-29
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js,
focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js,
scroll-parent.js, tabbable.js, unique-id.js, widgets/sortable.js,
widgets/mouse.js, widgets/tabs.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

(function(t){"function"==typeof
define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function
e(t){for(var
e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var
i=0,s=Array.prototype.slice;t.cleanData=function(e){return function(i){var
s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var
n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var
h=l+"-"+e;return
s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return
this._createWidget?(arguments.length&&this._createWidget(t,e),void
0):new
o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new
i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return
t.isFunction(s)?(r[e]=function(){function t(){return
i.prototype[e].apply(this,arguments)}function n(t){return
i.prototype[e].apply(this,t)}return function(){var
e,i=this._super,o=this._superApply;return
this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void
0):(r[e]=s,void
0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var
s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete
n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var
i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in
o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void
0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return
e},t.widget.bridge=function(e,i){var
n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var
a="string"==typeof o,r=s.call(arguments,1),l=this;return
a?this.length||"instance"!==o?this.each(function(){var
i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void
0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void
0):t.error("no such method '"+o+"' for
"+e+" widget instance"):t.error("cannot call methods on
"+e+" prior to initialization; "+"attempted to call
method '"+o+"'")}):l=void
0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var
e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new
i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var
e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return
this.element},option:function(e,i){var
s,n,o,a=e;if(0===arguments.length)return
t.widget.extend({},this.options);if("string"==typeof
e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return
void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void
0===this.options[e]?null:this.options[e];a[e]=i}return
this._setOptions(a),this},_setOptions:function(t){var e;for(e in
t)this._setOption(e,t[e]);return
this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var
i,s,n;for(i in
e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return
this._setOptions({disabled:!1})},disable:function(){return
this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var
a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var
s=[],n=this;return
e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join("
")},_untrackClassesElement:function(e){var
i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return
this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return
this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof
s?s:i;var n="string"==typeof
t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return
o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var
n,o=this;"boolean"!=typeof
e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function
r(){return
e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof
a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof
a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var
l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split("
").join(this.eventNamespace+"
")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function
i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var
s=this;return
setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var
n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n
in o)n in i||(i[n]=o[n]);return
this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof
n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof
n?i:n.effect||i:e;n=n||{},"number"==typeof
n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function
e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function
i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return
9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var
n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void
0!==n)return n;var e,i,s=t("<div
style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div
style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return
t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var
i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var
i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return
d.apply(this,arguments);n=t.extend({},n);var
u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split("
"),k={};return _=s(v),v[0].preventDefault&&(n.at="left
top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var
t,e,i=(n[this]||"").split("
");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var
s,r,l=t(this),h=l.outerWidth(),c=l.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=h+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),T=e(k.my,l.outerWidth(),l.outerHeight());"right"===n.my[0]?D.left-=h:"center"===n.my[0]&&(D.left-=h/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=T[0],D.top+=T[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:h,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+T[0],u[1]+T[1]],my:n.my,at:n.at,within:b,elem:l})}),n.using&&(r=function(t){var
e=g.left-D.left,i=e+p-h,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:l,left:D.left,top:D.top,width:h,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var
i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var
i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var
i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var
i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return
function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var
t="onselectstart"in
document.createElement("div")?"selectstart":"mousedown";return
function(){return
this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return
this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var
n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return
t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof
this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var
e=t(this);setTimeout(function(){var
i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var
t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var
e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function
s(e,i,s,o){return
t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var
n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return
void
0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof
e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return
this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var
t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return
function(e){return
e.replace(t,"\\$1")}}(),t.fn.labels=function(){var
e,i,s,n,o;return
this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var
i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var
e=t(this);return
s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var
i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var
t=0;return function(){return
this.each(function(){this.id||(this.id="ui-id-"+
++t)})}}(),removeUniqueId:function(){return
this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie
[\w.]+/.exec(navigator.userAgent.toLowerCase());var
n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input,
textarea, button, select,
option",distance:1,delay:0},_mouseInit:function(){var
e=this;this.element.on("mousedown."+this.widgetName,function(t){return
e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void
0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var
i=this,s=1===e.which,o="string"==typeof
this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return
s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return
i._mouseMove(t)},this._mouseUpDelegate=function(t){return
i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return
this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else
if(!this.ignoreMissingWhich)return
this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete
this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return
Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return
this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:">
*",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return
t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var
e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var
t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return
this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return
this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return
t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void
0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var
n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{
cursor: "+a.cursor+" !important;
}</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return
t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var
i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return
this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var
s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else
this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new
t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var
e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return
this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var
i=this._getItemsAsjQuery(e&&e.connected),s=[];return
e=e||{},t(i).each(function(){var
i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var
i=this._getItemsAsjQuery(e&&e.connected),s=[];return
e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var
e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var
e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return
o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var
e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return
this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var
t=this.positionAbs.top-this.lastPositionAbs.top;return
0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var
t=this.positionAbs.left-this.lastPositionAbs.left;return
0!==t&&(t>0?"right":"left")},refresh:function(t){return
this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var
t=this.options;return
t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function
i(){r.push(this)}var
s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return
t(r)},_removeCurrentsFromItems:function(){var
e=this.currentItem.find(":data("+this.widgetName+"-item)");
this.items=t.grep(this.items,function(t){for(var
i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var
i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var
i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else
for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return
this},_createPlaceholder:function(e){e=e||this;var
i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var
s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return
e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var
s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var
i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else
this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return
this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void
0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var
i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return
s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof
e&&(e=e.split("
")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in
e&&(this.offset.click.left=e.left+this.margins.left),"right"in
e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in
e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in
e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var
e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var
t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var
e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var
s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var
i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var
n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function
i(t,e,i){return
function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var
s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s
in
this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else
this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return
function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return
function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return
this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var
i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.ui.safeActiveElement=function(t){var
e;try{e=t.activeElement}catch(i){e=t.body}return
e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var
t=/#.*$/;return function(e){var
i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return
e.hash.length>1&&i===s}}(),_create:function(){var
e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget
ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return
e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var
e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return
null===e&&(s&&this.tabs.each(function(i,n){return
t(n).attr("aria-controls")===s?(e=i,!1):void
0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var
i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case
t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case
t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case
t.ui.keyCode.END:s=this.anchors.length-1;break;case
t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return
e.preventDefault(),clearTimeout(this.activating),this._activate(s),void
0;case t.ui.keyCode.ENTER:return
e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void
0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return
e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void
0},_findNextTab:function(e,i){function s(){return
e>n&&(e=0),0>e&&(e=n),e}for(var
n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return
e},_focusNextTab:function(t,e){return
t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void
0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void
0)},_sanitizeSelector:function(t){return
t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var
e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return
i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var
e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset
ui-helper-clearfix
ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,">
li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find(">
li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return
t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var
n,o,a,r=t(s).uniqueId().attr("id"),l=t(s).closest("li"),h=l.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=l.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),h&&l.data("ui-tabs-aria-controls",h),l.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return
this.tablist||this.element.find("ol,
ul").eq(0)},_createPanel:function(e){return
t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var
i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var
i={};e&&t.each(e.split("
"),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var
i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var
e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var
i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,l=r?t():this._getPanelForTab(o),h=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:h,newTab:r?t():o,newPanel:l};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),h.length||l.length||t.error("jQuery
UI Tabs: Mismatching fragment
identifier."),l.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function
s(){o.running=!1,o._trigger("activate",e,i)}function
n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var
o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return
0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var
i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return
e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof
e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role
tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role
tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden
aria-expanded")}),this.tabs.each(function(){var
e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var
i=this.options.disabled;i!==!1&&(void
0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return
t!==e?t:null}):t.map(this.tabs,function(t,i){return
i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var
i=this.options.disabled;if(i!==!0){if(void
0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var
s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},l=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete
s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),l(n,e)},1)}).fail(function(t,e){setTimeout(function(){l(t,e)},1)})))},_ajaxSettings:function(e,i,s){var
n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return
n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var
i=t(e).attr("aria-controls");return
this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs});assets/images/dot.gif000064400000002107151164267360010603
0ustar00GIF89a����!�XMP DataXMP<?xpacket
begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP
Core 5.3-c011 66.145661, 2012/02/06-14:56:27        "> <rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmp:CreatorTool="Adobe Photoshop CS6 (Windows)"
xmpMM:InstanceID="xmp.iid:4358707CC5CA11E6BBCBDAF95C47D8C5"
xmpMM:DocumentID="xmp.did:4358707DC5CA11E6BBCBDAF95C47D8C5">
<xmpMM:DerivedFrom
stRef:instanceID="xmp.iid:4358707AC5CA11E6BBCBDAF95C47D8C5"
stRef:documentID="xmp.did:4358707BC5CA11E6BBCBDAF95C47D8C5"/>
</rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket
end="r"?>�������������������������������������������������������������������������������������������������������������������������������~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!


	!�,D;assets/images/plus.png000064400000002031151164267360011013
0ustar00�PNG


IHDR;mG�tEXtSoftwareAdobe
ImageReadyq�e<fiTXtXML:com.adobe.xmp<?xpacket
begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP
Core 5.3-c011 66.145661, 2012/02/06-14:56:27        "> <rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmpMM:OriginalDocumentID="xmp.did:15356373E3C0E611A9EFDE7F62CAE490"
xmpMM:DocumentID="xmp.did:409EC8E5C0EA11E6B421C8D0133A0B3F"
xmpMM:InstanceID="xmp.iid:409EC8E4C0EA11E6B421C8D0133A0B3F"
xmp:CreatorTool="Adobe Photoshop CS6 (Windows)">
<xmpMM:DerivedFrom
stRef:instanceID="xmp.iid:15356373E3C0E611A9EFDE7F62CAE490"
stRef:documentID="xmp.did:15356373E3C0E611A9EFDE7F62CAE490"/>
</rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket
end="r"?>H�8�IIDATx�b���?����
�*���LOOG�+�̙3�w�b#r��^�Ōh��x�h����W.0�qg/�IEND�B`�assets/css/style.css000064400000016706151164267360010535
0ustar00/* Variables */
:root {
  /* Base colors */
  --gray-100: #f8f9fa;
  --gray-200: #e8e8e8;
  --gray-300: #dee2e6;
  --gray-400: #cdcdcd;
  --gray-500: #adb5bd;
  --gray-600: #666e76;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  /* Brand colors */
  --jaec-primary:   #2a69b8;
  --jaec-success:  #457d54;
  --jaec-warning:  #ffb514;
  --jaec-info:     #2a69b8;
  --jaec-danger:   #c52827;

  --jaec-link: #2a69b8;
  --jaec-link-hover: #c00;

  --jaec-label: #666e76;

  --jaec-border: #dbe4f0;

  --jaec-spacing: 8px;
  --jaec-border-radius: 5px;
}

.com_jamegafilter.layout-edit select {
  max-width: 320px;
}

.com_jamegafilter.layout-edit input.inputbox {
  max-width: 500px;
}

.com_jamegafilter.layout-edit #jform_thumb_width, #jform_thumb_height{
  max-width: 500px;
}

.com_jamegafilter.layout-edit .content > .row {
  background-color: #fff;
  border-radius: var(--jaec-border-radius);
}

.com_jamegafilter .config-wrap {
  width: 100%;  
}

.com_jamegafilter .adminform > .row-fluid .control-group:first-of-type
.control-label,
.com_jamegafilter .adminform > .row-fluid .span12
.control-group:first-of-type .control-label {
  display: none;
}

.com_jamegafilter .adminform > .row-fluid .control-group:first-of-type
> div,
.com_jamegafilter .adminform > .row-fluid .span12
.control-group:first-of-type > div {
  padding: calc(var(--jaec-spacing) * 2) 0;
  position: relative;
  width: 100%;
}

.com_jamegafilter .adminform > .row-fluid .control-group:first-of-type
> div.controls,
.com_jamegafilter .adminform > .row-fluid .span12
.control-group:first-of-type > div.controls {
  display: none;
}

.com_jamegafilter .adminform > .row-fluid .control-group:first-of-type
> div::before,
.com_jamegafilter .adminform > .row-fluid .span12
.control-group:first-of-type > div::before {
  background-color: var(--jaec-border);
  content: "";
  display: block;
  position: absolute;
  height: 5px;
  top: 30px;
  left: 0;
  right: 0;
  width: 100%;
}

.com_jamegafilter .adminform > .row-fluid .control-group:first-of-type
legend,
.com_jamegafilter .adminform > .row-fluid .span12
.control-group:first-of-type legend {
  background: #fff;
  border: 0;
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  margin-left: var(--jaec-spacing);
  padding: var(--jaec-spacing);
  position: relative;
  line-height: 1;
  text-transform: uppercase;
  width: auto;
  z-index: 10;
}

.com_jamegafilter .ui-tabs {
  position: relative;
}

.com_jamegafilter .ui-tabs-nav {
  border-bottom: 1px solid var(--jaec-border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  list-style: none;
  margin: 0 0 calc(var(--jaec-spacing) * 3);
  padding: 0;
}

.com_jamegafilter .ui-tabs-nav li {
  font-weight: 500;
  padding: var(--jaec-spacing) calc(var(--jaec-spacing) * 2) 0;
}

.com_jamegafilter .ui-tabs-nav li.ui-tabs-active {
  color: var(--jaec-primary);
}

.com_jamegafilter .ui-tabs-nav li a {
  color: var(--jaec-label);
  display: block;
  padding-bottom: var(--jaec-spacing);
}

.com_jamegafilter .ui-tabs-nav li.ui-tabs-active a {
  border-bottom: 3px solid var(--jaec-primary);
  color: var(--jaec-primary);
}

.com_jamegafilter .ui-tabs-nav li a span {
  margin-right: var(--jaec-spacing);
}

.com_jamegafilter .ui-tabs-nav li a .ui-sortable-handle:hover {
  color: #069;
  cursor: move;
}

.com_jamegafilter .ui-tabs-nav li a:hover,
.com_jamegafilter .ui-tabs-nav li a:focus,
.com_jamegafilter .ui-tabs-nav li a:active {
  color: var(--jaec-primary);
  text-decoration: none;
}

/* Tab configure */
#layoutconfig {
  display: flex;
  align-items: stretch;
}


/* [Tab] Filter config  */
#filterconfig > p {
  font-size: 14px;
}

.left, .right {
  box-sizing: border-box;
  flex-basis: 50%;
}

.left {
  padding-right: 20px;
}

.right {
  padding-left: 20px;
}

.left .block-inner,
.right .block-inner {
  border: 1px solid var(--jaec-border);
  border-radius: 3px;
  position: relative;
  padding-top: 38px;
  height: calc(100% - 40px);
}

.left .block-title,
.right .block-title {
  background: #edf2f7;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--jaec-border);
  border-radius: 0;
  color: #666;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5;
  padding: 10px 20px;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}

.ui-sortable-helper {
  display: table;
}

.com_jamegafilter .left ul.ui-sortable,
.com_jamegafilter .right ul.ui-sortable {
  box-sizing: border-box;
  padding: 20px 15px 5px !important;
  overflow: auto;
  max-height: 500px;
  height: 100%;
}

.com_jamegafilter #sortable1 li,
.com_jamegafilter #sortable2 li {
  background-color: #fff;
  border: 1px solid var(--jaec-border);
  border-radius: 5px;
  display: block;
  padding: 8px 12px;
  margin-bottom: 8px;
  overflow: hidden;
}

.com_jamegafilter #sortable1 .ui-state-disabled,
.com_jamegafilter #sortable2 .ui-state-disabled {
}

.com_jamegafilter #sortable1 li.ui-sortable-handle:hover,
.com_jamegafilter #sortable2 li.ui-sortable-handle:hover {
  border-color: var(--jaec-success);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  cursor: move;
}

.com_jamegafilter .ui-sortable .field-title {
  font-weight: 600;
  float: left;
}

.com_jamegafilter .ui-sortable .field-title span {
  background-color: var(--gray-200);
  border-radius: 3px;
  color: var(--jaec-label);
  display: inline-block;
  font-weight: normal;
  padding: 5px 10px;
  margin-right: 5px;
}

.com_jamegafilter .ui-sortable .field-title-option {
  float: right;
}

.com_jamegafilter .ui-sortable .field-title-option fieldset {
  margin-left: 5px;
}

#sortable1,
#sortable2 {
	min-height: 20px;
	list-style-type: none;
	margin: 0;
	padding: 5px 0 0 0;
}

#sortable1 li.ui-sortable-placeholder,
#sortable2 li.ui-sortable-placeholder {
	background-color: #ddd;
	display: block;
	min-height: 20px;
}

#sortable1 li.ui-sortable-helper,
#sortable2 li.ui-sortable-helper {
	opacity:0.8;
}

.left-panel,
.right-panel {
  float: left;
  width: 320px;
}

div.ui-tabs-panel.ui-corner-bottom.ui-widget-content {
	min-height: 300px;
}


/* Misc */
#basefield table tr td .btn-micro {
  margin-left: 20px;
}

.ui-tabs-panel .btn-micro {
  box-shadow: none;
  border: 0;
  background-color: transparent;
  padding: 0;
}

.ui-tabs-panel .btn-micro:hover,
.ui-tabs-panel .btn-micro:focus,
.ui-tabs-panel .btn-micro:active {
  background-color: transparent;
}

.ui-tabs-panel .btn-micro [class*="icon-"] {
  border: 2px solid var(--jaec-border);
  border-radius: 50%;
  color: var(--jaec-border);
  margin-right: 0;
  padding: 2px;
}

.j4 .ui-tabs-panel .btn-micro [class*="icon-"] {
  border: 2px solid var(--jaec-border);
  border-radius: 50%;
  color: var(--jaec-border);
  height: 26px;
  line-height: 22px;
  padding: 0;
  text-align: center;
  width: 26px;
}

.ui-tabs-panel .btn-micro .icon-publish {
  border: 1px solid var(--jaec-success);
  border-radius: 50%;
  color: var(--jaec-success);
}

.j4 .ui-tabs-panel .btn-micro .icon-publish {
  border-color: var(--jaec-success);
  color: var(--jaec-success);
}

.ui-tabs-panel .btn-micro .icon-unpublish {
  border: 1px solid var(--gray-400);
  color: var(--jaec-danger);
  transition: all 0.35s ease;
}

.ui-tabs-panel .btn-micro .icon-unpublish::before {
  color: var(--gray-400);
}

.ui-tabs-panel .btn-micro .icon-unpublish:hover {
  border-color: var(--gray-600);
}

.ui-tabs-panel .btn-micro .icon-unpublish:hover::before {
  color: var(--gray-600);
}

.ui-tabs-panel .btn-micro .icon-delete {
  border: 1px solid var(--jaec-danger);
}

.ui-tabs-panel .btn-micro .icon-delete::before {
  color: var(--jaec-danger);
}tables/jamegafilter.php000064400000001424151164267360011175
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

class JaMegaFilterTableJaMegaFilter extends JTable
{
	function __construct(&$db)
	{
		parent::__construct('#__jamegafilter', 'id', $db);
	}
}
tables/index.html000064400000000054151164267360010025
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/defaults.php000064400000002071151164267360010362
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class JaMegaFilterModelDefaults extends JModelList
{
	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Initialize variables.
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true);

		// Create the base select statement.
		$query->select('*')
			  ->from($db->quoteName('#__jamegafilter'));

		return $query;
	}
}
models/index.html000064400000000054151164267360010036
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/forms/cron.xml000064400000001024151164267360010650
0ustar00<?xml version="1.0" encoding="UTF-8"?>
<form>
	<fieldset name="config"
addfieldpath="/administrator/components/com_jamegafilter/models/fields">
		<field name="time" type="number"
default="3600" label="COM_JAMEGAFILTER_TIME"
description="COM_JAMEGAFILTER_TIME_DESC"/>
		<field 
			name="fids" 
			type="jamgfilter" 
			label="COM_JAMEGAFILTER_FILTERS" 
			multiple="true"
		/>
		<field name="crontoken" type="crontoken"
label="COM_JAMEGAFILTER_CRON_URL"
description="COM_JAMEGAFILTER_CRON_URL_DESC" default=""
/>
	</fieldset>
</form>models/cron.php000064400000005370151164267360007521
0ustar00<?php

/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');

use Joomla\Registry\Registry;

class JaMegafilterModelCron extends JModelForm {
	
	public function getForm($data = array(), $loadData = true) {
		$form = $this->loadForm('com_jamegafilter.cron',
'cron', array('control' => 'jform',
'load_data' => $loadData));
		return $form;
	}
	
	function save($new_cron = false, $reset_last_cron = false) {
		$app = JFactory::getApplication();
		$input = $app->input;
		$data = $input->get('jform', array(),
'registry');
		$data = new Registry($data);
		$time = $data->get('time');
		if (!$time) {
			$app->enqueueMessage(JText::_('COM_JAMEGAFILTER_MISSING_TIME'),
'error');
			return false;
		}
		
		$fids = $data->get('fids', array());

		$crontoken = $data->get('crontoken');
		if (!$crontoken || $new_cron) {
			$crontoken = $this->newCronToken($new_cron);
		}
		
		$params = JComponentHelper::getParams('com_jamegafilter');
		$params->set('time', $time);
		$params->set('fids', $fids);
		$params->set('crontoken', $crontoken);
		if ($reset_last_cron) {
			$params->set('last_cron', 0);
			$app->enqueueMessage(JText::_('COM_JAMEGAFILTER_LAST_CRON_TIME_HAS_BEEN_RESET'),
'notice');
		}
		
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query->update('#__extensions')
			->set($db->quoteName('params') . '=' .
$db->quote($params->toString()))
			->where($db->quoteName('element') . '=' .
$db->quote('com_jamegafilter'));
		$db->setQuery($query);
		if ($db->execute()) {
			$app->enqueueMessage(
JText::_('COM_JAMEGAFILTER_SAVE_SUCCESS'));
			return true;
		} else {
			$app->enqueueMessage(
JText::_('COM_JAMEGAFILTER_SAVE_FAILED'));
			return false;
		}
	}
	
	function newCronToken() {
		$length = rand(50, 100);
		$characters =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
		$charactersLength = strlen($characters);
		$randomString = '';
		for ($i = 0; $i < $length; $i++) {
			$randomString .= $characters[rand(0, $charactersLength - 1)];
		}
		return $randomString;
	}
	
	function getItem() {
		$params = JComponentHelper::getParams('com_jamegafilter');
		if ($params->get('crontoken')) {
			return $params;
		}
	}

}models/default.php000064400000014447151164267360010211 0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

class JaMegaFilterModelDefault extends JModelAdmin
{
	public function getTable($type = 'JaMegaFilter', $prefix =
'JaMegaFilterTable', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	public function getForm($data = array(), $loadData = true)
	{
		$jinput = JFactory::getApplication()->input;
		$type = $jinput->get('type', 0);
		$item = $this->getItem();
		if (empty($type)) $type = $item->type;
		if (!empty($type)) {
			$lang = JFactory::getLanguage();
			$extension = 'plg_jamegafilter_'.$type;
			$language_tag = JFactory::getLanguage()->getTag();
			$lang->load($extension, JPATH_ADMINISTRATOR, $language_tag, true);
			$xml =
JPATH_PLUGINS.'/jamegafilter/'.$type.'/forms/'.$type.'.xml';
			if(JFile::exists($xml)){
				// get form from third party
				JForm::addFieldPath(JPATH_PLUGINS.'/jamegafilter/'.$type.'/fields/');
				$options = array('control' => 'jform',
'load_data' => $loadData);
				$form = JForm::getInstance('jform', $xml, $options);
			}
		}
		if (empty($form))
		{
			return false;
		}
		return $form;
	}
	
	function saveobj()
	{
		$app = JFactory::getApplication();
		$jinput = $app->input;
		$post = $jinput->get('jform', array(), 'array');
		$table = $this->getTable();
		$table->type = $post['jatype'];
		$table->published = $post['published'];
		$table->title = $post['title'];

		JPluginHelper::importPlugin('jamegafilter');
		$app->triggerEvent('onBeforeSave'.ucfirst($post['jatype']).'Items',
array( &$post ));

		$table->params = json_encode($post);
		if (!empty($post['id'])) {
			$table->id = $post['id'];
		}

		$table->store();
		$this->proxyExport($table->id);

		return $table;
	}

	function proxyExport($id)
	{
		$params = JComponentHelper::getParams('com_jamegafilter');
		$cronurl = JUri::root() .
'index.php?option=com_jamegafilter&task=cron&token=' .
$params->get('crontoken');
		if ($cronurl) {
			$langs = JLanguageHelper::getContentLanguages();
			$lang = array_shift($langs);
			$uri = $cronurl . '&proxy=1&id=' . $id .
'&lang=' . $lang->sef;
			$options = new JRegistry;
			$options->set('userAgent', 'Mozilla/5.0 (Windows NT
6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');
			try
			{
				$response = JHttpFactory::getHttp($options)->get($uri);
				$data = @json_decode($response->body);
				if (is_object($data) && isset($data->success)) {
					JFactory::getApplication()->enqueueMessage($data->success);
				} else {
					die($response->body);
				}
			}
			catch (RuntimeException $e)
			{
				throw new RuntimeException('Unable to open cron url: ' .
$e->getMessage(), $e->getCode());
			}

			if ($response->code != 200)
			{
				throw new RuntimeException('Unable to open cron url: Response Code
' . $response->code);
			}
		}
	}
	
	function exportByID($id)
	{
		$libPath = JPATH_ADMINISTRATOR .
'/components/com_jamegafilter/assets/gumlet-image-resize/';
		require_once $libPath . 'ImageResize.php';
		require_once $libPath . 'ImageResizeException.php';

		$app = JFactory::getApplication();
		$item = $this->getItem($id);
		$isEnable = JPluginHelper::isEnabled('jamegafilter',
$item->type);
    
		if (!$isEnable) {
      $msg = array(
        'success' => 'Please enable ' .
ucfirst($item->title) . ' Plugin',
      );
      die(json_encode($msg));
			/*$app->enqueueMessage(JTEXT::_('COM_JAMEGAFILTER_EXPORT_FAILED_FILTER_PLUGIN_NOT_FOUND').'
: '.strtoupper($item->type), 'error');
			return false;*/
		}

		JPluginHelper::importPlugin('jamegafilter');
		
		$path = JPATH_SITE.'/media/com_jamegafilter/';
		if(!JFolder::exists($path)) {
			JFolder::create($path, 0755);
		}

    $result =
$app->triggerEvent('onAfterSave'.ucfirst($item->type).'Items',
array($item));
		$objectList = $result[0];
  
		foreach ($objectList as $key => $object) {
      $object = $this->checkObject($object, $path, $id);
      $json = json_encode($object);

      if (!JFile::write($path.$key.'/'.$id.'.json',
$json)) {
        $msg = array(
          'success' => "Can't write data into Json
file" ,
        );
        die(json_encode($msg));
       
/*$app->enqueueMessage(JTEXT::_('COM_JAMEGAFILTER_CAN_NOT_EXPORT_JSON_TO_FILE').':'.$path.$key.'/'.$id.'.json',
'error');
        return false;*/
      }
    }
		return true;
	}
  
  public function checkObject($obj, $path, $id){
    if (json_encode($obj) !== false){
      return $obj;
    }
    
    $log = '';
    $obj1 = clone $obj;
    
    foreach ($obj1 as $key => $val){
      if (json_encode($val) == false){
        $log .= $this->logLine($key, $val);
      }
      foreach ($val as $k => $v){
        if (json_encode($v) == false){
          $log .= $this->logLine($k, $v);
          if (!is_array($val->$k)){
            $val->$k = (string) $v;
          }else{
            foreach ($val->$k as $k1 => $v1){
              if (json_encode($v1) == false){
                $log .= $this->logLine($k1, $v1);
                if (!is_array($v1)){
                  $val->$k[$k1] = (string) $v1;
                }
                foreach ($v1 as $k2 => $attr){
                  if (json_encode($attr) == false){
                    $log .= $this->logLine($k2, $attr);
                    if (!is_array($attr)){
                      $val->$k[$k1][$k2] = (string) $attr;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    JFile::write($path.'/log/log_'.$id.'.txt', $log);
    return $obj1;
  }
  public function logLine($key, $val){
    if (!is_object($val) && !is_array($val)){
      return "key error: ". $key . " | value: ". $val .
" | value type: " . gettype($val) . "\n";
    }
    return "key error: ". $key . " | value type: " .
gettype($val) . "\n";
  }
}models/fields/jamegafilter_filterfields.php000064400000042723151164267360015217
0ustar00<?php
/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');

abstract class JFormFieldJamegafilter_filterfields extends JFormField {

	protected $type = 'jamegafilter_filterfields';
	protected $catOrdering = false;
  
  function setWidth(){
    if (version_compare(JVERSION, '4', 'ge')){
      return 'style="width:180px"';
    }
    return '';
  }
  
  //===============================
  // Page options
  //===============================
	function getLayoutInput() {
		$jinput = JFactory::getApplication()->input;
		$id = $jinput->get('id', 0, 'INT');
		$type = $jinput->get('type', '',
'STRING');
		$plg = array('content', 'k2', 'virtuemart',
'docman');
		if (!empty($id)) {
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true);
			$query->select('*')
				  ->from($db->quoteName('#__jamegafilter'))
				  ->where('published=1 AND id ='.$id);
			$db->setQuery($query);
			$item = $db->loadObject();
			$type = !empty($item->type) ? $item->type : NULL;
		}

		$html = '';
		$filterfields = $this->getFilterFields();
		$left = '';
		$right = '';
		$layout_addition = !empty($this->value['layout_addition']) ?
explode(',', $this->value['layout_addition']) :
false;
		$columns = !empty($this->value['jacolumn'])
?$this->value['jacolumn'] : false;
		// custom layout input. left column
		if (empty($layout_addition) || !in_array('thumb',
$layout_addition)) {
			$filterfields['basefield'][] = array(
				"field"=> "thumb",
				"title"=> JText::_("COM_JAMEGAFILTER_THUMB"),
			);
		}
		if (in_array($type, $plg)) {
			if (empty($layout_addition) || !in_array('desc',
$layout_addition)) {
				$filterfields['basefield'][] = array(
					"field"=> "desc",
					"title"=> JText::_("COM_JAMEGAFILTER_DESC"),
				);
			}
		}

		if (in_array($type, ['virtuemart'])) { // support base price
only for VM
			if (empty($layout_addition) || !in_array('baseprice',
$layout_addition)) {
				$filterfields['basefield'][] = array(
					"field"=> "baseprice",
					"title"=>
JText::_("COM_JAMEGAFILTER_BASE_PRICE"),
				);
			}
		}

		foreach ($filterfields as $key => $fieldgroups) {
			if (!empty($fieldgroups)) {
				foreach ($fieldgroups as $field) {
					$fi = str_replace('.', '_',
$field['field']);
					$val = empty($columns[$field['field']]) ? 0 : 1;
					if (empty($columns))
						$val=1; // default
					if (empty($field['showoff']))
						$left .= $this->liline($key, $fi, $field, $val);
					if (!$layout_addition && !empty($field['showoff']))
// in case first time runner.
						$right .= $this->liline($key, $fi, $field, $val);
				}
			}
		}
		
		// custom layout input. right column
		if (!empty($layout_addition) && in_array('thumb',
$layout_addition)) {
			$filterfields['basefield'][] = array(
				"field"=> "thumb",
				"title"=> JText::_("COM_JAMEGAFILTER_THUMB"),
			);
		}
		if (in_array($type, $plg)) {
			if (!empty($layout_addition) && in_array('desc',
$layout_addition)) {
				$filterfields['basefield'][] = array(
					"field"=> "desc",
					"title"=> JText::_("COM_JAMEGAFILTER_DESC"),
				);
			}
		}
		if (in_array($type, ['virtuemart'])) { // support base price
only for VM
			if (!empty($layout_addition) && in_array('baseprice',
$layout_addition)) {
				$filterfields['basefield'][] = array(
					"field"=> "baseprice",
					"title"=>
JText::_("COM_JAMEGAFILTER_BASE_PRICE"),
				);
			}
		}

		if (!empty($layout_addition)) // after save runner.
			foreach ($layout_addition AS $la) {
				foreach ($filterfields as $key => $fieldgroups) {
					if (!empty($fieldgroups)) {
						foreach ($fieldgroups as $field) {
							if ($la === $field['field']) {
								$fi = str_replace('.', '_',
$field['field']);
								$val = empty($columns[$field['field']]) ? 0 : 1;
								if (empty($columns))
									$val=1; // default
								$right .= $this->liline($key, $fi, $field, $val);
							}
						}
					}
				}
			}

		$html .= '<div class="left">';
		$html .= '<div class="block-inner">';
			$html .= '<div
class="block-title">'.JText::_('COM_MEGAFILTER_DEACTIVE_LIST').'</div>';
			$html .= '<ul id="sortable1"
class="connectedSortable">';
			$html .= $left;
			$html .= '</ul>';
		$html .= '</div>';
		$html .= '</div>';

		$html .= '<div class="right">';
		$html .= '<div class="block-inner">';
			$html .= '<div
class="block-title">'.JText::_('COM_MEGAFILTER_ACTIVE_LIST').'</div>';
			$html .= '<ul id="sortable2"
class="connectedSortable">';
			$html .= $right;
			$html .= '</ul>';
		$html .= '</div>';
		$html .= '</div>';
		return $html;
	}
	
	function liline($key, $fi, $field, $val) {
		return '<li class="ui-state-default"
data-jfield="'.$field['field'].'"><div
class="field-title"><span>'
     
.JText::_('COM_JAMEGAFILTER_'.strtoupper($key)).'</span>
'.($field['title'])
      .'</div> <div
class="field-title-option">'.JText::_('COM_MEGAFILTER_SHOW_TITLE').'
'
      .$this->layoutFieldset($fi, $field['field'],
$val).'</div>';
	}

	function layoutFieldset($el, $name, $val) {
		return '<fieldset
id="jform_params_'.$el.'">
			<div class="btn-group btn-group-yesno radio">
        <input class="btn-check" type="radio"
id="jform_params_'.$el.'0"
name="jform[filterfields][jacolumn]['.$name.']"
value="1" '.($val==1 ? ' checked="checked"
' : '').'>
				<label for="jform_params_'.$el.'0"
class="btn
btn-outline-success">'.JText::_('JYES').'</label>
        <input class="btn-check" type="radio"
id="jform_params_'.$el.'1"
name="jform[filterfields][jacolumn]['.$name.']"
value="0" '.($val==0 ? ' checked="checked"
' : '').'>
				<label for="jform_params_'.$el.'1"
class="btn
btn-outline-danger">'.JText::_('JNO').'</label>
      </div>
		</fieldset>';
	}

	protected function getInput() {
		$filterfields = $this->getFilterFields();
		$html = '';
		$html .= '<div id="tabs">';
		$html .= '<ul>';
		foreach ($filterfields as $key => $fieldgroups) {
			if (!empty($fieldgroups)) {
				$html .= '<li><a class="filter-field"
href="#' . $key . '"><span
class="icon-menu"></span>' .
JText::_("COM_JAMEGAFILTER_" . strtoupper($key)) .
'</a></li>';
			}
		}
		$html .= '<li><a href="#filterconfig"><span
class="icon-stop"></span>'.JText::_('COM_MEGAFILTER_FILTER_CONFIG').'</a></li>';
		$html .= '<li><a href="#layoutconfig"><span
class="icon-pause"></span>'.JText::_('COM_MEGAFILTER_LAYOUT_CONFIG').'</a></li>';
		$html .= '</ul>';
		$t = 0;
		$u = 0;

		// add sort by radio. BEWARE fields set sort by and on change sort by
radio.
		$sort_by = !empty($this->value['sort_by']) ?
$this->value['sort_by'] : 'desc';
		$layout_addition = !empty($this->value['layout_addition']) ?
$this->value['layout_addition'] : '';
		
		$html .= '
		<input type="radio" id="jform_params_sort_by0"
class="sort_by_input hidden"
name="jform[filterfields][sort_by]" value="asc"
'.($sort_by == 'asc' ? ' checked="checked"
' : '').'>
		<input type="radio" id="jform_params_sort_by1"
class="sort_by_input hidden"
name="jform[filterfields][sort_by]" value="desc"
'.($sort_by == 'desc' ? ' checked="checked"
' : '').'>
		<input type="hidden"
id="jform_params_layout_addition" class=""
name="jform[filterfields][layout_addition]"
value="'.$layout_addition.'" />

		<!-- Custom layout input 1 column field-->
		<input type="hidden" class="layout-addition"
data-jfield="name"
name="jform[filterfields][basefield]['.(count($filterfields['basefield'])).'][showoff]"
value="1">
		<input type="hidden"
name="jform[filterfields][basefield]['.(count($filterfields['basefield'])).'][field]"
value="thumb">

		<!-- Custom layout input 2 columns field -->
		<input type="hidden" class="layout-addition"
data-jfield="name"
name="jform[filterfields][basefield]['.(count($filterfields['basefield'])+1).'][showoff]"
value="1">
		<input type="hidden"
name="jform[filterfields][basefield]['.(count($filterfields['basefield'])+1).'][field]"
value="desc">
		';

		foreach ($filterfields as $key => $fieldgroups) {
			if (!empty($fieldgroups)) {
				$html .= '<div style="display:none" id="' .
$key . '">';
				$html .= '<table class="table">';
				$html .= '<thead>
							<tr>
								<th>' . JText::_('COM_JAMEGAFILTER_PUBLISHED')
. '</th>
								<th>' . JText::_('COM_JAMEGAFILTER_NAME') .
'</th>
								<th>' . JText::_('COM_JAMEGAFILTER_TITLE') .
'</th>
								<th>' .
JText::_('COM_JAMEGAFILTER_FILTER_TYPE') . '</th>
								<th>' . JText::_('COM_JAMEGAFILTER_SORT_BY') .
'</th>
								<th class="sortby">
									<fieldset class="btn-group btn-group-yesno
radio">
										<label
title="'.JText::_('COM_JAMEGAFILTER_DEFAULT_SORT_BY').'"
for="jform_params_sort_by0" class="btn btn-asc
'.($sort_by == 'asc' ? ' active btn-success ' :
'').'">ASC</label>
										<label
title="'.JText::_('COM_JAMEGAFILTER_DEFAULT_SORT_BY').'"
for="jform_params_sort_by1" class="btn btn-desc
'.($sort_by == 'desc' ? ' active btn-success ' :
'').'">DESC</label>
									</fieldset>
								</th>
							</tr>
						</thead>';
				$html .= '<tbody>';
				foreach ($fieldgroups as $field) {
					$html .= '<tr>';

					$html .= '<td>';
					$publish = $field['published'] ? 'publish' :
'unpublish';
					$html .= '<a class="btn btn-micro"
input="" href="javascript:void(0);"
onclick="return publish_item(this)"><span
data-jfield="'.$field['field'].'"
class="icon-' . $publish .
'"></span></a>';
					$html .= '<input type="hidden"
name="jform[filterfields][' . $key . '][' . $t .
'][published]" value="' . $field['published']
. '">';
					$html .= '</td>';

					$html .= '<input type="hidden"
class="layout-addition"
data-jfield="'.$field['field'].'"
name="jform[filterfields][' . $key . '][' . $t .
'][showoff]" value="' .
((!empty($field['showoff'])) ? $field['showoff'] : 0) .
'">';
					$html .= '<input type="hidden"
name="jform[filterfields][' . $key . '][' . $t .
'][field]" value="' . $field['field'] .
'">';

					$html .= '<td><label for="filterfield_' . $key
. '_' . str_replace('.', '_',
$field['field']) . '" >' .
$field['name'] . '</label></td>';

					$html .= '<td><input id="filterfield_' . $key
. '_' . str_replace('.', '_',
$field['field'])
            . '" class="inputbox form-control"
name="jform[filterfields][' . $key . '][' . $t .
'][title]" type="text" value="' .
$field['title'] . '" required></td>';
					$html .= '<td>';
					$html .= '<select class="form-select
form-select-color-state form-select-success valid
form-control-success" '
            . $this->setWidth() .'
name="jform[filterfields][' . $key . '][' . $t .
'][type]">';

					foreach ($field['filter_type'] as $type) {
						$selectd = !empty($field['type']) &&
$field['type'] === $type ? 'selected' : '';
						$html .= '<option value="' . $type . '"
' . $selectd . '>' . ucfirst($type) .
'</option>';
					}

					$html .= '</select>';
					$html .= '</td>';

					$html .= '<td>';
					$sort = $field['sort'] ? 'publish' :
'unpublish';
					$html .= '<a class="btn btn-micro"
input="" href="javascript:void(0);"
onclick="return publish_item(this)"><span
class="icon-' . $sort .
'"></span></a>';
					$html .= '<input type="hidden"
name="jform[filterfields][' . $key . '][' . $t .
'][sort]" value="' . $field['sort'] .
'">';
					$html .= '</td>';

					$html .= '<td>';
					// got warning message because we do not define in plugin field type.
change this code if we add to plugin.
					$sort_default = 'delete';
					$value=0;
					if (!empty($field['sort_default']))  {
						$sort_default = 'publish';
						$value = $field['sort_default'];
					}
					
					$html .= '<a class="btn btn-micro btn-sort_default"
title="'.JText::_('COM_JAMEGAFILTER_DEFAULT_SORT').'"
input="" href="javascript:void(0);"
onclick="return default_sort(this)"><span
class="icon-'.$sort_default.'"></span><input
type="hidden" class="sort_default-input"
name="jform[filterfields][' . $key . '][' . $t .
'][sort_default]" value="' . $value .
'"></a>';
					$html .= '</td>';
					$html .= '</tr>';
					$t++;
				}

				$html .= '</tbody>';
				$html .= '</table>';
				$html .= '</div>';
				$u++;
			}
		}
  
		$html .= '<div style="display:none"
id="layoutconfig">';
		$html .= $this->getLayoutInput();
		$html .= '</div>';
    
    //===============================
    // Filter config
    //===============================
		$html .= '<div style="display:none"
id="filterconfig">';
		$html .=
'<p>'.JText::_('COM_JAMEGAFILTER_FILTER_CONFIG_DESCRIPTION').'</p>';
		$html .= $this->getFilterInput($filterfields);
		$html .= '</div>';

		$html .= '</div>';

		return $html;
	}

	function getFilterInput($filterfields) {
		$filter_order = array();
		if (!empty($this->value['filter_order']))
			$filter_order = $this->value['filter_order'];
		$html = '';
		$t = 0;
		$html .= '<table class="table">';
		$html .= '<thead>
					<tr>
						<th><span
class="icon-menu-2"></span></th>
						<th>' . JText::_('COM_JAMEGAFILTER_NAME') .
'</th>
						<th>' .
JText::_('COM_JAMEGAFILTER_OPTION_FILTER') . '</th>
					</tr>
				</thead>';
		$html .= '<tbody>';
		$html .= $this->filterOrderLayout($filterfields, $filter_order);
		$html .= '</tbody>';
		$html .= '</table>';
		$html .= '</div>';

		return $html;
	}

	function filterOrderLayout($filterfields, $filter_order=array()) {
		$html = '';
		$filter_options = [
			'name_asc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_NAME_ASC'), 
			'name_desc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_NAME_DESC'), 
			'number_asc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_NUMBER_ASC'),
			'number_desc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_NUMBER_DESC'),
			'ordering_asc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_ORDERING_ASC'),
			'ordering_desc' =>
JText::_('COM_JAMEGAFILTER_FILTER_OPTIONS_ORDERING_DESC')
		];
		$listField = array();
		foreach ($filterfields as $key => $group) {
			foreach ($group as &$item) {
				$item['group'] = $key;
				$listField[] = $item;
			}
		}

		$sorting = isset($filter_order['sort']) ?
$filter_order['sort'] : array();
		$ordering = isset($filter_order['order']) ?
$filter_order['order'] : array();

		usort($listField, function($a, $b) use ($sorting) {
			$keyA = array_search($a['field'], $sorting);
			$keyB = array_search($b['field'], $sorting);

			if ($keyA === $keyB) {
				return 0;
			}

			return $keyA < $keyB ? -1 : 1;
		});

		$html = '';
		foreach ($listField as $field) {
			$html .= '<tr
data-jfield="'.$field['field'].'">';
			$html .= '<td><span class="icon-menu
large-icon"> </span></td>';

			$html .= '<input type="hidden"
name="jform[filterfields][filter_order][sort][]"
value="' . $field['field'] . '">';

			$html .= '<td><div
class="field-title"><span>'.JText::_('COM_JAMEGAFILTER_'.strtoupper($field['group'])).'</span>
'.($field['title']).'</div></td>';

			$html .= '<td>';
			$disabled = '';

			if (!in_array('single', $field['filter_type']) 
				&& !in_array('dropdown',
$field['filter_type'])
				&& !in_array('color',
$field['filter_type'])
				&& !in_array('multiple',
$field['filter_type'])
				|| ($field['field'] === 'attr.cat.value' &&
!$this->catOrdering))
				$disabled = 'disabled';

			$html .= '<select class="form-select
form-select-color-state form-select-success valid
form-control-success" '
        . $this->setWidth() .$disabled.'
name="jform[filterfields][filter_order][order]['.$field['field'].']">';

			$options = $filter_options;
			if (!$this->hasCustomOrdering($field) || $field['field']
=== 'attr.featured.value') {
				unset($options['ordering_asc']);
				unset($options['ordering_desc']);
			}

			if ($field['field'] === 'attr.cat.value') {
				unset($options['number_asc']);
				unset($options['number_desc']);
			}

			foreach ($options AS $k => $type) {
				$selected = '';
			
				if (!empty($ordering[$field['field']]) &&
$ordering[$field['field']] === $k) {
					$selected = 'selected';
				}

				$html .= '<option value="' . $k . '" '
. $selected . '>' . ucfirst($type) .
'</option>';
			}

			$html .= '</select>';
			$html .= '</td>';
			$html .= '</tr>';
		}

		return $html;
	}

	function getFilterFields() {
		$fieldgroups = $this->getFieldGroups();

		$filterfields = array();

		if (empty($this->value)) {

			$filterfields = $fieldgroups;
		} else {

			foreach ($this->value as $key => $group_value) {

				if (!empty($fieldgroups[$key])) {

					$filterfields[$key] = array();
					foreach ($group_value as $gv) {

						foreach ($fieldgroups[$key] as $k_fg => $fg) {

							if ($gv['field'] == $fg['field']) {

								$field = $gv + $fg;
								array_push($filterfields[$key], $field);

								unset($fieldgroups[$key][$k_fg]);

								break;
							}
						}
					}

					$filterfields[$key] = array_merge($filterfields[$key],
$fieldgroups[$key]);

					// unset the same field group
					unset($fieldgroups[$key]);
				}
			}

			$filterfields = array_merge($filterfields, $fieldgroups);
		}

		return $filterfields;
	}

	function hasCustomOrdering($field) {
		return false;
	}

	/**
	 *  @return array
	 */
	abstract function getFieldGroups();
}
models/fields/jalayout.php000064400000006226151164267360011657
0ustar00<?php
/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');
jimport('joomla.filesystem.folder');

class JFormFieldJalayout extends JFormField {

	protected $type = 'jalayout';

	protected function getInput() {
		$layouts = array();
		$type = $this->getFilterType();
		$templatePath = $this->getTemplatePath($type);
		$paths = array(
				JPATH_PLUGINS . '/jamegafilter/' . $type . '/tmpl'
		);
		if (!empty($templatePath)) {
			$paths[] = $templatePath;
		}
		foreach ($paths as $path) {
			if (JFolder::exists($path)) {
				$files = JFolder::files($path, '\.php');
				if (!empty($files)) {
					foreach ($files as $file) {
						$file = preg_replace('#\.[^.]*$#', '', $file);
						if ($file != 'default') {
							$layouts[] = $file;
						}
					}
				}
			}
		}
		$layouts = array_unique($layouts);
		$html = '<select class="form-select valid
form-control-success" name="' . $this->name .
'">';
		$html .= '<option
value="default">default</option>';
		foreach ($layouts as $layout) {
			$selected = ($layout == $this->value) ? 'selected' :
'';
			$html .= '<option value="' . $layout . '"
' . $selected . '>' . $layout .
'</option>';
		}
		$html .= '</select>';
		return $html;
	}

	function getFilterType() {
		$input = JFactory::getApplication()->input;
		$id = $input->getCmd('id', 0);
		if ($id) {
			if (version_compare(JVERSION, '4.0', 'ge'))
				$model = new  Joomla\Component\Menus\Administrator\Model\ItemModel();
			else
				$model = new MenusModelItem();
			$menu = $model->getItem($id);
			if (!empty($menu->request['id'])) {
				$q = 'SELECT type from #__jamegafilter where id=' .
$menu->request['id'];
				$db = JFactory::getDbo()->setQuery($q);
				$result = $db->loadResult();
				return $result;
			}
		}
		return;
	}

	function getTemplatePath($type) {
		$input = JFactory::getApplication()->input;
		$id = $input->getCmd('id', 0);
		if ($id) {
			$q = 'SELECT template_style_id from #__menu where id=' . $id;
			$db = JFactory::getDbo()->setQuery($q);
			$template_style_id = $db->loadResult();
			if ($template_style_id) {
				$q = 'SELECT template from #__template_styles where id=' .
$template_style_id;
				$db = JFactory::getDbo()->setQuery($q);
				$path = $db->loadResult();
			} else {
				$q = 'SELECT template from #__template_styles where client_id = 0
and home = 1';
				$db = JFactory::getDbo()->setQuery($q);
				$path = $db->loadResult();
			}
		}

		if (empty($path)) {
			return;
		} else {
			return JPATH_SITE . '/templates/' . $path .
'/html/plg_jamegafilter_' . $type;
		}
	}

}
models/fields/index.html000064400000000054151164267360011304
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/fields/crontoken.php000064400000002360151164267360012024
0ustar00<?php

/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');

class JFormFieldCronToken extends JFormField {
	
	protected $tpye="crontoken";
	
	function getInput() {
		if ($this->value) {
			$langs = JLanguageHelper::getContentLanguages();
			$lang = array_shift($langs);
			$url = JUri::root() .
'index.php?option=com_jamegafilter&task=cron&token='.$this->value
. '&lang=' . $lang->sef;

			$html = '<div class="well well-small"
style="display:inline-block;">';
			$html .= '<a style="word-break: break-all;"
target="_blank" href="' . $url . '">'
. $url . '</a>';
			$html .= '</div>';
			$html .= '<input name="jform[crontoken]"
type="hidden"
value="'.$this->value.'"/>';
			return $html;
		}
	}
}models/fields/jamgfilter.php000064400000002065151164267360012150
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

JFormHelper::loadFieldClass('list');

class JFormFieldJamgfilter extends JFormFieldList
{
	protected $type = 'Jamgfilter';
	
	protected function getOptions() {
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query->select(array('title as text', 'id as
value'))
			  ->from($db->quoteName('#__jamegafilter'))
			  ->where('published=1');
		$db->setQuery($query);
		return $db->loadObjectList();
	}
	
}views/defaults/index.html000064400000000054151164267360011517
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/defaults/view.html.php000064400000003754151164267360012162
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class JaMegaFilterViewDefaults extends JViewLegacy
{
	function display($tpl = null)
	{
		$app = JFactory::getApplication();
		// Get data from the model
		$this->items		= $this->get('Items');
		$this->pagination	= $this->get('Pagination');

		// Check for errors.
		if (count($errors = $this->get('Errors')))
		{
			$app->enqueueMessage(implode('<br />', $errors),
'message');

			return false;
		}

		// Set the toolbar
		$this->addToolBar();
		$this->sidebar = JHtmlSidebar::render();
		// Display the template
		parent::display($tpl);
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function addToolBar()
	{
		JaMegafilterHelper::addSubmenu('defaults');
		
		JToolBarHelper::title(JText::_('COM_JAMEGAFILTER_MANAGER_DEFAULTS'));
		JToolBarHelper::addNew('default.add');
		JToolBarHelper::editList('default.edit');
		JToolBarHelper::deleteList('JGLOBAL_CONFIRM_DELETE',
'defaults.delete');
 		JToolBarHelper::custom('defaults.export',
'database', '',
JTEXT::_('COM_JAMEGAFILTER_EXPORT'));
		JToolBarHelper::custom('defaults.export_all',
'pending', '',
JTEXT::_('COM_JAMEGAFILTER_EXPORT_ALL'), false);

		$user = JFactory::getUser();
		if ($user->authorise('core.admin',
'com_jamegafilter') ||
$user->authorise('core.options',
'com_jamegafilter'))
		{
			JToolbarHelper::preferences('com_jamegafilter');
		}
	}
}views/defaults/tmpl/index.html000064400000000054151164267360012473
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/defaults/tmpl/default.php000064400000006352151164267360012642
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$jversion = version_compare(JVERSION, '4', '>=') ?
'j4' : 'j3';
?>
<form
action="index.php?option=com_jamegafilter&view=defaults"
method="post" id="adminForm"
name="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2 <?php echo
$jversion ?>">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
<?php else : ?>
	<div id="j-main-container">
<?php endif; ?>	
	<table class="table table-striped table-hover">
		<thead>
		<tr>
			<th width="1%"><?php echo
JText::_('COM_JAMEGAFILTER_NUM'); ?></th>
			<th width="2%">
				<?php echo JHtml::_('grid.checkall'); ?>
			</th>
			<th width="90%">
				<?php echo JText::_('COM_JAMEGAFILTER_NAME') ;?>
			</th>
			<th width="5%">
				<?php echo JText::_('COM_JAMEGAFILTER_TYPE'); ?>
			</th>
			<th width="5%">
				<?php echo JText::_('COM_JAMEGAFILTER_PUBLISHED'); ?>
			</th>
		</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="5">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
			<?php if (!empty($this->items)) : ?>
				<?php foreach ($this->items as $i => $row) :
					$link =
JRoute::_('index.php?option=com_jamegafilter&task=default.edit&id='
. $row->id);
				?>
					<tr>
						<td><?php echo $this->pagination->getRowOffset($i);
?></td>
						<td>
							<?php echo JHtml::_('grid.id', $i, $row->id); ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>"
title="<?php echo JText::_('COM_JAMEGAFILTER_EDIT');
?>">
								<?php echo $row->title; ?>
							</a>
						</td>
						<td align="center">
							<?php echo $row->type; ?>
						</td>
						<td align="center">
							<?php echo JHtml::_('jgrid.published',
$row->published, $i, 'defaults.', true, 'cb'); ?>
						</td>
					</tr>
				<?php endforeach; ?>
			<?php endif; ?>
		</tbody>
	</table>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
<style>
	.j4 .sidebar-nav {
		padding-left: 0;
		padding-right: 0;
	}

	.j4 .sidebar-nav .nav {
		border-bottom: 2px solid #DEE2E6;
		display: flex;
		flex-direction: row !important;
		align-items: stretch;
	}

	.j4 .sidebar-nav .nav li {
		padding: 0 12px;
		margin-bottom: -2px;
	}

	.sidebar-nav li.active, .sidebar-nav li.item:hover {
		border-bottom: 2px solid var(--template-link-color);
		background: rgba(255,255,255,.8);
	}

	.j4 .sidebar-nav .nav a {
		font-size: 1rem;
		padding: 8px 0;
	}

	.j4 .sidebar-nav li.active a {
		color: var(--template-link-color);
		font-weight: 600;
	}

	.j4 .sidebar-nav .nav a::before {
		display: none;
	}
</style>
views/index.html000064400000000054151164267360007710
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/cron/view.html.php000064400000003004151164267360011300
0ustar00<?php

/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');

class JaMegafilterViewCron extends JViewLegacy {
	
	function display($tpl = null) {
		$this->form = $this->get('Form');
		$this->item = $this->get('Item');
		if ($this->item) {
			$this->form->bind($this->item);
		} else {
			$app = JFactory::getApplication();
			$app->enqueueMessage(
JText::_('COM_JAMEGAFILTER_SAVE_CONFIG_TO_GET_CRON_URL'),
'warning');
		}
		
		$this->addToolBar();
		$this->sidebar = JHtmlSidebar::render();
		
		parent::display($tpl);
	}
	
	function addToolBar()
	{
		JaMegafilterHelper::addSubmenu('cron');
		
		JToolBarHelper::title('JA Megafilter ' .
JText::_('COM_JAMEGAFILTER_CRON'));
		JToolBarHelper::apply('cron.save');
		JToolBarHelper::custom('cron.newCronUrl',
'link','link',JText::_('COM_JAMEGAFILTER_NEW_CRON_URL'),
false);
		JToolBarHelper::custom('cron.reset',
'loop','loop',JText::_('COM_JAMEGAFILTER_RESET_LAST_CRON'),
false);
	}
}views/cron/tmpl/default.php000064400000004006151164267360011766
0ustar00<?php

/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');
JHtml::_('formbehavior.chosen', 'select');
$jversion = version_compare(JVERSION, '4', '>=') ?
'j4' : 'j3';

?>
<form action="<?php echo
JRoute::_('index.php?option=com_jamegafilter&view=cron')
?>" method="post" id="adminForm"
name="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2 <?php echo
$jversion ?>">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
<?php else : ?>
	<div id="j-main-container">
<?php endif; ?>	
		<div class="form-horizontal">
			<?php echo $this->form->renderFieldSet('config')
?>
		</div>
	</div>
	<input type="hidden" name="task" value=""
/>
	<?php echo JHtml::_('form.token'); ?>
</form>
<style>
	.j4 .sidebar-nav {
		padding-left: 0;
		padding-right: 0;
	}

	.j4 .sidebar-nav .nav {
		border-bottom: 2px solid #DEE2E6;
		display: flex;
		flex-direction: row !important;
		align-items: stretch;
	}

	.j4 .sidebar-nav .nav li {
		padding: 0 12px;
		margin-bottom: -2px;
	}

	.sidebar-nav li.active, .sidebar-nav li.item:hover {
		border-bottom: 2px solid var(--template-link-color);
		background: rgba(255,255,255,.8);
	}

	.j4 .sidebar-nav .nav a {
		font-size: 1rem;
		padding: 8px 0;
	}

	.j4 .sidebar-nav li.active a {
		color: var(--template-link-color);
		font-weight: 600;
	}

	.j4 .sidebar-nav .nav a::before {
		display: none;
	}
</style>
views/default/index.html000064400000000054151164267360011334
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/default/view.html.php000064400000005500151164267360011766
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class JaMegaFilterViewDefault extends JViewLegacy
{

	protected $form = null;


	public function display($tpl = null)
	{
		$app = JFactory::getApplication();
		$input = $app->input;
		$this->type = $input->get('type');
		JPluginHelper::importPlugin('jamegafilter');
		// Get the Data
		$this->item = $this->get('Item');
		$this->form = $this->get('Form');
		if ($this->form && $this->item->params) {
			$this->form->bind($this->item->params);
		}

		// Check for errors.
		if (count($errors = $this->get('Errors')))
		{
			$app->enqueueMessages(implode('<br />', $errors),
'message');

			return false;
		}

		// Set the toolbar
		$this->addToolBar();
		
		$this->title = $input->get('title', '',
'raw');
		$this->published = $input->get('published', 0);
		if (!empty($this->type))
			$this->item->type = $this->type;
		if ($this->item->type == NULL) $this->item->type =
'blank';
		if (!empty($this->published))
			$this->item->published = $this->published;
		if (!empty($this->title))
			$this->item->title = $this->title;
		
		$this->typeLists = JaMegafilterHelper::getSupportedComponentList();
		$this->checkComponent =
JaMegafilterHelper::getComponentStatus('com_'.$this->item->type);
		
		$this->id = $input->get('id');
		if (!$this->checkComponent && $this->id) {
			$app->enqueueMessage(JText::sprintf('COM_JAMEGAFILTER_COMPONENT_NOT_FOUND',
ucfirst($this->item->type)), 'error');
		}
		
		if (!$this->form && $this->id) {
			$app->enqueueMessage(JText::_('COM_JAMEGAFILTER_FORM_NOT_FOUND'),
'error');
		}
		// Display the template
		parent::display($tpl);
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function addToolBar()
	{
		$input = JFactory::getApplication()->input;

		// Hide Joomla Administrator Main menu
		$input->set('hidemainmenu', true);

		$isNew = ($this->item->id == 0);

		if ($isNew)
		{
			$title = JText::_('COM_JAMEGAFILTER_NEW');
		}
		else
		{
			$title = JText::_('COM_JAMEGAFILTER_EDIT');
		}

		JToolBarHelper::title($title, 'default');
		JToolBarHelper::apply('default.jaapply');
		JToolBarHelper::save('default.jasave');
		JToolBarHelper::cancel(
			'default.cancel',
			$isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'
		);
	}
}views/default/tmpl/index.html000064400000000054151164267360012310
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/default/tmpl/edit.php000064400000022044151164267360011754
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');

require_once JPATH_COMPONENT.'/assets/asset.php';
JFactory::getDocument()->addScriptDeclaration("
	Joomla.submitbutton = function(task)
	{
		if (task == 'default.cancel' ||
document.formvalidator.isValid(document.getElementById('item-form')))
{
			Joomla.submitform(task, document.getElementById('item-form'));
		}
	};
");
$app = JFactory::getApplication();
$typeLists = $this->typeLists;
$item = $this->item;
if (!version_compare(JVERSION, '4', 'ge')){
  $jVer = 'j3';
}else{
  $jVer = 'j4';
}
?>
<form action="<?php echo
JRoute::_('index.php?option=com_jamegafilter&view=default&layout=edit&id='
. (int) $this->item->id); ?>"
		method="post" name="adminForm"
id="item-form" class="form-validate <?php echo $jVer
?>">
	<div class="form-horizontal">
		<fieldset class="adminform">
			<div class="row-fluid row-details">
				
				<div class="span12">
					<div class="control-group">
						<div class="control-label"></div>
						<div class="control-legend"><legend><?php
echo JText::_('COM_JAMEGAFILTER_DETAILS');
?></legend></div>
						<div class="controls"></div>
					</div>
					<div class="control-group">
						<div class="control-label"><?php echo
JText::_('COM_JAMEGAFILTER_COMPONENT'); ?></div>
						<div class="controls">
              <select class="form-select form-select-color-state
form-select-success valid form-control-success"
id="jform_jatype" name="jform[jatype]"
                      onChange="window.location.href='<?php
echo
JRoute::_('index.php?option=com_jamegafilter&layout=edit&id='
. (int) $this->item->id);
?>&view=default&type='+this.value;">
								<option value="blank"><?php echo
JText::_('JSELECT'); ?></option>
								<?php
								if (!empty($typeLists)):
									foreach ($typeLists AS $l):
										echo '<option '.($item->type == $l ? '
selected="selected" ' : '').'
value="'.$l.'"
>'.ucfirst($l).'</option>';
									endforeach;
								endif;
								?>
							</select>
						</div>
					</div>
					<?php if ($item->type != 'blank'): ?>
            <!--published-->
						<div class="control-group">
							<div class="control-label"><?php echo
JText::_('COM_JAMEGAFILTER_PUBLISHED'); ?></div>
							<div class="controls">
								<fieldset id="jform_params_menu_text"
class="btn-group btn-group-yesno radio">
                  <input class="btn-check"
type="radio" id="jform_params_menu_text0"
                         name="jform[published]"
value="1" <?php echo ($item->published==1 ? '
checked="checked"' : '') ?>>
                  <label for="jform_params_menu_text0"
class="btn btn-outline-success"><?php echo
JText::_('JYES'); ?></label>
                  
                  <input class="btn-check"
type="radio" id="jform_params_menu_text1"
                         name="jform[published]"
value="0" <?php echo ($item->published==0 ? '
checked="checked"' : '') ?>>
                  <label for="jform_params_menu_text1"
class="btn btn-outline-danger"><?php echo
JText::_('JNO'); ?></label>
								</fieldset>
							</div>
						</div>
            <!--title *-->
						<div class="control-group">
							<div class="control-label">
								<label for="jform_title">
									<?php echo JText::_('COM_JAMEGAFILTER_TITLE') ?>
									<span class="star">&nbsp;*</span>
								</label>
							</div>
							<div class="controls">
								<input id="jform_title" type="text"
class="inputbox form-control" value="<?php echo
$item->title; ?>" name="jform[title]" required />
							</div>
						</div>
            <!--root category -> generate thumbnail-->
						<?php if ($this->form && $this->checkComponent ):
?>
							<?php echo $this->form->renderFieldSet('base');
?>
						<?php endif; ?>
					<?php endif; ?>
				</div>
			</div>
			
			<?php if ($this->form && $this->checkComponent
&& $item->type != 'blank'): ?>
			<div class="row-fluid row-filter-config">
				<div class="control-group">
					<div class="control-label"></div>
					<div class="control-legend"><legend><?php
echo JText::_('COM_JAMEGAFILTER_FILTER_CONFIG');
?></legend></div>
					<div class="controls"></div>
				</div>
        <!--base field, filter config and Page option-->
				<?php foreach
($this->form->getFieldset('filterfields') as $field):?>
					<div class="control-group">
						<div class="config-wrap">
							<?php echo
$this->form->getInput($field->fieldname,$field->group,(!empty($item->params[$field->fieldname])
? $item->params[$field->fieldname] : false)); ?>
						</div>
					</div>
				<?php endforeach; ?>
			</div>
			<?php endif; ?>
		</fieldset>
	</div>
	<input type="hidden" name="task" value=""
/>
	<input type="hidden" value="<?php echo $item->id;
?>" name="jform[id]" />
	<?php echo JHtml::_('form.token'); ?>
</form>

<script type="text/javascript">
(function(root, $) {
	var drag_i, drop_i, helper, moved;
	$( "#tabs" ).tabs().addClass( "ui-tabs-vertical
ui-helper-clearfix" );
	$( "#tabs li" ).removeClass( "ui-corner-top"
).addClass( "ui-corner-left" );
	$( "#tabs" ).tabs().find( ".ui-tabs-nav" ).sortable({
		handle: ".icon-menu",
		axis: "y",
		start: function (e, ui) {
			drag_i= $(ui.item[0]).index();
		},
		stop: function(e, ui) {
			drop_i = $(ui.item[0]).index();
			if (drop_i !== drag_i) {
				helper = $('<div>', {
					class:'ui-tabs-panel'
				});
				helper.insertAfter($('.ui-tabs-panel:last'));
				moved = $($('.ui-tabs-panel')[drag_i]).detach();
				moved.insertBefore($($('.ui-tabs-panel')[drop_i]));
				helper.remove();
			}
			$( "#tabs" ).tabs( "refresh" );
		}
	});

	$( "tbody" ).sortable({
		axis: "y",
		handle: ".icon-menu"
	});
	
	var updateLayoutInfo = function() {
		var $info = $('#jform_params_layout_addition');
		var layout_addition = [];

		$info.val('');

		$('#sortable2').find('li').each(function() {
			var $li = $(this);
			var field = $li.attr('data-jfield');

			$('input.layout-addition[data-jfield="'+ field
+'"]').val(1);
			layout_addition.push(($(this).attr('data-jfield')));
		});

		$info.val(layout_addition.join(','));

		$('#sortable1').find('li').each(function() {
			var $li = $(this);
			var field = $li.attr('data-jfield');

			$('input.layout-addition[data-jfield="'+ field
+'"]').val(0);
		});
	}

	var updateFilterConfig = function() {
		var $groups = $('.filter-field');
		var groups = [];
		$groups.each(function() {
			groups.push( $(this).attr('href') );
		})

		var $fields = $( groups.join(','));

		var $filterConfig = $('#filterconfig');

		$fields.find('.icon-publish[data-jfield]').each( function() {
			var field = $(this).attr('data-jfield');
			var $filter =
$filterConfig.find('tr[data-jfield="'+field+'"]');

			$filter.show();
		});
		
		$fields.find('.icon-unpublish[data-jfield]').each( function() {
			var field = $(this).attr('data-jfield');
			var $filter =
$filterConfig.find('tr[data-jfield="'+field+'"]');

			$filter.hide();
		});

	}

	$(document).ready(function(){
		// this is code for field set radio sort by.
		$('input.sort_by_input').change(function(){
			$('.btn-asc, .btn-desc').removeClass('active
btn-success');
			$('.btn-'+$(this).val()).addClass('active
btn-success');
		});
		$( "#sortable1, #sortable2" ).sortable({
			items: "li:not(.ui-state-disabled)",
			connectWith: ".connectedSortable",
			placeholder: "ui-sortable-placeholder",
			update: function( event, ui ) {
				updateLayoutInfo();
			}
		}).disableSelection();

		setTimeout( function () {
			updateLayoutInfo();
			updateFilterConfig();
		}, 500);
    var jVer = "<?php echo $jVer ?>";
    if (jVer === 'j4'){
      $('div.chosen-container').css('display',
'none');
      $('select.form-select').css('display',
'');
    }
	});


	root.publish_item = function(e) {
		var $input = $(e).next();
		var $ele = $(e);
		var $span;
		
		switch ( $input.val()) {
			case '0':
				$input.val(1);
				$span = $ele.find('span');
				$span.removeClass('icon-unpublish');
				$span.addClass('icon-publish');
				break
			case '1':
				$input.val(0);
				$span = $ele.find('span');
				$span.removeClass('icon-publish');
				$span.addClass('icon-unpublish');
				break;
		}

		updateFilterConfig();
	}

	root.default_sort = function(e) {
		var obj = $(e);
		
		if (obj.children('span').hasClass('icon-publish')) {
			obj.children('span').removeClass('icon-publish').addClass('icon-delete');
			obj.children('input').val(0);
		} else {
			$('.btn-sort_default
span').removeClass('icon-publish').addClass('icon-delete');
			$('.sort_default-input').val(0);
			obj.children('span').removeClass('icon-delete').addClass('icon-publish');
			obj.children('input').val(1);
		}
	}
})( window, jQuery);
</script>
controllers/defaults.php000064400000004776151164267360011463
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');

class JaMegaFilterControllerDefaults extends JControllerAdmin
{
	function getModel($name = 'Default', $prefix =
'JaMegaFilterModel', $config = array('ignore_request'
=> true))
	{
		$model = parent::getModel($name, $prefix, $config);

		return $model;
	}

	function delete()
	{
		if (!JFactory::getUser()->authorise('jamegafilter.delete',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		parent::delete();
	}
	
	function export()
	{
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		$app = JFactory::getApplication();
		$input = $app->input;
		$cid = $input->post->get('cid', array(),
'array');
		foreach ( $cid as $id)
		{
			$this->getModel()->proxyExport($id);
		}

		$this->setMessage(JText::_('COM_JAMEGAFILTER_EXPORT_SUCCESS'));
		$this->setRedirect('index.php?option=com_jamegafilter');
	}
	
	function export_all()
	{
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}
		
		$app = JFactory::getApplication();
		$mode_list =
$this->getModel('Defaults','JaMegaFilterModel');
		$items = $mode_list->getItems();
		foreach ( $items as $item)
		{
			$this->getModel()->proxyExport($item->id);
		}

		$this->setMessage(JText::_('COM_JAMEGAFILTER_EXPORT_SUCCESS'));
		$this->setRedirect('index.php?option=com_jamegafilter');
	}
}
controllers/index.html000064400000000054151164267360011121
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>controllers/cron.php000064400000004172151164267360010603
0ustar00<?php

/**
 *
------------------------------------------------------------------------
 * JA Megafilter Component
 *
------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 *
------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');

class JaMegafilterControllerCron extends JControllerLegacy {
	
	function getModel($name = 'Cron', $prefix = '',
$config = array()) {
		return parent::getModel($name, $prefix, $config);
	}
	
	function save() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
			$this->redirect();
		}

		$model = $this->getModel();
		$model->save();
		$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
	}
	
	function newCronUrl() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
			$this->redirect();
		}

		$model = $this->getModel();
		$model->save(true);
		$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
	}
	
	function reset() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
			$this->redirect();
		}

		$model = $this->getModel();
		$model->save(false, true);
		$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=cron',
false));
	}
	
}controllers/default.php000064400000005226151164267360011267
0ustar00<?php
/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class JaMegaFilterControllerDefault extends JControllerForm
{

	function add()
	{
		if (!JFactory::getUser()->authorise('jamegafilter.create',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		parent::add();
	}

	function edit($key = NULL, $urlVar = NULL)
	{
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		parent::edit($key = NULL, $urlVar = NULL);
	}

	function saveobj() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();

		}

		$model = $this->getModel();
		return $model->saveobj();
	}
	
	function jaapply() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		$obj = $this->saveobj();
		$this->setMessage(JText::_('COM_JAMEGAFILTER_SAVE_SUCCESS'));
		$this->setRedirect('index.php?option=com_jamegafilter&view=default&layout=edit&id='.$obj->id);
	}
	
	function jasave() {
		if (!JFactory::getUser()->authorise('jamegafilter.edit',
'com_jamegafilter'))
		{
			$this->setMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->setRedirect(JRoute::_('index.php?option=com_jamegafilter&view=defaults',
false));
			$this->redirect();
		}

		$this->saveobj();
		$app = JFactory::getApplication();
		$app->enqueueMessage(JText::_('COM_JAMEGAFILTER_SAVE_SUCCESS'));
		$this->setRedirect('index.php?option=com_jamegafilter');
	}
}
jamegafilter.xml000064400000005506151164267360007741 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1"
method="upgrade">

	<name>JAMEGAFILTER</name>
	<!-- The following elements are optional and free of formatting
constraints -->
	<creationDate>August 17th,2022</creationDate>
	<author>Joomlart</author>
	<authorEmail>webmaster@joomlart.com</authorEmail>
	<authorUrl>https://www.joomlart.com</authorUrl>
	<copyright>Copyright (C), J.O.O.M Solutions Co., Ltd. All Rights
Reserved.</copyright>
	<license>license GNU/GPLv3
http://www.gnu.org/licenses/gpl-3.0.html</license>
	<!--  The version string is recorded in the components table -->
	<version>2.0.2</version>
	<!-- The description is optional and defaults to the name -->
	<description>
	<![CDATA[
		Joomla search and filter extension - JA Megafilter is a powerful and
flexible search and filtering system for your Joomla site. Supports
multiple filter setup for your Joomla site. The Filter Joomla extension
supports K2 component, E-Shop, Virtuemart, Hikashop, JoomShopping. J2Store
support is coming soon along with few more.
		<h2>NOTICE !</h2>
		<p style="color:red;"><b>Version 1.1.0 has changes
about layout management system so user has to access back-end, change
settings and save.</b></p>
	]]>
	</description>

	<updateservers>
    <server
type="extension">http://update.joomlart.com/service/tracking/j16/com_jamegafilter.xml</server>
    </updateservers>
	
	<install> <!-- Runs on install -->
		<sql>
			<file driver="mysql"
charset="utf8">sql/install.mysql.utf8.sql</file>
		</sql>
	</install>
	<uninstall> <!-- Runs on uninstall -->
		<sql>
			<file driver="mysql"
charset="utf8">sql/uninstall.mysql.utf8.sql</file>
		</sql>
	</uninstall>
	<files folder="site">
		<filename>index.html</filename>
		<filename>jamegafilter.php</filename>
		<filename>controller.php</filename>
		<folder>views</folder>
		<folder>assets</folder>
		<folder>layouts</folder>
		<folder>models</folder>
	</files>

	<languages folder="site/language">
		<language
tag="en-GB">en-GB/en-GB.com_jamegafilter.ini</language>
	</languages>

	<administration>
		<!-- Administration Menu Section -->
		<menu
link='index.php?option=com_jamegafilter'>COM_JAMEGAFILTER_MENU</menu>
		<files folder="admin">
			<filename>index.html</filename>
			<filename>jamegafilter.php</filename>
			<filename>helper.php</filename>
			<filename>base.php</filename>
			<filename>controller.php</filename>
			<filename>access.xml</filename>
			<filename>config.xml</filename>
			<folder>sql</folder>
			<folder>assets</folder>
			<folder>tables</folder>
			<folder>models</folder>
			<folder>views</folder>
			<folder>controllers</folder>
		</files>
		<languages folder="admin/language">
        		<language
tag="en-GB">en-GB/en-GB.com_jamegafilter.ini</language>
                <language
tag="en-GB">en-GB/en-GB.com_jamegafilter.sys.ini</language>
		</languages>
	</administration>

</extension>