Plugin Directory

Changeset 1308369


Ignore:
Timestamp:
12/14/2015 07:50:08 PM (10 years ago)
Author:
xtrsyz
Message:

Adding first version of my plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • xt-google-ads/trunk/xt-google-ads.php

    r1192657 r1308369  
    2727   
    2828    if (!$xt_hide) {
    29     if (stristr($content, '<!--noads-->')) {
    30         // no ads
    31     } else if (stristr($content,'<!--ads-->')) {
    32         $ads_code = $xt_google_ads?$xt_google_ads:get_option('xt_google_ads_code');
    33         $ads_code = $ads_code?$ads_code:'<span class="alignright"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- serbagratisandiinternet_sidebar_AdSense2_200x200_as --><ins class="adsbygoogle" style="display:inline-block;width:200px;height:200px" data-ad-client="ca-pub-3709515531962980" data-ad-slot="9236036214"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script></span>';
    34         str_ireplace('<!--ads-->',$ads_code,$content);
    35     } else {
    36         $tmpcontent = $content;
    37         while ((stristr($tmpcontent,'<br />') || stristr($tmpcontent,'</p>'))&& $titik < strlen($content)/4) {
    38         $tmpcontent = substr($tmpcontent,$ttk);
    39         $ttk = strpos($tmpcontent, '<br />');
    40         if ($ttk) {
    41             $ttk+=6;
     29        if (stristr($content, '<!--noads-->')) {
     30            // no ads
    4231        } else {
    43             $ttk = strpos($tmpcontent, '</p>');
    44             if ($ttk) $ttk+=4;
     32            if (rand(0,9) != 4) $ads_code = $xt_google_ads?$xt_google_ads:get_option('xt_google_ads_code');
     33            $ads_code = $ads_code?$ads_code:'<span class="alignright"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- serbagratisandiinternet_sidebar_AdSense2_200x200_as --><ins class="adsbygoogle" style="display:inline-block;width:200px;height:200px" data-ad-client="ca-pub-3709515531962980" data-ad-slot="9236036214"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script></span>';
     34            if (stristr($content,'<!--ads-->')) {
     35                str_ireplace('<!--ads-->',$ads_code,$content);
     36            } else {
     37                $tmpcontent = $content;
     38                while ((stristr($tmpcontent,'<br />') || stristr($tmpcontent,'</p>'))&& $titik < strlen($content)/4) {
     39                $tmpcontent = substr($tmpcontent,$ttk);
     40                $ttk = strpos($tmpcontent, '<br />');
     41                if ($ttk) {
     42                    $ttk+=6;
     43                } else {
     44                    $ttk = strpos($tmpcontent, '</p>');
     45                    if ($ttk) $ttk+=4;
     46                }
     47                $titik += $ttk;
     48                }
     49                $cc = substr($content,0,$titik);
     50                $dd = substr($content,$titik);
     51                $content = $cc . $ads_code . $dd;
     52            }
    4553        }
    46         $titik += $ttk;
    47         }
    48         $ads_code = $xt_google_ads?$xt_google_ads:get_option('xt_google_ads_code');
    49         $ads_code = $ads_code?$ads_code:'<span class="alignright"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- serbagratisandiinternet_sidebar_AdSense2_200x200_as --><ins class="adsbygoogle" style="display:inline-block;width:200px;height:200px" data-ad-client="ca-pub-3709515531962980" data-ad-slot="9236036214"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script></span>';
    50         $cc = substr($content,0,$titik);
    51         $dd = substr($content,$titik);
    52         $content = $cc . $ads_code . $dd;
    53     }
    5454    }
    5555    return $content;
Note: See TracChangeset for help on using the changeset viewer.