예제 #1
0
 function test_largo_need_updates()
 {
     // force updates by setting current version of largo to 0.0
     of_set_option('largo_version', '0.0');
     $this->assertTrue(largo_need_updates());
     // Will we ever hit this version number?
     of_set_option('largo_version', '999.999');
     $this->assertFalse(largo_need_updates());
     of_reset_options();
 }
예제 #2
0
파일: update.php 프로젝트: GaryJones/Largo
function largo_ajax_update_database()
{
    if (!current_user_can('activate_plugins')) {
        print json_encode(array("status" => __("An error occurred."), "success" => false));
        wp_die();
    }
    if (!largo_need_updates()) {
        print json_encode(array("status" => __("Finished. No update was required."), "success" => false));
        wp_die();
    }
    $ret = largo_perform_update();
    if (!empty($ret)) {
        if (version_compare(of_get_option('largo_version'), '0.4') < 0) {
            $message = __("Thank you -- the update is complete. Don't forget to check your site settings!");
        } else {
            $message = __("Thank you -- the update is complete.");
        }
        print json_encode(array("status" => $message, "success" => true));
        wp_die();
    } else {
        print json_encode(array("status" => __("There was a problem applying the update. Please try again."), "success" => false));
        wp_die();
    }
}
예제 #3
0
/**
 * If Largo needs to be updated, prevent the user from access the Theme Options edit page.
 *
 * @since 0.5.3
 */
function largo_block_theme_options_for_update()
{
    if (largo_need_updates()) {
        add_action('admin_init', function () {
            remove_submenu_page('themes.php', 'options-framework');
        });
        add_theme_page(__('Theme Options', 'options_framework_theme'), __('Theme Options', 'options_framework_theme'), 'edit_theme_options', 'largo-block-theme-options', 'largo_block_theme_options');
    }
}