Skip to content

Commit

Permalink
Merge pull request #2117 from yama/1.4.x-refactor
Browse files Browse the repository at this point in the history
merged from ce by cherry pick
  • Loading branch information
Dmi3yy authored Jan 22, 2023
2 parents 9bb77ed + 84a7faf commit 252d3f9
Show file tree
Hide file tree
Showing 328 changed files with 42,224 additions and 12,606 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
tab_width = 4

[**.js]
tab_width = 4

[**.coffee]
tab_width = 4

[**.cson]
tab_width = 4

[**.json]
tab_width = 4

[**rc]
tab_width = 4

[**php]
tab_width = 4
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gitattributes export-ignore
.gitignore export-ignore
.tx export-ignore
.github export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
!/assets/cache/.htaccess
!/assets/cache/index.html
!/assets/cache/siteManager.php
!/assets/cache/sitePublishing.idx.php
!/assets/cache/images/index.html
!/assets/cache/rss/index.html
!/assets/cache/updater/index.html
Expand Down
9 changes: 7 additions & 2 deletions assets/.thumbs/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
10 changes: 8 additions & 2 deletions assets/backup/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
order deny,allow
deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>

7 changes: 7 additions & 0 deletions assets/cache/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
9 changes: 7 additions & 2 deletions assets/cache/images/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
order deny,allow
allow from all
<ifModule mod_authz_core.c>
Require all granted
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
allow from all
</ifModule>
9 changes: 7 additions & 2 deletions assets/cache/images/ht.access
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
order deny,allow
allow from all
<ifModule mod_authz_core.c>
Require all granted
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
allow from all
</ifModule>
1 change: 1 addition & 0 deletions assets/cache/sitePublishing.idx.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php $cacheRefreshTime=0; ?>
9 changes: 7 additions & 2 deletions assets/export/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
9 changes: 7 additions & 2 deletions assets/files/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
9 changes: 7 additions & 2 deletions assets/images/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
9 changes: 7 additions & 2 deletions assets/import/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
12 changes: 9 additions & 3 deletions assets/js/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
</Files>
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
4 changes: 4 additions & 0 deletions assets/js/euiuploader/css/euiuploader.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
}
#euiUploadState .sgrow3 {
text-align: center;
overflow: visible;
display: block;
background: none;
height: auto;
}
#euiUploadState .progress .complete {
color:green;
Expand Down
12 changes: 9 additions & 3 deletions assets/lib/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
</Files>
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
<ifModule !mod_authz_core.c>
order deny,allow
deny from all
</ifModule>
</Files>
6 changes: 6 additions & 0 deletions assets/lib/Helpers/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function create(array $data = array())
/**
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
Expand Down Expand Up @@ -149,6 +150,7 @@ public function add($data, $id = null)
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->data);
Expand Down Expand Up @@ -259,6 +261,7 @@ public function removeElement($element)
* @param mixed $offset
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return $this->containsKey($offset);
Expand All @@ -268,6 +271,7 @@ public function offsetExists($offset)
* @param mixed $offset
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->get($offset);
Expand All @@ -278,6 +282,7 @@ public function offsetGet($offset)
* @param mixed $value
* @return Collection
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if ($offset !== null) {
Expand All @@ -293,6 +298,7 @@ public function offsetSet($offset, $value)
* @param mixed $offset
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
return $this->remove($offset);
Expand Down
8 changes: 8 additions & 0 deletions assets/lib/Helpers/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,12 @@ public function getCFGDef($param, $default = null)
{
return \APIhelpers::getkey($this->config, $param, $default);
}

/**
* @return MODxMailer
*/
public function getMailProcessor()
{
return $this->mail;
}
}
4 changes: 4 additions & 0 deletions assets/lib/Helpers/PHPThumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class PHPThumb
public function __construct()
{
$this->thumb = new \phpthumb();
$defaultCacheFolder = 'assets/cache';
$this->thumb->config_cache_directory = MODX_BASE_PATH . $defaultCacheFolder;
$this->thumb->config_temp_directory = $defaultCacheFolder;
$this->thumb->config_document_root = MODX_BASE_PATH;
$this->fs = FS::getInstance();
}

Expand Down
7 changes: 4 additions & 3 deletions assets/lib/MODxAPI/modResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,14 @@ public function save($fire_events = false, $clearCache = false)
}

$this->set('alias', $this->getAlias());

$data = $this->toArray(null, null, null, false);
$this->invokeEvent('OnBeforeDocFormSave', array(
'mode' => $this->newDoc ? "new" : "upd",
'id' => isset($this->id) ? $this->id : '',
'doc' => $this->toArray(),
'doc' => &$data,
'docObj' => $this
), $fire_events);
$this->fromArray($data);

