Your IP : 216.73.216.219


Current Path : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/_admin/elements/ext/
Upload File :
Current File : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/_admin/elements/ext/jed.php

<?php
/** 
* Cookie Commander
* 
* @author : Lab5 - Dennis Riegelsberger
* @authorUrl : https://lab5.ch
* @copyright : Copyright (C) 2018+  Lab5 - Dennis Riegelsberger. All rights reserved.
* @license : GNU/GPL General Public License version 2 or later
* @project : https://lab5.ch/cookie-commander
* @on JED : https://extensions.joomla.org/extensions/extension/site-management/cookie-control/lab5-cookie-commander/
* 
* Built with <3 
* Lab5
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
defined('JPATH_BASE') or die;
if(!defined('DS')) define('DS',DIRECTORY_SEPARATOR);

jimport('joomla.form.formfield');

class JFormFieldJed extends JFormField {
		
		/////////////////////////////////////////////////////
        protected $type = 'Jed';
		/////////////////////////////////////////////////////
		public function renderField($options = array()) {
		/////////////////////////////////////////////////////
									
									return $this->getInput(); 
					
        } ///////////////////////////////////////////////////
        protected function getInput() {
        /////////////////////////////////////////////////////

									$extension = $this->form->getData();  
									$ismod = $extension->get('module'); 
									if( !empty($ismod) ){  // MODULE :

											$extension = $extension->get('module');
											$extensionpath = "modules/".$extension ;

									}else{ // PLUGIN :
											
											$folder = $extension->get('folder');
											$extension = $extension->get('element');
											$extensionpath = 'plugins/'.$folder.'/'.$extension ;
									}
									/////////////////////////
									$configfile = JPATH_ROOT.'/'.$extensionpath.'/'.$extension.'.xml';
									$xml = simplexml_load_file($configfile);
									/////////////////////////

									$jed = trim($xml->jed);
									if( !$jed ) $jed = 'profile/profile/details/114444/#extensions'; // FALLBACK 
									$URL = 'https://extensions.joomla.org/'.$jed;

									/////////////////////////
									// $lastupdated = ($xml->updateDate) ? ' <small>(last updated '.$xml->updateDate.')</small>' : '';
									/////////////////////////

									// $LAB5_JEDLINK_TXT = JText::_('LAB5_JEDLINK_TXT');
									$LAB5_JEDLINK_TXT="Find this extension in the JED ( Joomla! Extensions Directory )";
									// $LAB5_JEDLINK_LABEL="Extension in JED:";
									return  '<a href = "'.$URL.'" target="_blank">'.$LAB5_JEDLINK_TXT.'</a>	'; 

        } ///////////////////////////////////////////////////
        /////////////////////////////////////////////////////
		
}