Migration to get_settings

git-svn-id: https://develop.svn.wordpress.org/trunk@956 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2004-03-01 06:13:32 +00:00
parent 37c361e964
commit 59155a15f3
30 changed files with 109 additions and 155 deletions
+3 -4
View File
@@ -81,13 +81,13 @@ function sanitize_title($title) {
}
function convert_chars($content, $flag='obsolete attribute left there for backwards compatibility') { // html/unicode entities output
global $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
global $wp_htmltrans, $wp_htmltranswinuni;
// removes metadata tags
$content = preg_replace('/<title>(.+?)<\/title>/','',$content);
$content = preg_replace('/<category>(.+?)<\/category>/','',$content);
if ($use_htmltrans) {
if (get_settings('use_htmltrans')) {
// converts lone & characters into &#38; (a.k.a. &amp;)
$content = preg_replace('/&[^#](?![a-z]*;)/ie', '"&#38;".substr("\0",1)', $content);
// converts HTML-entities to their display values in order to convert them again later
@@ -124,9 +124,8 @@ function convert_chars($content, $flag='obsolete attribute left there for backwa
1.0 First Version
*/
function balanceTags($text, $is_comment = 0) {
global $use_balanceTags;
if ($use_balanceTags == 0) {
if (get_settings('use_balanceTags') == 0) {
return $text;
}
+20 -24
View File
@@ -85,7 +85,7 @@ function get_weekstartend($mysqlstring, $start_of_week) {
$day = mktime(0,0,0, $md, $mm, $my);
$weekday = date('w',$day);
$i = 86400;
while ($weekday > $start_of_week) {
while ($weekday > get_settings('start_of_week')) {
$weekday = date('w',$day);
$day = $day - 86400;
$i = 0;
@@ -565,10 +565,9 @@ function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), w
// pings Weblogs.com
function pingWeblogs($blog_ID = 1) {
// original function by Dries Buytaert for Drupal
global $use_weblogsping, $blogname;
if ((!(($blogname=="my weblog") && (get_settings('siteurl')=="http://example.com") && (get_settings('blogfilename') == "wp.php"))) && (!preg_match("/localhost\//", get_settings('siteurl'))) && ($use_weblogsping)) {
if ((!((get_settings('blogname')=="my weblog") && (get_settings('siteurl')=="http://example.com") && (get_settings('blogfilename') == "wp.php"))) && (!preg_match("/localhost\//", get_settings('siteurl'))) && (get_settings('use_weblogsping'))) {
$client = new xmlrpc_client("/RPC2", "rpc.weblogs.com", 80);
$message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($blogname),
$message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval(get_settings('blogname')),
new xmlrpcval(get_settings('siteurl') . '/' . get_settings('blogfilename')
)));
$result = $client->send($message);
@@ -583,10 +582,10 @@ function pingWeblogs($blog_ID = 1) {
// pings Weblogs.com/rssUpdates
function pingWeblogsRss($blog_ID = 1, $rss_url) {
global $use_weblogsrssping, $blogname, $rss_url;
if ($blogname != 'my weblog' && $rss_url != 'http://example.com/b2rdf.php' && $use_weblogsrssping) {
global $use_weblogsrssping, $rss_url;
if (get_settings('blogname') != 'my weblog' && $rss_url != 'http://example.com/b2rdf.php' && $use_weblogsrssping) {
$client = new xmlrpc_client('/RPC2', 'rssrpc.weblogs.com', 80);
$message = new xmlrpcmsg('rssUpdate', array(new xmlrpcval($blogname), new xmlrpcval($rss_url)));
$message = new xmlrpcmsg('rssUpdate', array(new xmlrpcval(get_settings('blogname')), new xmlrpcval($rss_url)));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
return false;
@@ -599,8 +598,8 @@ function pingWeblogsRss($blog_ID = 1, $rss_url) {
// pings CaféLog.com
function pingCafelog($cafelogID,$title='',$p='') {
global $use_cafelogping, $blogname;
if ((!(($blogname=="my weblog") && (get_settings('siteurl') == "http://example.com") && (get_settings('blogfilename')=="wp.php"))) && (!preg_match("/localhost\//", get_settings('siteurl'))) && ($use_cafelogping) && ($cafelogID != '')) {
global $use_cafelogping;
if ((!((get_settings('blogname')=="my weblog") && (get_settings('siteurl') == "http://example.com") && (get_settings('blogfilename')=="wp.php"))) && (!preg_match("/localhost\//", get_settings('siteurl'))) && ($use_cafelogping) && ($cafelogID != '')) {
$client = new xmlrpc_client("/xmlrpc.php", "cafelog.tidakada.com", 80);
$message = new xmlrpcmsg("b2.ping", array(new xmlrpcval($cafelogID), new xmlrpcval($title), new xmlrpcval($p)));
$result = $client->send($message);
@@ -615,14 +614,14 @@ function pingCafelog($cafelogID,$title='',$p='') {
// pings Blo.gs
function pingBlogs($blog_ID="1") {
global $use_blodotgsping, $blodotgsping_url, $use_rss, $blogname;
if ((!(($blogname=='my weblog') && (get_settings('siteurl')=='http://example.com') && (get_settings('blogfilename')=='wp.php'))) && (!preg_match('/localhost\//',get_settings('siteurl'))) && ($use_blodotgsping)) {
$url = ($blodotgsping_url == 'http://example.com') ? get_settings('siteurl').'/'.get_settings('blogfilename') : $blodotgsping_url;
global $use_rss;
if ((!((get_settings('blogname')=='my weblog') && (get_settings('siteurl')=='http://example.com') && (get_settings('blogfilename')=='wp.php'))) && (!preg_match('/localhost\//',get_settings('siteurl'))) && (get_settings('use_blodotgsping'))) {
$url = get_settings('siteurl').'/'.get_settings('blogfilename');
$client = new xmlrpc_client('/', 'ping.blo.gs', 80);
if ($use_rss) {
$message = new xmlrpcmsg('weblogUpdates.extendedPing', array(new xmlrpcval($blogname), new xmlrpcval($url), new xmlrpcval($url), new xmlrpcval(get_settings('siteurl').'/b2rss.xml')));
$message = new xmlrpcmsg('weblogUpdates.extendedPing', array(new xmlrpcval(get_settings('blogname')), new xmlrpcval($url), new xmlrpcval($url), new xmlrpcval(get_settings('siteurl').'/b2rss.xml')));
} else {
$message = new xmlrpcmsg('weblogUpdates.ping', array(new xmlrpcval($blogname), new xmlrpcval($url)));
$message = new xmlrpcmsg('weblogUpdates.ping', array(new xmlrpcval(get_settings('blogname')), new xmlrpcval($url)));
}
$result = $client->send($message);
if (!$result || $result->faultCode()) {
@@ -637,10 +636,10 @@ function pingBlogs($blog_ID="1") {
// Send a Trackback
function trackback($trackback_url, $title, $excerpt, $ID) {
global $blogname, $wpdb, $tableposts;
global $wpdb, $tableposts;
$title = urlencode(stripslashes($title));
$excerpt = urlencode(stripslashes($excerpt));
$blog_name = urlencode(stripslashes($blogname));
$blog_name = urlencode(stripslashes(get_settings('blogname')));
$tb_url = $trackback_url;
$url = urlencode(get_permalink($ID));
$query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt";
@@ -971,9 +970,8 @@ function getRemoteFile($host,$path) {
}
function pingGeoURL($blog_ID) {
global $blodotgsping_url;
$ourUrl = $blodotgsping_url."/index.php?p=".$blog_ID;
$ourUrl = get_settings('siteurl') ."/index.php?p=".$blog_ID;
$host="geourl.org";
$path="/ping/?p=".$ourUrl;
getRemoteFile($host,$path);
@@ -1044,7 +1042,6 @@ function wp_get_comment_status($comment_id) {
function wp_notify_postauthor($comment_id, $comment_type='comment') {
global $wpdb, $tablecomments, $tableposts, $tableusers;
global $querystring_start, $querystring_equal, $querystring_separator;
global $blogname, $blog_charset;
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
@@ -1054,7 +1051,7 @@ function wp_notify_postauthor($comment_id, $comment_type='comment') {
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
$blogname = stripslashes($blogname);
$blogname = stripslashes(get_settings('blogname'));
if ('comment' == $comment_type) {
$notify_message = "New comment on your post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\"\r\n\r\n";
@@ -1090,7 +1087,7 @@ function wp_notify_postauthor($comment_id, $comment_type='comment') {
$message_headers = "MIME-Version: 1.0\r\n"
. "$from\r\n"
. "Content-Type: text/plain; charset=\"$blog_charset\"\r\n";
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n";
@mail($user->user_email, $subject, $notify_message, $message_headers);
@@ -1105,7 +1102,6 @@ function wp_notify_postauthor($comment_id, $comment_type='comment') {
function wp_notify_moderator($comment_id) {
global $wpdb, $tablecomments, $tableposts, $tableusers;
global $querystring_start, $querystring_equal, $querystring_separator;
global $blogname, $blog_charset;
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
@@ -1125,13 +1121,13 @@ function wp_notify_moderator($comment_id) {
$notify_message .= "Currently $comments_waiting comments are waiting for approval. Please visit the moderation panel:\r\n";
$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
$subject = '[' . stripslashes($blogname) . '] Please approve: "' .stripslashes($post->post_title).'"';
$subject = '[' . stripslashes(get_settings('blogname')) . '] Please approve: "' .stripslashes($post->post_title).'"';
$admin_email = get_settings("admin_email");
$from = "From: $admin_email";
$message_headers = "MIME-Version: 1.0\r\n"
. "$from\r\n"
. "Content-Type: text/plain; charset=\"$blog_charset\"\r\n";
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n";
@mail($admin_email, $subject, $notify_message, $message_headers);
+5 -7
View File
@@ -22,7 +22,7 @@ function bloginfo_unicode($show='') {
}
function get_bloginfo($show='') {
global $blogname, $admin_email;
global $admin_email;
$do_perma = 0;
$feed_url = get_settings('siteurl');
@@ -79,7 +79,7 @@ function get_bloginfo($show='') {
break;
case 'name':
default:
$output = $blogname;
$output = get_settings('blogname');
break;
}
return $output;
@@ -205,7 +205,7 @@ function get_archives_link($url, $text, $format = "html", $before = "", $after =
function get_archives($type='', $limit='', $format='html', $before = "", $after = "", $show_post_count = false) {
global $tableposts, $time_difference;
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb;
if ('' == $type) {
$type = get_settings('archive_mode');
@@ -270,9 +270,7 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
}
}
} elseif ('weekly' == $type) {
if (!isset($start_of_week)) {
$start_of_week = 1;
}
$start_of_week = get_settings('start_of_week');
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK($wp_posts_post_date_field, $start_of_week) AS `week`, YEAR($wp_posts_post_date_field) AS yr, DATE_FORMAT($wp_posts_post_date_field, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
$arc_w_last = '';
if ($arcresults) {
@@ -280,7 +278,7 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
if ($arcresult->week != $arc_w_last) {
$arc_year = $arcresult->yr;
$arc_w_last = $arcresult->week;
$arc_week = get_weekstartend($arcresult->yyyymmdd, $start_of_week);
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_settings('start_of_week'));
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
$url = sprintf('%s/%s%sm%s%s%sw%s%d', get_settings('siteurl'), get_settings('blogfilename'), $querystring_start,