/** * Setting an error on the screen * * @param string $plugin_section * @param string $readable_plugin_section This is the value for the translation. */ protected function set_error($plugin_section, $readable_plugin_section) { $plugins_as_string = $this->get_conflicting_plugins_as_string($plugin_section); $error_message = '<h3>' . __('Warning!', 'wordpress-seo') . '</h3>'; /* translators: %1$s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s), %2$s to Yoast SEO */ $error_message .= '<p>' . sprintf(__('The %1$s plugin(s) might cause issues when used in conjunction with %2$s.', 'wordpress-seo'), $plugins_as_string, 'Yoast SEO') . '</p>'; $error_message .= sprintf($readable_plugin_section, 'Yoast SEO', $plugins_as_string) . '<br/><br/>'; $error_message .= '<p><strong>' . __('Recommended solution', 'wordpress-seo') . '</strong><br/>'; /* translators: %1$s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s). %2$s to Yoast SEO */ $error_message .= sprintf(__('We recommend you deactivate %1$s and have another look at your %2$s configuration using the button above.', 'wordpress-seo'), $plugins_as_string, 'Yoast SEO') . '</p>'; foreach ($this->active_plugins[$plugin_section] as $plugin_file) { /* translators: %s: 'Facebook' plugin name of possibly conflicting plugin */ $error_message .= '<a target="_blank" class="button-primary" href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=all', 'deactivate-plugin_' . $plugin_file) . '">' . sprintf(__('Deactivate %s', 'wordpress-seo'), WPSEO_Utils::get_plugin_name($plugin_file)) . '</a> '; } /* translators: %1$s expands to Yoast SEO */ $error_message .= '<p class="alignright"><small>' . sprintf(__('This warning is generated by %1$s.', 'wordpress-seo'), 'Yoast SEO') . '</small></p><div class="clear"></div>'; // Add the message to the notifications center. Yoast_Notification_Center::get()->add_notification(new Yoast_Notification($error_message, array('type' => 'error yoast-dismissible', 'id' => 'wpseo-dismiss-plugin-conflict', 'nonce' => wp_create_nonce('dismiss-plugin-conflict'), 'data_json' => array('section' => $plugin_section, 'plugins' => $this->active_plugins[$plugin_section])))); }
/** * Setting an error on the screen * * @param string $plugin_section Type of conflict group (such as Open Graph or sitemap). * @param string $readable_plugin_section This is the value for the translation. */ protected function set_error($plugin_section, $readable_plugin_section) { $notification_center = Yoast_Notification_Center::get(); foreach ($this->active_plugins[$plugin_section] as $plugin_file) { $plugin_name = WPSEO_Utils::get_plugin_name($plugin_file); $error_message = ''; /* translators: %1$s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s), %2$s to Yoast SEO */ $error_message .= '<p>' . sprintf(__('The %1$s plugin might cause issues when used in conjunction with %2$s.', 'wordpress-seo'), '<em>' . $plugin_name . '</em>', 'Yoast SEO') . '</p>'; $error_message .= '<p>' . sprintf($readable_plugin_section, 'Yoast SEO', $plugin_name) . '</p>'; /* translators: %s: 'Facebook' plugin name of possibly conflicting plugin */ $error_message .= '<a target="_blank" class="button-primary" href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=all', 'deactivate-plugin_' . $plugin_file) . '">' . sprintf(__('Deactivate %s', 'wordpress-seo'), WPSEO_Utils::get_plugin_name($plugin_file)) . '</a> '; $identifier = $this->get_notification_identifier($plugin_file); // Add the message to the notifications center. $notification_center->add_notification(new Yoast_Notification($error_message, array('type' => Yoast_Notification::ERROR, 'id' => 'wpseo-conflict-' . $identifier))); } }