Skip to content

Commit

Permalink
Merge branch '5.x' into fix/excluded-words-error
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/Search/CombTest.php
  • Loading branch information
jasonvarga committed Jan 22, 2025
2 parents dc1dd61 + b07b70b commit dfd8032
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 82 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release Notes

## 5.45.2 (2025-01-21)

### What's fixed
- Revert "Allow form fields view to be rendered with single tag" [#11374](https://github.com/statamic/cms/issues/11374) by @duncanmcclean
- Remove `type` attribute in nocache replacer [#11373](https://github.com/statamic/cms/issues/11373) by @marcorieser
- Fix deprecation warning from regex operator [#11337](https://github.com/statamic/cms/issues/11337) by @duncanmcclean
- Fix bug report link in Contribution Guide [#11367](https://github.com/statamic/cms/issues/11367) by @duncanmcclean
- Fix bard undefined href error [#11351](https://github.com/statamic/cms/issues/11351) by @jacksleight
- Suppress “packing” git message [#11326](https://github.com/statamic/cms/issues/11326) by @edalzell



## 5.45.1 (2025-01-07)

### What's fixed
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Next, please search through the [open issues](https://github.com/statamic/cms/is

If you _do_ find a similar issue, upvote it by adding a :thumbsup: [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Only leave a comment if you have relevant information to add.

If no one has filed the issue yet, feel free to [submit a new one](https://github.com/statamic/cms/issues/new). Please include a clear description of the issue, follow along with the issue template, and provide and as much relevant information as possible. Code examples demonstrating the issue are the best way to ensure a timely solution to the issue.
If no one has filed the issue yet, feel free to [submit a new one](https://github.com/statamic/cms/issues/new?template=bug_report.yml). Please include a clear description of the issue, follow along with the issue template, and provide and as much relevant information as possible. Code examples demonstrating the issue are the best way to ensure a timely solution to the issue.

### Feature Requests

Expand Down
14 changes: 11 additions & 3 deletions resources/css/elements/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,27 @@ button {
.btn, .btn-default {
@apply text-gray-800 dark:text-dark-150 shadow-button;
background: linear-gradient(180deg, #fff, #f9fafb);
background-clip: padding-box;
border: 1px solid #D3DDE7;
border-bottom: 1px solid #c4cdd6;
box-shadow: inset 0 1px 0 0 #fff, 0 1px 0 0 rgba(0, 0, 0,.05), 0 2px 1px 0 theme(colors.gray.600 / .15), 0 0 0 0 transparent;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.550), theme(colors.dark.600));
background-clip: padding-box;
border-color: theme(colors.dark.700);
box-shadow: inset 0 1px 0 0 theme(colors.dark.300), 0 1px 0 0 rgba(200, 200, 200,.05), 0 2px 1px 0 theme(colors.dark.900 / .15), 0 0 0 0 transparent;
}

&:hover:not(:disabled), &:active:not(:disabled) {
@apply text-gray-800 dark:text-dark-150;
background: linear-gradient(180deg, #f9fafb, #f4f6f8);
background-clip: padding-box;
border-bottom: 1px solid #BFC7D0;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.600), theme(colors.dark.700));
background-clip: padding-box;
border-color: theme(colors.dark.800);
}
}
Expand Down Expand Up @@ -78,7 +82,7 @@ button {

/* Primary action button */
.btn-primary {
@apply text-white bg-gradient-to-b from-blue-500 to-blue-600 dark:from-dark-blue-100 dark:to-dark-blue-150 border border-blue-700 dark:border-blue-900 border-b-blue-800 dark:border-b-dark-blue-200 !important;
@apply text-white bg-gradient-to-b from-blue-500 to-blue-600 dark:from-dark-blue-100 dark:to-dark-blue-150 bg-clip-padding border border-blue-700 dark:border-blue-900 border-b-blue-800 dark:border-b-dark-blue-200 !important;
box-shadow: inset 0 1px 0 0 theme('colors.blue.400'), 0 1px 0 0 rgba(25,30,35,.05), 0 3px 2px -1px theme(colors.blue.900 / .15), 0 0 0 0 transparent;

&:hover:not(:disabled), :active:not(:disabled) {
Expand All @@ -93,11 +97,11 @@ button {

/* Danger/delete button */
.btn-danger {
@apply text-white bg-gradient-to-b from-red-500 to-red-600 border border-red-600 border-b-red-900;
@apply text-white bg-gradient-to-b from-red-500 to-red-600 bg-clip-padding border border-red-600 border-b-red-900;
box-shadow: inset 0 1px 0 0 theme('colors.red.400'), 0 1px 0 0 rgba(0, 0, 0,.05), 0 3px 2px -1px theme(colors.red.900 / .15), 0 0 0 0 transparent;

&:hover:not(:disabled), &:active:not(:disabled) {
@apply bg-gradient-to-b from-red-600 to-red-700 border border-red-700 border-b-red-900;
@apply bg-gradient-to-b from-red-600 to-red-700 bg-clip-padding border border-red-700 border-b-red-900;
}

&:disabled {
Expand Down Expand Up @@ -159,22 +163,26 @@ button {
.btn-round {
@apply rounded-full flex items-center text-center p-0;
background: linear-gradient(180deg, #fff, #f9fafb);
background-clip: padding-box;
border: 1px solid #c4cdd6;
box-shadow: 0 1px 0 0 rgba(25,30,35,.05);
height: 32px;
width: 32px;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.500), theme(colors.dark.550));
background-clip: padding-box;
border-color: theme(colors.dark.400);
}

&:hover:not(:disabled), &:active:not(:disabled) {
background: linear-gradient(180deg, #f9fafb, #f4f6f8);
background-clip: padding-box;
border-color: #c4cdd5;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.550), theme(colors.dark.600));
background-clip: padding-box;
border-color: theme(colors.dark.500);
}
}
Expand Down
8 changes: 8 additions & 0 deletions resources/css/elements/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ input.input-text-minimal:read-only,
.input-group-prepend, .input-group-append, .input-group-item {
@apply rtl:rounded-r ltr:rounded-l px-2 border dark:border-dark-900 text-sm text-gray-800 dark:text-dark-150 select-none;
background: linear-gradient(180deg, #fff, #f9fafb);
background-clip: padding-box;
border: 1px solid #c4cdd6;
box-shadow: 0 1px 0 0 rgba(25,30,35,.05);
height: 2.375rem;
line-height: 36px;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.500), theme(colors.dark.600));
background-clip: padding-box;
border-color: theme(colors.dark.900);
box-shadow: 0 1px 0 0 rgba(0,0,0,.05);
}
Expand Down Expand Up @@ -133,10 +135,12 @@ input.input-text-minimal:read-only,
button.input-group-append:hover:not(:disabled),
button.input-group-append:active:not(:disabled) {
background: linear-gradient(180deg, #f9fafb, #f4f6f8);
background-clip: padding-box;
border-color: #c4cdd5;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.550), theme(colors.dark.600));
background-clip: padding-box;
border-color: theme(colors.dark.900);
}
}
Expand Down Expand Up @@ -213,22 +217,26 @@ input.input-text-minimal:read-only,
@apply select-none rounded leading-normal align-middle whitespace-nowrap appearance-none subpixel-antialiased;

background: linear-gradient(180deg, #fff, #f9fafb);
background-clip: padding-box;
border: 1px solid #c4cdd6;
height: 2.375rem; /* 38px */
letter-spacing: -0.01em;
padding: .475rem 1.75rem .475rem .75rem ; [dir="rtl"] & { padding: .475rem .75rem .475rem 1.75rem ; }

.dark & {
background: linear-gradient(180deg, theme(colors.dark.500), theme(colors.dark.600));
background-clip: padding-box;
border-color: theme(colors.dark.800);
}

&:hover:not(:disabled), &:active:not(:disabled) {
background: linear-gradient(180deg, #f9fafb, #f4f6f8);
background-clip: padding-box;
border-color: #c4cdd5;

.dark & {
background: linear-gradient(180deg, theme(colors.dark.700), theme(colors.dark.750));
background-clip: padding-box;
border-color: theme(colors.dark.900);
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/css/vendors/vue-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

.vs__open-indicator {
@apply clickable;
@apply flex items-center rounded-e px-2 text-sm shrink-0 h-full border-e-0 dark:border-dark-800;
@apply flex items-center rounded-e px-2 text-sm shrink-0 h-full border-e-0 bg-clip-padding dark:border-dark-800;
/* height: 2.375rem; */
}

Expand Down
7 changes: 2 additions & 5 deletions resources/views/extend/forms/fields.antlers.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
<sup aria-label="{{ trans:Required }}">*</sup>
{{ /if }}
</label>
{{ if instructions && instructions_position == "above" }}
<p class="text-gray-500" id="{{ id }}-instructions">{{ instructions }}</p>
{{ /if }}
<div class="py-2">{{ field }}</div>
{{ if instructions && instructions_position == "below" }}
<div class="p-2">{{ field }}</div>
{{ if instructions }}
<p class="text-gray-500" id="{{ id }}-instructions">{{ instructions }}</p>
{{ /if }}
{{ if error }}
Expand Down
5 changes: 2 additions & 3 deletions src/Fieldtypes/Bard/LinkMark.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ public function addAttributes()
return [
'href' => [
'renderHTML' => function ($attributes) {
$href = $attributes->href;
if (! isset($href)) {
if (! isset($attributes->href)) {
return null;
}

return [
'href' => $this->convertHref($href) ?? '',
'href' => $this->convertHref($attributes->href) ?? '',
];
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/Fieldtypes/UserGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function toItemArray($id, $site = null)
{
if ($group = UserGroup::find($id)) {
return [
'title' => $group->title(),
'title' => __($group->title()),
'id' => $group->handle(),
];
}
Expand All @@ -30,7 +30,7 @@ public function getIndexItems($request)
return UserGroup::all()->sortBy('title')->map(function ($group) {
return [
'id' => $group->handle(),
'title' => $group->title(),
'title' => __($group->title()),
];
})->values();
}
Expand Down
21 changes: 0 additions & 21 deletions src/Forms/FieldsVariable.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Forms/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function create()

$data['sections'] = $this->getSections($this->sessionHandle(), $jsDriver);

$data['fields'] = new FieldsVariable(collect($data['sections'])->flatMap->fields->all());
$data['fields'] = collect($data['sections'])->flatMap->fields->all();

$data['honeypot'] = $form->honeypot();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ protected function extractFromFields($entry, $blueprint)

$extraValues = [
'depth' => $entry->page()?->depth(),
'children' => $entry->page()?->flattenedPages()->pluck('id')->all(),
];

return [$values->all(), $fields->meta(), $extraValues];
Expand Down
9 changes: 8 additions & 1 deletion src/Providers/ExtensionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Providers;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Env;
use Illuminate\Support\ServiceProvider;
use Statamic\Actions;
use Statamic\Actions\Action;
Expand Down Expand Up @@ -258,10 +259,16 @@ public function register()

protected function registerAddonManifest()
{
$cachePath = $this->app->bootstrapPath().'/cache/addons.php';

if (! is_null($env = Env::get('STATAMIC_ADDONS_CACHE'))) {
$cachePath = Str::startsWith($env, ['/', '\\']) ? $env : $this->app->basePath($env);
}

$this->app->instance(Manifest::class, new Manifest(
new Filesystem,
$this->app->basePath(),
$this->app->bootstrapPath().'/cache/addons.php'
$cachePath
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ protected function filterTestNotLike($item, $like)

protected function filterTestLikeRegex($item, $pattern)
{
return preg_match("/{$pattern}/im", $item);
return preg_match("/{$pattern}/im", (string) $item);
}

protected function filterTestNotLikeRegex($item, $pattern)
Expand Down
18 changes: 9 additions & 9 deletions src/Search/Comb/Comb.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,11 @@ private function searchOverData($params, $raw_query)
$escaped_chunk = preg_quote($chunk, '#');
$chunk_is_word = ! preg_match('#\s#', $chunk);
$regex = [
'partial_anywhere' => '#'.$escaped_chunk.'#i',
'partial_from_start_anywhere' => '#(^|\s)'.$escaped_chunk.'#i',
'whole_anywhere' => '#(^|\s)'.$escaped_chunk.'($|\s)#i',
'partial_from_start' => '#^'.$escaped_chunk.'#i',
'whole' => '#^'.$escaped_chunk.'$#i',
'partial_anywhere' => '#'.$escaped_chunk.'#iu',
'partial_from_start_anywhere' => '#(^|\s)'.$escaped_chunk.'#iu',
'whole_anywhere' => '#(^|\s)'.$escaped_chunk.'($|\s)#iu',
'partial_from_start' => '#^'.$escaped_chunk.'#iu',
'whole' => '#^'.$escaped_chunk.'$#iu',
];

// loop over each data property
Expand Down Expand Up @@ -710,8 +710,8 @@ private function searchOverData($params, $raw_query)
*/
private function removeDisallowedMatches($params)
{
$disallowed = '#'.implode('|', $params['disallowed']).'#i';
$required = '#(?=.*'.implode(')(?=.*', $params['required']).')#i';
$disallowed = '#'.implode('|', $params['disallowed']).'#iu';
$required = '#(?=.*'.implode(')(?=.*', $params['required']).')#iu';
$new_data = [];

// this only applies to boolean mode
Expand Down Expand Up @@ -1062,7 +1062,7 @@ private function extractSnippets($value, $chunks)
$escaped_chunks = collect($chunks)
->map(fn ($chunk) => preg_quote($chunk, '#'))
->join('|');
$regex = '#(.*?)('.$escaped_chunks.')(.{0,'.$length.'}(?:\s|$))#i';
$regex = '#(.*?)('.$escaped_chunks.')(.{0,'.$length.'}(?:\s|$))#iu';
if (! preg_match_all($regex, $value, $matches, PREG_SET_ORDER)) {
return [];
}
Expand All @@ -1085,7 +1085,7 @@ private function extractSnippets($value, $chunks)
}
$snippets[] = trim($snippet);
}
if (preg_match('#('.$escaped_chunks.')#i', $surplus)) {
if (preg_match('#('.$escaped_chunks.')#iu', $surplus)) {
$snippets[] = trim($surplus);
}

Expand Down
4 changes: 2 additions & 2 deletions src/StaticCaching/Replacers/NoCacheReplacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private function insertJsInHead($contents, $cacher)
Str::position($contents, '</head>'),
])->filter()->min();

$js = "<script type=\"text/javascript\">{$cacher->getNocacheJs()}</script>";
$js = "<script>{$cacher->getNocacheJs()}</script>";

return Str::substrReplace($contents, $js, $insertBefore, 0);
}
Expand All @@ -113,6 +113,6 @@ private function insertJsInBody($contents, $cacher)
{
$js = $cacher->getNocacheJs();

return str_replace('</body>', '<script type="text/javascript">'.$js.'</script></body>', $contents);
return str_replace('</body>', '<script>'.$js.'</script></body>', $contents);
}
}
14 changes: 14 additions & 0 deletions tests/Search/CombTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,20 @@ public function it_can_search_for_slashes()
$this->assertSame(1, $result['info']['total_results']);
}

#[Test]
public function it_can_search_for_umlauts()
{
$comb = new Comb([
['content' => 'Üppercase umlaut'],
['content' => 'Lowercase ümlaut'],
]);

$result = $comb->lookUp('ü');
$this->assertIsArray($result);
$this->assertCount(2, $result);
$this->assertSame(2, $result['info']['total_results']);
}

#[Test]
public function it_filters_out_results_with_disallowed_words()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/StaticCaching/FullMeasureStaticCachingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function index()
$this->assertEquals(vsprintf('<html><body>1 <span class="nocache" data-nocache="%s">%s</span>%s</body></html>', [
$region->key(),
'<svg>Loading...</svg>',
'<script type="text/javascript">js here</script>',
'<script>js here</script>',
]), file_get_contents($this->dir.'/about_.html'));
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public function it_should_add_the_javascript_if_there_is_a_csrf_token()
// The cached response should have the token placeholder, and the javascript.
$this->assertTrue(file_exists($this->dir.'/about_.html'));
$this->assertEquals(vsprintf('<html><body>STATAMIC_CSRF_TOKEN%s</body></html>', [
'<script type="text/javascript">js here</script>',
'<script>js here</script>',
]), file_get_contents($this->dir.'/about_.html'));
}
}
Loading

0 comments on commit dfd8032

Please sign in to comment.