Re: Paypal Donate Plugin [message #186554 is a reply to message #186546] |
Sat, 27 September 2014 22:26 |
Kermit
Messages: 35 Registered: November 2004
Karma:
|
Member |
|
|
Ok, thanks, here's the code then
Paypal_donate.plugin and locate in \plugins\donate\
<?php
/**
* copyright : (C) 2001-2013 Advanced Internet Designs Inc.
* email : forum(at)prohost(dot)org
* $Id: paypal_donate.plugin 25-09-2014 KermitX Honda-forums.com $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
**/
// Initialize plugin.
plugin_add_hook('COMPILER_EXPAND_TEMPLATE', 'plugin_paypal_donate');
function plugin_paypal_donate($array) {
list($tmpl, $tag, $sec, $name, $file) = $array;
if ((@include $GLOBALS['PLUGIN_PATH'] .'donate/paypal_donate.ini') === false) {
die('ERROR: Please configure the paypal_donate plugin from the Plugin Manager Control panel.');
}
if ($name == 'usercp' && $ini['PAYPAL_DONATE_POS'] == 0) {
$tmpl = $tmpl . $ini['PAYPAL_DONATE_CODE'];
} else if ($name == 'header' && $ini['PAYPAL_DONATE_POS'] == 1) {
$tmpl = $ini['PAYPAL_DONATE_CODE'] . $tmpl;
} else if ($name == 'header' && $ini['PAYPAL_DONATE_POS'] == 2) {
$tmpl = $tmpl . $ini['PAYPAL_DONATE_CODE'];
} else if ($name == 'curtime' && $ini['PAYPAL_DONATE_POS'] == 3) {
$tmpl = $ini['PAYPAL_DONATE_CODE'] . $tmpl;
} else if ($name == 'curtime' && $ini['PAYPAL_DONATE_POS'] == 4) {
$tmpl = $tmpl . $ini['PAYPAL_DONATE_CODE'];
} else if ($name == 'footer' && $ini['PAYPAL_DONATE_POS'] == 5) {
$tmpl = $ini['PAYPAL_DONATE_CODE'] . $tmpl;
} else if ($name == 'footer' && $ini['PAYPAL_DONATE_POS'] == 6) {
$tmpl = $tmpl . $ini['PAYPAL_DONATE_CODE'];
}
return array($tmpl, $tag, $sec, $name, $file);
}
function paypal_donate_info() {
return array('name' => 'Paypal Donate',
'desc' => 'Display Donate button on your forum\'s web pages.',
'cat' => 'Third-party Integration',
'version' => '1.0');
}
function paypal_donate_enable() {
if ((@include_once $GLOBALS['PLUGIN_PATH'] .'donate/paypal_donate.ini') === false) {
return array(null, 'Please configure the paypal_donate plugin before enabling it.'); // OK, Err.
}
@define('REBUILD_THEMES', 1);
}
function paypal_donate_disable() {
@define('REBUILD_THEMES', 1);
}
function paypal_donate_config() {
if ((@include $GLOBALS['PLUGIN_PATH'] .'donate/paypal_donate.ini') === false) {
$ini = NULL;
}
if (isset($_POST['Set'])) {
foreach (array_keys($_POST) as $key) {
if (substr($key,0,14) == 'PAYPAL_DONATE_') {
$ini[$key] = trim($_POST[$key]);
}
}
$fp = fopen($GLOBALS['PLUGIN_PATH'] .'donate/paypal_donate.ini', 'w');
fwrite($fp, '<?php $ini = '. var_export($ini, 1) .'; ?>');
fclose($fp);
pf(successify('Settings successfully saved.'));
compile_themes();
}
?>
<p>Where should it be displayed:<br />
<select name="PAYPAL_DONATE_POS">
<option value="0" <?php if($ini['PAYPAL_DONATE_POS']==0) echo 'selected="selected"'; ?>>After top level menu.</option>
<option value="1" <?php if($ini['PAYPAL_DONATE_POS']==1) echo 'selected="selected"'; ?>>Before page header.</option>
<option value="2" <?php if($ini['PAYPAL_DONATE_POS']==2) echo 'selected="selected"'; ?>>After page header.</option>
<option value="3" <?php if($ini['PAYPAL_DONATE_POS']==3) echo 'selected="selected"'; ?>>Before current time.</option>
<option value="4" <?php if($ini['PAYPAL_DONATE_POS']==4) echo 'selected="selected"'; ?>>After current time.</option>
<option value="5" <?php if($ini['PAYPAL_DONATE_POS']==5) echo 'selected="selected"'; ?>>Before page footer.</option>
<option value="6" <?php if($ini['PAYPAL_DONATE_POS']==6) echo 'selected="selected"'; ?>>After page footer.</option>
</select>
</p>
<p>Your Paypal Donate code (get it from <a href="https://www.paypal.com/">paypal.com</a>):<br />
<textarea name="PAYPAL_DONATE_CODE" cols="72" rows="10"><?php echo $ini['PAYPAL_DONATE_CODE'] ?></textarea>
<font size="-1">Tip: you can add additional HTML as well. For example, use the CENTRE tag to center your donate button.</font>
</p>
<?php
}
?>
|
|
|