Skip to content

Commit 6202028

Browse files
committed
Merge remote-tracking branch 'origin/5.x'
2 parents 19cd7ad + eba3079 commit 6202028

11 files changed

Lines changed: 183 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Release Notes
22

3+
## 5.57.0 (2025-06-04)
4+
5+
### What's new
6+
- Added the option to add renderers to markdown parsers [#11827](https://github.com/statamic/cms/issues/11827) by @CapitaineToinon
7+
- Add renderer methods to `Markdown` facade docblock [#11845](https://github.com/statamic/cms/issues/11845) by @duncanmcclean
8+
- Add `not_in` parameter to Assets tag [#11820](https://github.com/statamic/cms/issues/11820) by @nopticon
9+
- Added `X-Statamic-Uncacheable` header to prevent responses being statically cached [#11817](https://github.com/statamic/cms/issues/11817) by @macaws
10+
11+
### What's fixed
12+
- Throw 404 response when OAuth provider doesn't exist [#11844](https://github.com/statamic/cms/issues/11844) by @duncanmcclean
13+
- Fix edition check in outpost [#11843](https://github.com/statamic/cms/issues/11843) by @duncanmcclean
14+
- Updated Statamic references in language files [#11835](https://github.com/statamic/cms/issues/11835) by @tommulroy
15+
- Fix create/edit CP nav descendants not properly triggering active status [#11832](https://github.com/statamic/cms/issues/11832) by @jesseleite
16+
- Fix editability of nav items without content reference [#11822](https://github.com/statamic/cms/issues/11822) by @duncanmcclean
17+
- Entries fieldtype: Only show "Allow Creating" option when using stack selector [#11816](https://github.com/statamic/cms/issues/11816) by @duncanmcclean
18+
- French translations [#11826](https://github.com/statamic/cms/issues/11826) by @ebeauchamps
19+
- Added null check for fieldActions within replicator [#11828](https://github.com/statamic/cms/issues/11828) by @martyf
20+
- Perform null check on data in video fieldtype [#11821](https://github.com/statamic/cms/issues/11821) by @martyf
21+
- Added checks for `Closure` instances instead of `is_callable` inside `Route::statamic(...)` [#11809](https://github.com/statamic/cms/issues/11809) by @JohnathonKoster
22+
- Further increase trackDirtyState timeout [#11811](https://github.com/statamic/cms/issues/11811) by @simonerd
23+
24+
25+
326
## 5.56.0 (2025-05-20)
427

528
### What's new

resources/lang/cs/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
'outpost_error_422' => 'Chyba v komunikaci se statamic.com.',
179179
'outpost_error_429' => 'Příliš mnoho požadavků. Zkuste to znovu později.',
180180
'outpost_issue_try_later' => 'Při komunikaci se službou statamic.com došlo k problému. Zkuste to prosím později.',
181-
'outpost_license_key_error' => 'Statamicu se nepodařilo dešifrovat poskytnutý soubor licenčního klíče. Prosím stáhněte znovu ze statmic.com.',
181+
'outpost_license_key_error' => 'Statamicu se nepodařilo dešifrovat poskytnutý soubor licenčního klíče. Prosím stáhněte znovu ze statamic.com.',
182182
'password_protect_enter_password' => 'Zadejte heslo',
183183
'password_protect_incorrect_password' => 'Heslo není správné',
184184
'password_protect_token_invalid' => 'Token není platný',

resources/lang/ja/messages.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
'form_configure_title_instructions' => '通常は「お問い合わせ」などの行動喚起です。',
129129
'getting_started_widget_blueprints' => 'ブループリントは、コンテンツの作成と保存に使用されるカスタム フィールドを定義します。',
130130
'getting_started_widget_collections' => 'コレクションには、サイト内のさまざまな種類のコンテンツが含まれます。',
131-
'getting_started_widget_docs' => 'Statmic の機能を正しく理解して、Statamic について理解しましょう。',
131+
'getting_started_widget_docs' => 'Statamic の機能を正しく理解して、Statamic について理解しましょう。',
132132
'getting_started_widget_header' => 'スタティックの入門',
133133
'getting_started_widget_intro' => '新しい静的サイトの構築を開始するには、次の手順から始めることをお勧めします。',
134134
'getting_started_widget_navigation' => 'ナビゲーションバーやフッターなどのレンダリングに使用できるリンクのマルチレベルリストを作成します。',
@@ -175,9 +175,9 @@
175175
'navigation_documentation_instructions' => 'ナビゲーションの構築、構成、レンダリングの詳細については、こちらをご覧ください。',
176176
'navigation_link_to_entry_instructions' => 'エントリにリンクを追加します。構成領域で追加のコレクションへのリンクを有効にします。',
177177
'navigation_link_to_url_instructions' => '内部または外部 URL へのリンクを追加します。設定領域のエントリへのリンクを有効にします。',
178-
'outpost_error_422' => 'statmic.com との通信中にエラーが発生しました。',
178+
'outpost_error_422' => 'statamic.com との通信中にエラーが発生しました。',
179179
'outpost_error_429' => 'statamic.com へのリクエストが多すぎます。',
180-
'outpost_issue_try_later' => 'statmic.com との通信で問題が発生しました。後でもう一度試してください。',
180+
'outpost_issue_try_later' => 'statamic.com との通信で問題が発生しました。後でもう一度試してください。',
181181
'outpost_license_key_error' => 'Statamic は提供されたライセンス キー ファイルを復号化できませんでした。statamic.com から再度ダウンロードしてください。',
182182
'password_protect_enter_password' => 'ロックを解除するにはパスワードを入力してください',
183183
'password_protect_incorrect_password' => 'パスワードが間違っています。',
@@ -246,11 +246,11 @@
246246
'user_groups_title_instructions' => '通常、編集者や写真家などの複数名詞',
247247
'user_wizard_account_created' => 'ユーザーアカウントが作成されました。',
248248
'user_wizard_intro' => 'ユーザーは、コントロール パネル全体で権限、アクセス、機能をカスタマイズする役割に割り当てることができます。',
249-
'user_wizard_invitation_body' => 'この Web サイトの管理を開始するには、 :siteで新しい Statmic アカウントをアクティブ化します。安全のため、以下のリンクは:expiry時間後に期限切れになります。その後、サイト管理者に新しいパスワードを問い合わせてください。',
249+
'user_wizard_invitation_body' => 'この Web サイトの管理を開始するには、 :siteで新しい Statamic アカウントをアクティブ化します。安全のため、以下のリンクは:expiry時間後に期限切れになります。その後、サイト管理者に新しいパスワードを問い合わせてください。',
250250
'user_wizard_invitation_intro' => 'アカウントのアクティベーションの詳細を記載したウェルカム電子メールを新しいユーザーに送信します。',
251251
'user_wizard_invitation_share' => 'これらの資格情報をコピーし、好みの方法で<code>:email</code>で共有します。',
252252
'user_wizard_invitation_share_before' => 'ユーザーを作成すると、好みの方法で<code>:email</code>で共有するための詳細が提供されます。',
253-
'user_wizard_invitation_subject' => ':siteで新しい Statmic アカウントをアクティブ化します',
253+
'user_wizard_invitation_subject' => ':siteで新しい Statamic アカウントをアクティブ化します',
254254
'user_wizard_roles_groups_intro' => 'ユーザーは、コントロール パネル全体で権限、アクセス、機能をカスタマイズする役割に割り当てることができます。',
255255
'user_wizard_super_admin_instructions' => 'スーパー管理者は、コントロール パネル内のすべてを完全に制御し、アクセスできます。この役割を賢明に与えてください。',
256256
'view_more_count' => '表示:count',

resources/lang/zh_TW/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
'getting_started_widget_header' => '開始使用 Statamic',
133133
'getting_started_widget_intro' => '要開始建構你的新 Statamic 網站,我們建議從這幾個步驟開始:',
134134
'getting_started_widget_navigation' => '建立多層連結列表,可用來組成導航列、底部連結等。',
135-
'getting_started_widget_pro' => 'Statmic Pro 包含無限使用者帳號、角色、權限、Git 整合、修訂版、多網站、以及更多功能!',
135+
'getting_started_widget_pro' => 'Statamic Pro 包含無限使用者帳號、角色、權限、Git 整合、修訂版、多網站、以及更多功能!',
136136
'git_disabled' => 'Statamic Git 整合目前已禁用。',
137137
'git_nothing_to_commit' => '無可提交的內容,內容路徑很乾淨!',
138138
'git_utility_description' => '管理 Git 追蹤的內容。',

src/Facades/Markdown.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* @method static Parser addExtension(\Closure $closure)
1818
* @method static Parser addExtensions(\Closure $closure)
1919
* @method static array extensions()
20+
* @method static Parser addRenderer(\Closure $closure)
21+
* @method static Parser addRenderers(\Closure $closure)
22+
* @method static array renderers()
2023
* @method static void withStatamicDefaults()
2124
* @method static Parser withAutoLinks()
2225
* @method static Parser withAutoLineBreaks()

src/Http/Controllers/OAuthController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Facades\Auth;
77
use Laravel\Socialite\Facades\Socialite;
88
use Laravel\Socialite\Two\InvalidStateException;
9+
use Statamic\Exceptions\NotFoundHttpException;
910
use Statamic\Facades\OAuth;
1011
use Statamic\Support\Arr;
1112
use Statamic\Support\Str;
@@ -17,6 +18,10 @@ public function redirectToProvider(Request $request, string $provider)
1718
$referer = $request->headers->get('referer');
1819
$guard = config('statamic.users.guards.web', 'web');
1920

21+
if (! OAuth::providers()->has($provider)) {
22+
throw new NotFoundHttpException();
23+
}
24+
2025
if (Str::startsWith(parse_url($referer)['path'], Str::ensureLeft(config('statamic.cp.route'), '/'))) {
2126
$guard = config('statamic.users.guards.cp', 'web');
2227
}
@@ -30,6 +35,10 @@ public function handleProviderCallback(Request $request, string $provider)
3035
{
3136
$oauth = OAuth::provider($provider);
3237

38+
if (! $oauth) {
39+
throw new NotFoundHttpException();
40+
}
41+
3342
try {
3443
$providerUser = $oauth->getSocialiteUser();
3544
} catch (InvalidStateException $e) {

src/Licensing/Outpost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private function licenseKeyFileResponse()
104104
Addon::all()
105105
->reject(fn ($addon) => array_key_exists($addon->package(), $response['packages']))
106106
->mapWithKeys(fn ($addon) => [$addon->package() => [
107-
'valid' => ! $addon->isCommercial(),
107+
'valid' => ! $addon->isCommercial() || $addon->edition() === 'free',
108108
'exists' => $addon->existsOnMarketplace(),
109109
'version_limit' => null,
110110
]])

src/Markdown/Parser.php

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Parser
1515

1616
protected $converter;
1717
protected $extensions = [];
18+
protected $renderers = [];
1819
protected $config = [];
1920

2021
public function __construct(array $config = [])
@@ -37,8 +38,12 @@ public function converter(): CommonMarkConverter
3738

3839
$env = $converter->getEnvironment();
3940

40-
foreach ($this->extensions() as $ext) {
41-
$env->addExtension($ext);
41+
foreach ($this->extensions() as $extension) {
42+
$env->addExtension($extension);
43+
}
44+
45+
foreach ($this->renderers() as $renderer) {
46+
$env->addRenderer(...$renderer);
4247
}
4348

4449
return $this->converter = $converter;
@@ -65,15 +70,50 @@ public function addExtensions(Closure $closure): self
6570

6671
public function extensions(): array
6772
{
68-
$exts = [];
73+
$extensions = [];
6974

7075
foreach ($this->extensions as $closure) {
71-
foreach (Arr::wrap($closure()) as $ext) {
72-
$exts[] = $ext;
76+
foreach (Arr::wrap($closure()) as $extension) {
77+
$extensions[] = $extension;
78+
}
79+
}
80+
81+
return $extensions;
82+
}
83+
84+
public function addRenderer(Closure $closure): self
85+
{
86+
$this->converter = null;
87+
88+
$this->renderers[] = $closure;
89+
90+
return $this;
91+
}
92+
93+
public function addRenderers(Closure $closure): self
94+
{
95+
return $this->addRenderer($closure);
96+
}
97+
98+
public function renderers(): array
99+
{
100+
$renderers = [];
101+
102+
foreach ($this->renderers as $closure) {
103+
$closureRenderers = $closure();
104+
105+
// When the first item isn't an array, assume it's a single
106+
// renderer and wrap it in an array.
107+
if (! is_array($closureRenderers[0])) {
108+
$closureRenderers = [$closureRenderers];
109+
}
110+
111+
foreach ($closureRenderers as $renderer) {
112+
$renderers[] = $renderer;
73113
}
74114
}
75115

76-
return $exts;
116+
return $renderers;
77117
}
78118

79119
public function withStatamicDefaults()
@@ -151,6 +191,10 @@ public function newInstance(array $config = [])
151191
$parser->addExtensions($ext);
152192
}
153193

194+
foreach ($this->renderers as $renderer) {
195+
$parser->addRenderers($renderer);
196+
}
197+
154198
return $parser;
155199
}
156200
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Tests\Markdown\Fixtures;
4+
5+
use League\CommonMark\Extension\CommonMark\Node\Block\Heading;
6+
use League\CommonMark\Node\Node;
7+
use League\CommonMark\Renderer\ChildNodeRendererInterface;
8+
use League\CommonMark\Renderer\NodeRendererInterface;
9+
10+
class HeadingRenderer implements NodeRendererInterface
11+
{
12+
public function render(Node $node, ChildNodeRendererInterface $childRenderer)
13+
{
14+
if (! ($node instanceof Heading)) {
15+
throw new \InvalidArgumentException('Incompatible node type: '.get_class($node));
16+
}
17+
18+
return "<h1 data-custom-renderer>{$childRenderer->renderNodes($node->children())}</h1>";
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Tests\Markdown\Fixtures;
4+
5+
use League\CommonMark\Extension\CommonMark\Node\Inline\Link as InlineLink;
6+
use League\CommonMark\Node\Node;
7+
use League\CommonMark\Renderer\ChildNodeRendererInterface;
8+
use League\CommonMark\Renderer\NodeRendererInterface;
9+
10+
class LinkRenderer implements NodeRendererInterface
11+
{
12+
public function render(Node $node, ChildNodeRendererInterface $childRenderer)
13+
{
14+
if (! ($node instanceof InlineLink)) {
15+
throw new \InvalidArgumentException('Incompatible node type: '.get_class($node));
16+
}
17+
18+
return "<a data-custom-renderer href=\"{$node->getUrl()}\" title=\"{$node->getTitle()}\">{$childRenderer->renderNodes($node->children())}</a>";
19+
}
20+
}

0 commit comments

Comments
 (0)