Skip to content

Commit

Permalink
1.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmi3yy committed Dec 10, 2018
1 parent e91f8f2 commit 781bc0a
Show file tree
Hide file tree
Showing 453 changed files with 42,074 additions and 34,620 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Previous Releases:
https://modx.com/download/evolution/previous-releases.html

Extras:
https://extras.evolution-cms.com
https://extras.evo.im

Documentation:
http://docs.evo.im
https://evolution-docs.com
332 changes: 332 additions & 0 deletions assets/docs/changelog.txt

Large diffs are not rendered by default.

Binary file added assets/js/easy-ui/themes/modx/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 40 additions & 8 deletions assets/lib/APIHelpers.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function getkey($data, $key, $default = null, $validate = null)
if (is_array($data) && (is_int($key) || is_string($key)) && $key !== '' && array_key_exists($key, $data)) {
$out = $data[$key];
}
if (!empty($validate) && is_callable($validate)) {
if (! empty($validate) && is_callable($validate)) {
$out = (($validate($out) === true) ? $out : $default);
}
return $out;
Expand All @@ -94,14 +94,14 @@ public static function getkey($data, $key, $default = null, $validate = null)
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @param string $email проверяемый email
* @param boolean $dns проверять ли DNS записи
* @return boolean Результат проверки почтового ящика
* @return boolean|string Результат проверки почтового ящика
* @author Anton Shevchuk
*/
public static function emailValidate($email, $dns = true)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
list(, $domain) = explode("@", $email, 2);
if (!$dns || ($dns && checkdnsrr($domain, "MX") && checkdnsrr($domain, "A"))) {
if (! $dns || ($dns && checkdnsrr($domain, "MX") && checkdnsrr($domain, "A"))) {
$error = false;
} else {
$error = 'dns';
Expand Down Expand Up @@ -232,7 +232,7 @@ public static function getUserIP($default = '127.0.0.1')
case ($tmp = self::getEnv('HTTP_X_FORWARDED_FOR')):
$out = $tmp;
break;
case (!empty($_SERVER['REMOTE_ADDR'])):
case (! empty($_SERVER['REMOTE_ADDR'])):
$out = $_SERVER['REMOTE_ADDR'];
break;
default:
Expand Down Expand Up @@ -270,13 +270,14 @@ public static function sanitarTag(
$out = str_replace(
array_keys($chars),
array_values($chars),
is_null($charset) ? $data : self::e($data, $charset)
$charset === null ? $data : self::e($data, $charset)
);
break;
case is_array($data):
$out = $data;
foreach ($out as $key => &$val) {
$val = self::sanitarTag($val, $charset, $chars);
$out = array();
foreach ($data as $key => $val) {
$key = self::sanitarTag($key, $charset, $chars);
$out[$key] = self::sanitarTag($val, $charset, $chars);
}
break;
default:
Expand Down Expand Up @@ -381,6 +382,37 @@ public static function checkString($value, $minLen = 1, $alph = array(), $mixArr
return $flag;
}

/**
* @param $IDs
* @param string $sep
* @param integer[] $ignore
* @return array
* @throws Exception
*/
public static function cleanIDs($IDs, $sep = ',', $ignore = array())
{
$out = array();
if (!is_array($IDs)) {
if (is_scalar($IDs)) {
$IDs = explode($sep, $IDs);
} else {
$IDs = array();
throw new Exception('Invalid IDs list <pre>' . print_r($IDs, 1) . '</pre>');
}
}
foreach ($IDs as $item) {
$item = trim($item);
if (is_scalar($item) && (int)$item >= 0) { //Fix 0xfffffffff
if (empty($ignore) || !\in_array((int)$item, $ignore, true)) {
$out[] = (int)$item;
}
}
}
$out = array_unique($out);

return $out;
}

/**
* Переменовывание элементов массива
*
Expand Down
2 changes: 1 addition & 1 deletion assets/lib/Formatter/CSSMinify.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CSSMinify

public function __construct($cssFilesPath = array())
{
if (is_array($cssFilesPath) && !empty($cssFilesPath)) {
if (is_array($cssFilesPath) && ! empty($cssFilesPath)) {
$this->cssPath = $cssFilesPath;
}
}
Expand Down
20 changes: 10 additions & 10 deletions assets/lib/Formatter/SqlFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ protected static function getNextToken($string, $previous = null)
} // Non-quoted variable name
else {
preg_match('/^(' . $string[0] . '[a-zA-Z0-9\._\$]+)/', $string, $matches);
if (!empty($matches)) {
if (! empty($matches)) {
$ret[self::TOKEN_VALUE] = $matches[1];
}
}
Expand Down Expand Up @@ -863,7 +863,7 @@ protected static function getNextToken($string, $previous = null)

// A reserved word cannot be preceded by a '.'
// this makes it so in "mytable.from", "from" is not considered a reserved word
if (!$previous || !isset($previous[self::TOKEN_VALUE]) || $previous[self::TOKEN_VALUE] !== '.') {
if (! $previous || !isset($previous[self::TOKEN_VALUE]) || $previous[self::TOKEN_VALUE] !== '.') {
$upper = strtoupper($string);
// Top Level Reserved Word
if (preg_match('/^(' . self::$regex_reserved_toplevel . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
Expand Down Expand Up @@ -1158,7 +1158,7 @@ public static function format($string, $highlight = true)
$return = rtrim($return, ' ');
}

if (!$inline_parentheses) {
if (! $inline_parentheses) {
$increase_block_indent = true;
// Add a newline after the parentheses
$newline = true;
Expand Down Expand Up @@ -1191,7 +1191,7 @@ public static function format($string, $highlight = true)
}

// Add a newline before the closing parentheses (if not already added)
if (!$added_newline) {
if (! $added_newline) {
$return .= "\n" . str_repeat($tab, $indent_level);
}
} // Top level reserved words start a new line and increase the special indent level
Expand All @@ -1208,7 +1208,7 @@ public static function format($string, $highlight = true)
// Add a newline after the top level reserved word
$newline = true;
// Add a newline before the top level reserved word (if not already added)
if (!$added_newline) {
if (! $added_newline) {
$return .= "\n" . str_repeat($tab, $indent_level);
} // If we already added a newline, redo the indentation since it may be different now
else {
Expand All @@ -1222,14 +1222,14 @@ public static function format($string, $highlight = true)
$highlighted = preg_replace('/\s+/', ' ', $highlighted);
}
//if SQL 'LIMIT' clause, start variable to reset newline
if ($token[self::TOKEN_VALUE] === 'LIMIT' && !$inline_parentheses) {
if ($token[self::TOKEN_VALUE] === 'LIMIT' && ! $inline_parentheses) {
$clause_limit = true;
}
} // Checks if we are out of the limit clause
elseif ($clause_limit && $token[self::TOKEN_VALUE] !== "," && $token[self::TOKEN_TYPE] !== self::TOKEN_TYPE_NUMBER && $token[self::TOKEN_TYPE] !== self::TOKEN_TYPE_WHITESPACE) {
$clause_limit = false;
} // Commas start a new line (unless within inline parentheses or SQL 'LIMIT' clause)
elseif ($token[self::TOKEN_VALUE] === ',' && !$inline_parentheses) {
elseif ($token[self::TOKEN_VALUE] === ',' && ! $inline_parentheses) {
//If the previous TOKEN_VALUE is 'LIMIT', resets new line
if ($clause_limit === true) {
$newline = false;
Expand All @@ -1241,7 +1241,7 @@ public static function format($string, $highlight = true)
} // Newline reserved words start a new line
elseif ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_RESERVED_NEWLINE) {
// Add a newline before the reserved word (if not already added)
if (!$added_newline) {
if (! $added_newline) {
$return .= "\n" . str_repeat($tab, $indent_level);
}

Expand Down Expand Up @@ -1335,7 +1335,7 @@ public static function splitQuery($string)
foreach ($tokens as $token) {
// If this is a query separator
if ($token[self::TOKEN_VALUE] === ';') {
if (!$empty) {
if (! $empty) {
$queries[] = $current_query . ';';
}
$current_query = '';
Expand All @@ -1351,7 +1351,7 @@ public static function splitQuery($string)
$current_query .= $token[self::TOKEN_VALUE];
}

if (!$empty) {
if (! $empty) {
$queries[] = trim($current_query);
}

Expand Down
21 changes: 11 additions & 10 deletions assets/lib/Helpers/Assets.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ class AssetsHelper
* @var \DocumentParser
* @access protected
*/
protected $modx = null;
protected $fs = null;
protected $modx;

/** @var \Helpers\FS */
protected $fs;

/**
* @var AssetsHelper cached reference to singleton instance
Expand Down Expand Up @@ -52,7 +54,6 @@ private function __construct(DocumentParser $modx)
*/
private function __clone()
{

}

/**
Expand All @@ -62,7 +63,6 @@ private function __clone()
*/
private function __wakeup()
{

}

/**
Expand Down Expand Up @@ -94,12 +94,12 @@ public function registerJQuery()
public function registerScript($name, $params)
{
$out = '';
if (!isset($this->modx->loadedjscripts[$name])) {
if (! isset($this->modx->loadedjscripts[$name])) {
$src = $params['src'];
$remote = strpos($src, "http") !== false;
if (!$remote) {
$remote = strpos($src, 'http') === 0 || strpos($src, '//') === 0;
if (! $remote) {
$src = $this->modx->config['site_url'] . $src;
if (!$this->fs->checkFile($params['src'])) {
if (! $this->fs->checkFile($params['src'])) {
$this->modx->logEvent(0, 3, 'Cannot load ' . $src, 'Assets helper');

return $out;
Expand All @@ -116,7 +116,6 @@ public function registerScript($name, $params)
}

$this->modx->loadedjscripts[$name] = $params;

}

return $out;
Expand All @@ -129,7 +128,9 @@ public function registerScript($name, $params)
public function registerScriptsList($list = array())
{
$out = '';
if (!is_array($list)) return $out;
if (! \is_array($list)) {
return $out;
}

foreach ($list as $script => $params) {
$out .= $this->registerScript($script, $params);
Expand Down
13 changes: 8 additions & 5 deletions assets/lib/Helpers/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function partition(Closure $p)

/**
* @param $offset
* @param null $length
* @param null|int $length
* @return array
*/
public function slice($offset, $length = null)
Expand Down Expand Up @@ -132,7 +132,7 @@ public function append($value)

/**
* @param $data
* @param null $id
* @param null|int|string $id
* @return $this
*/
public function add($data, $id = null)
Expand Down Expand Up @@ -280,10 +280,13 @@ public function offsetGet($offset)
*/
public function offsetSet($offset, $value)
{
if (! isset($offset)) {
return $this->add($value);
if ($offset !== null) {
$this->set($offset, $value);
} else {
$this->add($value);
}
$this->set($offset, $value);

return $this;
}

/**
Expand Down
13 changes: 8 additions & 5 deletions assets/lib/Helpers/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
class Config
{
private $_cfg = array();
protected $fs = null;
/** @var FS */
protected $fs;
protected $path = '';

/**
Expand All @@ -20,7 +21,7 @@ class Config
*/
public function __construct($cfg = array())
{
if (!empty($cfg)) {
if (! empty($cfg)) {
$this->setConfig($cfg);
}
$this->fs = FS::getInstance();
Expand Down Expand Up @@ -69,7 +70,9 @@ public function loadConfig($name)

if ($this->fs->checkFile($configFile)) {
$json = file_get_contents(MODX_BASE_PATH . $configFile);
$config = array_merge($config, jsonHelper::jsonDecode($json, array('assoc' => true), true));
/** @var array $json */
$json = jsonHelper::jsonDecode($json, array('assoc' => true), true);
$config = array_merge($config, $json);
}
}

Expand All @@ -90,7 +93,7 @@ public function getConfig()
/**
* Сохранение массива настроек
* @param array $cfg массив настроек
* @return int результат сохранения настроек
* @return int|bool результат сохранения настроек
*/
public function setConfig($cfg, $overwrite = false)
{
Expand All @@ -106,7 +109,7 @@ public function setConfig($cfg, $overwrite = false)

/**
* @param $name
* @param null $def
* @param mixed $def
* @return mixed
*/
public function getCFGDef($name, $def = null)
Expand Down
Loading

0 comments on commit 781bc0a

Please sign in to comment.