Make WordPress Core


Ignore:
Timestamp:
02/17/2004 04:56:29 AM (21 years ago)
Author:
saxmatt
Message:

Refactoring of template tags to use filters, use TABS (!!!), and general cleanliness, which is next to godliness. Some get_settings improvements, less globals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r883 r885  
    265265
    266266function get_settings($setting) {
    267   global $wpdb, $cache_settings, $use_cache;
     267    global $wpdb, $cache_settings, $use_cache;
    268268    if (strstr($_SERVER['REQUEST_URI'], 'install.php')) {
    269269        return false;
    270270    }
     271
    271272    if ((empty($cache_settings)) OR (!$use_cache)) {
    272273        $settings = get_alloptions();
     
    275276        $settings = $cache_settings;
    276277    }
    277     if (!isset($settings->$setting)) {
    278         return false;
    279     }
    280     else {
    281         return $settings->$setting;
     278
     279    if (!isset($settings->$setting)) {
     280        return false;
     281    } else {
     282        return stripslashes($settings->$setting);
    282283    }
    283284}
    284285
    285286function get_alloptions() {
    286     global $tableoptions, $wpdb;
    287     $options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
    288     if ($options) {
    289         foreach ($options as $option) {
    290             $all_options->{$option->option_name} = $option->option_value;
    291         }
    292     }
    293     return $all_options;
     287    global $tableoptions, $wpdb;
     288    $options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
     289    if ($options) {
     290        foreach ($options as $option) {
     291            // "When trying to design a foolproof system,
     292            //  never underestimate the ingenuity of the fools :)"
     293            if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
     294            $all_options->{$option->option_name} = $option->option_value;
     295        }
     296    }
     297    return $all_options;
    294298}
    295299
     
    14621466}
    14631467
     1468function remove_slashes($string) {
     1469    return stripslashes(stripslashes($string));
     1470}
     1471
    14641472?>
Note: See TracChangeset for help on using the changeset viewer.