} // deal with the MOOTOOLS checkbox $onoff_opts = array('mootools'); foreach ($onoff_opts as $key) { $updated_options[$key] = $updated_options[$key] ? '1' : '0'; } // deal with the RESET checkbox $bool_opts = array('reset'); foreach ($bool_opts as $key) { $updated_options[$key] = $updated_options[$key] ? 'true' : 'false'; } // If RESET is checked, reset the options if ($updated_options['reset'] == "true") { dfcg_unset_gallery_options(); // clear out the old ones dfcg_set_gallery_options(); // put back the defaults echo '<div id="message" class="updated fade"><p><strong>' . __('Dynamic Content Gallery Settings reset to defaults.') . '</strong></p></div>'; } else { // Otherwise, update the options update_option('dfcg_plugin_settings', $updated_options); echo '<div id="message" class="updated fade"><p><strong>' . __('Dynamic Content Gallery Settings updated and saved.') . '</strong></p></div>'; } } // Display the updated options $options = get_option('dfcg_plugin_settings'); ?> <style> .form-table {margin-bottom:-6px;} .dfcginfo {border:1px solid #CCCCCC;margin:24px 0px 0px 0px;padding:10px 10px 10px 10px;} .dfcginfo ul {list-style-type:disc;margin-left:30px;font-size:11px;}
function dfcg_setup() { dfcg_load_textdomain(); if (current_user_can('manage_options') && function_exists('add_options_page')) { add_options_page('Dynamic Content Gallery Options', 'Dynamic Content Gallery', 'manage_options', 'dynamic-gallery-plugin.php', 'dfcg_options_page'); add_filter('plugin_action_links', 'dfcg_filter_plugin_actions', 10, 2); dfcg_set_gallery_options(); } }
/** * Create Admin settings page and populate options * * Hooked to 'admin_menu' * * Renamed in 3.2, was dfcg_add_page() * No need to check credentials - already built in to core wp function * * @uses dfcg_options_page() * @uses dfcg_loadjs_admin_head() * @uses dfcg_set_gallery_options() * * @return string $dfcg_page_hook, wp page hook * @since 3.2 * @updated 3.3.1 */ function dfcg_add_to_options_menu() { // Populate plugin's options (since 3.3.1, now runs BEFORE settings page is added. Duh!) dfcg_set_gallery_options(); // Add Settings Page $dfcg_page_hook = add_options_page('Dynamic Content Gallery Options', 'Dynamic Content Gallery', 'manage_options', DFCG_FILE_HOOK, 'dfcg_options_page'); // Load all the jQuery stuff we need for back end wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-tabs'); // Load Admin external scripts and CSS add_action('admin_head-settings_page_' . DFCG_FILE_HOOK, 'dfcg_loadjs_admin_head', 20); return $dfcg_page_hook; // May need this later }