Esempio n. 1
0
 function google_show_ad($id, $channel = '')
 {
     global $bnc_wptouch_version;
     $ad = '';
     $GLOBALS['google']['client'] = $id;
     $GLOBALS['google']['channel'] = $channel;
     $google_dt = time();
     google_set_screen_res();
     google_set_muid();
     $snoopy = new Snoopy();
     $snoopy->agent = 'WPtouch ' . $bnc_wptouch_version;
     $ad = '';
     $result = $snoopy->fetch(google_get_ad_url());
     if ($result) {
         $ad = $snoopy->results;
     }
     return $ad;
 }
Esempio n. 2
0
<?php

$GLOBALS['google']['ad_type'] = 'text_image';
$GLOBALS['google']['channel'] = '';
$GLOBALS['google']['client'] = 'pub-2389600000216179';
$GLOBALS['google']['format'] = 'mobile_single';
$GLOBALS['google']['https'] = read_global('HTTPS');
$GLOBALS['google']['ip'] = read_global('REMOTE_ADDR');
$GLOBALS['google']['markup'] = 'chtml';
$GLOBALS['google']['oe'] = 'utf8';
$GLOBALS['google']['output'] = 'chtml';
$GLOBALS['google']['ref'] = read_global('HTTP_REFERER');
$GLOBALS['google']['url'] = read_global('HTTP_HOST') . read_global('REQUEST_URI');
$GLOBALS['google']['useragent'] = read_global('HTTP_USER_AGENT');
$google_dt = time();
google_set_screen_res();
google_set_muid();
function read_global($var)
{
    return isset($_SERVER[$var]) ? $_SERVER[$var] : '';
}
function google_append_url(&$url, $param, $value)
{
    $url .= '&' . $param . '=' . urlencode($value);
}
function google_append_globals(&$url, $param)
{
    google_append_url($url, $param, $GLOBALS['google'][$param]);
}
function google_append_color(&$url, $param)
{
Esempio n. 3
0
function mim_mobile_adsense()
{
    $format = attribute_escape(get_option('mim_adsensemob_io'));
    if ($format != 'off') {
        $background = attribute_escape(get_option('mim_adsensemob_bg'));
        $border = attribute_escape(get_option('mim_adsensemob_border'));
        $channel = attribute_escape(get_option('mim_adsensemob_channel'));
        $charset = get_bloginfo('charset');
        $link = attribute_escape(get_option('mim_adsensemob_link'));
        $pub_client = attribute_escape(get_option('mim_adsensemob_pub'));
        $text = attribute_escape(get_option('mim_adsensemob_text'));
        $url = attribute_escape(get_option('mim_adsensemob_url'));
        function google_set_screen_res()
        {
            $screen_res = $_SERVER['HTTP_UA_PIXELS'];
            $delimiter = 'x';
            if ($screen_res == '') {
                $screen_res = $_SERVER['HTTP_X_UP_DEVCAP_SCREENPIXELS'];
                $delimiter = ',';
            }
            $res_array = explode($delimiter, $screen_res);
            if (sizeof($res_array) == 2) {
                $GLOBALS['google']['u_w'] = $res_array[0];
                $GLOBALS['google']['u_h'] = $res_array[1];
            }
        }
        $GLOBALS['google']['ad_type'] = 'text';
        $GLOBALS['google']['channel'] = "{$channel}";
        $GLOBALS['google']['client'] = "{$pub_client}";
        $GLOBALS['google']['color_border'] = "{$border}";
        $GLOBALS['google']['color_bg'] = "{$background}";
        $GLOBALS['google']['color_link'] = "{$link}";
        $GLOBALS['google']['color_text'] = "{$text}";
        $GLOBALS['google']['color_url'] = "{$url}";
        $GLOBALS['google']['format'] = "{$format}";
        $GLOBALS['google']['https'] = $_SERVER['HTTPS'];
        $GLOBALS['google']['host'] = $_SERVER['HTTP_HOST'];
        $GLOBALS['google']['ip'] = $_SERVER['REMOTE_ADDR'];
        $GLOBALS['google']['markup'] = 'xhtml';
        $GLOBALS['google']['oe'] = "{$charset}";
        $GLOBALS['google']['output'] = 'xhtml';
        $GLOBALS['google']['ref'] = $_SERVER['HTTP_REFERER'];
        $GLOBALS['google']['url'] = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        $GLOBALS['google']['useragent'] = $_SERVER['HTTP_USER_AGENT'];
        $google_dt = time();
        google_set_screen_res();
        function google_append_url(&$url, $param, $value)
        {
            $url .= '&' . $param . '=' . urlencode($value);
        }
        function google_append_globals(&$url, $param)
        {
            google_append_url($url, $param, $GLOBALS['google'][$param]);
        }
        function google_append_color(&$url, $param)
        {
            global $google_dt;
            $color_array = split(',', $GLOBALS['google'][$param]);
            google_append_url($url, $param, $color_array[$google_dt % sizeof($color_array)]);
        }
        function google_get_ad_url()
        {
            $google_ad_url = 'http://pagead2.googlesyndication.com/pagead/ads?';
            $google_scheme = $GLOBALS['google']['https'] == 'on' ? 'https://' : 'http://';
            foreach ($GLOBALS['google'] as $param => $value) {
                if ($param == 'client') {
                    google_append_url($google_ad_url, $param, 'ca-mb-' . $GLOBALS['google'][$param]);
                } elseif (strpos($param, 'color_') === 0) {
                    google_append_color($google_ad_url, $param);
                } elseif (strpos($param, 'host') === 0 || strpos($param, 'url') === 0) {
                    google_append_url($google_ad_url, $param, $google_scheme . $GLOBALS['google'][$param]);
                } else {
                    google_append_globals($google_ad_url, $param);
                }
            }
            google_append_url($google_ad_url, 'dt', round(1000 * array_sum(explode(' ', microtime()))));
            return $google_ad_url;
        }
        $google_ad_handle = @fopen(google_get_ad_url(), 'r');
        if ($google_ad_handle) {
            while (!feof($google_ad_handle)) {
                echo '<div class="ad">' . fread($google_ad_handle, 8192) . "</div>\n";
            }
            fclose($google_ad_handle);
        }
    }
}