WordPress Plugin Framework Reloaded
[Plugin: WordPress Plugin Framework Reloaded] A couple of tips for improvement... (1 post)

  1. amereservant
    Posted 4 years ago #

    One thing I was curious of is why the properties for the parent menu slugs/sections and I discovered these are really just adding bulk to your class for no beneficial reason....

    1. Remove the $PARENT_MENU_* properties

     * @var string  Menu Sections
    protected $PARENT_MENU_DASHBOARD = "index.php";
    protected $PARENT_MENU_WRITE = "post-new.php";
    protected $PARENT_MENU_MANAGE = "edit.php";
    protected $PARENT_MENU_PAGES = "edit-pages.php";
    protected $PARENT_MENU_COMMENTS = "edit-comments.php";
    protected $PARENT_MENU_BLOGROLL = "link-manager.php";
    protected $PARENT_MENU_PRESENTATION = "themes.php";
    protected $PARENT_MENU_PLUGINS = "plugins.php";
    protected $PARENT_MENU_USERS = "users.php";
    protected $PARENT_MENU_OPTIONS = "options-general.php";

    2. Cleaning up registerOptionsPage() Method
    In your class method registerOptionsPage(), the switch($this->menuHook) is unnecessary. Since the functions add_management_page() etc. are all wrapper functions of add_submenu_page(), it would be much simpler to just call the add_submenu_page() function and do away with the switch() function unless you added that for reference purposes or something.
    This would also further the lack of need for the properties mentioned in suggestion 1.

    Also on that same topic, you specify a 6th parameter for the $this->_appLogoFile, yet none of these functions have a 6th parameter for an icon. Check the source code at http://core.trac.wordpress.org/browser/tags/3.2.1/wp-admin/includes/plugin.php.

    3. _hook and _slug properties
    I couldn't see why both of these couldn't be combined and just a single property used for both, but maybe you had a particular reason for this. It made better sense to me to lighten the code and just use say $_slug even where you're using $_hook....

    Well there's a few suggestions/ideas I found and there's more, but I'll leave just those for now. Thanks for the work on this and giving me something to go by for developing my own framework to use since I got tired of re-writing all of my plugin functions every time I got ready to make a new one.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Plugin Framework Reloaded
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic