Beispiel #1
0
/**
 * Tarski preferences sometimes change between versions, and need to
 * be updated. This function does not determine whether an update is
 * needed, it merely perfoms it. It's also self-contained, so it
 * won't update the global $tarski_options object either.
 *
 * @since 2.1
 *
 * @uses tarski_upgrade_special
 */
function tarski_upgrade()
{
    // Get options and set defaults
    $options = get_option('tarski_options');
    // Update the options version so we don't run this code more than once
    $options->installed = wp_get_theme()->Version;
    // Handle special cases first
    tarski_upgrade_special($options, null);
    // Save our upgraded options
    update_option('tarski_options', flush_tarski_options());
}
Beispiel #2
0
/**
 * Returns the raw value of a given Tarski option.
 *
 * This function is required because, depending on the circumstances (such as
 * the TarskiOptions object being in a 'deleted' state), get_tarski_option may
 * return a default value rather than the raw value.
 *
 * @since 2.5
 *
 * @see get_tarski_option
 *
 * @global object $tarski_options
 * @param string $name
 * @return mixed
 */
function get_raw_tarski_option($name)
{
    global $tarski_options;
    if (!is_a($tarski_options, 'TarskiOptions')) {
        flush_tarski_options();
    }
    return $tarski_options->{$name};
}
Beispiel #3
0
/**
 * get_tarski_option() - Returns the given Tarski option.
 * 
 * @since 1.4
 * @param string $name
 * @return mixed
 */
function get_tarski_option($name)
{
    global $tarski_options;
    if (!is_object($tarski_options)) {
        flush_tarski_options();
    }
    return $tarski_options->{$name};
}
Beispiel #4
0
/**
 * tarski_upgrade_and_flush_options() - Upgrades Tarski if needed and flushes options.
 * 
 * @since 2.1
 * @see tarski_upgrade_needed()
 * @see tarski_upgrade()
 * @uses tarski_upgrade_needed()
 * @uses tarski_upgrade()
 * @uses flush_tarski_options
 */
function tarski_upgrade_and_flush_options()
{
    if (tarski_upgrade_needed()) {
        tarski_upgrade();
        flush_tarski_options();
    }
}