first commit
This commit is contained in:
72
plugins/convertforms/acymailing/acymailing.php
Normal file
72
plugins/convertforms/acymailing/acymailing.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @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');
|
||||
|
||||
class plgConvertFormsAcyMailing extends \ConvertForms\Plugin
|
||||
{
|
||||
/**
|
||||
* Main method to store data to service
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function subscribe()
|
||||
{
|
||||
// Make sure there's a list selected
|
||||
if (!isset($this->lead->campaign->list) || empty($this->lead->campaign->list))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED'));
|
||||
}
|
||||
|
||||
$lists = $this->lead->campaign->list;
|
||||
$lists_v5 = [];
|
||||
$lists_v6 = [];
|
||||
|
||||
// Discover lists for each version. v6 lists starts with 6: prefix.
|
||||
foreach ($lists as $list)
|
||||
{
|
||||
// Is a v5 list
|
||||
if (strpos($list, '6:') === false)
|
||||
{
|
||||
$lists_v5[] = $list;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Is a v6 list
|
||||
$lists_v6[] = str_replace('6:', '', $list);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
// Add user to AcyMailing 5 lists
|
||||
if (!empty($lists_v5))
|
||||
{
|
||||
ConvertFormsAcyMailingHelper::subscribe_v5($this->lead->email, $this->lead->params, $lists_v5, $this->lead->campaign->doubleoptin);
|
||||
}
|
||||
|
||||
// Add user to AcyMailing 6+ lists
|
||||
if (!empty($lists_v6))
|
||||
{
|
||||
ConvertFormsAcyMailingHelper::subscribe($this->lead->email, $this->lead->params, $lists_v6, $this->lead->campaign->doubleoptin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable service wrapper
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function loadWrapper()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
20
plugins/convertforms/acymailing/acymailing.xml
Normal file
20
plugins/convertforms/acymailing/acymailing.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.4.0" type="plugin" group="convertforms" method="upgrade">
|
||||
<name>PLG_CONVERTFORMS_ACYMAILING</name>
|
||||
<description>PLG_CONVERTFORMS_ACYMAILING_DESC</description>
|
||||
<version>1.0</version>
|
||||
<author>Tassos Marinos</author>
|
||||
<authorEmail>info@tassos.gr</authorEmail>
|
||||
<authorUrl>http://www.tassos.gr</authorUrl>
|
||||
<copyright>Copyright (c) 2020 Tassos Marinos</copyright>
|
||||
<license>GNU General Public License version 3, or later</license>
|
||||
<creationDate>November 2015</creationDate>
|
||||
<scriptfile>script.install.php</scriptfile>
|
||||
<files>
|
||||
<folder>language</folder>
|
||||
<filename plugin="acymailing">acymailing.php</filename>
|
||||
<filename>form.xml</filename>
|
||||
<filename>script.install.helper.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
</files>
|
||||
</extension>
|
||||
19
plugins/convertforms/acymailing/form.xml
Normal file
19
plugins/convertforms/acymailing/form.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset name="service">
|
||||
<field name="list" type="acymailing"
|
||||
label="PLG_CONVERTFORMS_ACYMAILING_LIST_ID"
|
||||
description="PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC"
|
||||
required="true"
|
||||
multiple="true"
|
||||
/>
|
||||
<field name="doubleoptin" type="radio"
|
||||
label="PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN"
|
||||
description="PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
173
plugins/convertforms/acymailing/helper.php
Normal file
173
plugins/convertforms/acymailing/helper.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @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');
|
||||
|
||||
class ConvertFormsAcyMailingHelper
|
||||
{
|
||||
/**
|
||||
* @deprecated Use subscribe()
|
||||
*/
|
||||
public static function subscribe_v6($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
self::subscribe($email, $params, $lists, $doubleOptin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe method for AcyMailing v6
|
||||
*
|
||||
* @param array $lists
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function subscribe($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_acym/helpers/helper.php'))
|
||||
{
|
||||
throw new Exception(JText::sprintf('PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR', 6));
|
||||
}
|
||||
|
||||
// Create user object
|
||||
$user = new stdClass();
|
||||
$user->email = $email;
|
||||
$user->confirmed = $doubleOptin ? 0 : 1;
|
||||
|
||||
$user_fields = array_change_key_case($params);
|
||||
|
||||
$user->name = isset($user_fields['name']) ? $user_fields['name'] : '';
|
||||
|
||||
// Load User Class
|
||||
$acym = acym_get('class.user');
|
||||
|
||||
// Check if exists
|
||||
$existing_user = $acym->getOneByEmail($email);
|
||||
|
||||
if ($existing_user)
|
||||
{
|
||||
$user->id = $existing_user->id;
|
||||
} else
|
||||
{
|
||||
// Save user to database only if it's a new user.
|
||||
if (!$user->id = $acym->save($user))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
// Save Custom Fields
|
||||
$fieldClass = acym_get('class.field');
|
||||
|
||||
// getAllfields was removed in 7.7.4 and we must use getAll moving forward.
|
||||
$acy_fields_method = method_exists($fieldClass, 'getAllfields') ? 'getAllfields' : 'getAll';
|
||||
$acy_fields = $fieldClass->$acy_fields_method();
|
||||
|
||||
unset($user_fields['name']); // Name is already used during user creation.
|
||||
|
||||
$fields_to_store = [];
|
||||
|
||||
foreach ($user_fields as $paramKey => $paramValue)
|
||||
{
|
||||
// Check if paramKey it's a custom field
|
||||
$field_found = array_filter($acy_fields, function($field) use($paramKey) {
|
||||
return (strtolower($field->name) == $paramKey || $field->id == $paramKey);
|
||||
});
|
||||
|
||||
if ($field_found)
|
||||
{
|
||||
// Get the 1st occurence
|
||||
$field = array_shift($field_found);
|
||||
|
||||
// AcyMailing 6 needs field's ID to recognize a field.
|
||||
$fields_to_store[$field->id] = $paramValue;
|
||||
|
||||
// $paramValue output: array(1) { [0]=> string(2) "gr" }
|
||||
// AcyMailing will get the key as the value instead of "gr"
|
||||
// We combine to remove the keys in order to keep the values
|
||||
if (is_array($paramValue))
|
||||
{
|
||||
$fields_to_store[$field->id] = array_combine($fields_to_store[$field->id], $fields_to_store[$field->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($fields_to_store)
|
||||
{
|
||||
$fieldClass->store($user->id, $fields_to_store);
|
||||
}
|
||||
|
||||
// Subscribe user to AcyMailing lists
|
||||
return $acym->subscribe($user->id, $lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe method for AcyMailing v5
|
||||
*
|
||||
* @param array $lists
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function subscribe_v5($email, $params, $lists, $doubleOptin = true)
|
||||
{
|
||||
if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_acymailing/helpers/helper.php'))
|
||||
{
|
||||
throw new Exception(JText::sprintf('PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR', 5));
|
||||
}
|
||||
|
||||
// Create user object
|
||||
$user = new stdClass();
|
||||
$user->email = $email;
|
||||
$user->confirmed = $doubleOptin ? false : true;
|
||||
|
||||
// Get Custrom Fields
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$customFields = $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select($db->quoteName('namekey'))
|
||||
->from($db->quoteName('#__acymailing_fields'))
|
||||
)->loadColumn();
|
||||
|
||||
if (is_array($customFields) && count($customFields))
|
||||
{
|
||||
foreach ($params as $key => $param)
|
||||
{
|
||||
if (in_array($key, $customFields))
|
||||
{
|
||||
$user->$key = $param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$acymailing = acymailing_get('class.subscriber');
|
||||
$userid = $acymailing->subid($email);
|
||||
|
||||
// AcyMailing sends account confirmation e-mails even if the user exists, so we need
|
||||
// to run save() method only if the user actually is new.
|
||||
if (is_null($userid))
|
||||
{
|
||||
// Save user to database
|
||||
if (!$userid = $acymailing->save($user))
|
||||
{
|
||||
throw new Exception(JText::_('PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribe user to AcyMailing lists
|
||||
$lead = [];
|
||||
foreach($lists as $listId)
|
||||
{
|
||||
$lead[$listId] = ['status' => 1];
|
||||
}
|
||||
|
||||
return $acymailing->saveSubscription($userid, $lead);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms – AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms – интеграция с Acymailing Joomla! разширение."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Списък ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Изберете списъците, за които потребителят трябва да се абонира."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="В две стъпки"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Трябва ли потребителят да щракне линка в имейла за потвърждение, преди да бъде считан за абонат?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Потребителят не може да бъде създаден."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Моля, изберете списък в настройките на кампанията"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Integració Convert Forms - AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Integració entre Convert Forms i l'extensió de Joomla! AcyMailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID de llista"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Escull les llistes a les que s'hauria de subscriure l'usuari"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doble confirmació d'entrada"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'usuari hauria de clicar a un correu de confirmació abans de ser considerat subscriptor?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="No es pot crear l'usuari."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Escull una llista a la configuració de la campanya"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - integrace AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integrace s rozšířením Acymailing pro Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Seznam ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Vyberte seznamy k jejiž odběru se uživatel přihlašuje."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Dvojité potvrzení souhlasu"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Měl by uživatel potvrdit kliknutím na odkaz v potvrzovacím e-mailu souhlas s odběrem?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Nevytvářet uživatele."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Prosím zvolte seznam v nastavení kampaní"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration mit der Acymailing Joomla! Erweiterung."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Listen ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Wählen Sie die Listen aus, zu denen der Benutzer hinzugefügt werden soll."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doppeltes Opt-in"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Sollte der Nutzer auf einen Bestätigungs-Link in einer E-Mail klicken müssen, bevor er als Abonnent betrachtet wird?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Der Benutzer kann nicht erstellt werden."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Bitte eine Liste in den Kampagnen-Einstellungen auswählen"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - Ενσωμάτωση AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Ενσωμάτωση με ένθεμα Acymailing Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Αναγνωριστικό λίστας"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Επιλέξτε τις λίστες στις οποίες πρέπει να εγγραφεί ο χρήστης."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Πρέπει ο χρήστης να κάνει κλικ σε μήνυμα επιβεβαίωσης πριν θεωρηθεί συνδρομητής;"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Αδυναμία δημιουργίας χρήστη."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Επιλέξτε μια λίστα στις ρυθμίσεις καμπάνιας"
|
||||
@@ -0,0 +1,17 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration with Acymailing Joomla! Extension."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="List ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Select the lists which the user should be subscribed to."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Should the user have to click on a confirmation email before being considered as a subscriber?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Can't create user."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Please select a list in the campaign settings"
|
||||
PLG_CONVERTFORMS_ACYMAILING_HELPER_CLASS_ERROR="AcyMailing %d helper class not found. Make sure AcyMailing is installed and you've selected the correct AcyMailing list in the campaign settings."
|
||||
@@ -0,0 +1,9 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration with Acymailing Joomla! Extension."
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="Acymailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="\"Formas de conversión\" - Integración con AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="\"Formularios de conversión\" - Integrar con extensión de Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Lista ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Selecciona las listas a la que el usuario debe estar suscrito."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Optin doble"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="¿Debe el usuario hacer click en un email de confirmación antes de ser considerado subscriptor?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="No se puede crear el usuario"
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Por favor, seleccione una lista en la configuración de campaña"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing integreerimine"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integreerimine Acymailing Joomla! lisaga."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Rühma ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Määra rühmad millega kasutaja liidetakse."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Kahekordne kinnitus"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Kas kasutaja peab klikkima kinnitusmeilis olemave lingile enne kui temast saab uudiskirja tellija?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Ei suuda luua kasutajat."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Määra rühm kampaania seadetes"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing liitäntä"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms -integrointi Acymailing Joomla! laajennukseen."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Luettelo ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Valitse luettelo ID, jonka käyttäjän tulee tilata"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Tupla varmistus"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Pitääkö käyttäjän avata vahvistusviesti ennen kuin hänet hyväksytään tilaajana?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Käyttäjää ei voi luoda."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Valitse luettelosta kampanja-asetuksissa"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convertisseur de formulaires - Intégration de AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convertisseur de formulaires - Intégration avec l'extension Joomla! AcyMailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID de la liste"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Sélectionnez les listes auxquelles l'utilisateur doit s'abonner."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Vérification par mail"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'utilisateur doit-il cliquer sur un mail de confirmation avant d'être considéré comme abonné ?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Impossible de créer un utilisateur"
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Merci de choisir une liste dans les réglages de la campagne"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Integrazione Convert Forms - AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Integrazione Convert Forms con l'estensione di Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID elenco"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Seleziona le liste a cui l'utente dovrebbe essere iscritto."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Doppio Opt-in"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="L'utente dovrebbe fare clic su una mail di conferma prima di essere considerato un iscritto?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Non posso creare l'utente."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Seleziona una lista nelle impostazioni di campagna"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Преобразовать формы - интеграция AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Преобразование форм - интеграция с расширением Joomla! Acymailing."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Список идентификаторов"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Выберите списки, для которых пользователь должен быть зарегистрирован в качестве подписки."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Двойная проверка"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Нужно ли пользователю нажимать подтверждение по электронной почте перед регистрацией в качестве подписки?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Пользователь не может быть создан."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Пожалуйста, выберите список в настройках кампании."
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Konvertovať formuláre – integrácia AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Konvertovať formuláre – integrácia s Acymailing Joomla! Rozšírenie."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="ID zoznamu"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Vyberte zoznamy, na odber ktorých má byť používateľ prihlásený."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Double Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Mal by používateľ kliknúť na potvrdzovací e-mail predtým, ako bude považovaný za odberateľa?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Nie je možné vytvoriť používateľa."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Vyberte zoznam v nastaveniach kampane"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="Acymailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Convert Forms - AcyMailing Integration"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Convert Forms - Integration med Acymailing Joomla! Komponent."
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="List ID"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Välj listan användaren skall bli prenumerant till."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Dubbel Optin"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Skall användaren behöva klicka på ett konfirmation email innan han anses bli en prenumerant?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Kan inte skapa användare."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Vänligen välj en lista i kampanj inställningen"
|
||||
@@ -0,0 +1,16 @@
|
||||
; @package Convert Forms
|
||||
; @version 3.2.12 Free
|
||||
;
|
||||
; @author Tassos Marinos - http://www.tassos.gr
|
||||
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
|
||||
; @license http://www.tassos.gr
|
||||
|
||||
PLG_CONVERTFORMS_ACYMAILING_ALIAS="AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING="Перетворити форми - інтеграція AcyMailing"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DESC="Перетворити форми - інтеграція з розширенням Acymailing Joomla!"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID="Список ідентифікаторів"
|
||||
PLG_CONVERTFORMS_ACYMAILING_LIST_ID_DESC="Виберіть списки, для яких користувач повинен бути зареєстрований як підписка."
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN="Подвійна перевірка"
|
||||
PLG_CONVERTFORMS_ACYMAILING_DOUBLEOPTIN_DESC="Чи повинен користувач натиснути електронний лист для підтвердження, перш ніж зареєструватися як підписка?"
|
||||
PLG_CONVERTFORMS_ACYMAILING_CANT_CREATE_USER="Користувача не можна створити."
|
||||
PLG_CONVERTFORMS_ACYMAILING_NO_LIST_SELECTED="Виберіть список у налаштуваннях кампанії."
|
||||
637
plugins/convertforms/acymailing/script.install.helper.php
Normal file
637
plugins/convertforms/acymailing/script.install.helper.php
Normal file
@@ -0,0 +1,637 @@
|
||||
<?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;
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
class PlgConvertformsAcymailingInstallerScriptHelper
|
||||
{
|
||||
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 = JFactory::getDbo();
|
||||
$this->app = JFactory::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;
|
||||
}
|
||||
|
||||
JFactory::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)
|
||||
{
|
||||
JFactory::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();
|
||||
}
|
||||
|
||||
JFactory::getCache()->clean('com_plugins');
|
||||
JFactory::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()
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::sprintf(
|
||||
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
|
||||
'<strong>' . JText::_($this->name) . '</strong>',
|
||||
'<strong>' . $this->getVersion() . '</strong>',
|
||||
$this->getFullType()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
switch ($this->extension_type)
|
||||
{
|
||||
case 'plugin';
|
||||
return JText::_('plg_' . strtolower($this->plugin_folder));
|
||||
|
||||
case 'component':
|
||||
return JText::_('com');
|
||||
|
||||
case 'module':
|
||||
return JText::_('mod');
|
||||
|
||||
case 'library':
|
||||
return JText::_('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 JText::_('NRI_' . strtoupper($this->getPrefix()));
|
||||
}
|
||||
|
||||
public function isPro()
|
||||
{
|
||||
$versionFile = __DIR__ . "/version.php";
|
||||
|
||||
// If version file does not exist we assume a PRO version
|
||||
if (!JFile::exists($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 = JInstaller::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.
|
||||
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
|
||||
);
|
||||
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
html_entity_decode(
|
||||
JText::sprintf(
|
||||
'NRI_ERROR_UNINSTALL_FIRST',
|
||||
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
|
||||
'</a>',
|
||||
JText::_($this->name)
|
||||
)
|
||||
), 'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders
|
||||
*
|
||||
* @param array $folders
|
||||
*/
|
||||
public function deleteFolders($folders = array())
|
||||
{
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (!is_dir($folder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JFolder::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(JFactory::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();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
plugins/convertforms/acymailing/script.install.php
Normal file
24
plugins/convertforms/acymailing/script.install.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Convert Forms
|
||||
* @version 3.2.12 Free
|
||||
*
|
||||
* @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 PlgConvertFormsAcyMailingInstallerScript extends PlgConvertFormsAcyMailingInstallerScriptHelper
|
||||
{
|
||||
public $name = 'PLG_CONVERTFORMS_ACYMAILING';
|
||||
public $alias = 'acymailing';
|
||||
public $extension_type = 'plugin';
|
||||
public $plugin_folder = "convertforms";
|
||||
public $show_message = false;
|
||||
}
|
||||
Reference in New Issue
Block a user