Example #1
0
function html_output_adsense_settings()
{
    // Check the required settings!
    if ($adsense_publisher_id = adsense_publisher_id()) {
        // Default banner size and type
        $ad_type = 'medium';
        $ad_width = 468;
        $ad_height = 60;
        // Get banner size and type
        adsense_get_banner_type($ad_type, $ad_width, $ad_height);
        // Get the slot id from the forum settings.
        $ad_slot_id = adsense_slot_id($ad_type);
        // Output the settings Javascript.
        echo "<script type=\"text/javascript\">\n";
        echo "<!--\n\n";
        echo "google_ad_client = \"{$adsense_publisher_id}\";\n";
        echo "google_ad_slot = \"{$ad_slot_id}\";\n";
        echo "google_ad_width = {$ad_width}\n";
        echo "google_ad_height = {$ad_height}\n\n";
        echo "//-->\n";
        echo "</script>\n";
        return true;
    }
    return false;
}
Example #2
0
function adsense_output_html()
{
    static $adsense_displayed = false;
    $webtag = get_webtag();
    forum_check_webtag_available($webtag);
    if ($adsense_displayed === false) {
        if (adsense_publisher_id()) {
            $adsense_display_users = adsense_display_users();
            $ad_type = 'medium';
            $ad_width = 468;
            $ad_height = 60;
            adsense_get_banner_type($ad_type, $ad_width, $ad_height);
            echo "<div class=\"google_adsense_container\" style=\"width: 100%; text-align: center\">\n";
            echo "  <div style=\"width: {$ad_width}px; margin: auto\">\n";
            echo "    <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\n";
            if (!session::logged_in() && $adsense_display_users == ADSENSE_DISPLAY_GUESTS) {
                echo "  <div class=\"google_adsense_register_note\"><a href=\"index.php?webtag={$webtag}&amp;final_uri=register.php%3Fwebtag%3D{$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Register to remove these adverts."), "</a></div>\n";
            }
            echo "  </div>\n";
            echo "</div>\n";
            $adsense_displayed = true;
        }
    }
}