Skip to content

Commit

Permalink
version 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor Iliev committed Nov 9, 2016
1 parent 1fc3fc9 commit cd7659a
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 77 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Email Templates release notes
EmailTemplates Changelog
==========================

###v1.2.1
* It was made compatible with Prism Library v1.17.

###v1.2
* Replaced Joomla\String\String with JString.
* Fixed bug with improper use of Joomla\Utilities\ArrayHelper::toInteger.
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Email Templates
EmailTemplates
Copyright (C) 2016 Todor Iliev

Email Templates is free software: you can redistribute it and/or modify
EmailTemplates is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Email Templates for Joomla!
EmailTemplates for Joomla!
==========================
( Version 1.2 )
( Version 1.2.1 )
--------------------------

Email Templates is an extension for Joomla! developers that provides functionality for creating and managing e-mail templates. Developers will be able to use those e-mail templates in their applications.

##Documentation
You can find documentation on following pages.

[Documentation and FAQ] (#)
[Documentation and FAQ](http://itprism.com/help/115-emailtemplates-info-guide)

[API documentation] (http://cdn.itprism.com/api/emailtemplates/index.html)
[API documentation](http://cdn.itprism.com/api/emailtemplates/index.html)

##Download
You can [download Email Templates package] (http://itprism.com/free-joomla-extensions/others/email-templates-manager) from the website of ITPrism.
You can [download Email Templates package](http://itprism.com/free-joomla-extensions/others/email-templates-manager) from the website of ITPrism.

##License
Email Templates is under GPLv3 [license] (https://raw.githubusercontent.com/ITPrism/EmailTemplates/master/LICENSE.txt).
Email Templates is under GPLv3 [license](https://raw.githubusercontent.com/ITPrism/EmailTemplates/master/LICENSE.txt).
4 changes: 4 additions & 0 deletions admin/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<config>

</config>
2 changes: 1 addition & 1 deletion admin/helpers/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function startTable()

public static function endTable()
{
echo "</table></div>";
echo '</table></div>';
}

public static function addRowHeading($heading)
Expand Down
4 changes: 2 additions & 2 deletions admin/language/en-GB/en-GB.com_emailtemplates.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
COM_EMAILTEMPLATES="Email Templates"
COM_EMAILTEMPLATES_HELP_URL="#"
COM_EMAILTEMPLATES="EmailTemplates"
COM_EMAILTEMPLATES_HELP_URL="http://itprism.com/help/115-emailtemplates-info-guide"

; Submenu
COM_EMAILTEMPLATES_CATEGORIES="Categories"
Expand Down
2 changes: 1 addition & 1 deletion admin/language/en-GB/en-GB.com_emailtemplates.sys.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COM_EMAILTEMPLATES="Email Templates"
COM_EMAILTEMPLATES="EmailTemplates"

; Installation
COM_EMAILTEMPLATES_MINIMUM_REQUIREMENTS="Minimum Requirements"
Expand Down
2 changes: 0 additions & 2 deletions admin/models/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ protected function prepareTable($table)
public function copyEmails(array $ids, $categoryId)
{
foreach ($ids as $id) {

if ((int)$id > 0) {
$table = $this->getTable();
$table->load($id);
Expand All @@ -148,6 +147,5 @@ public function copyEmails(array $ids, $categoryId)
}
}
}

}
}
2 changes: 2 additions & 0 deletions admin/models/emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protected function getStoreId($id = '')
/**
* Build an SQL query to load the list data.
*
* @throws \RuntimeException
*
* @return JDatabaseQuery
* @since 1.6
*/
Expand Down
2 changes: 0 additions & 2 deletions admin/models/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ protected function prepareXML($results, $root, $child)
$xml->addAttribute('generator', 'com_emailtemplates');

if (!empty($root) and !empty($child)) {

foreach ($results as $data) {

$item = $xml->addChild($child);

foreach ($data as $key => $value) {
Expand Down
73 changes: 32 additions & 41 deletions admin/models/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* @license GNU General Public License version 3 or later; see LICENSE.txt
*/

use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;

// no direct access
defined('_JEXEC') or die;

Expand All @@ -20,7 +23,6 @@ protected function populateState()
// Load the filter state.
$value = $app->getUserStateFromRequest('import.context', 'type', 'placeholders');
$this->setState('import.context', $value);

}

/**
Expand All @@ -29,14 +31,14 @@ protected function populateState()
* @param array $data An optional array of data for the form to interrogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
* @return JForm|bool A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm($this->option . '.import', 'import', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
if (!$form) {
return false;
}

Expand All @@ -59,7 +61,7 @@ protected function loadFormData()

public function extractFile($file, $destFolder)
{
$filePath = "";
$filePath = '';

// extract type
$zipAdapter = JArchive::getAdapter('zip');
Expand All @@ -68,36 +70,28 @@ public function extractFile($file, $destFolder)
$dir = new DirectoryIterator($destFolder);

foreach ($dir as $fileinfo) {

$fileExtension = JFile::getExt($fileinfo->getFilename());
if (!$fileinfo->isDot() and strcmp('xml', $fileExtension) === 0) {
$filePath = JPath::clean($destFolder . DIRECTORY_SEPARATOR . JFile::makeSafe($fileinfo->getFilename()));
break;
}

}

return $filePath;
}

public function uploadFile($fileData, $type)
public function uploadFile($uploadedFileData, $type)
{
$app = JFactory::getApplication();
/** @var $app JApplicationAdministrator */

jimport('joomla.filesystem.archive');

$uploadedFile = Joomla\Utilities\ArrayHelper::getValue($fileData, 'tmp_name');
$uploadedName = Joomla\Utilities\ArrayHelper::getValue($fileData, 'name');
$errorCode = Joomla\Utilities\ArrayHelper::getValue($fileData, 'error');

$destination = JPath::clean($app->get('tmp_path') . DIRECTORY_SEPARATOR . JFile::makeSafe($uploadedName));

$file = new Prism\File\File();
$uploadedFile = ArrayHelper::getValue($uploadedFileData, 'tmp_name');
$uploadedName = ArrayHelper::getValue($uploadedFileData, 'name');
$errorCode = ArrayHelper::getValue($uploadedFileData, 'error');

// Prepare size validator.
$KB = 1024 * 1024;
$fileSize = (int)$app->input->server->get('CONTENT_LENGTH');
$KB = 1024**2;
$fileSize = (int)ArrayHelper::getValue($uploadedFileData, 'size');

$mediaParams = JComponentHelper::getParams('com_media');
/** @var $mediaParams Joomla\Registry\Registry */
Expand All @@ -110,37 +104,32 @@ public function uploadFile($fileData, $type)
// Prepare server validator.
$serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE));

$file->addValidator($sizeValidator);
$file->addValidator($serverValidator);
$file = new Prism\File\File($uploadedFile);
$file
->addValidator($sizeValidator)
->addValidator($serverValidator);

// Validate the file
if (!$file->isValid()) {
throw new RuntimeException($file->getError());
}

// Prepare uploader object.
$uploader = new Prism\File\Uploader\Local($uploadedFile);
$uploader->setDestination($destination);

// Upload the file
$file->setUploader($uploader);
$file->upload();

$fileName = basename($destination);
// Upload the file.
$rootFolder = JPath::clean($app->get('tmp_path'), '/');
$filesystemLocal = new Prism\Filesystem\Adapter\Local($rootFolder);
$sourceFile = $filesystemLocal->upload($uploadedFileData);

// Extract file if it is archive.
$ext = JString::strtolower(JFile::getExt($fileName));
$ext = StringHelper::strtolower(JFile::getExt(basename($sourceFile)));
if (strcmp($ext, 'zip') === 0) {

$destFolder = JPath::clean($app->get('tmp_path'). '/'. $type);
if (is_dir($destFolder)) {
JFolder::delete($destFolder);
$destinationFolder = JPath::clean($app->get('tmp_path'). '/'. $type, '/');
if (JFolder::exists($destinationFolder)) {
JFolder::delete($destinationFolder);
}

$filePath = $this->extractFile($destination, $destFolder);

$filePath = $this->extractFile($sourceFile, $destinationFolder);
} else {
$filePath = $destination;
$filePath = $sourceFile;
}

return $filePath;
Expand All @@ -151,6 +140,8 @@ public function uploadFile($fileData, $type)
*
* @param string $file A path to file
* @param int $categoryId
*
* @throws \RuntimeException
*/
public function importPlaceholders($file, $categoryId)
{
Expand All @@ -163,8 +154,7 @@ public function importPlaceholders($file, $categoryId)

// Generate data for importing.
foreach ($content as $item) {

$name = JString::trim($item->name);
$name = StringHelper::trim($item->name);
if (!$name) {
continue;
}
Expand All @@ -190,6 +180,8 @@ public function importPlaceholders($file, $categoryId)
*
* @param string $file A path to file
* @param int $categoryId
*
* @throws \RuntimeException
*/
public function importEmails($file, $categoryId)
{
Expand All @@ -202,8 +194,7 @@ public function importEmails($file, $categoryId)

// Generate data for importing.
foreach ($content as $item) {

$title = JString::trim($item->title);
$title = StringHelper::trim($item->title);
if (!$title) {
continue;
}
Expand Down
Empty file added admin/sql/updates/1.2.1.sql
Empty file.
7 changes: 3 additions & 4 deletions emailtemplates.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.5" method="upgrade">
<extension type="component" version="3.6" method="upgrade">
<name>COM_EMAILTEMPLATES</name>
<author>Todor Iliev</author>
<authorEmail>todor@itprism.com</authorEmail>
<authorUrl>http://itprism.com</authorUrl>
<copyright>Copyright (C) 2016 Todor Iliev ( ITPrism.com )</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.en.html GNU/GPLv3</license>
<version>1.2</version>
<creationDate>31 March, 2016</creationDate>
<version>1.2.1</version>
<creationDate>09 November, 2016</creationDate>
<description><![CDATA[
<p><a href='http://itprism.com/free-joomla-extensions/others/email-templates-manager' target='_blank'>Email Templates</a> is an extension for Joomla! developers that provides functionality for creating and managing e-mail templates.</p>
<p><a href='http://itprism.com/' target='_blank'>Subscribe for the newsletter</a> to receive <strong>gifts</strong>, <strong>discount codes</strong>, information about <strong>updates</strong> and information about <strong>new ITPrism extensions</strong>.</p>
<p>Please, <a href='#' target='_blank'>vote for the extension</a> on Joomla! Extensions Directory</p>
]]></description>

<install>
Expand Down
6 changes: 3 additions & 3 deletions libraries/lib_emailtemplates/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Version
*
* @var integer
*/
public $devLevel = '2';
public $devLevel = '2.1';

/**
* Release Type
Expand All @@ -59,7 +59,7 @@ class Version
*
* @var string
*/
public $releaseDate = '31 March, 2016';
public $releaseDate = '09 November, 2016';

/**
* License
Expand Down Expand Up @@ -101,7 +101,7 @@ class Version
*
* @var string
*/
public $requiredPrismVersion = '1.9';
public $requiredPrismVersion = '1.17';

/**
* Build long format of the version text
Expand Down
10 changes: 5 additions & 5 deletions libraries/lib_emailtemplates/lib_emailtemplates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<extension type="library" version="3.5" method="upgrade">
<name>Email Templates Library</name>
<extension type="library" version="3.6" method="upgrade">
<name>EmailTemplates Library</name>
<libraryname>Emailtemplates</libraryname>
<author>Todor Iliev</author>
<authorEmail>todor@itprism.com</authorEmail>
Expand All @@ -9,9 +9,9 @@
<license>http://www.gnu.org/licenses/gpl-3.0.en.html GNU/GPLv3</license>
<packager>ITPrism</packager>
<packagerurl>http://itprism.com</packagerurl>
<version>1.2</version>
<creationDate>31 March, 2016</creationDate>
<description>Email Templates Library</description>
<version>1.2.1</version>
<creationDate>09 November, 2016</creationDate>
<description>EmailTemplates Library</description>

<files>
<folder>language</folder>
Expand Down
13 changes: 6 additions & 7 deletions pkg_emailtemplates.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<extension type="package" version="3.5" method="upgrade">
<name>Email Templates Package</name>
<extension type="package" version="3.6" method="upgrade">
<name>EmailTemplates Package</name>
<packagename>emailtemplates</packagename>
<author>Todor Iliev</author>
<authorEmail>todor@itprism.com</authorEmail>
<authorUrl>http://itprism.com</authorUrl>
<copyright>Copyright (C) 2016 Todor Iliev ( ITPrism.com )</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.en.html GNU/GPLv3</license>
<version>1.2</version>
<creationDate>31 March, 2016</creationDate>
<version>1.2.1</version>
<creationDate>09 November, 2016</creationDate>
<url>http://itprism.com</url>
<packager>Todor Iliev</packager>
<packagerurl>http://itprism.com</packagerurl>
<description><![CDATA[
<p><a href='http://itprism.com/free-joomla-extensions/others/email-templates-manager' target='_blank'>Email Templates</a> is an extension for Joomla! developers that provides functionality for creating and managing e-mail templates.</p>
<p><a href='http://itprism.com/free-joomla-extensions/others/email-templates-manager' target='_blank'>EmailTemplates</a> is an extension for Joomla! developers that provides functionality for creating and managing e-mail templates.</p>
<p><a href='http://itprism.com/' target='_blank'>Subscribe for the newsletter</a> to receive <strong>gifts</strong>, <strong>discount codes</strong>, information about <strong>updates</strong> and information about <strong>new ITPrism extensions</strong>.</p>
<p>Please, <a href='#' target='_blank'>vote for the extension</a> on Joomla! Extensions Directory</p>
]]></description>

<files folder="packages">
Expand All @@ -26,6 +25,6 @@
<scriptfile>install.php</scriptfile>

<updateservers>
<server type="extension" priority="1" name="Email Templates ( from CDN )">http://cdn.itprism.com/updates/emailtemplates.xml</server>
<server type="extension" priority="1" name="EmailTemplates Package">http://cdn.itprism.com/updates/emailtemplates.xml</server>
</updateservers>
</extension>

0 comments on commit cd7659a

Please sign in to comment.