acf
This commit is contained in:
		
							
								
								
									
										49
									
								
								plugins/fields/acfemail/acfemail.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								plugins/fields/acfemail/acfemail.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * @package         Advanced Custom Fields | ||||
|  * @version         2.8.8 Pro | ||||
|  *  | ||||
|  * @author          Tassos Marinos <info@tassos.gr> | ||||
|  * @link            http://www.tassos.gr | ||||
|  * @copyright       Copyright © 2020 Tassos Marinos All Rights Reserved | ||||
|  * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later | ||||
| */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| use Joomla\CMS\Factory; | ||||
|  | ||||
| JLoader::register('ACF_Field', JPATH_PLUGINS . '/system/acf/helper/plugin.php'); | ||||
|  | ||||
| if (!class_exists('ACF_Field')) | ||||
| { | ||||
| 	Factory::getApplication()->enqueueMessage('Advanced Custom Fields System Plugin is missing', 'error'); | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| class PlgFieldsACFEmail extends ACF_Field | ||||
| { | ||||
| 	protected $validate = 'email'; | ||||
| 	 | ||||
| 	/** | ||||
| 	 *  Override the field type | ||||
| 	 * | ||||
| 	 *  @var  string | ||||
| 	 */ | ||||
| 	protected $overrideType = 'email'; | ||||
|  | ||||
| 	/** | ||||
| 	 *  Field's Hint Description | ||||
| 	 * | ||||
| 	 *  @var  string | ||||
| 	 */ | ||||
| 	protected $hint = 'email@example.com'; | ||||
|  | ||||
| 	/** | ||||
| 	 *  Field's Class | ||||
| 	 * | ||||
| 	 *  @var  string | ||||
| 	 */ | ||||
| 	protected $class = 'input-xlarge w-100'; | ||||
| } | ||||
							
								
								
									
										21
									
								
								plugins/fields/acfemail/acfemail.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								plugins/fields/acfemail/acfemail.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <extension type="plugin" version="3.7.0" group="fields" method="upgrade"> | ||||
| 	<name>ACF_EMAIL</name> | ||||
| 	<description>ACF_EMAIL_DESC</description> | ||||
| 	<author>Tassos Marinos</author> | ||||
| 	<creationDate>May 2019</creationDate> | ||||
| 	<copyright>Copyright (C) 2019 Tassos Marinos. All rights reserved.</copyright> | ||||
| 	<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||||
| 	<authorEmail>info@tassos.gr</authorEmail> | ||||
| 	<authorUrl>www.tassos.gr</authorUrl> | ||||
| 	<version>1.0</version> | ||||
| 	<scriptfile>script.install.php</scriptfile> | ||||
| 	<files> | ||||
| 		<filename plugin="acfemail">acfemail.php</filename> | ||||
| 		<filename>script.install.helper.php</filename> | ||||
| 		<filename>version.php</filename> | ||||
| 		<folder>language</folder> | ||||
| 		<folder>params</folder> | ||||
| 		<folder>tmpl</folder> | ||||
| 	</files> | ||||
| </extension> | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Correu electrònic" | ||||
| ACF_EMAIL="Camps - ACF Correu electrònic" | ||||
| ACF_EMAIL_DESC="Mostrar l'adreça de correu electrònic de manera segura a la part pública d'una manera il·legible pels robots d'spam." | ||||
| ACF_EMAIL_VALUE_DESC="Estableix un correu electrònic" | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Protegeix el correu electrònic" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Si s'activa, l'adreça de correu electrònic estarà protegida per un script d'ofuscació Anti-Spam que la farà il·legible pels spambots." | ||||
| ACF_EMAIL_DISPLAY_AS="Mostrar com" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Estableix si mostrar l'adreça de correu electrònic  com text plà o si convertir-la en un enllaç mailto." | ||||
| ACF_EMAIL_TEXT="Text" | ||||
| ACF_EMAIL_LINK="Enllaç mailto" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - E-mail" | ||||
| ACF_EMAIL="Felter - ACF E-mail" | ||||
| ACF_EMAIL_DESC="Placer sikkert e-mailadresser i frontend som er ikke læsbare for spambotter." | ||||
| ACF_EMAIL_VALUE_DESC="Angiv en e-mailadresse." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Gem e-mailadresse" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Hvis aktiveret, så vil e-mailadressen være beskyttet med et anti-spam e-mail skjule script, der gør den ikke læsbar for spambotter." | ||||
| ACF_EMAIL_DISPLAY_AS="Vis som" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Vælg om e-mailadressen skal vises som ren tekst eller den skal konverteres til et mailto link." | ||||
| ACF_EMAIL_TEXT="Tekst" | ||||
| ACF_EMAIL_LINK="Mailto link" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - E-Mail" | ||||
| ACF_EMAIL="Felder - ACF-E-Mail" | ||||
| ACF_EMAIL_DESC="E-Mail-Adressen, die für Spambots nicht lesbar sind, sicher im Front-End anzeigen." | ||||
| ACF_EMAIL_VALUE_DESC="Legen Sie eine E-Mail-Adresse fest." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="E-Mail-Adresse verbergen" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Wenn diese Option aktiviert ist, wird die E-Mail-Adresse mit einem Anti-Spam-Skript zum Schutz vor E-Mails geschützt, sodass sie für Spambots nicht lesbar ist." | ||||
| ACF_EMAIL_DISPLAY_AS="Anzeigen als" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Wählen Sie aus, ob die E-Mail-Adresse als einfacher Text angezeigt oder in einen Mailto-Link konvertiert werden soll." | ||||
| ACF_EMAIL_TEXT="Text" | ||||
| ACF_EMAIL_LINK="Mailto Link" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Email" | ||||
| ACF_EMAIL="Fields - ACF Email" | ||||
| ACF_EMAIL_DESC="Safely display email addresses in the front-end that are unreadbable to spambots." | ||||
| ACF_EMAIL_VALUE_DESC="Set an email address." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Cloak Email Address" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="If enabled, the email address will be protected with an Anti-Spam Email Cloaking script making it unreadable to spambots." | ||||
| ACF_EMAIL_DISPLAY_AS="Display As" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Select whether to display the email address as plain text or convert it to a mailto link." | ||||
| ACF_EMAIL_TEXT="Text" | ||||
| ACF_EMAIL_LINK="Mailto Link" | ||||
| @ -0,0 +1,9 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| ACF_EMAIL="Fields - ACF Email" | ||||
| ACF_EMAIL_DESC="Safely display email addresses in the front-end that are unreadbable to spambots." | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Email" | ||||
| ACF_EMAIL="Campos - ACF Email" | ||||
| ACF_EMAIL_DESC="Muestre de forma segura las direcciones de correo electrónico en el front-end que son ilegibles para los spambots." | ||||
| ACF_EMAIL_VALUE_DESC="Establecer una dirección de correo electrónico." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Dirección de correo electrónico oculta" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Si está habilitado, la dirección de correo electrónico se protegerá con un script de encubrimiento de correo electrónico antispam que hará que los robots de spam no puedan leerla." | ||||
| ACF_EMAIL_DISPLAY_AS="Mostrar como" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Seleccione si desea mostrar la dirección de correo electrónico como texto sin formato o convertirla en un enlace mailto." | ||||
| ACF_EMAIL_TEXT="Texto" | ||||
| ACF_EMAIL_LINK="Enlace de correo a" | ||||
| @ -0,0 +1,9 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| ACF_EMAIL="Campos - ACF Email" | ||||
| ACF_EMAIL_DESC="Muestre de forma segura las direcciones de correo electrónico en el front-end paraa que sean ilegibles para los spambots." | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Email" | ||||
| ACF_EMAIL="Campi - Email ACF " | ||||
| ACF_EMAIL_DESC="Mostra indirizzi email in sicurezza nel front-end, che siano illeggibili per gli spambot." | ||||
| ACF_EMAIL_VALUE_DESC="Imposta un indirizzo email." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Maschera indirizzo email" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Se abilitato l'indirizzo email sarà protetto con una mascheramento anti-spam che lo rende illeggibile per gli spambot." | ||||
| ACF_EMAIL_DISPLAY_AS="Mostra come" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Scegli se mostrare l'indirizzo email come testo semplice o convertirlo a collegamento mailto." | ||||
| ACF_EMAIL_TEXT="Testo" | ||||
| ACF_EMAIL_LINK="Collegamento mailto" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Email" | ||||
| ACF_EMAIL="Velden - ACF Email" | ||||
| ACF_EMAIL_DESC="Toon veilig e-mailadressen aan de front-end die onleesbaar zullen zijn voor spambots." | ||||
| ACF_EMAIL_VALUE_DESC="Stel een e-mailadres in." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Verberg e-mailadres" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Indien ingeschakeld, wordt het e-mailadres beschermd met een Anti-Spam Email verberg-script, waardoor het onleesbaar is voor spambots." | ||||
| ACF_EMAIL_DISPLAY_AS="Weergeven als" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Selecteer of het e-mailadres als platte tekst moet worden weergegeven of moet worden omgezet in een mailto-link." | ||||
| ACF_EMAIL_TEXT="Tekst" | ||||
| ACF_EMAIL_LINK="Mailto Link" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - электронная почта" | ||||
| ACF_EMAIL="Поля - электронная почта ACF" | ||||
| ACF_EMAIL_DESC="Безопасное отображение адресов электронной почты в интерфейсе, недоступных для спам-ботов." | ||||
| ACF_EMAIL_VALUE_DESC="Установить адрес электронной почты." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Скрытый адрес электронной почты" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Если этот параметр включен, адрес электронной почты будет защищен сценарием защиты от спама в электронной почте, что сделает его нечитаемым для спам-ботов." | ||||
| ACF_EMAIL_DISPLAY_AS="Показать как" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Выберите, отображать ли адрес электронной почты в виде простого текста или преобразовать его в ссылку mailto." | ||||
| ACF_EMAIL_TEXT="Текст" | ||||
| ACF_EMAIL_LINK="Ссылка на почту" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - E-post" | ||||
| ACF_EMAIL="Fält - ACF E-post" | ||||
| ACF_EMAIL_DESC="Visa e-postadresser säkert i frontend, på ett sätt som är oläsbart för spamrobotar." | ||||
| ACF_EMAIL_VALUE_DESC="Ange en e-postadress." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Skydda e-postadress" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="Om aktiverad, kommer e-postadressen att skyddas med ett antispam-e-postskydd som gör den oläsbar för spamrobotar." | ||||
| ACF_EMAIL_DISPLAY_AS="Visa som" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Välj om e-postadressen ska visas som vanlig text eller om den ska konverteras till en mailto-länk." | ||||
| ACF_EMAIL_TEXT="Text" | ||||
| ACF_EMAIL_LINK="Mailto Länk" | ||||
| @ -0,0 +1,17 @@ | ||||
| ; @package      Advanced Custom Fields | ||||
| ; @version      2.8.8 Pro | ||||
| ; | ||||
| ; @author		Tassos Marinos - http://www.tassos.gr/joomla-extensions | ||||
| ; @copyright	Copyright (c) 2019 Tassos Marinos. All rights reserved. | ||||
| ; @license		http://www.tassos.gr | ||||
|  | ||||
| PLG_FIELDS_ACFEMAIL_LABEL="ACF - Email" | ||||
| ACF_EMAIL="Fields - ACF Email" | ||||
| ACF_EMAIL_DESC="Safely display email addresses in the front-end that are unreadbable to spambots." | ||||
| ACF_EMAIL_VALUE_DESC="Set an email address." | ||||
| ACF_EMAIL_CLOAK_SUPPORT="Cloak Email Address" | ||||
| ACF_EMAIL_CLOAK_SUPPORT_DESC="If enabled, the email address will be protected with an Anti-Spam Email Cloaking script making it unreadable to spambots." | ||||
| ACF_EMAIL_DISPLAY_AS="Display As" | ||||
| ACF_EMAIL_DISPLAY_AS_DESC="Select whether to display the email address as plain text or convert it to a mailto link." | ||||
| ACF_EMAIL_TEXT="Text" | ||||
| ACF_EMAIL_LINK="Mailto Link" | ||||
							
								
								
									
										20
									
								
								plugins/fields/acfemail/params/acfemail.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								plugins/fields/acfemail/params/acfemail.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <form> | ||||
| 	<fields name="fieldparams"> | ||||
| 		<fieldset name="fieldparams"> | ||||
| 			<field name="display_as" type="radio" | ||||
| 				label="ACF_EMAIL_DISPLAY_AS" | ||||
| 				description="ACF_EMAIL_DISPLAY_AS_DESC" | ||||
| 				class="btn-group btn-group-yesno" | ||||
| 				default="link"> | ||||
| 		        <option value="text">ACF_EMAIL_TEXT</option> | ||||
| 				<option value="link">ACF_EMAIL_LINK</option> | ||||
| 			</field> | ||||
| 			<field name="cloak_support" type="nrtoggle" | ||||
| 				label="ACF_EMAIL_CLOAK_SUPPORT" | ||||
| 				description="ACF_EMAIL_CLOAK_SUPPORT_DESC" | ||||
| 				checked="true" | ||||
| 			/> | ||||
| 		</fieldset> | ||||
| 	</fields> | ||||
| </form> | ||||
							
								
								
									
										691
									
								
								plugins/fields/acfemail/script.install.helper.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										691
									
								
								plugins/fields/acfemail/script.install.helper.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,691 @@ | ||||
| <?php | ||||
| /** | ||||
|  * Installer Script Helper | ||||
|  * | ||||
|  * @author          Tassos Marinos <info@tassos.gr> | ||||
|  * @link            http://www.tassos.gr | ||||
|  * @copyright       Copyright © 2016 Tassos Marinos All Rights Reserved | ||||
|  * @license         http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL | ||||
|  */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| use Joomla\CMS\Installer\Installer; | ||||
| use Joomla\CMS\Factory; | ||||
| use Joomla\CMS\Language\Text; | ||||
| use Joomla\Filesystem\File; | ||||
| use Joomla\Filesystem\Folder; | ||||
|  | ||||
| class PlgFieldsAcfemailInstallerScriptHelper | ||||
| { | ||||
| 	public $name = ''; | ||||
| 	public $alias = ''; | ||||
| 	public $extname = ''; | ||||
| 	public $extension_type = ''; | ||||
| 	public $plugin_folder = 'system'; | ||||
| 	public $module_position = 'status'; | ||||
| 	public $client_id = 1; | ||||
| 	public $install_type = 'install'; | ||||
| 	public $show_message = true; | ||||
| 	public $autopublish = true; | ||||
| 	public $db = null; | ||||
| 	public $app = null; | ||||
| 	public $installedVersion; | ||||
|  | ||||
| 	public function __construct(&$params) | ||||
| 	{ | ||||
| 		$this->extname = $this->extname ?: $this->alias; | ||||
| 		$this->db = Factory::getDbo(); | ||||
| 		$this->app = Factory::getApplication(); | ||||
| 		$this->installedVersion = $this->getVersion($this->getInstalledXMLFile()); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Preflight event | ||||
| 	 * | ||||
| 	 *  @param   string             | ||||
| 	 *  @param   JAdapterInstance | ||||
| 	 * | ||||
| 	 *  @return  boolean                       | ||||
| 	 */ | ||||
| 	public function preflight($route, $adapter) | ||||
| 	{ | ||||
| 		if (!in_array($route, array('install', 'update'))) | ||||
| 		{ | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		Factory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller'); | ||||
|  | ||||
| 		if ($this->show_message && $this->isInstalled()) | ||||
| 		{ | ||||
| 			$this->install_type = 'update'; | ||||
| 		} | ||||
|  | ||||
| 		if ($this->onBeforeInstall() === false) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Preflight event | ||||
| 	 * | ||||
| 	 *  @param   string             | ||||
| 	 *  @param   JAdapterInstance | ||||
| 	 * | ||||
| 	 *  @return  boolean                       | ||||
| 	 */ | ||||
| 	public function postflight($route, $adapter) | ||||
| 	{ | ||||
| 		Factory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder()); | ||||
|  | ||||
| 		if (!in_array($route, array('install', 'update'))) | ||||
| 		{ | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		if ($this->onAfterInstall() === false) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
|  | ||||
| 		if ($route == 'install' && $this->autopublish) | ||||
| 		{ | ||||
| 			$this->publishExtension(); | ||||
| 		} | ||||
|  | ||||
| 		if ($this->show_message) | ||||
| 		{ | ||||
| 			$this->addInstalledMessage(); | ||||
| 		} | ||||
|  | ||||
| 		Factory::getCache()->clean('com_plugins'); | ||||
| 		Factory::getCache()->clean('_system'); | ||||
| 	} | ||||
|  | ||||
| 	public function isInstalled() | ||||
| 	{ | ||||
| 		if (!is_file($this->getInstalledXMLFile())) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
|  | ||||
| 		$query = $this->db->getQuery(true) | ||||
| 			->select('extension_id') | ||||
| 			->from('#__extensions') | ||||
| 			->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type)) | ||||
| 			->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName())); | ||||
| 		$this->db->setQuery($query, 0, 1); | ||||
| 		$result = $this->db->loadResult(); | ||||
|  | ||||
| 		return empty($result) ? false : true; | ||||
| 	} | ||||
|  | ||||
| 	public function getMainFolder() | ||||
| 	{ | ||||
| 		switch ($this->extension_type) | ||||
| 		{ | ||||
| 			case 'plugin' : | ||||
| 				return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname; | ||||
|  | ||||
| 			case 'component' : | ||||
| 				return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname; | ||||
|  | ||||
| 			case 'module' : | ||||
| 				return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname; | ||||
|  | ||||
| 			case 'library' : | ||||
| 				return JPATH_SITE . '/libraries/' . $this->extname; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function getInstalledXMLFile() | ||||
| 	{ | ||||
| 		return $this->getXMLFile($this->getMainFolder()); | ||||
| 	} | ||||
|  | ||||
| 	public function getCurrentXMLFile() | ||||
| 	{ | ||||
| 		return $this->getXMLFile(__DIR__); | ||||
| 	} | ||||
|  | ||||
| 	public function getXMLFile($folder) | ||||
| 	{ | ||||
| 		switch ($this->extension_type) | ||||
| 		{ | ||||
| 			case 'module' : | ||||
| 				return $folder . '/mod_' . $this->extname . '.xml'; | ||||
| 			default : | ||||
| 				return $folder . '/' . $this->extname . '.xml'; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function foldersExist($folders = array()) | ||||
| 	{ | ||||
| 		foreach ($folders as $folder) | ||||
| 		{ | ||||
| 			if (is_dir($folder)) | ||||
| 			{ | ||||
| 				return true; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	public function publishExtension() | ||||
| 	{ | ||||
| 		switch ($this->extension_type) | ||||
| 		{ | ||||
| 			case 'plugin' : | ||||
| 				$this->publishPlugin(); | ||||
|  | ||||
| 			case 'module' : | ||||
| 				$this->publishModule(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function publishPlugin() | ||||
| 	{ | ||||
| 		$query = $this->db->getQuery(true) | ||||
| 			->update('#__extensions') | ||||
| 			->set($this->db->quoteName('enabled') . ' = 1') | ||||
| 			->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin')) | ||||
| 			->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname)) | ||||
| 			->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder)); | ||||
| 		$this->db->setQuery($query); | ||||
| 		$this->db->execute(); | ||||
| 	} | ||||
|  | ||||
| 	public function publishModule() | ||||
| 	{ | ||||
| 		// Get module id | ||||
| 		$query = $this->db->getQuery(true) | ||||
| 			->select('id') | ||||
| 			->from('#__modules') | ||||
| 			->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname)) | ||||
| 			->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id); | ||||
| 		$this->db->setQuery($query, 0, 1); | ||||
| 		$id = $this->db->loadResult(); | ||||
|  | ||||
| 		if (!$id) | ||||
| 		{ | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		// check if module is already in the modules_menu table (meaning is is already saved) | ||||
| 		$query->clear() | ||||
| 			->select('moduleid') | ||||
| 			->from('#__modules_menu') | ||||
| 			->where($this->db->quoteName('moduleid') . ' = ' . (int) $id); | ||||
| 		$this->db->setQuery($query, 0, 1); | ||||
| 		$exists = $this->db->loadResult(); | ||||
|  | ||||
| 		if ($exists) | ||||
| 		{ | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		// Get highest ordering number in position | ||||
| 		$query->clear() | ||||
| 			->select('ordering') | ||||
| 			->from('#__modules') | ||||
| 			->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position)) | ||||
| 			->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id) | ||||
| 			->order('ordering DESC'); | ||||
| 		$this->db->setQuery($query, 0, 1); | ||||
| 		$ordering = $this->db->loadResult(); | ||||
| 		$ordering++; | ||||
|  | ||||
| 		// publish module and set ordering number | ||||
| 		$query->clear() | ||||
| 			->update('#__modules') | ||||
| 			->set($this->db->quoteName('published') . ' = 1') | ||||
| 			->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering) | ||||
| 			->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position)) | ||||
| 			->where($this->db->quoteName('id') . ' = ' . (int) $id); | ||||
| 		$this->db->setQuery($query); | ||||
| 		$this->db->execute(); | ||||
|  | ||||
| 		// add module to the modules_menu table | ||||
| 		$query->clear() | ||||
| 			->insert('#__modules_menu') | ||||
| 			->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid'))) | ||||
| 			->values((int) $id . ', 0'); | ||||
| 		$this->db->setQuery($query); | ||||
| 		$this->db->execute(); | ||||
| 	} | ||||
|  | ||||
| 	public function addInstalledMessage() | ||||
| 	{ | ||||
| 		Factory::getApplication()->enqueueMessage( | ||||
| 			Text::sprintf( | ||||
| 				Text::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'), | ||||
| 				'<strong>' . Text::_($this->name) . '</strong>', | ||||
| 				'<strong>' . $this->getVersion() . '</strong>', | ||||
| 				$this->getFullType() | ||||
| 			) | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
| 	public function getPrefix() | ||||
| 	{ | ||||
| 		switch ($this->extension_type) | ||||
| 		{ | ||||
| 			case 'plugin'; | ||||
| 				return Text::_('plg_' . strtolower($this->plugin_folder)); | ||||
|  | ||||
| 			case 'component': | ||||
| 				return Text::_('com'); | ||||
|  | ||||
| 			case 'module': | ||||
| 				return Text::_('mod'); | ||||
|  | ||||
| 			case 'library': | ||||
| 				return Text::_('lib'); | ||||
|  | ||||
| 			default: | ||||
| 				return $this->extension_type; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function getElementName($type = null, $extname = null) | ||||
| 	{ | ||||
| 		$type = is_null($type) ? $this->extension_type : $type; | ||||
| 		$extname = is_null($extname) ? $this->extname : $extname; | ||||
|  | ||||
| 		switch ($type) | ||||
| 		{ | ||||
| 			case 'component' : | ||||
| 				return 'com_' . $extname; | ||||
|  | ||||
| 			case 'module' : | ||||
| 				return 'mod_' . $extname; | ||||
|  | ||||
| 			case 'plugin' : | ||||
| 			default: | ||||
| 				return $extname; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function getFullType() | ||||
| 	{ | ||||
| 		return Text::_('NRI_' . strtoupper($this->getPrefix())); | ||||
| 	} | ||||
|  | ||||
| 	public function isPro() | ||||
| 	{ | ||||
| 		$versionFile = __DIR__ . "/version.php"; | ||||
|  | ||||
| 		// If version file does not exist we assume a PRO version | ||||
| 		if (!is_file($versionFile)) | ||||
| 		{ | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		// Load version file | ||||
| 		require_once $versionFile; | ||||
| 		return (bool) $NR_PRO; | ||||
| 	} | ||||
|  | ||||
| 	public function getVersion($file = '') | ||||
| 	{ | ||||
| 		$file = $file ?: $this->getCurrentXMLFile(); | ||||
|  | ||||
| 		if (!is_file($file)) | ||||
| 		{ | ||||
| 			return ''; | ||||
| 		} | ||||
|  | ||||
| 		$xml = Installer::parseXMLInstallFile($file); | ||||
|  | ||||
| 		if (!$xml || !isset($xml['version'])) | ||||
| 		{ | ||||
| 			return ''; | ||||
| 		} | ||||
|  | ||||
| 		return $xml['version']; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Checks wether the extension can be installed or not | ||||
| 	 * | ||||
| 	 *  @return  boolean   | ||||
| 	 */ | ||||
| 	public function canInstall() | ||||
| 	{ | ||||
| 		// The extension is not installed yet. Accept Install. | ||||
| 		if (!$installed_version = $this->getVersion($this->getInstalledXMLFile())) | ||||
| 		{ | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		// Path to extension's version file | ||||
| 		$versionFile = $this->getMainFolder() . "/version.php"; | ||||
| 		$NR_PRO = true; | ||||
|  | ||||
| 		// If version file does not exist we assume we have a PRO version installed | ||||
| 		if (file_exists($versionFile)) | ||||
| 		{ | ||||
| 			require_once($versionFile); | ||||
| 		} | ||||
|  | ||||
| 		// The free version is installed. Accept install. | ||||
| 		if (!(bool)$NR_PRO) | ||||
| 		{ | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		// Current package is a PRO version. Accept install. | ||||
| 		if ($this->isPro()) | ||||
| 		{ | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		// User is trying to update from PRO version to FREE. Do not accept install. | ||||
| 		Factory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__); | ||||
|  | ||||
| 		Factory::getApplication()->enqueueMessage( | ||||
| 			Text::_('NRI_ERROR_PRO_TO_FREE'), 'error' | ||||
| 		); | ||||
|  | ||||
| 		Factory::getApplication()->enqueueMessage( | ||||
| 			html_entity_decode( | ||||
| 				Text::sprintf( | ||||
| 					'NRI_ERROR_UNINSTALL_FIRST', | ||||
| 					'<a href="http://www.tassos.gr/joomla-extensions/' . $this->getUrlAlias() . '" target="_blank">', | ||||
| 					'</a>', | ||||
| 					Text::_($this->name) | ||||
| 				) | ||||
| 			), 'error' | ||||
| 		);	 | ||||
|  | ||||
| 		return false;	 | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Returns the URL alias of the extension. | ||||
| 	 *  | ||||
| 	 * @return  string | ||||
| 	 */ | ||||
| 	private function getUrlAlias() | ||||
| 	{ | ||||
| 		$alias = $this->alias; | ||||
|  | ||||
| 		switch ($alias) | ||||
| 		{ | ||||
| 			case 'smilepack': | ||||
| 				$alias = 'smile-pack'; | ||||
| 				break; | ||||
| 			case 'convertforms': | ||||
| 				$alias = 'convert-forms'; | ||||
| 				break; | ||||
| 			case 'rstbox': | ||||
| 				$alias = 'engagebox'; | ||||
| 				break; | ||||
| 			case 'gsd': | ||||
| 				$alias = 'google-structured-data'; | ||||
| 				break; | ||||
| 		} | ||||
|  | ||||
| 		// ACF | ||||
| 		if ($this->plugin_folder === 'fields' && ($alias === 'acf' || $this->startsWith($alias, 'acf'))) | ||||
| 		{ | ||||
| 			$alias = 'advanced-custom-fields'; | ||||
| 		} | ||||
| 		 | ||||
| 		return $alias; | ||||
| 	} | ||||
|  | ||||
|     /** | ||||
|      * Checks whether string starts with substring. | ||||
|      *  | ||||
|      * @param   string  $string | ||||
|      * @param   string  $query | ||||
|      *  | ||||
|      * @return  bool | ||||
|      */ | ||||
|     public static function startsWith($string, $query) | ||||
|     { | ||||
|         return substr($string, 0, strlen($query)) === $query; | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 *  Checks if current version is newer than the installed one | ||||
| 	 *  Used for Novarain Framework | ||||
| 	 * | ||||
| 	 *  @return  boolean  [description] | ||||
| 	 */ | ||||
| 	public function isNewer() | ||||
| 	{ | ||||
| 		if (!$installed_version = $this->getVersion($this->getInstalledXMLFile())) | ||||
| 		{ | ||||
| 			return true; | ||||
| 		} | ||||
|  | ||||
| 		$package_version = $this->getVersion(); | ||||
|  | ||||
| 		return version_compare($installed_version, $package_version, '<='); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Helper method triggered before installation | ||||
| 	 * | ||||
| 	 *  @return  bool | ||||
| 	 */ | ||||
| 	public function onBeforeInstall() | ||||
| 	{ | ||||
| 		if (!$this->canInstall()) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Helper method triggered after installation | ||||
| 	 */ | ||||
| 	public function onAfterInstall() | ||||
| 	{ | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Delete files | ||||
| 	 * | ||||
| 	 *  @param   array   $folders | ||||
| 	 */ | ||||
| 	public function deleteFiles($files = array()) | ||||
| 	{ | ||||
| 	    foreach ($files as $key => $file) | ||||
|         { | ||||
| 			if (!is_file($file)) | ||||
| 			{ | ||||
| 				continue; | ||||
| 			} | ||||
| 			 | ||||
|             File::delete($file); | ||||
|         } | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Deletes folders | ||||
| 	 * | ||||
| 	 *  @param   array   $folders   | ||||
| 	 */ | ||||
| 	public function deleteFolders($folders = array()) | ||||
| 	{ | ||||
| 		foreach ($folders as $folder) | ||||
| 		{ | ||||
| 			if (!is_dir($folder)) | ||||
| 			{ | ||||
| 				continue; | ||||
| 			} | ||||
|  | ||||
| 			Folder::delete($folder); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function dropIndex($table, $index) | ||||
| 	{	 | ||||
| 		$db = $this->db; | ||||
|  | ||||
| 		// Check if index exists first | ||||
| 		$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index); | ||||
|         $db->setQuery($query); | ||||
|         $db->execute(); | ||||
|  | ||||
|         if (!$db->loadResult()) | ||||
|         { | ||||
|         	return; | ||||
|         } | ||||
|  | ||||
|         // Remove index | ||||
|         $query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index); | ||||
|         $db->setQuery($query); | ||||
|         $db->execute();  | ||||
| 	} | ||||
|  | ||||
|     public function dropUnwantedTables($tables) { | ||||
|  | ||||
|         if (!$tables) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         foreach ($tables as $table) { | ||||
|             $query = "DROP TABLE IF EXISTS #__".$this->db->escape($table); | ||||
|             $this->db->setQuery($query); | ||||
|             $this->db->execute(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| 	public function dropUnwantedColumns($table, $columns) { | ||||
|  | ||||
|         if (!$columns || !$table) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $db = $this->db; | ||||
|  | ||||
|         // Check if columns exists in database | ||||
|         function qt($n) { | ||||
|             return(Factory::getDBO()->quote($n)); | ||||
|         } | ||||
|          | ||||
|         $query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')'; | ||||
|         $db->setQuery($query); | ||||
|         $rows = $db->loadColumn(0); | ||||
|  | ||||
|         // Abort if we don't have any rows | ||||
|         if (!$rows) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         // Let's remove the columns | ||||
|         $q = ""; | ||||
|         foreach ($rows as $key => $column) { | ||||
|             $comma = (($key+1) < count($rows)) ? "," : ""; | ||||
|             $q .= "drop ".$this->db->escape($column).$comma; | ||||
|         } | ||||
|  | ||||
|         $query = "alter table #__".$table." $q"; | ||||
|  | ||||
|         $db->setQuery($query); | ||||
|         $db->execute(); | ||||
|     } | ||||
|  | ||||
|   	public function fetch($table, $columns = "*", $where = null, $singlerow = false) { | ||||
|         if (!$table) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $db = $this->db; | ||||
|         $query = $db->getQuery(true); | ||||
|  | ||||
|         $query | ||||
|             ->select($columns) | ||||
|             ->from("#__$table"); | ||||
|          | ||||
|         if (isset($where)) { | ||||
|             $query->where("$where"); | ||||
|         } | ||||
|          | ||||
|         $db->setQuery($query); | ||||
|   | ||||
|         return ($singlerow) ? $db->loadObject() : $db->loadObjectList(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      *  Load the Novarain Framework | ||||
|      * | ||||
|      *  @return  boolean | ||||
|      */ | ||||
| 	public function loadFramework() | ||||
| 	{ | ||||
| 		if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php')) | ||||
| 		{ | ||||
| 			include_once JPATH_PLUGINS . '/system/nrframework/autoload.php'; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 *  Re-orders plugin after passed array of plugins | ||||
| 	 * | ||||
| 	 *  @param   string  $plugin            Plugin element name | ||||
| 	 *  @param   array   $lowerPluginOrder  Array of plugin element names | ||||
| 	 * | ||||
| 	 *  @return  boolean | ||||
| 	 */ | ||||
| 	public function pluginOrderAfter($lowerPluginOrder) | ||||
|     { | ||||
|  | ||||
|         if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder)) | ||||
|         { | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         $db = $this->db; | ||||
|  | ||||
|         // Get plugins max order | ||||
|         $query = $db->getQuery(true); | ||||
|         $query | ||||
|             ->select($db->quoteName('b.ordering')) | ||||
|             ->from($db->quoteName('#__extensions', 'b')) | ||||
|             ->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")') | ||||
|             ->order('b.ordering desc'); | ||||
|  | ||||
|         $db->setQuery($query); | ||||
|         $maxOrder = $db->loadResult(); | ||||
|  | ||||
|         if (is_null($maxOrder)) | ||||
|         { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         // Get plugin details | ||||
|         $query | ||||
|             ->clear() | ||||
|             ->select(array($db->quoteName('extension_id'), $db->quoteName('ordering'))) | ||||
|             ->from($db->quoteName('#__extensions')) | ||||
|             ->where($db->quoteName('element') . ' = ' . $db->quote($this->alias)); | ||||
|  | ||||
|         $db->setQuery($query); | ||||
|         $pluginInfo = $db->loadObject(); | ||||
|  | ||||
|         if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder) | ||||
|         { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         // Update the new plugin order | ||||
|         $object = new stdClass(); | ||||
|         $object->extension_id = $pluginInfo->extension_id; | ||||
|         $object->ordering = ($maxOrder + 1); | ||||
|  | ||||
| 		try { | ||||
| 			$db->updateObject('#__extensions', $object, 'extension_id'); | ||||
| 		} catch (Exception $e) { | ||||
| 			return $e->getMessage(); | ||||
| 		} | ||||
|     } | ||||
| } | ||||
							
								
								
									
										23
									
								
								plugins/fields/acfemail/script.install.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								plugins/fields/acfemail/script.install.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * @package         Advanced Custom Fields | ||||
|  * @version         2.8.8 Pro | ||||
|  *  | ||||
|  * @author          Tassos Marinos <info@tassos.gr> | ||||
|  * @link            http://www.tassos.gr | ||||
|  * @copyright       Copyright © 2019 Tassos Marinos All Rights Reserved | ||||
|  * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later | ||||
| */ | ||||
|  | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| require_once __DIR__ . '/script.install.helper.php'; | ||||
|  | ||||
| class PlgFieldsACFEmailInstallerScript extends PlgFieldsACFEmailInstallerScriptHelper | ||||
| { | ||||
| 	public $alias = 'acfemail'; | ||||
| 	public $extension_type = 'plugin'; | ||||
| 	public $plugin_folder = 'fields'; | ||||
| 	public $show_message = false; | ||||
| } | ||||
							
								
								
									
										49
									
								
								plugins/fields/acfemail/tmpl/acfemail.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								plugins/fields/acfemail/tmpl/acfemail.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * @package         Advanced Custom Fields | ||||
|  * @version         2.8.8 Pro | ||||
|  *  | ||||
|  * @author          Tassos Marinos <info@tassos.gr> | ||||
|  * @link            http://www.tassos.gr | ||||
|  * @copyright       Copyright © 2019 Tassos Marinos All Rights Reserved | ||||
|  * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later | ||||
| */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| use Joomla\CMS\HTML\HTMLHelper; | ||||
|  | ||||
| if (!$email = $field->value) | ||||
| { | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| // Check if valid email is given | ||||
| if (!filter_var($email, FILTER_VALIDATE_EMAIL)) | ||||
| { | ||||
|     return; | ||||
| } | ||||
|  | ||||
| // Get field params | ||||
| $cloak_support = $fieldParams->get('cloak_support', true); | ||||
| $display_as    = $fieldParams->get('display_as', 'link'); | ||||
|  | ||||
| // We have selected cloak support | ||||
| if ($cloak_support) { | ||||
| 	if ($display_as == 'text') { | ||||
| 		// Cloak it but display it as text | ||||
| 		$buffer = HTMLHelper::_('email.cloak', $email, 0); | ||||
| 	} else { | ||||
| 		// Cloak it but display it as a link | ||||
| 		$buffer = HTMLHelper::_('email.cloak', $email); | ||||
| 	} | ||||
| } else { | ||||
| 	if ($display_as == 'text') { | ||||
| 		$buffer = $email; | ||||
| 	} else { | ||||
| 		$buffer = '<a href="mailto:' . $email . '">' . $email . '</a>'; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| echo $buffer; | ||||
							
								
								
									
										16
									
								
								plugins/fields/acfemail/version.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								plugins/fields/acfemail/version.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * @package         Advanced Custom Fields | ||||
|  * @version         2.8.8 Pro | ||||
|  * | ||||
|  * @author          Tassos Marinos <info@tassos.gr> | ||||
|  * @link            http://www.tassos.gr | ||||
|  * @copyright       Copyright © 2019 Tassos Marinos All Rights Reserved | ||||
|  * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later | ||||
|  */ | ||||
|  | ||||
| defined('_JEXEC') or die('Restricted Access'); | ||||
| $NR_PRO = "1"; | ||||
|  | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user