Skip to content

Commit 78ea9f4

Browse files
authored
Merge branch 'joomla:5.3-dev' into ghactions-codestyle
2 parents aa59a4c + 5ce363b commit 78ea9f4

File tree

13 files changed

+82
-58
lines changed

13 files changed

+82
-58
lines changed

build/media_source/templates/administrator/atum/scss/_variables-dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ $atum-colors-dark: (
284284
btn-secondary-bg: $info-dark,
285285
btn-secondary-border: 1px solid color.adjust($info-dark, $lightness: 10%),
286286
btn-secondary-bg-hvr: color.adjust($info-dark, $lightness: -10%),
287+
btn-secondary-color-hvr: var(--template-text-light),
287288
btn-secondary-border-hvr: 1px solid color.adjust($info-dark, $lightness: 10%),
288289

289290
btn-dark-border: 1px solid rgba(0,0,0,.85),

build/media_source/templates/administrator/atum/scss/_variables.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ $atum-colors: (
339339
btn-secondary-bg: var(--template-bg-dark-60),
340340
btn-secondary-border: 1px solid var(--template-bg-dark-60),
341341
btn-secondary-color: var(--template-text-light),
342+
btn-secondary-bg-hvr: var(--template-bg-dark-70),
343+
btn-secondary-color-hvr: var(--template-text-light),
342344

343345
btn-info-color: var(--template-text-light),
344346
btn-info-bg: $info,

build/media_source/templates/administrator/atum/scss/vendor/bootstrap/_buttons.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
border: var(--btn-secondary-border);
5555

5656
&:hover {
57-
color: var(--btn-secondary-color-hvr);
58-
background: var(--btn-secondary-bg-hvr);
57+
color: var(--btn-secondary-color-hvr, var(--btn-secondary-color));
58+
background: var(--btn-secondary-bg-hvr, var(--template-bg-dark-70));
5959
}
6060
}
6161

build/media_source/templates/administrator/atum/scss/vendor/choicesjs/choices.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
position: relative;
6161
margin: 2px;
6262
color: $choices-list-multiple-item; //$white;
63-
background-color: $choices-list-multiple-item-bg; // var(--template-bg-dark);
63+
background-color: $choices-list-multiple-item-bg !important; // var(--template-bg-dark);
6464
margin-inline-end: 2px;
6565
border: 0;
6666
border-radius: $border-radius;

libraries/src/Dispatcher/ComponentDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function getController(string $name, string $client = '', array $config =
171171

172172
// Check if the controller could be created
173173
if (!$controller) {
174-
throw new \InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $name));
174+
throw new \InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $name), 404);
175175
}
176176

177177
return $controller;

