Version Description
Download this release
Release Info
Developer | nutsmuggler |
Plugin | Events Manager |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- dbem-it_IT.mo +0 -0
- dbem-it_IT.po +404 -0
- dbem_calendar.php +279 -0
- dbem_widgets.php +188 -0
- events-manager.php +1395 -0
- readme.txt +167 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
dbem-it_IT.mo
ADDED
Binary file
|
dbem-it_IT.po
ADDED
@@ -0,0 +1,404 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: events-manager\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2008-07-21 18:53+0100\n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: Davide Benini <cno@cnomania.it>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-Language: Italian\n"
|
13 |
+
"X-Poedit-Country: ITALY\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-Basepath: /Users/davidebenini/Sites/testblog/wp-content/plugins/events-manager/\n"
|
16 |
+
"X-Poedit-KeywordsList: _e;__\n"
|
17 |
+
"X-Poedit-SearchPath-0: .\n"
|
18 |
+
|
19 |
+
#: dbem_calendar.php:123
|
20 |
+
msgid "M_Monday_initial"
|
21 |
+
msgstr "L"
|
22 |
+
|
23 |
+
#: dbem_calendar.php:123
|
24 |
+
msgid "T_Tuesday_initial"
|
25 |
+
msgstr "M"
|
26 |
+
|
27 |
+
#: dbem_calendar.php:123
|
28 |
+
msgid "W_Wednesday_initial"
|
29 |
+
msgstr "M"
|
30 |
+
|
31 |
+
#: dbem_calendar.php:123
|
32 |
+
msgid "T_Thursday_initial"
|
33 |
+
msgstr "G"
|
34 |
+
|
35 |
+
#: dbem_calendar.php:123
|
36 |
+
msgid "F_Friday_initial"
|
37 |
+
msgstr "V"
|
38 |
+
|
39 |
+
#: dbem_calendar.php:123
|
40 |
+
msgid "S_Saturday_initial"
|
41 |
+
msgstr "S"
|
42 |
+
|
43 |
+
#: dbem_calendar.php:123
|
44 |
+
msgid "S_Sunday_initial"
|
45 |
+
msgstr "D"
|
46 |
+
|
47 |
+
#: dbem_widgets.php:10
|
48 |
+
#: dbem_widgets.php:35
|
49 |
+
#: events-manager.php:42
|
50 |
+
#: events-manager.php:155
|
51 |
+
#: events-manager.php:161
|
52 |
+
#: events-manager.php:187
|
53 |
+
#: events-manager.php:198
|
54 |
+
msgid "Events"
|
55 |
+
msgstr "Eventi"
|
56 |
+
|
57 |
+
#: dbem_widgets.php:19
|
58 |
+
#: events-manager.php:675
|
59 |
+
msgid "No events"
|
60 |
+
msgstr "Nessun evento"
|
61 |
+
|
62 |
+
#: dbem_widgets.php:78
|
63 |
+
#: dbem_widgets.php:156
|
64 |
+
msgid "Title"
|
65 |
+
msgstr "Titolo"
|
66 |
+
|
67 |
+
#: dbem_widgets.php:82
|
68 |
+
msgid "Number of events"
|
69 |
+
msgstr "Numero di eventi"
|
70 |
+
|
71 |
+
#: dbem_widgets.php:86
|
72 |
+
msgid "Scope of the events"
|
73 |
+
msgstr "Ambito degli eventi"
|
74 |
+
|
75 |
+
#: dbem_widgets.php:88
|
76 |
+
#: events-manager.php:845
|
77 |
+
msgid "Future events"
|
78 |
+
msgstr "Eventi futuri"
|
79 |
+
|
80 |
+
#: dbem_widgets.php:89
|
81 |
+
#: events-manager.php:844
|
82 |
+
msgid "All events"
|
83 |
+
msgstr "Tutti gli eventi"
|
84 |
+
|
85 |
+
#: dbem_widgets.php:90
|
86 |
+
#: events-manager.php:843
|
87 |
+
msgid "Past events"
|
88 |
+
msgstr "Eventi passati"
|
89 |
+
|
90 |
+
#: dbem_widgets.php:94
|
91 |
+
msgid "Order of the events"
|
92 |
+
msgstr "Ordine degli eventi"
|
93 |
+
|
94 |
+
#: dbem_widgets.php:96
|
95 |
+
msgid "Ascendant"
|
96 |
+
msgstr "Ascendente"
|
97 |
+
|
98 |
+
#: dbem_widgets.php:97
|
99 |
+
msgid "Descendant"
|
100 |
+
msgstr "Discendente"
|
101 |
+
|
102 |
+
#: dbem_widgets.php:101
|
103 |
+
msgid "List item format"
|
104 |
+
msgstr "Formato degli elementi"
|
105 |
+
|
106 |
+
#: dbem_widgets.php:122
|
107 |
+
msgid "calendar"
|
108 |
+
msgstr "calendario "
|
109 |
+
|
110 |
+
#: dbem_widgets.php:176
|
111 |
+
#: dbem_widgets.php:177
|
112 |
+
msgid "Events List"
|
113 |
+
msgstr "Lista eventi"
|
114 |
+
|
115 |
+
#: dbem_widgets.php:178
|
116 |
+
#: dbem_widgets.php:179
|
117 |
+
msgid "Events Calendar"
|
118 |
+
msgstr "Calendario eventi"
|
119 |
+
|
120 |
+
#: events-manager.php:267
|
121 |
+
msgid "New event successfully inserted!"
|
122 |
+
msgstr "Nuovo evento inserito!"
|
123 |
+
|
124 |
+
#: events-manager.php:281
|
125 |
+
msgid "Event"
|
126 |
+
msgstr "Evento"
|
127 |
+
|
128 |
+
#: events-manager.php:281
|
129 |
+
msgid "updated"
|
130 |
+
msgstr "aggiornato"
|
131 |
+
|
132 |
+
#: events-manager.php:311
|
133 |
+
msgid "Insert New Event"
|
134 |
+
msgstr "Inserisci un nuovo evento"
|
135 |
+
|
136 |
+
#: events-manager.php:313
|
137 |
+
msgid "Edit Event"
|
138 |
+
msgstr "Modifica l'evento"
|
139 |
+
|
140 |
+
#: events-manager.php:350
|
141 |
+
msgid "Past Events"
|
142 |
+
msgstr "Eventi passati"
|
143 |
+
|
144 |
+
#: events-manager.php:353
|
145 |
+
msgid "All Events"
|
146 |
+
msgstr "Tutti gli eventi"
|
147 |
+
|
148 |
+
#: events-manager.php:356
|
149 |
+
msgid "Future Events"
|
150 |
+
msgstr "Eventi futuri"
|
151 |
+
|
152 |
+
#: events-manager.php:374
|
153 |
+
msgid "Event Manager Options"
|
154 |
+
msgstr "Opzioni di Events Manager"
|
155 |
+
|
156 |
+
#: events-manager.php:379
|
157 |
+
msgid "Default event list format"
|
158 |
+
msgstr "Formato predefinito della lista eventi"
|
159 |
+
|
160 |
+
#: events-manager.php:381
|
161 |
+
msgid "The format of any events in a list."
|
162 |
+
msgstr "Il formato di ciascun evento della lista."
|
163 |
+
|
164 |
+
#: events-manager.php:382
|
165 |
+
msgid "Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_VENUE</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>. Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page. Use #_URL to print the event URL and make your own customised links."
|
166 |
+
msgstr "Inserire uno o più dei seguenti segnaposto: <code>#_NAME</code>, <code>#_VENUE</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>. Utilizzare <code>#_LINKEDNAME</code> per il nome dell'evento con un link alla pagina corrispondente. Utilizzare #_URL per visualizzare l'URL dell'evento e creare link personalizzati."
|
167 |
+
|
168 |
+
#: events-manager.php:383
|
169 |
+
msgid "To insert date and time values, use <a href=\"http://www.php.net/manual/en/function.date.php\">PHP time format characters</a> with a # symbol before them, i.e. #m. #M, #j, etc. "
|
170 |
+
msgstr "Per inserire valori di data e ora, utilizzare i <a href=\"http://www.php.net/manual/it/function.date.php\">caratteri di stringa formato PHP</a> anteponendo ad essi un #, ad esempio #m. #M, #j, etc. "
|
171 |
+
|
172 |
+
#: events-manager.php:384
|
173 |
+
msgid "Use HTML tags as <code>li</code>, <code>br</code>, etc."
|
174 |
+
msgstr "Utilizzare liberamente tag HTML come <code>li</code>, <code>br</code>, ecc."
|
175 |
+
|
176 |
+
#: events-manager.php:387
|
177 |
+
msgid "Single event page title format"
|
178 |
+
msgstr "Formato del titolo della pagina eventi"
|
179 |
+
|
180 |
+
#: events-manager.php:390
|
181 |
+
msgid "The format of a single event page title."
|
182 |
+
msgstr "Il formato del titolo della pagina di un singolo evento."
|
183 |
+
|
184 |
+
#: events-manager.php:391
|
185 |
+
#: events-manager.php:399
|
186 |
+
#: events-manager.php:470
|
187 |
+
#: events-manager.php:501
|
188 |
+
msgid "Follow the previous formatting instructions."
|
189 |
+
msgstr "Seguire le istruzioni di formattazione precedenti."
|
190 |
+
|
191 |
+
#: events-manager.php:395
|
192 |
+
msgid "Default single event format"
|
193 |
+
msgstr "Fomato predefinito di un singolo evento"
|
194 |
+
|
195 |
+
#: events-manager.php:398
|
196 |
+
msgid "The format of a single eventy page."
|
197 |
+
msgstr "Il formati della pagina di un singolo evento."
|
198 |
+
|
199 |
+
#: events-manager.php:400
|
200 |
+
msgid "Use <code>#_MAP</code> to insert a map."
|
201 |
+
msgstr "Utilizzare <code>#_MAP</code> per inserire una mappa."
|
202 |
+
|
203 |
+
#: events-manager.php:408
|
204 |
+
msgid "Show events page in lists?"
|
205 |
+
msgstr "Mostrare la pagina degli eventi nelle liste?"
|
206 |
+
|
207 |
+
#: events-manager.php:410
|
208 |
+
#: events-manager.php:484
|
209 |
+
msgid "Yes"
|
210 |
+
msgstr "Sì"
|
211 |
+
|
212 |
+
#: events-manager.php:411
|
213 |
+
#: events-manager.php:485
|
214 |
+
msgid "No"
|
215 |
+
msgstr "No"
|
216 |
+
|
217 |
+
#: events-manager.php:412
|
218 |
+
msgid "Check this option if you want the events page to appear together with other pages in pages lists."
|
219 |
+
msgstr "Selezionare questa opzione se si vuole che la pagina degli eventi compaia nelle liste delle pagine."
|
220 |
+
|
221 |
+
#: events-manager.php:428
|
222 |
+
msgid "Events page title"
|
223 |
+
msgstr "Titolo della pagina degli eventi"
|
224 |
+
|
225 |
+
#: events-manager.php:431
|
226 |
+
msgid "The title on the multiple events page."
|
227 |
+
msgstr "Il titolo della pagina che contiene più eventi."
|
228 |
+
|
229 |
+
#: events-manager.php:443
|
230 |
+
msgid "RSS main title"
|
231 |
+
msgstr "Titolo principale dell'RSS"
|
232 |
+
|
233 |
+
#: events-manager.php:446
|
234 |
+
msgid "The main title of your RSS events feed."
|
235 |
+
msgstr "Il titolo principale del feed RSS degli eventi."
|
236 |
+
|
237 |
+
#: events-manager.php:450
|
238 |
+
msgid "RSS main description"
|
239 |
+
msgstr "Descrizione principale dell'RSS"
|
240 |
+
|
241 |
+
#: events-manager.php:453
|
242 |
+
msgid "The main description of your RSS events feed."
|
243 |
+
msgstr "La descrizione principale del feed RSS degli eventi."
|
244 |
+
|
245 |
+
#: events-manager.php:458
|
246 |
+
msgid "RSS title format"
|
247 |
+
msgstr "Formato del titolo dell'RSS"
|
248 |
+
|
249 |
+
#: events-manager.php:461
|
250 |
+
msgid "The format of the title of each item in the events RSS feed."
|
251 |
+
msgstr "Il formato del titolo di ciascun elemento nel feed RSS."
|
252 |
+
|
253 |
+
#: events-manager.php:466
|
254 |
+
msgid "RSS description format"
|
255 |
+
msgstr "Formato della descrizione nell'RSS"
|
256 |
+
|
257 |
+
#: events-manager.php:469
|
258 |
+
msgid "The format of the description of each item in the events RSS feed."
|
259 |
+
msgstr "Il formato della descrizione di ciascun elemento nel feed RSS."
|
260 |
+
|
261 |
+
#: events-manager.php:482
|
262 |
+
msgid "Enable Google Maps integration?"
|
263 |
+
msgstr "Abilitare l'integrazione con Google Maps?"
|
264 |
+
|
265 |
+
#: events-manager.php:486
|
266 |
+
msgid "Check this option to enable Goggle Map integration."
|
267 |
+
msgstr "Selezionare questa opzione per abilitare l'integrazione con Google Maps."
|
268 |
+
|
269 |
+
#: events-manager.php:491
|
270 |
+
msgid "Google Maps API Key"
|
271 |
+
msgstr "Chiave API di Google Maps"
|
272 |
+
|
273 |
+
#: events-manager.php:494
|
274 |
+
msgid "To display Google Maps you need a Google Maps API key. Don't worry, it's free, you can get one"
|
275 |
+
msgstr "Per visualizzare una mappa di Google Maps è necessaria una chiave API di Google Maps. Non preoccupatevi, è gratuita, è sufficiente andare su"
|
276 |
+
|
277 |
+
#: events-manager.php:494
|
278 |
+
msgid "here"
|
279 |
+
msgstr "questa pagina"
|
280 |
+
|
281 |
+
#: events-manager.php:498
|
282 |
+
msgid "Map text format"
|
283 |
+
msgstr "Formato del testo della mappa"
|
284 |
+
|
285 |
+
#: events-manager.php:500
|
286 |
+
msgid "The format the text appearing in the map cloud."
|
287 |
+
msgstr "Il fomato del testo del fumetto che appare sulla mappa."
|
288 |
+
|
289 |
+
#: events-manager.php:505
|
290 |
+
msgid "Save Changes"
|
291 |
+
msgstr "Salva le modifiche"
|
292 |
+
|
293 |
+
#: events-manager.php:839
|
294 |
+
msgid "New Event ..."
|
295 |
+
msgstr "Nuovo evento..."
|
296 |
+
|
297 |
+
#: events-manager.php:855
|
298 |
+
msgid "ID"
|
299 |
+
msgstr "ID"
|
300 |
+
|
301 |
+
#: events-manager.php:856
|
302 |
+
#: events-manager.php:963
|
303 |
+
msgid "Name"
|
304 |
+
msgstr "Nome"
|
305 |
+
|
306 |
+
#: events-manager.php:857
|
307 |
+
#: events-manager.php:994
|
308 |
+
msgid "Venue"
|
309 |
+
msgstr "Locale"
|
310 |
+
|
311 |
+
#: events-manager.php:858
|
312 |
+
#: events-manager.php:987
|
313 |
+
msgid "Town"
|
314 |
+
msgstr "Città"
|
315 |
+
|
316 |
+
#: events-manager.php:859
|
317 |
+
#: events-manager.php:1001
|
318 |
+
msgid "Address"
|
319 |
+
msgstr "Indirizzo"
|
320 |
+
|
321 |
+
#: events-manager.php:860
|
322 |
+
msgid "Date"
|
323 |
+
msgstr "Data"
|
324 |
+
|
325 |
+
#: events-manager.php:861
|
326 |
+
msgid "Time"
|
327 |
+
msgstr "Ora"
|
328 |
+
|
329 |
+
#: events-manager.php:863
|
330 |
+
msgid "Latitude"
|
331 |
+
msgstr "Latitudine"
|
332 |
+
|
333 |
+
#: events-manager.php:864
|
334 |
+
msgid "Longitude"
|
335 |
+
msgstr "Longitudine"
|
336 |
+
|
337 |
+
#: events-manager.php:866
|
338 |
+
msgid "Actions"
|
339 |
+
msgstr "Azioni"
|
340 |
+
|
341 |
+
#: events-manager.php:927
|
342 |
+
msgid "Edit"
|
343 |
+
msgstr "Modifica"
|
344 |
+
|
345 |
+
#: events-manager.php:928
|
346 |
+
msgid "Are you sure?"
|
347 |
+
msgstr "Sei sicuro?"
|
348 |
+
|
349 |
+
#: events-manager.php:928
|
350 |
+
msgid "Delete"
|
351 |
+
msgstr "Elimina"
|
352 |
+
|
353 |
+
#: events-manager.php:966
|
354 |
+
msgid "The event name. Example: Birthday party"
|
355 |
+
msgstr "Il nome dell'evento. Esempio: festa di compleanno."
|
356 |
+
|
357 |
+
#: events-manager.php:970
|
358 |
+
msgid "Day and Time"
|
359 |
+
msgstr "Giorno e ora."
|
360 |
+
|
361 |
+
#: events-manager.php:976
|
362 |
+
msgid "The event day and time. Example: 21/11/2009 - 21:30"
|
363 |
+
msgstr "Giorno e ora dell'evento. Esempio: 21/11/2009 - 21:30"
|
364 |
+
|
365 |
+
#: events-manager.php:982
|
366 |
+
msgid "Map not found"
|
367 |
+
msgstr "Mappa non trovata"
|
368 |
+
|
369 |
+
#: events-manager.php:990
|
370 |
+
msgid "The event town. Example: Verona. If you' using the Google Map integration and want to avoid geotagging ambiguities include the country as well. Example: Verona, Italy"
|
371 |
+
msgstr "La città dell'evento. Esempio: Verona. Se si utilizza Google Map e si vogliono evitare ambiguità, inserire anche lo stato. Esempio: Verona, Italy"
|
372 |
+
|
373 |
+
#: events-manager.php:997
|
374 |
+
msgid "The venue where the event takes place. Example: Arena"
|
375 |
+
msgstr "Il locale dove avviene l'evento. Esempio: Arena"
|
376 |
+
|
377 |
+
#: events-manager.php:1004
|
378 |
+
msgid "The address of the venue. Example: Via Mazzini 22"
|
379 |
+
msgstr "L'indirizzo del locale. Esempio: Via Mazzini 22"
|
380 |
+
|
381 |
+
#: events-manager.php:1008
|
382 |
+
msgid "Notes"
|
383 |
+
msgstr "Note"
|
384 |
+
|
385 |
+
#: events-manager.php:1011
|
386 |
+
msgid "Notes about the event"
|
387 |
+
msgstr "Note sull'evento"
|
388 |
+
|
389 |
+
#: events-manager.php:1016
|
390 |
+
msgid "Submit Event"
|
391 |
+
msgstr "Invia evento"
|
392 |
+
|
393 |
+
#: events-manager.php:1274
|
394 |
+
msgid "You cannot enable Google Maps integration without setting an appropriate API key."
|
395 |
+
msgstr "Non è possibile abilitare l'integrazione con Google Maps senza impostare una chiave API."
|
396 |
+
|
397 |
+
#~ msgid ""
|
398 |
+
#~ "You are about to delete this event.\\n 'Cancel' to stop, 'OK' to delete."
|
399 |
+
#~ msgstr ""
|
400 |
+
#~ "Stai per cancellare questo evento.\\n \\'Cancel\\' per annullare "
|
401 |
+
#~ "l'opererazione, \\'Ok\\' per cancellare."
|
402 |
+
#~ msgid "Widget Title"
|
403 |
+
#~ msgstr "Titolo"
|
404 |
+
|
dbem_calendar.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function dbem_get_calendar($month="") {
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
// if (!($month))
|
7 |
+
$date = mktime(0,0,0,date('m'), date('d'), date('Y'));
|
8 |
+
$day = date('d', $date);
|
9 |
+
$month = date('m', $date);
|
10 |
+
$year = date('Y', $date);
|
11 |
+
// Get the first day of the month
|
12 |
+
$month_start = mktime(0,0,0,$month, 1, $year);
|
13 |
+
// Get friendly month name
|
14 |
+
|
15 |
+
$month_name = mysql2date('M', "$year-$month-$day 00:00:00");
|
16 |
+
// Figure out which day of the week
|
17 |
+
// the month starts on.
|
18 |
+
$month_start_day = date('D', $month_start);
|
19 |
+
switch($month_start_day){
|
20 |
+
case "Sun": $offset = 6; break;
|
21 |
+
case "Mon": $offset = 0; break;
|
22 |
+
case "Tue": $offset = 1; break;
|
23 |
+
case "Wed": $offset = 2; break;
|
24 |
+
case "Thu": $offset = 3; break;
|
25 |
+
case "Fri": $offset = 4; break;
|
26 |
+
case "Sat": $offset = 5; break;
|
27 |
+
}
|
28 |
+
|
29 |
+
// determine how many days are in the last month.
|
30 |
+
if($month == 1) {
|
31 |
+
$num_days_last = dbem_days_in_month(12, ($year -1));
|
32 |
+
} else {
|
33 |
+
$num_days_last = dbem_days_in_month(($month-1), $year);
|
34 |
+
}
|
35 |
+
// determine how many days are in the current month.
|
36 |
+
$num_days_current = dbem_days_in_month($month, $year);
|
37 |
+
// Build an array for the current days
|
38 |
+
// in the month
|
39 |
+
for($i = 1; $i <= $num_days_current; $i++){
|
40 |
+
$num_days_array[] = mktime(0,0,0,date('m'), $i, date('Y'));
|
41 |
+
}
|
42 |
+
// Build an array for the number of days
|
43 |
+
// in last month
|
44 |
+
for($i = 1; $i <= $num_days_last; $i++){
|
45 |
+
$num_days_last_array[] = $i;
|
46 |
+
}
|
47 |
+
// If the $offset from the starting day of the
|
48 |
+
// week happens to be Sunday, $offset would be 0,
|
49 |
+
// so don't need an offset correction.
|
50 |
+
|
51 |
+
if($offset > 0){
|
52 |
+
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
|
53 |
+
$new_count = array_merge($offset_correction, $num_days_array);
|
54 |
+
$offset_count = count($offset_correction);
|
55 |
+
}
|
56 |
+
|
57 |
+
// The else statement is to prevent building the $offset array.
|
58 |
+
else {
|
59 |
+
$offset_count = 0;
|
60 |
+
$new_count = $num_days_array;
|
61 |
+
}
|
62 |
+
// count how many days we have with the two
|
63 |
+
// previous arrays merged together
|
64 |
+
$current_num = count($new_count);
|
65 |
+
|
66 |
+
// Since we will have 5 HTML table rows (TR)
|
67 |
+
// with 7 table data entries (TD)
|
68 |
+
// we need to fill in 35 TDs
|
69 |
+
// so, we will have to figure out
|
70 |
+
// how many days to appened to the end
|
71 |
+
// of the final array to make it 35 days.
|
72 |
+
|
73 |
+
|
74 |
+
if($current_num > 35){
|
75 |
+
$num_weeks = 6;
|
76 |
+
$outset = (42 - $current_num);
|
77 |
+
} elseif($current_num < 35){
|
78 |
+
$num_weeks = 5;
|
79 |
+
$outset = (35 - $current_num);
|
80 |
+
}
|
81 |
+
if($current_num == 35){
|
82 |
+
$num_weeks = 5;
|
83 |
+
$outset = 0;
|
84 |
+
}
|
85 |
+
// Outset Correction
|
86 |
+
for($i = 1; $i <= $outset; $i++){
|
87 |
+
$new_count[] = $i;
|
88 |
+
}
|
89 |
+
// Now let's "chunk" the $all_days array
|
90 |
+
// into weeks. Each week has 7 days
|
91 |
+
// so we will array_chunk it into 7 days.
|
92 |
+
$weeks = array_chunk($new_count, 7);
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
// Build Previous and Next Links
|
97 |
+
$previous_link = "<a href=\"".$_SERVER['PHP_SELF']."?date=";
|
98 |
+
if($month == 1){
|
99 |
+
$previous_link .= mktime(0,0,0,12,$day,($year -1));
|
100 |
+
} else {
|
101 |
+
$previous_link .= mktime(0,0,0,($month -1),$day,$year);
|
102 |
+
}
|
103 |
+
$previous_link .= "\"><< Prev</a>";
|
104 |
+
|
105 |
+
$next_link = "<a href=\"".$_SERVER['PHP_SELF']."?date=";
|
106 |
+
if($month == 12){
|
107 |
+
$next_link .= mktime(0,0,0,1,$day,($year + 1));
|
108 |
+
} else {
|
109 |
+
$next_link .= mktime(0,0,0,($month +1),$day,$year);
|
110 |
+
}
|
111 |
+
$next_link .= "\">Next >></a>";
|
112 |
+
|
113 |
+
$calendar="<div id='dbem-calendar'>";
|
114 |
+
|
115 |
+
// Build the heading portion of the calendar table
|
116 |
+
$calendar .= "<table id='dbem-calendar-table'>\n".
|
117 |
+
"<thead>\n<tr>\n".
|
118 |
+
"<td colspan='7'>$month_name $year</td>\n".
|
119 |
+
"</tr>\n</thead>\n".
|
120 |
+
"<tr class='days-names'>\n".
|
121 |
+
"<td>".__('M_Monday_initial')."</td><td>".__('T_Tuesday_initial')."</td><td>".__('W_Wednesday_initial')."</td><td>".__('T_Thursday_initial')."</td><td>".__('F_Friday_initial')."</td><td>".__('S_Saturday_initial')."</td><td>".__('S_Sunday_initial')."</td>\n".
|
122 |
+
"</tr>\n";
|
123 |
+
|
124 |
+
// Now we break each key of the array
|
125 |
+
// into a week and create a new table row for each
|
126 |
+
// week with the days of that week in the table data
|
127 |
+
|
128 |
+
$i = 0;
|
129 |
+
foreach($weeks as $week){
|
130 |
+
$calendar .= "<tr>\n";
|
131 |
+
foreach($week as $d){
|
132 |
+
if($i < $offset_count){ //if it is PREVIOUS month
|
133 |
+
$calendar .= "<td class='eventless-pre'>$d</td>\n";
|
134 |
+
}
|
135 |
+
if(($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)){ // if it is THIS month
|
136 |
+
$fullday=$d;
|
137 |
+
$d=date('j', $d);
|
138 |
+
$day_link = "$d";
|
139 |
+
if($date == mktime(0,0,0,$month,$d,$year)){
|
140 |
+
$calendar .= "<td class='eventless-today'>$d</td>\n";
|
141 |
+
} else {
|
142 |
+
$calendar .= "<td class='eventless'>$day_link</td>\n";
|
143 |
+
}
|
144 |
+
} elseif(($outset > 0)) { //if it is NEXT month
|
145 |
+
if(($i >= ($num_weeks * 7) - $outset)){
|
146 |
+
$calendar .= "<td class='eventless-post'>$d</td>\n";
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$i++;
|
150 |
+
}
|
151 |
+
$calendar .= "</tr>\n";
|
152 |
+
}
|
153 |
+
// $calendar .= "<tr>\n".
|
154 |
+
// "<td colspan='7'>\n".
|
155 |
+
// "<table align='center'>\n".
|
156 |
+
// "<tr class='month-navigation'>\n".
|
157 |
+
// "<td class='previous-month' colspan='2' align='left'>$previous_link</td>\n".
|
158 |
+
// "<td colspan='3'> </td>".
|
159 |
+
// "<td class='next-month' colspan='2' align='right'>$next_link</td>\n".
|
160 |
+
// "</tr>\n".
|
161 |
+
// "</table>\n".
|
162 |
+
// "</td>\n</tr>\n";
|
163 |
+
$calendar .= " </table>\n</div>";
|
164 |
+
|
165 |
+
// query the database for events in this time span
|
166 |
+
if ($month == 1) {
|
167 |
+
$month_pre=12;
|
168 |
+
$month_post=2;
|
169 |
+
$year_pre=$year-1;
|
170 |
+
$year_post=$year;
|
171 |
+
} elseif($month == 12) {
|
172 |
+
$month_pre=11;
|
173 |
+
$month_post=1;
|
174 |
+
$year_pre=$year;
|
175 |
+
$year_post=$year+1;
|
176 |
+
} else {
|
177 |
+
$month_pre=$month-1;
|
178 |
+
$month_post=$month+1;
|
179 |
+
$year_pre=$year;
|
180 |
+
$year_post=$year;
|
181 |
+
}
|
182 |
+
$limit_pre=mktime(0,0,0,$month_pre, 1 , $year_pre);
|
183 |
+
$limit_post=mktime(0,0,0,$month_post, 30 , $year_post);
|
184 |
+
$events=$wpdb->get_results("SELECT event_id,
|
185 |
+
event_name,
|
186 |
+
event_venue,
|
187 |
+
event_town,
|
188 |
+
event_province,
|
189 |
+
event_time,
|
190 |
+
DATE_FORMAT(event_time, '%w') AS 'event_weekday_n',
|
191 |
+
DATE_FORMAT(event_time, '%e') AS 'event_day',
|
192 |
+
DATE_FORMAT(event_time, '%c') AS 'event_month_n',
|
193 |
+
DATE_FORMAT(event_time, '%Y') AS 'event_year',
|
194 |
+
DATE_FORMAT(event_time, '%k') AS 'event_hh',
|
195 |
+
DATE_FORMAT(event_time, '%i') AS 'event_mm'
|
196 |
+
FROM ".$wpdb->prefix."events WHERE UNIX_TIMESTAMP(event_time) > $limit_pre AND UNIX_TIMESTAMP(event_time) < $limit_post ORDER BY event_time");
|
197 |
+
//----- DEBUG ------------
|
198 |
+
//foreach($events as $event) { //DEBUG
|
199 |
+
// $calendar .= ("$event->event_day / $event->event_month_n - $event->event_name<br/>");
|
200 |
+
//}
|
201 |
+
// ------------------
|
202 |
+
// inserts the events
|
203 |
+
$events_page = get_option('dbem_events_page');
|
204 |
+
if($events){
|
205 |
+
foreach($events as $event) {
|
206 |
+
if ($event->event_month_n == $month_pre) {
|
207 |
+
$calendar=str_replace("<td class='eventless-pre'>$event->event_day</td>","<td class='eventful-pre'><a href='?page_id=$events_page&event_id="."$event->event_id'>$event->event_day</a></td>",$calendar);
|
208 |
+
} elseif($event->event_month_n == $month_post) {
|
209 |
+
$calendar=str_replace("<td class='eventless-post'>$event->event_day</td>","<td class='eventful-post'><a href='?page_id=$events_page&event_id="."$event->event_id'>$event->event_day</a></td>",$calendar);
|
210 |
+
} elseif($event->event_day == $day) {
|
211 |
+
$calendar=str_replace("<td class='eventless-today'>$event->event_day</td>","<td class='eventful-today'><a href='?page_id=$events_page&event_id="."$event->event_id'>$event->event_day</a></td>",$calendar);
|
212 |
+
} else{
|
213 |
+
$calendar=str_replace("<td class='eventless'>$event->event_day</td>","<td class='eventful'><a href='?page_id=$events_page&event_id="."$event->event_id'>$event->event_day</a></td>",$calendar);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
$output=$calendar;
|
218 |
+
|
219 |
+
echo $output;
|
220 |
+
}
|
221 |
+
|
222 |
+
function dbem_days_in_month($month, $year) {
|
223 |
+
switch ($month) {
|
224 |
+
case (2):
|
225 |
+
if ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) {
|
226 |
+
return 29;
|
227 |
+
} else {
|
228 |
+
return 28;
|
229 |
+
}
|
230 |
+
break;
|
231 |
+
case (4):
|
232 |
+
return 30;
|
233 |
+
break;
|
234 |
+
case (6):
|
235 |
+
return 30;
|
236 |
+
break;
|
237 |
+
case (9):
|
238 |
+
return 30;
|
239 |
+
break;
|
240 |
+
case (11):
|
241 |
+
return 30;
|
242 |
+
break;
|
243 |
+
default:
|
244 |
+
return 31;
|
245 |
+
break;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
function dbem_calendar_style() {
|
250 |
+
?>
|
251 |
+
<style type="text/css">
|
252 |
+
#dbem-calendar td {
|
253 |
+
padding: 2px 4px;
|
254 |
+
text-align: center;
|
255 |
+
}
|
256 |
+
#dbem-calendar tr.days-names {
|
257 |
+
font-weight: bold;
|
258 |
+
}
|
259 |
+
#dbem-calendar td.eventless-pre, #dbem-calendar td.eventless-post {
|
260 |
+
color: #ccc;
|
261 |
+
}
|
262 |
+
#dbem-calendar td.eventful a {
|
263 |
+
font-weight: bold;
|
264 |
+
color: #FD7E29;
|
265 |
+
}
|
266 |
+
#dbem-calendar td.eventless-today {
|
267 |
+
background-color: #CFCFCF;
|
268 |
+
}
|
269 |
+
#dbem-calendar thead {
|
270 |
+
font-size: 120%;
|
271 |
+
font-weight: bold;
|
272 |
+
}
|
273 |
+
</style>
|
274 |
+
<?php
|
275 |
+
}
|
276 |
+
add_action('wp_head', 'dbem_calendar_style');
|
277 |
+
|
278 |
+
|
279 |
+
?>
|
dbem_widgets.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// List widget
|
3 |
+
function widget_dbem_list($args) {
|
4 |
+
extract($args);
|
5 |
+
|
6 |
+
$options = get_option("widget_dbem_list");
|
7 |
+
if (!is_array( $options ))
|
8 |
+
{
|
9 |
+
$options = array(
|
10 |
+
'title' => __('Events','dbem')
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
echo $before_widget;
|
15 |
+
echo $before_title;
|
16 |
+
echo $options['title'];
|
17 |
+
echo $after_title;
|
18 |
+
$events_list = dbem_get_events_list($options['limit'],$options['scope'],$options['order'] ,$options['format'], false);
|
19 |
+
if ($events_list == __('No events', 'dbem'))
|
20 |
+
$events_list = "<li>$events_list</li>";
|
21 |
+
echo "<ul>
|
22 |
+
$events_list
|
23 |
+
</ul>";
|
24 |
+
|
25 |
+
echo $after_widget;
|
26 |
+
}
|
27 |
+
|
28 |
+
function dbem_list_control()
|
29 |
+
{
|
30 |
+
$options = get_option("widget_dbem_list");
|
31 |
+
|
32 |
+
if (!is_array( $options ))
|
33 |
+
{
|
34 |
+
$options = array(
|
35 |
+
'title' => _('Events', 'dbem'),
|
36 |
+
'limit' => '5',
|
37 |
+
'scope' => 'future',
|
38 |
+
'order' => 'ASC',
|
39 |
+
'format' => DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($_POST['dbem_list-Submit'])
|
44 |
+
{
|
45 |
+
$options['title'] = htmlspecialchars($_POST['dbem_list-WidgetTitle']);
|
46 |
+
$options['limit'] = $_POST['dbem_list-WidgetLimit'];
|
47 |
+
$options['scope'] = $_POST['dbem_list-WidgetScope'];
|
48 |
+
$options['order'] = $_POST['dbem_list-WidgetOrder'];
|
49 |
+
$options['format'] = $_POST['dbem_list-WidgetFormat'];
|
50 |
+
update_option("widget_dbem_list", $options);
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($options['scope'] == "all" )
|
54 |
+
$allSelected = "selected='selected'";
|
55 |
+
else
|
56 |
+
$allSelected = "";
|
57 |
+
if ($options['scope'] == "past" )
|
58 |
+
$pastSelected = "selected='selected'";
|
59 |
+
else
|
60 |
+
$pastSelected = "";
|
61 |
+
if ($options['scope'] == "future" )
|
62 |
+
$futureSelected = "selected='selected'";
|
63 |
+
else
|
64 |
+
$futureSelected = "";
|
65 |
+
|
66 |
+
if ($options['order'] == "ASC" )
|
67 |
+
$ASCSelected = "selected='selected'";
|
68 |
+
else
|
69 |
+
$ASCSelected = "";
|
70 |
+
if ($options['order'] == "DESC" )
|
71 |
+
$DESCSelected = "selected='selected'";
|
72 |
+
else
|
73 |
+
$DESCSelected = "";
|
74 |
+
|
75 |
+
|
76 |
+
?>
|
77 |
+
<p>
|
78 |
+
<label for="dbem_list-WidgetTitle"><?php _e('Title'); ?>: </label>
|
79 |
+
<input type="text" id="dbem_list-WidgetTitle" name="dbem_list-WidgetTitle" value="<?php echo $options['title'];?>" />
|
80 |
+
</p>
|
81 |
+
<p>
|
82 |
+
<label for="dbem_list-WidgetTitle"><?php _e('Number of events','dbem'); ?>: </label>
|
83 |
+
<input type="text" id="dbem_list-WidgetLimit" name="dbem_list-WidgetLimit" value="<?php echo $options['limit'];?>" />
|
84 |
+
</p>
|
85 |
+
<p>
|
86 |
+
<label for="dbem_list-WidgetScope"><?php _e('Scope of the events','dbem'); ?>:</label><br/>
|
87 |
+
<select name="dbem_list-WidgetScope" >
|
88 |
+
<option value="future" <?php echo $futureSelected; ?>><?php _e('Future events','dbem'); ?></option>
|
89 |
+
<option value="all" <?php echo $allSelected; ?>><?php _e('All events','dbem'); ?></option>
|
90 |
+
<option value="past" <?php echo $pastSelected; ?>><?php _e('Past events','dbem'); ?>:</option>
|
91 |
+
</select>
|
92 |
+
</p>
|
93 |
+
<p>
|
94 |
+
<label for="dbem_list-WidgetOrder"><?php _e('Order of the events','dbem'); ?>:</label><br/>
|
95 |
+
<select name="dbem_list-WidgetOrder" >
|
96 |
+
<option value="ASC" <?php echo $ASCSelected; ?>><?php _e('Ascendant','dbem'); ?></option>
|
97 |
+
<option value="DESC" <?php echo $DESCSelected; ?>><?php _e('Descendant','dbem'); ?>:</option>
|
98 |
+
</select>
|
99 |
+
</p>
|
100 |
+
<p>
|
101 |
+
<label for="dbem_list-WidgetTitle"><?php _e('List item format','dbem'); ?>:</label>
|
102 |
+
<textarea id="dbem_list-WidgetFormat" name="dbem_list-WidgetFormat" rows="5" cols="24"><?php echo $options['format'];?></textarea>
|
103 |
+
</p>
|
104 |
+
<input type="hidden" id="dbem_list-Submit" name="dbem_list-Submit" value="1" />
|
105 |
+
<?php
|
106 |
+
}
|
107 |
+
|
108 |
+
// Calendar widget
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
function widget_dbem_calendar($args) {
|
116 |
+
extract($args);
|
117 |
+
|
118 |
+
$options = get_option("widget_dbem_calendar");
|
119 |
+
if (!is_array( $options ))
|
120 |
+
{
|
121 |
+
$options = array(
|
122 |
+
'title' => _e('calendar','dbem')
|
123 |
+
);
|
124 |
+
}
|
125 |
+
|
126 |
+
echo $before_widget;
|
127 |
+
echo $before_title;
|
128 |
+
echo $options['title'];
|
129 |
+
echo $after_title;
|
130 |
+
//Our Widget Content
|
131 |
+
$current_month = date("m");
|
132 |
+
|
133 |
+
dbem_get_calendar($current_month);
|
134 |
+
echo $after_widget;
|
135 |
+
}
|
136 |
+
|
137 |
+
function dbem_calendar_control()
|
138 |
+
{
|
139 |
+
$options = get_option("widget_dbem_calendar");
|
140 |
+
|
141 |
+
if (!is_array( $options ))
|
142 |
+
{
|
143 |
+
$options = array(
|
144 |
+
'title' => 'Calendar',
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
if ($_POST['dbem_calendar-Submit'])
|
149 |
+
{
|
150 |
+
$options['title'] = htmlspecialchars($_POST['dbem_calendar-WidgetTitle']);
|
151 |
+
update_option("widget_dbem_calendar", $options);
|
152 |
+
}
|
153 |
+
|
154 |
+
?>
|
155 |
+
<p>
|
156 |
+
<label for="dbem_calendar-WidgetTitle"><?php _e('Title'); ?>:</label>
|
157 |
+
<input type="text" id="dbem_calendar-WidgetTitle" name="dbem_calendar-WidgetTitle" value="<?php echo $options['title'];?>" />
|
158 |
+
<input type="hidden" id="dbem_calendar-Submit" name="dbem_calendar-Submit" value="1" />
|
159 |
+
</p>
|
160 |
+
<?php
|
161 |
+
}
|
162 |
+
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
// widgets registration
|
172 |
+
function dbem_list_init()
|
173 |
+
{
|
174 |
+
// $widget_ops = array('classname' => 'widget_dbem_list', 'description' => __( "A list of the events") );
|
175 |
+
// wp_register_sidebar_widget('widget_dbem_list', __('Events List'), 'widget_dbem_list', $widget_ops);
|
176 |
+
register_sidebar_widget(__('Events List', 'dbem'), 'widget_dbem_list');
|
177 |
+
register_widget_control(__('Events List', 'dbem'), 'dbem_list_control', 200, 200 );
|
178 |
+
register_sidebar_widget(__('Events Calendar','dbem'), 'widget_dbem_calendar');
|
179 |
+
register_widget_control(__('Events Calendar','dbem'), 'dbem_calendar_control', 300, 200 );
|
180 |
+
}
|
181 |
+
add_action("plugins_loaded", "dbem_list_init");
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
|
188 |
+
?>
|
events-manager.php
ADDED
@@ -0,0 +1,1395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Events Manager
|
4 |
+
Version: 1.0
|
5 |
+
Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
|
6 |
+
Description: Manage events specifying precise spatial data (Venue, Town, Province, etc).
|
7 |
+
Author: Davide Benini
|
8 |
+
Author URI: http://www.davidebenini.it/blog
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
Copyright (c) 2008, Davide Benini. $Revision: 1 $
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or
|
15 |
+
modify it under the terms of the GNU General Public License
|
16 |
+
as published by the Free Software Foundation; either version 2
|
17 |
+
of the License, or (at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
27 |
+
*/
|
28 |
+
|
29 |
+
/*************************************************/
|
30 |
+
include("dbem_calendar.php");
|
31 |
+
include("dbem_widgets.php");
|
32 |
+
// Setting constants
|
33 |
+
define('TBNAME','events'); //TABLE NAME
|
34 |
+
define('DEFAULT_EVENT_PAGE_NAME', 'Events');
|
35 |
+
define('DBEM_PAGE','<!--DBEM_EVENTS_PAGE-->'); //EVENTS PAGE
|
36 |
+
define('MIN_CAPABILITY', 'edit_posts'); // Minimum user level to access calendars
|
37 |
+
define('SETTING_CAPABILITY', 'activate_plugins'); // Minimum user level to access calendars
|
38 |
+
define('DEFAULT_EVENT_LIST_ITEM_FORMAT', '<li>#j #M #Y - #H:#i<br/> #_LINKEDNAME<br/>#_TOWN </li>');
|
39 |
+
define('DEFAULT_SINGLE_EVENT_FORMAT', '<p>#j #M #Y - #H:#i</p><p>#_TOWN</p>');
|
40 |
+
define('DEFAULT_EVENTS_PAGE_TITLE',__('Events','dbem') ) ;
|
41 |
+
define('DEFAULT_EVENT_PAGE_TITLE_FORMAT', ' #_NAME');
|
42 |
+
define('DEFAULT_RSS_DESCRIPTION_FORMAT',"#j #M #y - #H:#i <br/>#_VENUE <br/>#_ADDRESS <br/>#_TOWN");
|
43 |
+
define('DEFAULT_RSS_TITLE_FORMAT',"#_NAME");
|
44 |
+
define('DEFAULT_MAP_TEXT_FORMAT', '<strong>#_VENUE</strong><p>#_ADDRESS</p><p>#_TOWN</p>');
|
45 |
+
define('DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT','#_LINKEDNAME<ul><li>#j #M #y</li><li>#_TOWN</li></ul></li>');
|
46 |
+
// DEBUG constant for developing
|
47 |
+
// if you are hacking this plugin, set to TRUE, alog will show in admin pages
|
48 |
+
define('DEBUG', false);
|
49 |
+
|
50 |
+
load_plugin_textdomain('dbem', "/wp-content/plugins/events-manager/");
|
51 |
+
// To enable activation through the activate function
|
52 |
+
register_activation_hook(__FILE__,'events-manager');
|
53 |
+
|
54 |
+
// Execute the install script when the plugin is installed
|
55 |
+
add_action('activate_events-manager/events-manager.php','dbem_install');
|
56 |
+
|
57 |
+
// filters for general events field (corresponding to those of "the _title")
|
58 |
+
add_filter('dbem_general', 'wptexturize');
|
59 |
+
add_filter('dbem_general', 'convert_chars');
|
60 |
+
add_filter('dbem_general', 'trim');
|
61 |
+
// filters for the notes field (corresponding to those of "the _content")
|
62 |
+
add_filter('dbem_notes', 'wptexturize');
|
63 |
+
add_filter('dbem_notes', 'convert_smilies');
|
64 |
+
add_filter('dbem_notes', 'convert_chars');
|
65 |
+
add_filter('dbem_notes', 'wpautop');
|
66 |
+
add_filter('dbem_notes', 'prepend_attachment');
|
67 |
+
// RSS general filters
|
68 |
+
add_filter('dbem_general_rss', 'strip_tags');
|
69 |
+
add_filter('dbem_general_rss', 'ent2ncr', 8);
|
70 |
+
add_filter('dbem_general_rss', 'wp_specialchars');
|
71 |
+
// RSS content filter
|
72 |
+
add_filter('dbem_notes_rss', 'convert_chars', 8);
|
73 |
+
add_filter('dbem_notes_rss', 'ent2ncr', 8);
|
74 |
+
|
75 |
+
add_filter('dbem_notes_map', 'convert_chars', 8);
|
76 |
+
add_filter('dbem_notes_map', 'js_escape');
|
77 |
+
|
78 |
+
/* Creating the wp_events table to store event data*/
|
79 |
+
function dbem_install() {
|
80 |
+
global $wpdb, $user_level;
|
81 |
+
$table_name = $wpdb->prefix.TBNAME;
|
82 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
83 |
+
// check the user is allowed to make changes
|
84 |
+
// get_currentuserinfo();
|
85 |
+
// if ($user_level < 8) { return; }
|
86 |
+
|
87 |
+
// Creating the events table
|
88 |
+
$sql = "CREATE TABLE ".$table_name." (
|
89 |
+
event_id mediumint(9) NOT NULL AUTO_INCREMENT,
|
90 |
+
event_author mediumint(9) NOT NULL,
|
91 |
+
event_name tinytext NOT NULL,
|
92 |
+
event_time datetime NOT NULL,
|
93 |
+
event_venue tinytext NOT NULL,
|
94 |
+
event_address tinytext NOT NULL,
|
95 |
+
event_town tinytext NOT NULL,
|
96 |
+
event_province tinytext,
|
97 |
+
event_notes text NOT NULL,
|
98 |
+
event_latitude float DEFAULT NULL,
|
99 |
+
event_longitude float DEFAULT NULL,
|
100 |
+
UNIQUE KEY (event_id)
|
101 |
+
);";
|
102 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
103 |
+
dbDelta($sql);
|
104 |
+
//-------------- DEBUG CODE to insert a few events n the new table
|
105 |
+
// get the current timestamp into an array
|
106 |
+
$timestamp = time();
|
107 |
+
$date_time_array = getdate($timestamp);
|
108 |
+
|
109 |
+
$hours = $date_time_array['hours'];
|
110 |
+
$minutes = $date_time_array['minutes'];
|
111 |
+
$seconds = $date_time_array['seconds'];
|
112 |
+
$month = $date_time_array['mon'];
|
113 |
+
$day = $date_time_array['mday'];
|
114 |
+
$year = $date_time_array['year'];
|
115 |
+
|
116 |
+
// use mktime to recreate the unix timestamp
|
117 |
+
// adding 19 hours to $hours
|
118 |
+
$in_one_week = strftime('%Y-%m-%d 21:30:00', mktime($hours,$minutes,$seconds,$month,$day+7,$year));
|
119 |
+
$in_four_weeks = strftime('%Y-%m-%d 16:00:00',mktime($hours,$minutes,$seconds,$month,$day+28,$year));
|
120 |
+
$in_one_year = strftime('%Y-%m-%d 22:00:00',mktime($hours,$minutes,$seconds,$month,$day,$year+1));
|
121 |
+
|
122 |
+
$wpdb->query("INSERT INTO ".$wpdb->prefix."events (event_name, event_venue, event_address, event_time, event_town)
|
123 |
+
VALUES ('Monster gig','Wembley stadium', 'Wembley', '$in_one_week','London')");
|
124 |
+
$wpdb->query("INSERT INTO ".$wpdb->prefix."events (event_name, event_venue,event_address, event_time, event_town)
|
125 |
+
VALUES ('Fiesta Mexicana','Hard Rock Cafe', '1501 Broadway', '$in_four_weeks','New York')");
|
126 |
+
$wpdb->query("INSERT INTO ".$wpdb->prefix."events (event_name, event_venue,event_address, event_time, event_town)
|
127 |
+
VALUES ('Gladiators fight','Arena', 'Piazza Bra', '$in_one_year','Verona')");
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
$events_page_id = get_option('dbem_events_page') ;
|
133 |
+
if ($events_page_id != "" ) {
|
134 |
+
query_posts("page_id=$events_page_id");
|
135 |
+
$count = 0;
|
136 |
+
while(have_posts()) { the_post();
|
137 |
+
$count++;
|
138 |
+
}
|
139 |
+
if ($count == 0)
|
140 |
+
dbem_create_events_page();
|
141 |
+
} else {
|
142 |
+
dbem_create_events_page();
|
143 |
+
}
|
144 |
+
//if (get_option('dbem_events_page'))
|
145 |
+
//$event_page_id = get_option('dbem_events_page');
|
146 |
+
//dbem_create_events_page();
|
147 |
+
// Adding plugin options
|
148 |
+
$event_list_item_format = get_option('dbem_event_list_item_format');
|
149 |
+
if (empty($event_list_item_format))
|
150 |
+
update_option('dbem_event_list_item_format', DEFAULT_EVENT_LIST_ITEM_FORMAT);
|
151 |
+
|
152 |
+
$single_event_format = get_option('dbem_single_event_format');
|
153 |
+
if (empty($single_event_format))
|
154 |
+
update_option('dbem_single_event_format', DEFAULT_SINGLE_EVENT_FORMAT);
|
155 |
+
|
156 |
+
$event_page_title_format = get_option('dbem_event_page_title_format');
|
157 |
+
if (empty($event_page_title_format))
|
158 |
+
update_option('dbem_event_page_title_format', DEFAULT_EVENT_PAGE_TITLE_FORMAT);
|
159 |
+
|
160 |
+
$list_events_page = get_option('dbem_list_events_page');
|
161 |
+
if (empty($list_events_page))
|
162 |
+
update_option('dbem_list_events_page', 0);
|
163 |
+
|
164 |
+
$events_page_title = get_option('dbem_events_page_title');
|
165 |
+
if (empty($events_page_title))
|
166 |
+
update_option('dbem_events_page_title', DEFAULT_EVENTS_PAGE_TITLE);
|
167 |
+
|
168 |
+
$map_text_format = get_option('dbem_map_text_format');
|
169 |
+
if (empty($map_text_format))
|
170 |
+
update_option('dbem_map_text_format', DEFAULT_MAP_TEXT_FORMAT);
|
171 |
+
|
172 |
+
$rss_main_title = get_option('dbem_rss_main_title');
|
173 |
+
if (empty($rss_main_title)) {
|
174 |
+
$default_rss_main_title = get_bloginfo('title')." - ".__('Events');
|
175 |
+
update_option('dbem_rss_main_title', $default_rss_main_title);
|
176 |
+
}
|
177 |
+
|
178 |
+
$rss_main_description = get_option('dbem_rss_main_description');
|
179 |
+
if (empty($rss_main_description)) {
|
180 |
+
$default_rss_main_description = get_bloginfo('description')." - ".__('Events');
|
181 |
+
update_option('dbem_rss_main_description', $default_rss_main_description);
|
182 |
+
}
|
183 |
+
|
184 |
+
$rss_description_format = get_option('dbem_rss_description_format');
|
185 |
+
if (empty($rss_description_format))
|
186 |
+
update_option('dbem_rss_description_format', DEFAULT_RSS_DESCRIPTION_FORMAT);
|
187 |
+
|
188 |
+
$rss_title_format = get_option('dbem_rss_title_format');
|
189 |
+
if (empty($rss_title_format))
|
190 |
+
update_option('dbem_rss_title_format', DEFAULT_RSS_TITLE_FORMAT);
|
191 |
+
|
192 |
+
$gmap_is_active = get_option('dbem_gmap_is_active');
|
193 |
+
if(empty($gmap_is_active))
|
194 |
+
update_option('dbem_gmap_is_active', 0);
|
195 |
+
|
196 |
+
$gmap_key = get_option('dbem_gmap_key');
|
197 |
+
if (empty($gmap_key))
|
198 |
+
update_option('dbem_gmap_key', '');
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
function dbem_create_events_page(){
|
203 |
+
echo "inserimento pagina";
|
204 |
+
global $wpdb,$current_user;
|
205 |
+
$page_name= DEFAULT_EVENT_PAGE_NAME;
|
206 |
+
$sql= "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_type, post_content, post_title, post_name, post_modified, post_modified_gmt, comment_count) VALUES ($current_user->ID, '$now', '$now_gmt', 'page','CONTENTS', '$page_name', '".$wpdb->escape(__('Events','dbem'))."', '$now', '$now_gmt', '0')";
|
207 |
+
// echo($sql);
|
208 |
+
$wpdb->query($sql);
|
209 |
+
|
210 |
+
update_option('dbem_events_page', mysql_insert_id());
|
211 |
+
}
|
212 |
+
|
213 |
+
// Create the Manage Events and the Options submenus
|
214 |
+
add_action('admin_menu','dbem_create_events_submenu');
|
215 |
+
function dbem_create_events_submenu () {
|
216 |
+
if(function_exists('add_submenu_page')) {
|
217 |
+
add_submenu_page('edit.php',__('Events', 'dbem'),__('Events', 'dbem'),MIN_CAPABILITY,'eventmanager.php',dbem_events_subpanel);
|
218 |
+
// add_options_page('Events Manager','Events Manager',MIN_LEVEL,'eventmanager.php',dbem_options_subpanel);
|
219 |
+
add_options_page('Events manager', 'Events Manager', SETTING_CAPABILITY, __FILE__, dbem_options_subpanel);
|
220 |
+
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
// Events manager page
|
225 |
+
function dbem_events_subpanel() {
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
global $wpdb;
|
230 |
+
$action=$_GET['action'];
|
231 |
+
$element=$_GET['event_id'];
|
232 |
+
$scope=$_GET['scope'];
|
233 |
+
$offset=$_GET['offset'];
|
234 |
+
$order=$_GET['order'];
|
235 |
+
if ($order == "")
|
236 |
+
$order = "ASC";
|
237 |
+
if ($offset=="")
|
238 |
+
$offset = "0";
|
239 |
+
|
240 |
+
// Debug code, to make sure I get the correct page
|
241 |
+
//$event_page_id=get_option('dbem_event_page');
|
242 |
+
if (DEBUG) {
|
243 |
+
echo "<div class='debug'>\n
|
244 |
+
\t<h3>Debug log</h3>\n";
|
245 |
+
echo "<p>action = $action $element</p>\n";
|
246 |
+
|
247 |
+
}
|
248 |
+
// DELETE action
|
249 |
+
if ($action == 'delete_event') {
|
250 |
+
$sql="DELETE FROM ".$wpdb->prefix."events WHERE event_id='"."$element"."'";
|
251 |
+
if (DEBUG)
|
252 |
+
echo $sql;
|
253 |
+
// TODO eventual error if ID in non-existant
|
254 |
+
$wpdb->query($sql);
|
255 |
+
if (DEBUG)
|
256 |
+
echo "</div>"; // end of debug div
|
257 |
+
$events = dbem_get_events("", "future");
|
258 |
+
dbem_events_table($events, 10,"Future events");
|
259 |
+
}
|
260 |
+
// UPDATE or CREATE action
|
261 |
+
if ($action == 'update_event') {
|
262 |
+
// This script gets executed whenever has inserted a new event or updated an old one
|
263 |
+
$event = array();
|
264 |
+
$event['event_name']=$_POST[event_name];
|
265 |
+
$event['event_day']=$_POST[event_day];
|
266 |
+
$event['event_month']=$_POST[event_month];
|
267 |
+
$event['event_year']=$_POST[event_year];
|
268 |
+
$event['event_hh']=$_POST[event_hh];
|
269 |
+
$event['event_mm']=$_POST[event_mm];
|
270 |
+
$event['event_venue']=$_POST[event_venue];
|
271 |
+
$event['event_address']=$_POST[event_address];
|
272 |
+
$event['event_town']=$_POST[event_town];
|
273 |
+
$event['event_province']=$_POST[event_province];
|
274 |
+
$event['event_latitude']=$_POST[event_latitude];
|
275 |
+
$event['event_longitude']=$_POST[event_longitude];
|
276 |
+
$event['event_notes']=$_POST[event_notes];
|
277 |
+
$datetime="'{$event['event_year']}-{$event['event_month']}-{$event['event_day']} {$event['event_hh']}:{$event['event_mm']}:00'";
|
278 |
+
// $datetime="$event_day-$event_month-$event_year $event_hh:$event_mm:00";
|
279 |
+
$validation_result = dbem_validate_event($event);
|
280 |
+
if ( $validation_result == "OK") {
|
281 |
+
// validation successful
|
282 |
+
if(!$element) {
|
283 |
+
// INSERT new event
|
284 |
+
$sql="INSERT INTO ".$wpdb->prefix."events (event_name, event_venue, event_town, event_address, event_province, event_time, event_latitude, event_longitude, event_notes)
|
285 |
+
VALUES ('".$event['event_name']."','".$event['event_venue']."','".$event['event_town']."','".$event['event_address']."','".$event['event_province']."',".$datetime.",'".$event['event_latitude']."','".$event['event_longitude']."','".$event['event_notes']."');";
|
286 |
+
$feedback_message = __('New event successfully inserted!','dbem');
|
287 |
+
} else {
|
288 |
+
// UPDATE old event
|
289 |
+
$sql="UPDATE ".$wpdb->prefix."events
|
290 |
+
SET event_name='".$event['event_name']."', ".
|
291 |
+
"event_venue='".$event['event_venue']."',".
|
292 |
+
"event_town='".$event['event_town']."',".
|
293 |
+
"event_address='".$event['event_address']."',".
|
294 |
+
"event_province='".$event['event_province']."',".
|
295 |
+
"event_latitude='".$event['event_latitude']."',".
|
296 |
+
"event_longitude='".$event['event_longitude']."',".
|
297 |
+
"event_notes='".$event['event_notes']."',".
|
298 |
+
"event_time=$datetime ".
|
299 |
+
"WHERE event_id="."$element";
|
300 |
+
$feedback_message = __('Event','dbem')." $element ".__('updated','dbem')."!";
|
301 |
+
}
|
302 |
+
if (DEBUG)
|
303 |
+
echo "SQL = $sql";
|
304 |
+
if (DEBUG)
|
305 |
+
echo "</div>"; // end of debug
|
306 |
+
|
307 |
+
$wpdb->query($sql);
|
308 |
+
echo "<div id='message' class='updated fade'>
|
309 |
+
<p>$feedback_message</p>
|
310 |
+
</div>";
|
311 |
+
$events = dbem_get_events("", "future");
|
312 |
+
dbem_events_table($events, 10, "Future events");
|
313 |
+
} else {
|
314 |
+
// validation unsuccessful
|
315 |
+
|
316 |
+
echo $event['name'];
|
317 |
+
if (DEBUG)
|
318 |
+
echo "<p>NON VALIDO: $validation_result</p>";
|
319 |
+
if (DEBUG)
|
320 |
+
echo "</div>"; // end of debug
|
321 |
+
echo "<div id='message' class='error '>
|
322 |
+
<p>Ach, there's a problem here: $validation_result</p>
|
323 |
+
</div>";
|
324 |
+
dbem_event_form($event,"Edit event $element" ,$element);
|
325 |
+
|
326 |
+
}
|
327 |
+
}
|
328 |
+
if ($action == 'edit_event') {
|
329 |
+
if (!$element) {
|
330 |
+
$title=__("Insert New Event", 'dbem');
|
331 |
+
} else {
|
332 |
+
$title=__("Edit Event", 'dbem')." $element";
|
333 |
+
}
|
334 |
+
// If a edit operation was requested queries the event table
|
335 |
+
$sql='SELECT event_id,
|
336 |
+
event_name,
|
337 |
+
event_venue,
|
338 |
+
event_address,
|
339 |
+
event_town,
|
340 |
+
event_province,
|
341 |
+
DATE_FORMAT(event_time, "%e") AS "event_day",
|
342 |
+
DATE_FORMAT(event_time, "%c") AS "event_month",
|
343 |
+
DATE_FORMAT(event_time, "%Y") AS "event_year",
|
344 |
+
DATE_FORMAT(event_time, "%k") AS "event_hh",
|
345 |
+
DATE_FORMAT(event_time, "%i") AS "event_mm",
|
346 |
+
event_latitude,
|
347 |
+
event_longitude,
|
348 |
+
event_notes
|
349 |
+
FROM '.$wpdb->prefix.'events WHERE event_id="'.$element.'";';
|
350 |
+
$event=$wpdb->get_row($sql, ARRAY_A);
|
351 |
+
// Enter new events and updates old ones
|
352 |
+
// DEBUG: echo"Nome: $event->event_name";
|
353 |
+
if (DEBUG) {
|
354 |
+
echo "</div>";
|
355 |
+
}
|
356 |
+
|
357 |
+
dbem_event_form($event, $title, $element);
|
358 |
+
|
359 |
+
}
|
360 |
+
if ($action == ""){
|
361 |
+
// No action, only showing the events list
|
362 |
+
if (DEBUG)
|
363 |
+
echo "\t<p>No UPDATE, INSERT or DELETE action performed</p>\n
|
364 |
+
</div>";
|
365 |
+
|
366 |
+
|
367 |
+
switch ($scope) {
|
368 |
+
case "past":
|
369 |
+
$title = __('Past Events','dbem');
|
370 |
+
break;
|
371 |
+
case "all":
|
372 |
+
$title = __('All Events','dbem');
|
373 |
+
break;
|
374 |
+
default:
|
375 |
+
$title = __('Future Events','dbem');
|
376 |
+
$scope = "future";
|
377 |
+
}
|
378 |
+
$limit = 10;
|
379 |
+
$events = dbem_get_events($limit, $scope, $order,$offset);
|
380 |
+
|
381 |
+
dbem_events_table($events, $limit, $title);
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
// Function composing the options subpanel
|
389 |
+
function dbem_options_subpanel() {
|
390 |
+
|
391 |
+
?>
|
392 |
+
<div class="wrap">
|
393 |
+
<h2><?php _e('Event Manager Options','dbem'); ?></h2>
|
394 |
+
<form id="dbem_options_form" method="post" action="options.php">
|
395 |
+
<?php wp_nonce_field('update-options'); ?>
|
396 |
+
<table class="form-table">
|
397 |
+
<tr valign="top">
|
398 |
+
<th scope="row"><?php _e('Default event list format','dbem')?></th>
|
399 |
+
<td><textarea name="dbem_event_list_item_format" id="dbem_event_list_item_format" rows="6" cols="60"><?php echo (get_option('dbem_event_list_item_format'));?></textarea><br/>
|
400 |
+
<?php _e('The format of any events in a list.','dbem')?><br/>
|
401 |
+
<?php _e('Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_VENUE</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>. Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page. Use #_URL to print the event URL and make your own customised links.','dbem')?>
|
402 |
+
<?php _e('To insert date and time values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a # symbol before them, i.e. #m. #M, #j, etc. ','dbem')?><br/>
|
403 |
+
<?php _e('Use HTML tags as <code>li</code>, <code>br</code>, etc.','dbem')?></td>
|
404 |
+
</tr>
|
405 |
+
<tr valign="top">
|
406 |
+
<th scope="row"><?php _e('Single event page title format','dbem');?></th>
|
407 |
+
<td>
|
408 |
+
<input name="dbem_event_page_title_format" type="text" id="dbem_event_page_title_format" style="width: 95%" value="<?php echo get_option('dbem_event_page_title_format'); ?>" size="45" /><br />
|
409 |
+
<?php _e('The format of a single event page title.','dbem')?><br/>
|
410 |
+
<?php _e('Follow the previous formatting instructions.','dbem')?>
|
411 |
+
</td>
|
412 |
+
</tr>
|
413 |
+
<tr valign="top">
|
414 |
+
<th scope="row"><?php _e('Default single event format','dbem')?></th>
|
415 |
+
<td>
|
416 |
+
<textarea name="dbem_single_event_format" id="dbem_single_event_format" rows="6" cols="60"><?php echo (get_option('dbem_single_event_format'));?></textarea><br/>
|
417 |
+
<?php _e('The format of a single eventy page.','dbem')?><br/>
|
418 |
+
<?php _e('Follow the previous formatting instructions.','dbem')?><br/>
|
419 |
+
<?php _e('Use <code>#_MAP</code> to insert a map.','dbem')?>
|
420 |
+
</td>
|
421 |
+
</tr>
|
422 |
+
|
423 |
+
|
424 |
+
<?php $list_events_page = get_option('dbem_list_events_page'); ?>
|
425 |
+
|
426 |
+
<tr valign="top">
|
427 |
+
<th scope="row"><?php _e('Show events page in lists?','dbem'); ?></th>
|
428 |
+
<td>
|
429 |
+
<input id="dbem_list_events_page" name="dbem_list_events_page" type="radio" value="1" <?php if($list_events_page) echo "checked='checked'"; ?> /><?php _e('Yes'); ?> <br />
|
430 |
+
<input name="dbem_list_events_page" type="radio" value="0" <?php if(!$list_events_page) echo "checked='checked'"; ?> /><?php _e('No'); ?> <br />
|
431 |
+
<?php _e('Check this option if you want the events page to appear together with other pages in pages lists.','dbem')?>
|
432 |
+
</td>
|
433 |
+
</tr>
|
434 |
+
|
435 |
+
|
436 |
+
|
437 |
+
|
438 |
+
|
439 |
+
|
440 |
+
|
441 |
+
|
442 |
+
|
443 |
+
|
444 |
+
|
445 |
+
|
446 |
+
<tr valign="top">
|
447 |
+
<th scope="row"><?php _e('Events page title','dbem'); ?></th>
|
448 |
+
<td>
|
449 |
+
<input name="dbem_events_page_title" type="text" id="dbem_events_page_title" style="width: 95%" value="<?php echo get_option('dbem_events_page_title'); ?>" size="45" /><br />
|
450 |
+
<?php _e('The title on the multiple events page.','dbem')?>
|
451 |
+
</td>
|
452 |
+
</tr>
|
453 |
+
|
454 |
+
|
455 |
+
|
456 |
+
|
457 |
+
|
458 |
+
|
459 |
+
|
460 |
+
|
461 |
+
<tr valign="top">
|
462 |
+
<th scope="row"><?php _e('RSS main title','dbem'); ?></th>
|
463 |
+
<td>
|
464 |
+
<input name="dbem_rss_main_title" type="text" id="dbem_rss_main_title" style="width: 95%" value="<?php echo get_option('dbem_rss_main_title'); ?>" size="45" /><br />
|
465 |
+
<?php _e('The main title of your RSS events feed.','dbem')?>
|
466 |
+
|
467 |
+
</td>
|
468 |
+
</tr> <tr valign="top">
|
469 |
+
<th scope="row"><?php _e('RSS main description','dbem'); ?></th>
|
470 |
+
<td>
|
471 |
+
<input name="dbem_rss_main_description" type="text" id="dbem_rss_main_description" style="width: 95%" value="<?php echo get_option('dbem_rss_main_description'); ?>" size="45" /><br />
|
472 |
+
<?php _e('The main description of your RSS events feed.','dbem')?>
|
473 |
+
|
474 |
+
</td>
|
475 |
+
</tr>
|
476 |
+
<tr valign="top">
|
477 |
+
<th scope="row"><?php _e('RSS title format','dbem'); ?></th>
|
478 |
+
<td>
|
479 |
+
<input name="dbem_rss_title_format" type="text" id="dbem_rss_title_format" style="width: 95%" value="<?php echo get_option('dbem_rss_title_format'); ?>" size="45" /><br />
|
480 |
+
<?php _e('The format of the title of each item in the events RSS feed.','dbem')?>
|
481 |
+
|
482 |
+
</td>
|
483 |
+
</tr>
|
484 |
+
<tr valign="top">
|
485 |
+
<th scope="row"><?php _e('RSS description format','dbem'); ?></th>
|
486 |
+
<td>
|
487 |
+
<input name="dbem_rss_description_format" type="text" id="dbem_rss_description_format" style="width: 95%" value="<?php echo get_option('dbem_rss_description_format'); ?>" size="45" /><br />
|
488 |
+
<?php _e('The format of the description of each item in the events RSS feed.','dbem')?>
|
489 |
+
<?php _e('Follow the previous formatting instructions.','dbem')?><br/>
|
490 |
+
</td>
|
491 |
+
</tr>
|
492 |
+
|
493 |
+
|
494 |
+
|
495 |
+
|
496 |
+
|
497 |
+
|
498 |
+
<?php $gmap_is_active = get_option('dbem_gmap_is_active'); ?>
|
499 |
+
|
500 |
+
<tr valign="top">
|
501 |
+
<th scope="row"><?php _e('Enable Google Maps integration?','dbem'); ?></th>
|
502 |
+
<td>
|
503 |
+
<input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active" type="radio" value="1" <?php if($gmap_is_active) echo "checked='checked'"; ?> /><?php _e('Yes'); ?> <br />
|
504 |
+
<input name="dbem_gmap_is_active" type="radio" value="0" <?php if(!$gmap_is_active) echo "checked='checked'"; ?> /> <?php _e('No'); ?> <br />
|
505 |
+
<?php _e('Check this option to enable Goggle Map integration.','dbem')?>
|
506 |
+
</td>
|
507 |
+
</tr>
|
508 |
+
|
509 |
+
<tr valign="top">
|
510 |
+
<th scope="row"><?php _e('Google Maps API Key','dbem'); ?></th>
|
511 |
+
<td>
|
512 |
+
<input name="dbem_gmap_key" type="text" id="dbem_gmap_key" style="width: 95%" value="<?php echo get_option('dbem_gmap_key'); ?>" size="45" /><br />
|
513 |
+
<?php _e("To display Google Maps you need a Google Maps API key. Don't worry, it's free, you can get one", "dbem");?> <a href="http://code.google.com/apis/maps/signup.html"><?php _e("here",'dbem')?></a>.
|
514 |
+
</td>
|
515 |
+
</tr>
|
516 |
+
<tr valign="top">
|
517 |
+
<th scope="row"><?php _e('Map text format','dbem')?></th>
|
518 |
+
<td><textarea name="dbem_map_text_format" id="dbem_map_text_format" rows="6" cols="60"><?php echo (get_option('dbem_map_text_format'));?></textarea><br/>
|
519 |
+
<?php _e('The format the text appearing in the map cloud.','dbem')?><br/>
|
520 |
+
<?php _e('Follow the previous formatting instructions.','dbem')?></td>
|
521 |
+
</tr>
|
522 |
+
</table>
|
523 |
+
<p class="submit">
|
524 |
+
<input type="submit" id="dbem_options_submit" name="Submit" value="<?php _e('Save Changes') ?>" />
|
525 |
+
</p>
|
526 |
+
<input type="hidden" name="action" value="update" />
|
527 |
+
<input type="hidden" name="page_options" value="dbem_event_list_item_format,dbem_event_page_title_format,dbem_single_event_format,dbem_list_events_page,dbem_events_page_title, dbem_gmap_is_active, dbem_rss_main_title, dbem_rss_main_description, dbem_rss_title_format, dbem_rss_description_format, dbem_gmap_key, dbem_map_text_format" />
|
528 |
+
|
529 |
+
|
530 |
+
</form>
|
531 |
+
</div>
|
532 |
+
<?php
|
533 |
+
|
534 |
+
|
535 |
+
}
|
536 |
+
|
537 |
+
|
538 |
+
|
539 |
+
|
540 |
+
//This is the content of the event page
|
541 |
+
function dbem_events_page_content() {
|
542 |
+
|
543 |
+
global $wpdb;
|
544 |
+
if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
|
545 |
+
// single event page
|
546 |
+
$event_ID=$_REQUEST['event_id'];
|
547 |
+
$event= dbem_get_event($event_ID);
|
548 |
+
$single_event_format = get_option('dbem_single_event_format');
|
549 |
+
$page_body = dbem_replace_placeholders($single_event_format, $event);
|
550 |
+
return $page_body;
|
551 |
+
} else {
|
552 |
+
// Multiple events page
|
553 |
+
$stored_format = get_option('dbem_event_list_item_format');
|
554 |
+
$events_body = dbem_get_events_list(10, "future", "ASC", $stored_format, $false);
|
555 |
+
return $events_body;
|
556 |
+
|
557 |
+
}
|
558 |
+
}
|
559 |
+
|
560 |
+
// filter function to call the event page when appropriate
|
561 |
+
function dbem_filter_events_page($data) {
|
562 |
+
|
563 |
+
// $table_name = $wpdb->prefix .TBNAME;
|
564 |
+
// $start = strpos($data, DBEM_PAGE);
|
565 |
+
$events_page_id = get_option('dbem_events_page');
|
566 |
+
if (is_page($events_page_id) ) {
|
567 |
+
return dbem_events_page_content();
|
568 |
+
} else {
|
569 |
+
return $data;
|
570 |
+
}
|
571 |
+
}
|
572 |
+
add_filter('the_content','dbem_filter_events_page');
|
573 |
+
|
574 |
+
function dbem_events_page_title($data) {
|
575 |
+
$events_page_id = get_option('dbem_events_page');
|
576 |
+
$events_page = get_page($events_page_id);
|
577 |
+
$events_page_title = $events_page->post_title;
|
578 |
+
if (($data == $events_page_title) && (is_page($events_page_id))) {
|
579 |
+
if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
|
580 |
+
// single event page
|
581 |
+
$event_ID=$_REQUEST['event_id'];
|
582 |
+
$event= dbem_get_event($event_ID);
|
583 |
+
$stored_page_title_format = get_option('dbem_event_page_title_format');
|
584 |
+
$page_title = dbem_replace_placeholders($stored_page_title_format, $event);
|
585 |
+
return $page_title;
|
586 |
+
} else {
|
587 |
+
// Multiple events page
|
588 |
+
$page_title = get_option('dbem_events_page_title');
|
589 |
+
return $page_title;
|
590 |
+
|
591 |
+
}
|
592 |
+
|
593 |
+
} else {
|
594 |
+
return $data;
|
595 |
+
}
|
596 |
+
|
597 |
+
}
|
598 |
+
// to make sure that in pages lists the title is dbem_events_page_title, and not overwritten by the previous filter
|
599 |
+
add_filter('the_title','dbem_events_page_title');
|
600 |
+
add_filter('single_post_title','dbem_events_page_title');
|
601 |
+
|
602 |
+
function dbem_filter_get_pages($data) {
|
603 |
+
$output = array();
|
604 |
+
$events_page_id = get_option('dbem_events_page');
|
605 |
+
for ($i = 0; $i < count($data); ++$i) {
|
606 |
+
if ($data[$i]->ID == $events_page_id) {
|
607 |
+
$list_events_page = get_option('dbem_list_events_page');
|
608 |
+
if($list_events_page) {
|
609 |
+
$data[$i]->post_title = get_option('dbem_events_page_title')." ";
|
610 |
+
$output[] = $data[$i];
|
611 |
+
}
|
612 |
+
} else {
|
613 |
+
$output[] = $data[$i];
|
614 |
+
}
|
615 |
+
}
|
616 |
+
return $output;
|
617 |
+
}
|
618 |
+
add_filter('get_pages', 'dbem_filter_get_pages');
|
619 |
+
|
620 |
+
|
621 |
+
|
622 |
+
//
|
623 |
+
// TODO: ROBA NUOVA DA RIORDINARE
|
624 |
+
// ADMIN CSS for debug
|
625 |
+
function dbem_admin_css() {
|
626 |
+
$css = "
|
627 |
+
<style type='text/css'>
|
628 |
+
.debug{
|
629 |
+
color: green;
|
630 |
+
background: #B7F98C;
|
631 |
+
margin: 15px;
|
632 |
+
padding: 10px;
|
633 |
+
border: 1px solid #629948;
|
634 |
+
}
|
635 |
+
.switch-tab {
|
636 |
+
background: #aaa;
|
637 |
+
width: 100px;
|
638 |
+
float: right;
|
639 |
+
text-align: center;
|
640 |
+
margin: 3px 1px 0 5px;
|
641 |
+
padding: 2px;
|
642 |
+
}
|
643 |
+
.switch-tab a {
|
644 |
+
color: #fff;
|
645 |
+
text-decoration: none;
|
646 |
+
}
|
647 |
+
.switch-tab a:hover {
|
648 |
+
color: #D54E21;
|
649 |
+
|
650 |
+
}
|
651 |
+
#events-pagination {
|
652 |
+
text-align: center;
|
653 |
+
|
654 |
+
}
|
655 |
+
#events-pagination a {
|
656 |
+
margin: 0 20px 0 20px;
|
657 |
+
text-decoration: none;
|
658 |
+
width: 80px;
|
659 |
+
padding: 3px 0;
|
660 |
+
background: #FAF4B7;
|
661 |
+
border: 1px solid #ccc;
|
662 |
+
border-top: none;
|
663 |
+
}
|
664 |
+
#new-event {
|
665 |
+
float: left;
|
666 |
+
|
667 |
+
}
|
668 |
+
</style>";
|
669 |
+
echo $css;
|
670 |
+
}
|
671 |
+
|
672 |
+
add_action('admin_print_scripts','dbem_admin_css');
|
673 |
+
|
674 |
+
// exposed function, for theme makers
|
675 |
+
function dbem_get_events_list($limit="3", $scope="future", $order="ASC", $format='', $display=true) {
|
676 |
+
if ($scope == "")
|
677 |
+
$scope = "future";
|
678 |
+
if ($order != "DESC")
|
679 |
+
$order = "ASC";
|
680 |
+
if ($format == '')
|
681 |
+
$format = get_option('dbem_event_list_item_format');
|
682 |
+
$events = dbem_get_events($limit, $scope, $order);
|
683 |
+
$output = "";
|
684 |
+
if (!empty($events)) {
|
685 |
+
foreach ($events as $event){
|
686 |
+
// $localised_date = mysql2date("j M Y", $event->event_time);
|
687 |
+
|
688 |
+
|
689 |
+
|
690 |
+
$output .= dbem_replace_placeholders($format, $event);
|
691 |
+
}
|
692 |
+
} else {
|
693 |
+
$output = __('No events', 'dbem');
|
694 |
+
}
|
695 |
+
if ($display)
|
696 |
+
echo $output;
|
697 |
+
else
|
698 |
+
return $output;
|
699 |
+
}
|
700 |
+
|
701 |
+
function dbem_get_events_page($justurl=false) {
|
702 |
+
$page_link = get_permalink(get_option("dbem_events_page")) ;
|
703 |
+
if($justurl) {
|
704 |
+
echo $page_link;
|
705 |
+
} else {
|
706 |
+
$page_title = get_option("dbem_events_page_title") ;
|
707 |
+
echo "<a href='$page_link' title='$page_title'>$page_title</a>";
|
708 |
+
}
|
709 |
+
|
710 |
+
}
|
711 |
+
|
712 |
+
function dbem_replace_placeholders($format, $event, $target="html") {
|
713 |
+
$event_string = $format;
|
714 |
+
preg_match_all("/#_?[A-Za-z]+/", $format, $placeholders);
|
715 |
+
foreach($placeholders[0] as $result) {
|
716 |
+
// matches alla fields placeholder
|
717 |
+
if (preg_match('/#_MAP/', $result)) {
|
718 |
+
$gmap_is_active = get_option('dbem_gmap_is_active');
|
719 |
+
if ($gmap_is_active) {
|
720 |
+
$map_div = "<div id='event-map' style='width: 450px; height: 300px; background: green;'></div>" ;
|
721 |
+
} else {
|
722 |
+
$map_div = "";
|
723 |
+
}
|
724 |
+
$event_string = str_replace($result, $map_div , $event_string );
|
725 |
+
}
|
726 |
+
if (preg_match('/#_LINKEDNAME/', $result)) {
|
727 |
+
$events_page_id = get_option('dbem_events_page');
|
728 |
+
$event_page_link = get_permalink($events_page_id);
|
729 |
+
if (stristr($event_page_link, "?"))
|
730 |
+
$joiner = "&";
|
731 |
+
else
|
732 |
+
$joiner = "?";
|
733 |
+
$event_string = str_replace($result, "<a href='".get_permalink($events_page_id).$joiner."event_id=$event->event_id' title='$event->event_name'>$event->event_name</a>" , $event_string );
|
734 |
+
}
|
735 |
+
if (preg_match('/#_URL/', $result)) {
|
736 |
+
$events_page_id = get_option('dbem_events_page');
|
737 |
+
$event_page_link = get_permalink($events_page_id);
|
738 |
+
if (stristr($event_page_link, "?"))
|
739 |
+
$joiner = "&";
|
740 |
+
else
|
741 |
+
$joiner = "?";
|
742 |
+
$event_string = str_replace($result, get_permalink($events_page_id).$joiner."event_id=$event->event_id" , $event_string );
|
743 |
+
}
|
744 |
+
if (preg_match('/#_(NAME|VENUE|ADDRESS|TOWN|PROVINCE|NOTES)/', $result)) {
|
745 |
+
$field = "event_".ltrim(strtolower($result), "#_");
|
746 |
+
$field_value = $event->{$field};
|
747 |
+
if ($field == "event_notes") {
|
748 |
+
if ($target == "html")
|
749 |
+
$field_value = apply_filters('dbem_notes', $field_value);
|
750 |
+
else
|
751 |
+
if ($target == "map")
|
752 |
+
$field_value = apply_filters('dbem_notes_map', $field_value);
|
753 |
+
else
|
754 |
+
$field_value = apply_filters('dbem_notes_rss', $field_value);
|
755 |
+
} else {
|
756 |
+
if ($target == "html")
|
757 |
+
$field_value = apply_filters('dbem_general', $field_value);
|
758 |
+
else
|
759 |
+
$field_value = apply_filters('dbem_general_rss', $field_value);
|
760 |
+
}
|
761 |
+
$event_string = str_replace($result, $field_value , $event_string );
|
762 |
+
}
|
763 |
+
// matches all PHP time placeholders
|
764 |
+
if (preg_match('/#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/', $result)) {
|
765 |
+
$event_string = str_replace($result, mysql2date(ltrim($result, "#"), $event->event_time),$event_string );
|
766 |
+
}
|
767 |
+
}
|
768 |
+
return $event_string;
|
769 |
+
|
770 |
+
}
|
771 |
+
// main function querying the database event table
|
772 |
+
function dbem_get_events($limit="",$scope="future",$order="ASC", $offset="") {
|
773 |
+
global $wpdb;
|
774 |
+
|
775 |
+
if ($limit != "")
|
776 |
+
$limit = "LIMIT $limit";
|
777 |
+
if ($offset != "")
|
778 |
+
$offset = "OFFSET $offset";
|
779 |
+
|
780 |
+
if (($scope != "past") && ($scope !="all"))
|
781 |
+
$scope = "future";
|
782 |
+
|
783 |
+
$timestamp = time();
|
784 |
+
$date_time_array = getdate($timestamp);
|
785 |
+
$hours = $date_time_array['hours'];
|
786 |
+
$minutes = $date_time_array['minutes'];
|
787 |
+
$seconds = $date_time_array['seconds'];
|
788 |
+
$month = $date_time_array['mon'];
|
789 |
+
$day = $date_time_array['mday'];
|
790 |
+
$year = $date_time_array['year'];
|
791 |
+
$today = strftime('%Y-%m-%d 00:00:00', mktime($hours,$minutes,$seconds,$month,$day,$year));
|
792 |
+
|
793 |
+
|
794 |
+
|
795 |
+
|
796 |
+
if ($scope == "future")
|
797 |
+
$temporal_condition = "WHERE event_time >= '$today'" ;
|
798 |
+
if ($scope == "past")
|
799 |
+
$temporal_condition = "WHERE event_time < '$today'" ;
|
800 |
+
if ($scope == "all")
|
801 |
+
$temporal_condition = "";
|
802 |
+
|
803 |
+
$sql = "SELECT event_id,
|
804 |
+
event_name,
|
805 |
+
event_venue,
|
806 |
+
event_address,
|
807 |
+
event_town,
|
808 |
+
event_province,
|
809 |
+
DATE_FORMAT(event_time, '%e') AS 'event_day',
|
810 |
+
DATE_FORMAT(event_time, '%Y') AS 'event_year',
|
811 |
+
DATE_FORMAT(event_time, '%k') AS 'event_hh',
|
812 |
+
DATE_FORMAT(event_time, '%i') AS 'event_mm',
|
813 |
+
event_time,
|
814 |
+
event_latitude,
|
815 |
+
event_longitude,
|
816 |
+
event_notes
|
817 |
+
FROM ".$wpdb->prefix."events
|
818 |
+
$temporal_condition
|
819 |
+
ORDER BY event_time $order
|
820 |
+
$limit
|
821 |
+
$offset";
|
822 |
+
|
823 |
+
|
824 |
+
$events = $wpdb->get_results($sql);
|
825 |
+
|
826 |
+
return $events;
|
827 |
+
}
|
828 |
+
function dbem_get_event($event_id) {
|
829 |
+
global $wpdb;
|
830 |
+
$sql = "SELECT event_id,
|
831 |
+
event_name,
|
832 |
+
event_venue,
|
833 |
+
event_address,
|
834 |
+
event_town,
|
835 |
+
event_province,
|
836 |
+
DATE_FORMAT(event_time, '%e') AS 'event_day',
|
837 |
+
DATE_FORMAT(event_time, '%Y') AS 'event_year',
|
838 |
+
DATE_FORMAT(event_time, '%k') AS 'event_hh',
|
839 |
+
DATE_FORMAT(event_time, '%i') AS 'event_mm',
|
840 |
+
event_time,
|
841 |
+
event_latitude,
|
842 |
+
event_longitude,
|
843 |
+
event_notes
|
844 |
+
FROM ".$wpdb->prefix."events
|
845 |
+
WHERE event_id = $event_id";
|
846 |
+
|
847 |
+
|
848 |
+
$event = $wpdb->get_row($sql);
|
849 |
+
|
850 |
+
return $event;
|
851 |
+
}
|
852 |
+
function dbem_events_table($events, $limit, $title) {
|
853 |
+
|
854 |
+
|
855 |
+
if (isset($_GET['scope']))
|
856 |
+
$scope = $_GET['scope'];
|
857 |
+
else
|
858 |
+
$scope = "future";
|
859 |
+
if (($scope != "past") && ($scope != "all"))
|
860 |
+
$scope = "future";
|
861 |
+
$events_count = count(dbem_get_events("",$scope));
|
862 |
+
|
863 |
+
if (isset($_GET['offset']))
|
864 |
+
$offset = $_GET['offset'];
|
865 |
+
|
866 |
+
|
867 |
+
?>
|
868 |
+
<div class="wrap">
|
869 |
+
|
870 |
+
<h2><?php echo $title; ?></h2>
|
871 |
+
<div id='new-event' class='switch-tab'><a href="<?php bloginfo('wpurl')?>/wp-admin/edit.php?page=eventmanager.php&action=edit_event"><?php _e('New Event ...', 'dbem');?></a></div>
|
872 |
+
<?php
|
873 |
+
|
874 |
+
$link = array();
|
875 |
+
$link['past'] = "<a href='".get_bloginfo('url')."/wp-admin/edit.php?page=eventmanager.php&scope=past&order=desc'>".__('Past events','dbem')."</a>";
|
876 |
+
$link['all'] = " <a href='".get_bloginfo('url')."/wp-admin/edit.php?page=eventmanager.php&scope=all&order=desc'>".__('All events','dbem')."</a>";
|
877 |
+
$link['future'] = " <a href='".get_bloginfo('url')."/wp-admin/edit.php?page=eventmanager.php&scope=future'>".__('Future events','dbem')."</a>";
|
878 |
+
foreach ($link as $key => $value) {
|
879 |
+
if ($key != $scope)
|
880 |
+
echo "<div class='switch-tab'>".$link[$key]."</div>";
|
881 |
+
} ?>
|
882 |
+
|
883 |
+
|
884 |
+
<table class="widefat">
|
885 |
+
<thead>
|
886 |
+
<tr>
|
887 |
+
<th><?php _e('ID', 'dbem');?></th>
|
888 |
+
<th><?php _e('Name', 'dbem');?></th>
|
889 |
+
<th><?php _e('Venue', 'dbem');?></th>
|
890 |
+
<th><?php _e('Town', 'dbem');?></th>
|
891 |
+
<th><?php _e('Address', 'dbem');?></th>
|
892 |
+
<th><?php _e('Date', 'dbem');?></th>
|
893 |
+
<th><?php _e('Time', 'dbem');?></th>
|
894 |
+
<?php if (false) { ?>
|
895 |
+
<th><?php _e('Latitude', 'dbem');?></th>
|
896 |
+
<th><?php _e('Longitude', 'dbem');?></th>
|
897 |
+
<?php } ?>
|
898 |
+
<th colspan="2"><?php _e('Actions', 'dbem');?></th>
|
899 |
+
</tr>
|
900 |
+
</thead>
|
901 |
+
<tbody>
|
902 |
+
<?php
|
903 |
+
$i =1;
|
904 |
+
foreach ($events as $event){
|
905 |
+
$class = ($i % 2) ? ' class="alternate"' : '';
|
906 |
+
$month = mysql2date('M', $event->event_time);
|
907 |
+
$weekday = mysql2date('D', $event->event_time);
|
908 |
+
$style = "";
|
909 |
+
|
910 |
+
$timestamp = time();
|
911 |
+
$date_time_array = getdate($timestamp);
|
912 |
+
$this_hours = $date_time_array['hours'];
|
913 |
+
$this_minutes = $date_time_array['minutes'];
|
914 |
+
$this_seconds = $date_time_array['seconds'];
|
915 |
+
$this_month = $date_time_array['mon'];
|
916 |
+
$this_day = $date_time_array['mday'];
|
917 |
+
$this_year = $date_time_array['year'];
|
918 |
+
$today = strftime('%Y-%m-%d 00:00:00', mktime($this_hours,$this_minutes,$this_seconds,$this_month,$this_day,$this_year));
|
919 |
+
|
920 |
+
|
921 |
+
if ($event->event_time < $today )
|
922 |
+
$style= "style ='background-color: #FADDB7;'";
|
923 |
+
?>
|
924 |
+
<tr <?php echo"$class $style"; ?> >
|
925 |
+
<td>
|
926 |
+
<strong><?php echo "$event->event_id"; ?></strong>
|
927 |
+
</td>
|
928 |
+
<td>
|
929 |
+
<?php echo "$event->event_name"; ?>
|
930 |
+
</td>
|
931 |
+
<td>
|
932 |
+
<?php echo "$event->event_venue"; ?>
|
933 |
+
</td>
|
934 |
+
<td>
|
935 |
+
<?php
|
936 |
+
echo "$event->event_town";
|
937 |
+
if (isset($event->event_province)) {
|
938 |
+
echo " ($event->event_province)";
|
939 |
+
}
|
940 |
+
?>
|
941 |
+
</td>
|
942 |
+
<td>
|
943 |
+
<?php echo "$event->event_address"; ?>
|
944 |
+
</td>
|
945 |
+
<td>
|
946 |
+
<?php echo "$weekday $event->event_day $month $event->event_year"; ?>
|
947 |
+
</td>
|
948 |
+
<td>
|
949 |
+
<?php echo "$event->event_hh : $event->event_mm"; ?>
|
950 |
+
</td>
|
951 |
+
<?php if (false) { ?>
|
952 |
+
<td>
|
953 |
+
<?php echo "$event->event_latitude"; ?>
|
954 |
+
</td>
|
955 |
+
<td>
|
956 |
+
<?php echo "$event->event_longitude"; ?>
|
957 |
+
</td>
|
958 |
+
<?php } ?>
|
959 |
+
<td><a class="edit" href="<?php bloginfo('wpurl')?>/wp-admin/edit.php?page=eventmanager.php&action=edit_event&event_id=<?php echo "$event->event_id"?>"><?php _e('Edit'); ?></a></td>
|
960 |
+
<td><a class="delete" href="<?php bloginfo('wpurl')?>/wp-admin/edit.php?page=eventmanager.php&action=delete_event&event_id=<?php echo "$event->event_id" ?>" onclick="return confirm('<?php _e('Are you sure?','dbem'); ?>');"><?php _e('Delete'); ?></a></td>
|
961 |
+
<?php
|
962 |
+
echo'</tr>';
|
963 |
+
$i++;
|
964 |
+
}
|
965 |
+
?>
|
966 |
+
|
967 |
+
</tbody>
|
968 |
+
</table>
|
969 |
+
<?php
|
970 |
+
if ($events_count > $limit) {
|
971 |
+
$backward = $offset + $limit;
|
972 |
+
$forward = $offset - $limit;
|
973 |
+
if (DEBUG)
|
974 |
+
echo "COUNT = $count BACKWARD = $backward FORWARD = $forward<br> -- OFFSET = $offset" ;
|
975 |
+
echo "<div id='events-pagination'> ";
|
976 |
+
if ($backward < $events_count)
|
977 |
+
echo "<a style='float: left' href='".get_bloginfo('url')."/wp-admin/edit.php?page=eventmanager.php&scope=$scope&offset=$backward'><<</a>" ;
|
978 |
+
if ($forward >= 0)
|
979 |
+
echo "<a style='float: right' href='".get_bloginfo('url')."/wp-admin/edit.php?page=eventmanager.php&scope=$scope&offset=$forward'>>></a>";
|
980 |
+
echo "</div>" ;
|
981 |
+
}
|
982 |
+
?>
|
983 |
+
|
984 |
+
</div>
|
985 |
+
<?php
|
986 |
+
}
|
987 |
+
function dbem_event_form($event, $title, $element) {
|
988 |
+
?>
|
989 |
+
<form id="eventForm" method="post" action="edit.php?page=eventmanager.php&action=update_event&event_id=<?php echo "$element"?>">
|
990 |
+
<div class="wrap">
|
991 |
+
<h2><?php echo $title; ?></h2>
|
992 |
+
<div id="poststuff">
|
993 |
+
<div id="postbody">
|
994 |
+
<div id="event_name" class="stuffbox">
|
995 |
+
<h3><?php _e('Name','dbem'); ?></h3>
|
996 |
+
<div class="inside">
|
997 |
+
<input type="text" name="event_name" value="<?php echo $event['event_name'] ?>" /><br/>
|
998 |
+
<?php _e('The event name. Example: Birthday party', 'dbem') ?>
|
999 |
+
</div>
|
1000 |
+
</div>
|
1001 |
+
<div id="event_day" class="stuffbox">
|
1002 |
+
<h3><?php _e('Day and Time','dbem'); ?></h3>
|
1003 |
+
<div class="inside">
|
1004 |
+
<input type="text" size="3" maxlength="2" name="event_day" value="<?php echo $event['event_day']?>" /> /
|
1005 |
+
<input type="text" size="3" maxlength="2" name="event_month" value="<?php echo $event['event_month']?>" /> /
|
1006 |
+
<input type="text" size="5" maxlength="4" name="event_year" value="<?php echo $event['event_year'] ?>" /> - <input type="text" size="3" maxlength="2" name="event_hh" value="<?php echo $event['event_hh'] ?>" /> : <input type="text" size="3" maxlength="2" name="event_mm" value="<?php echo $event['event_mm'] ?>" /><br/>
|
1007 |
+
<!-- <input id="event_date" type="text" name="event_date" value="<?php //echo $event['event_date'] ?>" /><br/> -->
|
1008 |
+
<?php _e('The event day and time. Example: 21/11/2009 - 21:30', 'dbem') ?>
|
1009 |
+
</div>
|
1010 |
+
</div>
|
1011 |
+
<?php
|
1012 |
+
$gmap_is_active = get_option('dbem_gmap_is_active');
|
1013 |
+
if ($gmap_is_active) {
|
1014 |
+
echo "<div id='map-not-found' style='width: 450px; float: right; font-size: 140%; text-align: center; margin-top: 100px; display: hide'><p>".__('Map not found')."</p></div>";
|
1015 |
+
echo "<div id='event-map' style='width: 450px; height: 300px; background: green; float: right; display: hide; margin-right:8px'></div>";
|
1016 |
+
}
|
1017 |
+
?>
|
1018 |
+
<div id="event_town" class="stuffbox">
|
1019 |
+
<h3><?php _e('Town','dbem'); ?></h3>
|
1020 |
+
<div class="inside">
|
1021 |
+
<input id="town-input" type="text" name="event_town" value="<?php echo $event['event_town']?>" /><br/>
|
1022 |
+
<?php _e('The event town. Example: Verona. If you\' using the Google Map integration and want to avoid geotagging ambiguities include the country as well. Example: Verona, Italy', 'dbem') ?>
|
1023 |
+
</div>
|
1024 |
+
</div>
|
1025 |
+
<div id="event_venue" class="stuffbox">
|
1026 |
+
<h3><?php _e('Venue','dbem'); ?></h3>
|
1027 |
+
<div class="inside">
|
1028 |
+
<input id="venue-input" type="text" name="event_venue" value="<?php echo $event['event_venue']?>" /><br/>
|
1029 |
+
<?php _e('The venue where the event takes place. Example: Arena', 'dbem') ?>
|
1030 |
+
</div>
|
1031 |
+
</div>
|
1032 |
+
<div id="event_address" class="stuffbox">
|
1033 |
+
<h3><?php _e('Address','dbem'); ?></h3>
|
1034 |
+
<div class="inside">
|
1035 |
+
<input id="address-input" type="text" name="event_address" value="<?php echo $event['event_address']; ?>" /><br/>
|
1036 |
+
<?php _e('The address of the venue. Example: Via Mazzini 22', 'dbem') ?>
|
1037 |
+
</div>
|
1038 |
+
</div>
|
1039 |
+
<div id="event_notes" class="postbox closed">
|
1040 |
+
<h3><?php _e('Notes','dbem'); ?></h3>
|
1041 |
+
<div class="inside">
|
1042 |
+
<textarea name="event_notes" rows="8" cols="60"><?php echo $event['event_notes']; ?></textarea><br/>
|
1043 |
+
<?php _e('Notes about the event', 'dbem') ?>
|
1044 |
+
</div>
|
1045 |
+
</div>
|
1046 |
+
</div>
|
1047 |
+
</div>
|
1048 |
+
<p class="submit"><input type="submit" name="events_update" value="<?php _e('Submit Event','dbem'); ?> »" /></p>
|
1049 |
+
</div>
|
1050 |
+
</form>
|
1051 |
+
<?php
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
function dbem_validate_event($event) {
|
1055 |
+
// TODO decide which fields are required
|
1056 |
+
// Implement type check for dates, etc
|
1057 |
+
$required_fields = array('event_name');
|
1058 |
+
foreach ($required_fields as $field) {
|
1059 |
+
if ($event[$field] == "" ) {
|
1060 |
+
return "$field missing!";
|
1061 |
+
}
|
1062 |
+
}
|
1063 |
+
if (checkdate ((int)$event['event_month'], (int)$event['event_day'], (int)$event['event_year']) == FALSE) {
|
1064 |
+
return "invalid date!" ;
|
1065 |
+
}
|
1066 |
+
$time = $event['event_hh'].":".$event['event_mm'];
|
1067 |
+
if ($required_fields['event_hh'] && !preg_match ("/([01]\d|2[0-3])(:[0-5]\d){0,2}/", $time )) {
|
1068 |
+
//TODO sistema validate time
|
1069 |
+
}
|
1070 |
+
return "OK";
|
1071 |
+
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
|
1075 |
+
// Enqueing jQuery script to make sure it's loaded
|
1076 |
+
function dbem_enque_scripts(){
|
1077 |
+
wp_enqueue_script( 'jquery' );
|
1078 |
+
}
|
1079 |
+
add_action ('template_redirect', 'dbem_enque_scripts');
|
1080 |
+
|
1081 |
+
// General script to make sure hidden fields are shown when containing data
|
1082 |
+
function dbem_admin_general_script(){ ?>
|
1083 |
+
|
1084 |
+
<script type="text/javascript">
|
1085 |
+
//<![CDATA[
|
1086 |
+
// TODO: make more general, to support also latitude and longitude (when added)
|
1087 |
+
jQuery(document).ready( function() {
|
1088 |
+
jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
|
1089 |
+
if(jQuery("textarea[@name=event_notes]").val()!="") {
|
1090 |
+
jQuery("textarea[@name=event_notes]").parent().parent().removeClass('closed');
|
1091 |
+
}
|
1092 |
+
jQuery('#event_notes h3').click( function() {
|
1093 |
+
jQuery(jQuery(this).parent().get(0)).toggleClass('closed');
|
1094 |
+
});
|
1095 |
+
|
1096 |
+
|
1097 |
+
});
|
1098 |
+
//]]>
|
1099 |
+
</script>
|
1100 |
+
|
1101 |
+
<?php
|
1102 |
+
}
|
1103 |
+
add_action ('admin_head', 'dbem_admin_general_script');
|
1104 |
+
|
1105 |
+
|
1106 |
+
// Google maps implementation
|
1107 |
+
function dbem_map_script() {
|
1108 |
+
$gmap_is_active = get_option('dbem_gmap_is_active');
|
1109 |
+
if ($gmap_is_active) {
|
1110 |
+
if (strpos(get_option('dbem_single_event_format'), "#_MAP")) { // loading the script is useless unless #_MAP is in the format
|
1111 |
+
if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
|
1112 |
+
// single event page
|
1113 |
+
$event_ID=$_REQUEST['event_id'];
|
1114 |
+
$event = dbem_get_event($event_ID);
|
1115 |
+
if ($event->event_town != '') {
|
1116 |
+
$gmap_key = get_option('dbem_gmap_key');
|
1117 |
+
if($event->event_address != "") {
|
1118 |
+
$search_key = "$event->event_address, $event->event_town";
|
1119 |
+
} else {
|
1120 |
+
$search_key = "$event->event_venue, $event->event_town";
|
1121 |
+
}
|
1122 |
+
$map_text_format = get_option('dbem_map_text_format');
|
1123 |
+
$map_text = dbem_replace_placeholders($map_text_format, $event, "map");
|
1124 |
+
|
1125 |
+
?>
|
1126 |
+
|
1127 |
+
|
1128 |
+
<script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $gmap_key;?>" type="text/javascript"></script>
|
1129 |
+
<script type="text/javascript">
|
1130 |
+
//<![CDATA[
|
1131 |
+
$j=jQuery.noConflict();
|
1132 |
+
function loadMap() {
|
1133 |
+
if (GBrowserIsCompatible()) {
|
1134 |
+
var map = new GMap2(document.getElementById("event-map"));
|
1135 |
+
var mapTypeControl = new GLargeMapControl();
|
1136 |
+
var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
|
1137 |
+
map.addControl(mapTypeControl, topRight);
|
1138 |
+
|
1139 |
+
// map.addControl(new GLargeMapControl());
|
1140 |
+
//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
|
1141 |
+
var geocoder = new GClientGeocoder();
|
1142 |
+
var address = "<?php echo $search_key ?>" ;
|
1143 |
+
geocoder.getLatLng(
|
1144 |
+
address,
|
1145 |
+
function(point) {
|
1146 |
+
if (!point) {
|
1147 |
+
$j("#event-map").hide();
|
1148 |
+
} else {
|
1149 |
+
mapCenter= new GLatLng(point.lat()+0.01, point.lng()+0.005);
|
1150 |
+
map.setCenter(mapCenter, 13);
|
1151 |
+
var marker = new GMarker(point);
|
1152 |
+
map.addOverlay(marker);
|
1153 |
+
marker.openInfoWindowHtml('<?php echo $map_text;?>');
|
1154 |
+
}
|
1155 |
+
}
|
1156 |
+
);
|
1157 |
+
}
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
$j(document).ready(function() {
|
1161 |
+
if ($j("#event-map").length > 0 ) {
|
1162 |
+
loadMap();
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
});
|
1166 |
+
$j(document).unload(function() {
|
1167 |
+
if ($j("#event-map").length > 0 ) {
|
1168 |
+
GUnload();
|
1169 |
+
}
|
1170 |
+
});
|
1171 |
+
//]]>
|
1172 |
+
</script>
|
1173 |
+
<?php
|
1174 |
+
}
|
1175 |
+
}
|
1176 |
+
}
|
1177 |
+
}
|
1178 |
+
}
|
1179 |
+
add_action ('wp_head', 'dbem_map_script');
|
1180 |
+
|
1181 |
+
function dbem_admin_map_script() {
|
1182 |
+
?>
|
1183 |
+
|
1184 |
+
|
1185 |
+
|
1186 |
+
|
1187 |
+
<?php
|
1188 |
+
if (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
|
1189 |
+
// single event page
|
1190 |
+
$event_ID=$_REQUEST['event_id'];
|
1191 |
+
$event = dbem_get_event($event_ID);
|
1192 |
+
if ($event->event_town != '') {
|
1193 |
+
$gmap_key = get_option('dbem_gmap_key');
|
1194 |
+
if($event->event_address != "") {
|
1195 |
+
$search_key = "$event->event_address, $event->event_town";
|
1196 |
+
} else {
|
1197 |
+
$search_key = "$event->event_venue, $event->event_town";
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
?>
|
1201 |
+
<style type="text/css">
|
1202 |
+
div#event_town, div#event_address, div#event_venue {
|
1203 |
+
width: 480px;
|
1204 |
+
}
|
1205 |
+
</style>
|
1206 |
+
<script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $gmap_key;?>" type="text/javascript"></script>
|
1207 |
+
<script type="text/javascript">
|
1208 |
+
//<![CDATA[
|
1209 |
+
$j=jQuery.noConflict();
|
1210 |
+
|
1211 |
+
function loadMap(venue, town, address) {
|
1212 |
+
if (GBrowserIsCompatible()) {
|
1213 |
+
var map = new GMap2(document.getElementById("event-map"));
|
1214 |
+
// map.addControl(new GScaleControl());
|
1215 |
+
//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
|
1216 |
+
var geocoder = new GClientGeocoder();
|
1217 |
+
if (address !="") {
|
1218 |
+
searchKey = address + ", " + town;
|
1219 |
+
} else {
|
1220 |
+
searchKey = venue + ", " * town;
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
var search = "<?php echo $search_key ?>" ;
|
1224 |
+
geocoder.getLatLng(
|
1225 |
+
searchKey,
|
1226 |
+
function(point) {
|
1227 |
+
if (!point) {
|
1228 |
+
$j("#event-map").hide();
|
1229 |
+
$j('#map-not-found').show();
|
1230 |
+
} else {
|
1231 |
+
mapCenter= new GLatLng(point.lat()+0.01, point.lng()+0.005);
|
1232 |
+
map.setCenter(mapCenter, 13);
|
1233 |
+
var marker = new GMarker(point);
|
1234 |
+
map.addOverlay(marker);
|
1235 |
+
marker.openInfoWindowHtml('<strong>' + venue +'</strong><p>' + address + '</p><p>' + town + '</p>');
|
1236 |
+
$j("#event-map").show();
|
1237 |
+
$j('#map-not-found').hide();
|
1238 |
+
}
|
1239 |
+
}
|
1240 |
+
);
|
1241 |
+
// map.addControl(new GSmallMapControl());
|
1242 |
+
// map.addControl(new GMapTypeControl());
|
1243 |
+
|
1244 |
+
}
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
$j(document).ready(function() {
|
1248 |
+
eventVenue = $j("#venue-input").val();
|
1249 |
+
|
1250 |
+
eventTown = $j("#town-input").val();
|
1251 |
+
eventAddress = $j("#address-input").val();
|
1252 |
+
|
1253 |
+
loadMap(eventVenue, eventTown, eventAddress);
|
1254 |
+
|
1255 |
+
$j("#venue-input").blur(function(){
|
1256 |
+
newEventVenue = $j("#venue-input").val();
|
1257 |
+
if (newEventVenue !=eventVenue) {
|
1258 |
+
loadMap(newEventVenue, eventTown, eventAddress);
|
1259 |
+
eventVenue = newEventVenue;
|
1260 |
+
|
1261 |
+
}
|
1262 |
+
});
|
1263 |
+
$j("#town-input").blur(function(){
|
1264 |
+
newEventTown = $j("#town-input").val();
|
1265 |
+
if (newEventTown !=eventTown) {
|
1266 |
+
loadMap(eventVenue, newEventTown, eventAddress);
|
1267 |
+
eventTown = newEventTown;
|
1268 |
+
}
|
1269 |
+
});
|
1270 |
+
$j("#address-input").blur(function(){
|
1271 |
+
newEventAddress = $j("#address-input").val();
|
1272 |
+
if (newEventAddress != eventAddress) {
|
1273 |
+
loadMap(eventVenue, eventTown, newEventAddress);
|
1274 |
+
eventAddress = newEventAddress;
|
1275 |
+
}
|
1276 |
+
});
|
1277 |
+
|
1278 |
+
|
1279 |
+
|
1280 |
+
});
|
1281 |
+
$j(document).unload(function() {
|
1282 |
+
GUnload();
|
1283 |
+
});
|
1284 |
+
//]]>
|
1285 |
+
</script>
|
1286 |
+
<?php
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
}
|
1290 |
+
$gmap_is_active = get_option('dbem_gmap_is_active');
|
1291 |
+
if ($gmap_is_active)
|
1292 |
+
add_action ('admin_head', 'dbem_admin_map_script');
|
1293 |
+
|
1294 |
+
// Script to validate map options
|
1295 |
+
function dbem_admin_options_script() {
|
1296 |
+
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'events-manager/events-manager.php') {
|
1297 |
+
?>
|
1298 |
+
<script type="text/javascript">
|
1299 |
+
//<![CDATA[
|
1300 |
+
$j=jQuery.noConflict();
|
1301 |
+
|
1302 |
+
$j(document).ready(function() {
|
1303 |
+
// users cannot enable Googlr Maps without an api key
|
1304 |
+
function verifyOptionsForm(){
|
1305 |
+
var gmap_is_active = $j("input[@name=dbem_gmap_is_active]:checked").val();
|
1306 |
+
var gmap_key = $j("input[@name=dbem_gmap_key]").val();
|
1307 |
+
if(gmap_is_active == '1' && (gmap_key == '')){
|
1308 |
+
alert("<?php _e('You cannot enable Google Maps integration without setting an appropriate API key.');?>");
|
1309 |
+
$j("input[@name='dbem_gmap_is_active']:nth(1)").attr("checked","checked");
|
1310 |
+
|
1311 |
+
return false;
|
1312 |
+
} else {
|
1313 |
+
return true;
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
$j('#dbem_options_form').bind("submit", verifyOptionsForm);
|
1318 |
+
|
1319 |
+
|
1320 |
+
});
|
1321 |
+
|
1322 |
+
|
1323 |
+
//]]>
|
1324 |
+
</script>
|
1325 |
+
|
1326 |
+
<?php
|
1327 |
+
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
}
|
1331 |
+
add_action ('admin_head', 'dbem_admin_options_script');
|
1332 |
+
|
1333 |
+
function dbem_rss_link($justurl=false) {
|
1334 |
+
$rss_title = get_option('dbem_events_page_title');
|
1335 |
+
$url = get_bloginfo('url')."/?dbem_rss=main";
|
1336 |
+
$link = "<a href='$url'>RSS</a>";
|
1337 |
+
if ($justurl)
|
1338 |
+
echo $url;
|
1339 |
+
else
|
1340 |
+
echo $link;
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
function dbem_rss() {
|
1344 |
+
if (isset($_REQUEST['dbem_rss']) && $_REQUEST['dbem_rss'] == 'main') {
|
1345 |
+
header("Content-type: text/xml");
|
1346 |
+
echo "<?xml version='1.0'?>\n";
|
1347 |
+
|
1348 |
+
$events_page_id = get_option('dbem_events_page');
|
1349 |
+
$events_page_link = get_permalink($events_page_id);
|
1350 |
+
if (stristr($events_page_link, "?"))
|
1351 |
+
$joiner = "&";
|
1352 |
+
else
|
1353 |
+
$joiner = "?";
|
1354 |
+
|
1355 |
+
|
1356 |
+
?>
|
1357 |
+
<rss version="2.0">
|
1358 |
+
<channel>
|
1359 |
+
<title><?php echo get_option('dbem_rss_main_title');?></title>
|
1360 |
+
<link><?php echo $events_page_link; ?></link>
|
1361 |
+
<description><?php echo get_option('dbem_rss_main_description');?></description>
|
1362 |
+
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
1363 |
+
<generator>Weblog Editor 2.0</generator>
|
1364 |
+
<?php
|
1365 |
+
$title_format = get_option('dbem_rss_title_format');
|
1366 |
+
$description_format = str_replace(">",">",str_replace("<","<",get_option('dbem_rss_description_format')));
|
1367 |
+
$events = dbem_get_events(5);
|
1368 |
+
foreach ($events as $event) {
|
1369 |
+
$title = dbem_replace_placeholders($title_format, $event, "rss");
|
1370 |
+
$description = dbem_replace_placeholders($description_format, $event, "rss");
|
1371 |
+
echo "<item>";
|
1372 |
+
echo "<title>$title</title>\n";
|
1373 |
+
echo "<link>$events_page_link".$joiner."event_id=$event->event_id</link>\n ";
|
1374 |
+
echo "<description>$description </description>\n";
|
1375 |
+
echo "</item>";
|
1376 |
+
}
|
1377 |
+
?>
|
1378 |
+
|
1379 |
+
</channel>
|
1380 |
+
</rss>
|
1381 |
+
</code>
|
1382 |
+
|
1383 |
+
<?php
|
1384 |
+
die();
|
1385 |
+
}
|
1386 |
+
}
|
1387 |
+
add_action('init','dbem_rss');
|
1388 |
+
function substitute_rss($data) {
|
1389 |
+
if (isset($_REQUEST['event_id']))
|
1390 |
+
return get_bloginfo('url')."/?dbem_rss=main";
|
1391 |
+
else
|
1392 |
+
return $data;
|
1393 |
+
}
|
1394 |
+
//add_filter('feed_link','substitute_rss')
|
1395 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Events Manager ===
|
2 |
+
Contributors: nutsmuggler
|
3 |
+
Tags: events
|
4 |
+
Requires at least: 2.5.1
|
5 |
+
Tested up to: 2.6
|
6 |
+
Stable tag: 1.0
|
7 |
+
Donate link: http://davidebenini.it/wordpress-plugins/
|
8 |
+
|
9 |
+
Manage events and display them in your blog. Includes lists, calendar, Google map integration and sidebar widgets.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Events Manager is a plugin to manage events such as music gigs, art expositions, or even job meetings. Events Manager inserts an *Events* page in the *Manage* menu of Wordpress Administration, to let you insert, modify and delete events. You can describe events specifying their date and location, and also add a few notes. You can then add events list, calendars and description to your blog using a sidebar widget; if you're web designer you can simply employ the template tags provided by Events Manager.
|
14 |
+
|
15 |
+
Events Manager integrates with Google Maps; thanks the geocoding, Events Manager can find the location of your events, and accordingly display a map. To enable Google Maps integration, you need a Google maps API key, which you can obtain freely at the [Google Maps API Signup Page](http://code.google.com/apis/maps/signup.html).
|
16 |
+
|
17 |
+
Events Manager provides also a RSS feed, to keep your subscribers updated about the events you're organising.
|
18 |
+
|
19 |
+
Events manager is fully customisable; you can customise the amount of data displayed and their format in events lists, pages and in the RSS feed. You can choose to show or hide the events page, and change its title.
|
20 |
+
|
21 |
+
Events Manager is fully localisable. I have added an Italian localisation, and I'd welcome any translator willing to localise this plugin into his mother tongue.
|
22 |
+
|
23 |
+
== Installation ==
|
24 |
+
|
25 |
+
|
26 |
+
1. Upload the `events-manager` folder to the `/wp-content/plugins/` directory
|
27 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
28 |
+
3. Add events list or calendars following the instructions in the Usage section.
|
29 |
+
|
30 |
+
== Usage ==
|
31 |
+
|
32 |
+
After the installation, Events Manager adds two pages to your Wordpress Administration.
|
33 |
+
|
34 |
+
* Manage/Events is the page where you add, delete or modify events. You will see three pre-installed events in this page. Delete them and add your events own events. Choose between the visualisation of present/past/all events.
|
35 |
+
* Settings/Events Manager is where you set the Events Manager options. The page fields contain a description of their use; for more information, see *Formatting the events*.
|
36 |
+
|
37 |
+
Events list and calendars can be added to your blogs through widgets or template tags.
|
38 |
+
|
39 |
+
= Widgets =
|
40 |
+
|
41 |
+
Add the Events List or Events Calendar widgets to any of your sidebar. To do so, your theme might be [widget-ready](http://automattic.com/code/widgets/). You can change the title of both widgets. Moreover, you can adjust the formats of the events of Events List according to your need; see *Formatting Events*.
|
42 |
+
|
43 |
+
|
44 |
+
= Template tags =
|
45 |
+
|
46 |
+
If you're into theming, you should probably use the template tags provided by Events Manager, `dbem_get_events_list`, `dbem_get_calendar` and `dbem_get_events_page`.
|
47 |
+
|
48 |
+
`<?php dbem_get_events_list(limit, scope, order, format,display); ?>`
|
49 |
+
|
50 |
+
Prints or returns a list of the events. Accepts up to five optional parameters:
|
51 |
+
|
52 |
+
* `limit` indicates the maximum number of events to display. Default is 3.
|
53 |
+
* `scope` indicates lets you choose whether to show `future`, `past` or `all` events. Default is `future`.
|
54 |
+
* `order` indicates indicates the order of the events. Choose between ASC (ascendant, default) and DESC (descendant).
|
55 |
+
* `format`: the format of each item. If not specified, Events Manager will use the format specified in the *Default event list format* setting of the setting page.
|
56 |
+
* `display` indicates whether the list should be printed (`true`) or just returned (`false`). This option should be ignored, unless you know what you are doing.
|
57 |
+
|
58 |
+
Example: `dbem_get_events_list(5, "all", "DESC")` will print a list of the latest 5 events, including past ones, in a descendant order.
|
59 |
+
|
60 |
+
|
61 |
+
`<?php dbem_get_calendar(); ?>`
|
62 |
+
|
63 |
+
Prints the current month calendar, highlighting any event and linking to it. Accepts no parameters.
|
64 |
+
|
65 |
+
`<?php dbem_get_events_page(justurl) ?>`
|
66 |
+
|
67 |
+
Prints a link to the events page. If you set the optional `justurl` property to `true`, the function only prints the URL of the events page.
|
68 |
+
|
69 |
+
`<? dbem_rss_link(justurl) ?>`
|
70 |
+
Prints a the link to the events RSS. If you set the optional `justurl` property to `true`, the function only prints the RSS URL.
|
71 |
+
|
72 |
+
|
73 |
+
== Formatting the events ==
|
74 |
+
|
75 |
+
Events Manager lets you choose the format of the events displayed in your list and pages. Navigate to Settings/Events Manager and set the format of events in list; the format of the list widget is set directly in the widget settings.
|
76 |
+
|
77 |
+
The syntax of events format is quite simple. Basically, just write your html code in the usual way. Then you can add a number of placeholders corresponding to the data of the event. They are:
|
78 |
+
|
79 |
+
* `#_NAME` displays the name of the event
|
80 |
+
* `#_VENUE` displays the venue (theatre, pub, etc)
|
81 |
+
* `#_ADDRESS` displays the address
|
82 |
+
* `#_TOWN` displays the town
|
83 |
+
* `#_LINKEDNAME` displays the event name with a link to the event page
|
84 |
+
* `#_URL` simply prints the events URL. You can use this placeholder to build your own customised links
|
85 |
+
|
86 |
+
|
87 |
+
To add temporal information about the events, use [PHP syntax format characters](http://www.php.net/manual/en/function.date.php) with a # before them. For example:
|
88 |
+
|
89 |
+
* `#d` displays a Day of the month, with 2 digits with leading zeros
|
90 |
+
* `#m` displas short textual representation of a month, three letters (*jan* through *dec*)
|
91 |
+
* etc
|
92 |
+
|
93 |
+
If you have enabled the Google Map integration, you can use #_MAP to display a map; this placeholder, of course, shouldn't generally be used for list items.
|
94 |
+
|
95 |
+
== Google Maps Integration ==
|
96 |
+
|
97 |
+
To use Google Maps with Events Manager, you need a Goggle Map API key. Don't worry, it's free, you can get one [here](http://code.google.com/apis/maps/signup.html).
|
98 |
+
|
99 |
+
Once you have got you API key, go to *Settings/Events Manager*, insert you key in the *Google Maps API Key* field and set *Enable Google Maps integration?* to *Yes*.
|
100 |
+
|
101 |
+
Now you just need to put a the #_MAP placeholder in the *Default single event format*, and your map will show in the page dedicated to the event.
|
102 |
+
|
103 |
+
To resize the map, simply tweak the `#event-map` in your css.
|
104 |
+
|
105 |
+
== Frequently Asked Questions ==
|
106 |
+
|
107 |
+
= How does Events Manager work? =
|
108 |
+
|
109 |
+
When installed, events Manager creates a special "Events" page. This page is used for the dynamic content of the events. All the events link actually link to this page, which gets rendered differently for each event.
|
110 |
+
|
111 |
+
= Can further I customise the event page? =
|
112 |
+
|
113 |
+
Sure, you can do that by editing the page and changing its [template](http://codex.wordpress.org/Pages#Page_Templates).
|
114 |
+
|
115 |
+
= Can further I customise the event lists, etc? =
|
116 |
+
|
117 |
+
Yes, you can use css to match the id and classes of the events markup.
|
118 |
+
|
119 |
+
= Are events posts? =
|
120 |
+
|
121 |
+
Events aren't posts. They are stored in a different table and have no relationship whatsoever with posts.
|
122 |
+
|
123 |
+
= Why aren't events posts? =
|
124 |
+
|
125 |
+
I decided to treat events as a separate class because my priority was the usability of the user interface in the administration; I wanted my users to have a simple, straightforward way of inserting the events, without confusing them with posts. I wanted to make my own simple event form.
|
126 |
+
If you need to treat events like posts, you should use one of the other excellent events plugin.
|
127 |
+
|
128 |
+
= Is Events Manager available in my language? =
|
129 |
+
|
130 |
+
At this stage, Events Manager is only available in English and Italian. Yet, the plugin is fully localisable; I will welcome any translator willing to add to this package a translation of Events Manager into his mother tongue.
|
131 |
+
|
132 |
+
== Screenshots ==
|
133 |
+
|
134 |
+
1. A default event page with a map automatically pulled from Google Maps through the #_MAP placeholder.
|
135 |
+
2. The events management page.
|
136 |
+
3. The Events Manager Options page.
|
137 |
+
|
138 |
+
== Future features ==
|
139 |
+
|
140 |
+
This is a short list of the features that I intend to implement:
|
141 |
+
|
142 |
+
* Javascript datepicker
|
143 |
+
* End dates; events will have a beginning and (optionally) an ending
|
144 |
+
|
145 |
+
I have other ideas in the pipeline, but I'll stick to this ones and implement them first.
|
146 |
+
|
147 |
+
== Change Log ==
|
148 |
+
|
149 |
+
1.0b1
|
150 |
+
Fixed a small bug which prevented the loading of default options in the plugin.
|
151 |
+
|
152 |
+
1.0b2
|
153 |
+
Added a `#_URL` placeholder.
|
154 |
+
|
155 |
+
1.0b3
|
156 |
+
Fixed a small ampersand bug which prevented validation.
|
157 |
+
|
158 |
+
1.0b4
|
159 |
+
Permalinks now properly working.
|
160 |
+
Text now uses wordpress filters.
|
161 |
+
Map #_NOTES bug fixed; maps better centred.
|
162 |
+
|
163 |
+
1.0b5
|
164 |
+
Fixed a bug that caused trouble in the new post page javascript
|
165 |
+
|
166 |
+
1.0
|
167 |
+
No changes, only made this plugin officially out of beta after weeks without any bug popping out.
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|