Version Description
Download this release
Release Info
Developer | nutsmuggler |
Plugin | Events Manager |
Version | 2.0b2 |
Comparing to | |
See all releases |
Code changes from version 2.0b1 to 2.0b2
- dbem_calendar.php +117 -36
- dbem_events.php +1 -1
- dbem_locations.php +7 -7
- events-manager.php +8 -3
- readme.txt +5 -5
dbem_calendar.php
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function dbem_get_calendar_shortcode($atts) {
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
return $result;
|
6 |
}
|
7 |
add_shortcode('events_calendar', 'dbem_get_calendar_shortcode');
|
@@ -11,17 +15,28 @@ function dbem_get_calendar($args="") {
|
|
11 |
'month' => '',
|
12 |
'echo' => 1
|
13 |
);
|
14 |
-
|
15 |
extract( $r, EXTR_SKIP );
|
16 |
$month = $r['month'];
|
17 |
$echo = $r['echo'];
|
18 |
|
19 |
-
global $wpdb;
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
$day = date('d', $date);
|
23 |
-
$month = date('m', $date);
|
24 |
-
$year = date('Y', $date);
|
25 |
// Get the first day of the month
|
26 |
$month_start = mktime(0,0,0,$month, 1, $year);
|
27 |
// Get friendly month name
|
@@ -108,30 +123,34 @@ function dbem_get_calendar($args="") {
|
|
108 |
|
109 |
|
110 |
// Build Previous and Next Links
|
111 |
-
$
|
|
|
112 |
if($month == 1){
|
113 |
-
|
|
|
114 |
} else {
|
115 |
-
$
|
|
|
116 |
}
|
117 |
-
$previous_link
|
118 |
|
119 |
-
$next_link = "<a href=\"".$_SERVER['PHP_SELF']."?date=";
|
120 |
if($month == 12){
|
121 |
-
$
|
|
|
122 |
} else {
|
123 |
-
$
|
|
|
124 |
}
|
125 |
-
$next_link
|
126 |
-
|
127 |
-
$calendar="<div id='dbem-calendar'>";
|
128 |
|
129 |
$days_initials = "<td>".dbem_translate_and_trim("Monday")."</td><td>".dbem_translate_and_trim("Tuesday")."</td><td>".dbem_translate_and_trim("Wednesday")."</td><td>".dbem_translate_and_trim("Thursday")."</td><td>".dbem_translate_and_trim("Friday")."</td><td>".dbem_translate_and_trim("Saturday")."</td><td>".dbem_translate_and_trim("Sunday")."</td>\n";
|
130 |
|
131 |
// Build the heading portion of the calendar table
|
132 |
-
$calendar .= "<table
|
133 |
"<thead>\n<tr>\n".
|
134 |
-
"<td colspan='
|
135 |
"</tr>\n</thead>\n".
|
136 |
"<tr class='days-names'>\n".
|
137 |
$days_initials.
|
@@ -166,16 +185,7 @@ function dbem_get_calendar($args="") {
|
|
166 |
}
|
167 |
$calendar .= "</tr>\n";
|
168 |
}
|
169 |
-
|
170 |
-
// "<td colspan='7'>\n".
|
171 |
-
// "<table align='center'>\n".
|
172 |
-
// "<tr class='month-navigation'>\n".
|
173 |
-
// "<td class='previous-month' colspan='2' align='left'>$previous_link</td>\n".
|
174 |
-
// "<td colspan='3'> </td>".
|
175 |
-
// "<td class='next-month' colspan='2' align='right'>$next_link</td>\n".
|
176 |
-
// "</tr>\n".
|
177 |
-
// "</table>\n".
|
178 |
-
// "</td>\n</tr>\n";
|
179 |
$calendar .= " </table>\n</div>";
|
180 |
|
181 |
// query the database for events in this time span
|
@@ -269,24 +279,24 @@ function dbem_days_in_month($month, $year) {
|
|
269 |
function dbem_calendar_style() {
|
270 |
?>
|
271 |
<style type="text/css">
|
272 |
-
|
273 |
padding: 2px 4px;
|
274 |
text-align: center;
|
275 |
}
|
276 |
-
|
277 |
font-weight: bold;
|
278 |
}
|
279 |
-
|
280 |
color: #ccc;
|
281 |
}
|
282 |
-
|
283 |
font-weight: bold;
|
284 |
color: #FD7E29;
|
285 |
}
|
286 |
-
|
287 |
background-color: #CFCFCF;
|
288 |
}
|
289 |
-
|
290 |
font-size: 120%;
|
291 |
font-weight: bold;
|
292 |
}
|
@@ -297,5 +307,76 @@ add_action('wp_head', 'dbem_calendar_style');
|
|
297 |
|
298 |
function dbem_translate_and_trim($string, $length = 1) {
|
299 |
return substr(__($string), 0, $length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
}
|
|
|
301 |
?>
|
1 |
<?php
|
2 |
|
3 |
+
function dbem_get_calendar_shortcode($atts) {
|
4 |
+
extract(shortcode_atts(array(
|
5 |
+
'month' => '',
|
6 |
+
'year' => '',
|
7 |
+
), $atts));
|
8 |
+
$result = dbem_get_calendar("month={$month}&year={$year}&echo=0");
|
9 |
return $result;
|
10 |
}
|
11 |
add_shortcode('events_calendar', 'dbem_get_calendar_shortcode');
|
15 |
'month' => '',
|
16 |
'echo' => 1
|
17 |
);
|
18 |
+
$r = wp_parse_args( $args, $defaults );
|
19 |
extract( $r, EXTR_SKIP );
|
20 |
$month = $r['month'];
|
21 |
$echo = $r['echo'];
|
22 |
|
23 |
+
global $wpdb;
|
24 |
+
if(isset($_GET['calmonth']) && $_GET['calmonth'] != '') {
|
25 |
+
$month = $_GET['calmonth'] ;
|
26 |
+
} else {
|
27 |
+
if ($month == '')
|
28 |
+
$month = date('m');
|
29 |
+
}
|
30 |
+
if(isset($_GET['calyear']) && $_GET['calyear'] != '') {
|
31 |
+
$year = $_GET['calyear'] ;
|
32 |
+
} else {
|
33 |
+
if ($year == '')
|
34 |
+
$year = date('Y');
|
35 |
+
}
|
36 |
+
$date = mktime(0,0,0,$month, date('d'), $year);
|
37 |
$day = date('d', $date);
|
38 |
+
// $month = date('m', $date);
|
39 |
+
// $year = date('Y', $date);
|
40 |
// Get the first day of the month
|
41 |
$month_start = mktime(0,0,0,$month, 1, $year);
|
42 |
// Get friendly month name
|
123 |
|
124 |
|
125 |
// Build Previous and Next Links
|
126 |
+
$base_link = "?".$_SERVER['QUERY_STRING']."&";
|
127 |
+
|
128 |
if($month == 1){
|
129 |
+
$back_month = 12;
|
130 |
+
$back_year = $year-1;
|
131 |
} else {
|
132 |
+
$back_month = $month -1;
|
133 |
+
$back_year = $year;
|
134 |
}
|
135 |
+
$previous_link = "<a class='prev-month' href=\"".$base_link."calmonth={$back_month}&calyear={$back_year} \"><<</a>";
|
136 |
|
|
|
137 |
if($month == 12){
|
138 |
+
$next_month = 1;
|
139 |
+
$next_year = $year+1;
|
140 |
} else {
|
141 |
+
$next_month = $month + 1;
|
142 |
+
$next_year = $year;
|
143 |
}
|
144 |
+
$next_link = "<a class='next-month' href=\"".$base_link."calmonth={$next_month}&calyear={$next_year} \">>></a>";
|
145 |
+
$random = (rand(100,200));
|
146 |
+
$calendar="<div class='dbem-calendar' id='dbem-calendar-$random'><div style='display:none' class='month_n'>$month</div><div class='year_n' style='display:none' >$year</div>";
|
147 |
|
148 |
$days_initials = "<td>".dbem_translate_and_trim("Monday")."</td><td>".dbem_translate_and_trim("Tuesday")."</td><td>".dbem_translate_and_trim("Wednesday")."</td><td>".dbem_translate_and_trim("Thursday")."</td><td>".dbem_translate_and_trim("Friday")."</td><td>".dbem_translate_and_trim("Saturday")."</td><td>".dbem_translate_and_trim("Sunday")."</td>\n";
|
149 |
|
150 |
// Build the heading portion of the calendar table
|
151 |
+
$calendar .= "<table class='dbem-calendar-table'>\n".
|
152 |
"<thead>\n<tr>\n".
|
153 |
+
"<td>$previous_link</td><td colspan='5'>$month_name $year</td><td>$next_link\n".
|
154 |
"</tr>\n</thead>\n".
|
155 |
"<tr class='days-names'>\n".
|
156 |
$days_initials.
|
185 |
}
|
186 |
$calendar .= "</tr>\n";
|
187 |
}
|
188 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
$calendar .= " </table>\n</div>";
|
190 |
|
191 |
// query the database for events in this time span
|
279 |
function dbem_calendar_style() {
|
280 |
?>
|
281 |
<style type="text/css">
|
282 |
+
table.dbem-calendar-table td {
|
283 |
padding: 2px 4px;
|
284 |
text-align: center;
|
285 |
}
|
286 |
+
table.dbem-calendar.table tr.days-names {
|
287 |
font-weight: bold;
|
288 |
}
|
289 |
+
table.dbem-calendar-table td.eventless-pre, .dbem-calendar td.eventless-post {
|
290 |
color: #ccc;
|
291 |
}
|
292 |
+
table.dbem-calendar-table td.eventful a {
|
293 |
font-weight: bold;
|
294 |
color: #FD7E29;
|
295 |
}
|
296 |
+
table.dbem-calendar-table td.eventless-today {
|
297 |
background-color: #CFCFCF;
|
298 |
}
|
299 |
+
table.dbem-calendar-table thead {
|
300 |
font-size: 120%;
|
301 |
font-weight: bold;
|
302 |
}
|
307 |
|
308 |
function dbem_translate_and_trim($string, $length = 1) {
|
309 |
return substr(__($string), 0, $length);
|
310 |
+
}
|
311 |
+
|
312 |
+
function dbem_ajaxize_calendar()
|
313 |
+
{ ?>
|
314 |
+
<script type='text/javascript'>
|
315 |
+
$j=jQuery.noConflict();
|
316 |
+
|
317 |
+
|
318 |
+
$j(document).ready( function() {
|
319 |
+
initCalendar();
|
320 |
+
});
|
321 |
+
|
322 |
+
function initCalendar() {
|
323 |
+
$j('a.prev-month').click(function(e){
|
324 |
+
e.preventDefault();
|
325 |
+
tableDiv = $j(this).parents('table').parent();
|
326 |
+
prevMonthCalendar(tableDiv);
|
327 |
+
} );
|
328 |
+
$j('a.next-month').click(function(e){
|
329 |
+
e.preventDefault();
|
330 |
+
tableDiv = $j(this).parents('table').parent();
|
331 |
+
nextMonthCalendar(tableDiv);
|
332 |
+
} );
|
333 |
+
}
|
334 |
+
function prevMonthCalendar(tableDiv) {
|
335 |
+
month_n = tableDiv.children('div.month_n').html();
|
336 |
+
year_n = tableDiv.children('div.year_n').html();
|
337 |
+
parseInt(month_n) == 1 ? prevMonth = 12 : prevMonth = parseInt(month_n) - 1 ;
|
338 |
+
if (parseInt(month_n) == 1)
|
339 |
+
year_n = parseInt(year_n) -1;
|
340 |
+
$j.get("<?php bloginfo('url'); ?>", {ajaxCalendar: 'true', calmonth: prevMonth, calyear: year_n}, function(data){
|
341 |
+
tableDiv.html(data);
|
342 |
+
initCalendar();
|
343 |
+
});
|
344 |
+
}
|
345 |
+
function nextMonthCalendar(tableDiv) {
|
346 |
+
month_n = tableDiv.children('div.month_n').html();
|
347 |
+
year_n = tableDiv.children('div.year_n').html();
|
348 |
+
parseInt(month_n) == 12 ? nextMonth = 1 : nextMonth = parseInt(month_n) + 1 ;
|
349 |
+
if (parseInt(month_n) == 12)
|
350 |
+
year_n = parseInt(year_n) + 1;
|
351 |
+
$j.get("<?php bloginfo('url'); ?>", {ajaxCalendar: 'true', calmonth: nextMonth, calyear: year_n}, function(data){
|
352 |
+
tableDiv.html(data);
|
353 |
+
initCalendar();
|
354 |
+
});
|
355 |
+
}
|
356 |
+
|
357 |
+
// function reloadCalendar(e) {
|
358 |
+
// // e.preventDefault();
|
359 |
+
// console.log($j(this).parents('table'));
|
360 |
+
// $j.get("<?php bloginfo('url'); ?>", {ajax: 'true'}, function(data){
|
361 |
+
// tableDiv = table.parent();
|
362 |
+
// tableDiv.html(data);
|
363 |
+
// });
|
364 |
+
// }
|
365 |
+
//
|
366 |
+
|
367 |
+
</script>
|
368 |
+
|
369 |
+
<?php
|
370 |
+
}
|
371 |
+
add_action('wp_head', 'dbem_ajaxize_calendar');
|
372 |
+
|
373 |
+
function dbem_filter_calendar_ajax() {
|
374 |
+
if(isset($_GET['ajaxCalendar']) && $_GET['ajaxCalendar'] == true) {
|
375 |
+
$month = $_GET['month'];
|
376 |
+
$year = $_GET['year'];
|
377 |
+
dbem_get_calendar('echo=1');
|
378 |
+
die();
|
379 |
+
}
|
380 |
}
|
381 |
+
add_action('init','dbem_filter_calendar_ajax');
|
382 |
?>
|
dbem_events.php
CHANGED
@@ -96,7 +96,7 @@ function dbem_events_subpanel() {
|
|
96 |
$location['location_longitude']=$_POST[location_longitude];
|
97 |
$location['location_description']="";
|
98 |
$event['event_notes']=stripslashes($_POST[event_notes]);
|
99 |
-
$recurrence['recurrence_notes']=$
|
100 |
$validation_result = dbem_validate_event($event);
|
101 |
|
102 |
|
96 |
$location['location_longitude']=$_POST[location_longitude];
|
97 |
$location['location_description']="";
|
98 |
$event['event_notes']=stripslashes($_POST[event_notes]);
|
99 |
+
$recurrence['recurrence_notes']=$event['event_notes'];
|
100 |
$validation_result = dbem_validate_event($event);
|
101 |
|
102 |
|
dbem_locations.php
CHANGED
@@ -571,12 +571,12 @@ function dbem_replace_locations_placeholders($format, $location, $target="html")
|
|
571 |
}
|
572 |
if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
|
573 |
$events_page_link = dbem_get_events_page(true, false);
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
}
|
581 |
|
582 |
}
|
@@ -585,7 +585,7 @@ function dbem_replace_locations_placeholders($format, $location, $target="html")
|
|
585 |
}
|
586 |
function dbem_single_location_map($location) {
|
587 |
$gmap_is_active = get_option('dbem_gmap_is_active');
|
588 |
-
$map_text = dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location);
|
589 |
if ($gmap_is_active) {
|
590 |
$gmaps_key = get_option('dbem_gmap_key');
|
591 |
$map_div = "<div id='dbem-location-map' style=' background: green; width: 400px; height: 300px'></div>" ;
|
571 |
}
|
572 |
if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
|
573 |
$events_page_link = dbem_get_events_page(true, false);
|
574 |
+
if (stristr($events_page_link, "?"))
|
575 |
+
$joiner = "&";
|
576 |
+
else
|
577 |
+
$joiner = "?";
|
578 |
+
$venue_page_link = dbem_get_events_page(true, false).$joiner."location_id=".$location['location_id'];
|
579 |
+
$location_string = str_replace($result, $venue_page_link , $location_string );
|
580 |
}
|
581 |
|
582 |
}
|
585 |
}
|
586 |
function dbem_single_location_map($location) {
|
587 |
$gmap_is_active = get_option('dbem_gmap_is_active');
|
588 |
+
$map_text = addslashes(dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location));
|
589 |
if ($gmap_is_active) {
|
590 |
$gmaps_key = get_option('dbem_gmap_key');
|
591 |
$map_div = "<div id='dbem-location-map' style=' background: green; width: 400px; height: 300px'></div>" ;
|
events-manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
-
Version: 2.
|
5 |
Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
|
6 |
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
|
7 |
Author: Davide Benini
|
@@ -580,8 +580,13 @@ function dbem_replace_placeholders($format, $event, $target="html") {
|
|
580 |
$event_string = str_replace($result, $location_image , $event_string );
|
581 |
}
|
582 |
|
583 |
-
if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
|
584 |
-
|
|
|
|
|
|
|
|
|
|
|
585 |
$event_string = str_replace($result, $venue_page_link , $event_string );
|
586 |
}
|
587 |
// matches all PHP time placeholders for endtime
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
+
Version: 2.0b2
|
5 |
Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
|
6 |
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
|
7 |
Author: Davide Benini
|
580 |
$event_string = str_replace($result, $location_image , $event_string );
|
581 |
}
|
582 |
|
583 |
+
if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
|
584 |
+
$events_page_link = dbem_get_events_page(true, false);
|
585 |
+
if (stristr($events_page_link, "?"))
|
586 |
+
$joiner = "&";
|
587 |
+
else
|
588 |
+
$joiner = "?";
|
589 |
+
$venue_page_link = $events_page_link.$joiner."location_id=".$event['location_id'];
|
590 |
$event_string = str_replace($result, $venue_page_link , $event_string );
|
591 |
}
|
592 |
// matches all PHP time placeholders for endtime
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Events Manager ===
|
2 |
-
Contributors: nutsmuggler
|
|
|
3 |
Tags: events, manager, calendar, gigs, concert, maps, geotagging
|
4 |
Requires at least: 2.5.1
|
5 |
-
Tested up to: 2.7
|
6 |
-
Stable tag: 2.
|
7 |
-
Donate link: http://davidebenini.it/wordpress-plugins/
|
8 |
|
9 |
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
|
10 |
|
@@ -29,7 +29,7 @@ Events Manager is fully localisable. IN this release you will find the Italian a
|
|
29 |
Events Manager 1.* adopters should:
|
30 |
|
31 |
1. backup their Wordpress database.
|
32 |
-
2. deactivate Events Manager 1
|
33 |
3. delete Events Managers 1.* and upload Events Manager 2.* to their server
|
34 |
4. activate Events Manager 2.*
|
35 |
|
1 |
=== Events Manager ===
|
2 |
+
Contributors: nutsmuggler
|
3 |
+
Donate link: http://davidebenini.it
|
4 |
Tags: events, manager, calendar, gigs, concert, maps, geotagging
|
5 |
Requires at least: 2.5.1
|
6 |
+
Tested up to: 2.7.1
|
7 |
+
Stable tag: 2.0b2
|
|
|
8 |
|
9 |
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
|
10 |
|
29 |
Events Manager 1.* adopters should:
|
30 |
|
31 |
1. backup their Wordpress database.
|
32 |
+
2. deactivate Events Manager 1.*
|
33 |
3. delete Events Managers 1.* and upload Events Manager 2.* to their server
|
34 |
4. activate Events Manager 2.*
|
35 |
|