-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiBlock.php
193 lines (143 loc) · 4.77 KB
/
multiBlock.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
# get correct id for plugin
$thisfile = basename(__FILE__, ".php");
$plugin_id = 'multiBlock';
i18n_merge($plugin_id) || i18n_merge($plugin_id, 'en_US');
# register plugin
register_plugin(
$thisfile, //Plugin id
'MultiBlock 🧱', //Plugin name
'5.5', //Plugin version
'Multicolor', //Plugin author
'https://discord.gg/d5s83yk4R6', //author website
'Create category blocks from templates and custom fields. (Catalogue, product listing, services, team, food menu, etc.)', //Plugin description
'pages',
'multiblock' //main function (administration)
);
# add menu
add_action('pages-sidebar', 'createSideMenu', [$thisfile, i18n_r('multiBlock/MULTIBLOCK') . ' 🧱', 'newmultiblock']);
$turnOneBlock = glob(GSDATAOTHERPATH . 'oneBlock/*/*.json');
if (count($turnOneBlock) > 0) {
add_action('pages-sidebar', 'createSideMenu', [$thisfile, 'OneBlock 🧱', 'newoneblock']);
};
add_action('plugins-sidebar', 'createSideMenu', [$thisfile, i18n_r('multiBlock/MULTIBLOCKSETTINGS') . ' 🧱', 'category']);
# class for all function
include(GSPLUGINPATH . 'multiBlock/class/multiBlock.class.php');
$mb = new MultiBlock();
include(GSPLUGINPATH . 'multiBlock/class/oneBlock.class.php');
$ob = new OneBlock();
include(GSPLUGINPATH . 'multiBlock/class/frontMultiBlock.class.php');
$frontMb = new FrontMultiBlock();
include(GSPLUGINPATH . 'multiBlock/class/backBlock.class.php');
$bb = new BackBlock();
# paypal
$paypal = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" style=" box-sizing:border-box;display:grid; width:100%;grid-template-columns:1fr auto; padding:10px;background:#fafafa;border:solid 1px #ddd;margin-top:20px;">
<p style="margin:0;padding:0;"> ' . i18n_r('multiBlock/PAYPAL') . ' </p>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="KFZ9MCBUKB7GL">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" border="0">
<img alt="" src="https://www.paypal.com/en_PL/i/scr/pixel.gif" width="1" height="1" border="0">
</form>';
# functions
$counterShowHide;
function multiblock() {
global $paypal;
if (isset($_GET['category'])) {
include(GSPLUGINPATH . 'multiBlock/category.php');
echo $paypal;
echo '<form method="post" style="background:#fafafa;padding:10px;border:solid 1px #ddd;margin-top:10px;">
<input type="submit" value="' . i18n_r("multiBlock/CACHETHUMB") . '" class="cleanthumb" style="padding:5px 10px;border:none;background:red;color:#fff;" name="cleanthumb">
</form>';
};
if (isset($_GET['addnew'])) {
include(GSPLUGINPATH . 'multiBlock/multiform/addnew.php');
};
if (isset($_GET['addnewOneBlock'])) {
include(GSPLUGINPATH . 'multiBlock/oneform/addnewOneBlock.php');
};
if (isset($_GET['newmultiblock'])) {
include('multiBlock/multiform/newmultiblock.php');
echo $paypal;
};
//oneblock
if (isset($_GET['newoneblock'])) {
include('multiBlock/oneform/newoneblock.php');
echo $paypal;
};
if (isset($_GET['newblock'])) {
include(GSPLUGINPATH . 'multiBlock/multiform/newblock.php');
};
if (isset($_GET['newblock1'])) {
include(GSPLUGINPATH . 'multiBlock/oneform/newblock1.php');
};
if (isset($_GET['blockoptions'])) {
include(GSPLUGINPATH . 'multiBlock/blockOptions.php');
};
if (isset($_GET['migrator'])) {
include(GSPLUGINPATH . 'multiBlock/migrator.php');
};
include(GSPLUGINPATH.'multiBlock/createAutomaticSlug.php');
}
// function multiblock
function mbOrder() {
global $mb;
$mb->order();
};
function mbvaluetext($value) {
global $mb;
$mb->text($value);
};
function mbdate($value, $format = "d.m.Y") {
global $mb;
$mb->date($value, $format);
};
function mbshowhide($value) {
global $mb;
$mb->showhide($value);
};
function r_mbvaluetext($value) {
global $mb;
return $mb->r_text($value);
};
function mbvalue($value) {
global $mb;
$mb->value($value);
};
function r_mbvalue($value) {
global $mb;
return $mb->r_value($value);
};
function mbdropdown($value) {
global $mb;
$mb->mbdropdown($value);
};
function mbthumb($value, $width) {
global $mb;
$mb->thumb($value, $width);
}
// function multiBlock front
function getMultiBlock($category, $orderid = '') {
global $frontMb;
$frontMb->get($category, $orderid);
};
// OneBlock function front
function getOneBlock($category, $name, $input) {
global $ob;
$ob->get($category, $name, $input);
};
function getOneBlockWysywig($category, $name, $input) {
global $ob;
$ob->wysywig($category, $name, $input);
};
function getOneBlockThumb($category, $name, $input, $width) {
global $ob;
$ob->thumb($category, $name, $input, $width);
};
# function post
function mbCleanThumb() {
global $bb;
$bb->cleanThumb();
};
if (isset($_POST['cleanthumb'])) {
mbCleanThumb();
};