예제 #1
0
 function colabs_theme_check()
 {
     global $framework_need_update;
     $framework_need_update = false;
     $theme_name = get_option('colabs_themename');
     $theme_url_changelog = 'http://colorlabsproject.com/updates/' . strtolower($theme_name) . '/changelog.txt';
     $storefront_theme = colabs_get_fw_version($theme_url_changelog);
     $check_theme_update = version_compare($storefront_theme['version'], COLABS_THEME_VER, '>');
     $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), 'http://colorlabsproject.com/updates/' . strtolower($theme_name) . '/changelog.txt');
     $update_url = esc_url(add_query_arg(array('page' => 'colabsthemes_framework_update'), admin_url('admin.php')));
     if ($check_theme_update == 1) {
         ?>
 <div class="updated fade" id="colabs-update-theme">
   <p>
     <?php 
         printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a> or <a href="%4$s" >update now</a>.'), $theme_name, $details_url, $storefront_theme['version'], $update_url);
         ?>
   </p>
 </div>
 <?php 
     } else {
         $local_version = get_option('colabs_framework_version');
         if ($local_version == '') {
             return;
         }
         $update_data = colabs_framework_version_checker($local_version);
         if (is_array($update_data) && $update_data['is_update'] == true) {
             $framework_need_update = true;
         }
     }
 }
    function colabs_theme_check()
    {
        $theme_name = get_option('colabs_themename');
        $storefront_theme = colabs_get_fw_version('http://colorlabsproject.com/updates/' . strtolower($theme_name) . '/changelog.txt');
        $check_theme_update = version_compare($storefront_theme, COLABS_THEME_VER, '>');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), 'http://colorlabsproject.com/updates/' . strtolower($theme_name) . '/changelog.txt');
        $update_url = esc_url(add_query_arg(array('page' => 'colabsthemes_framework_update')));
        if ($check_theme_update == 1) {
            ?>
	<div class="colabs-save-popup" id="colabs-update-theme" style="display:block;">
		<div class="colabs-save-save">
			<?php 
            printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a> or <a href="%4$s" >update now</a>.'), $theme_name, $details_url, $storefront_theme, $update_url);
            ?>
		</div>
	</div>
	<?php 
        }
    }
/**
 * Add notification beside the "Updates" text when update is available
 * 
 */
function colabs_updates_notif()
{
    global $menu, $submenu;
    $upd = array();
    // Theme Update
    $theme_name = get_option('colabs_themename');
    $storefront_theme = colabs_get_fw_version('http://colorlabsproject.com/updates/' . strtolower($theme_name) . '/changelog.txt');
    $check_theme_update = version_compare($storefront_theme, COLABS_THEME_VER, '>');
    if ($check_theme_update) {
        $upd[] = true;
    }
    // Framework update
    $fw_update_check = colabsthemes_framework_update_check();
    if (isset($fw_update_check['update']) && $fw_update_check['update']) {
        $upd[] = true;
    }
    if (count($upd) > 0) {
        $update_text = $submenu['colabsthemes'][2][0];
        $submenu['colabsthemes'][2][0] = $update_text . "<span class='awaiting-mod update-plugins'><span class='processing-count'>" . count($upd) . "</span></span>";
    }
}