# [Admin Page Framework](http://wordpress.org/plugins/admin-page-framework/) #

### Welcome to our GitHub Repository

Admin Page Framework is an open source library for WordPress consisting of a set of PHP classes that provides theme and plugin developers with simpler means of creating administration pages of WordPress.

## Screenshots ##

<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 ##

- 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).

The distribution package includes the demo plugin which uses the framework and is ready to be installed as a WordPress plugin. Just upload the unpacked folder to the `...\wp-content\plugins` folder then activate it. The sample pages will be created.

## Example ##

### 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 */ 

if ( ! class_exists( 'AdminPageFramework' ) ) {
    include_once( dirname( __FILE__ ) . '/library/admin-page-framework.min.php' );
}
    
class APF extends AdminPageFramework {

    public function setUp() {
		
    	$this->setRootMenuPage( 'Settings' );	// where to belong
		$this->addSubMenuItem(
			array(
				'title'		=>	'My First Page',
				'page_slug'	=>	'myfirstpage'
			)
		);
			
    }

    public function do_myfirstpage() {  // do_{page slug}
        ?>
        <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 */ 

if ( ! class_exists( 'AdminPageFramework' ) ) {
    include_once( dirname( __FILE__ ) . '/library/admin-page-framework.min.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.
	 */
	public function load_my_first_form( $oAdminPage ) {	// load_{page slug}
	
		$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;
```
## Documentation ##
[Online documentation](http://admin-page-framework.michaeluno.jp/en/v3/)

The documentation is already included in the demo plugin and it is likely up-to-date than the online version. Navigate from the sidebar menu of the admin panel, `Dashboard` > `Admin Page Framework` > `Documentation`.

### Tutorials ###
[Online tutorials](http://en.michaeluno.jp/admin-page-framework/tutorials-v3/)

## Bugs ##
If you find an issue, let us know [here](https://github.com/michaeluno/admin-page-framework/issues)!

## Support ##
This is a developer's portal for Admin Page Framework and should _not_ be used for support. Please visit the [support forums](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:

- Try the open [beta version](https://github.com/michaeluno/admin-page-framework/labels/Beta%20Stage) and report issues you encounter.
- Post ideas on [enhancements](https://github.com/michaeluno/admin-page-framework/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
- Raise an [Issue](https://github.com/michaeluno/admin-page-framework/issues) on GitHub.
- 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 by modifying the [CSS rules](https://github.com/michaeluno/admin-page-framework/blob/master/development/_model/AdminPageFramework_CSS.php).
- Translate the language files in the [language](https://github.com/michaeluno/admin-page-framework/tree/master/language) directory. 

## 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 ###
Released under the [MIT license](./development/MIT-LICENSE.txt).
Copyright © 2014 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](http://opensource.org/licenses/MIT)

### Admin Page Framework - Demo ###
Released under the [GPL v2](./LICENSE.txt) or later.
Copyright © 2014 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.