Renaming Reloaded.

git-svn-id: https://develop.svn.wordpress.org/trunk@628 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2003-12-18 09:36:13 +00:00
parent 696bf353dc
commit ccc413011a
42 changed files with 259 additions and 430 deletions

View File

@@ -228,7 +228,7 @@ function get_weekstartend($mysqlstring, $start_of_week) {
function convert_chars($content,$flag='obsolete attribute left there for backwards compatibility') { // html/unicode entities output
global $use_htmltrans, $b2_htmltrans, $b2_htmltranswinuni;
global $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
// removes metadata tags
$content = preg_replace('/<title>(.+?)<\/title>/','',$content);
@@ -241,12 +241,12 @@ function convert_chars($content,$flag='obsolete attribute left there for backwar
// converts HTML-entities to their display values in order to convert them again later
$content = preg_replace('/['.chr(127).'-'.chr(255).']/e', '"&#".ord(\'\0\').";"', $content );
$content = strtr($content, $b2_htmltrans);
$content = strtr($content, $wp_htmltrans);
// now converting: Windows CP1252 => Unicode (valid HTML)
// (if you've ever pasted text from MSWord, you'll understand)
$content = strtr($content, $b2_htmltranswinuni);
$content = strtr($content, $wp_htmltranswinuni);
}
@@ -259,9 +259,9 @@ function convert_chars($content,$flag='obsolete attribute left there for backwar
}
function convert_bbcode($content) {
global $b2_bbcode, $use_bbcode;
global $wp_bbcode, $use_bbcode;
if ($use_bbcode) {
$content = preg_replace($b2_bbcode["in"], $b2_bbcode["out"], $content);
$content = preg_replace($wp_bbcode["in"], $wp_bbcode["out"], $content);
}
$content = convert_bbcode_email($content);
return $content;
@@ -283,16 +283,16 @@ function convert_bbcode_email($content) {
}
function convert_gmcode($content) {
global $b2_gmcode, $use_gmcode;
global $wp_gmcode, $use_gmcode;
if ($use_gmcode) {
$content = preg_replace($b2_gmcode["in"], $b2_gmcode["out"], $content);
$content = preg_replace($wp_gmcode["in"], $wp_gmcode["out"], $content);
}
return $content;
}
function convert_smilies($text) {
global $smilies_directory, $use_smilies;
global $b2_smiliessearch, $b2_smiliesreplace;
global $wp_smiliessearch, $wp_smiliesreplace;
$output = '';
if ($use_smilies) {
// HTML loop taken from texturize function, could possible be consolidated
@@ -301,7 +301,7 @@ function convert_smilies($text) {
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
$content = str_replace($b2_smiliessearch, $b2_smiliesreplace, $content);
$content = str_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
}
$output .= $content;
}
@@ -1030,7 +1030,7 @@ function debug_fclose($fp) {
function pingback($content, $post_ID) {
// original code by Mort (http://mort.mine.nu:8080)
global $siteurl, $blogfilename, $b2_version;
global $siteurl, $blogfilename, $wp_version;
$log = debug_fopen('./pingback.log', 'a');
$post_links = array();
debug_fwrite($log, 'BEGIN '.time()."\n");
@@ -1099,7 +1099,7 @@ function pingback($content, $post_ID) {
}
// Send the GET request
$request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: b2/$b2_version PHP/" . phpversion() . "\r\n\r\n";
$request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: b2/$wp_version PHP/" . phpversion() . "\r\n\r\n";
ob_end_flush();
fputs($fp, $request);
@@ -1553,7 +1553,7 @@ if (!function_exists('in_array')) {
}
}
function start_b2() {
function start_wp() {
global $post, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages;
global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr;
global $pagenow;
@@ -1609,18 +1609,18 @@ function is_new_day() {
}
function apply_filters($tag, $string) {
global $b2_filter;
if (isset($b2_filter['all'])) {
$b2_filter['all'] = (is_string($b2_filter['all'])) ? array($b2_filter['all']) : $b2_filter['all'];
if (isset($b2_filter[$tag]))
$b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
global $wp_filter;
if (isset($wp_filter['all'])) {
$wp_filter['all'] = (is_string($wp_filter['all'])) ? array($wp_filter['all']) : $wp_filter['all'];
if (isset($wp_filter[$tag]))
$wp_filter[$tag] = array_merge($wp_filter['all'], $wp_filter[$tag]);
else
$b2_filter[$tag] = array_merge($b2_filter['all'], array());
$b2_filter[$tag] = array_unique($b2_filter[$tag]);
$wp_filter[$tag] = array_merge($wp_filter['all'], array());
$wp_filter[$tag] = array_unique($wp_filter[$tag]);
}
if (isset($b2_filter[$tag])) {
$b2_filter[$tag] = (is_string($b2_filter[$tag])) ? array($b2_filter[$tag]) : $b2_filter[$tag];
$functions = $b2_filter[$tag];
if (isset($wp_filter[$tag])) {
$wp_filter[$tag] = (is_string($wp_filter[$tag])) ? array($wp_filter[$tag]) : $wp_filter[$tag];
$functions = $wp_filter[$tag];
foreach($functions as $function) {
//error_log("apply_filters #1 applying filter $function");
$string = $function($string);
@@ -1630,9 +1630,9 @@ function apply_filters($tag, $string) {
}
function add_filter($tag, $function_to_add) {
global $b2_filter;
if (isset($b2_filter[$tag])) {
$functions = $b2_filter[$tag];
global $wp_filter;
if (isset($wp_filter[$tag])) {
$functions = $wp_filter[$tag];
if (is_array($functions)) {
foreach($functions as $function) {
$new_functions[] = $function;
@@ -1644,25 +1644,25 @@ function add_filter($tag, $function_to_add) {
for no apparent reason
if (is_array($function_to_add)) {
foreach($function_to_add as $function) {
if (!in_array($function, $b2_filter[$tag])) {
if (!in_array($function, $wp_filter[$tag])) {
$new_functions[] = $function;
}
}
} else */if (is_string($function_to_add)) {
if (!@in_array($function_to_add, $b2_filter[$tag])) {
if (!@in_array($function_to_add, $wp_filter[$tag])) {
$new_functions[] = $function_to_add;
}
}
$b2_filter[$tag] = $new_functions;
$wp_filter[$tag] = $new_functions;
} else {
$b2_filter[$tag] = array($function_to_add);
$wp_filter[$tag] = array($function_to_add);
}
return true;
}
// Check for hacks file if the option is enabled
if (get_settings('hack_file')) {
if (file_exists($abspath . '/my-hacks.php'))
require($abspath . '/my-hacks.php');
if (file_exists(ABSPATH . '/my-hacks.php'))
require(ABSPATH . '/my-hacks.php');
}
?>

View File

@@ -1464,15 +1464,15 @@ function comments_link($file='', $echo=true) {
}
function comments_popup_script($width=400, $height=400, $file='wp-comments-popup.php') {
global $b2commentspopupfile, $b2trackbackpopupfile, $b2pingbackpopupfile, $b2commentsjavascript;
$b2commentspopupfile = $file;
$b2commentsjavascript = 1;
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
$wpcommentspopupfile = $file;
$wpcommentsjavascript = 1;
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
echo $javascript;
}
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
$number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
if (0 == $number && 'closed' == $post->comment_status) {
@@ -1486,8 +1486,8 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com
}
}
echo '<a href="';
if ($b2commentsjavascript) {
echo $b2commentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1';
if ($wpcommentsjavascript) {
echo $wpcommentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1';
//echo get_permalink();
echo '" onclick="wpopen(this.href); return false"';
} else {

View File

@@ -3,10 +3,10 @@
/* This file sets various arrays and variables for use in b2 */
#b2 version
$b2_version = '0.80';
$wp_version = '0.80';
#BBcode search and replace arrays
$b2_bbcode['in'] = array(
$wp_bbcode['in'] = array(
'#\[b](.+?)\[/b]#is', // Formatting tags
'#\[i](.+?)\[/i]#is',
'#\[u](.+?)\[/u]#is',
@@ -20,7 +20,7 @@ $b2_bbcode['in'] = array(
# '#\[email](.+?)\[/email]#eis', // E-mail
# '#\[email=(.+?)](.+?)\[/email]#eis'
);
$b2_bbcode['out'] = array(
$wp_bbcode['out'] = array(
'<strong>$1</strong>', // Formatting tags
'<em>$1</em>',
'<span style="text-decoration:underline">$1</span>',
@@ -36,22 +36,22 @@ $b2_bbcode['out'] = array(
);
#GreyMatter formatting search and replace arrays
$b2_gmcode['in'] = array(
$wp_gmcode['in'] = array(
'#\\*\*(.+?)\\*\*#is', // **bold**
'#\\\\(.+?)\\\\#is', // \\italic\\
'#\__(.+?)\__#is' // __underline__
);
$b2_gmcode['out'] = array(
$wp_gmcode['out'] = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<span style="text-decoration:underline">$1</span>'
);
#Translation of HTML entities and special characters
$b2_htmltrans = array_flip(get_html_translation_table(HTML_ENTITIES));
$b2_htmltrans['<'] = '<'; # preserve HTML
$b2_htmltrans['>'] = '>'; # preserve HTML
$b2_htmltransbis = array(
$wp_htmltrans = array_flip(get_html_translation_table(HTML_ENTITIES));
$wp_htmltrans['<'] = '<'; # preserve HTML
$wp_htmltrans['>'] = '>'; # preserve HTML
$wp_htmltransbis = array(
'' => '&#8211;',
'—' => '&#8212;',
'' => '&#8216;',
@@ -95,10 +95,10 @@ $b2_htmltransbis = array(
'&supe;' => '&#8839;', '&oplus;' => '&#8853;', '&otimes;' => '&#8855;', '&perp;' => '&#8869;', '&sdot;' => '&#8901;', '&lceil;' => '&#8968;', '&rceil;' => '&#8969;', '&lfloor;' => '&#8970;', '&rfloor;' => '&#8971;', '&lang;' => '&#9001;',
'&rang;' => '&#9002;', '&loz;' => '&#9674;', '&spades;' => '&#9824;', '&clubs;' => '&#9827;', '&hearts;' => '&#9829;', '&diams;' => '&#9830;'
);
$b2_htmltrans = array_merge($b2_htmltrans,$b2_htmltransbis);
$wp_htmltrans = array_merge($wp_htmltrans,$wp_htmltransbis);
#Translation of invalid Unicode references range to valid range
$b2_htmltranswinuni = array(
$wp_htmltranswinuni = array(
'&#128;' => '&#8364;', // the Euro sign
'&#129;' => '',
'&#130;' => '&#8218;', // these are Windows CP1252 specific characters
@@ -164,28 +164,28 @@ if (preg_match('/Lynx/', $HTTP_USER_AGENT)) {
$is_IE = (($is_macIE) || ($is_winIE));
# browser-specific javascript corrections
$b2_macIE_correction['in'] = array(
$wp_macIE_correction['in'] = array(
'/\%uFFD4/', '/\%uFFD5/', '/\%uFFD2/', '/\%uFFD3/',
'/\%uFFA5/', '/\%uFFD0/', '/\%uFFD1/', '/\%uFFBD/',
'/\%uFF83%uFFC0/', '/\%uFF83%uFFC1/', '/\%uFF83%uFFC6/', '/\%uFF83%uFFC9/',
'/\%uFFB9/', '/\%uFF81%uFF8C/', '/\%uFF81%uFF8D/', '/\%uFF81%uFFDA/',
'/\%uFFDB/'
);
$b2_macIE_correction['out'] = array(
$wp_macIE_correction['out'] = array(
'&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;',
'&bull;', '&ndash;', '&mdash;', '&Omega;',
'&beta;', '&gamma;', '&theta;', '&lambda;',
'&pi;', '&prime;', '&Prime;', '&ang;',
'&euro;'
);
$b2_gecko_correction['in'] = array(
$wp_gecko_correction['in'] = array(
'/\‘/', '/\’/', '/\“/', '/\â€<C3A2>/',
'/\•/', '/\–/', '/\—/', '/\Ω/',
'/\β/', '/\γ/', '/\θ/', '/\λ/',
'/\Ï€/', '/\′/', '/\″/', '/\âˆ/',
'/\€/', '/\ /'
);
$b2_gecko_correction['out'] = array(
$wp_gecko_correction['out'] = array(
'&8216;', '&rsquo;', '&ldquo;', '&rdquo;',
'&bull;', '&ndash;', '&mdash;', '&Omega;',
'&beta;', '&gamma;', '&theta;', '&lambda;',
@@ -198,8 +198,8 @@ $is_Apache = strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache') ? 1 : 0;
$is_IIS = strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
# if the config file does not provide the smilies array, let's define it here
if (!isset($b2smiliestrans)) {
$b2smiliestrans = array(
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
' :)' => 'icon_smile.gif',
' :D' => 'icon_biggrin.gif',
' :-D' => 'icon_biggrin.gif',
@@ -257,16 +257,16 @@ if (!function_exists('smiliescmp')) {
return (strlen($a) > strlen($b)) ? -1 : 1;
}
}
uksort($b2smiliestrans, 'smiliescmp');
uksort($wpsmiliestrans, 'smiliescmp');
# generates smilies' search & replace arrays
foreach($b2smiliestrans as $smiley => $img) {
$b2_smiliessearch[] = $smiley;
foreach($wpsmiliestrans as $smiley => $img) {
$wp_smiliessearch[] = $smiley;
$smiley_masked = '';
for ($i = 0; $i < strlen($smiley); $i = $i + 1) {
$smiley_masked .= substr($smiley, $i, 1).chr(160);
}
$b2_smiliesreplace[] = "&nbsp;<img src='$smilies_directory/$img' alt='$smiley_masked' />";
$wp_smiliesreplace[] = "&nbsp;<img src='$smilies_directory/$img' alt='$smiley_masked' />";
}
add_filter('all', 'wptexturize');