本文整理汇总了PHP中WPSEO_Utils::get_plugin_name方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::get_plugin_name方法的具体用法?PHP WPSEO_Utils::get_plugin_name怎么用?PHP WPSEO_Utils::get_plugin_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Utils
的用法示例。
在下文中一共展示了WPSEO_Utils::get_plugin_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_error
/**
* 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]))));
}
示例2: set_error
/**
* 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)));
}
}