function responsive_mobile_plugin_notice()
{
    global $pagenow;
    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    // Check that the user hasn't already clicked to ignore the message
    // Add plugin notification only if the current user ican install plugins and on theme.php
    if (!get_user_meta($user_id, 'responsive_mobile_ignore_notice') && current_user_can('install_plugins') && 'themes.php' == $pagenow) {
        // Set array of plugins to be suggested.
        $plugins = array(array('name' => 'Clef', 'slug' => 'wpclef', 'uri' => 'http://wordpress.org/extend/plugins/wpclef'), array('name' => 'Wp Product Review', 'slug' => 'wp-product-review', 'uri' => 'http://wordpress.org/extend/plugins/wp-product-review'), array('name' => 'Tweet Old Post', 'slug' => 'tweet-old-post', 'uri' => 'http://wordpress.org/extend/plugins/tweet-old-post'));
        // Initialise plugin suggestion text.
        $msg = '';
        $msg .= '<div class="updated"><p>' . __('This theme recommends the following plugins:', 'responsive-mobile') . '</br><strong>';
        // Loop through each plugin.
        foreach ($plugins as $plugin) {
            // Get plugin object by sending plugin slug and uri.
            $plugin_object = new Theme_Plugin_Dependency($plugin['slug'], $plugin['uri']);
            // Display plugin name as the suggestion with link to the plugin page in wordpress.org
            $msg .= ' <a target="_blank" href="' . esc_url($plugin['uri']) . '">' . $plugin['name'] . '</a>';
            // Check if the plugin is allready installed then show link to Activate it.
            if ($plugin_object->check()) {
                $msg .= ' | <a href="' . $plugin_object->activate_link() . '">' . __('Activate', 'responsive-mobile') . '</a>,</br>';
            } elseif ($install_link = $plugin_object->install_link()) {
                $msg .= ' | <a href="' . $install_link . '">' . __('Install', 'responsive-mobile') . '</a>,</br>';
            } else {
                $msg .= sprintf(__('%s is not installed. Please install this plugin manually.', 'responsive-mobile'), $plugin['name']) . '</br>';
            }
        }
        // End of the plugin loop.
        // Show link to Hide the Notice.
        $msg .= '</strong><a href="?responsive_mobile_ignore_notice=true">' . __('Hide Notice', 'responsive-mobile') . '</a></p></div>';
        echo $msg;
    }
}
/**
 * Adding a free extensions to the list
 * @author Sven Lehnert, Konrad Sroka   
 */
function add_free_extension($name, $slug, $url)
{
    $tpd = new Theme_Plugin_Dependency($slug, $url);
    ?>

    <tr class="<?php 
    if ($tpd->check_active()) {
        echo "active";
    } else {
        echo "inactive";
    }
    ?>
">
    	<td><p>
		    <?php 
    // echo '<pre>';
    // print_r($tpd);
    // echo '/<pre>';
    if ($tpd->check_active()) {
        echo $name . ' is installed and activated!';
    } else {
        if ($tpd->check()) {
            echo $name . ' is installed, but not activated. <a href="' . $tpd->activate_link() . '">Click here to activate the plugin.</a>';
        } else {
            if ($install_link = $tpd->install_link()) {
                echo $name . ' is not installed. <a href="' . $install_link . '">Click here to install the plugin.</a>';
            } else {
                echo $name . ' is not installed and could not be found in the plugin directory. Please install this plugin manually.';
            }
        }
    }
    ?>
 
		</td></p>
    </tr><?php 
}
示例#3
0
    /**
     * Add a notice saying that WP Better Emails doesn't exist.
     *
     * We also add a quick activation / installation link for WP Better Emails depending on that plugin's state.
     *
     * @see Theme_Plugin_Dependency
     */
    function get_wpbe()
    {
        $wpbe = new Theme_Plugin_Dependency('wp-better-emails', 'http://wordpress.org/extend/plugins/wp-better-emails/');
        ?>
		<div class="error">
			<p><?php 
        printf(__('%s requires the %s plugin to be activated.', 'wpbe-bp'), '<strong>WP Better Emails for BuddyPress</strong>', '<strong>WP Better Emails</strong>');
        ?>
</p>

			<?php 
        if ($wpbe->check()) {
            ?>
				<p><a href="<?php 
            echo $wpbe->activate_link();
            ?>
"><?php 
            _e('Activate it now!', 'wpbe-bp');
            ?>
</a></p>
			<?php 
        } elseif ($install_link = $wpbe->install_link()) {
            ?>
				<p><a href="<?php 
            echo $install_link;
            ?>
"><?php 
            _e('Intsall it now!', 'wpbe-bp');
            ?>
</a></p>
			<?php 
        }
        ?>
		</div>
	<?php 
    }