acf
This commit is contained in:
64
plugins/fields/acfaddress/acfaddress.php
Normal file
64
plugins/fields/acfaddress/acfaddress.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?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\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 PlgFieldsACFAddress extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Update the label of the field in filters.
|
||||
*
|
||||
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
|
||||
*
|
||||
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
|
||||
*/
|
||||
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
|
||||
{
|
||||
// Make sure it is a field of that type
|
||||
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
$data = $option->getData();
|
||||
$data = is_string($data->value) && json_decode($data->value, true) ? json_decode($data->value, true) : false;
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$address = isset($data['address']['address']) ? $data['address']['address'] : '';
|
||||
|
||||
if (!$address)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($address);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
25
plugins/fields/acfaddress/acfaddress.xml
Normal file
25
plugins/fields/acfaddress/acfaddress.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_ADDRESS</name>
|
||||
<description>ACF_ADDRESS_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>December 2022</creationDate>
|
||||
<copyright>Copyright (C) 2022 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="acfaddress">acfaddress.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>language</folder>
|
||||
<folder>params</folder>
|
||||
<folder>tmpl</folder>
|
||||
<folder>fields</folder>
|
||||
</files>
|
||||
<media folder="media" destination="plg_fields_acfaddress">
|
||||
<folder>img</folder>
|
||||
</media>
|
||||
</extension>
|
||||
63
plugins/fields/acfaddress/fields/acfaddress.php
Normal file
63
plugins/fields/acfaddress/fields/acfaddress.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2018 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Form\Field\TextField;
|
||||
|
||||
class JFormFieldACFAddress extends TextField
|
||||
{
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*/
|
||||
public function getInput()
|
||||
{
|
||||
// Setup properties
|
||||
$zoom = $this->element['zoom'] ? (int) $this->element['zoom'] : 4;
|
||||
$marker_image = !empty($this->element['marker_image']) ? (string) $this->element['marker_image'] : null;
|
||||
$value = is_string($this->value) ? (json_decode($this->value) ? json_decode($this->value, true) : null) : json_decode(json_encode($this->value), true);
|
||||
$address = isset($value['address']) ? $value['address'] : [];
|
||||
$show_map = (string) $this->element['show_map'];
|
||||
$autocomplete = (string) $this->element['autocomplete'];
|
||||
$coordinates = '';
|
||||
|
||||
if (isset($address['latitude']) && !empty($address['latitude']) && isset($address['longitude']) && !empty($address['longitude']))
|
||||
{
|
||||
$coordinates = $address['latitude'] . ',' . $address['longitude'];
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'width' => 600,
|
||||
'height' => 400,
|
||||
'required' => $this->required,
|
||||
'name' => $this->name,
|
||||
'id' => $this->id,
|
||||
'zoom' => $zoom,
|
||||
'markerImage' => $marker_image,
|
||||
'show_map' => $show_map === '0' ? false : $show_map,
|
||||
'autocomplete' => $autocomplete === '1',
|
||||
'value' => $coordinates,
|
||||
'address' => $address
|
||||
];
|
||||
|
||||
$showAddressDetails = isset($this->element['address_details_info']) ? (string) $this->element['address_details_info'] : false;
|
||||
if ($showAddressDetails)
|
||||
{
|
||||
// Make it an array
|
||||
$showAddressDetails = array_map('trim', explode(',', $showAddressDetails));
|
||||
// Set all values of each array key to true
|
||||
$showAddressDetails = array_fill_keys($showAddressDetails, true);
|
||||
$payload['_showAddressDetails'] = $showAddressDetails;
|
||||
}
|
||||
|
||||
return \NRFramework\Widgets\Helper::render('MapAddressEditor', $payload);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
; @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_ACFADDRESS_LABEL="ACF - Adressen Autovervollständigung"
|
||||
ACF_ADDRESS="Fields - ACF Adressen Autovervollständigung"
|
||||
ACF_ADDRESS_DESC="Zeigt eine Karte mit den Standortdetails wie Adresse, Stadt, Bundesland, Land usw. an."
|
||||
ACF_ADDRESS_VALUE_DESC="Wählen Sie einen Ort auf der Karte, geben Sie eine Adresse oder Koordinaten in das Suchfeld ein."
|
||||
ACF_ADDRESS_ZOOM="Zoom"
|
||||
ACF_ADDRESS_ZOOM_DESC="Zoom-Stufe einstellen"
|
||||
ACF_ADDRESS_WIDTH="Breite"
|
||||
ACF_ADDRESS_WIDTH_DESC=""
|
||||
ACF_ADDRESS_HEIGHT="Höhe"
|
||||
ACF_ADDRESS_HEIGHT_DESC=""
|
||||
ACF_ADDRESS_ADDRESS="Adresse"
|
||||
ACF_ADDRESS_ADDRESS_DESC="Eine Adresse oder Koordinaten für die Suche eingeben"
|
||||
ACF_ADDRESS_SHOW_MAP="Zeige Karte"
|
||||
ACF_ADDRESS_SHOW_MAP_DESC="Festlegen, ob und wo die Karte angezeigt werden soll.<br><br><strong>Backend</strong>: Zeigt Sie die Karte nur an, wenn das Feld in einem Artikel, Kontakt usw. bearbeiten wurde...<br><strong>Frontend</strong>: Zeigt die Karte nur an, wenn das Feld im Frontend Ihrer Website anzeigt wird, z. B. in einem Artikel, Kontakt usw....<br><strong>Beide</strong>: Zeigt die Karte sowohl bei der Bearbeitung des benutzerdefinierten Feldes in einem Artikel, Kontakt usw. als auch bei der Anzeige des Feldes im Frontend Ihrer Website an, z. B. beim Anzeigen eines Artikels."
|
||||
ACF_ADDRESS_MARKER_IMAGE="Marker Bild"
|
||||
ACF_ADDRESS_MARKER_IMAGE_DESC="Ersetzt Sie den Standard-Marker durch ein Bild Ihrer Wahl."
|
||||
ACF_ADDRESS_DETAILS_LAYOUT="Layout"
|
||||
ACF_ADDRESS_DETAILS_LAYOUT_DESC="Wählen Sie das zu verwendende Layout, Standard oder benutzerdefiniert.<br><br><strong>Standard:</strong> Die Karte und darunter alle ausgewählten Adressdetails anzeigen.<br><strong>Benutzerdefiniert:</strong> Verwenden Sie Smart Tags, um ein benutzerdefiniertes Layout anzuzeigen. Unterstützt auch HTML-Code."
|
||||
ACF_ADDRESS_MAP_LOCATION="Standort"
|
||||
ACF_ADDRESS_MAP_LOCATION_DESC="Legt fest, ob die Karte über oder unter den Adressdetails angezeigt werden soll."
|
||||
ACF_ADDRESS_ABOVE="über der Adresse"
|
||||
ACF_ADDRESS_BELOW="unter der Adresse"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM="Benutzerdefiniertes Layout"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM_DESC="Legen Sie das benutzerdefinierte Layout für die Adressdetails fest. Unterstützt auch HTML-Code. <br><br>Erlaubte Smart Tags:<br>{address.map}<br>{address.address} - {address.address.label}<br>{address.latitude} - {address.latitude.label}<br>{address.longitude} - {address.longitude.label}<br>{address.country} - {address.country.label}<br>{address.country_code} - {address.country_code.label}<br>{address.city} - {address.city.label}<br>{address.county} - {address.county.label}<br>{address.postal_code} - {address.postal_code.label}<br>{address.state} - {address.state.label}<br>{address.municipality} - {address.municipality.label}<br>{address.town} - {address.town.label}<br>{address.road} - {address.road.label}"
|
||||
ACF_ADDRESS_DETAILS_INFO="Adressdetails"
|
||||
ACF_ADDRESS_DETAILS_INFO_DESC="Legen Sie fest, welche Adressdetails angezeigt werden sollen."
|
||||
ACF_ADDRESS_AUTOCOMPLETE="Adress-Autovervollständigung"
|
||||
ACF_ADDRESS_AUTOCOMPLETE_DESC="Legen Sie fest, ob die automatische Vervollständigung von Adressen aktiviert werden soll und ob bei der Eingabe einer Adresse automatisch Orte vorgeschlagen werden sollen."
|
||||
@ -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_ADDRESS="Felder – Automatische Vervollständigung der ACF-Adresse"
|
||||
ACF_ADDRESS_DESC="Zeigen Sie eine Karte an mit Standortdetails wie Adresse, Stadt, Bundesland, Land, etc.."
|
||||
@ -0,0 +1,35 @@
|
||||
; @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_ACFADDRESS_LABEL="ACF - Address Autocomplete"
|
||||
; ACF_ADDRESS="Fields - ACF Address Autocomplete"
|
||||
; ACF_ADDRESS_DESC="Display a map with the location details such as address, city, state, country, etc..."
|
||||
; ACF_ADDRESS_VALUE_DESC="Pick a location from the map, enter an address or coordinates in the search field."
|
||||
; ACF_ADDRESS_ZOOM="Zoom"
|
||||
; ACF_ADDRESS_ZOOM_DESC="Set the map zoom."
|
||||
ACF_ADDRESS_WIDTH="Μήκος"
|
||||
ACF_ADDRESS_WIDTH_DESC=""
|
||||
ACF_ADDRESS_HEIGHT="Ύψος"
|
||||
ACF_ADDRESS_HEIGHT_DESC=""
|
||||
ACF_ADDRESS_ADDRESS="Διέθυνση"
|
||||
; ACF_ADDRESS_ADDRESS_DESC="Enter an address or coordinates to search"
|
||||
ACF_ADDRESS_SHOW_MAP="Εμφάνιση Χάρτη"
|
||||
; ACF_ADDRESS_SHOW_MAP_DESC="Set whether and where to show the map.<br><br><strong>Back-end</strong>: Show the map only when editing the field in an article, contact, etc...<br><strong>Front-end</strong>: Show the map only when viewing the field on the front-end of your site such as in an article, contact, etc...<br><strong>Both</strong>: Show the map both when editing the custom field in an article, contact, etc... as well as when viewing the field on the front-end of your site such as when viewing an article."
|
||||
; ACF_ADDRESS_MARKER_IMAGE="Marker Image"
|
||||
; ACF_ADDRESS_MARKER_IMAGE_DESC="Replace the default marker image by uploading an image of your choice."
|
||||
; ACF_ADDRESS_DETAILS_LAYOUT="Layout"
|
||||
; ACF_ADDRESS_DETAILS_LAYOUT_DESC="Select which layout to use, default or custom.<br><br><strong>Default:</strong> Show a map and below all selected address details.<br><strong>Custom:</strong> Use Smart Tags to display a custom layout. Also supports HTML code."
|
||||
; ACF_ADDRESS_MAP_LOCATION="Map Location"
|
||||
; ACF_ADDRESS_MAP_LOCATION_DESC="Set whether to display the map above or below the address details."
|
||||
; ACF_ADDRESS_ABOVE="Above Address"
|
||||
; ACF_ADDRESS_BELOW="Below Address"
|
||||
; ACF_ADDRESS_DETAILS_CUSTOM="Custom Layout"
|
||||
; ACF_ADDRESS_DETAILS_CUSTOM_DESC="Set the Custom Layout for the address details. Also supports HTML code.<br><br>Allowed Smart Tags:<br>{address.map}<br>{address.address} - {address.address.label}<br>{address.latitude} - {address.latitude.label}<br>{address.longitude} - {address.longitude.label}<br>{address.country} - {address.country.label}<br>{address.country_code} - {address.country_code.label}<br>{address.city} - {address.city.label}<br>{address.county} - {address.county.label}<br>{address.postal_code} - {address.postal_code.label}<br>{address.state} - {address.state.label}<br>{address.municipality} - {address.municipality.label}<br>{address.town} - {address.town.label}<br>{address.road} - {address.road.label}"
|
||||
; ACF_ADDRESS_DETAILS_INFO="Address Details"
|
||||
; ACF_ADDRESS_DETAILS_INFO_DESC="Set which address details to show."
|
||||
; ACF_ADDRESS_AUTOCOMPLETE="Address Autocomplete"
|
||||
; ACF_ADDRESS_AUTOCOMPLETE_DESC="Set whether to enable address autocomplete and automatically suggest places as you type an address."
|
||||
@ -0,0 +1,35 @@
|
||||
; @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_ACFADDRESS_LABEL="ACF - Address Autocomplete"
|
||||
ACF_ADDRESS="Fields - ACF Address Autocomplete"
|
||||
ACF_ADDRESS_DESC="Display a map with the location details such as address, city, state, country, etc..."
|
||||
ACF_ADDRESS_VALUE_DESC="Pick a location from the map, enter an address or coordinates in the search field."
|
||||
ACF_ADDRESS_ZOOM="Zoom"
|
||||
ACF_ADDRESS_ZOOM_DESC="Set the map zoom."
|
||||
ACF_ADDRESS_WIDTH="Width"
|
||||
ACF_ADDRESS_WIDTH_DESC=""
|
||||
ACF_ADDRESS_HEIGHT="Height"
|
||||
ACF_ADDRESS_HEIGHT_DESC=""
|
||||
ACF_ADDRESS_ADDRESS="Address"
|
||||
ACF_ADDRESS_ADDRESS_DESC="Enter an address or coordinates to search"
|
||||
ACF_ADDRESS_SHOW_MAP="Show Map"
|
||||
ACF_ADDRESS_SHOW_MAP_DESC="Set whether and where to show the map.<br /><br /><strong>Back-end</strong>: Show the map only when editing the field in an article, contact, etc...<br /><strong>Front-end</strong>: Show the map only when viewing the field on the front-end of your site such as in an article, contact, etc...<br /><strong>Both</strong>: Show the map both when editing the custom field in an article, contact, etc... as well as when viewing the field on the front-end of your site such as when viewing an article."
|
||||
ACF_ADDRESS_MARKER_IMAGE="Marker Image"
|
||||
ACF_ADDRESS_MARKER_IMAGE_DESC="Replace the default marker image by uploading an image of your choice."
|
||||
ACF_ADDRESS_DETAILS_LAYOUT="Layout"
|
||||
ACF_ADDRESS_DETAILS_LAYOUT_DESC="Select which layout to use, default or custom.<br /><br /><strong>Default:</strong> Show a map and below all selected address details.<br /><strong>Custom:</strong> Use Smart Tags to display a custom layout. Also supports HTML code."
|
||||
ACF_ADDRESS_MAP_LOCATION="Map Location"
|
||||
ACF_ADDRESS_MAP_LOCATION_DESC="Set whether to display the map above or below the address details."
|
||||
ACF_ADDRESS_ABOVE="Above Address"
|
||||
ACF_ADDRESS_BELOW="Below Address"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM="Custom Layout"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM_DESC="Set the Custom Layout for the address details. Also supports HTML code.<br /><br />Allowed Smart Tags:<br />{address.map}<br />{address.address} - {address.address.label}<br />{address.latitude} - {address.latitude.label}<br />{address.longitude} - {address.longitude.label}<br />{address.country} - {address.country.label}<br />{address.country_code} - {address.country_code.label}<br />{address.city} - {address.city.label}<br />{address.county} - {address.county.label}<br />{address.postal_code} - {address.postal_code.label}<br />{address.state} - {address.state.label}<br />{address.municipality} - {address.municipality.label}<br />{address.town} - {address.town.label}<br />{address.road} - {address.road.label}"
|
||||
ACF_ADDRESS_DETAILS_INFO="Address Details"
|
||||
ACF_ADDRESS_DETAILS_INFO_DESC="Set which address details to show."
|
||||
ACF_ADDRESS_AUTOCOMPLETE="Enable Autocomplete"
|
||||
ACF_ADDRESS_AUTOCOMPLETE_DESC="Set whether to enable address autocomplete and automatically suggest places as you type an address."
|
||||
@ -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_ADDRESS="Fields - ACF Address Autocomplete"
|
||||
ACF_ADDRESS_DESC="Display a map with the location details such as address, city, state, country, etc..."
|
||||
@ -0,0 +1,35 @@
|
||||
; @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_ACFADDRESS_LABEL="ACF - Dirección Autocompletar"
|
||||
ACF_ADDRESS="Campos - ACF Dirección Autocompletar"
|
||||
ACF_ADDRESS_DESC="Muestra un mapa con los detalles de la ubicación, como dirección, ciudad, estado, país, etc."
|
||||
ACF_ADDRESS_VALUE_DESC="Elija una ubicación del mapa, ingrese una dirección o coordenadas en el campo de búsqueda."
|
||||
ACF_ADDRESS_ZOOM="Zoom"
|
||||
ACF_ADDRESS_ZOOM_DESC="Establezca el zoom del mapa."
|
||||
ACF_ADDRESS_WIDTH="Ancho"
|
||||
ACF_ADDRESS_WIDTH_DESC=""
|
||||
ACF_ADDRESS_HEIGHT="Altura"
|
||||
ACF_ADDRESS_HEIGHT_DESC=""
|
||||
ACF_ADDRESS_ADDRESS="Dirección"
|
||||
ACF_ADDRESS_ADDRESS_DESC="Introduzca una dirección o coordenadas para buscar"
|
||||
ACF_ADDRESS_SHOW_MAP="Mostrar Mapa"
|
||||
ACF_ADDRESS_SHOW_MAP_DESC="Establezca si mostrar el mapa y dónde.<br><br><strong>Back-end</strong>:Mostrar el mapa solo al editar el campo en un artículo, contacto, etc...<br><strong>Front-end</strong>:Muestre el mapa solo cuando vea el campo en el front-end de su sitio, como en un artículo, contacto, etc.<br><strong>Both</strong>: Muestre el mapa tanto cuando edite el campo personalizado en un artículo, contacto, etc... como cuando vea el campo en el front-end de su sitio, como cuando vea un artículo."
|
||||
ACF_ADDRESS_MARKER_IMAGE="Imagen de Marcador"
|
||||
ACF_ADDRESS_MARKER_IMAGE_DESC="Reemplace la imagen del marcador predeterminado cargando una imagen de su elección."
|
||||
ACF_ADDRESS_DETAILS_LAYOUT="Disposición"
|
||||
ACF_ADDRESS_DETAILS_LAYOUT_DESC="Seleccione qué diseño usar, predeterminado o personalizado.<br><br><strong>Defecto:</strong> Muestra un mapa y debajo todos los detalles de la dirección seleccionada.<br><strong>Personalizado:</strong> Use etiquetas inteligentes para mostrar un diseño personalizado. También admite código HTML."
|
||||
ACF_ADDRESS_MAP_LOCATION="Ubicación del Mapa"
|
||||
ACF_ADDRESS_MAP_LOCATION_DESC="Establezca si mostrar el mapa encima o debajo de los detalles de la dirección."
|
||||
ACF_ADDRESS_ABOVE="Sobre Dirección"
|
||||
ACF_ADDRESS_BELOW="Bajo Dirección"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM="Diseño personalizado"
|
||||
ACF_ADDRESS_DETAILS_CUSTOM_DESC="Configure el diseño personalizado para los detalles de la dirección. También admite código HTML.<br><br>Etiquetas inteligentes permitidas:<br>{address.map}<br>{address.address} - {address.address.label}<br>{address.latitude} - {address.latitude.label}<br>{address.longitude} - {address.longitude.label}<br>{address.country} - {address.country.label}<br>{address.country_code} - {address.country_code.label}<br>{address.city} - {address.city.label}<br>{address.county} - {address.county.label}<br>{address.postal_code} - {address.postal_code.label}<br>{address.state} - {address.state.label}<br>{address.municipality} - {address.municipality.label}<br>{address.town} - {address.town.label}<br>{address.road} - {address.road.label}"
|
||||
ACF_ADDRESS_DETAILS_INFO="Detalles de Dirección"
|
||||
ACF_ADDRESS_DETAILS_INFO_DESC="Establezca qué detalles de la dirección mostrar."
|
||||
ACF_ADDRESS_AUTOCOMPLETE="Autocompletar Dirección"
|
||||
ACF_ADDRESS_AUTOCOMPLETE_DESC="Establezca si desea habilitar el autocompletado de direcciones y sugerir lugares automáticamente a medida que escribe una dirección."
|
||||
@ -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_ADDRESS="Campos - ACF Dirección Autocompletar"
|
||||
ACF_ADDRESS_DESC="Muestra un mapa con los detalles de la ubicación, como dirección, ciudad, estado, país, etc."
|
||||
101
plugins/fields/acfaddress/params/acfaddress.xml
Normal file
101
plugins/fields/acfaddress/params/acfaddress.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field name="address_details_info" type="checkboxes"
|
||||
label="ACF_ADDRESS_DETAILS_INFO"
|
||||
description="ACF_ADDRESS_DETAILS_INFO_DESC"
|
||||
class="nrf-checkboxes-field-columns"
|
||||
default="address,country,city,postal_code"
|
||||
>
|
||||
<option value="address">NR_ADDRESS</option>
|
||||
<option value="country">NR_COUNTRY</option>
|
||||
<option value="city">NR_CITY</option>
|
||||
<option value="postal_code">NR_POSTAL_CODE</option>
|
||||
<option value="latitude">NR_LATITUDE</option>
|
||||
<option value="longitude">NR_LONGITUDE</option>
|
||||
<option value="country_code">NR_COUNTRY_CODE</option>
|
||||
<option value="county">NR_COUNTY</option>
|
||||
<option value="state">NR_STATE</option>
|
||||
<option value="municipality">NR_MUNICIPALITY</option>
|
||||
<option value="town">NR_TOWN</option>
|
||||
<option value="road">NR_ROAD</option>
|
||||
</field>
|
||||
<field name="autocomplete" type="radio"
|
||||
label="ACF_ADDRESS_AUTOCOMPLETE"
|
||||
description="ACF_ADDRESS_AUTOCOMPLETE_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field name="layout_type" type="radio"
|
||||
label="ACF_ADDRESS_DETAILS_LAYOUT"
|
||||
description="ACF_ADDRESS_DETAILS_LAYOUT_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="default">
|
||||
<option value="default">JDEFAULT</option>
|
||||
<option value="custom">NR_CUSTOM</option>
|
||||
</field>
|
||||
<field name="map_location" type="radio"
|
||||
label="ACF_ADDRESS_MAP_LOCATION"
|
||||
description="ACF_ADDRESS_MAP_LOCATION_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
showon="show_map!:0[AND]layout_type:default"
|
||||
default="below">
|
||||
<option value="above">ACF_ADDRESS_ABOVE</option>
|
||||
<option value="below">ACF_ADDRESS_BELOW</option>
|
||||
</field>
|
||||
<field name="custom_layout" type="editor"
|
||||
label="ACF_ADDRESS_DETAILS_CUSTOM"
|
||||
description="ACF_ADDRESS_DETAILS_CUSTOM_DESC"
|
||||
showon="layout_type:custom"
|
||||
editor="codemirror"
|
||||
filter="raw"
|
||||
default="{address.address.label}: {address.address}"
|
||||
/>
|
||||
<field type="spacer" name="label"
|
||||
label="NR_MAP"
|
||||
class="acf"
|
||||
/>
|
||||
<field name="show_map" type="radio"
|
||||
label="ACF_ADDRESS_SHOW_MAP"
|
||||
description="ACF_ADDRESS_SHOW_MAP_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="backend">NR_BACKEND</option>
|
||||
<option value="frontend">NR_FRONTEND</option>
|
||||
<option value="both">NR_BOTH</option>
|
||||
</field>
|
||||
<field name="width" type="text"
|
||||
label="ACF_ADDRESS_WIDTH"
|
||||
description="ACF_ADDRESS_WIDTH_DESC"
|
||||
default="400px"
|
||||
showon="show_map!:0"
|
||||
/>
|
||||
<field name="height" type="text"
|
||||
label="ACF_ADDRESS_HEIGHT"
|
||||
description="ACF_ADDRESS_HEIGHT_DESC"
|
||||
default="350px"
|
||||
showon="show_map!:0"
|
||||
/>
|
||||
<field name="zoom" type="nrnumber"
|
||||
label="ACF_ADDRESS_ZOOM"
|
||||
description="ACF_ADDRESS_ZOOM_DESC"
|
||||
default="4"
|
||||
min="0"
|
||||
showon="show_map!:0"
|
||||
/>
|
||||
<field name="marker_image" type="media"
|
||||
directory="acfosm"
|
||||
default="media/plg_fields_acfaddress/img/marker.png"
|
||||
preview_width="32"
|
||||
label="ACF_ADDRESS_MARKER_IMAGE"
|
||||
description="ACF_ADDRESS_MARKER_IMAGE_DESC"
|
||||
showon="show_map!:0"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
|
||||
691
plugins/fields/acfaddress/script.install.helper.php
Normal file
691
plugins/fields/acfaddress/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 PlgFieldsAcfaddressInstallerScriptHelper
|
||||
{
|
||||
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/acfaddress/script.install.php
Normal file
23
plugins/fields/acfaddress/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 PlgFieldsACFAddressInstallerScript extends PlgFieldsACFAddressInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfaddress';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
}
|
||||
33
plugins/fields/acfaddress/tmpl/acfaddress.php
Normal file
33
plugins/fields/acfaddress/tmpl/acfaddress.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
|
||||
$value = $field->value;
|
||||
|
||||
if (is_string($value) && !$value = json_decode($value, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = $value + $fieldParams->flatten();
|
||||
$payload['value'] = !empty($payload['address']['latitude']) && !empty($payload['address']['longitude']) ? $payload['address']['latitude'] . ',' . $payload['address']['longitude'] : null;
|
||||
$payload['show_map'] = $payload['show_map'] === '0' ? false : $payload['show_map'];
|
||||
$payload['showAddressDetails'] = $fieldParams->get('address_details_info', []);
|
||||
|
||||
// Set custom layout
|
||||
if ($field->params->get('acf_layout_override'))
|
||||
{
|
||||
$payload['layout'] = $field->params->get('acf_layout_override');
|
||||
}
|
||||
|
||||
echo \NRFramework\Widgets\Helper::render('MapAddress', $payload);
|
||||
16
plugins/fields/acfaddress/version.php
Normal file
16
plugins/fields/acfaddress/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";
|
||||
|
||||
?>
|
||||
461
plugins/fields/acfarticles/acfarticles.php
Normal file
461
plugins/fields/acfarticles/acfarticles.php
Normal file
@ -0,0 +1,461 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use NRFramework\Conditions\Conditions\Component\ContentBase;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Factory;
|
||||
use NRFramework\Cache;
|
||||
|
||||
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 PlgFieldsACFArticles extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Update the label of the field in filters.
|
||||
*
|
||||
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
|
||||
*
|
||||
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
|
||||
*/
|
||||
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
|
||||
{
|
||||
// Make sure it is a field of that type
|
||||
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
$contentAssignment = new ContentBase();
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (!$article = $contentAssignment->getItem($option->getLabel()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($article->title);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
||||
public function onContentBeforeSave($context, $item, $isNew, $data = [])
|
||||
{
|
||||
if (!is_array($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isset($data['com_fields']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Create correct context for category
|
||||
if ($context == 'com_categories.category')
|
||||
{
|
||||
$context = $item->get('extension') . '.categories';
|
||||
}
|
||||
|
||||
// Load Fields Component Helper class
|
||||
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
|
||||
|
||||
// Check the context
|
||||
$parts = FieldsHelper::extract($context, $item);
|
||||
|
||||
if (!$parts)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Compile the right context for the fields
|
||||
$context = $parts[0] . '.' . $parts[1];
|
||||
|
||||
// Loading the fields
|
||||
$fields = FieldsHelper::getFields($context, $item);
|
||||
|
||||
if (!$fields)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the fields data
|
||||
$fieldsData = !empty($data['com_fields']) ? $data['com_fields'] : [];
|
||||
|
||||
// Whether we should clean up the temp folder at the end of this process
|
||||
$should_clean = false;
|
||||
|
||||
// Get the Fields Model
|
||||
if (!defined('nrJ4'))
|
||||
{
|
||||
$model = JModelLegacy::getInstance('Field', 'FieldsModel', ['ignore_request' => true]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$model = Factory::getApplication()->bootComponent('com_fields')->getMVCFactory()->createModel('Field', 'Administrator', ['ignore_request' => true]);
|
||||
}
|
||||
|
||||
// Cache subform fields
|
||||
$subform_fields = [];
|
||||
|
||||
$error = false;
|
||||
|
||||
// Loop over the fields
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field_type = $field->type;
|
||||
|
||||
/**
|
||||
* Check whether a Gallery field is used within the Subform field.
|
||||
*/
|
||||
if ($field_type === 'subform')
|
||||
{
|
||||
// Ensure it has a value
|
||||
if (!$subform_value = json_decode($field->value, true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($subform_value as $key => $value)
|
||||
{
|
||||
if (!is_array($value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($value as $_key => $_value)
|
||||
{
|
||||
// Get Field ID
|
||||
$field_id = str_replace('field', '', $_key);
|
||||
|
||||
// Get Field by ID
|
||||
$subform_field = isset($subform_fields[$field_id]) ? $subform_fields[$field_id] : $model->getItem($field_id);
|
||||
|
||||
// Only proceed for this field type
|
||||
if ($subform_field->type !== $this->_name)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Cache field
|
||||
if (!isset($subform_fields[$field_id]))
|
||||
{
|
||||
$subform_fields[$field_id] = $subform_field;
|
||||
}
|
||||
|
||||
$check_value = isset($fieldsData[$field->name][$key][$_key]) ? $fieldsData[$field->name][$key][$_key] : false;
|
||||
|
||||
if (!$check_value)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$fieldParams = new Registry($subform_field->fieldparams);
|
||||
|
||||
$check_value = is_array($check_value) ? $check_value : [$check_value];
|
||||
|
||||
if ($min_articles = (int) $fieldParams->get('min_articles', 0))
|
||||
{
|
||||
if (count($check_value) < $min_articles)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(sprintf(Text::_('ACF_ARTICLES_MIN_ITEMS_REQUIRED'), $subform_field->title, $min_articles), 'error');
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($max_articles = (int) $fieldParams->get('max_articles', 0))
|
||||
{
|
||||
if (count($check_value) > $max_articles)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(sprintf(Text::_('ACF_ARTICLES_MAX_ITEMS_REQUIRED'), $subform_field->title, $max_articles), 'error');
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only proceed for this field type
|
||||
if ($field_type !== $this->_name)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine the value if it is available from the data
|
||||
$value = array_key_exists($field->name, $fieldsData) ? $fieldsData[$field->name] : null;
|
||||
|
||||
if (!$value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = is_array($value) ? $value : [$value];
|
||||
|
||||
if ($min_articles = (int) $field->fieldparams->get('min_articles', 0))
|
||||
{
|
||||
if (count($value) < $min_articles)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(sprintf(Text::_('ACF_ARTICLES_MIN_ITEMS_REQUIRED'), $field->title, $min_articles), 'error');
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($max_articles = (int) $field->fieldparams->get('max_articles', 0))
|
||||
{
|
||||
if (count($value) > $max_articles)
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage(sprintf(Text::_('ACF_ARTICLES_MAX_ITEMS_REQUIRED'), $field->title, $max_articles), 'error');
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !$error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
|
||||
*
|
||||
* @param stdClass $field The field.
|
||||
* @param DOMElement $parent The field node parent.
|
||||
* @param Form $form The form.
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onCustomFieldsPrepareDom($field, DOMElement $parent, Joomla\CMS\Form\Form $form)
|
||||
{
|
||||
if (!$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form))
|
||||
{
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
$field_type = $field->fieldparams->get('articles_type', 'default');
|
||||
|
||||
$fieldNode->setAttribute('multiple', true);
|
||||
|
||||
|
||||
$max_articles = (int) $field->fieldparams->get('max_articles', 0);
|
||||
if ($max_articles === 1)
|
||||
{
|
||||
$fieldNode->setAttribute('multiple', false);
|
||||
}
|
||||
|
||||
// Linked
|
||||
if ($field_type === 'linked')
|
||||
{
|
||||
$fieldNode->setAttribute('multiple', false);
|
||||
$fieldNode->setAttribute('type', 'NRToggle');
|
||||
// Default state
|
||||
$fieldNode->setAttribute('default', 'false');
|
||||
|
||||
// Checked if Default Value = 1/true
|
||||
if (isset($field->value) && in_array($field->value, ['1', 'true']))
|
||||
{
|
||||
$fieldNode->setAttribute('checked', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the field value for the (front-end) layout
|
||||
*
|
||||
* @param string $context The context.
|
||||
* @param stdclass $item The item.
|
||||
* @param stdclass $field The field.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onCustomFieldsPrepareField($context, $item, $field)
|
||||
{
|
||||
// Check if the field should be processed by us
|
||||
if (!$this->isTypeSupported($field->type))
|
||||
{
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
$value = array_filter((array) $field->value);
|
||||
|
||||
|
||||
$type = $field->fieldparams->get('articles_type', 'default');
|
||||
|
||||
// Linked articles
|
||||
if ($type === 'linked')
|
||||
{
|
||||
// Abort if no ACF Articles fields are selected
|
||||
if (!$acf_articles = array_filter($field->fieldparams->get('articles_fields', [])))
|
||||
{
|
||||
$field->value = [];
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
// Proceed only if Field Value = 1/true
|
||||
if (!in_array($field->value, ['1', 'true']))
|
||||
{
|
||||
$field->value = [];
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
$cache_key = 'ACFArticles_' . $item->id . '_' . md5(implode(',', $acf_articles));
|
||||
|
||||
if (Cache::has($cache_key))
|
||||
{
|
||||
$field->value = Cache::get($cache_key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Grab all linked articles
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('a.*')
|
||||
->from($db->quoteName('#__fields_values', 'fv'))
|
||||
->join('LEFT', $db->quoteName('#__content', 'a') . ' ON a.id = fv.item_id')
|
||||
->where($db->quoteName('fv.field_id') . ' IN (' . implode(',', $acf_articles) . ')')
|
||||
->where($db->quoteName('fv.value') . ' = ' . $db->q($item->id));
|
||||
|
||||
$this->prepareArticles($context, $query, $field, $value, true);
|
||||
|
||||
Cache::set($cache_key, $field->value);
|
||||
}
|
||||
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
|
||||
if (!$value)
|
||||
{
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
$cache_key = 'ACFArticles_Auto_' . $item->id . '_' . md5(implode(',', $value));
|
||||
|
||||
if (Cache::has($cache_key))
|
||||
{
|
||||
$field->value = Cache::get($cache_key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default articles
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('a.*')
|
||||
->from($db->quoteName('#__content', 'a'))
|
||||
->where($db->quoteName('a.id') . ' IN (' . implode(',', array_map('intval', $value)) . ')');
|
||||
|
||||
$this->prepareArticles($context, $query, $field, $value);
|
||||
|
||||
Cache::set($cache_key, $field->value);
|
||||
}
|
||||
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the articles.
|
||||
*
|
||||
* @param string $context
|
||||
* @param object $query
|
||||
* @param object $field
|
||||
* @param array $articles
|
||||
* @param bool $all_filters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function prepareArticles($context, $query, &$field, $articles, $all_filters = true)
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
|
||||
// Filter results
|
||||
require_once 'fields/acfarticlesfilters.php';
|
||||
$payload = $all_filters ? $field->fieldparams : ['order' => $field->fieldparams->get('order')];
|
||||
$filters = new ACFArticlesFilters($query, $payload);
|
||||
$query = $filters->apply();
|
||||
|
||||
// Set query
|
||||
$db->setQuery($query);
|
||||
|
||||
// Get articles
|
||||
if (!$articles = $db->loadAssocList())
|
||||
{
|
||||
$field->value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get and set the articles values
|
||||
foreach ($articles as &$article)
|
||||
{
|
||||
$article['custom_fields'] = $this->fetchCustomFields($article);
|
||||
}
|
||||
|
||||
|
||||
$field->value = $articles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an article's custom fields.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function fetchCustomFields($article = null)
|
||||
{
|
||||
if (!$article)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$callback = function() use ($article)
|
||||
{
|
||||
\JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
|
||||
|
||||
if (!$fields = \FieldsHelper::getFields('com_content.article', $article, false))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$fieldsAssoc = [];
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$fieldsAssoc[$field->name] = $field->value;
|
||||
}
|
||||
|
||||
return $fieldsAssoc;
|
||||
};
|
||||
|
||||
return Cache::memo('ACFArticlesFetchCustomFields' . $article['id'], $callback);
|
||||
}
|
||||
|
||||
}
|
||||
26
plugins/fields/acfarticles/acfarticles.xml
Normal file
26
plugins/fields/acfarticles/acfarticles.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_ARTICLES</name>
|
||||
<description>ACF_ARTICLES_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>Februray 2023</creationDate>
|
||||
<copyright>Copyright (C) 2023 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="acfarticles">acfarticles.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>fields</folder>
|
||||
<folder>language</folder>
|
||||
<folder>params</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<media folder="media" destination="plg_fields_acfarticles">
|
||||
<folder>css</folder>
|
||||
<folder>img</folder>
|
||||
</media>
|
||||
</extension>
|
||||
125
plugins/fields/acfarticles/fields/acfarticles.php
Normal file
125
plugins/fields/acfarticles/fields/acfarticles.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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 JPATH_PLUGINS . '/system/nrframework/helpers/fieldlist.php';
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class JFormFieldACFArticles extends NRFormFieldList
|
||||
{
|
||||
public function getInput()
|
||||
{
|
||||
$this->hint = $this->getFieldHint();
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
|
||||
private function getFieldHint()
|
||||
{
|
||||
$hint = (string) $this->element['hint'];
|
||||
return !empty($hint) ? $hint : Text::_('ACF_ARTICLES_SELECT_ARTICLES');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
require_once 'acfarticlesfilters.php';
|
||||
|
||||
// The layout param in the field XML overrides $this->layout and thus we need to set it again.
|
||||
$this->layout = 'joomla.form.field.list-fancy-select';
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('a.*, c.lft as category_lft, c.title as category_title')
|
||||
->from($this->db->quoteName('#__content', 'a'))
|
||||
->join('LEFT', $this->db->quoteName('#__categories', 'c') . ' ON c.id = a.catid');
|
||||
|
||||
// Get current item id and exclude it from the list
|
||||
if ($current_item_id = Factory::getApplication()->input->getInt('id'))
|
||||
{
|
||||
$query->where($this->db->quoteName('a.id') . ' != ' . (int) $current_item_id);
|
||||
}
|
||||
|
||||
$field_attributes = (array) $this->element->attributes();
|
||||
|
||||
$payload = new Registry($field_attributes['@attributes']);
|
||||
|
||||
// Apply filters
|
||||
$filters = new ACFArticlesFilters($query, $payload);
|
||||
$query = $filters->apply();
|
||||
|
||||
$this->db->setQuery($query);
|
||||
|
||||
// Get all articles
|
||||
if (!$items = $this->db->loadObjectList())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all dropdown choices
|
||||
$options = [];
|
||||
|
||||
// Add hint to single value field
|
||||
if ($payload->get('max_articles') == '1')
|
||||
{
|
||||
$options[] = HTMLHelper::_('select.option', '', $this->getFieldHint());
|
||||
}
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$options[] = HTMLHelper::_('select.option', $item->id, $item->title);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all categories child ids.
|
||||
*
|
||||
* @param array $categories
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getCategoriesChildIds($categories = [])
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('a.id')
|
||||
->from($this->db->quoteName('#__categories', 'a'))
|
||||
->where('a.extension = ' . $this->db->quote('com_content'))
|
||||
->where('a.published = 1');
|
||||
|
||||
$children = [];
|
||||
|
||||
while (!empty($categories))
|
||||
{
|
||||
$query
|
||||
->clear('where')
|
||||
->where($this->db->quoteName('a.parent_id') . ' IN (' . implode(',', $categories) . ')');
|
||||
|
||||
$this->db->setQuery($query);
|
||||
|
||||
$categories = $this->db->loadColumn();
|
||||
|
||||
$children = array_merge($children, $categories);
|
||||
}
|
||||
|
||||
return $children;
|
||||
}
|
||||
}
|
||||
70
plugins/fields/acfarticles/fields/acfarticlesfields.php
Normal file
70
plugins/fields/acfarticles/fields/acfarticlesfields.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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 JPATH_PLUGINS . '/system/nrframework/helpers/fieldlist.php';
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class JFormFieldACFArticlesFields extends NRFormFieldList
|
||||
{
|
||||
public function getInput()
|
||||
{
|
||||
$this->hint = Text::_('ACF_ARTICLES_SELECT_ACF_ARTICLES');
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// The layout param in the field XML overrides $this->layout and thus we need to set it again.
|
||||
$this->layout = 'joomla.form.field.list-fancy-select';
|
||||
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('id, label')
|
||||
->from($this->db->quoteName('#__fields'))
|
||||
->where('type = ' . $this->db->quote('acfarticles'))
|
||||
->where('state = 1');
|
||||
|
||||
// Get current item id and exclude it from the list
|
||||
if ($current_item_id = Factory::getApplication()->input->getInt('id'))
|
||||
{
|
||||
$query->where($this->db->quoteName('id') . ' != ' . (int) $current_item_id);
|
||||
}
|
||||
|
||||
$this->db->setQuery($query);
|
||||
|
||||
// Get all fields
|
||||
if (!$items = $this->db->loadObjectList())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all dropdown choices
|
||||
$options = [];
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$options[] = HTMLHelper::_('select.option', $item->id, $item->label);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
223
plugins/fields/acfarticles/fields/acfarticlesfilters.php
Normal file
223
plugins/fields/acfarticles/fields/acfarticlesfilters.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?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');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class ACFArticlesFilters
|
||||
{
|
||||
private $db;
|
||||
|
||||
private $query;
|
||||
|
||||
private $filters;
|
||||
|
||||
public function __construct($query, $filters)
|
||||
{
|
||||
$this->db = Factory::getDbo();
|
||||
$this->query = $query;
|
||||
$this->filters = $filters;
|
||||
}
|
||||
|
||||
public function apply()
|
||||
{
|
||||
$this->applyCategories();
|
||||
|
||||
$this->applyTags();
|
||||
$this->applyAuthor();
|
||||
|
||||
$this->applyStatus();
|
||||
$this->applyOrdering();
|
||||
|
||||
$this->applyLimit();
|
||||
|
||||
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
public function applyCategories()
|
||||
{
|
||||
if (!isset($this->filters['filters_category_enabled']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->filters['filters_category_value']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$categories = $this->filters['filters_category_value'];
|
||||
|
||||
$inc_children = isset($this->filters['filters_category_inc_children']) ? (string) $this->filters['filters_category_inc_children'] : false;
|
||||
|
||||
if (in_array($inc_children, ['1', '2']))
|
||||
{
|
||||
$categories = is_string($categories) ? array_map('trim', explode(',', $categories)) : $categories;
|
||||
|
||||
$children_categories = $this->getCategoriesChildIds($categories);
|
||||
|
||||
// Also include children categories
|
||||
if ($inc_children === '1')
|
||||
{
|
||||
$categories = array_unique(array_filter(array_merge($categories, $children_categories)));
|
||||
}
|
||||
// Use only children categories
|
||||
else
|
||||
{
|
||||
$categories = $children_categories;
|
||||
}
|
||||
|
||||
$categories = implode(',', $categories);
|
||||
}
|
||||
|
||||
$this->query->where($this->db->quoteName('a.catid') . ' IN (' . (is_string($categories) ? $categories : implode(',', $categories)) . ')');
|
||||
}
|
||||
|
||||
|
||||
public function applyTags()
|
||||
{
|
||||
if (!isset($this->filters['filters_tag_enabled']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->filters['filters_tag_value']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($filtersTagEnabled = (string) $this->filters['filters_tag_enabled'] === '1' && $tags = $this->filters['filters_tag_value'])
|
||||
{
|
||||
$this->query
|
||||
->join('INNER', $this->db->quoteName('#__contentitem_tag_map', 't') . ' ON t.content_item_id = a.id')
|
||||
->where($this->db->quoteName('t.tag_id') . ' IN (' . (is_string($tags) ? $tags : implode(',', $tags)) . ')')
|
||||
->group($this->db->quoteName('a.id'));
|
||||
}
|
||||
}
|
||||
|
||||
public function applyAuthor()
|
||||
{
|
||||
if (!isset($this->filters['filters_author_enabled']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->filters['filters_author_value']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($filtersAuthorEnabled = (string) $this->filters['filters_author_enabled'] === '1' && $authors = $this->filters['filters_author_value'])
|
||||
{
|
||||
$this->query->where($this->db->quoteName('a.created_by') . ' IN (' . (is_string($authors) ? $authors : implode(',', $authors)) . ')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function applyStatus()
|
||||
{
|
||||
// Default status is to show published articles
|
||||
$status = [1];
|
||||
|
||||
|
||||
if (isset($this->filters['filters_status_value']) && is_array($this->filters['filters_status_value']) && count($this->filters['filters_status_value']))
|
||||
{
|
||||
$status = $this->filters['filters_status_value'];
|
||||
}
|
||||
|
||||
|
||||
// Set articles status
|
||||
$this->query->where($this->db->quoteName('a.state') . ' IN (' . (is_string($status) ? $status : implode(',', $status)) . ')');
|
||||
|
||||
}
|
||||
|
||||
private function applyOrdering()
|
||||
{
|
||||
// Apply ordering
|
||||
if (!$this->filters['order'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$order = is_string($this->filters['order']) ? explode(',', $this->filters['order']) : $this->filters['order'];
|
||||
|
||||
$order = array_filter(array_map('trim', $order));
|
||||
$orders = [];
|
||||
|
||||
foreach ($order as $item)
|
||||
{
|
||||
$lastUnderscorePos = strrpos($item, '_');
|
||||
$part1 = substr($item, 0, $lastUnderscorePos);
|
||||
$part2 = substr($item, $lastUnderscorePos + 1);
|
||||
|
||||
if (!$part1 || !$part2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$orders[] = $part1 . ' ' . $part2;
|
||||
}
|
||||
|
||||
if ($orders)
|
||||
{
|
||||
$this->query->order($this->db->escape(implode(',', $orders)));
|
||||
}
|
||||
}
|
||||
|
||||
private function applyLimit()
|
||||
{
|
||||
// Apply limit
|
||||
$limit = isset($this->filters['limit']) ? (int) $this->filters['limit'] : false;
|
||||
if (!$limit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->query->setLimit($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all categories child ids.
|
||||
*
|
||||
* @param array $categories
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getCategoriesChildIds($categories = [])
|
||||
{
|
||||
$query = $this->db->getQuery(true)
|
||||
->select('a.id')
|
||||
->from($this->db->quoteName('#__categories', 'a'))
|
||||
->where('a.extension = ' . $this->db->quote('com_content'))
|
||||
->where('a.published = 1');
|
||||
|
||||
$children = [];
|
||||
|
||||
while (!empty($categories))
|
||||
{
|
||||
$query
|
||||
->clear('where')
|
||||
->where($this->db->quoteName('a.parent_id') . ' IN (' . implode(',', $categories) . ')');
|
||||
|
||||
$this->db->setQuery($query);
|
||||
|
||||
$categories = $this->db->loadColumn();
|
||||
|
||||
$children = array_merge($children, $categories);
|
||||
}
|
||||
|
||||
return $children;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2023 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFARTICLES_LABEL="ACF - Articles"
|
||||
ACF_ARTICLES="Fields - ACF Articles"
|
||||
ACF_ARTICLES_DESC="Select and connect articles to each other."
|
||||
ACF_ARTICLES_VALUE_DESC="Select articles to connect to this item."
|
||||
ACF_ARTICLES_MIN_ARTICLES="Minimum Articles"
|
||||
ACF_ARTICLES_MIN_ARTICLES_DESC="Sets a limit on the minimum articles that can be selected."
|
||||
ACF_ARTICLES_MAX_ARTICLES="Maximum Articles"
|
||||
ACF_ARTICLES_MAX_ARTICLES_DESC="Sets a limit on the maximum articles that can be selected."
|
||||
ACF_ARTICLES_FILTER_BY_CATEGORY="By Category"
|
||||
ACF_ARTICLES_FILTER_CATEGORY_DESC="Set whether to filter the articles by categories."
|
||||
ACF_ARTICLES_FILTER_CATEGORY_SELECTION_DESC="Select categories to filter the articles."
|
||||
ACF_ARTICLES_FILTER_BY_TAG="By Tag"
|
||||
ACF_ARTICLES_FILTER_TAG_DESC="Set whether to filter the articles by tags."
|
||||
ACF_ARTICLES_FILTER_TAG_SELECTION_DESC="Select tags to filter the articles."
|
||||
ACF_ARTICLES_FILTER_BY_AUTHOR="By Author"
|
||||
ACF_ARTICLES_FILTER_AUTHOR_DESC="Set whether to filter the articles by authors."
|
||||
ACF_ARTICLES_FILTER_AUTHOR_SELECTION_DESC="Select authors to filter the articles."
|
||||
ACF_ARTICLES_LAYOUT_DESC="Select the layout to display the articles."
|
||||
ACF_ARTICLES_LAYOUT_CUSTOM="Custom Layout"
|
||||
ACF_ARTICLES_LAYOUT_CUSTOM_DESC="Enter HTML code for each article item. Smart Tags are also supported.<br /><br />To access an article's data, use the Smart Tag {acf.article.KEY} where KEY is the article object key.<br/><br/>Helpful Smart Tags:</br>{acf.article.link}: The Article URL<br />{acf.article.introtext}: The Article intro text<br />{acf.article.images.image_intro}: The article intro image.<br />{acf.articles.index}: The article index.<br />{acf.articles.total}: The number of total articles to show.<br /><br />For a complete list of Smart Tags, please read the documentation page."
|
||||
ACF_ARTICLES_ORDER="Order"
|
||||
ACF_ARTICLES_ORDER_DESC="Select how to order the items."
|
||||
ACF_ARTICLES_ID_ASC="ID (Asc)"
|
||||
ACF_ARTICLES_ID_DESC="ID (Desc)"
|
||||
ACF_ARTICLES_ORDERING_ASC="Ordering (Asc)"
|
||||
ACF_ARTICLES_ORDERING_DESC="Ordering (Desc)"
|
||||
ACF_ARTICLES_TITLE_ASC="Title (Asc)"
|
||||
ACF_ARTICLES_TITLE_DESC="Title (Desc)"
|
||||
ACF_ARTICLES_ALIAS_ASC="Alias (Asc)"
|
||||
ACF_ARTICLES_ALIAS_DESC="Alias (Desc)"
|
||||
ACF_ARTICLES_HITS_ASC="Hits (Asc)"
|
||||
ACF_ARTICLES_HITS_DESC="Hits (Desc)"
|
||||
ACF_ARTICLES_CREATED_ASC="Created Date (Asc)"
|
||||
ACF_ARTICLES_CREATED_DESC="Created Date (Desc)"
|
||||
ACF_ARTICLES_MODIFIED_ASC="Modified Date (Asc)"
|
||||
ACF_ARTICLES_MODIFIED_DESC="Modified Date (Desc)"
|
||||
ACF_ARTICLES_PUBLISH_UP_ASC="Published Date (Asc)"
|
||||
ACF_ARTICLES_PUBLISH_UP_DESC="Published Date (Desc)"
|
||||
ACF_ARTICLES_FEATURED_ASC="Featured (Asc)"
|
||||
ACF_ARTICLES_FEATURED_DESC="Featured (Desc)"
|
||||
ACF_ARTICLES_CATEGORY_LFT_ASC="Category Order (Asc)"
|
||||
ACF_ARTICLES_CATEGORY_LFT_DESC="Category Order (Desc)"
|
||||
ACF_ARTICLES_CATEGORY_TITLE_ASC="Category Title (Asc)"
|
||||
ACF_ARTICLES_CATEGORY_TITLE_DESC="Category Title (Desc)"
|
||||
ACF_ARTICLES_SELECT_ARTICLES="Select articles"
|
||||
ACF_ARTICLES_SELECT_ARTICLE="Select an article"
|
||||
ACF_ARTICLES_COLUMNS="Columns"
|
||||
ACF_ARTICLES_COLUMNS_DESC="Select the columns of the layout."
|
||||
ACF_ARTICLES_GAP="Gap"
|
||||
ACF_ARTICLES_GAP_DESC="Select the gap between the items."
|
||||
ACF_ARTICLES_INPUT_FILTERS="Input Filters"
|
||||
ACF_ARTICLES_INPUT_FILTERS_DESC="These filters are applied to the articles that are displayed on the back-end."
|
||||
ACF_ARTICLES_INPUT_OPTIONS="Input Options"
|
||||
ACF_ARTICLES_MIN_ITEMS_REQUIRED="%s: You must select a minimum of %s articles."
|
||||
ACF_ARTICLES_MAX_ITEMS_REQUIRED="%s: You must select a maximum of %s articles."
|
||||
ACF_ARTICLES_FILTER_BY_STATUS="By Status"
|
||||
ACF_ARTICLES_FILTER_STATUS_DESC="Set whether to filter the articles by their status."
|
||||
ACF_ARTICLES_FILTER_STATUS_SELECTION_DESC="Select statuses to filter the articles."
|
||||
ACF_ARTICLES_TYPE="Connection Options"
|
||||
ACF_ARTICLES_TYPE_DESC="Select how the articles will be displayed.<br><br><strong>Manual Selection</strong>: Choose specific articles manually.<br><br><strong>Automatically</strong>: Automatically identify related articles by checking if the current article is linked to other ACF Articles fields that use the Manual Selection option.<br><strong>Note</strong>: By default, you must enable this custom field on each article. To automatically make all articles display the linked articles, set Default Value to 1/true."
|
||||
ACF_ARTICLES_ARTICLES_FIELD="ACF - Articles fields"
|
||||
ACF_ARTICLES_ARTICLES_FIELD_DESC="In order to automatically find articles, you must select at least one ACF - Articles field, and the current article must be linked to the selected ACF - Articles fields."
|
||||
ACF_ARTICLES_ARTICLES_LINKED="Linked Articles"
|
||||
ACF_ARTICLES_ARTICLES_LINKED_DESC="Make ACF - Articles automatically retrive articles that link to this field."
|
||||
ACF_ARTICLES_MANUAL="Manual Selection"
|
||||
ACF_ARTICLES_AUTO="Automatic Discovery"
|
||||
ACF_ARTICLES_SELECT_ACF_ARTICLES="Select ACF - Articles fields"
|
||||
ACF_ARTICLES_OUTPUT_FILTERS="Output Filters"
|
||||
ACF_ARTICLES_OUTPUT_FILTERS_DESC="These filters are applied to the articles that are displayed on the front-end."
|
||||
ACF_ARTICLES_LIMIT_ARTICLES="Limit Articles"
|
||||
ACF_ARTICLES_LIMIT_ARTICLES_DESC="Define how many linked articles to display. Enter 0 for no limit."
|
||||
@ -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) 2023 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
ACF_ARTICLES="Fields - ACF Articles"
|
||||
ACF_ARTICLES_DESC="Select and connect articles to each other."
|
||||
@ -0,0 +1,78 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2023 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFARTICLES_LABEL="ACF - Artículos"
|
||||
ACF_ARTICLES="Campos - ACF Artículos"
|
||||
ACF_ARTICLES_DESC="Seleccionar y conectar artículos entre sí."
|
||||
ACF_ARTICLES_VALUE_DESC="Seleccione artículos para conectarse a este elemento."
|
||||
ACF_ARTICLES_MIN_ARTICLES="Artículos Mínimos"
|
||||
ACF_ARTICLES_MIN_ARTICLES_DESC="Establece un límite en los artículos mínimos que se pueden seleccionar."
|
||||
ACF_ARTICLES_MAX_ARTICLES="Artículos Máximos"
|
||||
ACF_ARTICLES_MAX_ARTICLES_DESC="Establece un límite en los artículos máximos que se pueden seleccionar."
|
||||
ACF_ARTICLES_FILTER_BY_CATEGORY="Por Categoría"
|
||||
ACF_ARTICLES_FILTER_CATEGORY_DESC="Establezca si desea filtrar los artículos por categorías."
|
||||
ACF_ARTICLES_FILTER_CATEGORY_SELECTION_DESC="Seleccione categorías para filtrar los artículos."
|
||||
ACF_ARTICLES_FILTER_BY_TAG="Por Etiqueta"
|
||||
ACF_ARTICLES_FILTER_TAG_DESC="Establezca si desea filtrar los artículos por etiquetas."
|
||||
ACF_ARTICLES_FILTER_TAG_SELECTION_DESC="Seleccione etiquetas para filtrar los artículos."
|
||||
ACF_ARTICLES_FILTER_BY_AUTHOR="Por Autor"
|
||||
ACF_ARTICLES_FILTER_AUTHOR_DESC="Establezca si desea filtrar los artículos por autor."
|
||||
ACF_ARTICLES_FILTER_AUTHOR_SELECTION_DESC="Seleccione autores para filtrar los artículos."
|
||||
ACF_ARTICLES_LAYOUT_DESC="Seleccione el diseño para mostrar los artículos."
|
||||
ACF_ARTICLES_LAYOUT_CUSTOM="Diseño Personalizado"
|
||||
ACF_ARTICLES_LAYOUT_CUSTOM_DESC="Ingrese el código HTML para cada elemento del artículo. También se admiten etiquetas inteligentes. <br><br>Para acceder a los datos de un artículo, utilice la etiqueta inteligente {acf.article.KEY} donde KEY es la clave del objeto del artículo. <br><br>Etiquetas inteligentes útiles: </br>{acf.article.link}: la URL del artículo <br>{acf.article .introtext}: el texto de introducción del artículo <br>{acf.article.images.image_intro}: la imagen de introducción del artículo. <br>{acf.articles.index}: el índice del artículo. <br>{acf.articles.total}: el número total de artículos que se mostrarán. <br><br>Para obtener una lista completa de etiquetas inteligentes, lea la página de documentación."
|
||||
ACF_ARTICLES_ORDER="Orden"
|
||||
ACF_ARTICLES_ORDER_DESC="Seleccione cómo ordenar los artículos."
|
||||
ACF_ARTICLES_ID_ASC="ID (Asc)"
|
||||
ACF_ARTICLES_ID_DESC="ID (Desc)"
|
||||
ACF_ARTICLES_ORDERING_ASC="Ordenar (Asc)"
|
||||
ACF_ARTICLES_ORDERING_DESC="Ordenar (Desc)"
|
||||
ACF_ARTICLES_TITLE_ASC="Título (Asc)"
|
||||
ACF_ARTICLES_TITLE_DESC="Título (Desc)"
|
||||
ACF_ARTICLES_ALIAS_ASC="Alias (Asc)"
|
||||
ACF_ARTICLES_ALIAS_DESC="Alias (Desc)"
|
||||
ACF_ARTICLES_HITS_ASC="Golpes (Asc)"
|
||||
ACF_ARTICLES_HITS_DESC="Golpes (Desc)"
|
||||
ACF_ARTICLES_CREATED_ASC="Fecha de Creación (Asc)"
|
||||
ACF_ARTICLES_CREATED_DESC="Fecha de Creación (Desc)"
|
||||
ACF_ARTICLES_MODIFIED_ASC="Fecha de Modificación (Asc)"
|
||||
ACF_ARTICLES_MODIFIED_DESC="Fecha de Modificación (Desc)"
|
||||
ACF_ARTICLES_PUBLISH_UP_ASC="Fecha de Publicación (Asc)"
|
||||
ACF_ARTICLES_PUBLISH_UP_DESC="Fecha de Publicación (Desc)"
|
||||
ACF_ARTICLES_FEATURED_ASC="Características (Asc)"
|
||||
ACF_ARTICLES_FEATURED_DESC="Características (Desc)"
|
||||
ACF_ARTICLES_CATEGORY_LFT_ASC="Orden de Categoría (Asc)"
|
||||
ACF_ARTICLES_CATEGORY_LFT_DESC="Orden de Categoría (Desc)"
|
||||
ACF_ARTICLES_CATEGORY_TITLE_ASC="Título de Categoría (Asc)"
|
||||
ACF_ARTICLES_CATEGORY_TITLE_DESC="Título de Categoría (Desc)"
|
||||
ACF_ARTICLES_SELECT_ARTICLES="Seleccionar artículos"
|
||||
ACF_ARTICLES_SELECT_ARTICLE="Seleccionar un artículo"
|
||||
ACF_ARTICLES_COLUMNS="Columnas"
|
||||
ACF_ARTICLES_COLUMNS_DESC="Seleccione las columnas del diseño."
|
||||
ACF_ARTICLES_GAP="Espaciado"
|
||||
ACF_ARTICLES_GAP_DESC="Seleccione el espacio entre los elementos."
|
||||
ACF_ARTICLES_INPUT_FILTERS="Filtros de Entrada"
|
||||
ACF_ARTICLES_INPUT_FILTERS_DESC="Estos filtros se aplican a los artículos que se muestran en el back-end."
|
||||
ACF_ARTICLES_INPUT_OPTIONS="Opciones de Entrada"
|
||||
ACF_ARTICLES_MIN_ITEMS_REQUIRED="%s: Debe seleccionar un mínimo de %s artículos."
|
||||
ACF_ARTICLES_MAX_ITEMS_REQUIRED="%s: Debe seleccionar un máximo de %s artículos."
|
||||
ACF_ARTICLES_FILTER_BY_STATUS="Por Estado"
|
||||
ACF_ARTICLES_FILTER_STATUS_DESC="Establezca si desea filtrar los artículos por estados."
|
||||
ACF_ARTICLES_FILTER_STATUS_SELECTION_DESC="Seleccione estados para filtrar los artículos."
|
||||
ACF_ARTICLES_TYPE="Opciones de conexión"
|
||||
ACF_ARTICLES_TYPE_DESC="Seleccione cómo se mostrarán los artículos.<br><br><strong>Selección manual</strong>: Elija artículos específicos manualmente.<br><br><strong>Automáticamente</strong>: Identifique automáticamente los artículos relacionados comprobando si el artículo actual está vinculado a otros campos de artículos ACF que utilizan la opción de selección manual.<br><strong>Nota</strong>: De forma predeterminada, debe habilitar este campo personalizado en cada artículo. Para hacer que todos los artículos muestren automáticamente los artículos vinculados, establezca el Valor predeterminado en 1/true."
|
||||
ACF_ARTICLES_ARTICLES_FIELD="ACF - Campos de artículos"
|
||||
ACF_ARTICLES_ARTICLES_FIELD_DESC="Para encontrar automáticamente artículos, debes seleccionar al menos un ACF - Campo de Artículos, y el artículo actual debe estar vinculado a ACF - Campos de Artículos."
|
||||
ACF_ARTICLES_ARTICLES_LINKED="Artículos vinculados"
|
||||
ACF_ARTICLES_ARTICLES_LINKED_DESC="Hacer que AC - Artículos recupere automáticamente los artículos que estan vinculados con este campo."
|
||||
ACF_ARTICLES_MANUAL="Selección Manual"
|
||||
ACF_ARTICLES_AUTO="Descubrimiento automático"
|
||||
ACF_ARTICLES_SELECT_ACF_ARTICLES="Seleccionar ACF - Campos de artículos"
|
||||
ACF_ARTICLES_OUTPUT_FILTERS="Filtros de salida"
|
||||
ACF_ARTICLES_OUTPUT_FILTERS_DESC="Estos filtros se aplican a los artículos que se muestran en el front-end."
|
||||
ACF_ARTICLES_LIMIT_ARTICLES="Limitar Artículos"
|
||||
ACF_ARTICLES_LIMIT_ARTICLES_DESC="Define cuántos artículos vinculados mostrar. Introduce 0 para no tener límite."
|
||||
@ -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) 2023 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
ACF_ARTICLES="Campos - ACF Articulos"
|
||||
ACF_ARTICLES_DESC="Seleccionar y conectar artículos entre sí."
|
||||
213
plugins/fields/acfarticles/params/acfarticles.xml
Normal file
213
plugins/fields/acfarticles/params/acfarticles.xml
Normal file
@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams" addfieldpath="plugins/fields/acfarticles/fields">
|
||||
<fieldset name="fieldparams">
|
||||
|
||||
|
||||
<field name="articles_type" type="list"
|
||||
label="ACF_ARTICLES_TYPE"
|
||||
description="ACF_ARTICLES_TYPE_DESC"
|
||||
default="default">
|
||||
<option value="default">ACF_ARTICLES_MANUAL</option>
|
||||
<option value="linked">ACF_ARTICLES_AUTO</option>
|
||||
</field>
|
||||
|
||||
<field type="spacer" name="auto_discovery_label"
|
||||
label="ACF_ARTICLES_AUTO"
|
||||
class="acf"
|
||||
showon="articles_type:linked"
|
||||
/>
|
||||
<field name="articles_fields" type="ACFArticlesFields"
|
||||
label="ACF_ARTICLES_ARTICLES_FIELD"
|
||||
description="ACF_ARTICLES_ARTICLES_FIELD_DESC"
|
||||
multiple="true"
|
||||
showon="articles_type:linked"
|
||||
/>
|
||||
|
||||
<field type="number" name="limit"
|
||||
label="ACF_ARTICLES_LIMIT_ARTICLES"
|
||||
description="ACF_ARTICLES_LIMIT_ARTICLES_DESC"
|
||||
min="0"
|
||||
default="0"
|
||||
showon="articles_type:linked"
|
||||
/>
|
||||
|
||||
|
||||
<field name="order" type="list"
|
||||
label="ACF_ARTICLES_ORDER"
|
||||
description="ACF_ARTICLES_ORDER_DESC"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
default="id_desc">
|
||||
<option value="id_asc">ACF_ARTICLES_ID_ASC</option>
|
||||
<option value="id_desc">ACF_ARTICLES_ID_DESC</option>
|
||||
<option value="ordering_asc">ACF_ARTICLES_ORDERING_ASC</option>
|
||||
<option value="ordering_desc">ACF_ARTICLES_ORDERING_DESC</option>
|
||||
<option value="title_asc">ACF_ARTICLES_TITLE_ASC</option>
|
||||
<option value="title_desc">ACF_ARTICLES_TITLE_DESC</option>
|
||||
<option value="alias_asc">ACF_ARTICLES_ALIAS_ASC</option>
|
||||
<option value="alias_desc">ACF_ARTICLES_ALIAS_DESC</option>
|
||||
<option value="hits_asc">ACF_ARTICLES_HITS_ASC</option>
|
||||
<option value="hits_desc">ACF_ARTICLES_HITS_DESC</option>
|
||||
<option value="created_asc">ACF_ARTICLES_CREATED_ASC</option>
|
||||
<option value="created_desc">ACF_ARTICLES_CREATED_DESC</option>
|
||||
<option value="modified_asc">ACF_ARTICLES_MODIFIED_ASC</option>
|
||||
<option value="modified_desc">ACF_ARTICLES_MODIFIED_DESC</option>
|
||||
<option value="publish_up_asc">ACF_ARTICLES_PUBLISH_UP_ASC</option>
|
||||
<option value="publish_up_desc">ACF_ARTICLES_PUBLISH_UP_DESC</option>
|
||||
<option value="featured_asc">ACF_ARTICLES_FEATURED_ASC</option>
|
||||
<option value="featured_desc">ACF_ARTICLES_FEATURED_DESC</option>
|
||||
<option value="category_lft_asc">ACF_ARTICLES_CATEGORY_LFT_ASC</option>
|
||||
<option value="category_lft_desc">ACF_ARTICLES_CATEGORY_LFT_DESC</option>
|
||||
<option value="category_title_asc">ACF_ARTICLES_CATEGORY_TITLE_ASC</option>
|
||||
<option value="category_title_desc">ACF_ARTICLES_CATEGORY_TITLE_DESC</option>
|
||||
</field>
|
||||
<field type="spacer" name="input_options_label"
|
||||
label="ACF_ARTICLES_INPUT_OPTIONS"
|
||||
class="acf"
|
||||
showon="articles_type:default"
|
||||
/>
|
||||
|
||||
<field name="min_articles" type="number"
|
||||
label="ACF_ARTICLES_MIN_ARTICLES"
|
||||
description="ACF_ARTICLES_MIN_ARTICLES_DESC"
|
||||
min="0"
|
||||
default="0"
|
||||
showon="articles_type:default"
|
||||
/>
|
||||
<field name="max_articles" type="number"
|
||||
label="ACF_ARTICLES_MAX_ARTICLES"
|
||||
description="ACF_ARTICLES_MAX_ARTICLES_DESC"
|
||||
min="0"
|
||||
default="0"
|
||||
showon="articles_type:default"
|
||||
/>
|
||||
|
||||
|
||||
<field type="spacer" name="filters_label"
|
||||
label="ACF_ARTICLES_INPUT_FILTERS"
|
||||
description="ACF_ARTICLES_INPUT_FILTERS_DESC"
|
||||
class="acf"
|
||||
showon="articles_type:default"
|
||||
/>
|
||||
<field type="spacer" name="linked_filters_label"
|
||||
label="ACF_ARTICLES_OUTPUT_FILTERS"
|
||||
description="ACF_ARTICLES_OUTPUT_FILTERS_DESC"
|
||||
class="acf"
|
||||
showon="articles_type:linked"
|
||||
/>
|
||||
<field name="filters_category_enabled" type="nrtoggle"
|
||||
label="ACF_ARTICLES_FILTER_BY_CATEGORY"
|
||||
description="ACF_ARTICLES_FILTER_CATEGORY_DESC"
|
||||
/>
|
||||
<field name="filters_category_value" type="nr_content"
|
||||
label="NR_CATEGORIES"
|
||||
description="ACF_ARTICLES_FILTER_CATEGORY_SELECTION_DESC"
|
||||
group="categories"
|
||||
multiple="true"
|
||||
showon="fieldparams.filters_category_enabled:1"
|
||||
/>
|
||||
<field name="filters_category_inc_children" type="radio"
|
||||
default="0"
|
||||
label="NR_ALSO_ON_CHILD_ITEMS"
|
||||
description="NR_ALSO_ON_CHILD_ITEMS_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
showon="fieldparams.filters_category_enabled:1">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
<option value="2">NR_ONLY</option>
|
||||
</field>
|
||||
|
||||
<field name="filters_tag_enabled" type="nrtoggle"
|
||||
label="ACF_ARTICLES_FILTER_BY_TAG"
|
||||
description="ACF_ARTICLES_FILTER_TAG_DESC"
|
||||
/>
|
||||
<field name="filters_tag_value" type="componentitems"
|
||||
label="NR_TAG"
|
||||
description="ACF_ARTICLES_FILTER_TAG_SELECTION_DESC"
|
||||
multiple="true"
|
||||
table="tags"
|
||||
column_title="title"
|
||||
column_state="published"
|
||||
where="published = 1 AND level > 0"
|
||||
showon="fieldparams.filters_tag_enabled:1"
|
||||
/>
|
||||
<field name="filters_author_enabled" type="nrtoggle"
|
||||
label="ACF_ARTICLES_FILTER_BY_AUTHOR"
|
||||
description="ACF_ARTICLES_FILTER_AUTHOR_DESC"
|
||||
/>
|
||||
<field name="filters_author_value" type="componentitems"
|
||||
label="NR_AUTHOR"
|
||||
description="ACF_ARTICLES_FILTER_AUTHOR_SELECTION_DESC"
|
||||
multiple="true"
|
||||
table="users"
|
||||
join="#__content as c ON c.created_by = i.id"
|
||||
column_title="i.name"
|
||||
column_state="i.block"
|
||||
group="i.id"
|
||||
showon="fieldparams.filters_author_enabled:1"
|
||||
/>
|
||||
<field name="filters_status_value" type="list"
|
||||
label="ACF_ARTICLES_FILTER_BY_STATUS"
|
||||
description="ACF_ARTICLES_FILTER_STATUS_SELECTION_DESC"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
default="1">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
<option value="2">JARCHIVED</option>
|
||||
<option value="-2">JTRASHED</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field type="spacer" name="layout_label"
|
||||
label="NR_LAYOUT"
|
||||
class="acf"
|
||||
/>
|
||||
|
||||
|
||||
<field name="layout" type="NRImagesSelector"
|
||||
columns="4"
|
||||
width="600px"
|
||||
images="/media/plg_fields_acfarticles/img"
|
||||
label="NR_LAYOUT"
|
||||
description="ACF_ARTICLES_LAYOUT_DESC"
|
||||
default="media/plg_fields_acfarticles/img/alist.svg"
|
||||
/>
|
||||
<field name="devices_columns" type="NRResponsiveControl"
|
||||
showon="layout:media/plg_fields_acfarticles/img/astylea.svg[OR]layout:media/plg_fields_acfarticles/img/astyleb.svg"
|
||||
label="ACF_ARTICLES_COLUMNS"
|
||||
description="ACF_ARTICLES_COLUMNS_DESC">
|
||||
<subform>
|
||||
<field name="columns" type="number"
|
||||
class="input-small"
|
||||
default="2"
|
||||
hint="3"
|
||||
min="1"
|
||||
max="6" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="devices_gap" type="NRResponsiveControl"
|
||||
showon="layout:media/plg_fields_acfarticles/img/astylea.svg[OR]layout:media/plg_fields_acfarticles/img/astyleb.svg"
|
||||
label="ACF_ARTICLES_GAP"
|
||||
description="ACF_ARTICLES_GAP_DESC">
|
||||
<subform>
|
||||
<field name="gap" type="nrnumber"
|
||||
class="input-small"
|
||||
default="10"
|
||||
hint="10"
|
||||
addon="px" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="custom_layout" type="editor"
|
||||
label="ACF_ARTICLES_LAYOUT_CUSTOM"
|
||||
description="ACF_ARTICLES_LAYOUT_CUSTOM_DESC"
|
||||
showon="layout:media/plg_fields_acfarticles/img/custom.svg"
|
||||
editor="codemirror"
|
||||
filter="raw"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
|
||||
691
plugins/fields/acfarticles/script.install.helper.php
Normal file
691
plugins/fields/acfarticles/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 PlgFieldsAcfarticlesInstallerScriptHelper
|
||||
{
|
||||
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/acfarticles/script.install.php
Normal file
23
plugins/fields/acfarticles/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 © 2023 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 PlgFieldsACFArticlesInstallerScript extends PlgFieldsACFArticlesInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfarticles';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
}
|
||||
86
plugins/fields/acfarticles/tmpl/acfarticles.php
Normal file
86
plugins/fields/acfarticles/tmpl/acfarticles.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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;
|
||||
|
||||
if (!$articles = $field->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$routerHelper = defined('nrJ4') ? 'Joomla\Component\Content\Site\Helper\RouteHelper' : 'ContentHelperRoute';
|
||||
|
||||
// Get the layout
|
||||
$layout = $fieldParams->get('layout', 'media/plg_fields_acfarticles/img/alist.svg');
|
||||
$layout = str_replace(['media/plg_fields_acfarticles/img/', '.svg'], '', $layout);
|
||||
$layout = ltrim($layout, 'a');
|
||||
$customLayout = $fieldParams->get('custom_layout', '');
|
||||
|
||||
if ($layout === 'custom' && !$customLayout)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$id = 'acf_articles_' . $item->id . '_' . $field->id;
|
||||
|
||||
// Set the wrapper classes
|
||||
$classes = [];
|
||||
$classes[] = $id;
|
||||
$classes[] = 'layout-' . $layout;
|
||||
|
||||
if (in_array($layout, ['stylea', 'styleb']))
|
||||
{
|
||||
$classes[] = 'layout-grid';
|
||||
}
|
||||
|
||||
// Set columns and gap
|
||||
if (in_array($layout, ['stylea', 'styleb']))
|
||||
{
|
||||
// Get columns and gap
|
||||
$columns = $fieldParams->get('devices_columns.columns', []);
|
||||
$gap = $fieldParams->get('devices_gap.gap', []);
|
||||
|
||||
Factory::getDocument()->addStyleDeclaration('
|
||||
.acfarticles-field-wrapper.' . $id . ' {
|
||||
--columns: ' . $columns['desktop'] . ';
|
||||
--gap: ' . $gap['desktop'] . 'px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 991px) {
|
||||
.acfarticles-field-wrapper.' . $id . ' {
|
||||
--columns: ' . $columns['tablet'] . ';
|
||||
--gap: ' . $gap['tablet'] . 'px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 575px) {
|
||||
.acfarticles-field-wrapper.' . $id . ' {
|
||||
--columns: ' . $columns['mobile'] . ';
|
||||
--gap: ' . $gap['mobile'] . 'px;
|
||||
}
|
||||
}
|
||||
');
|
||||
}
|
||||
|
||||
$html = '<div class="acfarticles-field-wrapper ' . implode(' ', $classes) . '">';
|
||||
|
||||
$path = __DIR__ . '/layouts/' . $layout . '.php';
|
||||
if (file_exists($path))
|
||||
{
|
||||
require $path;
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
echo $html;
|
||||
39
plugins/fields/acfarticles/tmpl/layouts/custom.php
Normal file
39
plugins/fields/acfarticles/tmpl/layouts/custom.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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;
|
||||
|
||||
$customLayout = HTMLHelper::_('content.prepare', $customLayout);
|
||||
|
||||
$st = new \NRFramework\SmartTags();
|
||||
|
||||
// Add total articles
|
||||
$st->add(['total' => count($articles)], 'acf.articles.');
|
||||
|
||||
// Set the pattern
|
||||
$pattern = '/\{(acf\.)?article\.([^}]+)\}/';
|
||||
|
||||
foreach ($articles as $index => $article)
|
||||
{
|
||||
// Add article index
|
||||
$st->add(['index' => $index + 1], 'acf.articles.');
|
||||
|
||||
// Set the replacement
|
||||
$replacement = '{article.$2 --id=' . $article['id'] . ' --prepareCustomFields=false}';
|
||||
|
||||
// Get updated layout
|
||||
$tmpCustomLayout = preg_replace($pattern, $replacement, $customLayout);
|
||||
|
||||
$html .= $st->replace($tmpCustomLayout);
|
||||
}
|
||||
0
plugins/fields/acfarticles/tmpl/layouts/index.php
Normal file
0
plugins/fields/acfarticles/tmpl/layouts/index.php
Normal file
24
plugins/fields/acfarticles/tmpl/layouts/list.php
Normal file
24
plugins/fields/acfarticles/tmpl/layouts/list.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$html .= '<ul>';
|
||||
|
||||
foreach ($articles as $article)
|
||||
{
|
||||
$html .= '<li><a href="' . Route::_($routerHelper::getArticleRoute($article['id'], $article['catid'], $article['language'])) . '">' . $article['title'] . '</a></li>';
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
47
plugins/fields/acfarticles/tmpl/layouts/stylea.php
Normal file
47
plugins/fields/acfarticles/tmpl/layouts/stylea.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
if (defined('nrJ4'))
|
||||
{
|
||||
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||
$wa->registerAndUseStyle('acf_articles_style', 'plg_fields_acfarticles/style.css');
|
||||
}
|
||||
else
|
||||
{
|
||||
HTMLHelper::stylesheet('plg_fields_acfarticles/style.css', ['relative' => true, 'version' => 'auto']);
|
||||
}
|
||||
|
||||
foreach ($articles as $article)
|
||||
{
|
||||
$image = '';
|
||||
if (isset($article['images']) && $image = json_decode($article['images']))
|
||||
{
|
||||
$image = $image->image_intro ?: $image->image_fulltext;
|
||||
}
|
||||
|
||||
$html .= '<div class="acfarticle-item">';
|
||||
|
||||
if ($image)
|
||||
{
|
||||
$html .= '<img src="' . $image . '" class="acfarticle-item--image" alt="' . $article['title'] . '" loading="lazy" />';
|
||||
}
|
||||
|
||||
$html .= '<a href="' . Route::_($routerHelper::getArticleRoute($article['id'], $article['catid'], $article['language'])) . '" class="acfarticle-item--content--title">' . $article['title'] . '</a>';
|
||||
|
||||
$html .= '</div>';
|
||||
}
|
||||
56
plugins/fields/acfarticles/tmpl/layouts/styleb.php
Normal file
56
plugins/fields/acfarticles/tmpl/layouts/styleb.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2023 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
if (defined('nrJ4'))
|
||||
{
|
||||
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||
$wa->registerAndUseStyle('acf_articles_style', 'plg_fields_acfarticles/style.css');
|
||||
}
|
||||
else
|
||||
{
|
||||
HTMLHelper::stylesheet('plg_fields_acfarticles/style.css', ['relative' => true, 'version' => 'auto']);
|
||||
}
|
||||
|
||||
foreach ($articles as $article)
|
||||
{
|
||||
$image = '';
|
||||
if (isset($article['images']) && $image = json_decode($article['images']))
|
||||
{
|
||||
$image = $image->image_intro ?: $image->image_fulltext;
|
||||
}
|
||||
|
||||
$html .= '<div class="acfarticle-item">';
|
||||
|
||||
if ($image)
|
||||
{
|
||||
$html .= '<img src="' . $image . '" class="acfarticle-item--image" alt="' . $article['title'] . '" loading="lazy" />';
|
||||
}
|
||||
|
||||
$html .= '<div class="acfarticle-item--content">';
|
||||
|
||||
$html .= '<a href="' . Route::_($routerHelper::getArticleRoute($article['id'], $article['catid'], $article['language'])) . '" class="acfarticle-item--content--title">' . $article['title'] . '</a>';
|
||||
|
||||
// Get the article excerpt
|
||||
if ($excerpt = substr(strip_tags($article['introtext']), 0, 200))
|
||||
{
|
||||
// Add the excerpt
|
||||
$html .= '<div class="acfarticle-item--content--excerpt">' . $excerpt . '...</div>';
|
||||
}
|
||||
|
||||
$html .= '</div></div>';
|
||||
}
|
||||
16
plugins/fields/acfarticles/version.php
Normal file
16
plugins/fields/acfarticles/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 © 2023 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";
|
||||
|
||||
?>
|
||||
81
plugins/fields/acfchainedfields/acfchainedfields.php
Normal file
81
plugins/fields/acfchainedfields/acfchainedfields.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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 PlgFieldsACFChainedFields extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Override the field type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $overrideType = 'NRChainedFields';
|
||||
|
||||
/**
|
||||
* Prepares the field value for the (front-end) layout
|
||||
*
|
||||
* @param string $context The context.
|
||||
* @param stdclass $item The item.
|
||||
* @param stdclass $field The field.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onCustomFieldsPrepareField($context, $item, $field)
|
||||
{
|
||||
// Check if the field should be processed by us
|
||||
if (!$this->isTypeSupported($field->type))
|
||||
{
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
$data_source = $field->fieldparams->get('data_source', 'custom');
|
||||
|
||||
$dataset = '';
|
||||
switch ($data_source)
|
||||
{
|
||||
case 'custom':
|
||||
$dataset = $field->fieldparams->get('data_source_custom', '');
|
||||
break;
|
||||
|
||||
case 'csv_file':
|
||||
$csv_file = $field->fieldparams->get('data_source_csv', '');
|
||||
|
||||
if (!file_exists($csv_file))
|
||||
{
|
||||
return $parent;
|
||||
}
|
||||
|
||||
$dataset = $csv_file;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$choices = \NRFramework\Helpers\ChainedFields::loadCSV($dataset, $data_source, $field->fieldparams->get('separator'), $field->name . '_', $field->name))
|
||||
{
|
||||
return $parent;
|
||||
}
|
||||
|
||||
$field->choices = $choices;
|
||||
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
}
|
||||
21
plugins/fields/acfchainedfields/acfchainedfields.xml
Normal file
21
plugins/fields/acfchainedfields/acfchainedfields.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_CHAINEDFIELDS</name>
|
||||
<description>ACF_CHAINEDFIELDS_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>November 2022</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="acfchainedfields">acfchainedfields.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,24 @@
|
||||
; @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_ACFCHAINEDFIELDS_LABEL="ACF - Chained Fields"
|
||||
ACF_CHAINEDFIELDS_VALUE_DESC="Select a value from a dropdown to reveal the next available options."
|
||||
ACF_CHAINEDFIELDS="Fields - ACF Chained Fields"
|
||||
ACF_CHAINEDFIELDS_DESC="Create select fields that dynamically change based on the previous selection."
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE="Data Source"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_DESC="Select the data source. You can either enter the expected format via text or upload a CSV file."
|
||||
ACF_CHAINEDFIELDS_FROM_CSV_FILE="From CSV File"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM="Custom Data Source"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM_DESC="Enter the data source source manually. Format:<br />Year,Make,Model<br />2015,Audi,A3<br />2016,BMW,X3<br />2017,FIAT,500"
|
||||
ACF_CHAINEDFIELDS_CSV="CSV Data Source"
|
||||
ACF_CHAINEDFIELDS_CSV_DESC="Upload a CSV file to import your choices."
|
||||
ACF_CHAINEDFIELDS_CSV_SEPARATOR="CSV Separator"
|
||||
ACF_CHAINEDFIELDS_CSV_SEPARATOR_DESC="Enter the separator used in the CSV file."
|
||||
ACF_CHAINEDFIELDS_LAYOUT="Layout"
|
||||
ACF_CHAINEDFIELDS_LAYOUT_DESC="Select the layout that will be used to display the field."
|
||||
ACF_CHAINEDFIELDS_CUSTOM_LAYOUT="Custom Layout"
|
||||
ACF_CHAINEDFIELDS_CUSTOM_LAYOUT_DESC="Enter the custom layout.<br />You can use the following Smart Tags for each dropdown fields to retrieve their values: {field.1.value} where 1 is the first dropdown field which will return its value.<br />Similarly, you can use the Smart Tag {field.1.label} to retrieve each dropdown label.<br /><br />Replace 1 with 2 for the second dropdown field, etc..."
|
||||
@ -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_CHAINEDFIELDS="Fields - ACF Chained Fields"
|
||||
ACF_CHAINEDFIELDS_DESC="Create select fields that dynamically change based on the previous selection."
|
||||
@ -0,0 +1,24 @@
|
||||
; @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_ACFCHAINEDFIELDS_LABEL="ACF - Campos Encadenados"
|
||||
ACF_CHAINEDFIELDS_VALUE_DESC="Seleccione un valor del menú desplegable para revelar las siguientes opciones disponibles."
|
||||
ACF_CHAINEDFIELDS="Campos - ACF Campos Encadenados"
|
||||
ACF_CHAINEDFIELDS_DESC="Cree campos de selección que cambien dinámicamente en función de la selección anterior."
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE="Fuente de datos"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_DESC="Seleccione la fuente de datos. Puede ingresar el formato esperado a través de texto o cargar un archivo CSV."
|
||||
ACF_CHAINEDFIELDS_FROM_CSV_FILE="Desde archivo CSV"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM="Fuente de datos personalizada"
|
||||
ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM_DESC="Ingrese la fuente de origen de datos manualmente. Formato:<br>Año, Marca, Modelo<br>2015,Audi,A3<br>2016,BMW,X3<br>2017,FIAT,500"
|
||||
ACF_CHAINEDFIELDS_CSV="Fuente de datos CSV"
|
||||
ACF_CHAINEDFIELDS_CSV_DESC="Cargue un archivo CSV para importar sus opciones."
|
||||
ACF_CHAINEDFIELDS_CSV_SEPARATOR="Separador CSV"
|
||||
ACF_CHAINEDFIELDS_CSV_SEPARATOR_DESC="Introduzca el separador utilizado en el archivo CSV."
|
||||
ACF_CHAINEDFIELDS_LAYOUT="Disposición"
|
||||
ACF_CHAINEDFIELDS_LAYOUT_DESC="Seleccione el diseño que se utilizará para mostrar el campo."
|
||||
ACF_CHAINEDFIELDS_CUSTOM_LAYOUT="Diseño personalizado"
|
||||
ACF_CHAINEDFIELDS_CUSTOM_LAYOUT_DESC="Introduzca el diseño personalizado.<br>Puede usar las siguientes etiquetas inteligentes para cada campo desplegable para recuperar sus valores: {field.1.value} donde 1 es el primer campo desplegable que devolverá su valor.<br>De manera similar, puede usar la etiqueta inteligente {field.1.label} para recuperar cada etiqueta desplegable.<br><br>Reemplace 1 con 2 para el segundo campo desplegable, etc."
|
||||
@ -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_CHAINEDFIELDS="Campos - ACF Campos Encadenados"
|
||||
ACF_CHAINEDFIELDS_DESC="Cree campos de selección que cambien dinámicamente en función de la selección anterior."
|
||||
54
plugins/fields/acfchainedfields/params/acfchainedfields.xml
Normal file
54
plugins/fields/acfchainedfields/params/acfchainedfields.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field name="data_source" type="radio"
|
||||
label="ACF_CHAINEDFIELDS_DATA_SOURCE"
|
||||
description="ACF_CHAINEDFIELDS_DATA_SOURCE_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="custom">
|
||||
<option value="custom">NR_CUSTOM</option>
|
||||
<option value="csv_file">ACF_CHAINEDFIELDS_FROM_CSV_FILE</option>
|
||||
</field>
|
||||
<field name="data_source_custom" type="editor"
|
||||
label="ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM"
|
||||
description="ACF_CHAINEDFIELDS_DATA_SOURCE_CUSTOM_DESC"
|
||||
showon="data_source:custom"
|
||||
editor="codemirror|none"
|
||||
filter="raw"
|
||||
rows="10"
|
||||
/>
|
||||
<field name="data_source_csv" type="NRInlineFileUpload"
|
||||
label="ACF_CHAINEDFIELDS_CSV"
|
||||
description="ACF_CHAINEDFIELDS_CSV_DESC"
|
||||
accept=".csv"
|
||||
upload_folder="media/acfchainedfields"
|
||||
showon="data_source:csv_file"
|
||||
/>
|
||||
<field name="separator" type="text"
|
||||
label="ACF_CHAINEDFIELDS_CSV_SEPARATOR"
|
||||
description="ACF_CHAINEDFIELDS_CSV_SEPARATOR_DESC"
|
||||
default=","
|
||||
showon="data_source:csv_file"
|
||||
/>
|
||||
<field name="layout" type="radio"
|
||||
label="ACF_CHAINEDFIELDS_LAYOUT"
|
||||
description="ACF_CHAINEDFIELDS_LAYOUT_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="default">
|
||||
<option value="default">JDEFAULT</option>
|
||||
<option value="custom">NR_CUSTOM</option>
|
||||
</field>
|
||||
<field name="custom_layout" type="editor"
|
||||
label="ACF_CHAINEDFIELDS_CUSTOM_LAYOUT"
|
||||
description="ACF_CHAINEDFIELDS_CUSTOM_LAYOUT_DESC"
|
||||
showon="layout:custom"
|
||||
editor="codemirror|none"
|
||||
filter="raw"
|
||||
rows="5"
|
||||
default="{field.1.label}: {field.1.value}, {field.2.label}: {field.2.value}"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
|
||||
691
plugins/fields/acfchainedfields/script.install.helper.php
Normal file
691
plugins/fields/acfchainedfields/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 PlgFieldsAcfchainedfieldsInstallerScriptHelper
|
||||
{
|
||||
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/acfchainedfields/script.install.php
Normal file
23
plugins/fields/acfchainedfields/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 PlgFieldsACFChainedFieldsInstallerScript extends PlgFieldsACFChainedFieldsInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfchainedfields';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
}
|
||||
78
plugins/fields/acfchainedfields/tmpl/acfchainedfields.php
Normal file
78
plugins/fields/acfchainedfields/tmpl/acfchainedfields.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?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;
|
||||
|
||||
if (!$value = $field->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$value = array_values($value);
|
||||
|
||||
$layout = $fieldParams->get('layout', 'default');
|
||||
|
||||
// Default layout
|
||||
if ($layout === 'default')
|
||||
{
|
||||
?><div class="acf-chained-fields"><?php
|
||||
foreach ($value as $key => $_value)
|
||||
{
|
||||
if (!$_value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$label = isset($field->choices['inputs'][$key]) ? $field->choices['inputs'][$key]['label'] : '';
|
||||
?>
|
||||
<div class="item">
|
||||
<strong><?php echo $label; ?></strong>: <?php echo $_value; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
// Custom Layout
|
||||
else
|
||||
{
|
||||
if (!$layout = $fieldParams->get('custom_layout', null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make index start from 1
|
||||
array_unshift($value, '');
|
||||
unset($value[0]);
|
||||
|
||||
// Create Smart Tags instance
|
||||
$st = new \NRFramework\SmartTags();
|
||||
|
||||
$values = [];
|
||||
$labels = [];
|
||||
|
||||
foreach ($value as $key => $_value)
|
||||
{
|
||||
$label_value = isset($field->choices['inputs'][$key - 1]) ? $field->choices['inputs'][$key - 1]['label'] : '';
|
||||
|
||||
$labels[$key . '.label'] = $label_value;
|
||||
$values[$key . '.value'] = $_value;
|
||||
}
|
||||
$st->add($labels, 'field.');
|
||||
|
||||
// Add values to Smart Tags
|
||||
$st->add($values, 'field.');
|
||||
|
||||
// Replace Smart Tags
|
||||
echo $st->replace($layout);
|
||||
}
|
||||
16
plugins/fields/acfchainedfields/version.php
Normal file
16
plugins/fields/acfchainedfields/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 © 2018 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";
|
||||
|
||||
?>
|
||||
89
plugins/fields/acfconvertforms/acfconvertforms.php
Normal file
89
plugins/fields/acfconvertforms/acfconvertforms.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2022 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;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
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 PlgFieldsACFConvertForms extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Update the label of the field in filters.
|
||||
*
|
||||
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
|
||||
*
|
||||
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
|
||||
*/
|
||||
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
|
||||
{
|
||||
// Make sure it is a field of that type
|
||||
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
if (!class_exists('\ConvertForms\Form'))
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (!$form = ConvertForms\Form::load($option->getLabel()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($form['name']);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
|
||||
*
|
||||
* @param stdClass $field The field.
|
||||
* @param DOMElement $parent The field node parent.
|
||||
* @param Form $form The form.
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onCustomFieldsPrepareDom($field, DOMElement $parent, Joomla\CMS\Form\Form $form)
|
||||
{
|
||||
if (!$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$form->addFieldPath(JPATH_ADMINISTRATOR . '/components/com_convertforms/models/forms/fields');
|
||||
|
||||
$fieldNode->setAttribute('type', 'convertforms');
|
||||
|
||||
$option = new \DOMElement('option');
|
||||
$option->textContent = htmlspecialchars('- ' . Text::_('JSELECT') . ' -', ENT_COMPAT, 'UTF-8');
|
||||
$element = $fieldNode->appendChild($option);
|
||||
|
||||
return $fieldNode;
|
||||
}
|
||||
}
|
||||
20
plugins/fields/acfconvertforms/acfconvertforms.xml
Normal file
20
plugins/fields/acfconvertforms/acfconvertforms.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_CONVERTFORMS</name>
|
||||
<description>ACF_CONVERTFORMS_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>Sep 2022</creationDate>
|
||||
<copyright>Copyright (C) 2017 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="acfconvertforms">acfconvertforms.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
</extension>
|
||||
@ -0,0 +1,4 @@
|
||||
PLG_FIELDS_ACFCONVERTFORMS_LABEL="ACF - Convert Forms"
|
||||
ACF_CONVERTFORMS="Fields - ACF Convert Forms"
|
||||
ACF_CONVERTFORMS_DESC="Render a form created with Convert Forms"
|
||||
ACF_CONVERTFORMS_VALUE_DESC="Select a form to render"
|
||||
@ -0,0 +1,2 @@
|
||||
ACF_CONVERTFORMS="Fields - ACF Convert Forms"
|
||||
ACF_CONVERTFORMS_DESC="Render a form created with Convert Forms"
|
||||
@ -0,0 +1,4 @@
|
||||
PLG_FIELDS_ACFCONVERTFORMS_LABEL="ACF - Convert Forms"
|
||||
ACF_CONVERTFORMS="Campos - ACF Convert Forms"
|
||||
ACF_CONVERTFORMS_DESC="Renderizar un formulario creado con Convert Forms"
|
||||
ACF_CONVERTFORMS_VALUE_DESC="Seleccione un formulario para renderizar"
|
||||
@ -0,0 +1,2 @@
|
||||
ACF_CONVERTFORMS="Campos - ACF Conversor de Formularios"
|
||||
ACF_CONVERTFORMS_DESC="Renderizar un formulario creado con Convert Forms"
|
||||
691
plugins/fields/acfconvertforms/script.install.helper.php
Normal file
691
plugins/fields/acfconvertforms/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 PlgFieldsAcfconvertformsInstallerScriptHelper
|
||||
{
|
||||
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/acfconvertforms/script.install.php
Normal file
23
plugins/fields/acfconvertforms/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 © 2022 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 PlgFieldsACFConvertFormsInstallerScript extends PlgFieldsACFConvertFormsInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfconvertforms';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = 'fields';
|
||||
public $show_message = false;
|
||||
}
|
||||
18
plugins/fields/acfconvertforms/tmpl/acfconvertforms.php
Normal file
18
plugins/fields/acfconvertforms/tmpl/acfconvertforms.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2022 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if ($id = $field->value)
|
||||
{
|
||||
echo ConvertForms\Helper::renderFormById($id);
|
||||
}
|
||||
16
plugins/fields/acfconvertforms/version.php
Normal file
16
plugins/fields/acfconvertforms/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 © 2022 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";
|
||||
|
||||
?>
|
||||
92
plugins/fields/acfcountdown/acfcountdown.php
Normal file
92
plugins/fields/acfcountdown/acfcountdown.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?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;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
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 PlgFieldsACFCountdown extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Override the field type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $overrideType = 'Countdown';
|
||||
|
||||
/**
|
||||
* The form event. Load additional parameters when available into the field form.
|
||||
* Only when the type of the form is of interest.
|
||||
*
|
||||
* @param Form $form The form
|
||||
* @param stdClass $data The data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onContentPrepareForm(Form $form, $data)
|
||||
{
|
||||
$data = (object) $data;
|
||||
|
||||
// Make sure we are manipulating the right field.
|
||||
if (isset($data->type) && $data->type != $this->_name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the configuration for the presets.
|
||||
*
|
||||
* These are handed over to Javascript and
|
||||
* whenever we click on a preset, these values
|
||||
* are set to each setting on the backend.
|
||||
*/
|
||||
if (Factory::getApplication()->isClient('administrator'))
|
||||
{
|
||||
Text::script('ACF_FIELD_PREVIEWER');
|
||||
Text::script('ACF_FIELD_PREVIEWER_INFO_ICON_TITLE');
|
||||
Text::script('NR_AND_LC');
|
||||
Text::script('NR_DAYS');
|
||||
Text::script('NR_HOURS');
|
||||
Text::script('NR_MINUTES');
|
||||
Text::script('NR_SECONDS');
|
||||
|
||||
// Include presets
|
||||
include 'fields/helper.php';
|
||||
|
||||
$script = 'window.ACFCountdownPresetsData = ' . json_encode($presets) . ';';
|
||||
Factory::getDocument()->addScriptDeclaration($script);
|
||||
HTMLHelper::script('plg_system_nrframework/tffieldsvaluesapplier.js', ['relative' => true, 'version' => 'auto']);
|
||||
HTMLHelper::script('plg_fields_acfcountdown/countdown.js', ['relative' => true, 'version' => 'auto']);
|
||||
|
||||
$script = 'window.ACFFieldsPreviewerData = ' . json_encode([
|
||||
'fullscreenActions' => true,
|
||||
'responsiveControls' => true
|
||||
]) . ';';
|
||||
Factory::getDocument()->addScriptDeclaration($script);
|
||||
HTMLHelper::script('plg_fields_acfcountdown/previewer.js', ['relative' => true, 'version' => 'auto']);
|
||||
}
|
||||
|
||||
|
||||
return parent::onContentPrepareForm($form, $data);
|
||||
}
|
||||
}
|
||||
26
plugins/fields/acfcountdown/acfcountdown.xml
Normal file
26
plugins/fields/acfcountdown/acfcountdown.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_COUNTDOWN</name>
|
||||
<description>ACF_COUNTDOWN_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>December 2022</creationDate>
|
||||
<copyright>Copyright (C) 2021 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="acfcountdown">acfcountdown.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>fields</folder>
|
||||
<folder>language</folder>
|
||||
<folder>params</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<media folder="media" destination="plg_fields_acfcountdown">
|
||||
<folder>js</folder>
|
||||
<folder>img</folder>
|
||||
</media>
|
||||
</extension>
|
||||
120
plugins/fields/acfcountdown/fields/countdown.php
Normal file
120
plugins/fields/acfcountdown/fields/countdown.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\Form\Form;
|
||||
|
||||
class JFormFieldCountdown extends FormField
|
||||
{
|
||||
/**
|
||||
* Method to attach a JForm object to the field.
|
||||
*
|
||||
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||
* @param mixed $value The form field value to validate.
|
||||
* @param string $group The field name group control value.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
public function setup(SimpleXMLElement $element, $value, $group = null)
|
||||
{
|
||||
if (!parent::setup($element, $value, $group))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Value must be an array
|
||||
if (is_string($this->value) && $value = json_decode($this->value, true))
|
||||
{
|
||||
$this->value = json_decode($this->value, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$countdown_type = (string) $this->element['countdown_type'];
|
||||
|
||||
$static_fields = '
|
||||
<field name="value" type="calendar"
|
||||
hiddenLabel="true"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="none"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
required="' . $this->required . '"
|
||||
/>';
|
||||
|
||||
$evergreen_fields = '
|
||||
<field name="acf_countdown_inline_start" hiddenLabel="true" type="nr_inline" />
|
||||
<field name="dynamic_days" type="nrnumber"
|
||||
class="input-small"
|
||||
hiddenLabel="true"
|
||||
addon="ACF_COUNTDOWN_DAYS"
|
||||
default="0"
|
||||
min="0"
|
||||
max="365"
|
||||
required="' . $this->required . '"
|
||||
/>
|
||||
<field name="dynamic_hours" type="nrnumber"
|
||||
class="input-small"
|
||||
hiddenLabel="true"
|
||||
addon="ACF_COUNTDOWN_HOURS"
|
||||
default="0"
|
||||
min="0"
|
||||
max="999"
|
||||
required="' . $this->required . '"
|
||||
/>
|
||||
<field name="dynamic_minutes" type="nrnumber"
|
||||
class="input-small"
|
||||
hiddenLabel="true"
|
||||
addon="ACF_COUNTDOWN_MINUTES"
|
||||
default="0"
|
||||
min="0"
|
||||
max="999"
|
||||
required="' . $this->required . '"
|
||||
/>
|
||||
<field name="dynamic_seconds" type="nrnumber"
|
||||
class="input-small"
|
||||
hiddenLabel="true"
|
||||
addon="ACF_COUNTDOWN_SECONDS"
|
||||
default="0"
|
||||
min="0"
|
||||
max="999"
|
||||
required="' . $this->required . '"
|
||||
/>
|
||||
<field name="acf_countdown_inline_end" end="1" type="nr_inline" />
|
||||
';
|
||||
|
||||
$form_source = new SimpleXMLElement('
|
||||
<form>
|
||||
<fieldset name="acfcountdown">
|
||||
' . ($countdown_type === 'static' ? $static_fields : $evergreen_fields) . '
|
||||
</fieldset>
|
||||
</form>
|
||||
');
|
||||
|
||||
$control = $this->name;
|
||||
$formname = 'acfcountdown.' . str_replace(['jform[', '[', ']'], ['', '.', ''], $control);
|
||||
|
||||
$form = Form::getInstance($formname, $form_source->asXML(), ['control' => $control]);
|
||||
$form->bind($this->value);
|
||||
|
||||
return '<div class="acf-countdown-item-edit-wrapper">' . $form->renderFieldset('acfcountdown') . '</div>';
|
||||
}
|
||||
}
|
||||
516
plugins/fields/acfcountdown/fields/helper.php
Normal file
516
plugins/fields/acfcountdown/fields/helper.php
Normal file
@ -0,0 +1,516 @@
|
||||
<?php
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$presets = [
|
||||
1 => [
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => 25, 'mobile' => '']
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 15, 'tablet' => 13, 'mobile' => '']
|
||||
],
|
||||
'gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 10, 'tablet' => 0, 'mobile' => '']
|
||||
],
|
||||
'minutes_label' => [
|
||||
'type' => 'text',
|
||||
'value' => Text::_('ACF_COUNTDOWN_MINS')
|
||||
],
|
||||
'seconds_label' => [
|
||||
'type' => 'text',
|
||||
'value' => Text::_('ACF_COUNTDOWN_SECS')
|
||||
],
|
||||
'digits_wrapper_custom_width' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'digits_wrapper_min_width' => [
|
||||
'type' => 'number',
|
||||
'value' => 50
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 400
|
||||
],
|
||||
'unit_label_margin_top' => [
|
||||
'type' => 'number',
|
||||
'value' => 9
|
||||
]
|
||||
],
|
||||
2 => [
|
||||
'item_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => 74
|
||||
],
|
||||
'[border][style]' => [
|
||||
'type' => 'list',
|
||||
'value' => 'solid'
|
||||
],
|
||||
'[border][width]' => [
|
||||
'type' => 'number',
|
||||
'value' => 2
|
||||
],
|
||||
'[border][color]' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'item_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 9]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 12, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
]
|
||||
],
|
||||
3 => [
|
||||
'days_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('NR_DAYS'))
|
||||
],
|
||||
'hours_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('NR_HOURS'))
|
||||
],
|
||||
'minutes_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('ACF_COUNTDOWN_MINS'))
|
||||
],
|
||||
'seconds_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('ACF_COUNTDOWN_SECS'))
|
||||
],
|
||||
'item_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => 84
|
||||
],
|
||||
'[border][style]' => [
|
||||
'type' => 'list',
|
||||
'value' => 'solid'
|
||||
],
|
||||
'[border][width]' => [
|
||||
'type' => 'number',
|
||||
'value' => 2
|
||||
],
|
||||
'[border][color]' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'item_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 100]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 12, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
]
|
||||
],
|
||||
4 => [
|
||||
'item_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => 74
|
||||
],
|
||||
'item_background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'item_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 9]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#fff'
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 12, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#d2d5ee'
|
||||
]
|
||||
],
|
||||
5 => [
|
||||
'days' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => false
|
||||
],
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 5]
|
||||
],
|
||||
'digits_gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 3]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#fff'
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 15, 'tablet' => 13, 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 400
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'unit_label_margin_top' => [
|
||||
'type' => 'number',
|
||||
'value' => 8
|
||||
],
|
||||
'digits_custom_width' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'digits_min_width' => [
|
||||
'type' => 'number',
|
||||
'value' => 39
|
||||
],
|
||||
'digits_padding' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => ['top' => 9, 'right' => 5, 'bottom' => 9, 'left' => 5]]
|
||||
],
|
||||
'digit_background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'digits_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 9]
|
||||
]
|
||||
],
|
||||
6 => [
|
||||
'minutes_label' => [
|
||||
'type' => 'text',
|
||||
'value' => Text::_('ACF_COUNTDOWN_MINS')
|
||||
],
|
||||
'seconds_label' => [
|
||||
'type' => 'text',
|
||||
'value' => Text::_('ACF_COUNTDOWN_SECS')
|
||||
],
|
||||
'digits_wrapper_custom_width' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'digits_wrapper_min_width' => [
|
||||
'type' => 'number',
|
||||
'value' => 59
|
||||
],
|
||||
'digits_wrapper_padding' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 9]
|
||||
],
|
||||
'digits_wrapper_background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#fff'
|
||||
],
|
||||
'digits_wrapper_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 5]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => 25, 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 15, 'tablet' => 13, 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 400
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'unit_label_margin_top' => [
|
||||
'type' => 'number',
|
||||
'value' => 8
|
||||
]
|
||||
],
|
||||
7 => [
|
||||
'days_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('NR_DAYS'))
|
||||
],
|
||||
'hours_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('NR_HOURS'))
|
||||
],
|
||||
'minutes_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('ACF_COUNTDOWN_MINS'))
|
||||
],
|
||||
'seconds_label' => [
|
||||
'type' => 'text',
|
||||
'value' => strtoupper(Text::_('ACF_COUNTDOWN_SECS'))
|
||||
],
|
||||
'separator' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'item_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => 90
|
||||
],
|
||||
'item_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 7]
|
||||
],
|
||||
'item_background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#f6f6f6'
|
||||
],
|
||||
'gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 5]
|
||||
],
|
||||
'digits_gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 3]
|
||||
],
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 30, 'tablet' => 25, 'mobile' => '']
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
],
|
||||
'digit_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#fff'
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 12, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'label_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 600
|
||||
],
|
||||
'unit_label_text_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'unit_label_margin_top' => [
|
||||
'type' => 'number',
|
||||
'value' => 9
|
||||
],
|
||||
'digits_custom_width' => [
|
||||
'type' => 'nrtoggle',
|
||||
'value' => true
|
||||
],
|
||||
'digits_min_width' => [
|
||||
'type' => 'number',
|
||||
'value' => 30
|
||||
],
|
||||
'digits_padding' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 5]
|
||||
],
|
||||
'digit_background_color' => [
|
||||
'type' => 'text',
|
||||
'value' => '#41495b'
|
||||
],
|
||||
'digits_border_radius' => [
|
||||
'responsive' => true,
|
||||
'dimensions' => true,
|
||||
'border_radius' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 7]
|
||||
]
|
||||
],
|
||||
8 => [
|
||||
'digits_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 16, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'label_font_size' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ['desktop' => 16, 'tablet' => '', 'mobile' => '']
|
||||
],
|
||||
'gap' => [
|
||||
'responsive' => true,
|
||||
'type' => 'number',
|
||||
'value' => ''
|
||||
],
|
||||
'days_label' => [
|
||||
'type' => 'text',
|
||||
'value' => ' ' . strtolower(Text::_('NR_DAYS'))
|
||||
],
|
||||
'hours_label' => [
|
||||
'type' => 'text',
|
||||
'value' => ' ' . strtolower(Text::_('NR_HOURS'))
|
||||
],
|
||||
'minutes_label' => [
|
||||
'type' => 'text',
|
||||
'value' => ' ' . strtolower(Text::_('NR_MINUTES'))
|
||||
],
|
||||
'seconds_label' => [
|
||||
'type' => 'text',
|
||||
'value' => ' ' . strtolower(Text::_('NR_SECONDS'))
|
||||
],
|
||||
'digits_font_weight' => [
|
||||
'type' => 'list',
|
||||
'value' => 500
|
||||
]
|
||||
]
|
||||
];
|
||||
@ -0,0 +1,108 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2020 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTDOWN_LABEL="ACF - Countdown"
|
||||
ACF_COUNTDOWN="Fields - ACF Countdown"
|
||||
ACF_COUNTDOWN_VALUE_DESC="Set the countdown date, or dynamic days/hours/minutes/seconds."
|
||||
ACF_COUNTDOWN_DESC="Use a countdown timer to create anticipation and scarcity around upcoming events, creating the feeling of scarcity, anticipation, and drive more sales."
|
||||
ACF_COUNTDOWN_SHOW_MESSAGE="Show message"
|
||||
ACF_COUNTDOWN_SHOW_MESSAGE_DESC="Set the message that will appear once the timer ends."
|
||||
ACF_COUNTDOWN_FINISH_TEXT_DESC="Set the message that will appear once the countdown ends."
|
||||
ACF_COUNTDOWN_FINISH_TEXT_HINT="Countdown finished."
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT="Custom Format"
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT_DESC="Using the <strong>Custom Format</strong> option, you can write your own HTML to produce a countdown that fits your needs.<br>Available Tags:<br><br>• {days}<br>• {hours}<br>• {minutes}<br>• {seconds}<br><br>Example: {minutes}m:{seconds}s will produce a countdown with output: 35m:28s"
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT_HINT="{days} days, {hours} hours, {minutes} minutes and {seconds} seconds"
|
||||
ACF_COUNTDOWN_COUNTDOWN_TIMER="Timer"
|
||||
ACF_COUNTDOWN_ACTION="On Countdown Expire"
|
||||
ACF_COUNTDOWN_ACTION_DESC="Select the countdown end action.<br><br><strong>No action:</strong> The countdown will remain once finished.<br><strong>Hide timer:</strong> The countdown will disappear once it ends.<br><strong>Show message:</strong> Show a message once the countdown ends.<br><strong>Redirect to URL:</strong> Redirect to a URL once the timer ends."
|
||||
ACF_COUNTDOWN_ACTION_NO_ACTION="No action"
|
||||
ACF_COUNTDOWN_ACTION_HIDE_TIMER="Hide timer"
|
||||
ACF_COUNTDOWN_ACTION_REDIRECT="Redirect to URL"
|
||||
ACF_COUNTDOWN_REDIRECT_URL="Redirect URL"
|
||||
ACF_COUNTDOWN_REDIRECT_URL_DESC="Set the URL to redirect the user once the countdown ends."
|
||||
ACF_COUNTDOWN_REDIRECT_URL_HINT="https://"
|
||||
ACF_COUNTDOWN_PRE_MADE_TEMPLATE="Pre-made Template"
|
||||
ACF_COUNTDOWN_TEMPLATE="Template"
|
||||
ACF_COUNTDOWN_TEMPLATE_DESC="Select the countdown template to use. Once you select a template, the settings below will be updated based on the selected template."
|
||||
ACF_COUNTDOWN_UNIT_DISPLAY="Unit Display"
|
||||
ACF_COUNTDOWN_DAYS_LABEL="Show Days"
|
||||
ACF_COUNTDOWN_DAYS="Days"
|
||||
ACF_COUNTDOWN_DAYS_DESC="Set whether to display the days."
|
||||
ACF_COUNTDOWN_DAYS_LABEL="Days Label"
|
||||
ACF_COUNTDOWN_DAYS_LABEL_DESC="Set the days label."
|
||||
ACF_COUNTDOWN_HOURS_LABEL="Show Hours"
|
||||
ACF_COUNTDOWN_HOURS="Hours"
|
||||
ACF_COUNTDOWN_HOURS_DESC="Set whether to display the hours."
|
||||
ACF_COUNTDOWN_HOURS_LABEL="Hours Label"
|
||||
ACF_COUNTDOWN_HOURS_LABEL_DESC="Set the hours label."
|
||||
ACF_COUNTDOWN_MINUTES_LABEL="Show Minutes"
|
||||
ACF_COUNTDOWN_MINUTES="Minutes"
|
||||
ACF_COUNTDOWN_MINUTES_DESC="Set whether to display the minutes."
|
||||
ACF_COUNTDOWN_MINUTES_LABEL="Minutes Label"
|
||||
ACF_COUNTDOWN_MINUTES_LABEL_DESC="Set the minutes label."
|
||||
ACF_COUNTDOWN_SECONDS_LABEL="Show Seconds"
|
||||
ACF_COUNTDOWN_SECONDS="Seconds"
|
||||
ACF_COUNTDOWN_SECONDS_DESC="Set whether to display the seconds."
|
||||
ACF_COUNTDOWN_SECONDS_LABEL="Seconds Label"
|
||||
ACF_COUNTDOWN_SECONDS_LABEL_DESC="Set the seconds label."
|
||||
ACF_COUNTDOWN_TYPE="Type"
|
||||
ACF_COUNTDOWN_TYPE_DESC="Select the Contdown type.<br><br><strong>Fixed:</strong> Counts down to a specific date and time. Universal deadline for all visitors.<br><strong>Evergreen:</strong> Set-and-forget solution. The countdown starts when your visitor sees the offer. The countdown will also restart upon ending."
|
||||
ACF_COUNTDOWN_TYPE_FIXED="Fixed Date"
|
||||
ACF_COUNTDOWN_TYPE_EVERGREEN="Evergreen"
|
||||
ACF_COUNTDOWN_TIMEZONE="Date Timezone"
|
||||
ACF_COUNTDOWN_TIMEZONE_DESC="Select which timezone will be used."
|
||||
ACF_COUNTDOWN_TIMEZONE_SERVER="Use Joomla Timezone"
|
||||
ACF_COUNTDOWN_TIMEZONE_CLIENT="Use Visitor's Timezone"
|
||||
ACF_COUNTDOWN_THEME_SETTINGS="Theme Settings"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_COLOR="Item Border Color"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_COLOR_DESC="Set the border color around each countdown item."
|
||||
ACF_COUNTDOWN_ENABLE_SEPARATOR="Enable Separator"
|
||||
ACF_COUNTDOWN_ENABLE_SEPARATOR_DESC="Set to display a colon \":\" separator."
|
||||
ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT="Enable 00 Number Format"
|
||||
ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT_DESC="Set whether to display the numbers in 0 or 00 format."
|
||||
ACF_COUNTDOWN_UNIT_ITEM="Unit Item"
|
||||
ACF_COUNTDOWN_ITEM_SIZE="Size"
|
||||
ACF_COUNTDOWN_ITEM_SIZE_DESC="Sets the item's width and height in pixels. Leave empty for auto width."
|
||||
ACF_COUNTDOWN_TEMPLATE_SELECTOR_DESC="Select whether to use a pre-made template or a custom template"
|
||||
ACF_COUNTDOWN_TEMPLATE_SELECTOR="Template selector"
|
||||
ACF_COUNTDOWN_GAP="Gap"
|
||||
ACF_COUNTDOWN_GAP_DESC="Set the space between unit items."
|
||||
ACF_COUNTDOWN_BACKGROUND_COLOR="Background Color"
|
||||
ACF_COUNTDOWN_ITEM_BACKGROUND_COLOR_DESC="Set the item background color."
|
||||
ACF_COUNTDOWN_UNIT_ITEM_BORDER_CONTROL_DESC="Set the border for the unit item (style, color and width)."
|
||||
ACF_COUNTDOWN_UNIT_DIGITS_CONTAINER="Unit Digits Container"
|
||||
ACF_COUNTDOWN_UNIT_DIGIT="Unit Digit"
|
||||
ACF_COUNTDOWN_UNIT_LABEL="Unit Label"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_RADIUS_DESC="Set the item border radius."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_PADDING_DESC="Set the digits container padding."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH="Digits Container Custom Width"
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH_DESC="Set the digits container minimum width.<br><br><strong>Enable</strong> to set a custom width.<br><strong>Disable</strong> for auto width."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_BACKGROUND_COLOR_DESC="Set the digits container background color."
|
||||
ACF_COUNTDOWN_DIGITS_FONT_SIZE_DESC="Set the font size of the digits."
|
||||
ACF_COUNTDOWN_DIGITS_FONT_WEIGHT="Font Weight"
|
||||
ACF_COUNTDOWN_DIGITS_FONT_WEIGHT_DESC="Set the font weight of the digits."
|
||||
ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH="Digits Custom Width"
|
||||
ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH_DESC="Set the digits minimum width.<br><br><strong>Enable</strong> to set a custom width.<br><strong>Disable</strong> for auto width."
|
||||
ACF_COUNTDOWN_DIGITS_PADDING_DESC="Set the padding for each digit."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_BORDER_RADIUS_DESC="Set the border radius for the digits container."
|
||||
ACF_COUNTDOWN_DIGITS_BORDER_RADIUS_DESC="Set the border radius for each digit."
|
||||
ACF_COUNTDOWN_DIGITS_GAP_DESC="Set the gap between the digits."
|
||||
ACF_COUNTDOWN_DIGIT_BACKGROUND_COLOR_DESC="Set the background color of each digit."
|
||||
ACF_COUNTDOWN_TEXT_COLOR="Text Color"
|
||||
ACF_COUNTDOWN_DIGIT_TEXT_COLOR_DESC="Set the text color of each digit."
|
||||
ACF_COUNTDOWN_LABEL_FONT_SIZE_DESC="Set the font size of the labels."
|
||||
ACF_COUNTDOWN_LABEL_FONT_WEIGHT="Label Weight"
|
||||
ACF_COUNTDOWN_LABEL_FONT_WEIGHT_DESC="Set the font weight of the labels."
|
||||
ACF_COUNTDOWN_UNIT_LABEL_COLOR_DESC="Set the text color of the labels appearing below each countdown digit."
|
||||
ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP="Space between label and digits"
|
||||
ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP_DESC="Set the spacing between the label and the countdown digits."
|
||||
ACF_COUNTDOWN_MINS="Mins"
|
||||
ACF_COUNTDOWN_SECS="Secs"
|
||||
ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS="Show Advanced Settings"
|
||||
ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS_DESC="Enable to show advanced settings."
|
||||
ACF_COUNTDOWN_ITEM_PADDING="Item Padding"
|
||||
ACF_COUNTDOWN_ITEM_PADDING_DESC="Set the item's padding."
|
||||
@ -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) 2020 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
ACF_COUNTDOWN="Fields - ACF Countdown"
|
||||
ACF_COUNTDOWN_DESC="Use a countdown timer to create anticipation and scarcity around upcoming events, creating the feeling of scarcity, anticipation, and drive more sales."
|
||||
@ -0,0 +1,108 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2020 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTDOWN_LABEL="ACF - Cuenta Atras"
|
||||
ACF_COUNTDOWN="Campos - ACF Cuenta Atras"
|
||||
ACF_COUNTDOWN_VALUE_DESC="Establezca la fecha de la cuenta regresiva o en dinámico los días/horas/minutos/segundos."
|
||||
ACF_COUNTDOWN_DESC="Use un temporizador de cuenta regresiva para crear anticipación y escasez en torno a los próximos eventos, creando la sensación de escasez, anticipación e impulsando más ventas."
|
||||
ACF_COUNTDOWN_SHOW_MESSAGE="Mostrar mensaje"
|
||||
ACF_COUNTDOWN_SHOW_MESSAGE_DESC="Configure el mensaje que aparecerá una vez que finalice el temporizador."
|
||||
ACF_COUNTDOWN_FINISH_TEXT_DESC="Configure el mensaje que aparecerá una vez finalice la cuenta atrás."
|
||||
ACF_COUNTDOWN_FINISH_TEXT_HINT="Cuenta regresiva finalizada."
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT="Formato Personalizado"
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT_DESC="Usando la opción de <strong>Formato Personalizado</strong>, puede escribir su propio HTML para producir una cuenta regresiva que se ajuste a sus necesidades.<br>Etiquetas Disponibles:<br><br>• {days}<br>• {hours}<br>• {minutes}<br>• {seconds}<br><br>Ejemplo: {minutes}m:{seconds}s producirá una cuenta regresiva con salida: 35m:28s"
|
||||
ACF_COUNTDOWN_CUSTOM_FORMAT_HINT="{days} días, {hours} horas, {minutes} minutos y {seconds} segundos"
|
||||
ACF_COUNTDOWN_COUNTDOWN_TIMER="Temporizador"
|
||||
ACF_COUNTDOWN_ACTION="Expirar una Cuenta Atras"
|
||||
ACF_COUNTDOWN_ACTION_DESC="Seleccione la acción final de la cuenta atras.<br><br><strong>Sin acción:</strong> La cuenta atrás permanecerá una vez finalizada.<br><strong>Ocultar temporizador:</strong> La cuenta atras desaparecerá una vez que finalice.<br><strong>Mostrar mensaje:</strong> Muestra un mensaje una vez que finaliza la cuenta atras.<br><strong>Redirigir a una URL:</strong> Redirige a una URL una vez que finaliza el temporizador."
|
||||
ACF_COUNTDOWN_ACTION_NO_ACTION="Sin acción"
|
||||
ACF_COUNTDOWN_ACTION_HIDE_TIMER="Ocultar temporizador"
|
||||
ACF_COUNTDOWN_ACTION_REDIRECT="Redirigir a URL"
|
||||
ACF_COUNTDOWN_REDIRECT_URL="Redireccionar URL"
|
||||
ACF_COUNTDOWN_REDIRECT_URL_DESC="Configure la URL para redirigir al usuario una vez que finalice la cuenta atras."
|
||||
ACF_COUNTDOWN_REDIRECT_URL_HINT="https://"
|
||||
ACF_COUNTDOWN_PRE_MADE_TEMPLATE="Plantilla Prefabricada"
|
||||
ACF_COUNTDOWN_TEMPLATE="Plantilla"
|
||||
ACF_COUNTDOWN_TEMPLATE_DESC="Seleccione la plantilla de cuenta atrasa que desea usar. Una vez que seleccione una plantilla, la configuración a continuación se actualizará en función de la plantilla seleccionada."
|
||||
ACF_COUNTDOWN_UNIT_DISPLAY="Pantalla de unidad"
|
||||
ACF_COUNTDOWN_DAYS_LABEL="Mostrar Días"
|
||||
ACF_COUNTDOWN_DAYS="Días"
|
||||
ACF_COUNTDOWN_DAYS_DESC="Establezca si mostrar los días."
|
||||
ACF_COUNTDOWN_DAYS_LABEL="Mostrar Días"
|
||||
ACF_COUNTDOWN_DAYS_LABEL_DESC="Establecer la etiqueta de días."
|
||||
ACF_COUNTDOWN_HOURS_LABEL="Mostrar Horas"
|
||||
ACF_COUNTDOWN_HOURS="Horas"
|
||||
ACF_COUNTDOWN_HOURS_DESC="Establezca si mostrar las horas."
|
||||
ACF_COUNTDOWN_HOURS_LABEL="Mostrar Horas"
|
||||
ACF_COUNTDOWN_HOURS_LABEL_DESC="Establecer la etiqueta de horas."
|
||||
ACF_COUNTDOWN_MINUTES_LABEL="Mostrar Minutos"
|
||||
ACF_COUNTDOWN_MINUTES="Minutos"
|
||||
ACF_COUNTDOWN_MINUTES_DESC="Establezca si mostrar minutos."
|
||||
ACF_COUNTDOWN_MINUTES_LABEL="Mostrar Minutos"
|
||||
ACF_COUNTDOWN_MINUTES_LABEL_DESC="Establecer la etiqueta de minutos."
|
||||
ACF_COUNTDOWN_SECONDS_LABEL="Mostrar Segundos"
|
||||
ACF_COUNTDOWN_SECONDS="Segundos"
|
||||
ACF_COUNTDOWN_SECONDS_DESC="Establezca si mostrar segundos"
|
||||
ACF_COUNTDOWN_SECONDS_LABEL="Mostrar Segundos"
|
||||
ACF_COUNTDOWN_SECONDS_LABEL_DESC="Establecer la etiqueta de segundos."
|
||||
ACF_COUNTDOWN_TYPE="Tipo"
|
||||
ACF_COUNTDOWN_TYPE_DESC="Seleccione el tipo de Cuenta Atras.<br><br><strong>Fijo:</strong> Cuenta atrás hasta una fecha y hora específicas. Plazo universal para todos los visitantes.<br><strong>Perenne:</strong> Solución de configurar y olvidar. La cuenta regresiva comienza cuando su visitante ve la oferta. La cuenta regresiva también se reiniciará al finalizar."
|
||||
ACF_COUNTDOWN_TYPE_FIXED="Fecha Fijada"
|
||||
ACF_COUNTDOWN_TYPE_EVERGREEN="Perenne"
|
||||
ACF_COUNTDOWN_TIMEZONE="Zona Horaria"
|
||||
ACF_COUNTDOWN_TIMEZONE_DESC="Seleccione qué zona horaria se utilizará."
|
||||
ACF_COUNTDOWN_TIMEZONE_SERVER="Usar la zona horaria de Joomla"
|
||||
ACF_COUNTDOWN_TIMEZONE_CLIENT="Usar la zona horaria del visitante"
|
||||
ACF_COUNTDOWN_THEME_SETTINGS="Ajustes del Tema"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_COLOR="Color del borde del artículo"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_COLOR_DESC="Establezca el color del borde alrededor de cada elemento de la cuenta atras."
|
||||
ACF_COUNTDOWN_ENABLE_SEPARATOR="Activar Separador"
|
||||
ACF_COUNTDOWN_ENABLE_SEPARATOR_DESC="Configure para mostrar un separador de dos puntos \\\":\\\"."
|
||||
ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT="Habilitar Formato de Número 00"
|
||||
ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT_DESC="Establezca si mostrar los números en formato 0 o 00."
|
||||
ACF_COUNTDOWN_UNIT_ITEM="Unidad del Elemento"
|
||||
ACF_COUNTDOWN_ITEM_SIZE="Tamaño"
|
||||
ACF_COUNTDOWN_ITEM_SIZE_DESC="Establece el ancho y la altura del elemento en píxeles. Deje vacío para ancho automático."
|
||||
ACF_COUNTDOWN_TEMPLATE_SELECTOR_DESC="Seleccione si desea utilizar una plantilla prefabricada o una plantilla personalizada"
|
||||
ACF_COUNTDOWN_TEMPLATE_SELECTOR="Selector de Plantilla"
|
||||
ACF_COUNTDOWN_GAP="Espaciado"
|
||||
ACF_COUNTDOWN_GAP_DESC="Establezca el espacio entre los elementos de la unidad."
|
||||
ACF_COUNTDOWN_BACKGROUND_COLOR="Color de Fondo"
|
||||
ACF_COUNTDOWN_ITEM_BACKGROUND_COLOR_DESC="Establezca el color de fondo del elemento"
|
||||
ACF_COUNTDOWN_UNIT_ITEM_BORDER_CONTROL_DESC="Establezca el borde para el elemento de la unidad (estilo, color y ancho)."
|
||||
ACF_COUNTDOWN_UNIT_DIGITS_CONTAINER="Contenedor de Unidad de Dígitos"
|
||||
ACF_COUNTDOWN_UNIT_DIGIT="Unidad de Digitos"
|
||||
ACF_COUNTDOWN_UNIT_LABEL="Unidad de Etiqueta"
|
||||
ACF_COUNTDOWN_ITEM_BORDER_RADIUS_DESC="Establezca el radio del borde del elemento."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_PADDING_DESC="Establezca el relleno del contenedor de dígitos."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH="Ancho personalizado del contenedor de dígitos"
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH_DESC="Establezca el ancho mínimo del contenedor de dígitos.<br><br><strong>Activado</strong>para establecer un ancho personalizado.<br><strong>Desactivado</strong> Para tamaño automático."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_BACKGROUND_COLOR_DESC="Establezca el color de fondo del contenedor de dígitos."
|
||||
ACF_COUNTDOWN_DIGITS_FONT_SIZE_DESC="Establezca el tamaño de la fuente de los dígitos."
|
||||
ACF_COUNTDOWN_DIGITS_FONT_WEIGHT="Peso de fuente"
|
||||
ACF_COUNTDOWN_DIGITS_FONT_WEIGHT_DESC="Establezca el peso de la fuente de los dígitos."
|
||||
ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH="Ancho Personalizado de Dígitos"
|
||||
ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH_DESC="Configure el ancho mínimo de los dígitos.<br><br><strong>Activado</strong> para establecer un ancho personalizado.<br><strong>Desactivado</strong> para tamaño automático."
|
||||
ACF_COUNTDOWN_DIGITS_PADDING_DESC="Establecer el relleno para cada dígito."
|
||||
ACF_COUNTDOWN_DIGITS_CONTAINER_BORDER_RADIUS_DESC="Establezca el radio del borde para el contenedor de dígitos."
|
||||
ACF_COUNTDOWN_DIGITS_BORDER_RADIUS_DESC="Establezca el radio del borde para cada dígito."
|
||||
ACF_COUNTDOWN_DIGITS_GAP_DESC="Establezca el espacio entre los dígitos."
|
||||
ACF_COUNTDOWN_DIGIT_BACKGROUND_COLOR_DESC="Establezca el color de fondo de cada dígito."
|
||||
ACF_COUNTDOWN_TEXT_COLOR="Color del Texto"
|
||||
ACF_COUNTDOWN_DIGIT_TEXT_COLOR_DESC="Establece el color del texto de cada dígito."
|
||||
ACF_COUNTDOWN_LABEL_FONT_SIZE_DESC="Establezca el tamaño de fuente de las etiquetas."
|
||||
ACF_COUNTDOWN_LABEL_FONT_WEIGHT="Peso de la Etiqueta"
|
||||
ACF_COUNTDOWN_LABEL_FONT_WEIGHT_DESC="Establezca el peso de la fuente de las etiquetas."
|
||||
ACF_COUNTDOWN_UNIT_LABEL_COLOR_DESC="Establezca el color del texto de las etiquetas que aparecen debajo de cada dígito de la cuenta regresiva."
|
||||
ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP="Espacio entre la etiqueta y los dígitos"
|
||||
ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP_DESC="Configure el espacio entre la etiqueta y los dígitos de la cuenta atras."
|
||||
ACF_COUNTDOWN_MINS="Minutos"
|
||||
ACF_COUNTDOWN_SECS="Segundos"
|
||||
ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS="Mostrar Ajustes Avanzados"
|
||||
ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS_DESC="Habilite para mostrar la configuración avanzada."
|
||||
ACF_COUNTDOWN_ITEM_PADDING="Relleno de Artículos"
|
||||
ACF_COUNTDOWN_ITEM_PADDING_DESC="Establezca el relleno del elemento."
|
||||
@ -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) 2020 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
ACF_COUNTDOWN="Campos - ACF Cuenta Atras"
|
||||
ACF_COUNTDOWN_DESC="Use un temporizador de cuenta regresiva para crear anticipación y escasez en torno a los próximos eventos, creando la sensación de escasez, anticipación e impulsando más ventas."
|
||||
417
plugins/fields/acfcountdown/params/acfcountdown.xml
Normal file
417
plugins/fields/acfcountdown/params/acfcountdown.xml
Normal file
@ -0,0 +1,417 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field name="advanced_settings" type="nrtoggle"
|
||||
label="ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS"
|
||||
description="ACF_COUNTDOWN_SHOW_ADVANCED_SETTINGS_DESC"
|
||||
/>
|
||||
<!-- Timer -->
|
||||
<field name="a" type="spacer" class="acf" label="ACF_COUNTDOWN_COUNTDOWN_TIMER" />
|
||||
<field name="countdown_type" type="radio"
|
||||
label="ACF_COUNTDOWN_TYPE"
|
||||
description="ACF_COUNTDOWN_TYPE_DESC"
|
||||
default="static"
|
||||
class="btn-group btn-group-yesno"
|
||||
required="true">
|
||||
<option value="static">ACF_COUNTDOWN_TYPE_FIXED</option>
|
||||
<option value="evergreen">ACF_COUNTDOWN_TYPE_EVERGREEN</option>
|
||||
</field>
|
||||
<field name="timezone" type="list"
|
||||
label="ACF_COUNTDOWN_TIMEZONE"
|
||||
description="ACF_COUNTDOWN_TIMEZONE_DESC"
|
||||
default="server"
|
||||
showon="countdown_type:static"
|
||||
required="true">
|
||||
<option value="server">ACF_COUNTDOWN_TIMEZONE_SERVER</option>
|
||||
<option value="client">ACF_COUNTDOWN_TIMEZONE_CLIENT</option>
|
||||
</field>
|
||||
<field name="action" type="list"
|
||||
label="ACF_COUNTDOWN_ACTION"
|
||||
description="ACF_COUNTDOWN_ACTION_DESC"
|
||||
class="tfHasChosen"
|
||||
showon="countdown_type:static"
|
||||
default="keep">
|
||||
<option value="keep">ACF_COUNTDOWN_ACTION_NO_ACTION</option>
|
||||
<option value="hide">ACF_COUNTDOWN_ACTION_HIDE_TIMER</option>
|
||||
<option value="message">ACF_COUNTDOWN_SHOW_MESSAGE</option>
|
||||
<option value="redirect">ACF_COUNTDOWN_ACTION_REDIRECT</option>
|
||||
</field>
|
||||
<field name="finish_text" type="textarea"
|
||||
label="ACF_COUNTDOWN_SHOW_MESSAGE"
|
||||
description="ACF_COUNTDOWN_SHOW_MESSAGE_DESC"
|
||||
hint="ACF_COUNTDOWN_FINISH_TEXT_HINT"
|
||||
rows="5"
|
||||
filter="raw"
|
||||
class="input-xxlarge"
|
||||
showon="action:message[AND]countdown_type:static"
|
||||
/>
|
||||
<field name="redirect_url" type="text"
|
||||
label="ACF_COUNTDOWN_REDIRECT_URL"
|
||||
description="ACF_COUNTDOWN_REDIRECT_URL_DESC"
|
||||
hint="ACF_COUNTDOWN_REDIRECT_URL_HINT"
|
||||
showon="action:redirect[AND]countdown_type:static"
|
||||
/>
|
||||
<!-- Template Selector -->
|
||||
<field name="b" type="spacer" class="acf" label="ACF_COUNTDOWN_TEMPLATE_SELECTOR" />
|
||||
<field name="preset_source" type="radio"
|
||||
label="ACF_COUNTDOWN_TYPE"
|
||||
description="ACF_COUNTDOWN_TEMPLATE_SELECTOR_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="preset">
|
||||
<option value="preset">ACF_COUNTDOWN_TEMPLATE</option>
|
||||
<option value="custom">NR_CUSTOM</option>
|
||||
</field>
|
||||
<field name="preset" type="NRImagesSelector"
|
||||
images="/media/plg_fields_acfcountdown/img"
|
||||
class="acf-countdown-preset-selector"
|
||||
width="800px"
|
||||
height="110px"
|
||||
columns="2"
|
||||
required="true"
|
||||
default="2"
|
||||
label="ACF_COUNTDOWN_TEMPLATE"
|
||||
key_type="filename"
|
||||
description="ACF_COUNTDOWN_TEMPLATE_DESC"
|
||||
showon="preset_source:preset"
|
||||
/>
|
||||
<field name="format" type="textarea"
|
||||
label="ACF_COUNTDOWN_CUSTOM_FORMAT"
|
||||
description="ACF_COUNTDOWN_CUSTOM_FORMAT_DESC"
|
||||
default="{days} days, {hours} hours, {minutes} minutes and {seconds} seconds"
|
||||
rows="5"
|
||||
filter="raw"
|
||||
hint="ACF_COUNTDOWN_CUSTOM_FORMAT_HINT"
|
||||
showon="preset_source:custom"
|
||||
class="input-xxlarge"
|
||||
/>
|
||||
<!-- Unit Display -->
|
||||
<field name="c" type="spacer" class="acf" label="ACF_COUNTDOWN_UNIT_DISPLAY" />
|
||||
<!-- Days -->
|
||||
<field name="days" type="nrtoggle"
|
||||
label="ACF_COUNTDOWN_DAYS"
|
||||
description="ACF_COUNTDOWN_DAYS_DESC"
|
||||
checked="true"
|
||||
showon="preset_source:preset"
|
||||
/>
|
||||
<field name="days_label" type="text"
|
||||
label="ACF_COUNTDOWN_DAYS_LABEL"
|
||||
description="ACF_COUNTDOWN_DAYS_LABEL_DESC"
|
||||
default="Days"
|
||||
hint="ACF_COUNTDOWN_DAYS"
|
||||
showon="preset_source:preset[AND]days:1"
|
||||
/>
|
||||
<!-- Hours -->
|
||||
<field name="hours" type="nrtoggle"
|
||||
label="ACF_COUNTDOWN_HOURS"
|
||||
description="ACF_COUNTDOWN_HOURS_DESC"
|
||||
checked="true"
|
||||
showon="preset_source:preset"
|
||||
/>
|
||||
<field name="hours_label" type="text"
|
||||
label="ACF_COUNTDOWN_HOURS_LABEL"
|
||||
description="ACF_COUNTDOWN_HOURS_LABEL_DESC"
|
||||
default="Hours"
|
||||
hint="ACF_COUNTDOWN_HOURS"
|
||||
showon="preset_source:preset[AND]hours:1"
|
||||
/>
|
||||
<!-- Minutes -->
|
||||
<field name="minutes" type="nrtoggle"
|
||||
label="ACF_COUNTDOWN_MINUTES"
|
||||
description="ACF_COUNTDOWN_MINUTES_DESC"
|
||||
checked="true"
|
||||
showon="preset_source:preset"
|
||||
/>
|
||||
<field name="minutes_label" type="text"
|
||||
label="ACF_COUNTDOWN_MINUTES_LABEL"
|
||||
description="ACF_COUNTDOWN_MINUTES_LABEL_DESC"
|
||||
default="Mins"
|
||||
hint="ACF_COUNTDOWN_MINUTES"
|
||||
showon="preset_source:preset[AND]minutes:1"
|
||||
/>
|
||||
<!-- Seconds -->
|
||||
<field name="seconds" type="nrtoggle"
|
||||
label="ACF_COUNTDOWN_SECONDS"
|
||||
description="ACF_COUNTDOWN_SECONDS_DESC"
|
||||
checked="true"
|
||||
showon="preset_source:preset"
|
||||
/>
|
||||
<field name="seconds_label" type="text"
|
||||
label="ACF_COUNTDOWN_SECONDS_LABEL"
|
||||
description="ACF_COUNTDOWN_SECONDS_LABEL_DESC"
|
||||
default="Secs"
|
||||
hint="ACF_COUNTDOWN_SECONDS"
|
||||
showon="preset_source:preset[AND]seconds:1"
|
||||
/>
|
||||
<field name="separator" type="nrtoggle"
|
||||
checked="true"
|
||||
label="ACF_COUNTDOWN_ENABLE_SEPARATOR"
|
||||
description="ACF_COUNTDOWN_ENABLE_SEPARATOR_DESC"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
/>
|
||||
<field name="double_zeroes_format" type="nrtoggle"
|
||||
checked="true"
|
||||
label="ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT"
|
||||
description="ACF_COUNTDOWN_DOUBLE_ZEROES_FORMAT_DESC"
|
||||
showon="advanced_settings:1"
|
||||
/>
|
||||
<!-- Unit Item -->
|
||||
<field name="d" type="spacer" class="acf" label="ACF_COUNTDOWN_UNIT_ITEM" showon="preset_source:preset[AND]preset!:1" />
|
||||
<field name="item_size_responsive" type="NRResponsiveControl"
|
||||
label="ACF_COUNTDOWN_ITEM_SIZE"
|
||||
description="ACF_COUNTDOWN_ITEM_SIZE_DESC"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1">
|
||||
<subform>
|
||||
<field name="item_size" type="number"
|
||||
class="input-small"
|
||||
min="0"
|
||||
hint="90"
|
||||
max="999" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="item_gap" type="NRResponsiveControl"
|
||||
label="ACF_COUNTDOWN_GAP"
|
||||
description="ACF_COUNTDOWN_GAP_DESC"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
default='{"desktop": {"gap": 10}}'
|
||||
>
|
||||
<subform>
|
||||
<field name="gap" type="number"
|
||||
class="input-small"
|
||||
hint="20"
|
||||
min="0"
|
||||
max="999" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="item_padding_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
label="ACF_COUNTDOWN_ITEM_PADDING"
|
||||
description="ACF_COUNTDOWN_ITEM_PADDING_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="item_padding"
|
||||
type="TFDimensionControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="item_background_color" type="color"
|
||||
label="ACF_COUNTDOWN_BACKGROUND_COLOR"
|
||||
description="ACF_COUNTDOWN_ITEM_BACKGROUND_COLOR_DESC"
|
||||
keywords="transparent,none"
|
||||
format="rgba"
|
||||
position="bottom"
|
||||
showon="preset_source:preset[AND]preset!:1"
|
||||
/>
|
||||
<field name="border" type="TFBorderControl"
|
||||
label="NR_BORDER"
|
||||
description="ACF_COUNTDOWN_UNIT_ITEM_BORDER_CONTROL_DESC"
|
||||
inline="true"
|
||||
hide_labels="true"
|
||||
control_group_class="nr-hide-control-group-label"
|
||||
default_width="1"
|
||||
default_color="#333"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
/>
|
||||
<field name="item_border_radius_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
label="NR_BORDER_RADIUS"
|
||||
description="ACF_COUNTDOWN_ITEM_BORDER_RADIUS_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="item_border_radius"
|
||||
type="TFBorderRadiusControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<!-- Unit Digits Container -->
|
||||
<field name="e" type="spacer" class="acf" label="ACF_COUNTDOWN_UNIT_DIGITS_CONTAINER" showon="preset_source:preset" />
|
||||
<field name="digits_wrapper_padding_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_PADDING"
|
||||
description="ACF_COUNTDOWN_DIGITS_CONTAINER_PADDING_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_wrapper_padding"
|
||||
type="TFDimensionControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digits_wrapper_border_radius_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_BORDER_RADIUS"
|
||||
description="ACF_COUNTDOWN_DIGITS_CONTAINER_BORDER_RADIUS_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_wrapper_border_radius"
|
||||
type="TFBorderRadiusControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digits_wrapper_background_color" type="color"
|
||||
showon="preset_source:preset"
|
||||
label="ACF_COUNTDOWN_BACKGROUND_COLOR"
|
||||
description="ACF_COUNTDOWN_DIGITS_CONTAINER_BACKGROUND_COLOR_DESC"
|
||||
keywords="transparent,none"
|
||||
format="rgba"
|
||||
position="bottom"
|
||||
/>
|
||||
<field name="digits_container_custom_width_row_start"
|
||||
label="ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH"
|
||||
description="ACF_COUNTDOWN_DIGITS_CONTAINER_CUSTOM_WIDTH_DESC"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
type="nr_inline" />
|
||||
<field name="digits_wrapper_custom_width" type="NRToggle"
|
||||
checked="true"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
hiddenLabel="true"
|
||||
/>
|
||||
<field name="digits_wrapper_min_width" type="nrnumber"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]digits_wrapper_custom_width:1"
|
||||
default="50"
|
||||
hint="50"
|
||||
hiddenLabel="true"
|
||||
class="input-small"
|
||||
addon="px"
|
||||
/>
|
||||
<field name="digits_container_custom_width_row_end" type="nr_inline" end="1" showon="advanced_settings:1[AND]preset_source:preset" />
|
||||
<!-- Unit Digit -->
|
||||
<field name="f" type="spacer" class="acf" label="ACF_COUNTDOWN_UNIT_DIGIT" showon="preset_source:preset" />
|
||||
<field name="digits_font_size_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_FONT_SIZE"
|
||||
default='{"desktop": {"digits_font_size": 30}}'
|
||||
description="ACF_COUNTDOWN_DIGITS_FONT_SIZE_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_font_size"
|
||||
type="nrnumber"
|
||||
hint="30"
|
||||
class="input-small"
|
||||
addon="px" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digits_font_weight" type="list"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="ACF_COUNTDOWN_DIGITS_FONT_WEIGHT"
|
||||
description="ACF_COUNTDOWN_DIGITS_FONT_WEIGHT_DESC"
|
||||
class="tfHasChosen"
|
||||
default="500">
|
||||
<option value="300">300</option>
|
||||
<option value="400">400</option>
|
||||
<option value="500">500</option>
|
||||
<option value="600">600</option>
|
||||
<option value="700">700</option>
|
||||
</field>
|
||||
<field name="digits_padding_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_PADDING"
|
||||
description="ACF_COUNTDOWN_DIGITS_PADDING_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_padding"
|
||||
type="TFDimensionControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digits_border_radius_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_BORDER_RADIUS"
|
||||
description="ACF_COUNTDOWN_DIGITS_BORDER_RADIUS_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_border_radius"
|
||||
type="TFBorderRadiusControl" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digits_gap_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="ACF_COUNTDOWN_GAP"
|
||||
description="ACF_COUNTDOWN_DIGITS_GAP_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="digits_gap"
|
||||
hint="0"
|
||||
type="nrnumber"
|
||||
class="input-small"
|
||||
addon="px" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="digit_background_color" type="color"
|
||||
showon="preset_source:preset"
|
||||
label="ACF_COUNTDOWN_BACKGROUND_COLOR"
|
||||
description="ACF_COUNTDOWN_DIGIT_BACKGROUND_COLOR_DESC"
|
||||
keywords="transparent,none"
|
||||
format="rgba"
|
||||
position="bottom"
|
||||
/>
|
||||
<field name="digit_text_color" type="color"
|
||||
showon="preset_source:preset"
|
||||
label="ACF_COUNTDOWN_TEXT_COLOR"
|
||||
description="ACF_COUNTDOWN_DIGIT_TEXT_COLOR_DESC"
|
||||
keywords="transparent,none"
|
||||
default="#41495b"
|
||||
format="rgba"
|
||||
position="bottom"
|
||||
/>
|
||||
<field name="digits_custom_width_row_start"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH"
|
||||
description="ACF_COUNTDOWN_DIGITS_CUSTOM_WIDTH_DESC"
|
||||
type="nr_inline" />
|
||||
<field name="digits_custom_width" type="NRToggle"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
hiddenLabel="true"
|
||||
/>
|
||||
<field name="digits_min_width" type="nrnumber"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]digits_custom_width:1"
|
||||
hiddenLabel="true"
|
||||
hint="20"
|
||||
class="input-small"
|
||||
addon="px"
|
||||
/>
|
||||
<field name="digits_custom_width_row_end" type="nr_inline" end="1" showon="advanced_settings:1[AND]preset_source:preset" />
|
||||
<!-- Unit Label -->
|
||||
<field name="g" type="spacer" class="acf" label="ACF_COUNTDOWN_UNIT_LABEL" showon="preset_source:preset" />
|
||||
<field name="label_font_size_control" type="NRResponsiveControl"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="NR_FONT_SIZE"
|
||||
default='{"desktop": {"label_font_size": 15}}'
|
||||
description="ACF_COUNTDOWN_LABEL_FONT_SIZE_DESC">
|
||||
<subform>
|
||||
<field
|
||||
name="label_font_size"
|
||||
type="nrnumber"
|
||||
hint="15"
|
||||
class="input-small"
|
||||
addon="px" />
|
||||
</subform>
|
||||
</field>
|
||||
<field name="label_font_weight" type="list"
|
||||
showon="advanced_settings:1[AND]preset_source:preset"
|
||||
label="ACF_COUNTDOWN_LABEL_FONT_WEIGHT"
|
||||
description="ACF_COUNTDOWN_LABEL_FONT_WEIGHT_DESC"
|
||||
class="tfHasChosen"
|
||||
default="400">
|
||||
<option value="300">300</option>
|
||||
<option value="400">400</option>
|
||||
<option value="500">500</option>
|
||||
<option value="600">600</option>
|
||||
<option value="700">700</option>
|
||||
</field>
|
||||
<field name="unit_label_margin_top" type="nrnumber"
|
||||
showon="advanced_settings:1[AND]preset_source:preset[AND]preset!:1"
|
||||
label="ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP"
|
||||
description="ACF_COUNTDOWN_UNIT_LABEL_MARGIN_TOP_DESC"
|
||||
class="input-small"
|
||||
addon="px"
|
||||
hint="9"
|
||||
default="9"
|
||||
/>
|
||||
<field name="unit_label_text_color" type="color"
|
||||
showon="preset_source:preset"
|
||||
label="ACF_COUNTDOWN_TEXT_COLOR"
|
||||
description="ACF_COUNTDOWN_UNIT_LABEL_COLOR_DESC"
|
||||
keywords="transparent,none"
|
||||
default="#41495b"
|
||||
format="rgba"
|
||||
position="bottom"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
|
||||
691
plugins/fields/acfcountdown/script.install.helper.php
Normal file
691
plugins/fields/acfcountdown/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 PlgFieldsAcfcountdownInstallerScriptHelper
|
||||
{
|
||||
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/acfcountdown/script.install.php
Normal file
23
plugins/fields/acfcountdown/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 © 2020 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 PlgFieldsACFCountdownInstallerScript extends PlgFieldsACFCountdownInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfcountdown';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
}
|
||||
110
plugins/fields/acfcountdown/tmpl/acfcountdown.php
Normal file
110
plugins/fields/acfcountdown/tmpl/acfcountdown.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?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;
|
||||
|
||||
if (!$value = $field->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_string($value) && !$value = json_decode($value, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$countdown_action = $fieldParams->get('action', 'keep');
|
||||
$countdown_type = $fieldParams->get('countdown_type', 'static');
|
||||
|
||||
// Evergreen provides extra actions, allow to override the action on item editing page
|
||||
if ($countdown_type === 'evergreen')
|
||||
{
|
||||
$countdown_action = 'restart';
|
||||
}
|
||||
|
||||
$preset_source = $fieldParams->get('preset_source', 'preset');
|
||||
$preset = $fieldParams->get('preset', '1');
|
||||
|
||||
// Determine theme
|
||||
$theme = $preset_source === 'custom' ? 'custom' : ($preset === '8' ? 'oneline' : 'default');
|
||||
|
||||
$payload = [
|
||||
// Field values
|
||||
'countdown_type' => $countdown_type,
|
||||
'value' => isset($value['value']) ? $value['value'] : null,
|
||||
'timezone' => $fieldParams->get('timezone', 'server'),
|
||||
'dynamic_days' => isset($value['dynamic_days']) ? $value['dynamic_days'] : null,
|
||||
'dynamic_hours' => isset($value['dynamic_hours']) ? $value['dynamic_hours'] : null,
|
||||
'dynamic_minutes' => isset($value['dynamic_minutes']) ? $value['dynamic_minutes'] : null,
|
||||
'dynamic_seconds' => isset($value['dynamic_seconds']) ? $value['dynamic_seconds'] : null,
|
||||
|
||||
// Countdown End Action
|
||||
'finish_text' => $fieldParams->get('finish_text', ''),
|
||||
'redirect_url' => $fieldParams->get('redirect_url', ''),
|
||||
'countdown_action' => $countdown_action,
|
||||
|
||||
// Preset
|
||||
'theme' => $theme,
|
||||
'format' => $fieldParams->get('format', ''),
|
||||
|
||||
// Unit Display
|
||||
'days' => $fieldParams->get('days') === '1',
|
||||
'days_label' => $fieldParams->get('days_label'),
|
||||
'hours' => $fieldParams->get('hours') === '1',
|
||||
'hours_label' => $fieldParams->get('hours_label'),
|
||||
'minutes' => $fieldParams->get('minutes') === '1',
|
||||
'minutes_label' => $fieldParams->get('minutes_label'),
|
||||
'seconds' => $fieldParams->get('seconds') === '1',
|
||||
'seconds_label' => $fieldParams->get('seconds_label'),
|
||||
'separator' => $fieldParams->get('separator') === '1',
|
||||
'double_zeroes_format' => $fieldParams->get('double_zeroes_format') === '1',
|
||||
|
||||
// Unit Item
|
||||
'item_size' => $fieldParams->get('item_size_responsive.item_size'),
|
||||
'item_padding' => $fieldParams->get('item_padding_control.item_padding'),
|
||||
'gap' => $fieldParams->get('item_gap.gap'),
|
||||
'item_border_style' => $fieldParams->get('border.style'),
|
||||
'item_border_width' => $fieldParams->get('border.width'),
|
||||
'item_border_color' => $fieldParams->get('border.color'),
|
||||
'item_background_color' => $fieldParams->get('item_background_color'),
|
||||
'item_border_radius' => $fieldParams->get('item_border_radius_control.item_border_radius'),
|
||||
|
||||
// Unit Digits Container
|
||||
'digits_wrapper_min_width' => $fieldParams->get('digits_wrapper_custom_width') === '1' ? $fieldParams->get('digits_wrapper_min_width') : null,
|
||||
'digits_wrapper_padding' => $fieldParams->get('digits_wrapper_padding_control.digits_wrapper_padding'),
|
||||
'digits_wrapper_border_radius' => $fieldParams->get('digits_wrapper_border_radius_control.digits_wrapper_border_radius'),
|
||||
'digits_wrapper_background_color' => $fieldParams->get('digits_wrapper_background_color'),
|
||||
|
||||
// Unit Digit
|
||||
'digits_font_size' => $fieldParams->get('digits_font_size_control.digits_font_size'),
|
||||
'digits_font_weight' => $fieldParams->get('digits_font_weight'),
|
||||
'digit_min_width' => $fieldParams->get('digits_custom_width') === '1' ? $fieldParams->get('digits_min_width') : null,
|
||||
'digits_padding' => $fieldParams->get('digits_padding_control.digits_padding'),
|
||||
'digit_border_radius' => $fieldParams->get('digits_border_radius_control.digits_border_radius'),
|
||||
'digits_gap' => $fieldParams->get('digits_gap_control.digits_gap'),
|
||||
'digit_background_color' => $fieldParams->get('digit_background_color'),
|
||||
'digit_text_color' => $fieldParams->get('digit_text_color'),
|
||||
|
||||
// Unit Label
|
||||
'label_font_size' => $fieldParams->get('label_font_size_control.label_font_size'),
|
||||
'label_font_weight' => $fieldParams->get('label_font_weight'),
|
||||
'unit_label_margin_top' => $fieldParams->get('unit_label_margin_top'),
|
||||
'unit_label_text_color' => $fieldParams->get('unit_label_text_color'),
|
||||
];
|
||||
|
||||
// Set custom layout
|
||||
if ($field->params->get('acf_layout_override'))
|
||||
{
|
||||
$payload['layout'] = $field->params->get('acf_layout_override');
|
||||
}
|
||||
|
||||
echo \NRFramework\Widgets\Helper::render('Countdown', $payload);
|
||||
16
plugins/fields/acfcountdown/version.php
Normal file
16
plugins/fields/acfcountdown/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 © 2020 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";
|
||||
|
||||
?>
|
||||
137
plugins/fields/acfcountry/acfcountry.php
Normal file
137
plugins/fields/acfcountry/acfcountry.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?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 PlgFieldsACFCountry extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Override the field type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $overrideType = 'NR_Geo';
|
||||
|
||||
/**
|
||||
* Update the label of the field in filters.
|
||||
*
|
||||
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
|
||||
*
|
||||
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
|
||||
*/
|
||||
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
|
||||
{
|
||||
// Make sure it is a field of that type
|
||||
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (!$country = \NRFramework\Countries::getCountry($option->getValue()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($country['name']);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
|
||||
*
|
||||
* @param stdClass $field The field.
|
||||
* @param DOMElement $parent The field node parent.
|
||||
* @param Form $form The form.
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onCustomFieldsPrepareDom($field, DOMElement $parent, Joomla\CMS\Form\Form $form)
|
||||
{
|
||||
if (!$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form))
|
||||
{
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
$fieldNode->setAttribute('layout', 'joomla.form.field.list-fancy-select');
|
||||
|
||||
$fieldNode->setAttribute('multiple', (bool) $field->fieldparams->get('multiple_selection', false));
|
||||
$fieldNode->setAttribute('detect_visitor_country', (bool) $field->fieldparams->get('detect_visitor_country', false));
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the field value for the (front-end) layout
|
||||
*
|
||||
* @param string $context The context.
|
||||
* @param stdclass $item The item.
|
||||
* @param stdclass $field The field.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onCustomFieldsPrepareField($context, $item, $field)
|
||||
{
|
||||
// Check if the field should be processed by us
|
||||
if (!$this->isTypeSupported($field->type))
|
||||
{
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
|
||||
$countries = $field->value;
|
||||
|
||||
if (!is_array($countries))
|
||||
{
|
||||
$countries = [$countries];
|
||||
}
|
||||
|
||||
if ($field->fieldparams->get('countrydisplay', 'name') == 'name')
|
||||
{
|
||||
if (!is_array($countries))
|
||||
{
|
||||
$countries = [$countries];
|
||||
}
|
||||
|
||||
$countries_temp = [];
|
||||
|
||||
foreach ($countries as $c)
|
||||
{
|
||||
if (!$country = \NRFramework\Countries::getCountry($c))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$countries_temp[] = $country['name'];
|
||||
}
|
||||
|
||||
$countries = $countries_temp;
|
||||
}
|
||||
|
||||
$field->value = implode (', ', $countries);
|
||||
|
||||
return parent::onCustomFieldsPrepareField($context, $item, $field);
|
||||
}
|
||||
}
|
||||
21
plugins/fields/acfcountry/acfcountry.xml
Normal file
21
plugins/fields/acfcountry/acfcountry.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_COUNTRY</name>
|
||||
<description>ACF_COUNTRY_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>April 2017</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="acfcountry">acfcountry.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>params</folder>
|
||||
<folder>tmpl</folder>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
</extension>
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - País"
|
||||
ACF_COUNTRY="Camps - ACF País"
|
||||
ACF_COUNTRY_DESC="Mostra el nom o el codi del país"
|
||||
ACF_COUNTRY_NAME="Nom del país"
|
||||
ACF_COUNTRY_CODE="Codi de país"
|
||||
ACF_COUNTRY_VALUE_DESC="Escull un país del llistat"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Land"
|
||||
ACF_COUNTRY="Felter - ACF Land"
|
||||
ACF_COUNTRY_DESC="Vis landenavn eller landekodecountry name or country code"
|
||||
ACF_COUNTRY_NAME="Landenavn"
|
||||
ACF_COUNTRY_CODE="LandekodeCode"
|
||||
ACF_COUNTRY_VALUE_DESC="Vælg et land fra listena Country from the list"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Land"
|
||||
ACF_COUNTRY="Felder - ACF-Land"
|
||||
ACF_COUNTRY_DESC="Ländernamen oder Ländercode anzeigen"
|
||||
ACF_COUNTRY_NAME="Ländername"
|
||||
ACF_COUNTRY_CODE="Ländercode"
|
||||
ACF_COUNTRY_VALUE_DESC="Wählen Sie ein Land aus der Liste"
|
||||
@ -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_ACFCOUNTRY_LABEL="ACF - Country"
|
||||
ACF_COUNTRY="Fields - ACF Country"
|
||||
ACF_COUNTRY_DESC="Select a country from a list in the back-end and display the country name or country code in the front-end."
|
||||
ACF_COUNTRY_NAME="Country Name"
|
||||
ACF_COUNTRY_CODE="Country Code"
|
||||
ACF_COUNTRY_VALUE_DESC="Select a Country from the list"
|
||||
ACF_COUNTRY_DETECT_VISITOR_COUNTRY="Detect Visitor Country"
|
||||
ACF_COUNTRY_DETECT_VISITOR_COUNTRY_DESC="If enabled, the field will try to detect and prefill the visitor's country.<br><br>It requires the TGeoIP plugin to be installed."
|
||||
ACF_COUNTRY_MULTIPLE_SELECTION="Multiple Country Selection"
|
||||
ACF_COUNTRY_MULTIPLE_SELECTION_DESC="Allow selection of multiple countries."
|
||||
@ -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_COUNTRY="Fields - ACF Country"
|
||||
ACF_COUNTRY_DESC="Select a country from a list in the back-end and display the country name or country code in the front-end."
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="País - ACF"
|
||||
ACF_COUNTRY="Campos - ACF País"
|
||||
ACF_COUNTRY_DESC="Mostrar el nombre del país o el código del país "
|
||||
ACF_COUNTRY_NAME="Nombre del país"
|
||||
ACF_COUNTRY_CODE="Código de país "
|
||||
ACF_COUNTRY_VALUE_DESC="Selecciona un país de la lista"
|
||||
@ -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_COUNTRY="Campos - ACF País"
|
||||
ACF_COUNTRY_DESC="Seleccione un país de una lista en el back-end y muestre el nombre del país o el código del país en el front-end."
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Pays"
|
||||
ACF_COUNTRY="Champs - Pays ACF"
|
||||
ACF_COUNTRY_DESC="Afficher le nom ou le code du pays"
|
||||
ACF_COUNTRY_NAME="Nom du pays"
|
||||
ACF_COUNTRY_CODE="Code du pays"
|
||||
ACF_COUNTRY_VALUE_DESC="Sélectionnez un pays dans la liste"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Stato"
|
||||
ACF_COUNTRY="Campi - ACF Stato"
|
||||
ACF_COUNTRY_DESC="Visualizza il nome o il codice dello stato"
|
||||
ACF_COUNTRY_NAME="Nome Stato"
|
||||
ACF_COUNTRY_CODE="Codice Stato"
|
||||
ACF_COUNTRY_VALUE_DESC="Seleziona un Paese dall'elenco"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Land"
|
||||
ACF_COUNTRY="Velden - ACF Land"
|
||||
ACF_COUNTRY_DESC="Toon de landnaam of het landcode"
|
||||
ACF_COUNTRY_NAME="Naam van het land"
|
||||
ACF_COUNTRY_CODE="Land Code"
|
||||
ACF_COUNTRY_VALUE_DESC="Selecteer een land uit de lijst"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - País"
|
||||
ACF_COUNTRY="Campos - ACF País"
|
||||
ACF_COUNTRY_DESC="Exibe o nome do país ou código do país."
|
||||
ACF_COUNTRY_NAME="Nome do País"
|
||||
ACF_COUNTRY_CODE="Código do País"
|
||||
; ACF_COUNTRY_VALUE_DESC="Select a Country from the list"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Страна"
|
||||
ACF_COUNTRY="Поля - Страна ACF"
|
||||
ACF_COUNTRY_DESC="Показать название страны или код страны"
|
||||
ACF_COUNTRY_NAME="Название страны"
|
||||
ACF_COUNTRY_CODE="Код страны"
|
||||
ACF_COUNTRY_VALUE_DESC="Выберите страну из списка"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Land"
|
||||
ACF_COUNTRY="Fält - ACF Land"
|
||||
ACF_COUNTRY_DESC="Visa landsnamn eller landskod"
|
||||
ACF_COUNTRY_NAME="Land namn"
|
||||
ACF_COUNTRY_CODE="Landskod"
|
||||
ACF_COUNTRY_VALUE_DESC="Välj ett land från listan"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
; PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - Country"
|
||||
; ACF_COUNTRY="Fields - ACF Country"
|
||||
ACF_COUNTRY_DESC="Ülke adını veya ülke kodunu göster"
|
||||
; ACF_COUNTRY_NAME="Country Name"
|
||||
; ACF_COUNTRY_CODE="Country Code"
|
||||
; ACF_COUNTRY_VALUE_DESC="Select a Country from the list"
|
||||
@ -0,0 +1,13 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCOUNTRY_LABEL="ACF - країна"
|
||||
ACF_COUNTRY="Поля - країна ACF"
|
||||
ACF_COUNTRY_DESC="Відобразити назву країни або код країни"
|
||||
ACF_COUNTRY_NAME="Назва країни"
|
||||
ACF_COUNTRY_CODE="Код країни"
|
||||
ACF_COUNTRY_VALUE_DESC="Вибрати країну зі списку"
|
||||
25
plugins/fields/acfcountry/params/acfcountry.xml
Normal file
25
plugins/fields/acfcountry/params/acfcountry.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field name="countrydisplay" type="list"
|
||||
label="ACF_RETURN_VALUE"
|
||||
description="ACF_RETURN_VALUE_DESC"
|
||||
default="name">
|
||||
<option value="name">ACF_COUNTRY_NAME</option>
|
||||
<option value="code">ACF_COUNTRY_CODE</option>
|
||||
</field>
|
||||
<field name="multiple_selection" type="nrtoggle"
|
||||
label="ACF_COUNTRY_MULTIPLE_SELECTION"
|
||||
description="ACF_COUNTRY_MULTIPLE_SELECTION_DESC"
|
||||
/>
|
||||
|
||||
<field name="detect_visitor_country" type="nrtoggle"
|
||||
label="ACF_COUNTRY_DETECT_VISITOR_COUNTRY"
|
||||
description="ACF_COUNTRY_DETECT_VISITOR_COUNTRY_DESC"
|
||||
/>
|
||||
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
691
plugins/fields/acfcountry/script.install.helper.php
Normal file
691
plugins/fields/acfcountry/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 PlgFieldsAcfcountryInstallerScriptHelper
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
plugins/fields/acfcountry/script.install.php
Normal file
42
plugins/fields/acfcountry/script.install.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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');
|
||||
|
||||
use Joomla\Filesystem\File;
|
||||
|
||||
require_once __DIR__ . '/script.install.helper.php';
|
||||
|
||||
class PlgFieldsACFCountryInstallerScript extends PlgFieldsACFCountryInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfcountry';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
// Fix missing version.php
|
||||
if ($this->isInstalled() && !file_exists($this->getMainFolder() . '/version.php'))
|
||||
{
|
||||
$systemVersionPath = JPATH_SITE . '/plugins/system/acf/version.php';
|
||||
File::copy($systemVersionPath, $this->getMainFolder() . '/version.php');
|
||||
}
|
||||
|
||||
return parent::onBeforeInstall();
|
||||
}
|
||||
}
|
||||
15
plugins/fields/acfcountry/tmpl/acfcountry.php
Normal file
15
plugins/fields/acfcountry/tmpl/acfcountry.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2021 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
echo htmlspecialchars($field->value, ENT_COMPAT, 'UTF-8');
|
||||
16
plugins/fields/acfcountry/version.php
Normal file
16
plugins/fields/acfcountry/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";
|
||||
|
||||
?>
|
||||
66
plugins/fields/acfcurrency/acfcurrency.php
Normal file
66
plugins/fields/acfcurrency/acfcurrency.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?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 PlgFieldsACFCurrency extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Override the field type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $overrideType = 'NR_Currencies';
|
||||
|
||||
/**
|
||||
* Update the label of the field in filters.
|
||||
*
|
||||
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
|
||||
*
|
||||
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
|
||||
*/
|
||||
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
|
||||
{
|
||||
// Make sure it is a field of that type
|
||||
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
require_once JPATH_PLUGINS . '/system/nrframework/fields/currencies.php';
|
||||
|
||||
$class = new \JFormFieldNR_Currencies();
|
||||
$currencies = $class->currencies;
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (!isset($currencies[$option->getValue()]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($currencies[$option->getValue()]);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
20
plugins/fields/acfcurrency/acfcurrency.xml
Normal file
20
plugins/fields/acfcurrency/acfcurrency.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_CURRENCY</name>
|
||||
<description>ACF_CURRENCY_DESC</description>
|
||||
<author>Tassos Marinos</author>
|
||||
<creationDate>April 2017</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="acfcurrency">acfcurrency.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
</extension>
|
||||
@ -0,0 +1,11 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCURRENCY_LABEL="ACF - Divisa"
|
||||
ACF_CURRENCY="Camps - ACF divisa"
|
||||
ACF_CURRENCY_DESC="Mostra un codi de divisa"
|
||||
ACF_CURRENCY_VALUE_DESC="Escull una divisa del llistat"
|
||||
@ -0,0 +1,11 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCURRENCY_LABEL="ACF - Valuta"
|
||||
ACF_CURRENCY="Felter - ACF Valuta"
|
||||
ACF_CURRENCY_DESC="Vis en valutakodea currency code"
|
||||
ACF_CURRENCY_VALUE_DESC="Vælg en valuta fra listena Currency from the list"
|
||||
@ -0,0 +1,11 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCURRENCY_LABEL="ACF - Währung"
|
||||
ACF_CURRENCY="Felder - ACF-Währung"
|
||||
ACF_CURRENCY_DESC="Währungscode anzeigen"
|
||||
ACF_CURRENCY_VALUE_DESC="Währung aus der Liste auswählen"
|
||||
@ -0,0 +1,11 @@
|
||||
; @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_ACFCURRENCY_LABEL="ACF - Currency"
|
||||
ACF_CURRENCY="Fields - ACF Currency"
|
||||
ACF_CURRENCY_DESC="Select a currency from a list in the back-end and display the currency code in the front-end."
|
||||
ACF_CURRENCY_VALUE_DESC="Select a Currency from the list"
|
||||
@ -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_CURRENCY="Fields - ACF Currency"
|
||||
ACF_CURRENCY_DESC="Select a currency from a list in the back-end and display the currency code in the front-end."
|
||||
@ -0,0 +1,11 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCURRENCY_LABEL="ACF - Moneda"
|
||||
ACF_CURRENCY="Campos - ACF Moneda"
|
||||
ACF_CURRENCY_DESC="Mostrar el código de moneda"
|
||||
ACF_CURRENCY_VALUE_DESC="Seleccione una moneda de la lista"
|
||||
@ -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_CURRENCY="Campos - ACF Moneda"
|
||||
ACF_CURRENCY_DESC="Seleccione una moneda de una lista en el back-end y muestre el código de moneda en el front-end."
|
||||
@ -0,0 +1,11 @@
|
||||
; @package Advanced Custom Fields
|
||||
; @version 2.8.8 Pro
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_FIELDS_ACFCURRENCY_LABEL="ACF - Devise"
|
||||
ACF_CURRENCY="Champs - Devise ACF"
|
||||
ACF_CURRENCY_DESC="Afficher un code de devise"
|
||||
ACF_CURRENCY_VALUE_DESC="Sélectionnez une devise dans la liste"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user