Current File : /home/pacjaorg/www/kmm/plugins/system/djcfajax/djcfajax.php
<?php
/**
 * @package DJ-Classifieds
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email: contact@dj-extensions.com
 */

defined('_JEXEC') or die;

class plgSystemDjcfajax extends JPlugin
{
	public function __construct(& $subject, $config)
	{
		parent::__construct ( $subject, $config );
		$this->loadLanguage();
	}

	function onAfterDispatch()
	{	
		$app = JFactory::getApplication();
		$document = JFactory::getDocument();
		$jinput = $app->input;
		
		if(!$app->isClient('administrator') && $jinput->get('option')=='com_djclassifieds'){

			if(($this->params->get('enable_mobile','1')=='0' && $app->client->mobile) || ($this->params->get('enable_mobile','1')=='2' && !$app->client->mobile)){
				return;
			}
			
			$enable_in = $this->params->get('enable_in',array());
			$disable_in = $this->params->get('disable_in',array());
			
			if($disable_in && in_array($app->input->get('Itemid','0'), $disable_in)){
				return;
			}elseif(!$enable_in || in_array($app->input->get('Itemid','0'), $enable_in)){
				JHTML::_('jquery.framework');
				require_once(JPATH_ROOT.'/administrator/components/com_djclassifieds/lib/djtheme.php');
				$loader_path = JUri::root().DJClassifiedsTheme::getImgAssetPath('loading.gif');
	
				$document->addScriptDeclaration("var DJAjaxParams=".json_encode($this->params).";var DJAjaxVars={'loader_path':'".$loader_path."','page_just_loaded':true};");
				if($this->params->get('search_reset','0')){
					$lang = JFactory::getLanguage();
					$lang->load('mod_djclassifieds_search', JPATH_SITE.'/modules/mod_djclassifieds_search', 'en-GB', true);
					$lang->load('mod_djclassifieds_search', JPATH_SITE, $lang->getTag(), true);
					$document->addScriptDeclaration("DJAjaxVars.reset_text = '".JText::_('MOD_DJCLASSIFIEDS_SEARCH_RESET')."';");
				}
				$document->addScript(JURI::root(true).'/plugins/system/djcfajax/assets/js/script.js', array('version' => 'auto'));
				
				if($this->params->get('on_pagination','0')){
					if($this->params->get('items_lazy_loading','0')){
						$enable_in = $this->params->get('items_lazy_loading_enable_in',array());
						$disable_in = $this->params->get('items_lazy_loading_disable_in',array());
						if(!in_array($app->input->get('Itemid','0'), $disable_in) && (!$enable_in || in_array($app->input->get('Itemid','0'), $enable_in))){
							if($this->params->get('pagination','0')=='3'){
								JText::script('PLG_SYSTEM_DJCFAJAX_LOAD_MORE_BTN_LABEL');
							}
							$document->addScript(JURI::root(true).'/plugins/system/djcfajax/assets/js/infinitescroll.js', array('version' => 'auto'));
							if($this->params->get('blog_grid_layout','0') && $jinput->get('view')=='items' && $jinput->get('layout')=='blog'){
								$document->addScript('https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js');
							}
						}
					}
					$document->addStyleSheet(JURI::root(true).'/plugins/system/djcfajax/assets/css/style.css', array('version' => 'auto'));
				}
	
				if($this->params->get('progress_bar','0')){
					$document->addScript('https://unpkg.com/nprogress@0.2.0/nprogress.js');
					$document->addStyleSheet('https://unpkg.com/nprogress@0.2.0/nprogress.css');
				}
			
			}
		}
	}
}
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!