Settings'; array_unshift($links, $settings_link); return $links; } /** * Init the adplugg admin */ function adplugg_admin_init() { $options = get_option(ADPLUGG_OPTIONS_NAME); $data_version = $options['version']; if($data_version != ADPLUGG_VERSION) { $options['version'] = ADPLUGG_VERSION; update_option(ADPLUGG_OPTIONS_NAME, $options); if(!is_null($data_version)) { //skip if not an upgrade //do any necessary version data upgrades here $notices = get_option(ADPLUGG_NOTICES_NAME); $notices[] = "Upgraded version from $data_version to " . ADPLUGG_VERSION . "."; update_option('adplugg_notices', $notices); } } } /** * Add Notices in the administrator. Notices may be stored in the * adplugg_options. Once the notices have been displayed, delete them from * the database. */ function adplugg_admin_notices() { $stored_notices = get_option(ADPLUGG_NOTICES_NAME); $page = (isset($_GET["page"])) ? $_GET["page"] : ""; //$script = end((explode('/', $_SERVER['REQUEST_URI']))); $script = end(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))); $notices = array(); //stored notices if($stored_notices) { foreach($stored_notices as $notice) { $notices[] = $notice; } delete_option(ADPLUGG_NOTICES_NAME); } if(!adplugg_is_access_code_installed()) { if($page != "adplugg") { $notices[]= 'You\'ve activated the AdPlugg Plugin, yay! Now let\'s configure it!'; } } else { if(!adplugg_is_widget_active()) { if($script == "widgets.php") { $notices[]= 'Drag the AdPlugg Widget into a Widget Area to display ads on your site.'; } else { $notices[]= 'You\'re configured and ready to go. Now just drag the AdPlugg Widget into a Widget Area. Go to Widget Configuration.'; } } } //print the notices foreach($notices as $notice) { echo '

AdPlugg: ' . $notice . '

'; } } /** * Called when the plugin is activated. */ function adplugg_activation() { // } /** * Called when the plugin is deactivated. */ function adplugg_deactivation() { // } /** * Function called when AdPlugg is uninstalled */ function adplugg_uninstall() { delete_option(ADPLUGG_OPTIONS_NAME); delete_option(ADPLUGG_NOTICES_NAME); delete_option(ADPLUGG_WIDGET_OPTIONS_NAME); } }