my-calendar-shortcodes.php
4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
function my_calendar_insert( $atts, $content = null ) {
extract( shortcode_atts( array(
'name' => 'all',
'format' => 'calendar',
'category' => 'all',
'time' => 'month',
'ltype' => '',
'lvalue' => '',
'author' => 'all',
'host' => 'all',
'id' => '',
'template' => '',
'above' => '',
'below' => '',
'year' => false,
'month' => false,
'day' => false,
'site' => false
), $atts, 'my_calendar' ) );
if ( $format != 'mini' ) {
if ( isset( $_GET['format'] ) ) {
$format = esc_sql( $_GET['format'] );
}
}
global $user_ID;
if ( $author == 'current' ) {
$author = apply_filters( 'mc_display_author', $user_ID, 'main' );
}
if ( $host == 'current' ) {
$host = apply_filters( 'mc_display_host', $user_ID, 'main' );
}
return my_calendar( $name, $format, $category, $time, $ltype, $lvalue, $id, $template, $content, $author, $host, $above, $below, $year, $month, $day, 'shortcode', $site );
}
function my_calendar_insert_upcoming( $atts ) {
extract( shortcode_atts( array(
'before' => 'default',
'after' => 'default',
'type' => 'default',
'category' => 'default',
'template' => 'default',
'fallback' => '',
'order' => 'asc',
'skip' => '0',
'show_today' => 'yes',
'author' => 'default',
'host' => 'default',
'ltype' => '',
'lvalue' => '',
'from' => false,
'to' => false,
'site' => false
), $atts, 'my_calendar_upcoming' ) );
global $user_ID;
if ( $author == 'current' ) {
$author = apply_filters( 'mc_display_author', $user_ID, 'upcoming' );
}
if ( $host == 'current' ) {
$host = apply_filters( 'mc_display_host', $user_ID, 'upcoming' );
}
return my_calendar_upcoming_events( $before, $after, $type, $category, $template, $fallback, $order, $skip, $show_today, $author, $host, $ltype, $lvalue, $from, $to, $site );
}
function my_calendar_insert_today( $atts ) {
extract( shortcode_atts( array(
'category' => 'default',
'author' => 'default',
'host' => 'default',
'template' => 'default',
'fallback' => '',
'date' => false,
'site' => false
), $atts, 'my_calendar_today' ) );
global $user_ID;
if ( $author == 'current' ) {
$author = apply_filters( 'mc_display_author', $user_ID, 'today' );
}
if ( $host == 'current' ) {
$host = apply_filters( 'mc_display_host', $user_ID, 'today' );
}
return my_calendar_todays_events( $category, $template, $fallback, $author, $host, $date, $site );
}
function my_calendar_locations( $atts ) {
extract( shortcode_atts( array(
'show' => 'list',
'type' => 'saved',
'datatype' => 'name'
), $atts, 'my_calendar_locations' ) );
return my_calendar_locations_list( $show, $type, $datatype );
}
function my_calendar_show_locations_list( $atts ) {
extract( shortcode_atts( array(
'datatype' => 'name',
'template' => ''
), $atts, 'my_calendar_locations_list' ) );
return my_calendar_show_locations( $datatype, $template );
}
function my_calendar_categories( $atts ) {
extract( shortcode_atts( array(
'show' => 'list'
), $atts, 'my_calendar_categories' ) );
return my_calendar_categories_list( $show );
}
function my_calendar_access( $atts ) {
extract( shortcode_atts( array(
'show' => 'list'
), $atts, 'my_calendar_access' ) );
return mc_access_list( $show );
}
function my_calendar_filters( $atts ) {
extract( shortcode_atts( array(
'show' => 'categories,locations'
), $atts, 'my_calendar_filters' ) );
return mc_filters( $show );
}
function my_calendar_show_event( $atts ) {
extract( shortcode_atts( array(
'event' => '',
'template' => '<h3>{title}</h3>{description}',
'list' => '<li>{date}, {time}</li>',
'before' => '<ul>',
'after' => '</ul>',
'instance' => false
), $atts, 'my_calendar_event' ) );
return mc_instance_list( $event, false, $template, $list, $before, $after, $instance );
}
function my_calendar_search( $atts ) {
extract( shortcode_atts( array(
'type' => 'simple',
'url' => ''
), $atts, 'my_calendar_search' ) );
return my_calendar_searchform( $type, $url );
}
function my_calendar_now( $atts ) {
extract( shortcode_atts( array(
'category' => '',
'template' => '<strong>{link_title}</strong> {timerange}',
'site' => false
), $atts, 'my_calendar_now' ) );
return my_calendar_events_now( $category, $template, $site );
}