Example #1
0
/**
 * Display a notice if there is a newer version of YOURLS available
 *
 * @since 1.7
 */
function yourls_new_core_version_notice()
{
    yourls_debug_log('Check for new version: ' . (yourls_maybe_check_core_version() ? 'yes' : 'no'));
    $checks = yourls_get_option('core_version_checks');
    if (isset($checks->last_result->latest) and version_compare($checks->last_result->latest, YOURLS_VERSION, '>')) {
        $msg = yourls_s('<a href="%s">YOURLS version %s</a> is available. Please update!', 'http://yourls.org/download', $checks->last_result->latest);
        yourls_add_notice($msg);
    }
}
Example #2
0
// Allow early inclusion of a cache layer
if (file_exists(YOURLS_USERDIR . '/cache.php')) {
    require_once YOURLS_USERDIR . '/cache.php';
}
// Read options right from start
yourls_get_all_options();
// Register shutdown function
register_shutdown_function('yourls_shutdown');
// Core now loaded
yourls_do_action('init');
// plugins can't see this, not loaded yet
// Check if need to redirect to install procedure
if (!yourls_is_installed() && !yourls_is_installing()) {
    yourls_redirect(yourls_admin_url('install.php'), 302);
}
// Check if upgrade is needed (bypassed if upgrading or installing)
if (!yourls_is_upgrading() && !yourls_is_installing()) {
    if (yourls_upgrade_is_needed()) {
        yourls_redirect(YOURLS_SITE . '/admin/upgrade.php', 302);
    }
}
// Init all plugins
yourls_load_plugins();
yourls_do_action('plugins_loaded');
// Is there a new version of YOURLS ?
if (yourls_is_installed() && !yourls_is_upgrading() && yourls_maybe_check_core_version()) {
    yourls_new_core_version_notice();
}
if (yourls_is_admin()) {
    yourls_do_action('admin_init');
}