Skip to content

Commit 286471d

Browse files
authored
Merge branch '5.3-dev' into fix/vuecs
2 parents fc9a63d + 38e90bf commit 286471d

File tree

4 files changed

+77
-32
lines changed

4 files changed

+77
-32
lines changed

libraries/src/Document/Document.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class Document
144144
* @var array
145145
* @since 1.7.0
146146
*
147-
* @deprecated 4.3 will be removed in 6.0
147+
* @deprecated 4.3 will be removed in 7.0
148148
* Use WebAssetManager
149149
*/
150150
public $_scripts = [];
@@ -155,7 +155,7 @@ class Document
155155
* @var array
156156
* @since 1.7.0
157157
*
158-
* @deprecated 4.3 will be removed in 6.0
158+
* @deprecated 4.3 will be removed in 7.0
159159
* Use WebAssetManager
160160
*/
161161
public $_script = [];
@@ -173,7 +173,7 @@ class Document
173173
* @var array
174174
* @since 1.7.0
175175
*
176-
* @deprecated 4.3 will be removed in 6.0
176+
* @deprecated 4.3 will be removed in 7.0
177177
* Use WebAssetManager
178178
*/
179179
public $_styleSheets = [];
@@ -184,7 +184,7 @@ class Document
184184
* @var array
185185
* @since 1.7.0
186186
*
187-
* @deprecated 4.3 will be removed in 6.0
187+
* @deprecated 4.3 will be removed in 7.0
188188
* Use WebAssetManager
189189
*/
190190
public $_style = [];
@@ -503,7 +503,7 @@ public function setMetaData($name, $content, $attribute = 'name')
503503
*
504504
* @since 1.7.0
505505
*
506-
* @deprecated 4.3 will be removed in 6.0
506+
* @deprecated 4.3 will be removed in 7.0
507507
* Use WebAssetManager
508508
* Example: $wa->registerAndUseScript(...);
509509
*/
@@ -530,7 +530,7 @@ public function addScript($url, $options = [], $attribs = [])
530530
*
531531
* @since 1.7.0
532532
*
533-
* @deprecated 4.3 will be removed in 6.0
533+
* @deprecated 4.3 will be removed in 7.0
534534
* Use WebAssetManager
535535
* Example: $wa->addInlineScript(...);
536536
*/
@@ -602,7 +602,7 @@ public function getScriptOptions($key = null)
602602
*
603603
* @since 1.7.0
604604
*
605-
* @deprecated 4.3 will be removed in 6.0
605+
* @deprecated 4.3 will be removed in 7.0
606606
* Use WebAssetManager
607607
* Example: $wa->registerAndUseStyle(...);
608608
*/
@@ -634,7 +634,7 @@ public function addStyleSheet($url, $options = [], $attribs = [])
634634
*
635635
* @since 1.7.0
636636
*
637-
* @deprecated 4.3 will be removed in 6.0
637+
* @deprecated 4.3 will be removed in 7.0
638638
* Use WebAssetManager
639639
* Example: $wa->addInlineStyle(...);
640640
*/

libraries/src/HTML/HTMLHelper.php

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,31 @@ public static function iframe($url, $name, $attribs = null, $noFrames = '')
348348
return '<iframe src="' . $url . '" ' . $attribs . ' name="' . $name . '">' . $noFrames . '</iframe>';
349349
}
350350

