You are on page 1of 3

<?

php

// on which page are we ?


if (preg_match('#([^/]+\.php)$#', $php_self, $self_matches)) {
$pagenow = $self_matches[1];
} else if (strstr($php_self, '?')) {
$pagenow = explode('/', $php_self);
$pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
$pagenow = explode('?', $pagenow);
$pagenow = $pagenow[0];
} else {
$pagenow = 'index.php';
}

// simple browser detection


$is_lynx = 0; $is_gecko = 0; $is_winie = 0; $is_macie = 0; $is_opera = 0; $is_ns4
= 0;

if (preg_match('/lynx/', $_server['http_user_agent'])) {
$is_lynx = 1;
} elseif (preg_match('/gecko/', $_server['http_user_agent'])) {
$is_gecko = 1;
} elseif ((preg_match('/msie/', $_server['http_user_agent'])) &&
(preg_match('/win/', $_server['http_user_agent']))) {
$is_winie = 1;
} elseif ((preg_match('/msie/', $_server['http_user_agent'])) &&
(preg_match('/mac/', $_server['http_user_agent']))) {
$is_macie = 1;
} elseif (preg_match('/opera/', $_server['http_user_agent'])) {
$is_opera = 1;
} elseif ((preg_match('/nav/', $_server['http_user_agent']) ) ||
(preg_match('/mozilla\/4\./', $_server['http_user_agent']))) {
$is_ns4 = 1;
}
$is_ie = (($is_macie) || ($is_winie));

// server detection
$is_apache = ( strstr($_server['server_software'], 'apache') ||
strstr($_server['server_software'], 'litespeed') ) ? 1 : 0;
$is_iis = strstr($_server['server_software'], 'microsoft-iis') ? 1 : 0;

// on os x server, $_server['remote_addr'] is the server's address. workaround


this
// by using $_server['http_pc_remote_addr'], which *is* the remote address.
if ( isset($_server['http_pc_remote_addr']) )
$_server['remote_addr'] = $_server['http_pc_remote_addr'];

// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
':angry:' => 'yahoo_angry.gif',
':angel:' => 'yahoo_angel.gif',
' 0:)' => 'yahoo_angel.gif',
':blink:' => 'yahoo_batting.gif',
' ;;)' => 'yahoo_batting.gif',
':wink:' => 'yahoo_wink.gif',
' ;)' => 'yahoo_wink.gif',
':grin:' => 'yahoo_bigsmile.gif',
' :d' => 'yahoo_bigsmile.gif',
':blush:' => 'yahoo_blush.gif',
':brokenheart:' => 'yahoo_brokenheart.gif',
':bye:' => 'yahoo_bye.gif',
':callme:' => 'yahoo_callme.gif',
':clap:' => 'yahoo_clap.gif',
':cry:' => 'yahoo_cry.gif',
' :((' => 'yahoo_cry.gif',
':dance:' => 'yahoo_dance.gif',
':daydream:' => 'yahoo_daydream.gif',
':devil:' => 'yahoo_devil.gif',
':doh:' => 'yahoo_doh.gif',
':dontknow:' => 'yahoo_dontknow.gif',
':drool:' => 'yahoo_drool.gif',
':eyebrow:' => 'yahoo_eyebrow.gif',
':eyeroll:' => 'yahoo_eyeroll.gif',
':frustrated:' => 'yahoo_frustrated.gif',
':giggle:' => 'yahoo_giggle.gif',
':glasses:' => 'yahoo_glasses.gif',
':hug:' => 'yahoo_huggs.gif',
':smile:' => 'yahoo_smiley.gif',
' :)' => 'yahoo_smiley.gif',
':hypnotized:' => 'yahoo_hypnotized.gif',
':idea:' => 'yahoo_idea.gif',
':kiss:' => 'yahoo_kiss.gif',
':laughaloud:' => 'yahoo_laughloud.gif',
':liar:' => 'yahoo_liar.gif',
':ahwait:' => 'yahoo_loser.gif',
':love:' => 'yahoo_love.gif',
' :x:' => 'yahoo_love.gif',
':madtongue:' => 'yahoo_madtongue.gif',
':mean:' => 'yahoo_mean.gif',
' :>' => 'yahoo_mean.gif',
':nailbiting:' => 'yahoo_nailbiting.gif',
':neutral:' => 'yahoo_neutral.gif',
' :|' => 'yahoo_neutral.gif',
':oooh:' => 'yahoo_ooooh.gif',
':party:' => 'yahoo_party.gif',
':peace:' => 'yahoo_peace.gif',
':pray:' => 'yahoo_pray.gif',
':question:' => 'yahoo_question.gif',
':rotfl:' => 'yahoo_rotfl.gif',
':sad:' => 'yahoo_sad.gif',
':shame:' => 'yahoo_shame.gif',
':shhh:' => 'yahoo_shhhh.gif',
':sick:' => 'yahoo_sick.gif',
':sighing:' => 'yahoo_sighing.gif',
':silent:' => 'yahoo_silent.gif',
':silly:' => 'yahoo_silly.gif',
':sleep:' => 'yahoo_sleep.gif',
':star:' => 'yahoo_star.gif',
':sunglass:' => 'yahoo_sunglas.gif',
':cool:' => 'yahoo_sunglas.gif',
':sweating:' => 'yahoo_sweating.gif',
':blabber:' => 'yahoo_talktohand.gif',
':think:' => 'yahoo_think.gif',
' :?' => 'yahoo_think.gif',
':tired:' => 'yahoo_tired.gif',
':tongue:' => 'yahoo_tongue.gif',
' :p' => 'yahoo_tongue.gif',
':waiting:' => 'yahoo_waiting.gif',
':wave:' => 'yahoo_wave.gif',
':waving:' => 'yahoo_waving.gif',
':whistle:' => 'yahoo_whistling.gif',
':witsend:' => 'yahoo_witsend.gif',
':worried:' => 'yahoo_worried.gif',
' :s' => 'yahoo_worried.gif',
':worship:' => 'yahoo_worship.gif',
':kiddingme:' => 'yahoo_youkiddingme.gif',
);
}

// generates smilies' search & replace arrays


foreach($wpsmiliestrans as $smiley => $img) {
$wp_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars( trim($smiley) , ent_quotes);
$wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-
includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}

?>

You might also like