Skip to content

sultann/admin-page-framework

 
 

Repository files navigation

Welcome to our GitHub Repository

Admin Page Framework is an OOP based open source WordPress library that facilitates theme and plugin development.

Scrutinizer Code Quality

Screenshots

Admin Page Framework - Text, Password, and Textarea

Admin Page Framework - Selectors   Admin Page Framework - Image, Media Library, and File Uploads   Admin Page Framework - Taxonomies and Post Types Checklist   Admin Page Framework - Misc   Admin Page Framework - Form Input Verification   Admin Page Framework - Export and Import Options   Admin Page Framework - Contextual Help Pane   Admin Page Framework - Custom Post Type and Meta Box   Admin Page Framework - Meta Boxes in Pages Added by the Framework   Admin Page Framework - Form Fields in Taxonomy Page   Admin Page Framework - Form Sections in Tabbed Boxes and Repeatable Option   Admin Page Framework - Auto-complete Custom Field Type   Admin Page Framework - Widget Form Fields

Installation

There are mainly two ways to include the framework.

  • Use the framework loader plugin.

    • The latest development version can be found here.
    • The latest stable version can be downloaded here.
  • Use the generated framework files which can be downloaded via Dashboard -> Admin Page Framework -> Tools -> Generator.

For more details, see the Getting Started (Dashboard -> Admin Page Framework -> Help -> Getting Started) of the admin pages of the loader plugin.

Example

Create a Page

Admin Page Framework - Getting Started

<?php
/* Plugin Name: Admin Page Framework - Getting Started */ 

if ( ! class_exists( 'AdminPageFramework' ) ) {
    include( dirname( __FILE__ ) . '/library/admin-page-framework/admin-page-framework.php' );
}
    
class APF extends AdminPageFramework {

    public function setUp() {
        
        $this->setRootMenuPage( 'Settings' );    // where to belong
        $this->addSubMenuItem(
            array(
                'title'        => 'My First Page',
                'page_slug'    => 'myfirstpage'
            )
        );
            
    }
    
    /**
     * @callback        action      do_{page slug}
     */
    public function do_myfirstpage() {
        ?>
        <h3>Say Something</h3>
        <p>This is my first admin page!</p>
        <?php   
    }
    
}
new APF;

Create a Form

Admin Page Framework - My First Form

<?php
/* Plugin Name: Admin Page Framework - My First Form */ 

if ( ! class_exists( 'AdminPageFramework' ) ) {
    include( dirname( __FILE__ ) . '/library/admin-page-framework/admin-page-framework.php' );
}
    
class APF_MyFirstFrom extends AdminPageFramework {

    public function setUp() {
        
        $this->setRootMenuPage( 'My Settings' );    // create a root page 
        $this->addSubMenuItem(
            array(
                'title'        => 'My First Form',
                'page_slug'    => 'my_first_form'
            )
        );
                    
    }
    
    /**
     * The pre-defined callback method that is triggered when the page loads.
     * @callback        action      load_{page slug}
     */     
    public function load_my_first_form( $oAdminPage ) {
    
        $this->addSettingSections(    
            array(
                'section_id'    => 'my_first_text_section',    
                'page_slug'     => 'my_first_form',    
            )
        );
        
        $this->addSettingFields(
            array(    
                'field_id'      => 'text',
                'section_id'    => 'my_first_text_section',
                'title'         => 'Text',
                'type'          => 'text',
                'default'       => 123456,
            ),
            array(    
                'field_id'      => 'submit',
                'type'          => 'submit',
            )
        );
        
    }
    
}
new APF_MyFirstFrom;

See more code examples in Dashboard -> AdminPageFramework -> Help -> Examples.

Documentation

Online documentation

Tutorials

Online tutorials

  1. Create an Admin Page
  2. Create a Form
  3. Create a Page Group
  4. Create In-page Tabs
  5. Organize a Form with Sections
  6. Use Section Tabs and Repeatable Sections
  7. Validate Submitted Form Data of a Single Field
  8. Validate Submitted Form Data of Multiple Fields
  9. Add a Meta Box in an Admin Page
  10. Add a Page Meta Box Specific to an In-page Tab
  11. Add a Meta Box for Posts
  12. Create a Custom Post Type and Custom Taxonomy
  13. Add a Meta Box to a Custom Post Type

Getting Framework Core Files

In order to modify the framework development files, you need to clone the repository files.

Simply clone the repository from either of the following addresses.

ssh:

git@github.com:michaeluno/admin-page-framework.git

https:

https://github.com/michaeluno/admin-page-framework.git

With Composer, create a composer.json file with the following contents and perform php composer.phar install.

{
    "require": {
        "michaeluno/admin-page-framework": "dev-master"
    }
}

Modifying Framework Core Files

The core files are in the development directory.

  1. Make sure the constant WP_DEBUG is set to true in the wp-config.php file of your development site. If this is false, the loader plugin will load the complied files in the library directory.
  2. Modify the core files and make sure your changes take effect.
  3. If you add class files, make sure to run run.sh in tool/inclusion_class_list to generate inclusion file lists.
  4. After all the modifications are done, run php-class-files-beautifier.sh in tool/beautifier to compile the files.

Bugs

If you find an issue, let us know here!

Support

This is a developer's portal for Admin Page Framework and should not be used for support. Please visit the support forums.

Contributions

Anyone is welcome to contribute to Admin Page Framework. There are various ways you can contribute:

Supporting Future Development

If you like the library, please rate and review it in the WordPress Plugin Directory. Also donation would be greatly appreciated. Thank you!

Donate with PayPal

Copyright and License

Admin Page Framework (Framework Files)###

Released under the MIT license. Copyright © 2013-2015 Michael Uno

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

http://opensource.org/licenses/MIT

Admin Page Framework - Loader (WordPress Plugin)

Released under the GPL v2 or later. Copyright © 2013-2015 Michael Uno

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

About

Facilitates WordPress plugin and theme development.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.5%
  • Other 1.5%