-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzenPaypal.php
139 lines (114 loc) · 3.67 KB
/
zenPaypal.php
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
include(dirname(__FILE__).'/zenPaypal/class.ZenPayPal.php');
// here declarate new zenpaypal !
$zenpaypal = new ZenPayPal();
$zenpaypal_options = $zenpaypal->getOptions();
$zenpaypal_version = $zenpaypal->getPluginVersion();
/**
* zenPaypal -- PayPal ordering support
*
* Provides a PayPal ordering form for image print ordering.
*
* Price lists can also be passed as a parameter to the zenPaypal() function. See also
* zenPaypalPricelistFromString() for parsing a string into the pricelist array. This could be used,
* for instance, by storing a pricelist string in the 'customdata' field of your images and then parsing and
* passing it in the zenPaypal() call. This would give you individual pricing by image.
*
* @author Ebrahim Ezzy (Nimbuz) adapted as a plugin by Stephen Billard (sbillard)
* modified by Stephane HUC (hucste) <devs@stephane-huc.net>
*
* @package plugins
*
*/
$option_interface = 'zenPaypalOptions';
$plugin_author = gettext('Ebrahim Ezzy (Nimbuz), adapted as a plugin by Stephen Billard (sbillard), modified by Stephane HUC (hucste).');
$plugin_description = gettext('PayPal Integration');
$plugin_disable = (version_compare(PHP_VERSION, '5.0.0') != 1) ? gettext('PHP version 5 or greater is required.') : false;
$plugin_is_filter = 5|ADMIN_PLUGIN|THEME_PLUGIN;
if(!empty($zenpaypal_version)) $plugin_version = $zenpaypal_version;
$plugin_URL = 'http://zenphoto.dev.stephane-huc.net/pages/zenPaypal-Plugin';
zp_register_filter('admin_head','ZenPayPal');
zp_register_filter('theme_head','printCSS');
zp_register_filter('theme_head','printJS');
/**
* Plugin option handling class
*
*/
class zenPaypalOptions {
function zenPaypalOptions() {
global $zenpaypal_options;
foreach($zenpaypal_options['key'] as $value) {
setOptionDefault('zenPaypal_'.$value, $zenpaypal_options['default'][$value]);
}
unset($value);
}
function getOptionsSupported() {
global $zenpaypal_options;
$options = array();
foreach($zenpaypal_options['key'] as $key => $value) {
$title = gettext($zenpaypal_options['title'][$value]);
$type = $zenpaypal_options['type'][$value];
switch($type) {
case 'checkbox': $option_type = OPTION_TYPE_CHECKBOX; break;
case 'cleartext': $option_type = OPTION_TYPE_CLEARTEXT; break;
case 'selector':
$option_type = OPTION_TYPE_SELECTOR;
$selections = array();
foreach($zenpaypal_options['selections'][$value]['code'] as $key1 => $value1) {
$title1 = gettext($zenpaypal_options['selections'][$value]['text'][$key1]);
$selections[$title1] = $value1;
}
unset($title1, $key1, $value1);
break;
case 'textarea':
$option_type = OPTION_TYPE_TEXTAREA;
$options[$title]['multilingual'] = 0;
break;
case 'textbox':
$option_type = OPTION_TYPE_TEXTBOX;
$options[$title]['multilingual'] = 0;
break;
}
$options[$title]['desc'] = gettext($zenpaypal_options['desc'][$value]);
$options[$title]['key'] = 'zenPaypal_'.$value;
$options[$title]['type'] = $option_type;
if(!empty($selections)) {
$options[$title]['selections'] = $selections;
}
}
unset($key, $value);
return $options;
}
function handleOption($option, $currentValue) { }
}
/**
* Place code CSS
*/
function printCSS() {
global $zenpaypal;
$zenpaypal->printLinkCSS();
}
/**
* Place code JavaScript
*/
function printJS() {
global $zenpaypal;
$zenpaypal->printJS();
}
/**
* Place a PayPal's button, in the script image...
*/
function zenPaypal() {
global $zenpaypal;
$zenpaypal->printPayPalButton();
}
/***
*
* Print a PayPal's Logo !
*
***/
function printZenPayPalLogo() {
global $zenpaypal;
$zenpaypal->printPayPalLogo();
}
?>