Skip to content

Commit

Permalink
version 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor Iliev committed Sep 8, 2017
1 parent 838e55f commit a88e123
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 42 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Prism Library Changelog

### v1.20
* Upgraded [VueJS](https://vuejs.org/) to v2.4.2.
* Upgraded [jQuery Cropper](https://fengyuanchen.github.io/cropper/) to v3.0.0.
* Upgraded [jQuery AutoComplete](https://github.com/devbridge/jQuery-Autocomplete) to v1.4.1.
* Upgraded [jQuery File Upload](https://github.com/blueimp/jQuery-File-Upload) to v9.18.0.
* Upgraded [SweetAlert2](https://limonte.github.io/sweetalert2/) to v6.6.5.
Expand All @@ -16,6 +17,7 @@ Prism Library Changelog
* Renamed folder __libs__ to __vendor__.
* The antbuilder reworked. Now, it builds Joomla! package from current source.
* Published to Packagist. The library can be installed to any framework via Composer.
* It was decreased minimum image size to 25 when resize or crop.

### v1.19.6
* Improved Log class.
Expand Down
18 changes: 12 additions & 6 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@
<fileset dir="${cfg.vendorSourceDir}/abraham/twitteroauth/src" />
</copy>
<copy todir="${cfg.vendorDir}/AdamPaterson/OAuth2/Client/Provider">
<fileset dir="${cfg.vendorSourceDir}/adam-paterson/oauth2-stripe/src" />
<fileset dir="${cfg.vendorSourceDir}/adam-paterson/oauth2-stripe/src/Provider" />
</copy>
<copy todir="${cfg.vendorDir}/Aws">
<fileset dir="${cfg.vendorSourceDir}/aws/aws-sdk-php/src" />
</copy>
<copy file="${cfg.vendorSourceDir}/aws/prism/init.php" todir="${cfg.vendorDir}/Aws" />

<copy todir="${cfg.vendorDir}/Defuse/Crypto">
<fileset dir="${cfg.vendorSourceDir}/defuse/php-encryption/src" />
</copy>
<copy todir="${cfg.vendorDir}/GuzzleHttp">
<fileset dir="${cfg.vendorSourceDir}/guzzlehttp/guzzle/src" />
</copy>
<copy todir="${cfg.vendorDir}/GuzzleHttp">
<fileset dir="${cfg.vendorSourceDir}/guzzlehttp/guzzle/src" />
</copy>
<copy file="${cfg.vendorSourceDir}/guzzlehttp/prism/init.php" todir="${cfg.vendorDir}/GuzzleHttp" />

<copy todir="${cfg.vendorDir}/GuzzleHttp/Promise">
<fileset dir="${cfg.vendorSourceDir}/guzzlehttp/promises/src" />
</copy>
Expand Down Expand Up @@ -69,7 +70,7 @@
<fileset dir="${cfg.vendorSourceDir}/ramsey/uuid/src" />
</copy>
<copy todir="${cfg.vendorDir}/Carbon">
<fileset dir="${cfg.vendorSourceDir}/nesbot/carbon/src" />
<fileset dir="${cfg.vendorSourceDir}/nesbot/carbon/src/Carbon" />
</copy>
<copy todir="${cfg.vendorDir}/Ramsey/Uuid">
<fileset dir="${cfg.vendorSourceDir}/ramsey/uuid/src" />
Expand All @@ -96,8 +97,13 @@
<fileset dir="${cfg.vendorSourceDir}/ircmaxell/security-lib/lib/SecurityLib" />
</copy>
<copy todir="${cfg.vendorDir}/Stripe">
<fileset dir="${cfg.vendorSourceDir}/stripe/stripe-php/lib" />
<fileset dir="${cfg.vendorSourceDir}/stripe/stripe-php" >
<include name="lib/**" />
<include name="data/**" />
</fileset>
</copy>
<copy file="${cfg.vendorSourceDir}/stripe/prism/init.php" todir="${cfg.vendorDir}/Stripe" />

<copy todir="${cfg.vendorDir}/Google">
<fileset dir="${cfg.vendorSourceDir}/google/apiclient/src/Google" />
</copy>
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Condition/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function __construct(array $data = array())
$this->raw = array_key_exists('raw', $data) ? (string)$data['raw'] : '';
$this->column = array_key_exists('column', $data) ? (string)$data['column'] : '';
$this->value = array_key_exists('value', $data) ? $data['value'] : '';
$this->table = array_key_exists('table', $data) ? (string)$data['table'] : '';
$this->operator = array_key_exists('operator', $data) ? (string)$data['operator'] : '';
$this->table = array_key_exists('table', $data) ? (string)$data['table'] : 'a';
$this->operator = array_key_exists('operator', $data) ? (string)$data['operator'] : '=';
}

/**
Expand Down
25 changes: 15 additions & 10 deletions src/Database/JoomlaDatabaseGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ protected function limit(\JDatabaseQuery $query, Request $request)
*
* @param Request $request
* @param array $defaultFields
* @param array $aliasFields
*
* @return array
*/
protected function prepareFields($request, array $defaultFields)
protected function prepareFields($request, array $defaultFields, array $aliasFields = array())
{
$fields = array();

Expand All @@ -140,16 +141,20 @@ protected function prepareFields($request, array $defaultFields)
if (count($requiredFields) > 0) {
/** @var Field $field */
foreach ($requiredFields as $field) {
$requireField = $field->getTable() ? $field->getTable() . '.' . $field->getColumn() : 'a.' . $field->getColumn();
if (!in_array($requireField, $defaultFields, true)) {
continue;
if ($field->isAlias() && array_key_exists($field->getColumn(), $aliasFields)) {
$fields[] = $aliasFields[$field->getColumn()];
} else {
$requireField = $field->getTable() ? $field->getTable() . '.' . $field->getColumn() : 'a.' . $field->getColumn();
if (!in_array($requireField, $defaultFields, true)) {
continue;
}

if ($field->getAlias()) {
$requireField .= ' AS ' . $field->getAlias();
}

$fields[] = $requireField;
}

if ($field->getAlias()) {
$requireField .= ' AS ' . $field->getAlias();
}

$fields[] = $requireField;
}
}
}
Expand Down
26 changes: 22 additions & 4 deletions src/Database/Request/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ class Field
*/
protected $raw;

/**
* It shows us the column name is an alias of expression.
*
* @var string
*/
protected $is_alias = false;

public function __construct(array $data)
{
$this->raw = array_key_exists('raw', $data) ? (string)$data['raw'] : '';
$this->alias = array_key_exists('alias', $data) ? (string)$data['alias'] : '';
$this->column = array_key_exists('column', $data) ? (string)$data['column'] : '';
$this->table = array_key_exists('table', $data) ? (string)$data['table'] : '';
$this->raw = array_key_exists('raw', $data) ? (string)$data['raw'] : '';
$this->alias = array_key_exists('alias', $data) ? (string)$data['alias'] : '';
$this->column = array_key_exists('column', $data) ? (string)$data['column'] : '';
$this->table = array_key_exists('table', $data) ? (string)$data['table'] : '';
$this->is_alias = array_key_exists('is_alias', $data) ? (bool)$data['is_alias'] : false;
}

/**
Expand Down Expand Up @@ -116,4 +124,14 @@ public function setRaw($raw)
{
$this->raw = $raw;
}

/**
* Check if the filed is an alias of expression.
*
* @return bool
*/
public function isAlias()
{
return (bool)$this->is_alias;
}
}
45 changes: 41 additions & 4 deletions src/Database/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Prism\Database\Request;

use Prism\Database\Condition\Condition;
use Prism\Database\Condition\Conditions;
use Prism\Database\Condition\Order;
use Prism\Database\Condition\Ordering;
Expand Down Expand Up @@ -50,10 +51,10 @@ class Request

public function __construct()
{
$this->fields = new Fields();
$this->conditions = new Conditions();
$this->ordering = new Ordering();
$this->limit = new Limit();
$this->fields = new Fields;
$this->conditions = new Conditions;
$this->ordering = new Ordering;
$this->limit = new Limit;
}

/**
Expand Down Expand Up @@ -135,4 +136,40 @@ public function getLimit()
{
return $this->limit;
}

/**
* @param Condition $condition
*
* @return self
*/
public function addCondition(Condition $condition)
{
$this->conditions->addCondition($condition);

return $this;
}

/**
* @param Field $field
*
* @return self
*/
public function requestField(Field $field)
{
$this->fields->addField($field);

return $this;
}

/**
* @param Order $condition
*
* @return self
*/
public function addOrderCondition(Order $condition)
{
$this->ordering->addCondition($condition);

return $this;
}
}
2 changes: 1 addition & 1 deletion src/Domain/PropertiesMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
trait PropertiesMethods
{
/**
* Returns object properties as associative array;
* Returns object properties as associative array.
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/ToOptionsMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function toOptions($key, $text, $suffix = '')
$properties = is_object($item) ? $item->getProperties() : $item;

if ($suffix !== '' && (array_key_exists($suffix, $properties) && (string)$properties[$suffix] !== '')) {
$options[] = array('value' => $properties[$key], 'text' => $properties[$text] . ' ['.(string)$properties[$suffix].']');
$options[] = array('value' => $properties[$key], 'text' => $properties[$text] . ', '.(string)$properties[$suffix]);
} else {
$options[] = array('value' => $properties[$key], 'text' => $properties[$text]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/File/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public function resize($destinationFolder, Registry $options)

// Resize to general size.
$width = $options->get('width', 640);
$width = ($width < 50) ? 50 : $width;
$width = ($width < 25) ? 25 : $width;
$height = $options->get('height', 480);
$height = ($height < 50) ? 50 : $height;
$height = ($height < 25) ? 25 : $height;
$scale = $options->get('scale', \JImage::SCALE_INSIDE);
$createNew = (bool)$options->get('create_new', Constants::NO);

Expand Down Expand Up @@ -157,9 +157,9 @@ public function crop($destinationFolder, Registry $options)

// Resize to general size.
$width = $options->get('width', 200);
$width = ($width < 50) ? 50 : $width;
$width = ($width < 25) ? 25 : $width;
$height = $options->get('height', 200);
$height = ($height < 50) ? 50 : $height;
$height = ($height < 25) ? 25 : $height;
$left = (int)abs($options->get('x', 0));
$top = (int)abs($options->get('y', 0));
$createNew = (bool)$options->get('create_new', Constants::NO);
Expand Down
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Version
*
* @var string
*/
public $releaseDate = '10 September, 2017';
public $releaseDate = '08 September, 2017';

/**
* License
Expand Down
2 changes: 1 addition & 1 deletion src/lib_prism.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<packager>ITPrism</packager>
<packagerurl>http://itprism.com</packagerurl>
<version>1.20</version>
<creationDate>10 September, 2017</creationDate>
<creationDate>08 September, 2017</creationDate>
<description><![CDATA[
<p><a href="http://itprism.com/free-joomla-extensions/others/software-development-kit" target="_blank">Prism Library</a> is a collection of PHP classes used in many ITPrism extensions.</p>
<p><a href="http://itprism.com/" target="_blank">Subscribe for the newsletter</a> to receive information about updates and new ITPrism extensions.</p>
Expand Down
10 changes: 6 additions & 4 deletions src/ui/cropper/cropper.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/ui/cropper/cropper.min.js

Large diffs are not rendered by default.

0 comments on commit a88e123

Please sign in to comment.