$fld = $this->encodeFields()->toArray(null, null, null, false);
foreach ($this->default_field as $key => $value) {
Expand Down Expand Up @@ -632,7 +633,7 @@ public function save($fire_events = false, $clearCache = false)
$this->invokeEvent('OnDocFormSave', array(
'mode' => $this->mode,
'id' => isset($this->id) ? $this->id : '',
'doc' => $this->toArray(),
'doc' => $this->toArray(null, null, null, false),
'docObj' => $this
), $fire_events);

Expand Down
2 changes: 1 addition & 1 deletion assets/lib/SimpleTab/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __construct($modx, $lang_attribute = 'en')
* @param array $ids
* @param $folder
*/
public function clearFolders($ids = array(), $folder)
public function clearFolders(array $ids, $folder)
{
foreach ($ids as $id) {
$this->fs->rmDir($folder . $id . '/');
Expand Down
34 changes: 16 additions & 18 deletions assets/lib/class.modxRTEbridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function __construct($editorKey = NULL, $bridgeConfig = array(), $tvOptio
$this->initLang($basePath);

// Get modxRTEbridge-config from child-class
$this->bridgeParams = isset($bridgeConfig['bridgeParams']) ? $bridgeConfig['bridgeParams'] : array();
$this->gSettingsCustom = isset($bridgeConfig['gSettingsCustom']) ? $bridgeConfig['gSettingsCustom'] : array();
$this->bridgeParams = isset($bridgeConfig['bridgeParams']) ? $bridgeConfig['bridgeParams'] : array();
$this->gSettingsCustom = isset($bridgeConfig['gSettingsCustom']) ? $bridgeConfig['gSettingsCustom'] : array();
$this->gSettingsDefaultValues = isset($bridgeConfig['gSettingsDefaultValues']) ? $bridgeConfig['gSettingsDefaultValues'] : array();

// Determine settings from Modx
Expand Down Expand Up @@ -149,17 +149,17 @@ public function __construct($editorKey = NULL, $bridgeConfig = array(), $tvOptio
$this->tvOptions = $tvOptions;

// Set pluginParams
$this->editorKey = $editorKey;
$this->theme = $this->modxParams['theme'] ?? 'base';
$this->pluginParams = $modx->event->params ?? array();
$this->pluginParams['pluginName'] = $modx->event->activePlugin;
$this->pluginParams['editorLabel'] = $bridgeConfig['editorLabel'] ?? 'No editorLabel set for "' . $editorKey . '"';
$this->pluginParams['editorVersion'] = $bridgeConfig['editorVersion'] ?? 'No editorVersion set';
$this->pluginParams['editorLogo'] = $bridgeConfig['editorLogo'] ?? '';
$this->editorKey = $editorKey;
$this->theme = $this->modxParams['theme'] ?? 'base';
$this->pluginParams = $modx->event->params ?? array();
$this->pluginParams['pluginName'] = $modx->event->activePlugin;
$this->pluginParams['editorLabel'] = $bridgeConfig['editorLabel'] ?? 'No editorLabel set for "' . $editorKey . '"';
$this->pluginParams['editorVersion'] = $bridgeConfig['editorVersion'] ?? 'No editorVersion set';
$this->pluginParams['editorLogo'] = $bridgeConfig['editorLogo'] ?? '';
$this->pluginParams['skinsDirectory'] = isset($bridgeConfig['skinsDirectory']) && !empty($bridgeConfig['skinsDirectory']) ? trim($bridgeConfig['skinsDirectory'], "/") . "/" : '';
$this->pluginParams['skinthemeDirectory'] = isset($bridgeConfig['skinthemeDirectory']) && !empty($bridgeConfig['skinthemeDirectory']) ? trim($bridgeConfig['skinthemeDirectory'], "/") . "/" : '';
$this->pluginParams['base_path'] = $basePath;
$this->pluginParams['base_url'] = $baseUrl;
$this->pluginParams['base_path'] = $basePath;
$this->pluginParams['base_url'] = $baseUrl;
}

// Function to set editor-parameters
Expand All @@ -170,12 +170,10 @@ public function set($key, $value, $type = false, $emptyAllowed = false)
$this->themeConfig[$key] = NULL; // Delete Parameter completely from JS-initialization
} else {
if (!isset($this->themeConfig[$key])) $this->themeConfig[$key] = array();
$this->themeConfig[$key]['value'] = $value;
$this->themeConfig[$key]['default'] = !isset($this->themeConfig[$key]['default'])
? $value
: $this->themeConfig[$key]['default'];
$this->themeConfig[$key]['type'] = $type == false ? 'string' : $type;
$this->themeConfig[$key]['empty'] = $emptyAllowed;
$this->themeConfig[$key]['value'] = $value;
$this->themeConfig[$key]['default'] = !isset($this->themeConfig[$key]['default']) ? $value : $this->themeConfig[$key]['default'];
$this->themeConfig[$key]['type'] = $type == false ? 'string' : $type;
$this->themeConfig[$key]['empty'] = $emptyAllowed;
}
}

Expand Down Expand Up @@ -798,7 +796,7 @@ public function getModxSettings()
public function parsePlaceholders($content, $ph)
{
foreach ($ph as $key => $value) {
$content = str_replace('[+' . $key . '+]', $value, $content);
$content = str_replace('[+' . $key . '+]', $value ?? '', $content);
}
return $content;
}
Expand Down
Loading

0 comments on commit 252d3f9

Please sign in to comment.