hook ) !== false ) { wp_enqueue_script( 'postbox' ); wp_enqueue_script( 'dashboard' ); wp_enqueue_script( 'thickbox' ); wp_enqueue_script( 'media-upload' ); } } /** * Register admin css styles (only for plugin admin page) * **/ function config_page_styles() { //make sure we're on the appropriate page if ( isset( $_GET['page'] ) && strpos( $_GET['page'], $this->hook ) !== false ) { wp_enqueue_style( 'dashboard' ); wp_enqueue_style( 'thickbox' ); wp_enqueue_style( 'global' ); wp_enqueue_style( 'wp-admin' ); wp_enqueue_style( 'bit51-css', plugin_dir_url( __FILE__ ). 'bit51.css' ); } } /** * Register all settings groups * * Registers all settings groups defined in main plugin file * **/ function register_settings() { foreach ( $this->settings as $group => $settings ) { //look at each main group foreach ( $settings as $setting => $option ) { //look at each option set if ( isset( $option['callback'] ) ) { //if callback is defined register with callback register_setting( $group, $setting, array( $this, $option['callback'] ) ); } else { //register without callback register_setting( $group, $setting ); } } } } /** * Add action link to plugin page * * Adds plugin settings link to plugin page in WordPress admin area. * * @param object $links Array of WordPress links * @param string $file String name of current file * @return object Array of WordPress links * **/ function add_action_link( $links, $file ) { static $this_plugin; if ( empty( $this_plugin ) ) { $this_plugin = $this->pluginbase; } if ( $file == $this_plugin ) { $settings_link = '' . __( 'Settings', $this->hook ) . ''; array_unshift( $links, $settings_link ); } return $links; } /** * Return URL of options page * * @return object WordPress admin URL * **/ function plugin_options_url() { return admin_url('options-general.php?page=' . $this->hook); } /** * Setup and call admin messages * * Sets up messages and registers actions for WordPress admin messages * * @param object $errors WordPress error object or string of message to display * **/ function showmessages( $errors ) { global $savemessages; //use global to transfer to add_action callback $savemessages = ''; //initialize so we can get multiple error messages (if needed) if ( function_exists( 'apc_store' ) ) { apc_clear_cache(); //Let's clear APC (if it exists) when big stuff is saved. } if ( is_wp_error( $errors ) ) { //see if object is even an error $errors = $errors->get_error_messages(); //get all errors if it is foreach ( $errors as $error => $string ) { $savemessages .= '
' . $string . '
' . $errors . '
' . __( 'Short on funds?', $this->hook ) . '
'; $content .= '' . __( 'It looks like you\'ve been enjoying', $plughook ) . ' ' . $plugname . ' ' . __( 'for at least 30 days. Would you consider a small donation to help support continued development of the plugin?', $plughook ) . '