Linux 软件免费装

Option Page Helper

开发者 davidajnered
更新时间 2014年7月17日 16:04
捐献地址: 去捐款
PHP版本: 3.9 及以上
WordPress版本: 3.9
版权: GPLv3
版权网址: 版权信息

标签

admin development class code option settings dev framework developer object admin page option page settings page object oriented programming

下载

0.1

详情介绍:

Option Page Helper is just a class aimed to help developer create option pages easily in code. The class wrappes all function calls to create a option page. It stores the variables that are used multiple times for cleaner code and it auto-generate callbacks to minimize the development time. Still work in progress... I built this for myself but see a greater use for it. If it doesn't suite your needs right out of the box, please let me know and I might add in more features. If you feel like helping out, feel free to do so on github

安装:

I thought I was a bit complicated to add option pages so I wrote a helper that simplify thing a bit. The helper stores recurring variables like page slug so you don't have to pass it with all function calls. It created callback automatically based on the section or field name, so you don't have to care about that eigher. This is a simple example on how to create a options page ` $options = array( 'page_title' => 'Settings Admin', // Page title 'menu_title' => 'My Settings', // Menu title 'capability' => 'manage_options', // Capability 'menu_slug' => 'my-settings', // Menu slug 'callback' => array($this, 'page'), // Callback object 'form' => array( array( 'name' => 'First Section', // Section name 'fields' => array( 'first_option' => 'First option' // Field id and name ) ) ), ); $this->optionPageHelper = new OptionPageHelper($options); ` You're page is created, but there are some callbacks to take care of. ` /** My Option Page ' . $this->optionPageHelper->renderForm() . ' '; echo $output; } And then we have the field(s) callback... /** // Build element and print echo ''; } ` Don't forget to read the code comments here, they're useful :) The Utils class contains some formatting helpers, so you need that file to. The OptionPage class is just an example on how to implement this, just like this readme.

升级注意事项:

Nothung

更新日志: