ForumPostAssistant / FPA

The Forum Post Assistant (FPA) script has been developed to assist Joomla!® forum posters to be able to post relevant system, instance, PHP and troubleshooting information directly in to a pre-formatted forum post. This will save a few hours of posting back and forth, asking for, and explaining how to acquire useful information in order for other forum users to help troubleshoot a problem.
https://forumpostassistant.github.io/docs/
GNU General Public License v2.0
25 stars 15 forks source link

No template star <7.0 #98

Closed frostmakk closed 4 years ago

frostmakk commented 4 years ago

@sozzled Why does this happen when running PHP lower than 7.0?

image

sozzled commented 4 years ago

Good question, @frostmakk (and well caught). See https://stackoverflow.com/questions/6058394/unicode-character-in-php-string

The idea was to find a way to encode the HTML entity ★ as a "character" that can be displayed in the forum. The phpBB forum does not allow the use of HTML entities.

The code is generated by lines 5482 and 5524 that look like

                                                                            $bldop = '[b]'. "\u{2605} ";

It's written that way instead of

                                                                            $bldop = '[b]'. "★ ";

I used the "heredoc" syntax for double-quoted strings (see https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) because it has a simpler looking syntax. You are right: that syntax only works for PHP 7 and above and is suitable for people who use PHP 5 (or lower).

Instead of lines 5482 and 5524 (as they are), replace these with

                                                                         $bldop = '[b]'. mb_convert_encoding('&#x2605;', 'UTF-8', 'HTML-ENTITIES');

This works for me. Can you try this, please?

Also, the "bolding" is probably unnecessary and we could replace the pairs of lines at 5482-5483 and 5524-5525 with

                                                                         $bldop = mb_convert_encoding('&#x2605;', 'UTF-8', 'HTML-ENTITIES');
                                                                        $bldcl = '';

... and this would save another 7 characters of BBcode (in two places) = 14 BBcode characters saved.

RussW commented 4 years ago

I've reverted the change from unsupported PHP unicode "star" character back to simply wrapping in [b] BBCode.

Didn't implement the proposed mb_convert_entities forcing UTF8 change, as mb_string may not be installed on the unknown server and the enforced UTF8 character set will fail on some multibyte & character based languages where UTF is not the primary (or even optioned) character set.

sozzled commented 4 years ago

Fair enough. I don't have a PHP 5 environment to test. Also, I don't have an environment where I don't use UTF8 character encoding. It's a pity but we probably have to live without this.

frostmakk commented 4 years ago

It used to be underlined...

RussW commented 4 years ago

I didn't [u] it again as per above reference to not being needed and saving characters... Can be done again if needed

sozzled commented 4 years ago

Yes, it used to be underlined and bolded. Is there a need for both?

sozzled commented 4 years ago

I was seeking a way of applying the "star" so that the BBcode was consistent with the desktop view. Pity that the J! forum BBcode doesn't allow HTML entities, eh?

Lastly, I'm sorry that my idea caused this bug.

sozzled commented 4 years ago

Didn't implement the proposed mb_convert_entities forcing UTF8 change, as mb_string may not be installed on the unknown server and the enforced UTF8 character set will fail on some multibyte & character based languages where UTF is not the primary (or even optioned) character set.

Just wondering if we could use bolding and/or underlining if mb_string is unavailable in the target environment. Perhaps an if-test that says

if mbstring is available then display a star, else bold and/or underline

???

(I don't know how to test for that. As I wrote earlier, this is a non-critical change that can be deferred to another time after v1.6.0 is released.)

RussW commented 4 years ago

KISS.... I think you're getting a little "too clever" for little if any gain.

sozzled commented 4 years ago

Ssshh ... I know it's non-urgent. I'll look into it another time.

BTW, what happens if the BBcode character count exceeds 19,xxx characters? Does the copy/paste still work?

frostmakk commented 4 years ago

Bold can be difficult to see. UL is better. Bold & UL is best. I really don't give a F about saving a couple of characters...

sozzled commented 4 years ago

really don't give a **** about saving a couple of characters...

Every bit helps. Even a few characters can mean the difference between successfully posting the FPA report on the forum or not. See also my earlier post: what happens when the character count exceeds the 19,xxx characters? Can the user still copy the BBcode?

mandville commented 4 years ago

what happens when the character count exceeds the 19,xxx characters? Can the user > still copy the BBcode?

they can probably print off the pdf, screeengrab it and then post the image... [grin]

RussW commented 4 years ago

Windows has the lowest "clipboard buffer" at 1mb before W10 and 4mb from W10, MacOSX provides a dynamic %'age of available memory (including swap space), so depending on requirements the copy function should technically support up to 4mb on Windows and as big as the system can free-memory or swap, Linux has a similar process as to apple, but is willing to also unload unused allocated memory to accommodate a large copy function if it can.

sozzled commented 4 years ago

@mandville & @RussW

There's a character count that displays the BBcode in the FPA. What happens if the generated BBcode exceeds 19,xxx (I can't remember the exact number) of characters? Is the copy facility disabled? Is the generated text (to be copied) truncated? Does the user have the ability to copy parts of the FPA BBcode to be used as multiple posts on the forum?

