this plugin requires at least WordPress $require_wp. Please update your WordPress version."; return $errors; } function dbfw_check_admin_notices() { $errors = dbfw_min_wp_version(); if ( empty ( $errors ) ) return; // Suppress "Plugin activated" notice. unset( $_GET['activate'] ); // this plugin's name $name = get_file_data( __FILE__, array ( 'Plugin Name' ), 'plugin' ); printf( __( '
%1$s
%2$s has been deactivated.
', $errors ), $name[0] ); deactivate_plugins( plugin_basename( __FILE__ ) ); } /** * Rewrite of the plugin * * @since 2.0.0 */ class DBFW_Load { function __construct() { global $so_dbfw; /* Set up an empty class for the global $so_dbfw object. */ $so_dbfw = new stdClass; /* Set the init. */ add_action( 'admin_init', array( &$this, 'init' ), 1 ); /* Set the constants needed by the plugin. */ add_action( 'plugins_loaded', array( &$this, 'constants' ), 2 ); /* Internationalize the text strings used. */ add_action( 'plugins_loaded', array( &$this, 'i18n' ), 3 ); /* Load the functions files. */ add_action( 'plugins_loaded', array( &$this, 'includes' ), 4 ); /* Load the admin files. */ add_action( 'plugins_loaded', array( &$this, 'admin' ), 5 ); } /** * Init plugin options to white list our options * * @since 2.0.0 */ function init() { register_setting( 'dbfw_plugin_options', 'dbfw_options', 'dbfw_validate_options' ); } /** * Defines constants used by the plugin. * * @since 2.0.0 */ function constants() { /* Set the version number of the plugin. */ define( 'SO_DBFW_VERSION', '2014.04.17' ); /* Set constant path to the plugin directory. */ define( 'SO_DBFW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) ); /* Set constant path to the plugin URL. */ define( 'SO_DBFW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) ); /* Set the constant path to the inc directory. */ define( 'SO_DBFW_INCLUDES', SO_DBFW_DIR . trailingslashit( 'inc' ) ); /* Set the constant path to the admin directory. */ define( 'SO_DBFW_ADMIN', SO_DBFW_DIR . trailingslashit( 'admin' ) ); } /** * Loads the translation file. * * @since 2.0.0 */ function i18n() { /* Load the translation of the plugin. */ load_plugin_textdomain( 'dashboard-feed-widget', false, basename( dirname( __FILE__ ) ) . '/languages/' ); } /** * Loads the initial files needed by the plugin. * * @since 2.0.0 */ function includes() { /* Load the plugin functions file. */ require_once( SO_DBFW_INCLUDES . 'functions.php' ); } /** * Loads the admin functions and files. * * @since 2.0.0 */ function admin() { /* Only load files if in the WordPress admin. */ if ( is_admin() ) { /* Load the main admin file. */ require_once( SO_DBFW_ADMIN . 'settings.php' ); } } } $so_dbfw_load = new DBFW_Load(); /** * Register activation/deactivation hooks * @since 0.1 */ register_activation_hook( __FILE__, 'dbfw_add_defaults' ); //register_deactivation_hook( __FILE__, 'dbfw_delete_plugin_options' ); add_action( 'admin_menu', 'dbfw_add_options_page' ); function dbfw_add_options_page() { // Add the new admin menu and page and save the returned hook suffix $hook = add_options_page( '96Down Assistant Settings', '96Down Assistant', 'manage_options', __FILE__, 'dbfw_render_form' ); // Use the hook suffix to compose the hook and register an action executed when plugin's options page is loaded add_action( 'admin_print_styles-' . $hook , 'dbfw_load_settings_style' ); } /** * Define default option settings * @since 0.1 */ function dbfw_add_defaults() { $tmp = get_option( 'dbfw_options' ); if ( ( $tmp['chk_default_options_db'] == '1' ) || ( ! is_array( $tmp ) ) ) { $defaults = array( 'widget_title' => __( 'Recent 96Down Updates', 'dashboard-feed-widget' ), 'feed_url' => 'http://www.96down.com/private/rss/forums/4-96downcom-updates/', 'drp_select_box' => '5', 'widget_bkgr' => 'FF9', 'chk_default_options_db' => '' ); update_option( 'dbfw_options', $defaults ); } } /** * Delete options table entries ONLY when plugin deactivated AND deleted * @since 0.1 */ function dbfw_delete_plugin_options() { delete_option( 'dbfw_options' ); } /** * Register and enqueue the settings stylesheet * @since 2.0.0 */ function dbfw_load_settings_style() { wp_register_style( 'custom_dbfw_settings_css', SO_DBFW_URI . 'css/settings.css', false, SO_DBFW_VERSION ); wp_enqueue_style( 'custom_dbfw_settings_css' ); } /** * Set-up Action and Filter Hooks * @since 0.1 */ add_filter( 'plugin_action_links', 'dbfw_plugin_action_links', 10, 2 ); add_action( 'wp_dashboard_setup', 'dbfw_setup_function' ); // Register the new dashboard widget into the 'wp_dashboard_setup' action add_action( 'admin_enqueue_scripts', 'dbfw_load_custom_admin_style' ); /** * Sanitize and validate input. Accepts an array, return a sanitized array. * @since 0.1 */ function dbfw_validate_options($input) { // strip html from textboxes $input['widget_title'] = wp_filter_nohtml_kses( $input['widget_title'] ); // Sanitize input (strip html tags, and escape characters) $input['feed_url'] = wp_filter_nohtml_kses( $input['feed_url'] ); // Sanitize input (strip html tags, and escape characters) $input['widget_bkgr'] = wp_filter_nohtml_kses( $input['widget_bkgr'] ); // Sanitize input (strip html tags, and escape characters) return $input; } /** * Display a Settings link on the main Plugins page */ function dbfw_plugin_action_links( $links, $file ) { if ( $file == plugin_basename( __FILE__ ) ) { $dbfw_links = '' . __( 'Settings', 'dashboard-feed-widget' ) . ''; // make the 'Settings' link appear first array_unshift( $links, $dbfw_links ); } return $links; } /** Include the nuke-list.php page to remove notifications from admin dashboard. */ require( 'nuke-list.php' ); ?>