Skip to content

Commit

Permalink
Merge branch 'develop' into wip/1.2
Browse files Browse the repository at this point in the history
* develop: (45 commits)
  Revert "Add class alias registration method to plugins (#152)" (#176)
  Add class alias registration method to plugins (#152)
  Improved Latvian translation (#142)
  Fixing styles for custom checkbox (#140)
  ImageResizer should support uppercase file extensions (#135)
  Improved Italian Translations (#134)
  Improved Latvian translation (#128)
  Update lang.php
  Only show plugin warnings for active replacements (#122)
  Fix unit tests
  Ensure route attributes from plugins are properly loaded
  Revert "Support ReportContainers that are aliases of real ReportContainers"
  Ensure all plugins are uninstalled when the system is uninstalled (#114)
  Add history of replacement plugins to the system_plugin_history table (#115)
  Warn when replaced plugins are still present (#109)
  Added plugin registration after loading (#113)
  Fixed issue with taglist when not readOnly but an array value
  Improve handling for null being passed to the ImageResizer
  Add discord badge
  Support ReportContainers that are aliases of real ReportContainers
  ...
  • Loading branch information
LukeTowers committed May 14, 2021
2 parents 5866460 + ff9c934 commit 6632ad6
Show file tree
Hide file tree
Showing 91 changed files with 2,518 additions and 754 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/utilities/library-switcher
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Storm library switch for CI
*
* Switches the version of the Storm library being required through Composer. The only argument is the branch or tag
* to switch to.
*/
if (empty($argv[1])) {
echo 'You must provide a version to switch the library dependency to.';
echo "\n";
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/utilities/phpcs-pr
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Run PHPCS tests against a PR.
*
* The only argument is for the PR's base branch, which is then compared to the HEAD of the PR to retrieve the list
* of changed files. The PHPCS tests are only run against these changed files, to speed up the tests.
*/
if (empty($argv[1])) {
echo 'You must provide a base branch to check this PR against.';
echo "\n";
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/utilities/phpcs-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env php
<?php
/**
* Run PHPCS tests against a push.
*
* The only argument is for the commit, which a list of changed files is retrieved from. The PHPCS tests are only run
* against these changed files, to speed up the tests.
*/
if (empty($argv[1])) {
echo 'You must provide a commit SHA to check.';
echo "\n";
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Winter's mission is to show the world that web development is not rocket science

![Stable Build](https://github.com/wintercms/winter/workflows/Tests/badge.svg?branch=develop)
[![License](https://poser.pugx.org/wintercms/winter/license.svg)](https://packagist.org/packages/wintercms/winter)
[![Discord](https://img.shields.io/discord/816852513684193281?label=discord&style=flat-square)](https://discord.gg/D5MFSPH6Ux)

## Installing Winter

Expand All @@ -29,7 +30,7 @@ php artisan winter:install

## Learning Winter

The best place to learn Winter is by [reading the documentation](https://wintercms.com/docs), [watching some screencasts](https://wintercms.com/support/topic/screencast) or [following some tutorials](https://wintercms.com/support/articles/tutorials).
The best place to learn Winter is by [reading the documentation](https://wintercms.com/docs), [watching some screencasts](https://octobercms.com/support/topic/screencast) or [following some tutorials](https://octobercms.com/support/articles/tutorials).

You may also watch these introductory videos for [beginners](https://vimeo.com/79963873) and [advanced users](https://vimeo.com/172202661).

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"require-dev": {
"phpunit/phpunit": "^8.4|^9.3.3",
"mockery/mockery": "~1.3.3|^1.4.2",
"fzaninotto/faker": "~1.9",
"fakerphp/faker": "~1.9",
"squizlabs/php_codesniffer": "3.*",
"php-parallel-lint/php-parallel-lint": "^1.0",
"dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1"
Expand Down
10 changes: 5 additions & 5 deletions config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
'stores' => [

'apc' => [
'driver' => 'apc'
'driver' => 'apc',
],

'array' => [
'driver' => 'array'
'driver' => 'array',
],

'database' => [
'driver' => 'database',
'table' => 'cache',
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],

Expand All @@ -64,7 +64,7 @@
],

'redis' => [
'driver' => 'redis',
'driver' => 'redis',
'connection' => 'default',
],

Expand Down
3 changes: 2 additions & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

'sqlite' => [
'driver' => 'sqlite',
'database' => 'storage/database.sqlite',
'database' => base_path('storage/database.sqlite'),
'prefix' => '',
],

Expand Down Expand Up @@ -144,4 +144,5 @@
*/

'useConfigForTesting' => false,

];
5 changes: 4 additions & 1 deletion config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
|
*/

'from' => ['address' => '[email protected]', 'name' => 'Winter CMS'],
'from' => [
'address' => '[email protected]',
'name' => 'Winter CMS',
],

/*
|--------------------------------------------------------------------------
Expand Down
23 changes: 12 additions & 11 deletions config/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@

'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
],

'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
],

'iron' => [
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'queue' => 'your-queue-name',
'encrypt' => true,
],

'redis' => [
'driver' => 'redis',
'queue' => 'default',
'queue' => 'default',
'expire' => 60,
],

Expand All @@ -86,7 +86,8 @@
*/

'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs',
'database' => 'mysql',
'table' => 'failed_jobs',
],

];
2 changes: 1 addition & 1 deletion config/testing/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@
|
*/

'enableCsrfProtection' => false
'enableCsrfProtection' => false,

];
22 changes: 12 additions & 10 deletions modules/backend/classes/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
class NavigationManager
{
use \Winter\Storm\Support\Traits\Singleton;
use \System\Traits\LazyOwnerAlias;

/**
* @var array Cache of registration callbacks.
Expand Down Expand Up @@ -54,6 +55,9 @@ class NavigationManager
*/
protected function init()
{
foreach (static::$lazyAliases as $alias => $owner) {
$this->registerOwnerAlias($owner, $alias);
}
$this->pluginManager = PluginManager::instance();
}

Expand Down Expand Up @@ -237,7 +241,7 @@ public function registerMenuItems($owner, array $definitions)
*/
public function registerOwnerAlias(string $owner, string $alias)
{
$this->aliases[$alias] = $owner;
$this->aliases[strtoupper($alias)] = strtoupper($owner);
}

/**
Expand Down Expand Up @@ -632,7 +636,7 @@ public function setContext($owner, $mainMenuItemCode, $sideMenuItemCode = null)
*/
public function setContextOwner($owner)
{
$this->contextOwner = $owner;
$this->contextOwner = strtoupper($owner);
}

/**
Expand Down Expand Up @@ -685,7 +689,7 @@ public function setContextSideMenu($sideMenuItemCode)
*/
public function isMainMenuItemActive($item)
{
return $this->getContextOwner() === $item->owner && $this->contextMainMenuItemCode === $item->code;
return $this->getContextOwner() === strtoupper($item->owner) && $this->contextMainMenuItemCode === $item->code;
}

/**
Expand Down Expand Up @@ -716,7 +720,7 @@ public function isSideMenuItemActive($item)
return true;
}

return $this->getContextOwner() === $item->owner && $this->contextSideMenuItemCode === $item->code;
return $this->getContextOwner() === strtoupper($item->owner) && $this->contextSideMenuItemCode === $item->code;
}

/**
Expand All @@ -728,7 +732,7 @@ public function isSideMenuItemActive($item)
*/
public function registerContextSidenavPartial($owner, $mainMenuItemCode, $partial)
{
$this->contextSidenavPartials[$owner.$mainMenuItemCode] = $partial;
$this->contextSidenavPartials[$this->makeItemKey($owner, $mainMenuItemCode)] = $partial;
}

/**
Expand All @@ -741,10 +745,7 @@ public function registerContextSidenavPartial($owner, $mainMenuItemCode, $partia
*/
public function getContextSidenavPartial($owner, $mainMenuItemCode)
{
$owner = $this->aliases[$owner] ?? $owner;
$key = $owner.$mainMenuItemCode;

return $this->contextSidenavPartials[$key] ?? null;
return $this->contextSidenavPartials[$this->makeItemKey($owner, $mainMenuItemCode)] ?? null;
}

/**
Expand Down Expand Up @@ -778,6 +779,7 @@ protected function filterItemPermissions($user, array $items)
*/
protected function makeItemKey($owner, $code)
{
return strtoupper($this->aliases[$owner] ?? $owner).'.'.strtoupper($code);
$owner = strtoupper($owner);
return ($this->aliases[$owner] ?? $owner) . '.' . strtoupper($code);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ $.FroalaEditor.DEFAULTS=$.extend($.FroalaEditor.DEFAULTS,{pageLinksHandler:'onLo
var link={text:$('option:selected',$select).text().trim(),href:$select.val()}
setTimeout(function(){editor.popups.show('link.insert')
setLinkValue(link)},300)}
function setLinkValue(link){var $popup=editor.popups.get('link.insert');var text_inputs=$popup.find('input.fr-link-attr[type="text"]');var check_inputs=$popup.find('input.fr-link-attr[type="checkbox"]');var $input;var i;for(i=0;i<text_inputs.length;i++){$input=$(text_inputs[i]);if(link[$input.attr('name')]){$input.val(link[$input.attr('name')]);}
else if($input.attr('name')!='text'){$input.val('');}}
for(i=0;i<check_inputs.length;i++){$input=$(check_inputs[i]);$input.prop('checked',$input.data('checked')==link[$input.attr('name')]);}}
function setLinkValue(link){var $popup=editor.popups.get('link.insert');var text_inputs=$popup.find('input.fr-link-attr[type="text"]');var check_inputs=$popup.find('input.fr-link-attr[type="checkbox"]');var $input;var i;for(i=0;i<text_inputs.length;i++){$input=$(text_inputs[i]);var name=$input.attr('name');var value=link[name];if(name==='text'){if($input.val().length===0){$input.val(value);}}else{$input.val(value);}}
for(i=0;i<check_inputs.length;i++){$input=$(check_inputs[i]);$input.prop('checked',$input.data('checked')==link[$input.attr('name')]);}
editor.selection.restore();}
function insertLink(){richeditorPageLinksPlugin=this
editor.$el.popup({handler:editor.opts.pageLinksHandler})}
editor.$el.popup({handler:editor.opts.pageLinksHandler}).one('shown.oc.popup.pageLinks',function(){editor.selection.save()})}
function _init(){}
return{_init:_init,setLinkValueFromPopup:setLinkValueFromPopup,setLinkValue:setLinkValue,insertLink:insertLink}}
$.FE.DEFAULTS.linkInsertButtons=['linkBack','|','linkPageLinks']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,36 @@ $.FroalaEditor.DEFAULTS.key = 'JA6B2B5A1qB1F1F4D3I1A15A11D3E6B5dVh1VCQWa1EOQFe1N
var i;
for (i = 0; i < text_inputs.length; i++) {
$input = $(text_inputs[i]);
if (link[$input.attr('name')]) {
$input.val(link[$input.attr('name')]);
}
else if ($input.attr('name') != 'text') {
$input.val('');
var name = $input.attr('name');
var value = link[name];

// Only change the text of the link to be inserted if it has not already been set
if (name === 'text') {
if ($input.val().length === 0) {
$input.val(value);
}
} else {
$input.val(value);
}
}

for (i = 0; i < check_inputs.length; i++) {
$input = $(check_inputs[i]);
$input.prop('checked', $input.data('checked') == link[$input.attr('name')]);
}

// Restore selection, so that the link gets inserted properly.
editor.selection.restore();
}

function insertLink() {
richeditorPageLinksPlugin = this

editor.$el.popup({
handler: editor.opts.pageLinksHandler
}).one('shown.oc.popup.pageLinks', function () {
// Save the current selection so it can be restored after popup is closed.
editor.selection.save()
})
}

Expand Down
26 changes: 20 additions & 6 deletions modules/backend/formwidgets/taglist/partials/_taglist.htm
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
<?php
$selectedValues = is_array($selectedValues) ? $selectedValues : [];
$availableOptions = $useKey ? $fieldOptions : array_unique(array_merge($selectedValues, $fieldOptions));
$displayOnlyOptions = [];

foreach ($availableOptions as $key => $option) {
if (!strlen($option)) {
continue;
}
if (($useKey && in_array($key, $selectedValues)) || (!$useKey && in_array($option, $selectedValues))) {
$displayOnlyOptions[] = $option;
}
}
?>
<!-- Tag List -->
<?php if ($this->previewMode || $field->readOnly || $field->disabled): ?>
<ul class="form-control taglist--preview" <?= $field->readOnly || $field->disabled ? 'disabled="disabled"' : ''; ?>>
<?php foreach ($availableOptions as $key => $option): ?>
<?php if (!strlen($option)) continue ?>
<?php if (($useKey && in_array($key, $selectedValues)) || (!$useKey && in_array($option, $selectedValues))): ?>
<li class="taglist__item"><?= e(trans($option)) ?></li>
<?php endif ?>
<?php foreach ($displayOnlyOptions as $option): ?>
<li class="taglist__item"><?= e(trans($option)) ?></li>
<?php endforeach ?>
</ul>
<?php if ($field->readOnly): ?>
<?php if (is_array($field->value)): ?>
<?php foreach ($displayOnlyOptions as $option): ?>
<input
type="hidden"
name="<?= $field->getName() ?>[]"
value="<?= $option ?>">
<?php endforeach ?>
<?php else: ?>
<input
type="hidden"
name="<?= $field->getName() ?>"
Expand Down
Loading

0 comments on commit 6632ad6

Please sign in to comment.