mpanel = $mpanel;
}
/**
* 选项样式
*
* @TODO 太乱啦,看着就不想动手改造,反正也还能用,先这么放着,心情好再改,(*^__^*) !!!
*/
public function item( $args ) {
$args = wp_parse_args( $args, array(
'type' => 'text',
'id' => false,
'name' => false
) );
if( $this->get_default ){
if( isset( $args['default'] ) )
$this->default[$args['id']] = $args['default'];
return;
}
if( $args['type'] == 'help' ){
$id = $args['id'] ? ' id="' . 'mpanel-item-' . esc_attr( $args['id'] ) . '"' : '';
echo '
' . $args['name'] . '
';
return;
}
$option_value = $this->mpanel->get( $args['id'] );
if( $args['id'] )
$htmlid = esc_attr( 'mpanel-item-' . $args['id'] );
?>
'; ?>
' . $args['explain'] . '
';
?>
menu = $this->default = array();
$this->page = $this->group = 0;
$this->get_default = false;
unset( $this->from );
}
/**
* 页面开始
*/
public function before( $name, $class = '' ) {
$this->menu[] = $name;
++$this->page;
$classes = empty( $class ) ? '' : ' ' . $class;
?>
';
}
/**
* 选项组开始
*/
public function group( $title, $class = '' ) {
++$this->group;
$classes = empty( $class ) ? '' : ' ' . $class;
?>
';
}
/**
* 获取选项表单
*
* @since Unknown
* @since Beginning 4.0.5 用新的文件路径调用方式取代 `dirname( __FILE__ )`。
*/
public function get_from( $reset = false ) {
if ( !isset( $this->from ) || $reset ) {
ob_start();
$filename = get_template_directory() . '/mpanel/mpanel-ui.php';
include( $filename );
$this->from = ob_get_clean();
}
return $this->from;
}
/**
* 获取默认设置
*/
public function get_default() {
$this->get_default = true;
$this->get_from( true );
$default = $this->default;
$this->init();
return $default;
}
}
// End of page.