1 | <?php |
---|
2 | /***************************************************************\ |
---|
3 | * This is 'Not Evil Ads', a plugin for Dotclear 2 * |
---|
4 | * * |
---|
5 | * Copyright (c) 2007 * |
---|
6 | * Oleksandr Syenchuk and contributors. * |
---|
7 | * * |
---|
8 | * This is an open source software, distributed under the GNU * |
---|
9 | * General Public License (version 2) terms and conditions. * |
---|
10 | * * |
---|
11 | * You should have received a copy of the GNU General Public * |
---|
12 | * License along 'Not evil ads' (see COPYING.txt); * |
---|
13 | * if not, write to the Free Software Foundation, Inc., * |
---|
14 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
15 | \***************************************************************/ |
---|
16 | if (!defined('DC_RC_PATH')) { return; } |
---|
17 | |
---|
18 | include_once dirname(__FILE__).'/lib/class.notevilads.php'; |
---|
19 | |
---|
20 | $core->addBehavior('initWidgets',array('notEvilAdsBehaviors','addAd')); |
---|
21 | $core->addBehavior('initWidgets',array('notEvilAdsBehaviors','addTrigger')); |
---|
22 | |
---|
23 | class notEvilAdsBehaviors |
---|
24 | { |
---|
25 | public static function addAd(&$w) |
---|
26 | { |
---|
27 | global $core; |
---|
28 | |
---|
29 | $nea_ads = notEvilAds::loadAds($core->blog->settings->get('nea_ads')); |
---|
30 | if (!$nea_ads) |
---|
31 | return; |
---|
32 | |
---|
33 | $options = array(); |
---|
34 | foreach ($nea_ads as $k=>$v) |
---|
35 | { |
---|
36 | $options[$k] = $v['identifier']; |
---|
37 | } |
---|
38 | |
---|
39 | $w->create('notEvilAds',__('Not Evil Ads'), |
---|
40 | array('publicNotEvilAds','showAdsInWidgets')); |
---|
41 | $w->notEvilAds->setting('identifier',__('Select the ad to show:'), |
---|
42 | null,'combo',$options); |
---|
43 | } |
---|
44 | |
---|
45 | public static function addTrigger(&$w) |
---|
46 | { |
---|
47 | $w->create('notEvilAdsTrigger',__('Not Evil Ads hide button'), |
---|
48 | array('publicNotEvilAds','triggerAdsInWidgets')); |
---|
49 | |
---|
50 | $w->notEvilAdsTrigger->setting('hValue',__('Hide button value:'), |
---|
51 | __('Hide ads'),'text'); |
---|
52 | $w->notEvilAdsTrigger->setting('sValue',__('Show button value:'), |
---|
53 | __('Show me ads'),'text'); |
---|
54 | $w->notEvilAdsTrigger->setting('attr',__('Extra DIV attributes:'), |
---|
55 | 'style="text-align:center;"','text'); |
---|
56 | } |
---|
57 | } |
---|
58 | ?> |
---|