summaryrefslogtreecommitdiff
path: root/plugins/data.adsense.php
blob: 8f865c0646621e9949c1dd1dec6477982c673754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
 * @version  $Revision: 1.4 $
 * @package  liberty
 * @subpackage plugins_data
 */
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author:  xing
// +----------------------------------------------------------------------+
// $Id: data.adsense.php,v 1.4 2006/08/08 07:31:15 squareing Exp $

/**
 * definitions
 */

/******************
* Initialization *
******************/
global $gLibertySystem;
define( 'PLUGIN_GUID_DATAADSENSE', 'dataadsense' );
$pluginParams = array (
	'tag' => 'ADSENSE',
	'auto_activate' => FALSE,
	'requires_pair' => FALSE,
	'load_function' => 'data_adsense',
	'title' => 'Adsense',
	'help_page' => 'DataPluginAdsense',
	'description' => tra("This plugin adds Adsense Code to page."),
	'help_function' => 'data_adsense_help',
	'syntax' => "{ADSENSE}",
	'path' => LIBERTY_PKG_PATH.'plugins/data.adsense.php',
	'security' => 'registered',
	'plugin_type' => DATA_PLUGIN
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADSENSE, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADSENSE );

/*****************
* Help Function *
*****************/
function data_adsense_help() {
	return 'NO HELP WRITTEN FOR {ADSENSE} YET. You can set: client, width, height, format, type and channel.';
}

/****************
* Load Function *
****************/
function data_adsense( $pData, $pParams ) {
	extract( $pParams );
	$width   = ( !empty( $width )   ? $width   : "728" );
	$height  = ( !empty( $height )  ? $height  : "90" );
	$client  = ( !empty( $client )  ? $client  : "pub-xxxxxxxxxxxxxxxx" );
	$format  = ( !empty( $format )  ? $format  : "728x90_as" );
	$type    = ( !empty( $type )    ? $type    : "text_image" );
	$channel = ( !empty( $channel ) ? $channel : "" );

	return "<!--~np~--><script type=\"text/javascript\">/* <![CDATA[ */
		google_ad_width   = $width;
		google_ad_height  = $height;
		google_ad_client  = \"$client\";
		google_ad_format  = \"$format\";
		google_ad_type    = \"$type\";
		google_ad_channel = \"$channel\";
	/* ]]> */</script>
	<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script><!--~/np~-->";
}
?>