TukuToi / tukutoi-maintenance

Enable and Control a Custom Maintenance Mode for your WordPress Website.
https://www.tukutoi.com/program/tukutoi-maintenance/
GNU General Public License v2.0
0 stars 1 forks source link

class-tkt-maintenance-loader #12

Closed joyously closed 3 years ago

joyously commented 3 years ago

https://github.com/TukuToi/tkt-maintenance/blob/18c552f0089296be71e39d1c9521a61df0f6d6e1/includes/class-tkt-maintenance-loader.php#L16

This whole class is duplicating what already exists in core, so all it does is waste memory.

smileBeda commented 3 years ago

It doesn't duplicate core, it makes core better :) because you don't need to pass array($object, 'method') as is usually necessary when add_filter or add_action in OOP. The loader does that for us, thus we can just pass $object. This is the main reason I like it.

However, there seems to be as well more technical reasoning here https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/issues/248#issuecomment-68713041 about why this even exists.

I will leave this as it is.

joyously commented 3 years ago

Yes, it does duplicate core. You don't need to pass the array if you don't use a class, and this plugin is so small it shouldn't be a class. Therefore, the reasoning at that comment doesn't apply. The business logic of this plugin is, in fact, dealing with WordPress.