351+
/**
352+
* Look for path relatively to media folder.
353+
*
354+
* @param string $folder Folder name to search in (i.e. images, css, js).
355+
* @param string $file Path to file to check.
356+
* @param array $options Array with additional options:
357+
* relative: Flag if the path to the file is relative to the /media folder (and searches in template);
358+
* detectBrowser: Flag if the browser should be detected to include specific browser file;
359+
* detectDebug: Flag if debug mode is enabled to include uncompressed files (for css, js)
360+
* (boolean) - will enable debugging depends on site configuration, (1) - force debug On, (-1) - force debug Off;
361+
*
362+
* @return string
363+
* @since __DEPLOY_VERSION__
364+
*/
365+
final public static function mediaPath(string $folder, string $file, array $options = []): string
366+
{
367+
$relative = $options['relative'] ?? false;
368+
$detectBrowser = $options['detectBrowser'] ?? false;
369+
$detectDebug = $options['detectDebug'] ?? true;
370+
371+
$includes = static::includeRelativeFiles($folder, $file, $relative, $detectBrowser, $detectDebug);
372+
373+
return $includes[0] ?? '';
374+
}
375+
351376
/**
352377
* Compute the files to be included
353378
*
@@ -356,6 +381,7 @@ public static function iframe($url, $name, $attribs = null, $noFrames = '')
356381
* @param boolean $relative Flag if the path to the file is relative to the /media folder (and searches in template).
357382
* @param boolean $detectBrowser Flag if the browser should be detected to include specific browser files.
358383
* @param boolean $detectDebug Flag if debug mode is enabled to include uncompressed files if debug is on.
384+
* (boolean) - will enable debugging depends on site configuration, (1) - force debug On, (-1) - force debug Off;
359385
*
360386
* @return array files to be included.
361387
*
@@ -364,12 +390,17 @@ public static function iframe($url, $name, $attribs = null, $noFrames = '')
364390
*/
365391
protected static function includeRelativeFiles($folder, $file, $relative, $detectBrowser, $detectDebug)
366392
{
367-
// Set debug flag
368-
$debugMode = false;
369-
370393
// Detect debug mode
371-
if ($detectDebug && JDEBUG) {
372-
$debugMode = true;
394+
switch (true) {
395+
case \is_bool($detectDebug):
396+
$debugMode = $detectDebug && JDEBUG;
397+
break;
398+
case $detectDebug === 1:
399+
$debugMode = true;
400+
break;
401+
case $detectDebug === -1:
402+
default:
403+
$debugMode = false;
373404
}
374405

375406
// If http is present in filename
@@ -757,9 +788,14 @@ public static function image($file, $alt, $attribs = null, $relative = false, $r
757788
*
758789
* @see Browser
759790
* @since 1.5
791+
*
792+
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0
793+
* Use WebAssetManager::useStyle() or WebAssetManager::registerAndUseStyle() instead.
760794
*/
761795
public static function stylesheet($file, $options = [], $attribs = [])
762796
{
797+
@trigger_error('Method HTMLHelper::stylesheet() is deprecated, and will be removed in 7.0', \E_USER_DEPRECATED);
798+
763799
$options['relative'] = $options['relative'] ?? false;
764800
$options['pathOnly'] = $options['pathOnly'] ?? false;
765801
$options['detectBrowser'] = $options['detectBrowser'] ?? false;
@@ -804,9 +840,14 @@ public static function stylesheet($file, $options = [], $attribs = [])
804840
*
805841
* @see HTMLHelper::stylesheet()
806842
* @since 1.5
843+
*
844+
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0
845+
* Use WebAssetManager::useScript() or WebAssetManager::registerAndUseScript() instead.
807846
*/
808847
public static function script($file, $options = [], $attribs = [])
809848
{
849+
@trigger_error('Method HTMLHelper::script() is deprecated, and will be removed in 7.0', \E_USER_DEPRECATED);
850+
810851
$options['relative'] = $options['relative'] ?? false;
811852
$options['pathOnly'] = $options['pathOnly'] ?? false;
812853
$options['detectBrowser'] = $options['detectBrowser'] ?? false;

libraries/src/WebAsset/WebAssetItem.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,17 @@ protected function resolvePath(string $path, string $type): string
304304

305305
$file = $path;
306306
$external = $this->isPathExternal($path);
307+
$folders = ['script' => 'js', 'stylesheet' => 'css'];
307308

308309
if (!$external) {
309310
// Get the file path
310311
$file = HTMLHelper::_(
311-
$type,
312+
'mediaPath',
313+
$folders[$type],
312314
$path,
313315
[
314-
'pathOnly' => true,
315-
'relative' => !$this->isPathAbsolute($path),
316+
'detectDebug' => $this->getOption('debug') ? 1 : true,
317+
'relative' => !$this->isPathAbsolute($path),
316318
]
317319
);
318320
}

plugins/system/accessibility/src/Extension/Accessibility.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ public function onBeforeCompileHead(BeforeCompileHeadEvent $event): void
7272
// Load language file.
7373
$this->loadLanguage();
7474

75+
$language = $app->getLanguage();
76+
7577
// Determine if it is an LTR or RTL language
76-
$direction = $app->getLanguage()->isRtl() ? 'right' : 'left';
78+
$direction = $language->isRtl() ? 'right' : 'left';
7779

7880
// Detect the current active language
79-
$lang = $app->getLanguage()->getTag();
81+
$lang = $language->getTag();
8082

8183
/**
8284
* Add strings for translations in Javascript.
@@ -86,20 +88,20 @@ public function onBeforeCompileHead(BeforeCompileHeadEvent $event): void
8688
'accessibility-options',
8789
[
8890
'labels' => [
89-
'menuTitle' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_MENU_TITLE'),
90-
'increaseText' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_INCREASE_TEXT'),
91-
'decreaseText' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_DECREASE_TEXT'),
92-
'increaseTextSpacing' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_INCREASE_SPACING'),
93-
'decreaseTextSpacing' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_DECREASE_SPACING'),
94-
'invertColors' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_INVERT_COLORS'),
95-
'grayHues' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_GREY'),
96-
'underlineLinks' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_UNDERLINE'),
97-
'bigCursor' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_CURSOR'),
98-
'readingGuide' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_READING'),
99-
'textToSpeech' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_TTS'),
100-
'speechToText' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_STT'),
101-
'resetTitle' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_RESET'),
102-
'closeTitle' => $app->getLanguage()->_('PLG_SYSTEM_ACCESSIBILITY_CLOSE'),
91+
'menuTitle' => $language->_('PLG_SYSTEM_ACCESSIBILITY_MENU_TITLE'),
92+
'increaseText' => $language->_('PLG_SYSTEM_ACCESSIBILITY_INCREASE_TEXT'),
93+
'decreaseText' => $language->_('PLG_SYSTEM_ACCESSIBILITY_DECREASE_TEXT'),
94+
'increaseTextSpacing' => $language->_('PLG_SYSTEM_ACCESSIBILITY_INCREASE_SPACING'),
95+
'decreaseTextSpacing' => $language->_('PLG_SYSTEM_ACCESSIBILITY_DECREASE_SPACING'),
96+
'invertColors' => $language->_('PLG_SYSTEM_ACCESSIBILITY_INVERT_COLORS'),
97+
'grayHues' => $language->_('PLG_SYSTEM_ACCESSIBILITY_GREY'),
98+
'underlineLinks' => $language->_('PLG_SYSTEM_ACCESSIBILITY_UNDERLINE'),
99+
'bigCursor' => $language->_('PLG_SYSTEM_ACCESSIBILITY_CURSOR'),
100+
'readingGuide' => $language->_('PLG_SYSTEM_ACCESSIBILITY_READING'),
101+
'textToSpeech' => $language->_('PLG_SYSTEM_ACCESSIBILITY_TTS'),
102+
'speechToText' => $language->_('PLG_SYSTEM_ACCESSIBILITY_STT'),
103+
'resetTitle' => $language->_('PLG_SYSTEM_ACCESSIBILITY_RESET'),
104+
'closeTitle' => $language->_('PLG_SYSTEM_ACCESSIBILITY_CLOSE'),
103105
],
104106
'icon' => [
105107
'position' => [

0 commit comments

Comments
 (0)