# [Admin Page Framework](http://wordpress.org/plugins/admin-page-framework/)

## Welcome to Admin Page Framework GitHub Repository

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

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/michaeluno/admin-page-framework/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/michaeluno/admin-page-framework/?branch=master)
[![Build Status](https://scrutinizer-ci.com/g/michaeluno/admin-page-framework/badges/build.png?b=master)](https://scrutinizer-ci.com/g/michaeluno/admin-page-framework/build-status/master)

<p align="center">
	<a href="https://lh6.googleusercontent.com/-U_29dZp26Yw/VCFc0cDPGSI/AAAAAAAABtM/0l9klA6JFcg/s0/built-in%2520field%2520types.png" title="Admin Page Framework - Text, Password, and Textarea">
		<img src="https://lh6.googleusercontent.com/-U_29dZp26Yw/VCFc0cDPGSI/AAAAAAAABtM/0l9klA6JFcg/s600/built-in%2520field%2520types.png" alt="Admin Page Framework - Text, Password, and Textarea" />
	</a>
</p>

<div style="margin:20px; float:left">
	<a href="https://lh4.googleusercontent.com/-EuQbXCx4HhI/VCFc441vgCI/AAAAAAAABuE/KeKVd3t5PSc/s0/selectors.png" title="Admin Page Framework - Selectors">
		<img src="https://lh4.googleusercontent.com/-EuQbXCx4HhI/VCFc441vgCI/AAAAAAAABuE/KeKVd3t5PSc/s144/selectors.png" alt="Admin Page Framework - Selectors" />
	</a>
	&nbsp;
	<a href="https://lh6.googleusercontent.com/-LjEY_hZLGX0/VCFc4Kh4BRI/AAAAAAAABt4/2ZOt-J3LpgM/s0/files.png" title="Admin Page Framework - Image, Media Library, and File Uploads">
		<img src="https://lh6.googleusercontent.com/-LjEY_hZLGX0/VCFc4Kh4BRI/AAAAAAAABt4/2ZOt-J3LpgM/s144/files.png" alt="Admin Page Framework - Image, Media Library, and File Uploads" />
	</a>
	&nbsp;
	<a href="https://lh3.googleusercontent.com/-fbuQOuBSSJ0/VCFc0CTx3rI/AAAAAAAABtI/jYYMxH07T-Q/s0/checklist.png" title="Admin Page Framework - Taxonomies and Post Types Checklist">
		<img src="https://lh3.googleusercontent.com/-fbuQOuBSSJ0/VCFc0CTx3rI/AAAAAAAABtI/jYYMxH07T-Q/s144/checklist.png" alt="Admin Page Framework - Taxonomies and Post Types Checklist" />
	</a>
	&nbsp;
	<a href="https://lh6.googleusercontent.com/-D2tssBl00fw/VCFc16XZ1CI/AAAAAAAABtY/uBBqQkWqG4w/s0/misc.png" title="Admin Page Framework - Misc">
		<img src="https://lh6.googleusercontent.com/-D2tssBl00fw/VCFc16XZ1CI/AAAAAAAABtY/uBBqQkWqG4w/s144/misc.png" alt="Admin Page Framework - Misc" />
	</a>
	&nbsp;
	<a href="https://lh5.googleusercontent.com/-gbd0VdjjKQQ/VCFc49JM_tI/AAAAAAAABuA/4FbHz_pMW2Y/s0/verification.png" title="Admin Page Framework - Form Input Verification">
		<img src="https://lh5.googleusercontent.com/-gbd0VdjjKQQ/VCFc49JM_tI/AAAAAAAABuA/4FbHz_pMW2Y/s144/verification.png" alt="Admin Page Framework - Form Input Verification" />
	</a>
	&nbsp;
	<a href="https://lh6.googleusercontent.com/-cmgLpnx3iIA/UtDfHZdsxvI/AAAAAAAABfk/BklgC-MnqWY/s0/admin_page_framework_v3_export_%2526_import.png" title="Admin Page Framework - Export and Import Options">
		<img src="https://lh6.googleusercontent.com/-cmgLpnx3iIA/UtDfHZdsxvI/AAAAAAAABfk/BklgC-MnqWY/s144/admin_page_framework_v3_export_%2526_import.png" alt="Admin Page Framework - Export and Import Options" />
	</a>
	&nbsp;
	<a href="https://lh5.googleusercontent.com/-YujIDW7LMdU/UtDfGcrDjrI/AAAAAAAABfM/EMA4NF3WgYU/s0/admin_page_framework_help_pane.png" title="Admin Page Framework - Contextual Help Pane">
		<img src="https://lh5.googleusercontent.com/-YujIDW7LMdU/UtDfGcrDjrI/AAAAAAAABfM/EMA4NF3WgYU/s144/admin_page_framework_help_pane.png" alt="Admin Page Framework - Contextual Help Pane" />
	</a>
	&nbsp;
	<a href="https://lh5.googleusercontent.com/-qYgg41nH2_s/VCFc2rSlOQI/AAAAAAAABtg/XQSLHSUX5yA/s0/meta_boxes.png" title="Admin Page Framework - Custom Post Type and Meta Box">
		<img src="https://lh5.googleusercontent.com/-qYgg41nH2_s/VCFc2rSlOQI/AAAAAAAABtg/XQSLHSUX5yA/s144/meta_boxes.png" alt="Admin Page Framework - Custom Post Type and Meta Box" />
	</a>
	&nbsp;
	<a href="https://lh3.googleusercontent.com/-omMuKSVYLPw/VCFc3Kg1okI/AAAAAAAABto/e51rB0qvlC8/s0/page_metabox.png" title="Admin Page Framework - Meta Boxes in Pages Added by the Framework">
		<img src="https://lh3.googleusercontent.com/-omMuKSVYLPw/VCFc3Kg1okI/AAAAAAAABto/e51rB0qvlC8/s144/page_metabox.png" alt="Admin Page Framework - Meta Boxes in Pages Added by the Framework" />
	</a>	
	&nbsp;
	<a href="https://lh6.googleusercontent.com/-FGum6Tjts9k/UtyrddRYdBI/AAAAAAAABhA/LvY_3wgkvyo/s0/form_fields_in_taxonomy_page.png" title="Admin Page Framework - Form Fields in Taxonomy Page">
		<img src="https://lh6.googleusercontent.com/-FGum6Tjts9k/UtyrddRYdBI/AAAAAAAABhA/LvY_3wgkvyo/s144/form_fields_in_taxonomy_page.png" alt="Admin Page Framework - Form Fields in Taxonomy Page" />
	</a>	
	&nbsp;
	<a href="https://lh3.googleusercontent.com/-g-JYTcEDTmQ/VCFc4dXs1_I/AAAAAAAABt8/occvS1fFTBM/s0/sections.png" title="Admin Page Framework - Form Sections in Tabbed Boxes and Repeatable Option">
		<img src="https://lh3.googleusercontent.com/-g-JYTcEDTmQ/VCFc4dXs1_I/AAAAAAAABt8/occvS1fFTBM/s144/sections.png" alt="Admin Page Framework - Form Sections in Tabbed Boxes and Repeatable Option" />
	</a>
	&nbsp;
	<a href="https://lh6.googleusercontent.com/-S8C4xm8BALg/VCFczgOWr6I/AAAAAAAABtE/RTdJuwLOdpI/s0/autocomplete.png" title="Admin Page Framework - Auto-complete Custom Field Type">
		<img src="https://lh6.googleusercontent.com/-S8C4xm8BALg/VCFczgOWr6I/AAAAAAAABtE/RTdJuwLOdpI/s144/autocomplete.png" alt="Admin Page Framework - Auto-complete Custom Field Type" />
	</a>
	&nbsp;
	<a href="https://lh5.googleusercontent.com/-LOY1iOGFSmY/VCMHVoQfwGI/AAAAAAAABuc/V9zdtpWvVbA/s0/widgets.png" title="Admin Page Framework - Widget Form Fields">
		<img src="https://lh5.googleusercontent.com/-LOY1iOGFSmY/VCMHVoQfwGI/AAAAAAAABuc/V9zdtpWvVbA/s144/widgets.png" alt="Admin Page Framework - Widget Form Fields" />
	</a>        
</div>

## Installation

There are mainly two ways to include the framework.

- Use the framework loader plugin. 
    - The latest development version can be found [here](https://github.com/michaeluno/admin-page-framework/branches). 
    - The latest stable version can be downloaded [here](http://downloads.wordpress.org/plugin/admin-page-framework.latest-stable.zip).

- 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.

## Examples

### Create a Page

<p align="center">
	<a href="https://lh5.googleusercontent.com/-v-XvdGmQH1k/Uty9YC3kqwI/AAAAAAAABhk/Ti2R_i6JbhU/s0/my_first_page.png" title="Admin Page Framework - Getting Started">
		<img src="https://lh5.googleusercontent.com/-v-XvdGmQH1k/Uty9YC3kqwI/AAAAAAAABhk/Ti2R_i6JbhU/s400/my_first_page.png" alt="Admin Page Framework - Getting Started" />
	</a>
</p>

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

include( dirname( __FILE__ ) . '/library/apf/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

<p align="center">
    <a href="https://lh6.googleusercontent.com/-T5_iUiJAlR8/Uty9YKlpkzI/AAAAAAAABhg/8mcpt6h_XHU/s0/my_first_form.png" title="Admin Page Framework - My First Form">
        <img src="https://lh6.googleusercontent.com/-T5_iUiJAlR8/Uty9YKlpkzI/AAAAAAAABhg/8mcpt6h_XHU/s400/my_first_form.png" alt="Admin Page Framework - My First Form" />
    </a>
</p>

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

include( dirname( __FILE__ ) . '/library/apf/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`.

## Resources

- [Online documentation](http://admin-page-framework.michaeluno.jp/en/v3/)
- [Online tutorials](http://admin-page-framework.michaeluno.jp/tutorials/)
- [FAQ](https://wordpress.org/plugins/admin-page-framework/faq/)
- [Change Log](https://wordpress.org/plugins/admin-page-framework/#developers)

### Getting Helped

- [Support Forum](http://wordpress.org/support/plugin/admin-page-framework)

## Contributions

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

- Report [bugs](https://github.com/michaeluno/admin-page-framework/issues).
- Post ideas on [enhancements](https://github.com/michaeluno/admin-page-framework/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
- Send us a Pull Request with your bug fixes and/or new features.
- Write a [custom field type](http://admin-page-framework.michaeluno.jp/en/v3/package-AdminPageFramework.FieldType.html). 
- Write [test cases](test/readme.md).
- Improve the [documentation](https://github.com/michaeluno/admin-page-framework/blob/master/documentation_guideline.md).
- Tweak the styling of the framework page elements.
- Translate the language files in the [language](https://github.com/michaeluno/admin-page-framework/tree/master/language) directory to your native language.
- Possibly more.

### Browser Compatibility

Internet Explorer 9 or below is not supported.

The framework uses
- CSS `flex`.
 
### Framework Core Development

See the [contribution guideline](./.gituhb/contributing.md).

### Supporting Future Development 

If you like the library, please rate and review it in the [WordPress Plugin Directory](http://wordpress.org/support/view/plugin-reviews/admin-page-framework?filter=5). Also donation would be greatly appreciated. Thank you!

[![Donate with PayPal](https://www.paypal.com/en_US/i/btn/x-click-but04.gif)](http://en.michaeluno.jp/donate) 

## Copyright and License

### Admin Page Framework (Framework Files)
[MIT license](development/LICENSE.txt)

### Admin Page Framework - Loader (WordPress Plugin) 
[GPL v2](./LICENSE.txt)