I would like to know that, please. I don't have any sites where the character count of the generated BBcode exceeds 19,xxx characters and therefore I haven't tested it to see what might happen. Has anyone tried it?

I'm trying to defuse the debate about not caring how many characters of BBcode might be involved and to reach an understanding that every saving (even a few characters) may be useful.

RussW commented 4 years ago

At the moment, FPA posts a message to the user to re-run FPA without some options selected, then run it a second time with only the previously unchecked options.

Assisting with that issue is slated to be worked on at a later date.

[EDIT] I've had a brief look at it whilst tinkering with the GUI Update, the default (non-selectable) output is generally around the 5500-6000 characters I think, so my thoughts were to (in-future) present the user with two texboxes, the first with just the basic/core output and the second to be posted in to a new reply in a second textbox, providing an additional 5-6k of characters to the second post.

mandville commented 4 years ago

5-6k@ i suppose after installing virtuefart, k2, seo everything, sitemaps galore then it would hit that figure

sozzled commented 4 years ago

Thanks, @RussW. I wasn't sure about that.

fpaRunTime_options

No problem.

RussW commented 4 years ago

it may not be a perfect solution, but if the first textbox then only contains the core information, and it is not placed in the second textbox, then effectively thats a 25% increased in useable characters for the non-core/optional information in the second textbox/reply.

sozzled commented 4 years ago

Good solution for the occasions when even one character above the 19,xxx limit clobbers the ability to generate the BBcode report and/or copy the BBcode. I'm happy with that.

RussW commented 4 years ago

I've been thinking (which I know can be a dangerous thing), but...

In addition to still catering for the larger post data, and whilst appreciating that everyone wants as much information, as quick as possible. Is it really necessary to have every option checked as the default for the Forum Post Output? Would it not be more useful to have a more "focussed" approach?

My mind, is thinking "relevancy" - Is every piece of information needed for every problem, or for initial problem diagnosis? Or is it better to obtain the problem description from a user and initial basic data, then ask for "suspect" relevant extra information in an additional post?

sidenote: this activity also negates some of the apparent whinges or complaints by some community members about excessive use, or misuse and abuse of the FPA in the forum, plus in the initial diagnosis stages, where users are less experienced with FPA, reduces the risk of exceeding the character limits

A potential addition could be to have "pre-designed" reports replacing the current options; say something thats purely DB Related, something that purely permissions/ownership orientated, one for components/modules and plugins only, and then and all-n-sundry report.

Understand that this is somewhat of a contentious proposal, especially considering I rarely enter the fray in the forums any longer. Just "thinking out loud" and thinking about ways to enhance the user experience of FPA (and Joomla!) and the supporters getting relevant and not excessive information to hunt through every time (the proverbial "needle in a haystack" syndrome, also reducing from a few comments I've read, the opportunity of unfocussed "nit-picking" of unrelated configurations/information)

sozzled commented 4 years ago

@RussW: I agree with you. I have a dozen ideas to contribute (so you will have to wait until I make time to put a list of those together).

In the meantime, I have another suggestion in place of the five-pointed star idea.

At lines 5482-5483 and 5524-5525:

                                                                    $bldop = '* ';  // display an asterisk with the default template
                                                                    $bldcl = '';
RussW commented 4 years ago

@sozzled put together a list of those idea's in a single new issue as a proposal, these can then be reviewed by everyone and if workable and possible each proposal can then be added under it's own issue (tagged: as a wishlist) and put on the list of things to do.

sozzled commented 4 years ago

I'll do that—create a list—over the next couple of weeks.

What did you think of my idea about "starring" the default template with an asterisk?