fileManager = $fileManager; } public function register() { register_setting(self::OPTIONS, self::OPTIONS, array( 'sanitize_callback' => array($this, 'updateSettings'), )); add_settings_section('menu_settings', __('', 'anchor_smooth_scroll'), array( $this, 'menuSection', ), self::SETTINGS_PAGE); } public function show() { print('
'); } public function menuSection() { $this->fileManager->includeTemplate('admin/section/menu-settings.php', array( 'offset' => $this->getOption('offset'), 'scroll_duration' => $this->getOption('scroll_duration'), 'custom_anchor_selector' => $this->getOption('custom_anchor_selector'), 'remove_anchor_highlight' => $this->getOption('remove_anchor_highlight'), 'disable_theme_scroll' => $this->getOption('disable_theme_scroll'), 'only_reload' => $this->getOption('only_reload') )); } public function updateSettings($settings) { return $settings; } /** * @param string $key * @param mixed|null $default * * @return mixed|null */ public function getOption($key, $default = null) { if (!isset($this->options)) { $this->options = get_option(self::OPTIONS); } return isset($this->options[ $key ])? $this->options[ $key ] : $default; } }