/** * 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!', 'ymbeseo') . '</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.', 'ymbeseo'), $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', 'ymbeseo') . '</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.', 'ymbeseo'), $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', 'ymbeseo'), YMBESEO_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.', 'ymbeseo'), '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])))); }