? ? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
22 Sep 2021

Pull Request for Issue #35633 .

Summary of Changes

This pull request (PR) changes the look up for TinyMCE templates so that it doesn't use anymore a single "glob" call using the "GLOB_BRACE" flag.

See https://www.php.net/manual/en/function.glob.php :

Note: The GLOB_BRACE flag is not available on some non GNU systems, like Solaris or Alpine Linux.

The use of that flag had been introduced with PR #33130 , so we don't have that issue in Joomla 3.

In addition to the above fix, this PR remove a redundant call to Factory::getLanguage() from inside the foreach loop. The language object is already fetched here https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/editors/tinymce/tinymce.php#L178 in the same routine and later not modified, so it can be used.

Testing Instructions

  1. Use the TinyMCE editor on a Joomla 4 installation on an operating system which doesn't support the "GLOB_BRACE" flag, like e.g. Alpine Linux.

  2. Check if PR #33130 still works by testing as described in that PR.

Actual result BEFORE applying this Pull Request

  1. See issue #35633 : error 0: Undefined constant "GLOB_BRACE".

  2. Cannot be tested if you have error 1.

Expected result AFTER applying this Pull Request

  1. No errors, all works fine.

  2. The test from PR #33130 works as it should.

Documentation Changes Required

None.

avatar richard67 richard67 - open - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Sep 2021
Category Front End Plugins
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar joeforjoomla joeforjoomla - test_item - 22 Sep 2021 - Tested successfully
avatar joeforjoomla
joeforjoomla - comment - 22 Sep 2021

I have tested this item successfully on d1a9820


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35636.

avatar dgrammatiko
dgrammatiko - comment - 22 Sep 2021

@richard67 can I ask a change here? Can we be more functional here:

			array_map(function ($suffix) use (&$template_path) {
				foreach (glob(JPATH_ROOT . $template_path . '/*.' . $suffix) as $filepath) {
					$fileinfo      = pathinfo($filepath);
					$filename      = $fileinfo['filename'];
					$full_filename = $fileinfo['basename'];

					if ($filename === 'index') {
						continue;
					}

					$lang        = Factory::getLanguage();
					$title       = $filename;
					$title_upper = strtoupper($filename);
					$description = ' ';

					if ($lang->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE')) {
						$title = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE');
					}

					if ($lang->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC')) {
						$description = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC');
					}

					$templates[] = array(
						'title' => $title,
						'description' => $description,
						'url' => Uri::root(true) . $template_path . '/' . $full_filename,
					);
				}
			}, ['html', 'txt']);
avatar Fedik
Fedik - comment - 22 Sep 2021

it PHP not JS, it is fine as it is ;)

avatar richard67 richard67 - change - 22 Sep 2021
Labels Added: ?
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67 richard67 - change - 22 Sep 2021
The description was changed
avatar richard67 richard67 - edited - 22 Sep 2021
avatar richard67
richard67 - comment - 22 Sep 2021

@joeforjoomla Could you test again? I had to modify my code a bit. Thanks in advance.

avatar joeforjoomla joeforjoomla - test_item - 23 Sep 2021 - Tested successfully
avatar joeforjoomla
joeforjoomla - comment - 23 Sep 2021

I have tested this item successfully on 02eceff


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35636.

avatar joomdonation joomdonation - test_item - 23 Sep 2021 - Tested successfully
avatar joomdonation
joomdonation - comment - 23 Sep 2021

I have tested this item successfully on 02eceff


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35636.

avatar joomdonation joomdonation - change - 23 Sep 2021
Status Pending Ready to Commit
avatar joomdonation
joomdonation - comment - 23 Sep 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35636.

avatar bembelimen bembelimen - change - 27 Sep 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-09-27 11:04:27
Closed_By bembelimen
Labels Added: ?
avatar bembelimen bembelimen - close - 27 Sep 2021
avatar bembelimen bembelimen - merge - 27 Sep 2021
avatar bembelimen
bembelimen - comment - 27 Sep 2021

Thx

Add a Comment

Login with GitHub to post a comment