: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Exit if accessed directly
if( !defined( 'ABSPATH' ) )
* Helper method to check if user is in the plugins page.
function ampforwp_is_plugins_page() {
return ( 'plugins.php' === $pagenow );
* display deactivation logic on plugins page
function ampforwp_add_deactivation_feedback_modal() {
if( !is_admin() && !ampforwp_is_plugins_page()) {
$current_user = wp_get_current_user();
if( !($current_user instanceof WP_User) ) {
$email = trim( $current_user->user_email );
require_once AMPFORWP_PLUGIN_DIR."/includes/deactivate-feedback.php";
* send feedback via email
function ampforwp_send_feedback() {
if( isset( $_POST['data'] ) ) {
parse_str( $_POST['data'], $form );
if( isset( $form['ampforwp_disable_text'] ) ) {
$text = implode( "\n\r", $form['ampforwp_disable_text'] );
$from = isset( $form['ampforwp_disable_from'] ) ? $form['ampforwp_disable_from'] : '';
$headers[] = "From: $from";
$headers[] = "Reply-To: $from";
$subject = isset( $form['ampforwp_disable_reason'] ) ? $form['ampforwp_disable_reason'] : '(no reason given)';
$subject = $subject.' - Accelerated Mobile Pages';
if($subject == 'technical - Accelerated Mobile Pages'){
$text = 'technical issue description: '.$text;
$text = 'no description: '.$text;
$success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
add_action( 'wp_ajax_ampforwp_send_feedback', 'ampforwp_send_feedback' );
add_action( 'admin_enqueue_scripts', 'ampforwp_enqueue_makebetter_email_js' );
function ampforwp_enqueue_makebetter_email_js(){
if( !is_admin() && !ampforwp_is_plugins_page()) {
wp_enqueue_script( 'ampforwp-make-better-js', AMPFORWP_PLUGIN_DIR_URI . 'includes/make-better-admin.js', array( 'jquery' ), AMPFORWP_VERSION);
wp_enqueue_style( 'ampforwp-make-better-css', AMPFORWP_PLUGIN_DIR_URI . 'includes/make-better-admin.css', false , AMPFORWP_VERSION);
if( is_admin() && ampforwp_is_plugins_page()) {
add_filter('admin_footer', 'ampforwp_add_deactivation_feedback_modal');