? Success

User tests: Successful: Unsuccessful:

avatar nonumber
nonumber
18 Jul 2015

With the plugins in the editors-xtd folder you need to prefix the main class names with plgButton, like plgButtonFoobar
However if you also use an installer script, the prefix should be plgEditorsXtd, like plgEditorsXtdFoobarInstallerScript.

This is confusing and makes no sense.

This PR makes it possible to use plgEditorsXtd as a prefix to the main plugin class.
So you can use plgEditorsXtdFoobar and plgEditorsXtdFoobarInstallerScript

I'd rather deprecate the use of plgButton completely...

Testing instructions

Just rename the class name in, for instance, /plugins/editors-xtd/readmore/readmore.php from PlgButtonReadmore to PlgEditorsXtdReadmore.
Before this patch it will not show the Read More button any more. After this patch it will.

avatar nonumber nonumber - open - 18 Jul 2015
avatar nonumber nonumber - change - 18 Jul 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jul 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 18 Jul 2015

Looks good to me, consistency is always nice.

On Saturday, July 18, 2015, Peter van Westen notifications@github.com
wrote:

With the plugins in the editors-xtd folder you need to prefix the main
class names with plgButton, like plgButtonFoobar
However if you also use an installer script, the prefix should be
plgEditorsXtd, like plgEditorsXtdFoobarInstallerScript.

This is confusing and makes no sense.

This PR makes it possible to use plgEditorsXtd as a prefix to the main
plugin class.
So you can use plgEditorsXtdFoobar and plgEditorsXtdFoobarInstallerScript

I'd rather deprecate the use of plgButton completely...

You can view, comment on, or merge this pull request online at:

#7461
Commit Summary

  • Made both plgButton and plgEditorsXtd prefix possible
  • Update editor.php

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#7461.

avatar nonumber
nonumber - comment - 18 Jul 2015

Just a query: I see core extensions using prefix Plg (so uppercased first letter), however, the code checks for plg.
Should first letters in class names be upper- or lowercase?

avatar Bakual
Bakual - comment - 18 Jul 2015

:+1: as well.

Just a query: I see core extensions using prefix Plg (so uppercased first letter), however, the code checks for plg.
Should first letters in class names be upper- or lowercase?

Coding Standards (http://joomla.github.io/coding-standards/?coding-standards/chapters/php.md) says for classes:

Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).

For PHP itself it doesn't matter as class names aren't case sensitive.

avatar nonumber
nonumber - comment - 18 Jul 2015

Yeah, I know it doesn't matter for php itself.
But following those coding standards, should we be changing the code that checks for classnames to reflect this?
So do this instead:

$className = 'PlgEditorsXtd' . $plugin->name;

if (!class_exists($className))
{
    $className = 'PlgButton' . $plugin->name;
}

Or is that not worth fussing about?

(this would require 'fixes' in a lot of core files!)

avatar Bakual
Bakual - comment - 18 Jul 2015

For consistency it would make sense, but it's probably not worth the effort.

avatar nonumber
nonumber - comment - 18 Jul 2015

And outside of the scope of this PR anyway ;)

avatar mbabker
mbabker - comment - 18 Jul 2015

It really only starts to matter if you're using the autoloader because of
how it splits paths on camel case. Since extensions mostly aren't
autoloaded, it doesn't really matter right now. But down the line, I think
the code should match the expected naming convention (plgbuttonarticle !==
PlgButtonArticle)

On Saturday, July 18, 2015, Peter van Westen notifications@github.com
wrote:

Just a query: I see core extensions using prefix Plg (so uppercased first
letter), however, the code checks for plg.
Should first letters in class names be upper- or lowercase?


Reply to this email directly or view it on GitHub
#7461 (comment).

avatar nonumber
nonumber - comment - 18 Jul 2015

Ok, changed :)

avatar wilsonge wilsonge - change - 21 Jul 2015
Milestone Added:
avatar zero-24 zero-24 - change - 31 Jul 2015
Category Libraries
avatar zero-24 zero-24 - change - 31 Jul 2015
Easy No Yes
avatar nonumber
nonumber - comment - 10 Aug 2015

Can this go to RTC? Has 2 successful tests...

avatar zero-24 zero-24 - change - 10 Aug 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 10 Aug 2015

@nonumber


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

avatar joomla-cms-bot joomla-cms-bot - change - 10 Aug 2015
Labels Added: ?
avatar zero-24 zero-24 - alter_testresult - 10 Aug 2015 - mbabker: Tested successfully
avatar zero-24 zero-24 - alter_testresult - 10 Aug 2015 - Bakual: Tested successfully
avatar roland-d
roland-d - comment - 17 Oct 2015

I think this a B/C break. Anybody else using their own editors-xtd buttons would need to update their code as well or not?

avatar infograf768
infograf768 - comment - 17 Oct 2015

I do not think so, @roland-d
Code first look for PlgEditorsXtd' and if not exist, look for PlgButton

$className = 'PlgEditorsXtd' . $plugin->name;
+
+           if (!class_exists($className))
+           {
+               $className = 'PlgButton' . $plugin->name;
+           }
avatar roland-d
roland-d - comment - 17 Oct 2015

@infograf768 Thanks, you are correct, I missed that.

avatar roland-d roland-d - reference | 39db3c0 - 17 Oct 15
avatar roland-d roland-d - close - 17 Oct 2015
avatar roland-d
roland-d - comment - 17 Oct 2015

Thanks all, merged into 3.5-dev with commit 39db3c

avatar roland-d roland-d - change - 17 Oct 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-10-17 09:24:11
Closed_By roland-d
avatar roland-d roland-d - close - 17 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - close - 17 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - change - 17 Oct 2015
Labels Removed: ?
avatar nonumber nonumber - head_ref_deleted - 27 Oct 2015

Add a Comment

Login with GitHub to post a comment