PluginProbe
Event Organiser / trunk
Event Organiser vtrunk
3.12.10 trunk 2.0.2 2.1.7 2.10.0 2.11.1 2.12.5 2.13.7 2.2.2 2.3.2 2.4 2.5.1 2.6.0 2.7.5 2.8.6 2.9.2 3.0.5 3.1.1 3.1.10 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 All 75 releases
event-organiser / event-organiser.php

event-organiser.php in Event Organiser trunk, at event-organiser.php

258 lines 9.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Event Organiser
4 Plugin URI: http://www.wp-event-organiser.com
5 Version: 3.12.10
6 Description: Creates a custom post type 'events' with features such as recurring events, venues, Google Maps, calendar views and events and venue pages
7 Author: Stephen Harris
8 Author URI: http://www.stephenharris.info
9 Network: false
10 Text Domain: eventorganiser
11 Domain Path: /languages
12 */
13 /* Copyright 2011 Stephen Harris (contact@stephenharris.info)
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29 /* Cookies used:
30 eo_admin_cal_last_viewed_date - stores the last viewed date on the admin calendar.
31 eo_admin_cal_last_view - stores the last used admin calendar view (month, week, day).
32 Expires: 10 minutes. Used for persitant admin calendar
33 */
34 /**
35 * The main plug-in loader
36 */
37
38 /**
39 * Set the plug-in database version
40 */
41 define( 'EVENT_ORGANISER_VER', '3.12.5' );
42
43 add_action( 'after_setup_theme', '_eventorganiser_set_constants' );
44 function _eventorganiser_set_constants() {
45 /*
46 * Defines the plug-in directory url
47 * <code>url:http://mysite.com/wp-content/plugins/event-organiser</code>
48 */
49 if ( ! defined( 'EVENT_ORGANISER_URL' ) ) {
50 define( 'EVENT_ORGANISER_URL', plugin_dir_url( __FILE__ ) );
51 }
52
53 require_once( EVENT_ORGANISER_DIR . 'event-organiser-add-ons.php' );
54
55 if ( ! defined( 'EVENT_ORGANISER_BETA_FEATURES' ) ) {
56 define( 'EVENT_ORGANISER_BETA_FEATURES', false );
57 }
58 }
59
60 /*
61 * Defines the plug-in directory path
62 * <code>/home/mysite/public_html/wp-content/plugins/event-organiser</code>
63 */
64 define( 'EVENT_ORGANISER_DIR', plugin_dir_path( __FILE__ ) );
65
66 /**
67 * For use in datetime formats. To return a datetime object rather than formatted string
68 */
69 define( 'DATETIMEOBJ', 'DATETIMEOBJ' );
70
71
72 /**
73 * Load the translation file for current language. Checks in wp-content/languages first
74 * and then the event-organiser/languages.
75 *
76 * Edits to translation files inside event-organiser/languages will be lost with an update
77 * **If you're creating custom translation files, please use the global language folder.**
78 *
79 * @since 1.3
80 * @ignore
81 * @uses apply_filters() Calls 'plugin_locale' with the get_locale() value
82 * @uses load_textdomain() To load the textdomain from global language folder
83 * @uses load_plugin_textdomain() To load the textdomain from plugin folder
84 */
85 function eventorganiser_load_textdomain() {
86 $domain = 'eventorganiser';
87
88 /**
89 *@ignore
90 */
91 $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
92
93 $mofile = $domain . '-' . $locale . '.mo';
94
95 /* Check the global language folder */
96 $files = array( WP_LANG_DIR . '/event-organiser/' . $mofile, WP_LANG_DIR . '/' . $mofile );
97 foreach ( $files as $file ) {
98 if ( file_exists( $file ) ) {
99 return load_textdomain( $domain, $file );
100 }
101 }
102
103 //If we got this far, fallback to the plug-in language folder.
104 //We could use load_textdomain - but this avoids touching any more constants.
105 load_plugin_textdomain( 'eventorganiser', false, basename( dirname( __FILE__ ) ) . '/languages' );
106 }
107 add_action( 'plugins_loaded', 'eventorganiser_load_textdomain' );
108
109 /**
110 * Initiates the EO_Admin_Notice_Handler singleton
111 *
112 * @since 3.0.3
113 * @ignore
114 */
115 function eventorganiser_init_notice_handler() {
116 $notice_handler = EO_Admin_Notice_Handler::get_instance();
117 }
118 add_action( 'plugins_loaded', 'eventorganiser_init_notice_handler' );
119
120 global $eventorganiser_roles;
121 $eventorganiser_roles = array(
122 'edit_events' => __( 'Edit Events', 'eventorganiser' ),
123 'publish_events' => __( 'Publish Events', 'eventorganiser' ),
124 'delete_events' => __( 'Delete Events', 'eventorganiser' ),
125 'edit_others_events' => __( 'Edit Others\' Events', 'eventorganiser' ),
126 'delete_others_events' => __( 'Delete Other\'s Events', 'eventorganiser' ),
127 'read_private_events' => __( 'Read Private Events', 'eventorganiser' ),
128 'manage_venues' => __( 'Manage Venues', 'eventorganiser' ),
129 'manage_event_categories' => __( 'Manage Event Categories & Tags', 'eventorganiser' ),
130 );
131
132 /****** Install, activation & deactivation******/
133 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-install.php' );
134
135 register_activation_hook( __FILE__, 'eventorganiser_install' );
136 register_deactivation_hook( __FILE__, 'eventorganiser_deactivate' );
137 register_uninstall_hook( __FILE__, 'eventorganiser_uninstall' );
138
139
140 function eventorganiser_get_option( $option = false, $default = false ) {
141
142 $defaults = array(
143 'url_event' => 'events/event',
144 'url_events' => 'events/event',
145 'url_venue' => 'events/venue',
146 'url_cat' => 'events/category',
147 'url_tag' => 'events/tag',
148 'url_on' => 'on',
149 'navtitle' => __( 'Events', 'eventorganiser' ),
150 'group_events' => '',
151 'feed' => 1,
152 'deleteexpired' => 0,
153 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'eventtag', 'event-venue' ),
154 'event_redirect' => 'events',
155 'dateformat' => 'd-m-Y',
156 'prettyurl' => 1,
157 'templates' => 'themecompat',
158 'addtomenu' => 0,
159 'menu_item_db_id' => 0,
160 'excludefromsearch' => 0,
161 'showpast' => 0,
162 'runningisnotpast' => 0,
163 'hide_addon_page' => 0,
164 'disable_css' => 0,
165 'google_api_key' => false,
166 'map_provider' => 'openstreetmap'
167 );
168 $options = get_option( 'eventorganiser_options', $defaults );
169 $options = wp_parse_args( $options, $defaults );
170
171 $options['supports'][] = 'event-venue';
172
173 $options = apply_filters( 'eventorganiser_options', $options );
174
175 if ( false === $option ) {
176 return $options;
177 }
178
179 /* Backwards compatibility for 'eventag' option */
180 if ( 'eventtag' === $option ) {
181 return in_array( 'eventtag', $options['supports'] );
182 }
183
184 if ( 'dateformat' === $option ) {
185 //Backwards compatibility (migration from mm-dd/dd-mm to php format):
186 if ( 'mm-dd' == $options[$option] ) {
187 $options[$option] = 'm-d-Y';
188 } elseif ( 'dd-mm' == $options[$option] ) {
189 $options[$option] = 'd-m-Y';
190 }
191 }
192
193 if ( ! isset( $options[$option] ) ) {
194 return $default;
195 }
196
197 return $options[$option];
198 }
199
200
201 /****** Register event post type and event taxonomy******/
202 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-cpt.php' );
203 require_once( EVENT_ORGANISER_DIR . 'includes/class-eo-walker-taxonomydropdown.php' );
204
205 /****** Register scripts, styles and actions******/
206 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-register.php' );
207
208 /****** Deals with the queries******/
209 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-archives.php' );
210
211 /****** Deals with importing/exporting & subscriptions******/
212 require_once( EVENT_ORGANISER_DIR . 'includes/class-event-organiser-im-export.php' );
213 require_once( EVENT_ORGANISER_DIR . 'includes/class-eo-ical-parser.php' );
214
215 if ( is_admin() ) :
216 require_once( EVENT_ORGANISER_DIR . 'classes/class-eventorganiser-admin-page.php' );
217
218 /****** event editing pages******/
219 require_once( EVENT_ORGANISER_DIR . 'event-organiser-edit.php' );
220 require_once( EVENT_ORGANISER_DIR . 'event-organiser-manage.php' );
221
222 /****** settings, venue and calendar pages******/
223 require_once( EVENT_ORGANISER_DIR . 'event-organiser-settings.php' );
224 require_once( EVENT_ORGANISER_DIR . 'event-organiser-venues.php' );
225 require_once( EVENT_ORGANISER_DIR . 'event-organiser-calendar.php' );
226
227 require_once( EVENT_ORGANISER_DIR . 'event-organiser-debug.php' );
228
229 require_once( EVENT_ORGANISER_DIR . 'event-organiser-go-pro.php' );
230
231 endif;
232
233 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
234 /****** Ajax actions ******/
235 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-ajax.php' );
236 }
237
238 /****** Functions ******/
239 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-event-functions.php' );
240 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-venue-functions.php' );
241 require_once( EVENT_ORGANISER_DIR . 'includes/event-organiser-utility-functions.php' );
242 require_once( EVENT_ORGANISER_DIR . 'includes/class-eo-admin-notice.php' );
243 require_once( EVENT_ORGANISER_DIR . 'includes/deprecated.php' );
244 require_once( EVENT_ORGANISER_DIR . 'includes/event.php' );
245 require_once( EVENT_ORGANISER_DIR . 'includes/class-eo-extension.php' );
246
247 /****** Templates - note some plug-ins will require this to included admin-side too ******/
248 require_once( 'includes/event-organiser-templates.php' );
249 require_once( 'includes/class-eo-theme-compatability.php' );
250
251 /****** Widgets and Shortcodes ******/
252 require_once( EVENT_ORGANISER_DIR . 'classes/class-eo-agenda-widget.php' );
253 require_once( EVENT_ORGANISER_DIR . 'classes/class-eo-event-list-widget.php' );
254 require_once( EVENT_ORGANISER_DIR . 'classes/class-eo-calendar-widget.php' );
255 require_once( EVENT_ORGANISER_DIR . 'classes/class-eo-widget-categories.php' );
256 require_once( EVENT_ORGANISER_DIR . 'classes/class-eo-widget-venues.php' );
257 require_once( EVENT_ORGANISER_DIR . 'classes/class-eventorganiser-shortcodes.php' );
258