Settings'; array_unshift( $links, $settings_link ); return $links; } /** * Init the adplugg admin */ public function admin_init() { $options = get_option( ADPLUGG_OPTIONS_NAME, array() ); $data_version = ( array_key_exists( 'version', $options ) ) ? $options['version'] : null; if ( ADPLUGG_VERSION !== $data_version ) { $options['version'] = ADPLUGG_VERSION; update_option( ADPLUGG_OPTIONS_NAME, $options ); // Do the following block when upgrading. if ( ! is_null( $data_version ) ) { // FBIA ad endpoint change (prior to 1.6.0 we were using www.adplugg.com // in 1.6.0 we changed to www.adplugg.io but had a period where accounts // could temporarily stay on www.adplugg.com). if ( version_compare( $data_version, '1.6.0', '<' ) ) { if ( AdPlugg_Facebook::is_ia_automatic_placement_enabled() ) { $fb_options = get_option( ADPLUGG_FACEBOOK_OPTIONS_NAME ); $fb_options['temp_allow_legacy_adplugg_com_endpoint'] = 1; $fb_options['temp_use_legacy_adplugg_com_endpoint'] = 1; update_option( ADPLUGG_FACEBOOK_OPTIONS_NAME, $fb_options ); } } $upgrade_notice = AdPlugg_Notice::create( 'notify_upgrade', 'Upgraded version from ' . $data_version . ' to ' . ADPLUGG_VERSION . '.' ); AdPlugg_Notice_Controller::get_instance()->add_to_queue( $upgrade_notice ); } } // Add the adplugg-wp font stylesheet to the WP admin head. wp_register_style( 'adplugg-wp-font', plugins_url( '../../assets/fonts/adplugg-wp/adplugg-wp.css', __FILE__ ) ); wp_enqueue_style( 'adplugg-wp-font' ); // Add the AdPlugg admin stylesheet to the WP admin head. wp_register_style( 'adplugg-admin', plugins_url( '../../assets/css/admin/admin.css', __FILE__ ) ); wp_enqueue_style( 'adplugg-admin' ); // Add the AdPlugg admin JavaScript page to the WP admin head. wp_register_script( 'adplugg-admin', plugins_url( '../../assets/js/admin/admin.js', __FILE__ ) ); wp_enqueue_script( 'adplugg-admin' ); } /** * Change the admin footer text on AdPlugg admin pages. * * @param string $footer_text The current admin footer text. * @return string Returns the filtered admin footer text. */ public function admin_footer_text( $footer_text ) { $screen = get_current_screen(); $screen_id = ( ! empty( $screen ) ? $screen->id : null ); // only do on the adplugg settings page and if the user has already added an access code. if ( ( 'toplevel_page_adplugg' === $screen_id ) && ( AdPlugg_Options::is_access_code_installed() ) ) { // If not already clicked/rated. if ( ! get_option( ADPLUGG_RATED_NAME ) ) { // NOTE: the click action for the link is defined in admin.js. $footer_text = 'If you like AdPlugg, please leave us a ' . '' . '★★★★★' . ' rating. A huge thank you in advance from the AdPlugg Team!'; } else { // Show when rating link already clicked. $footer_text = 'Thank you for using AdPlugg.'; } } return $footer_text; } /** * Called via ajax to when the rate link is clicked. */ public function rated_callback() { update_option( ADPLUGG_RATED_NAME, 1 ); wp_die(); // Terminate immediately and return a proper response. } /** * Called when the plugin is activated. */ public static function activate() { } /** * Called when the plugin is deactivated. */ public static function deactivate() { } /** * Called when plugin is uninstalled. */ public static function uninstall() { delete_option( ADPLUGG_OPTIONS_NAME ); delete_option( ADPLUGG_FACEBOOK_OPTIONS_NAME ); delete_option( ADPLUGG_NOTICES_NAME ); delete_option( ADPLUGG_NOTICES_DISMISSED_NAME ); delete_option( ADPLUGG_WIDGET_OPTIONS_NAME ); } }