示例#1
0
function ubermenu_update_notifier_bar_menu()
{
    global $uberMenu;
    if (!$uberMenu->getSettings()->op('update-alerts')) {
        return;
    }
    if (!function_exists('simplexml_load_string')) {
        return;
    }
    global $wp_admin_bar, $wpdb;
    if (!is_super_admin() || !is_admin_bar_showing()) {
        return;
    }
    $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
    //21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
    $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
    // Get plugin data (current version is what we want)
    if (!$xml) {
        //we can't retrieve the XML file and parse it properly
        return;
    }
    if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
        $wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
    }
}
    function ubermenu_update_notifier()
    {
        $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
        $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
        // Get plugin data (current version is what we want)
        ?>

		<div class="wrap">
		
			<div id="icon-tools" class="icon32"></div>
			<div id="message" class="updated below-h2"><p><strong>There is a new version of UberMenu available.</strong> You have version <?php 
        echo $plugin_data['Version'];
        ?>
 installed. Update to version <?php 
        echo $xml->latest;
        ?>
.</p></div>
			<br/>
			<a href="http://wpmegamenu.com/help/#updates" class="button" target="_blank">Update Instructions</a>
			<a href="http://codecanyon.net/item/ubermenu-wordpress-mega-menu-plugin/154703" class="button" target="_blank">Download update from CodeCanyon</a>
			<br/>
			<div class="clear"></div>
			
			<h3 class="title">Changelog</h3>
			<?php 
        echo $xml->changelog;
        ?>

		</div>
		
	<?php 
    }