name = $name; $this->plugin = $plugin; // Don't run deactivation survey on dev sites. if ( aioseo()->helpers->isDev() ) { // return; } add_action( 'admin_print_scripts', [ $this, 'js' ], 20 ); add_action( 'admin_print_scripts', [ $this, 'css' ] ); add_action( 'admin_footer', [ $this, 'modal' ] ); } /** * Returns the URL of the remote endpoint. * * @since 4.5.5 * * @return string The URL. */ public function getApiUrl() { if ( defined( 'AIOSEO_DEACTIVATION_SURVEY_URL' ) ) { return AIOSEO_DEACTIVATION_SURVEY_URL; } return $this->apiUrl; } /** * Checks if current admin screen is the plugins page. * * @since 4.5.5 * * @return bool True if it is, false if not. */ public function isPluginPage() { $screen = aioseo()->helpers->getCurrentScreen(); if ( empty( $screen->id ) ) { return false; } return in_array( $screen->id, [ 'plugins', 'plugins-network' ], true ); } /** * Survey javascript. * * @since 4.5.5 * * @return void */ public function js() { if ( ! $this->isPluginPage() ) { return; } ?> isPluginPage() ) { return; } ?> isPluginPage() ) { return; } $options = [ 1 => [ 'title' => esc_html__( 'I no longer need the plugin', 'all-in-one-seo-pack' ), ], 2 => [ 'title' => esc_html__( 'I\'m switching to a different plugin', 'all-in-one-seo-pack' ), 'details' => esc_html__( 'Please share which plugin', 'all-in-one-seo-pack' ), ], 3 => [ 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'all-in-one-seo-pack' ), ], 4 => [ 'title' => esc_html__( 'It\'s a temporary deactivation', 'all-in-one-seo-pack' ), ], 5 => [ 'title' => esc_html__( 'Other', 'all-in-one-seo-pack' ), 'details' => esc_html__( 'Please share the reason', 'all-in-one-seo-pack' ), ], ]; ?>