acf
This commit is contained in:
86
plugins/fields/acfprogressbar/acfprogressbar.php
Normal file
86
plugins/fields/acfprogressbar/acfprogressbar.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 © 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 PlgFieldsACFProgressBar extends ACF_Field
|
||||
{
|
||||
protected $validate = 'number';
|
||||
|
||||
/**
|
||||
* Field's Hint Description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $hint = '70';
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$option->setLabel($option->getValue() . '%');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// percentage must be a number with values between 0 and 100
|
||||
$fieldNode->setAttribute('type', 'nrnumber');
|
||||
$fieldNode->setAttribute('min', 0);
|
||||
$fieldNode->setAttribute('max', 100);
|
||||
$fieldNode->setAttribute('addon', '%');
|
||||
$fieldNode->setAttribute('class', 'input-mini');
|
||||
|
||||
return $fieldNode;
|
||||
}
|
||||
}
|
||||
24
plugins/fields/acfprogressbar/acfprogressbar.xml
Normal file
24
plugins/fields/acfprogressbar/acfprogressbar.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
|
||||
<name>ACF_PROGRESSBAR</name>
|
||||
<description>ACF_PROGRESSBAR_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="acfprogressbar">acfprogressbar.php</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>version.php</filename>
|
||||
<folder>language</folder>
|
||||
<folder>params</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<media folder="media" destination="plg_fields_acfprogressbar">
|
||||
<folder>css</folder>
|
||||
</media>
|
||||
</extension>
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Progress Bar"
|
||||
ACF_PROGRESSBAR="camps - ACF Progress Bar"
|
||||
ACF_PROGRESSBAR_DESC="El connector camp barra de progrés mostra una barra de progrés."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Estableix el valor del percentatge per la barra de progrés."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="L'alçada de la barra de progrés"
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Estableix el color de la barra de progrés."
|
||||
ACF_PROGRESSBAR_STRIPPED="Ratllada"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Mostra bandes a la barra de progrés."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animada"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Anima la barra de progrés."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Vores arrodonides"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Arrodoneix les vores."
|
||||
ACF_PROGRESSBAR_SHADOW="Ombra"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Activa l'ombra interior."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Mostrar etiqueta"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Activa-ho per mostrar el text del percentatge dins la barra de progrés."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Fremskridtsbjælke"
|
||||
ACF_PROGRESSBAR="Felter - ACF Fremskridtsbjælke"
|
||||
ACF_PROGRESSBAR_DESC="Plugin'et fremskridtsbjælke viser en fremskridtsbjælke."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Sæt procentsatsen for fremskridtsbjælken."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="Højden på fremskditsbjælken."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Sæt farven på fremskridtsbjælken."
|
||||
ACF_PROGRESSBAR_STRIPPED="Stribet"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Vis striber på fremskdridtsbjælken."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animeret"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animer fremskridtsbjælken."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Afrundede hjørner"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Aktiver afrundede hjørner."
|
||||
ACF_PROGRESSBAR_SHADOW="Skygge"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Aktiver indre skygge."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Vis label"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Aktiver for at vise procenttekst i fremskridtsbjælken."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Fortschrittsbalken"
|
||||
ACF_PROGRESSBAR="Felder - ACF-Fortschrittsanzeige"
|
||||
ACF_PROGRESSBAR_DESC="Das Fortschrittsbalken-Feld-Plugin zeigt einen Fortschrittsbalken an."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Legen Sie die Prozentzahl für den Fortschrittsbalken fest."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="Die Höhe des Fortschrittsbalkens."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Legen Sie die Farbe des Fortschrittsbalkens fest."
|
||||
ACF_PROGRESSBAR_STRIPPED="Stripped"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Streifen auf dem Fortschrittsbalken anzeigen."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animiert"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animieren Sie den Fortschrittsbalken."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Abgerundete Ecken"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Abgerundete Ecken aktivieren."
|
||||
ACF_PROGRESSBAR_SHADOW="Schatten"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Inneren Schatten aktivieren."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Label anzeigen"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Prozentualen Text in der Fortschrittsleiste anzeigen lassen."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Progress Bar"
|
||||
ACF_PROGRESSBAR="Fields - ACF Progress Bar"
|
||||
ACF_PROGRESSBAR_DESC="Enter a completion percentage in the back-end and display the respective progress bar in the front-end."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Set the percentage number for the progress bar."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="The height of the progress bar."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Set the progress bar color."
|
||||
ACF_PROGRESSBAR_STRIPPED="Stripped"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Display stripes on progress bar."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animated"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animate the progress bar."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Rounded Corners"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Enable rounded corners."
|
||||
ACF_PROGRESSBAR_SHADOW="Shadow"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Enable inner shadow."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Show Label"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Enable to display percentage text within the progress bar."
|
||||
@ -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_PROGRESSBAR="Fields - ACF Progress Bar"
|
||||
ACF_PROGRESSBAR_DESC="Enter a completion percentage in the back-end and display the respective progress bar in the front-end."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Barra de progreso"
|
||||
ACF_PROGRESSBAR="Campos - ACF Barra de progreso"
|
||||
ACF_PROGRESSBAR_DESC="El complemento de campo Barra de progreso muestra una barra de progreso."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Establezca el número de porcentaje para la barra de progreso."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="La altura de la barra de progreso."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Establecer el color de la barra de progreso."
|
||||
ACF_PROGRESSBAR_STRIPPED="Despojada"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Mostrar rayas en la barra de progreso."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animado"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animar la barra de progreso."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Esquinas Redondeadas"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Habilitar esquinas redondeadas."
|
||||
ACF_PROGRESSBAR_SHADOW="Sombra"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Habilitar sombra interior."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Mostrar Etiqueta"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Habilite para mostrar texto de porcentaje dentro de la barra de progreso."
|
||||
@ -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_PROGRESSBAR="Campos - ACF Barra de progreso"
|
||||
ACF_PROGRESSBAR_DESC="Ingrese un porcentaje de finalización en el back-end y muestre la barra de progreso respectiva en el front-end."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Progress Bar"
|
||||
ACF_PROGRESSBAR="Champs - Progress Bar ACF"
|
||||
ACF_PROGRESSBAR_DESC="Le plugin de champ Progress Bar affiche une barre de progression."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Définir un nombre en pourcentage pour la barre de progression"
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="La hauteur de la barre de progression."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Définir la couleur de la barre de progression."
|
||||
ACF_PROGRESSBAR_STRIPPED="Zébré"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Affichage des bandes sur la barre de progression."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animé"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animer la barre de progression."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Coins Arrondis"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Active les coins arrondis"
|
||||
ACF_PROGRESSBAR_SHADOW="Ombre"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Active l'ombre interne"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Afficher Label"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Activez pour afficher le pourcentage en texte dans la barre de progression."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - barra di avanzamento"
|
||||
ACF_PROGRESSBAR="Campi - barra di avanzamento ACF"
|
||||
ACF_PROGRESSBAR_DESC="Il plugin del campo barra di avanzamento visualizza una barra di avanzamento."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Imposta il numero percentuale per la barra di avanzamento."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="L'altezza della barra di avanzamento."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Imposta il colore della barra di avanzamento."
|
||||
ACF_PROGRESSBAR_STRIPPED="Stripped"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Visualizza strisce sulla barra di avanzamento."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animata"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Anima la barra di avanzamento."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Angoli arrotondati"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Abilita angoli arrotondati"
|
||||
ACF_PROGRESSBAR_SHADOW="Ombra"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Abilita l'ombra interna."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Mostra etichetta"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Abilita per visualizzare la percentuale di testo all'interno della barra di avanzamento."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Progress Bar"
|
||||
ACF_PROGRESSBAR="Velden - ACF Progress Bar"
|
||||
ACF_PROGRESSBAR_DESC="De Progress Bar field plugin geeft een voortgangsbalk weer."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Set the percentage number for the progress bar."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="De hoogte van de voortgangsbalk."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Stel de kleur van de voortgangsbalk in."
|
||||
ACF_PROGRESSBAR_STRIPPED="Gestreept"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Geef strepen weer op de voortgangsbalk."
|
||||
ACF_PROGRESSBAR_ANIMATED="Geanimeerd"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animeer de voortgangsbalk"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Ronde Hoeken"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Schakel ronde hoeken in"
|
||||
ACF_PROGRESSBAR_SHADOW="Schaduw"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Schakel binnen schaduw in"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Toon Etiket"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Schakel in om procentuele tekst binnen de voortgangsbalk weer te geven."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - индикатор выполнения"
|
||||
ACF_PROGRESSBAR="Поля - индикатор выполнения ACF"
|
||||
ACF_PROGRESSBAR_DESC="Плагин поля Progress Bar отображает индикатор выполнения."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Установить процентное значение для индикатора выполнения."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="Высота индикатора выполнения."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Установить цвет индикатора выполнения."
|
||||
ACF_PROGRESSBAR_STRIPPED="Отображать полосы"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Отображать полосы на индикаторе выполнения."
|
||||
ACF_PROGRESSBAR_ANIMATED="Анимировать"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Анимировать индикатор выполнения."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Закругленные углы"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Включить закругленные углы."
|
||||
ACF_PROGRESSBAR_SHADOW="Тень"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Включить внутреннюю тень."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Показать метку"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Включить отображение процентного текста на индикаторе выполнения."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - Progress Bar"
|
||||
ACF_PROGRESSBAR="Fält - ACF Progress Bar"
|
||||
ACF_PROGRESSBAR_DESC="Fält-pluginen Progress Bar visar en förloppsindikator."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Ställ in procenttal för förloppsindikatorn."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="Förloppsindikatorns höjd."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Ställ in förloppsindikatorns färg."
|
||||
ACF_PROGRESSBAR_STRIPPED="Randig"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Visa ränder i förloppsindikatorn."
|
||||
ACF_PROGRESSBAR_ANIMATED="Animerad"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Animera förloppsindikatorn."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Rundade hörn."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Aktivera rundade hörn."
|
||||
ACF_PROGRESSBAR_SHADOW="Skugga"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Aktivera inre skugga."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Visa etikett"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Gör det möjligt att visa procentuell text i förloppsindikatorn."
|
||||
@ -0,0 +1,23 @@
|
||||
; @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_ACFPROGRESSBAR_LABEL="ACF - панель ходу"
|
||||
ACF_PROGRESSBAR="Поля - панель ходу ACF"
|
||||
ACF_PROGRESSBAR_DESC="Плагін поля"_QQ_" Прогрес "_QQ_"відображає панель прогресу."
|
||||
ACF_PROGRESSBAR_VALUE_DESC="Встановити число відсотків для рядка прогресу."
|
||||
ACF_PROGRESSBAR_HEIGHT_DESC="Висота смуги прогресу."
|
||||
ACF_PROGRESSBAR_COLOR_DESC="Встановити колір смужки прогресу."
|
||||
ACF_PROGRESSBAR_STRIPPED="Знятий"
|
||||
ACF_PROGRESSBAR_STRIPPED_DESC="Відображення смуг на панелі прогресу."
|
||||
ACF_PROGRESSBAR_ANIMATED="Анімовані"
|
||||
ACF_PROGRESSBAR_ANIMATED_DESC="Анімація панелі прогресу."
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS="Закруглені кути"
|
||||
ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC="Увімкнути закруглені кути."
|
||||
ACF_PROGRESSBAR_SHADOW="Тінь"
|
||||
ACF_PROGRESSBAR_SHADOW_DESC="Увімкнути внутрішню тінь."
|
||||
ACF_PROGRESSBAR_SHOW_LABEL="Показати мітку"
|
||||
ACF_PROGRESSBAR_SHOW_LABEL_DESC="Увімкнути для відображення відсоткового тексту в рядку прогресу."
|
||||
47
plugins/fields/acfprogressbar/params/acfprogressbar.xml
Normal file
47
plugins/fields/acfprogressbar/params/acfprogressbar.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field name="height" type="nrnumber"
|
||||
label="NR_HEIGHT"
|
||||
addon="px"
|
||||
description="ACF_PROGRESSBAR_HEIGHT_DESC"
|
||||
default="18"
|
||||
hint="18"
|
||||
class="input-small"
|
||||
/>
|
||||
<field name="color" type="nrcolor"
|
||||
label="NR_COLOR"
|
||||
description="ACF_PROGRESSBAR_COLOR_DESC"
|
||||
default="#007bff"
|
||||
/>
|
||||
<field name="stripped" type="nrtoggle"
|
||||
label="ACF_PROGRESSBAR_STRIPPED"
|
||||
description="ACF_PROGRESSBAR_STRIPPED_DESC"
|
||||
/>
|
||||
<field name="animated" type="nrtoggle"
|
||||
label="ACF_PROGRESSBAR_ANIMATED"
|
||||
description="ACF_PROGRESSBAR_ANIMATED_DESC"
|
||||
/>
|
||||
<field name="roundedcorners" type="nrtoggle"
|
||||
label="ACF_PROGRESSBAR_ROUNDED_CORNERS"
|
||||
description="ACF_PROGRESSBAR_ROUNDED_CORNERS_DESC"
|
||||
checked="true"
|
||||
/>
|
||||
<field name="shadow" type="nrtoggle"
|
||||
label="ACF_PROGRESSBAR_SHADOW"
|
||||
description="ACF_PROGRESSBAR_SHADOW_DESC"
|
||||
checked="true"
|
||||
/>
|
||||
<field name="show_label" type="list"
|
||||
label="ACF_PROGRESSBAR_SHOW_LABEL"
|
||||
description="ACF_PROGRESSBAR_SHOW_LABEL_DESC"
|
||||
default="center">
|
||||
<option value="0">JDISABLED</option>
|
||||
<option value="left">NR_LEFT</option>
|
||||
<option value="center">NR_CENTER</option>
|
||||
<option value="right">NR_RIGHT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
691
plugins/fields/acfprogressbar/script.install.helper.php
Normal file
691
plugins/fields/acfprogressbar/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 PlgFieldsAcfprogressbarInstallerScriptHelper
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
43
plugins/fields/acfprogressbar/script.install.php
Normal file
43
plugins/fields/acfprogressbar/script.install.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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 PlgFieldsACFProgressBarInstallerScript extends PlgFieldsACFProgressBarInstallerScriptHelper
|
||||
{
|
||||
public $alias = 'acfprogressbar';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "fields";
|
||||
public $show_message = false;
|
||||
|
||||
/**
|
||||
* Helper method triggered before installation
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onBeforeInstall()
|
||||
{
|
||||
// If version.php doesn't exist, copy it from the system plugin
|
||||
if ($this->isInstalled() && !file_exists($this->getMainFolder() . '/version.php'))
|
||||
{
|
||||
$systemVersionPath = JPATH_SITE . '/plugins/system/acf/version.php';
|
||||
|
||||
$result = File::copy($systemVersionPath, $this->getMainFolder() . '/version.php');
|
||||
}
|
||||
|
||||
return parent::onBeforeInstall();
|
||||
}
|
||||
}
|
||||
59
plugins/fields/acfprogressbar/tmpl/acfprogressbar.php
Normal file
59
plugins/fields/acfprogressbar/tmpl/acfprogressbar.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2019 Tassos Marinos All Rights Reserved
|
||||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
$percentage = floatval($field->value);
|
||||
|
||||
if (empty($percentage))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Add Media Files
|
||||
HTMLHelper::stylesheet('plg_fields_acfprogressbar/style.css', ['relative' => true, 'version' => 'auto']);
|
||||
|
||||
$height = $fieldParams->get('height', '18');
|
||||
$color = $fieldParams->get('color', '#007bff');
|
||||
$stripped = $fieldParams->get('stripped', '0');
|
||||
$animated = $fieldParams->get('animated', '0');
|
||||
$roundedcorners = $fieldParams->get('roundedcorners', '1');
|
||||
$shadow = $fieldParams->get('shadow', '1');
|
||||
$show_label = $fieldParams->get('show_label', 'center');
|
||||
|
||||
$progressbar_atts = 'height: '.$height.'px;';
|
||||
$progressbar_cls = ($roundedcorners == '1') ? ' acf_progressbar_rounded' : '';
|
||||
$progressbar_cls .= ($shadow == '1') ? ' acf_progressbar_shadow' : '';
|
||||
|
||||
$color_att = 'background-color: '.$color.';';
|
||||
|
||||
$bar_cls = '';
|
||||
$bar_cls .= ($stripped == '1') ? ' acf_progressbar_stripes' : '';
|
||||
$bar_cls .= ($animated == '1') ? ' acf_progressbar_animated' : '';
|
||||
$bar_cls .= ($roundedcorners == '1') ? ' acf_progressbar_rounded' : '';
|
||||
|
||||
$buffer = '
|
||||
<div class="acf_progressbar_wrapper">
|
||||
<div class="acf_progressbar' . $progressbar_cls . '" style="'.$progressbar_atts.'">
|
||||
<div class="acf_bar'.$bar_cls.'" style="'.$color_att.'width: '.$percentage.'%">
|
||||
';
|
||||
|
||||
if ($show_label != '0')
|
||||
{
|
||||
$buffer .= '<div class="acf_progressbar_label acf_' . $show_label . '">' . $percentage . '%</div>';
|
||||
}
|
||||
|
||||
$buffer .= '</div></div></div>';
|
||||
|
||||
echo $buffer;
|
||||
16
plugins/fields/acfprogressbar/version.php
Normal file
16
plugins/fields/acfprogressbar/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";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user