$data['submit'] = __('Save', 'php_snippets'); $data['action_name'] = 'php_snippets_settings'; $data['nonce_name'] = 'php_snippets_settings_nonce'; ob_start(); PhpSnippets\License::get_fields(); $ps_data = get_option(Phpsnippets\Base::db_key, array()); $data['licensing_fields'] = ob_get_clean(); $data['snippet_dirs'] = Phpsnippets\Base::get_value($ps_data, 'snippet_dirs', array()); $data['warnings'] = Phpsnippets\Base::get_value($ps_data, 'warnings', array()); $data['snippet_suffix'] = Phpsnippets\Base::get_value($ps_data, 'snippet_suffix'); $data['show_builtin_snippets'] = Phpsnippets\Base::get_value($ps_data, 'show_builtin_snippets'); $data['show_tmce_button'] = Phpsnippets\Base::get_value($ps_data, 'show_tmce_button'); // Save if submitted... if (!empty($_POST) && check_admin_referer($data['action_name'], $data['nonce_name'])) { if (isset($_POST['activate_license'])) { if (PhpSnippets\License::activate($_POST['license_key'])) { $data['msg'] .= sprintf('<div class="updated"><p>%s</p></div>', 'Your license has been successfully activated. Thank you for your support!'); ob_start(); PhpSnippets\License::get_fields(); $data['licensing_fields'] = ob_get_clean(); } else { $data['msg'] .= sprintf('<div class="error"><p>%s</p></div>', 'There was a problem activating your license. Sorry for the inconvenience.'); ob_start(); PhpSnippets\License::get_fields(); $data['licensing_fields'] = ob_get_clean(); } // options-general.php?page=php-snippets //print '<script type="text/javascript">window.location.replace("'.get_admin_url(false, 'options-general.php?page=php-snippets').'");</script>'; } else { // A little cleanup before we handoff to save_definition_filter $snippet_dirs = Phpsnippets\Base::get_value($_POST, 'snippet_dirs', array());