function colabsthemes_framework_update_page_set() { if (isset($_POST['password'])) { $cred = $_POST; $filesystem = WP_Filesystem($cred); } elseif (isset($_POST['colabs_ftp_cred'])) { $cred = unserialize(stripcslashes($_POST['colabs_ftp_cred'])); $filesystem = WP_Filesystem($cred); } else { $filesystem = WP_Filesystem(); } $localversion = get_option('colabs_framework_version'); $remoteversion = colabs_get_fw_version(); $upd = colabsthemes_framework_update_check(); ?> <span style="display:none"><?php echo $method; ?> </span> <form method="post" enctype="multipart/form-data" id="colabsform" action="<?php /* echo $url; */ ?> "> <?php if ($upd['update']) { ?> <?php wp_nonce_field('update-options'); ?> <h3><?php _e("A new version of ColorLabs Framework is available.", "colabsthemes"); ?> </h3> <p><?php _e("This updater will download and extract the latest ColorLabs Framework files to your current theme's functions folder. ", "colabsthemes"); ?> </p> <p><?php _e("We recommend backing up your theme files before updating.", "colabsthemes"); ?> </p> <p>→ <strong><?php _e("Your version:", "colabsthemes"); ?> </strong> <?php echo $upd['localversion']; ?> </p> <p>→ <strong><?php _e("New Version:", "colabsthemes"); ?> </strong> <?php echo $upd['remoteversion']; ?> </p> <input type="submit" class="button" value="Update Framework" /> <input type="hidden" name="colabs_update_save" value="save" /> <input type="hidden" name="colabs_ftp_cred" value="<?php echo esc_attr(serialize($_POST)); ?> " /> <?php } else { ?> <h3><?php _e("You have the latest version of ColorLabs Framework", "colabsthemes"); ?> </h3> <p>→ <strong><?php _e("Your version:", "colabsthemes"); ?> </strong> <?php echo $upd['localversion']; ?> </p> <?php } ?> </form> <?php }
function colabsthemes_options_page_header($args) { /* SET VARIABLES */ $themename = get_option('colabs_themename'); //Defaults $save_button = 'true'; $reset_button = 'true'; $update_class = 'update-true'; //Set Var $upd = colabsthemes_framework_update_check(); if ($upd['update'] == true) { $upd_class = $update_class; } else { $upd_class = ''; } if (!is_array($args)) { parse_str($args, $args); } extract($args); /* SET HEADER */ ?> <div id="panel-logo"> <a href="http://colorlabsproject.com" title="Visit Our Website"><img src="<?php echo get_template_directory_uri(); ?> /functions/images/colorlabs-logo.png" /></a> <span class="theme-info"><?php echo $themename; ?> <?php echo COLABS_THEME_VER; ?> </span> </div><!-- #panel-logo --> <div id="header-nav"> <ul> <?php // SET UP OPTIONS $options = array(); // General Settings $options[] = array('name' => __('Theme Options', 'colabsthemes'), 'desc' => '', 'page' => 'colabsthemes', 'icon' => 'options', 'class' => ''); $layoutfile = get_template_directory() . '/includes/theme-options-layout.php'; if (get_option('framework_colabs_seo_disable') != 'true') { $options[] = array('name' => __('SEO Settings', 'colabsthemes'), 'desc' => '', 'page' => 'colabsthemes_seo', 'icon' => 'dashboard', 'class' => ''); } if (get_option('framework_colabs_layout_disable') != 'true' && file_exists($layoutfile)) { $options[] = array('name' => __('Layout Settings', 'colabsthemes'), 'desc' => '', 'page' => 'colabsthemes_layout_settings', 'icon' => 'options', 'class' => ''); } //--Get admin submenu from add_submenu_page() function global $submenu; $newarr = array(); $icon = 'options'; // Store current $options['page'] into new array foreach ($options as $key => $val) { $newarr[] = $val['page']; } foreach ($submenu['colabsthemes_dummy'] as $colabsthemes_dummy_submenu) { //if page already exists skip it if (in_array($colabsthemes_dummy_submenu[2], $newarr)) { continue; } //Icon $filename = get_template_directory() . '/functions/images/icon/' . $colabsthemes_dummy_submenu[2] . '.png'; if (file_exists($filename)) { $icon = $colabsthemes_dummy_submenu[2]; } $options[] = array('name' => $colabsthemes_dummy_submenu[0], 'desc' => '', 'page' => $colabsthemes_dummy_submenu[2], 'icon' => $icon, 'class' => ''); } //-- END Get admin submenu $options[] = array('name' => __('Updates', 'colabsthemes'), 'desc' => '', 'page' => 'colabsthemes_framework_update', 'icon' => 'update', 'class' => $upd_class); //generate nav lists echo colabs_header_nav($options); ?> </ul> </div><!-- #header-nav --> <div class="save-bar save_bar_top right"> <img style="display:none" src="<?php echo get_template_directory_uri(); ?> /functions/images/ajax-loading.gif" class="ajax-loading-img ajax-loading-img-top" alt="Working..." /> <?php if ('true' == $save_button) { ?> <input type="submit" value="Save Changes" class="button submit-button button-primary" /> <span> </span> <?php } ?> </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>"; } }