libraries/src/HTML/Helpers/StringHelper.php

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ abstract class StringHelper
4040
*/
4141
public static function truncate($text, $length = 0, $noSplit = true, $allowHtml = true)
4242
{
43-
// Assume a lone open tag is invalid HTML.
43+
// Assume a lone open tag is invalid HTML
4444
if ($length === 1 && $text[0] === '<') {
4545
return '...';
4646
}
@@ -156,87 +156,80 @@ public static function truncate($text, $length = 0, $noSplit = true, $allowHtml
156156
*/
157157
public static function truncateComplex($html, $maxLength = 0, $noSplit = true)
158158
{
159-
// Start with some basic rules.
160159
$baseLength = \strlen($html);
161160

162-
// If the original HTML string is shorter than the $maxLength do nothing and return that.
163-
if ($baseLength <= $maxLength || $maxLength === 0) {
161+
// Early return for trivial cases
162+
if ($maxLength === 0 || $baseLength <= $maxLength) {
164163
return $html;
165164
}
166165

167-
// Take care of short simple cases.
168-
if ($maxLength <= 3 && $html[0] !== '<' && !str_contains(substr($html, 0, $maxLength - 1), '<') && $baseLength > $maxLength) {
166+
// Special case: very short cutoff, plain text.
167+
if ($maxLength <= 3 && $html[0] !== '<' && !str_contains(substr($html, 0, max(0, $maxLength - 1)), '<')) {
169168
return '...';
170169
}
171170

172-
// Deal with maximum length of 1 where the string starts with a tag.
171+
// Special case: string starts with a tag and maxLength is 1
173172
if ($maxLength === 1 && $html[0] === '<') {
174-
$endTagPos = \strlen(strstr($html, '>', true));
175-
$tag = substr($html, 1, $endTagPos);
176-
177-
$l = $endTagPos + 1;
178-
179-
if ($noSplit) {
180-
return substr($html, 0, $l) . '</' . $tag . '...';
173+
$endTagPos = strpos($html, '>');
174+
if ($endTagPos === false) {
175+
return '...';
181176
}
182-
183-
// @todo: $character doesn't seem to be used...
184-
$character = substr(strip_tags($html), 0, 1);
185-
186-
return substr($html, 0, $l) . '</' . $tag . '...';
177+
$tag = substr($html, 1, $endTagPos - 1);
178+
return substr($html, 0, $endTagPos + 1) . "</$tag>...";
187179
}
188180

189-
// First get the truncated plain text string. This is the rendered text we want to end up with.
190-
$ptString = HTMLHelper::_('string.truncate', $html, $maxLength, $noSplit, $allowHtml = false);
181+
// Get a plain text truncated string
182+
$ptString = HTMLHelper::_('string.truncate', $html, $maxLength, $noSplit, false);
191183

192-
// It's all HTML, just return it.
193184
if ($ptString === '') {
194185
return $html;
195186
}
196-
197-
// If the plain text is shorter than the max length the variable will not end in ...
198-
// In that case we use the whole string.
199187
if (!str_ends_with($ptString, '...')) {
200188
return $html;
201189
}
202-
203-
// Regular truncate gives us the ellipsis but we want to go back for text and tags.
204190
if ($ptString === '...') {
205191
$stripped = substr(strip_tags($html), 0, $maxLength);
206-
$ptString = HTMLHelper::_('string.truncate', $stripped, $maxLength, $noSplit, $allowHtml = false);
192+
$ptString = HTMLHelper::_('string.truncate', $stripped, $maxLength, $noSplit, false);
207193
}
208-
209-
// We need to trim the ellipsis that truncate adds.
210194
$ptString = rtrim($ptString, '.');
211195

212-
// Now deal with more complex truncation.
213196
while ($maxLength <= $baseLength) {
214-
// Get the truncated string assuming HTML is allowed.
215-
$htmlString = HTMLHelper::_('string.truncate', $html, $maxLength, $noSplit, $allowHtml = true);
197+
$htmlString = HTMLHelper::_('string.truncate', $html, $maxLength, $noSplit, true);
216198

217199
if ($htmlString === '...' && \strlen($ptString) + 3 > $maxLength) {
218-
return $htmlString;
200+
return '...';
219201
}
220202

221203
$htmlString = rtrim($htmlString, '.');
222204

223-
// Now get the plain text from the HTML string and trim it.
224-
$htmlStringToPtString = HTMLHelper::_('string.truncate', $htmlString, $maxLength, $noSplit, $allowHtml = false);
205+
// Get the plain text version of the truncated HTML string
206+
$htmlStringToPtString = HTMLHelper::_('string.truncate', $htmlString, $maxLength, $noSplit, false);
225207
$htmlStringToPtString = rtrim($htmlStringToPtString, '.');
226208

227-
// If the new plain text string matches the original plain text string we are done.
209+
// If plain text matches, we're done
228210
if ($ptString === $htmlStringToPtString) {
211+
// Remove whitespace, non-breaking spaces, and trailing tags before the ellipsis
212+
$htmlString = preg_replace('/(&nbsp;|\s)+(<\/[^>]+>)?$/u', '', $htmlString);
213+
214+
// If it ends with a closing tag, try to inject the ellipsis before the last closing tag
215+
if (preg_match('/(<\/[^>]+>)$/', $htmlString, $matches)) {
216+
return preg_replace('/(<\/[^>]+>)$/', '...$1', $htmlString);
217+
}
229218
return $htmlString . '...';
230219
}
231220

232-
// Get the number of HTML tag characters in the first $maxLength characters
221+
// Adjust length for HTML tags
233222
$diffLength = \strlen($ptString) - \strlen($htmlStringToPtString);
234-
235223
if ($diffLength <= 0) {
224+
// Remove whitespace, non-breaking spaces, and trailing tags before the ellipsis
225+
$htmlString = preg_replace('/(&nbsp;|\s)+(<\/[^>]+>)?$/u', '', $htmlString);
226+
227+
// If it ends with a closing tag, inject the ellipsis before the last closing tag
228+
if (preg_match('/(<\/[^>]+>)$/', $htmlString, $matches)) {
229+
return preg_replace('/(<\/[^>]+>)$/', '...$1', $htmlString);
230+
}
236231
return $htmlString . '...';
237232
}
238-
239-
// Set new $maxlength that adjusts for the HTML tags
240233
$maxLength += $diffLength;
241234
}
242235

libraries/src/Versioning/VersionableModelTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public function loadHistory($versionId, Table $table)
7979
$table->load($rowArray[$key]);
8080
}
8181

82+
// Fix null ordering when restoring history
83+
if (\array_key_exists('ordering', $rowArray) && $rowArray['ordering'] === null) {
84+
$rowArray['ordering'] = 0;
85+
}
86+
8287
return $table->bind($rowArray);
8388
}
8489
}

libraries/src/Versioning/Versioning.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ public static function store($typeAlias, $id, $data, $note = '')
123123
Factory::getApplication()->getDispatcher()->dispatch('onContentVersioningPrepareTable', $event);
124124
}
125125

126+
// Fix for null ordering - set to 0 if null
127+
if (\is_object($data)) {
128+
if (property_exists($data, 'ordering') && $data->ordering === null) {
129+
$data->ordering = 0;
130+
}
131+
} elseif (\is_array($data)) {
132+
if (\array_key_exists('ordering', $data) && $data['ordering'] === null) {
133+
$data['ordering'] = 0;
134+
}
135+
}
136+
126137
$historyTable->version_data = json_encode($data);
127138
$historyTable->version_note = $note;
128139

plugins/quickicon/eos/src/Extension/Eos.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class Eos extends CMSPlugin implements SubscriberInterface
3838
* @var string
3939
* @since 4.4.0
4040
*/
41-
private const EOS_DATE = '2027-10-19';
41+
private const EOS_DATE = '2027-10-12';
4242

4343
/**
4444
* Load the language file on instantiation.
@@ -189,7 +189,7 @@ private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
189189
'id' => 5,
190190
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_ERROR_SUPPORT_ENDED',
191191
'messageType' => 'error',
192-
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
192+
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_5.4.x_to_6.x_Planning_and_Upgrade_Step_by_Step',
193193
'snoozable' => false,
194194
];
195195
}
@@ -200,7 +200,7 @@ private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
200200
'id' => 4,
201201
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SUPPORT_ENDING',
202202
'messageType' => 'warning',
203-
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
203+
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_5.4.x_to_6.x_Planning_and_Upgrade_Step_by_Step',
204204
'snoozable' => true,
205205
];
206206
}
@@ -211,7 +211,7 @@ private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
211211
'id' => 3,
212212
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SECURITY_ONLY',
213213
'messageType' => 'warning',
214-
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
214+
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_5.4.x_to_6.x_Planning_and_Upgrade_Step_by_Step',
215215
'snoozable' => true,
216216
];
217217
}
@@ -233,7 +233,7 @@ private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
233233
'id' => 1,
234234
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_INFO_01',
235235
'messageType' => 'info',
236-
'messageLink' => 'https://joomla.org/5',
236+
'messageLink' => 'https://joomla.org/6',
237237
'snoozable' => true,
238238
];
239239
}

plugins/system/debug/src/Extension/Debug.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,12 @@ public function onAfterRespond(AfterRespondEvent|ApplicationEvent $event): void
344344
}
345345

346346
$debugBarRenderer = new JavascriptRenderer($this->debugBar, Uri::root(true) . '/media/vendor/debugbar/');
347-
$openHandlerUrl = Uri::base(true) . '/index.php?option=com_ajax&plugin=debug&group=system&format=raw&action=openhandler';
348-
$openHandlerUrl .= '&' . ($formToken ?? Session::getFormToken()) . '=1';
349-
350-
$debugBarRenderer->setOpenHandlerUrl($openHandlerUrl);
351347

348+
if ($this->params->get('track_request_history', false)) {
349+
$openHandlerUrl = Uri::base(true) . '/index.php?option=com_ajax&plugin=debug&group=system&format=raw&action=openhandler';
350+
$openHandlerUrl .= '&' . ($formToken ?? Session::getFormToken()) . '=1';
351+
$debugBarRenderer->setOpenHandlerUrl($openHandlerUrl);
352+
}
352353
/**
353354
* @todo disable highlightjs from the DebugBar, import it through NPM
354355
* and deliver it through Joomla's API

0 commit comments

Comments
 (0)