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

git-svn-id: https://develop.svn.wordpress.org/trunk@885 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2004-02-17 04:56:29 +00:00
parent 1c58817681
commit d6a30cc0e8
8 changed files with 267 additions and 316 deletions

View File

@@ -264,33 +264,37 @@ function url_to_postid($url = '') {
/* Options functions */
function get_settings($setting) {
global $wpdb, $cache_settings, $use_cache;
global $wpdb, $cache_settings, $use_cache;
if (strstr($_SERVER['REQUEST_URI'], 'install.php')) {
return false;
}
if ((empty($cache_settings)) OR (!$use_cache)) {
$settings = get_alloptions();
$cache_settings = $settings;
} else {
$settings = $cache_settings;
}
if (!isset($settings->$setting)) {
return false;
}
else {
return $settings->$setting;
if (!isset($settings->$setting)) {
return false;
} else {
return stripslashes($settings->$setting);
}
}
function get_alloptions() {
global $tableoptions, $wpdb;
$options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
if ($options) {
foreach ($options as $option) {
$all_options->{$option->option_name} = $option->option_value;
}
}
return $all_options;
global $tableoptions, $wpdb;
$options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
if ($options) {
foreach ($options as $option) {
// "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)"
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
$all_options->{$option->option_name} = $option->option_value;
}
}
return $all_options;
}
function update_option($option_name, $newvalue) {
@@ -1461,4 +1465,8 @@ function rewrite_rules($matches = '') {
return $rewrite;
}
?>
function remove_slashes($string) {
return stripslashes(stripslashes($string));
}
?>