                                                                                                                                                                                
                                                                                                                                                                                
jllike/jllike.xml                                                                                   0000705                 00000001676 15242037005 0010020 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?xml version="1.0" encoding="utf-8"?>
<extension version="3.5.0" type="plugin" group="k2" method="upgrade">
	<name>JL Like K2 Plugin</name>
	<author>JoomLine</author>
	<creationDate>11.02.2020</creationDate>
	<copyright>(C) 2012-2019 by Artem Zhukov, Arkadiy Sedelnikov and Vadim Kunicin(http://www.joomline.ru)</copyright>
	<authorEmail>sale@joomline.ru</authorEmail>
	<authorUrl>https://joomline.ru</authorUrl>
	<version>4.0.4</version>
	<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
	<description>An Joomline Like K2 plugin to extend item form in K2.</description>
	<files>
		<filename plugin="jllike">jllike.php</filename>
	</files>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="parent_contayner"
					type="text"
					default=""
					label="Parent Contayner"
					description="Parent Contayner css class"
					/>
			</fieldset>
		</fields>
	</config>
</extension>
                                                                  jllike/jllike.php                                                                                   0000705                 00000014364 15242037005 0010005 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/**
 * jllike
 *
 * @version 4.0.0
 * @author Vadim Kunicin (vadim@joomline.ru), Arkadiy (a.sedelnikov@gmail.com)
 * @copyright (C) 2010-2019 by Vadim Kunicin (http://www.joomline.ru)
 * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 **/

// no direct access
defined('_JEXEC') or die;

/**
 * Example K2 Plugin to render YouTube URLs entered in backend K2 forms to video players in the frontend.
 */

// Load the K2 Plugin API
JLoader::register('K2Plugin', JPATH_ADMINISTRATOR . '/components/com_k2/lib/k2plugin.php');
use Joomla\String\StringHelper;

// Initiate class to hold plugin events
class plgK2Jllike extends K2Plugin
{

    // Some params
    var $pluginName = 'line';
    var $pluginNameHumanReadable = 'Line-Chart';
    private $enableShow;

    function __construct(&$subject, $params)
    {
        if(!$this->enableShow())
		{
            $this->enableShow = false;
			return;
		}
        parent::__construct($subject, $params);
		$parent_contayner = $this->params->get('parent_contayner', '');
        $plugin = JPluginHelper::getPlugin('content', 'jllike');
        $this->params = new JRegistry($plugin->params);
		if(!empty($parent_contayner))
        {
            $this->params->set('parent_contayner', $parent_contayner);
        }
        $this->loadLanguage('plg_content_jllike');
        $this->enableShow = true;
    }

    function onK2BeforeDisplay(&$item, &$params, $limitstart){
        if($this->check('onK2BeforeDisplay')){
            return $this->loadLikes($item, $params, $limitstart);
        }
    }

    function onK2AfterDisplayTitle(&$item, &$params, $limitstart){
        if($this->check('onK2AfterDisplayTitle')){
            return $this->loadLikes($item, $params, $limitstart);
        }
    }

    function onK2BeforeDisplayContent(&$item, &$params, $limitstart){
        if($this->check('onK2BeforeDisplayContent')){
            return $this->loadLikes($item, $params, $limitstart);
        }
    }

    function onK2AfterDisplayContent(&$item, &$params, $limitstart){
        if($this->check('onK2AfterDisplayContent')){
            return $this->loadLikes($item, $params, $limitstart);
        }
    }

    function onK2AfterDisplay(&$item, &$params, $limitstart){
        if($this->check('onK2AfterDisplay')){
            return $this->loadLikes($item, $params, $limitstart);
        }
    }


    private function enableShow()
	{
		$app = JFactory::getApplication();
		$input = $app->input;
        $view = $input->getString('view','');
        $layout = $input->getString('layout','');
        $task = $input->getString('task','');

        if(!$app->isClient('administrator') && ($view == 'itemlist' || ($view == 'item' && ($layout == 'item' || !$layout))) && $task != 'edit' && $task != 'add')
		{
            return true;
        }
        else
		{
            return false;
        }
    }

    private function check($trigger)
	{
        if($this->enableShow && $trigger == $this->params->get('k2trigger', ''))
		{
            return true;
        }
        return false;
    }

    private function loadLikes(&$article, &$params, $limitstart)
    {

        $k2categories = $this->params->get('k2categories', array());
        $k2categories = (is_array($k2categories)) ? $k2categories : array();
        $input = JFactory::getApplication()->input;
        $print = $input->getInt('print', 0);

        if(in_array($article->catid, $k2categories) || $print)
        {
            return '';
        }

        include_once JPATH_ROOT.'/plugins/content/jllike/helper.php';

        $url = $this->getUrl();
        $isCategory = ($input->getString('view', '') == 'itemlist') ? true : false;

        $helper = PlgJLLikeHelper::getInstance($this->params);
        $conf = JFactory::getConfig();
        $enableSef = $conf->get('sef', 0);

        if($enableSef)
        {
            $link = $url.JRoute::_(K2HelperRoute::getItemRoute($article->id.':'.$article->alias, $article->catid.':'.urlencode($article->category->alias)));
        }
        else
        {
            $link = $url.'/'.K2HelperRoute::getItemRoute($article->id.':'.$article->alias, $article->catid.':'.urlencode($article->category->alias));
        }

        if($this->params->get('k2_images', 'fields') == 'fields' && !empty($article->imageLarge))
        {
            $image = trim($article->imageLarge);
            if(!empty($image))
            {
                if(StringHelper::strpos($image, '/') === 0)
                {
                    $image = StringHelper::substr($image, 1);
                }
                $image = JURI::root().$image;
            }
        }
        else
        {
            $image = PlgJLLikeHelper::extractImageFromText($article->introtext, $article->fulltext);
        }

        $text = $helper->getShareText($article->metadesc, $article->introtext, $article->fulltext);
        $enableOG = $isCategory ? 0 : $this->params->get('k2_add_opengraph', 0);
        $shares = $helper->ShowIN($article->id, $link, $article->title, $image, $text, $enableOG);

        if (!$isCategory)
        {
            $helper->loadScriptAndStyle(0);
            return $shares;
        }
        else if($this->params->get('allow_in_category', 0))
        {
            $helper->loadScriptAndStyle(1);
            return $shares;
        }
    }

    private function getUrl()
    {
		$root = JURI::getInstance()->toString(array('host'));
		$prefix = (JFactory::getConfig()->get('force_ssl') == 2) ? 'https://' : 'http://';
        $url = $prefix . $this->params->get('pathbase', '') . str_replace('www.', '', $root);

        if($this->params->get('punycode_convert',0))
        {
            $file = JPATH_ROOT.'/libraries/idna_convert/idna_convert.class.php';
            if(!JFile::exists($file))
            {
                return JText::_('PLG_JLLIKEPRO_PUNYCODDE_CONVERTOR_NOT_INSTALLED');
            }

            include_once $file;

            if($url)
            {
                if (class_exists('idna_convert'))
                {
                    $idn = new idna_convert;
                    $url = $idn->encode($url);
                }
            }
        }
        return $url;
    }
}
                                                                                                                                                                                                                                                                            sppagebuilder/sppagebuilder.php                                                                     0000705                 00000005650 15242037005 0012733 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2016 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
//no direct accees
defined ('_JEXEC') or die ('restricted aceess');

$k2_plg_path = JPATH_ADMINISTRATOR.'/components/com_k2/lib/k2plugin.php';
if (!file_exists($k2_plg_path)) {
 return;
}

$sppb_helper_path = JPATH_ADMINISTRATOR . '/components/com_sppagebuilder/helpers/sppagebuilder.php';
if (!file_exists($sppb_helper_path)) {
 return;
}

JLoader::register('K2Plugin', $k2_plg_path);
if(!class_exists('SppagebuilderHelper')) {
	require_once $sppb_helper_path;
}

// Initiate class to hold plugin events
class plgK2Sppagebuilder extends K2Plugin
{
	// Some params
	var $pluginName = 'sppagebuilder';
	var $pluginNameHumanReadable = 'K2 - SP Page Builder';

	function __construct(&$subject, $params) {
		parent::__construct($subject, $params);
	}

	public static function __context() {
		$context = array(
			'option'=>'com_k2',
			'view'=>'item',
			'id_alias'=>'cid'
		);
		return $context;
	}

	function onAfterK2Save($row, $isNew) {

    $isSppagebuilderEnabled = $this->isSppagebuilderEnabled();
    if ( !$isSppagebuilderEnabled ) return;

		$input = JFactory::getApplication()->input;
		$option = $input->get('option', '', 'STRING');
		$view = $input->get('view', '', 'STRING');
		$form = $input->post->get('jform', array(), 'ARRAY');

		$sppagebuilder_active = (isset($form['attribs']['sppagebuilder_active']) && $form['attribs']['sppagebuilder_active']) ? $form['attribs']['sppagebuilder_active'] : 0;
		$sppagebuilder_content = (isset($form['attribs']['sppagebuilder_content']) && $form['attribs']['sppagebuilder_content']) ? $form['attribs']['sppagebuilder_content'] : '[]';

		$values = array(
			'title' => $row->title,
			'text' => $sppagebuilder_content,
			'option' => $option,
			'view' => $view,
			'id' => $row->id,
			'active' => $sppagebuilder_active,
			'created_on' => $row->created,
			'created_by' => $row->created_by,
			'modified' => $row->modified,
			'modified_by' => $row->modified_by,
			'language' => '*'
		);

		SppagebuilderHelper::onAfterIntegrationSave($values);

	}

	function onK2PrepareContent(&$item, &$params, $limitstart) {
		$input = JFactory::getApplication()->input;
		$option = $input->get('option', '', 'STRING');
		$view = $input->get('view', '', 'STRING');

    $isSppagebuilderEnabled = $this->isSppagebuilderEnabled();

    if ( $isSppagebuilderEnabled ) {
      if (SppagebuilderHelper::onIntegrationPrepareContent($item->text, $option, $view, $item->id)) {
  			$item->text = SppagebuilderHelper::onIntegrationPrepareContent($item->text, $option, $view, $item->id);
  		}
    }
	}

  private function isSppagebuilderEnabled(){
    $db = JFactory::getDbo();
    $db->setQuery("SELECT enabled FROM #__extensions WHERE element = 'com_sppagebuilder' AND type = 'component'");
    return $is_enabled = $db->loadResult();
  }

}
                                                                                        sppagebuilder/sppagebuilder.xml                                                                     0000705                 00000001343 15242037005 0012737 0                                                                                                    ustar 00                                                                                                                                                                                                                                                       <?xml version="1.0" encoding="utf-8"?>
<extension version="3.6" type="plugin" group="k2" method="upgrade">
	<name>K2 - SP Page Builder</name>
	<author>Joomla! Project</author>
	<author>JoomShaper.com</author>
    <creationDate>Sep 2016</creationDate>
    <copyright>Copyright (C) 2010 - 2016 JoomShaper. All rights reserved.</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later</license>
    <authorEmail>support@joomshaper.com</authorEmail>
    <authorUrl>www.joomshaper.com</authorUrl>
    <version>1.2</version>
    <description>SP Page Builder System plugin to add support for 3rd party components</description>
	<files>
		<filename plugin="sppagebuilder">sppagebuilder.php</filename>
	</files>
</extension>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             