Version Description
Coding improvements.
Download this release
Release Info
Developer | manojtd |
Plugin | Easy Plugin for AdSense |
Version | 7.10 |
Comparing to | |
See all releases |
Code changes from version 7.02 to 7.10
- easy-adsense-lite.php +122 -194
- readme.txt +3 -2
easy-adsense-lite.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Easy AdSense
|
5 |
Plugin URI: http://www.thulasidas.com/adsense
|
6 |
Description: Easiest way to show AdSense and make money from your blog. Configure it at <a href="options-general.php?page=easy-adsense-lite.php">Settings → Easy AdSense</a>.
|
7 |
-
Version: 7.
|
8 |
Author: Manoj Thulasidas
|
9 |
Author URI: http://www.thulasidas.com
|
10 |
*/
|
@@ -40,7 +40,7 @@ if (!class_exists("EzAdSense")) {
|
|
40 |
var $invite, $locale, $defaults, $helpTags,
|
41 |
$leadin, $leadout, $options, $optionName, $metaOptions;
|
42 |
var $ezMax, $urMax, $urCount, $ezCount;
|
43 |
-
var $adminMsg;
|
44 |
var $kills = array('page', 'sticky', 'home', 'front_page', 'category',
|
45 |
'tag', 'archive', 'search', 'single', 'attachment');
|
46 |
var $ezOptions = array();
|
@@ -64,12 +64,7 @@ if (!class_exists("EzAdSense")) {
|
|
64 |
$this->urCount = 0;
|
65 |
$this->ezCount = 0;
|
66 |
$this->metaOptions = array();
|
67 |
-
|
68 |
-
|
69 |
-
function session_start() {
|
70 |
-
if (!session_id()) {
|
71 |
-
@session_start();
|
72 |
-
}
|
73 |
}
|
74 |
|
75 |
static function showUnreal($print = false) {
|
@@ -198,6 +193,7 @@ if (!class_exists("EzAdSense")) {
|
|
198 |
$o->desc = __('Position:', 'easy-adsenser');
|
199 |
$o->style = "width:30%;";
|
200 |
$o->addChoice('send_headers', 'send_headers', __('Above Header', 'easy-adsenser'));
|
|
|
201 |
$o->addChoice('the_content', 'the_content', __('Below Header', 'easy-adsenser'));
|
202 |
$o->addChoice('default', '', __('Beginning of Post', 'easy-adsenser'));
|
203 |
$this->ezOptions['header_leadin'] = clone $o;
|
@@ -677,50 +673,50 @@ if (!class_exists("EzAdSense")) {
|
|
677 |
}
|
678 |
|
679 |
function getMetaOptions() {
|
680 |
-
if (
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
$
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
$
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
$
|
709 |
-
|
710 |
-
|
711 |
-
$
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
$style
|
718 |
-
|
719 |
-
|
720 |
-
$metaOptions[$optKey] = $style;
|
721 |
}
|
|
|
722 |
}
|
723 |
-
return $metaOptions;
|
724 |
}
|
725 |
|
726 |
function findParas($content) {
|
@@ -740,25 +736,59 @@ if (!class_exists("EzAdSense")) {
|
|
740 |
}
|
741 |
|
742 |
function mkBorder() {
|
743 |
-
$border
|
744 |
-
|
745 |
-
$border = 'border:#' . $this->options['border_normal'] .
|
746 |
' solid ' . $this->options['border_width'] . 'px;" ' .
|
747 |
' onmouseover="this.style.border=\'#' . $this->options['border_color'] .
|
748 |
' solid ' . $this->options['border_width'] . 'px\'" ' .
|
749 |
'onmouseout="this.style.border=\'#' . $this->options['border_normal'] .
|
750 |
-
' solid ' . $this->options['border_width'] . 'px\'
|
751 |
}
|
752 |
-
return $border;
|
753 |
}
|
754 |
|
755 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
foreach ($this->kills as $k) {
|
757 |
$fn = "is_$k";
|
758 |
if ($this->options["kill_$k"] && $fn()) {
|
759 |
-
|
760 |
}
|
761 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
$this->ezMax = $this->options['max_count'];
|
763 |
$adsServed = 0;
|
764 |
if ($this->options['force_widget']) {
|
@@ -777,35 +807,12 @@ if (!class_exists("EzAdSense")) {
|
|
777 |
return $content;
|
778 |
}
|
779 |
|
780 |
-
$timeout = 60;
|
781 |
-
$commentArgs = array('status' => 'approve');
|
782 |
-
$commentArgs['post_id'] = get_the_ID();
|
783 |
-
$comments = get_comments($commentArgs);
|
784 |
-
$ezContent = '';
|
785 |
-
foreach ($comments as $comment) {
|
786 |
-
$ezContent .= $comment->comment_content;
|
787 |
-
}
|
788 |
-
$ezContent .= $content;
|
789 |
-
set_transient('ezContent', $ezContent, $timeout);
|
790 |
if (!in_the_loop()) {
|
791 |
return $content;
|
792 |
}
|
793 |
$this->handleDefaults();
|
794 |
|
795 |
-
if ($this->options['kill_linebreaks']) {
|
796 |
-
$linebreak = "";
|
797 |
-
}
|
798 |
-
else {
|
799 |
-
$linebreak = "\n";
|
800 |
-
}
|
801 |
$wc = str_word_count($content);
|
802 |
-
if ((is_single() || is_page()) && $this->urCount < $this->urMax) {
|
803 |
-
$unreal = self::showUnreal();
|
804 |
-
}
|
805 |
-
else {
|
806 |
-
$unreal = '';
|
807 |
-
}
|
808 |
-
$border = $this->mkBorder();
|
809 |
|
810 |
$show_leadin = $metaOptions['show_leadin'];
|
811 |
$leadin = '';
|
@@ -813,20 +820,7 @@ if (!class_exists("EzAdSense")) {
|
|
813 |
if ($this->ezCount < $this->ezMax) {
|
814 |
$adsServed++;
|
815 |
$this->ezCount++;
|
816 |
-
$
|
817 |
-
if ($this->options['kill_inline']) {
|
818 |
-
$inline = '';
|
819 |
-
}
|
820 |
-
else {
|
821 |
-
$inline = 'style="' . $show_leadin . ';margin:' .
|
822 |
-
$margin . 'px;' . $border . '"';
|
823 |
-
}
|
824 |
-
$leadin = stripslashes($this->options['info'] .
|
825 |
-
"$linebreak<!-- Post[count: " . $this->ezCount . "] -->$linebreak" .
|
826 |
-
'<div class="ezAdsense adsense adsense-leadin" ' . $inline . '>' .
|
827 |
-
$this->options['text_leadin'] .
|
828 |
-
($this->urCount++ < $this->urMax ? $unreal : '') .
|
829 |
-
"</div>$linebreak" . $this->options['info'] . "$linebreak");
|
830 |
}
|
831 |
}
|
832 |
|
@@ -846,19 +840,7 @@ if (!class_exists("EzAdSense")) {
|
|
846 |
if ($this->options['force_midad'] || $half > 10) {
|
847 |
$this->ezCount++;
|
848 |
$adsServed++;
|
849 |
-
$
|
850 |
-
if ($this->options['kill_inline']) {
|
851 |
-
$inline = '';
|
852 |
-
}
|
853 |
-
else {
|
854 |
-
$inline = 'style="' . $show_midtext . ';margin:' . $margin . 'px;' . $border . '"';
|
855 |
-
}
|
856 |
-
$midtext = stripslashes($this->options['info'] .
|
857 |
-
"$linebreak<!-- Post[count: " . $this->ezCount . "] -->$linebreak" .
|
858 |
-
'<div class="ezAdsense adsense adsense-midtext" ' . $inline . '>' .
|
859 |
-
$this->options['text_midtext'] .
|
860 |
-
($this->urCount++ < $this->urMax ? $unreal : '') .
|
861 |
-
"</div>$linebreak" . $this->options['info'] . "$linebreak");
|
862 |
$content = substr($content, 0, $split) . $midtext . substr($content, $split);
|
863 |
}
|
864 |
}
|
@@ -870,14 +852,7 @@ if (!class_exists("EzAdSense")) {
|
|
870 |
if ($this->ezCount < $this->ezMax) {
|
871 |
$this->ezCount++;
|
872 |
$adsServed++;
|
873 |
-
$
|
874 |
-
if ($this->options['kill_inline']) {
|
875 |
-
$inline = '';
|
876 |
-
}
|
877 |
-
else {
|
878 |
-
$inline = 'style="' . $show_leadout . ';margin:' . $margin . 'px;' . $border . '"';
|
879 |
-
}
|
880 |
-
if (strpos($inline, "float") !== false) {
|
881 |
$paras = $this->findParas($content);
|
882 |
$split = array_pop($paras);
|
883 |
if (!empty($split)) {
|
@@ -885,12 +860,7 @@ if (!class_exists("EzAdSense")) {
|
|
885 |
$content2 = substr($content, $split);
|
886 |
}
|
887 |
}
|
888 |
-
$leadout =
|
889 |
-
"$linebreak<!-- Post[count: " . $this->ezCount . "] -->$linebreak" .
|
890 |
-
'<div class="ezAdsense adsense adsense-leadout" ' . $inline . '>' .
|
891 |
-
$this->options['text_leadout'] .
|
892 |
-
($this->urCount++ < $this->urMax ? $unreal : '') .
|
893 |
-
"</div>$linebreak" . $this->options['info'] . "$linebreak");
|
894 |
}
|
895 |
}
|
896 |
if ($this->options['header_leadin']) {
|
@@ -914,49 +884,40 @@ if (!class_exists("EzAdSense")) {
|
|
914 |
self::showUnreal(true);
|
915 |
}
|
916 |
|
917 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
// if it is an admin page, don't show ads
|
919 |
if (is_admin()) {
|
920 |
-
return;
|
921 |
}
|
922 |
-
// is_feed() is not ready, because the WP query
|
923 |
if (strpos($_SERVER['REQUEST_URI'], 'feed') !== false) {
|
924 |
-
return;
|
|
|
|
|
|
|
925 |
}
|
926 |
-
$border = $this->mkBorder();
|
927 |
$show_leadin = $this->options['show_leadin'];
|
928 |
if ($show_leadin != 'no') {
|
929 |
-
$
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
else {
|
934 |
-
$inline = 'style="' . $show_leadin . ';margin:' .
|
935 |
-
$margin . 'px;' . $border . '"';
|
936 |
-
}
|
937 |
-
$this->ezCount++;
|
938 |
-
$unreal = self::showUnreal();
|
939 |
-
if ($this->options['kill_linebreaks']) {
|
940 |
-
$linebreak = "";
|
941 |
-
}
|
942 |
-
else {
|
943 |
-
$linebreak = "\n";
|
944 |
-
}
|
945 |
-
$this->leadin = stripslashes($this->options['info'] .
|
946 |
-
"$linebreak<!-- Post[count: " . $this->ezCount . "] -->$linebreak" .
|
947 |
-
'<div class="ezAdsense adsense adsense-leadin" ' . $inline . '>' .
|
948 |
-
$this->options['text_leadin'] .
|
949 |
-
($this->urCount++ < $this->urMax ? $unreal : '') .
|
950 |
-
"</div>$linebreak" . $this->options['info'] . "$linebreak");
|
951 |
-
echo $this->leadin;
|
952 |
}
|
953 |
}
|
954 |
|
955 |
-
function footer_leadout() {
|
956 |
if (is_admin()) {
|
957 |
-
return;
|
958 |
}
|
959 |
echo $this->leadout;
|
|
|
960 |
}
|
961 |
|
962 |
}
|
@@ -991,6 +952,9 @@ if (class_exists("EzAdSense")) {
|
|
991 |
function widget($args, $instance) {
|
992 |
// outputs the content of the widget
|
993 |
global $ezAdSense;
|
|
|
|
|
|
|
994 |
extract($args);
|
995 |
$ezAdSense->options['text_widget'] = $ezAdSense->handleDefaultText($ezAdSense->options['text_widget'], '160x600');
|
996 |
$metaOptions = $ezAdSense->getMetaOptions();
|
@@ -1009,36 +973,15 @@ if (class_exists("EzAdSense")) {
|
|
1009 |
}
|
1010 |
$ezAdSense->ezCount++;
|
1011 |
}
|
1012 |
-
$unreal = EzAdSense::showUnreal();
|
1013 |
-
if ($ezAdSense->options['kill_linebreaks']) {
|
1014 |
-
$linebreak = "";
|
1015 |
-
}
|
1016 |
-
else {
|
1017 |
-
$linebreak = "\n";
|
1018 |
-
}
|
1019 |
|
1020 |
$title = empty($ezAdSense->options['title_widget']) ?
|
1021 |
__('Sponsored Links', 'easy-adsenser') :
|
1022 |
stripslashes(htmlspecialchars($ezAdSense->options['title_widget']));
|
1023 |
-
$border = $ezAdSense->mkBorder();
|
1024 |
echo $before_widget;
|
1025 |
if (!$ezAdSense->options['kill_widget_title']) {
|
1026 |
echo $before_title . $title . $after_title;
|
1027 |
}
|
1028 |
-
|
1029 |
-
if ($ezAdSense->options['kill_inline']) {
|
1030 |
-
$inline = '';
|
1031 |
-
}
|
1032 |
-
else {
|
1033 |
-
$inline = 'style="' . $show_widget . ';margin:' .
|
1034 |
-
$margin . 'px;' . $border . '"';
|
1035 |
-
}
|
1036 |
-
echo stripslashes($ezAdSense->options['info'] .
|
1037 |
-
"$linebreak<!-- Widg[count: " . $ezAdSense->ezCount . "] -->$linebreak" .
|
1038 |
-
'<div class="ezAdsense adsense adsense-widget"><div ' . $inline . '>' .
|
1039 |
-
$ezAdSense->options['text_widget']) .
|
1040 |
-
($ezAdSense->urCount++ < $ezAdSense->urMax ? $unreal : '') .
|
1041 |
-
"</div></div>$linebreak" . $ezAdSense->options['info'] . "$linebreak";
|
1042 |
echo $after_widget;
|
1043 |
}
|
1044 |
|
@@ -1147,6 +1090,9 @@ if (class_exists("EzAdSense")) {
|
|
1147 |
function widget($args, $instance) {
|
1148 |
// outputs the content of the widget
|
1149 |
global $ezAdSense;
|
|
|
|
|
|
|
1150 |
extract($args);
|
1151 |
$ezAdSense->options['text_lu'] = $ezAdSense->handleDefaultText($ezAdSense->options['text_lu'], '160x160');
|
1152 |
$title = empty($ezAdSense->options['title_lu']) ? '' :
|
@@ -1158,30 +1104,12 @@ if (class_exists("EzAdSense")) {
|
|
1158 |
return;
|
1159 |
}
|
1160 |
$show_lu = $metaOptions['show_lu'];
|
1161 |
-
$border = $ezAdSense->mkBorder();
|
1162 |
if ($show_lu != 'no') {
|
1163 |
-
if ($ezAdSense->options['kill_linebreaks']) {
|
1164 |
-
$linebreak = "";
|
1165 |
-
}
|
1166 |
-
else {
|
1167 |
-
$linebreak = "\n";
|
1168 |
-
}
|
1169 |
echo $before_widget;
|
1170 |
if (!$ezAdSense->options['kill_widget_title']) {
|
1171 |
echo $title;
|
1172 |
}
|
1173 |
-
|
1174 |
-
if ($ezAdSense->options['kill_inline']) {
|
1175 |
-
$inline = '';
|
1176 |
-
}
|
1177 |
-
else {
|
1178 |
-
$inline = 'style="' . $show_lu . ';margin:' .
|
1179 |
-
$margin . 'px;' . $border . '"';
|
1180 |
-
}
|
1181 |
-
echo stripslashes('<div class="ezAdsense adsense adsense-lu"><div ' .
|
1182 |
-
$inline . '>' . "$linebreak" .
|
1183 |
-
$ezAdSense->options['text_lu'] . "$linebreak" .
|
1184 |
-
'</div></div>');
|
1185 |
echo $after_widget;
|
1186 |
}
|
1187 |
}
|
@@ -1202,10 +1130,10 @@ if (class_exists("EzAdSense")) {
|
|
1202 |
}
|
1203 |
|
1204 |
add_action('widgets_init', create_function('', 'return register_widget("EzAdsLU");'));
|
1205 |
-
add_filter('the_content', array($ezAdSense, 'filterContent'));
|
1206 |
add_action('admin_menu', 'ezAdSense_ap');
|
1207 |
-
add_action('init', array($ezAdSense, 'session_start'));
|
1208 |
add_filter('plugin_action_links', array($ezAdSense, 'plugin_action'), -10, 2);
|
|
|
|
|
1209 |
if ($ezAdSense->options['max_link'] === -1) {
|
1210 |
add_action('wp_footer', array($ezAdSense, 'footer_action', 1));
|
1211 |
}
|
4 |
Plugin Name: Easy AdSense
|
5 |
Plugin URI: http://www.thulasidas.com/adsense
|
6 |
Description: Easiest way to show AdSense and make money from your blog. Configure it at <a href="options-general.php?page=easy-adsense-lite.php">Settings → Easy AdSense</a>.
|
7 |
+
Version: 7.10
|
8 |
Author: Manoj Thulasidas
|
9 |
Author URI: http://www.thulasidas.com
|
10 |
*/
|
40 |
var $invite, $locale, $defaults, $helpTags,
|
41 |
$leadin, $leadout, $options, $optionName, $metaOptions;
|
42 |
var $ezMax, $urMax, $urCount, $ezCount;
|
43 |
+
var $adminMsg, $border;
|
44 |
var $kills = array('page', 'sticky', 'home', 'front_page', 'category',
|
45 |
'tag', 'archive', 'search', 'single', 'attachment');
|
46 |
var $ezOptions = array();
|
64 |
$this->urCount = 0;
|
65 |
$this->ezCount = 0;
|
66 |
$this->metaOptions = array();
|
67 |
+
$this->border = '';
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
static function showUnreal($print = false) {
|
193 |
$o->desc = __('Position:', 'easy-adsenser');
|
194 |
$o->style = "width:30%;";
|
195 |
$o->addChoice('send_headers', 'send_headers', __('Above Header', 'easy-adsenser'));
|
196 |
+
$o->addChoice('loop_start', 'loop_start', __('Above Post Title', 'easy-adsenser'));
|
197 |
$o->addChoice('the_content', 'the_content', __('Below Header', 'easy-adsenser'));
|
198 |
$o->addChoice('default', '', __('Beginning of Post', 'easy-adsenser'));
|
199 |
$this->ezOptions['header_leadin'] = clone $o;
|
673 |
}
|
674 |
|
675 |
function getMetaOptions() {
|
676 |
+
if (empty($this->metaOptions)) {
|
677 |
+
global $post;
|
678 |
+
$lookup = array('adsense' => 'adsense',
|
679 |
+
'adsense-top' => 'show_leadin',
|
680 |
+
'adsense-middle' => 'show_midtext',
|
681 |
+
'adsense-bottom' => 'show_leadout',
|
682 |
+
'adsense-widget' => 'show_widget',
|
683 |
+
'adsense-search' => 'title_gsearch',
|
684 |
+
'adsense-linkunits' => 'show_lu');
|
685 |
+
$metaOptions = array();
|
686 |
+
foreach ($lookup as $metaKey => $optKey) {
|
687 |
+
if (!empty($this->options[$optKey])) {
|
688 |
+
$metaOptions[$optKey] = $this->options[$optKey];
|
689 |
+
}
|
690 |
+
else {
|
691 |
+
$metaOptions[$optKey] = '';
|
692 |
+
}
|
693 |
+
$customStyle = get_post_custom_values($metaKey, $post->ID, true);
|
694 |
+
if (is_array($customStyle)) {
|
695 |
+
$metaStyle = strtolower($customStyle[0]);
|
696 |
+
}
|
697 |
+
else {
|
698 |
+
$metaStyle = strtolower($customStyle);
|
699 |
+
}
|
700 |
+
$style = '';
|
701 |
+
if ($metaStyle == 'left') {
|
702 |
+
$style = 'float:left;display:block;';
|
703 |
+
}
|
704 |
+
else if ($metaStyle == 'right') {
|
705 |
+
$style = 'float:right;display:block;';
|
706 |
+
}
|
707 |
+
else if ($metaStyle == 'center') {
|
708 |
+
$style = 'text-align:center;display:block;';
|
709 |
+
}
|
710 |
+
else {
|
711 |
+
$style = $metaStyle;
|
712 |
+
}
|
713 |
+
if (!empty($style)) {
|
714 |
+
$metaOptions[$optKey] = $style;
|
715 |
+
}
|
|
|
716 |
}
|
717 |
+
$this->metaOptions = $metaOptions;
|
718 |
}
|
719 |
+
return $this->metaOptions;
|
720 |
}
|
721 |
|
722 |
function findParas($content) {
|
736 |
}
|
737 |
|
738 |
function mkBorder() {
|
739 |
+
if ($this->options['show_borders'] && empty($this->border)) {
|
740 |
+
$this->border = 'border:#' . $this->options['border_normal'] .
|
|
|
741 |
' solid ' . $this->options['border_width'] . 'px;" ' .
|
742 |
' onmouseover="this.style.border=\'#' . $this->options['border_color'] .
|
743 |
' solid ' . $this->options['border_width'] . 'px\'" ' .
|
744 |
'onmouseout="this.style.border=\'#' . $this->options['border_normal'] .
|
745 |
+
' solid ' . $this->options['border_width'] . 'px\'';
|
746 |
}
|
747 |
+
return $this->border;
|
748 |
}
|
749 |
|
750 |
+
function mkAdBlock($slot) {
|
751 |
+
$border = $this->mkBorder();
|
752 |
+
$show = $this->metaOptions["show_$slot"];
|
753 |
+
$margin = $this->options["margin_$slot"];
|
754 |
+
if ($this->options['kill_linebreaks']) {
|
755 |
+
$linebreak = "";
|
756 |
+
}
|
757 |
+
else {
|
758 |
+
$linebreak = "\n";
|
759 |
+
}
|
760 |
+
if ($this->options['kill_inline']) {
|
761 |
+
$inline = '';
|
762 |
+
}
|
763 |
+
else {
|
764 |
+
$inline = 'style="' . $show . ';margin:' .
|
765 |
+
$margin . 'px;' . $border . '"';
|
766 |
+
}
|
767 |
+
$unreal = self::showUnreal();
|
768 |
+
$adBlock = stripslashes($linebreak . $this->info() .
|
769 |
+
"<!-- [$slot: {$this->ezCount }] -->$linebreak" .
|
770 |
+
'<div class="ezAdsense adsense adsense-' . $slot . '" ' . $inline . '>' .
|
771 |
+
$this->options["text_$slot"] .
|
772 |
+
($this->urCount++ < $this->urMax ? $unreal : '') .
|
773 |
+
"</div>$linebreak" . $this->options['info'] . "$linebreak");
|
774 |
+
return $adBlock;
|
775 |
+
}
|
776 |
+
|
777 |
+
function isKilled() {
|
778 |
+
$killed = false;
|
779 |
foreach ($this->kills as $k) {
|
780 |
$fn = "is_$k";
|
781 |
if ($this->options["kill_$k"] && $fn()) {
|
782 |
+
$killed = true;
|
783 |
}
|
784 |
}
|
785 |
+
return $killed;
|
786 |
+
}
|
787 |
+
|
788 |
+
function filterContent($content) {
|
789 |
+
if ($this->isKilled()) {
|
790 |
+
return $content;
|
791 |
+
}
|
792 |
$this->ezMax = $this->options['max_count'];
|
793 |
$adsServed = 0;
|
794 |
if ($this->options['force_widget']) {
|
807 |
return $content;
|
808 |
}
|
809 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
810 |
if (!in_the_loop()) {
|
811 |
return $content;
|
812 |
}
|
813 |
$this->handleDefaults();
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
$wc = str_word_count($content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
816 |
|
817 |
$show_leadin = $metaOptions['show_leadin'];
|
818 |
$leadin = '';
|
820 |
if ($this->ezCount < $this->ezMax) {
|
821 |
$adsServed++;
|
822 |
$this->ezCount++;
|
823 |
+
$leadin = $this->mkAdBlock("leadin");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
}
|
825 |
}
|
826 |
|
840 |
if ($this->options['force_midad'] || $half > 10) {
|
841 |
$this->ezCount++;
|
842 |
$adsServed++;
|
843 |
+
$midtext = $this->mkAdBlock("midtext");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
$content = substr($content, 0, $split) . $midtext . substr($content, $split);
|
845 |
}
|
846 |
}
|
852 |
if ($this->ezCount < $this->ezMax) {
|
853 |
$this->ezCount++;
|
854 |
$adsServed++;
|
855 |
+
if (strpos($show_leadout, "float") !== false) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
$paras = $this->findParas($content);
|
857 |
$split = array_pop($paras);
|
858 |
if (!empty($split)) {
|
860 |
$content2 = substr($content, $split);
|
861 |
}
|
862 |
}
|
863 |
+
$leadout = $this->mkAdBlock("leadout");
|
|
|
|
|
|
|
|
|
|
|
864 |
}
|
865 |
}
|
866 |
if ($this->options['header_leadin']) {
|
884 |
self::showUnreal(true);
|
885 |
}
|
886 |
|
887 |
+
// This is add_action target to either the_content, loop_start or send_headers.
|
888 |
+
function header_leadin($arg) {
|
889 |
+
if (is_object($arg)) {
|
890 |
+
$content = '';
|
891 |
+
}
|
892 |
+
else {
|
893 |
+
$content = $arg;
|
894 |
+
}
|
895 |
// if it is an admin page, don't show ads
|
896 |
if (is_admin()) {
|
897 |
+
return $arg;
|
898 |
}
|
899 |
+
// is_feed() is not ready, because the WP query may not be run yet.
|
900 |
if (strpos($_SERVER['REQUEST_URI'], 'feed') !== false) {
|
901 |
+
return $arg;
|
902 |
+
}
|
903 |
+
if ($this->isKilled()) {
|
904 |
+
return $arg;
|
905 |
}
|
|
|
906 |
$show_leadin = $this->options['show_leadin'];
|
907 |
if ($show_leadin != 'no') {
|
908 |
+
$this->metaOptions['show_leadin'] = '';
|
909 |
+
echo $this->mkAdBlock("leadin");
|
910 |
+
unset($this->metaOptions);
|
911 |
+
return $arg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
912 |
}
|
913 |
}
|
914 |
|
915 |
+
function footer_leadout($arg) {
|
916 |
if (is_admin()) {
|
917 |
+
return $arg;
|
918 |
}
|
919 |
echo $this->leadout;
|
920 |
+
return $arg;
|
921 |
}
|
922 |
|
923 |
}
|
952 |
function widget($args, $instance) {
|
953 |
// outputs the content of the widget
|
954 |
global $ezAdSense;
|
955 |
+
if ($ezAdSense->isKilled()) {
|
956 |
+
return;
|
957 |
+
}
|
958 |
extract($args);
|
959 |
$ezAdSense->options['text_widget'] = $ezAdSense->handleDefaultText($ezAdSense->options['text_widget'], '160x600');
|
960 |
$metaOptions = $ezAdSense->getMetaOptions();
|
973 |
}
|
974 |
$ezAdSense->ezCount++;
|
975 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
976 |
|
977 |
$title = empty($ezAdSense->options['title_widget']) ?
|
978 |
__('Sponsored Links', 'easy-adsenser') :
|
979 |
stripslashes(htmlspecialchars($ezAdSense->options['title_widget']));
|
|
|
980 |
echo $before_widget;
|
981 |
if (!$ezAdSense->options['kill_widget_title']) {
|
982 |
echo $before_title . $title . $after_title;
|
983 |
}
|
984 |
+
echo $ezAdSense->mkAdBlock("widget");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
985 |
echo $after_widget;
|
986 |
}
|
987 |
|
1090 |
function widget($args, $instance) {
|
1091 |
// outputs the content of the widget
|
1092 |
global $ezAdSense;
|
1093 |
+
if ($ezAdSense->isKilled()) {
|
1094 |
+
return;
|
1095 |
+
}
|
1096 |
extract($args);
|
1097 |
$ezAdSense->options['text_lu'] = $ezAdSense->handleDefaultText($ezAdSense->options['text_lu'], '160x160');
|
1098 |
$title = empty($ezAdSense->options['title_lu']) ? '' :
|
1104 |
return;
|
1105 |
}
|
1106 |
$show_lu = $metaOptions['show_lu'];
|
|
|
1107 |
if ($show_lu != 'no') {
|
|
|
|
|
|
|
|
|
|
|
|
|
1108 |
echo $before_widget;
|
1109 |
if (!$ezAdSense->options['kill_widget_title']) {
|
1110 |
echo $title;
|
1111 |
}
|
1112 |
+
echo $ezAdSense->mkAdBlock("lu");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1113 |
echo $after_widget;
|
1114 |
}
|
1115 |
}
|
1130 |
}
|
1131 |
|
1132 |
add_action('widgets_init', create_function('', 'return register_widget("EzAdsLU");'));
|
|
|
1133 |
add_action('admin_menu', 'ezAdSense_ap');
|
|
|
1134 |
add_filter('plugin_action_links', array($ezAdSense, 'plugin_action'), -10, 2);
|
1135 |
+
|
1136 |
+
add_filter('the_content', array($ezAdSense, 'filterContent'));
|
1137 |
if ($ezAdSense->options['max_link'] === -1) {
|
1138 |
add_action('wp_footer', array($ezAdSense, 'footer_action', 1));
|
1139 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://buy.thulasidas.com/easy-adsense
|
|
4 |
Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 7.
|
8 |
License: GPL2 or later
|
9 |
|
10 |
Easy AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!
|
@@ -42,7 +42,7 @@ Easy AdSense is the freely distributed version of a premium plugin. The [Pro ver
|
|
42 |
|
43 |
== Upgrade Notice ==
|
44 |
|
45 |
-
|
46 |
|
47 |
== Screenshots ==
|
48 |
|
@@ -140,6 +140,7 @@ A big "Thank You" to all my translators. Easy AdSense V2.6+ sports an *Easy Tran
|
|
140 |
|
141 |
== Change Log ==
|
142 |
|
|
|
143 |
* V7.02: Fixing a bug related to showing borders around ad blocks. [Apr 1, 2014]
|
144 |
* V7.01: Changes to show ads on home/front pages made up of full posts. Translation interface improvements. [Mar 29, 2014]
|
145 |
* V7.00: Major changes to the options data model and the translation interface. [Mar 21, 2014]
|
4 |
Tags: adsense, google adsense, ads, advertising, easy adsense, google, adsense plugin
|
5 |
Requires at least: 2.6
|
6 |
Tested up to: 3.8
|
7 |
+
Stable tag: 7.10
|
8 |
License: GPL2 or later
|
9 |
|
10 |
Easy AdSense manages all aspects of AdSense: insert ads into posts and sidebar, and add a Google Search box. Easiest and most complete AdSense Plugin!
|
42 |
|
43 |
== Upgrade Notice ==
|
44 |
|
45 |
+
Coding improvements.
|
46 |
|
47 |
== Screenshots ==
|
48 |
|
140 |
|
141 |
== Change Log ==
|
142 |
|
143 |
+
* V7.10: Coding improvements. [Apr 2, 2014]
|
144 |
* V7.02: Fixing a bug related to showing borders around ad blocks. [Apr 1, 2014]
|
145 |
* V7.01: Changes to show ads on home/front pages made up of full posts. Translation interface improvements. [Mar 29, 2014]
|
146 |
* V7.00: Major changes to the options data model and the translation interface. [Mar 21, 2014]
|