$value){
$browserAgents[$key] = trim($value);
}
return $browserAgents;
}
}
return array();
}
function detectPDA(){
$browserAgent = $_SERVER['HTTP_USER_AGENT'];
$userAgents = getBrowserAgentsToDetect();
foreach ( $userAgents as $userAgent ) {
if(eregi($userAgent,$browserAgent)){
return true;
}
}
return false;
}
function barcodes_add_options() {
if(function_exists('add_options_page')){
add_options_page('barcodes', 'barcodes', 9, basename(__FILE__), 'barcodes_options_subpanel');
}
}
switch($_POST['action']){
case 'Save':
if(isset($_POST['betatest'])) update_option('barcodes_betatest', "yes");
else delete_option('barcodes_betatest');
if(isset($_POST['notme'])) update_option('barcodes_notme', "yes");
else delete_option('barcodes_notme');
if(isset($_POST['googtestmode'])) update_option('barcodes_googtestmode', "yes");
else delete_option('barcodes_googtestmode');
update_option('devkey', $_POST['devkey']);
update_option('barcodes_lra', $_POST['barcodes_pos']);
if($_POST['home'] == "on") update_option('barcodes_home', "checked=on");
else update_option('barcodes_home', "");
if($_POST['page'] == "on") update_option('barcodes_page', "checked=on");
else update_option('barcodes_page', "");
if($_POST['post'] == "on") update_option('barcodes_post', "checked=on");
else update_option('barcodes_post', "");
if($_POST['cat'] == "on") update_option('barcodes_cat', "checked=on");
else update_option('barcodes_cat', "");
if($_POST['archive'] == "on") update_option('barcodes_archive', "checked=on");
else update_option('barcodes_archive', "");
break;
}
function barcodes_options_subpanel(){
$value_devkey = get_option('devkey');
$ad_channel = get_option('barcodes_channel');
$lra = get_option('barcodes_lra');
?>
';
if($tag == "right")
return '';
if(($tag == "top") || ($tag == "bottom"))
return '
';
else
return '
';
}
###doerfel insert code!!
function barcodes_genadcode(){
global $user_level;
$devkey = get_option('devkey');
define("TAGSOLUTE_DEV_KEY", $devkey);
define("TAGSOLUTE_API_URL", "http://www.tagsolute.de/cgi-bin/api.cgi");
require_once("json/JSON.php");
require_once("api.php");
$mParams = array("sUrl" => get_permalink());
$mResult = mxApiCall("GetRedirectTag", $mParams);
if($mResult["bSuccessful"]) {
$TagsoluteImg='

';;
}
else {
$mResult["jResult"]["sInfo"];
}
print "\n";
$TagsoluteDiv.=$TagsoluteImg;
$retstr=$TagsoluteImg;
return $retstr;
}
$barcodes_adsused = 0;
function barcodes_the_content($content){
global $doing_rss;
$content_doerfel=$content;
### doerfel auschluss von barcodes
if(is_feed() || $doing_rss)
return $content;
if(strpos($content, "") !== false) return $content;
if( detectPDA()== true) return $content;
if(is_home() && get_option('barcodes_home') == "checked=on") return $content;
if(is_page() && get_option('barcodes_page') == "checked=on") return $content;
if(is_single() && get_option('barcodes_post') == "checked=on") return $content;
if(is_category() && get_option('barcodes_cat') == "checked=on") return $content;
if(is_archive() && get_option('barcodes_archive') == "checked=on") return $content;
global $barcodes_adsused, $user_level;
if(get_option('barcodes_betatest') == "yes" && $user_level < 8)
return $content;
if(get_option('barcodes_notme') == "yes" && $user_level > 8)
return $content;
$numads = get_option('barcodes_nads');
if(is_single())
$numads = get_option('barcodes_nadspp');
$content_hold = "";
if(strpos($content, "") !== false){
$content_hold = substr($content, 0, strpos($content, ""));
$content = substr_replace($content, "", 0, strpos($content, ""));
}
### ende doerfel auschluss von barcodes
$poses = array();
$lastpos = -1;
$repchar = "
$half)
array_pop($poses);
$pickme = $poses[rand(0, sizeof($poses)-1)];
$replacewith = barcodes_pickalign(get_option('barcodes_lra'));
$replacewith .= barcodes_genadcode()."
";
if (get_option('barcodes_lra')=="bottom") {
return $content_doerfel.barcodes_genadcode()."
";
} else {
$content = substr_replace($content, $replacewith.$repchar, $pickme, 2);
}
return $content_hold.$content;
}
add_filter('the_content', 'barcodes_the_content');
?>