plugin = $plugin; add_action( 'admin_menu', array( $this, 'menu_pages' ) ); add_action( 'admin_init', array( $this, 'admin_init' ) ); } /** * init sections and fields */ function admin_init() { add_settings_section( self::MENU_SLUG, __( 'Stats', Plugin::DOMAIN ), array( $this, 'section_stats' ), self::MENU_SLUG ); add_settings_field( Plugin::OPTION_FILE_LOCATION, __( 'Where to aggregate the files?' ), array( $this, 'field_file_location' ), self::MENU_SLUG, self::MENU_SLUG ); add_settings_field( Plugin::OPTION_MINIFY, __( 'Minify?', Plugin::DOMAIN ), array( $this, 'field_minify' ), self::MENU_SLUG, self::MENU_SLUG ); add_settings_field( self::OPTION_CC, __( 'Clear aggregated files?', Plugin::DOMAIN ), array( $this, 'field_clear_cache' ), self::MENU_SLUG, self::MENU_SLUG ); register_setting( self::MENU_SLUG, Plugin::OPTION_FILE_LOCATION ); register_setting( self::MENU_SLUG, Plugin::OPTION_MINIFY ); register_setting( self::MENU_SLUG, self::OPTION_CC, array( $this, 'clear_cache' ) ); } /** * add menu */ function menu_pages() { add_submenu_page( 'options-general.php', 'Aggregator', 'Aggregator', 'manage_options', "aggregator", array( $this, "render" ) ); } /** * render menu */ function render() { ?>