Patch for AdSense
Mini Chate <[email protected]> Sun, 06 Nov 2005 05:24:49 -0500
| Newsgroups | gmane.comp.horde.midas |
|---|---|
| Message-ID | <[email protected]> |
--nextPart2166775.m2iiCZiexC
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hello,
I don't know if anyone is interested in this patch, but I have added the
ability to show Google AdSense ads from Midas. I have found it usefull as
an alternative to using Google's channels.
Patch is attached to this message.
--nextPart2166775.m2iiCZiexC
Content-Type: text/x-diff; name="midas_adsense.patch"
Content-Disposition: attachment; filename="midas_adsense.patch"
Content-Transfer-Encoding: quoted-printable
Index: edit.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /repository/midas/edit.php,v
retrieving revision 1.30
diff -u -r1.30 edit.php
--- edit.php 20 Apr 2005 05:51:19 -0000 1.30
+++ edit.php 6 Nov 2005 09:18:53 -0000
@@ -75,6 +75,9 @@
case '1':
$form->addVariable(_("Text"), 'campaign_ad', 'longtext', true, false=
, null, array('4', '40'));
break;
+case '2':
+ $form->addVariable(_("Google"), 'campaign_ad', 'longtext', true, fal=
se, "In here, paste the lines of code from Google which begin with \"goog=
le_\". These lines control the type of ad, and its formatting on your pag=
e.", array('8', '40'));
+ break;
}
=20
if ($form->validate($vars)) {
Index: view.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /repository/midas/view.php,v
retrieving revision 1.15
diff -u -r1.15 view.php
--- view.php 20 Apr 2005 05:51:19 -0000 1.15
+++ view.php 6 Nov 2005 09:18:53 -0000
@@ -74,6 +74,10 @@
case '1':
$form->addVariable(_("Text"), 'campaign_ad', 'longtext', true, false=
, null, array('4', '40'));
break;
+
+case '2':
+ $form->addVariable(_("Google Code"), 'campaign_ad', 'longtext', true=
, false, null, array('8', '40'));
+ break;
}
=20
/* Output the page. */
Index: lib/Midas.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /repository/midas/lib/Midas.php,v
retrieving revision 1.37
diff -u -r1.37 Midas.php
--- lib/Midas.php 3 Jul 2005 02:57:26 -0000 1.37
+++ lib/Midas.php 6 Nov 2005 09:18:53 -0000
@@ -13,7 +13,7 @@
=20
function getAdTypes()
{
- $types =3D array('0' =3D> _("Image"), '1' =3D> _("Text"));
+ $types =3D array('0' =3D> _("Image"), '1' =3D> _("Text"), '2' =3D=
> _("Google Adsense"));
return $types;
}
=20
Index: lib/Display/js.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /repository/midas/lib/Display/js.php,v
retrieving revision 1.8
diff -u -r1.8 js.php
--- lib/Display/js.php 13 Oct 2005 05:40:15 -0000 1.8
+++ lib/Display/js.php 6 Nov 2005 09:18:53 -0000
@@ -36,13 +36,20 @@
if ($ad['campaign_type'] =3D=3D '1') {
/* Simple text ad. */
$html =3D $link . htmlspecialchars($ad['campaign_ad']) . '</=
a>';
- } else {
+ } else if ($ad['campaign_type'] =3D=3D '0') {
/* Image ad. */
$img =3D Horde::url($GLOBALS['registry']->get('webroot', 'ho=
rde') . '/services/images/view.php', true, -1);
$img =3D Util::addParameter($img, array('f' =3D> $ad['campai=
gn_ad'], 's' =3D> 'vfs', 'p' =3D> '.horde/midas', 'n' =3D> ''));
$img =3D Horde::img($img, '', '', '');
$html =3D $link . $img . '</a>';
- }
+ } else {
+ $html =3D $ad['campaign_ad'];
+ require_once 'HTTP/Request.php';
+ $http =3D &new HTTP_Request('http://pagead2.googlesyndication.com/p=
agead/show_ads.js');
+ $http->sendRequest();
+ $html .=3D $http->getResponseBody();
+ return($html);
+ }
=20
$html =3D str_replace("'", "\\'", $html);
=20
--nextPart2166775.m2iiCZiexC
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--
midas mailing list - Join the hunt: http://horde.org/bounties/#midas
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
--nextPart2166775.m2iiCZiexC--