本文整理汇总了PHP中is_plugin_inactive函数的典型用法代码示例。如果您正苦于以下问题:PHP is_plugin_inactive函数的具体用法?PHP is_plugin_inactive怎么用?PHP is_plugin_inactive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_plugin_inactive函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install_plugins
/**
* Sets up Developer Plugin
* @subcommand install-plugins
* @synopsis --type=<type> [--activate]
*/
function install_plugins($args, $assoc_args)
{
global $automattic_developer;
// wp-cli doesn't fire admin_init since 0.11.2
if (!did_action('admin_init')) {
$automattic_developer->admin_init();
}
$type = $assoc_args['type'];
$activate = isset($assoc_args['activate']) && $assoc_args['activate'] == "true";
$reco_plugins = $automattic_developer->recommended_plugins;
$installed_plugins = array_keys(get_plugins());
$types = array_keys($automattic_developer->get_project_types());
if (in_array($type, $types)) {
$automattic_developer->save_project_type($type);
foreach ($reco_plugins as $slug => $plugin) {
$path = $automattic_developer->get_path_for_recommended_plugin($slug);
$activate_plugin = $activate && ('all' == $plugin['project_type'] || $type == $plugin['project_type']);
// Download the plugin if we don't already have it
if (!in_array($path, $installed_plugins)) {
WP_CLI::run_command(explode(" ", "plugin install {$slug}"));
}
// Install the plugin if --activate and it's the right type
if (is_plugin_inactive($path) && $activate_plugin) {
if (NULL == activate_plugin($path)) {
WP_CLI::success("Activated " . $plugin['name']);
}
}
}
} else {
WP_CLI::error("Specify a valid type to install: <" . implode("|", $types) . ">");
}
}
示例2: ninja_forms_tab_addons
function ninja_forms_tab_addons()
{
$uri = 'http://ninjaforms.com/downloads/category/ninja-forms/feed/';
//include_once(ABSPATH . WPINC . '/feed.php');
$feed = fetch_feed($uri);
if (!is_wp_error($feed)) {
$items = $feed->get_items(0, 0);
}
$items = array(array('title' => __('Layout and Styles', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/01/layout-styles-300x121.png', 'content' => __('This extension gives you power over the look and feel of your Ninja Forms from within your WordPress admin. It gives you the ability to style almost every part of your form, down to the the smallest detail, with little to no …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/layout-styles/', 'plugin' => 'ninja-forms-style/ninja-forms-style.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/layout-styles/'), array('title' => __('PayPal Express', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/09/paypal-express-300x121.png', 'content' => __('Accept payments using PayPal Express and Ninja Forms', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/paypal-express/', 'plugin' => 'ninja-forms-paypal-express/paypal-express.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/paypal-express/'), array('title' => __('Save User Progress', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/save-user-progress-300x121.png', 'content' => __('Sometimes forms can grow quite large, and it would be very helpful for users to be able to save their progress and come back at a later time. This extension does just that for you. Using the built-in WordPress user …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/save-user-progress/', 'plugin' => 'ninja-forms-save-progress/save-progress.php', 'docs' => ''), array('title' => __('File Uploads', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/file-uploads1-300x121.png', 'content' => __('File Uploads for Ninjas Forms gives you the ability to insert file upload fields to your forms. This will allow users the ability to upload images, docs, audio or video files, or anything else you may need. You can easily …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/file-uploads/', 'plugin' => 'ninja-forms-uploads/file-uploads.php', 'docs' => 'http://ninjaforms.com/documentation/extensions/file-uploads/'), array('title' => __('Front-End Posting', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/front-end-posting-300x121.png', 'content' => __('The Ninja Forms Front-end Posting extension gives you the power of the WordPress post editor on any publicly viewable page you choose. You can allow users the ability to create content and have it assigned to any publicly available built-in or custom …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/front-end-posting/', 'plugin' => 'ninja-forms-post-creation/post-creation.php', 'docs' => ''), array('title' => __('Front-End Editor', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/03/front-end-editor.png', 'content' => __('The Front-End Editor Extension brings the power of your WordPress admin to your front-facing site. It is a one-stop solution for almost all your front-end editing needs. Users can now be allowed to create, edit, or delete posts, pages, or any custom post type without the need to see the WordPress admin.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/front-end-editor/', 'plugin' => 'ninja-forms-front-end-editor/front-end-editor.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/front-end-editor/'), array('title' => __('Multi-Part Forms', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/multi-part-forms-300x121.png', 'content' => __('The Multi-Part Forms extension allows you to break long forms into sections, creating a natural flow for your visitors. You can add a breadcrumb trail through the various sections of the form and a progress bar so that your users …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/multi-part-forms/', 'plugin' => 'ninja-forms-multi-part/multi-part.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/multi-part-forms/'), array('title' => __('Conditional Logic', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2012/10/conditional-logic-300x121.png', 'content' => __('This extension for Ninja Forms allows you to create “smart” forms. Fields within these forms can dynamically change based upon user input; show or hide fields based on a selected item, set field values based upon a list selection, or …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/conditional-logic/', 'plugin' => 'ninja-forms-conditionals/conditionals.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/conditional-logic/'), array('title' => __('MailChimp', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/04/mailchimp-for-ninja-forms-300x121.png', 'content' => __('The MailChimp extension allows you to quickly create newsletter signup forms for your MailChimp account using the power and flexibility that Ninja Forms provides. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mail-chimp/', 'plugin' => 'ninja-forms-mailchimp/ninja-forms-mailchimp.php', 'docs' => ''), array('title' => __('Campaign Monitor', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/05/campaign-monitor-header-300x121.png', 'content' => __('The Campaign Monitor extension allows you to quickly create newsletter signup forms for your Campaign Monitor account using the power and flexibility that Ninja Forms provides. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mail-chimp/', 'plugin' => 'ninja-forms-campaign-monitor/ninja-forms-campaign-monitor.php', 'docs' => ''), array('title' => __('User Analytics', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/05/user-analytics-header-300x121.png', 'content' => __('The User Analytics extension will help website owners understand how hot a lead is based on extra data automatically collected about the user. …', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/user-analytics/', 'plugin' => 'ninja-forms-user-analytics/nf-user-analytics.php', 'docs' => ''), array('title' => __('Constant Contact', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/07/constant-contact-300x121.png', 'content' => __('The Constant Contact extension allows you to quickly create newsletter signup forms for your Constant Contact account using the power and…', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/constant-contact/', 'plugin' => 'ninja-forms-constant-contact/ninja-forms-constant-contact.php', 'docs' => ''), array('title' => __('AWeber', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/08/aweber-300x121.png', 'content' => __('Use Ninja Forms to quickly create flexible newsletter signup forms for your AWeber email marketing account.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/aweber/', 'plugin' => 'ninja-forms-aweber/ninja-forms-aweber.php', 'docs' => ''), array('title' => __('Picatcha', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/08/picatcha-header-300x121.png', 'content' => __('The Picatcha extension allows you to add image-based CAPTHA to your forms.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/picatcha/', 'plugin' => 'ninja-forms-picatcha/ninja-forms-picatcha.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/picatcha/'), array('title' => __('MailPoet (formerly Wysija)', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/09/mailpoet-300x121.png', 'content' => __('The MailPoet (formerly Wysija) extension allows you to quickly create newsletter signup forms for your MailPoet mailing lists using the power and flexibility that Ninja Forms provides.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/mailpoet/', 'plugin' => 'ninja-forms-mailpoet/nf-mailpoet.php', 'docs' => ''), array('title' => __('HubSpot', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/10/hubspot-300x121.png', 'content' => __('The Ninja Forms HubSpot Extension extends a forms capabilities by forwarding submit data directly into your HubSpot account.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/hubspot/', 'plugin' => 'ninja-forms-hubspot/ninja-forms-hubspot.php', 'docs' => ''), array('title' => __('Text Message Notifications', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/10/text-message-notifications-300x121.png', 'content' => __('Send text message notifications to a site administrator when a form has been submitted.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/text-message-notifications/', 'plugin' => 'ninja-forms-text-message-notifications/nf-text-message-notifications.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/text-message-notifications/'), array('title' => __('Modal Forms', 'ninja-forms'), 'image' => 'http://ninjaforms.com/wp-content/uploads/edd/2013/11/modal-forms-300x121.png', 'content' => __('Open your Ninja Forms with a simple and clean modal pop-up.', 'ninja-forms'), 'link' => 'http://ninjaforms.com/downloads/modal-forms/', 'plugin' => 'ninja-forms-modal/ninja-forms-modal.php', 'docs' => 'http://ninjaforms.com/documentation/extension-docs/modal-forms/'));
foreach ($items as $item) {
echo '<div class="nf-extend nf-box">';
echo '<img src="' . $item['image'] . '" />';
echo '<h2>' . $item['title'] . '</h2>';
echo '<div>';
echo '<p>' . $item['content'] . '</p>';
if (!empty($item['docs'])) {
echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __('Documentation', 'ninja-forms') . '</a>';
} else {
echo '<p>' . __('Documentation coming soon.', 'ninja-forms') . '</a>.</p>';
}
echo '</div>';
if (file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
if (is_plugin_active($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Active', 'ninja-forms') . '</span>';
} elseif (is_plugin_inactive($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Installed', 'ninja-forms') . '</span>';
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
echo '</div>';
}
}
示例3: plugin_activate_example_activate
function plugin_activate_example_activate()
{
// Activation code here...
// let's create some categories upon activation
//http://codex.wordpress.org/Function_Reference/wp_insert_category
for ($i = 0; $i < 5; $i++) {
$catarr = array('cat_name' => 'My Category' . $i, 'category_description' => 'A Cool Category' . $i, 'category_nicename' => 'category-slug' . $i, 'category_parent' => '');
wp_insert_category($catarr);
}
// should be root path of the wp install
$wordpress_path = get_home_path();
require_once $wordpress_path . '/wp-load.php';
//not sure if this line is needed
//activate_plugin() is here:
require_once $wordpress_path . '/wp-admin/includes/plugin.php';
// we're going to activate our plugins that are dependencies
$plugins = array("filters-example", "js-example", "shortcode-example");
// see
//http://wordpress.stackexchange.com/questions/62967/why-activate-plugin-is-not-working-in-register-activation-hook
foreach ($plugins as $plugin) {
$plugin_path = $wordpress_path . 'wp-content/plugins/' . $plugin . '/' . $plugin . '.php';
if (file_exists($plugin_path) && is_plugin_inactive($plugin . '/' . $plugin . '.php')) {
// just double check that the plugin exists and unactivated
add_action('update_option_active_plugins', 'plugin_activation_dependencies');
}
}
}
示例4: mashsb_install
/**
* Install
*
* Runs on plugin install to populates the settings fields for those plugin
* pages. After successful install, the user is redirected to the MASHSB Welcome
* screen.
*
* @since 2.0
* @global $wpdb
* @global $mashsb_options
* @global $wp_version
* @return void
*/
function mashsb_install()
{
global $wpdb, $mashsb_options, $wp_version;
// Add Upgraded From Option
$current_version = get_option('mashsb_version');
if ($current_version) {
update_option('mashsb_version_upgraded_from', $current_version);
}
// Update the current version
update_option('mashsb_version', MASHSB_VERSION);
// Add plugin installation date and variable for rating div
add_option('mashsb_installDate', date('Y-m-d h:i:s'));
add_option('mashsb_RatingDiv', 'no');
if (!get_option('mashsb_update_notice')) {
add_option('mashsb_update_notice', 'no');
}
/* Setup some default options
* Store our initial social networks in separate option row.
* For easier modification and to prevent some trouble
*/
$networks = array('Facebook', 'Twitter', 'Subscribe');
if (is_plugin_inactive('mashshare-networks/mashshare-networks.php')) {
update_option('mashsb_networks', $networks);
}
// Bail if activating from network, or bulk
if (is_network_admin() || isset($_GET['activate-multi'])) {
return;
}
// Add the transient to redirect / not for multisites
set_transient('_mashsb_activation_redirect', true, 30);
}
示例5: axiom_widget_is_active
function axiom_widget_is_active($slug)
{
if (!function_exists('is_plugin_inactive')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
return !is_plugin_inactive("{$slug}.php");
}
示例6: is_plugin_inactive
/**
* Check if target plugin is inactive wrapper
*
* @param string $plugin_file
*
* @return bool
*/
public static function is_plugin_inactive($plugin_file)
{
if (!function_exists('is_plugin_inactive')) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return is_plugin_inactive($plugin_file);
}
示例7: activate_addon
/**
* Activate add-on.
*
* @access public
* @return void
*/
public function activate_addon()
{
//make sure we activated an add-on
if (empty($_POST['gmw_action']) || $_POST['gmw_action'] != 'activate_addon') {
return;
}
$active_addon = $_POST['gmw_addon_activated'];
$plugin_basename = $_POST['gmw_addon_basename'];
//look for nonce
if (empty($_POST[$active_addon . '_activate_addon_nonce'])) {
return;
}
//varify nonce
if (!wp_verify_nonce($_POST[$active_addon . '_activate_addon_nonce'], $active_addon . '_activate_addon_nonce')) {
return;
}
unset($this->addons[$active_addon]);
$this->addons[$active_addon] = 'active';
update_option('gmw_addons', $this->addons);
$plugins = get_plugins();
//activate the addon
if (array_key_exists($plugin_basename, $plugins) && is_plugin_inactive($plugin_basename)) {
activate_plugins($plugin_basename);
}
//reload the page to prevent resubmission
wp_safe_redirect(admin_url('admin.php?page=gmw-add-ons&gmw_notice=addon_activated&gmw_notice_status=updated'));
exit;
}
示例8: plugins_messages
function plugins_messages(){
$plugin_messages = array();
include_once(ABSPATH . 'wp-admin/includes/plugin.php' );
if(is_plugin_inactive('polylang/polylang.php')) {
// if (is_plugin_page('polylang/polylang.php')) {
// $plugin_messages[] = '當前主題要求必須啟用 Polylang 插件';
// } else {
$plugin_messages[] = '當前主題要求必須安裝 Polylang 插件,<a href="' . admin_url() . '/plugin-install.php?tab=plugin-information&plugin=polylang&TB_iframe=true" class="thickbox">下載插件2</a>';
// }
}
if(is_plugin_inactive( 'cool-tag-cloud/cool-tag-cloud.php' )) {
// if (is_plugin_page('cool-tag-cloud/cool-tag-cloud.php')) {
// // activate_plugins( 'cool-tag-cloud/cool-tag-cloud.php' );
// $plugin_messages[] = '當前主題要求必須啟用 Cool Tag Cloud 插件';
// } else {
$plugin_messages[] = '當前主題要求必須安裝 Cool Tag Cloud 插件,<a href="' . admin_url() . '/plugin-install.php?tab=plugin-information&plugin=cool-tag-cloud&TB_iframe=true" class="thickbox">下載插件</a>';
// }
}
if( count( $plugin_messages ) > 0 ){
echo '<div id="message" class="error">';
foreach( $plugin_messages as $message ) echo '<p><strong>' . $message . '</strong></p>';
echo '</div>';
}
}
示例9: test_is_plugin_inactive_false
function test_is_plugin_inactive_false()
{
activate_plugin('hello.php');
$test = is_plugin_inactive('hello.php');
$this->assertFalse($test);
deactivate_plugins('hello.php');
}
示例10: init
/**
* Initialize the plugin by registering any hooks the plugin needs to run
*
* @static
*/
public static function init()
{
// If Wordfence is not activated, display a warning
if (is_plugin_inactive('wordfence/wordfence.php')) {
add_thickbox();
add_action('admin_notices', array('SM_Wordfence_Scanner', 'display_warning'));
}
}
示例11: activate
public function activate()
{
// Check if WP-Piwik is installed
if (!isset($GLOBALS['wp-piwik'])) {
if (is_plugin_inactive('wp-piwik/wp-piwik.php')) {
add_action('update_option_active_plugins', array($this, 'activate_piwik'));
} else {
deactivate_plugins(plugin_basename(__FILE__));
wp_die('This plugin requires WP-Piwik. Install that one first.', 'Install WP-Piwik', array('back_link' => true));
}
}
}
示例12: ninja_forms_tab_addons
function ninja_forms_tab_addons()
{
// $uri = 'https://ninjaforms.com/downloads/category/ninja-forms/feed/';
//include_once(ABSPATH . WPINC . '/feed.php');
// $feed = fetch_feed( $uri );
// if (!is_wp_error( $feed ) ) :
// $items = $feed->get_items(0, 0);
// endif;
$items = wp_remote_get('https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h');
$items = wp_remote_retrieve_body($items);
$items = json_decode($items, true);
//shuffle( $items );
foreach ($items as $item) {
$plugin_data = array();
if (!empty($item['plugin']) && file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $item['plugin'], false, true);
}
$version = isset($plugin_data['Version']) ? $plugin_data['Version'] : '';
if (!empty($version) && $version < $item['version']) {
echo '<div class="error"><p>';
echo '<strong>' . $item['title'] . '</strong> requires an update. You have version <strong>' . $version . '</strong> installed. The current version is <strong>' . $item['version'] . '</strong>.';
echo '</p></div>';
}
}
foreach ($items as $item) {
echo '<div class="nf-extend nf-box">';
echo '<img src="' . $item['image'] . '" />';
echo '<h2>' . $item['title'] . '</h2>';
echo '<div class="nf-extend-content">';
echo '<p>' . $item['content'] . '</p>';
echo '<div class="nf-extend-buttons">';
if (!empty($item['docs'])) {
echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __('Documentation', 'ninja-forms') . '</a>';
} else {
echo '<p>' . __('Documentation coming soon.', 'ninja-forms') . '</a>.</p>';
}
if (!empty($item['plugin']) && file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
if (is_plugin_active($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Active', 'ninja-forms') . '</span>';
} elseif (is_plugin_inactive($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Installed', 'ninja-forms') . '</span>';
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
echo '</div>';
echo '</div>';
echo '</div>';
}
}
示例13: check_plugin_status
/**
* Check plugin status
*
* @return array
* @since 1.3
*/
public function check_plugin_status($slug, $extension)
{
if (is_plugin_active($slug)) {
echo '<button class="button-primary">' . __('Already Installed', 'wp-analytify') . '</button>';
} else {
if (array_key_exists($slug, $this->plugins_list)) {
echo '<a href="' . admin_url('plugins.php') . '" class="button-primary">' . __('Activate Plugin', 'wp-analytify') . '</a>';
} else {
if (is_plugin_inactive($slug)) {
if ($extension->status != '') {
echo '<a target="_blank" href="' . $extension->url . '" class="button-primary">' . __('Coming Soon', 'wp-analytify') . '</a>';
} else {
echo '<a target="_blank" href="' . $extension->url . '" class="button-primary">' . __('Get this add-on', 'wp-analytify') . '</a>';
}
}
}
}
}
示例14: ninja_forms_tab_addons
function ninja_forms_tab_addons()
{
$uri = 'http://ninjaforms.com/downloads/category/ninja-forms/feed/';
//include_once(ABSPATH . WPINC . '/feed.php');
$feed = fetch_feed($uri);
if (!is_wp_error($feed)) {
$items = $feed->get_items(0, 0);
}
$items = wp_remote_get('https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h');
$items = wp_remote_retrieve_body($items);
$items = json_decode($items, true);
//shuffle( $items );
foreach ($items as $item) {
echo '<div class="nf-extend nf-box">';
echo '<img src="' . $item['image'] . '" />';
echo '<h2>' . $item['title'] . '</h2>';
echo '<div>';
echo '<p>' . $item['content'] . '</p>';
if (!empty($item['docs'])) {
echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __('Documentation', 'ninja-forms') . '</a>';
} else {
echo '<p>' . __('Documentation coming soon.', 'ninja-forms') . '</a>.</p>';
}
echo '</div>';
if (!empty($item['plugin']) && file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
if (is_plugin_active($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Active', 'ninja-forms') . '</span>';
} elseif (is_plugin_inactive($item['plugin'])) {
echo '<span class="button-secondary nf-button">' . __('Installed', 'ninja-forms') . '</span>';
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
} else {
echo '<a href="' . $item['link'] . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __('Learn More', 'ninja-forms') . '</a>';
}
echo '</div>';
}
}
示例15: restful_notice_recommended_plugins
/**
* Display a notice with a list of recommended plugins.
*/
function restful_notice_recommended_plugins()
{
$plugins = array('brightslider/brightslider.php' => array('name' => 'BrightSlider', 'slug' => 'brightslider'), 'church-theme-content/church-theme-content.php' => array('name' => 'Church Theme Content', 'slug' => 'church-theme-content'), 'post-type-archive-links/post-type-archive-links.php' => array('name' => 'Post Type Archive Link', 'slug' => 'post-type-archive-links'));
$inactive = array();
foreach ($plugins as $plugin => $data) {
if (is_plugin_inactive($plugin)) {
$inactive[] = $data;
}
}
if (count($inactive) > 0) {
wp_enqueue_script('plugin-install');
add_thickbox();
$plugins_str = '';
$i = 0;
foreach ($inactive as $plugin) {
if ($i > 0) {
$plugins_str .= ', ';
}
$install_url = esc_url(admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=772&height=644'));
$plugins_str .= '<a href="' . $install_url . '" class="thickbox"><strong>' . $plugin['name'] . '</strong></a>';
$i++;
}
?>
<div class="notice error">
<p><?php
_e('Restful recommends the following plugin(s):', 'restful');
?>
<?php
echo $plugins_str;
?>
</p>
</div>
<?php
}
}