Version Description
Small features, UX and Content Tweaks:
- Adjusted the Settings API so it now saves on page load and then redirects back to the page
- add_cap()s are now wrapped in an if-statement
- Added proper indentation and spacing to the Events Calendar PRO source files
Bug Fixes:
- Additional fields no longer wiped when saving changes to events/settings pages
- Plugin now removes newlines and carriage returns in the process of saving line-separated options for custom links
- Reviewed/improved $_POST and $_GET variables after a security audit to make sure they're sanitized before output/saving to the database (to prevent mySQL injects and/or cross-site scripting vulnerabilities)
Download this release
Release Info
Developer | PaulHughes01 |
Plugin | The Events Calendar |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- admin-views/events-audit-trail.php +54 -0
- admin-views/tribe-options-general.php +46 -46
- admin-views/tribe-options-templates.php +10 -10
- admin-views/venue-meta-box.php +0 -3
- lang/tribe-events-calendar.pot +154 -125
- lib/template-tags-deprecated.php +5 -3
- lib/the-events-calendar.class.php +264 -155
- lib/tribe-event-api.class.php +30 -14
- lib/tribe-field.class.php +7 -3
- lib/tribe-settings-tab.class.php +39 -51
- lib/tribe-settings.class.php +99 -97
- lib/tribe-validate.class.php +65 -52
- lib/tribe-view-helpers.class.php +0 -1
- public/template-tags/google-map.php +3 -0
- readme.txt +16 -2
- the-events-calendar.php +1 -1
- vendor/wp-router/WP_Route.class.php +375 -0
- vendor/wp-router/WP_Router.class.php +277 -0
- vendor/wp-router/WP_Router_Page.class.php +179 -0
- vendor/wp-router/WP_Router_Sample.class.php +30 -0
- vendor/wp-router/WP_Router_Utility.class.php +77 -0
- vendor/wp-router/readme.txt +158 -0
- vendor/wp-router/wp-router.php +63 -0
admin-views/events-audit-trail.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Events audit trial metabox
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Don't load directly
|
7 |
+
if ( !defined('ABSPATH') ) { die('-1'); }
|
8 |
+
|
9 |
+
if( is_admin() ){
|
10 |
+
|
11 |
+
//$postid = intval($_GET['post']);
|
12 |
+
|
13 |
+
global $post;
|
14 |
+
|
15 |
+
if ( isset($post->ID) && isset($post->post_type) ) {
|
16 |
+
if ( $post->post_type == self::POSTTYPE ) {
|
17 |
+
$post_type = '_Event';
|
18 |
+
} elseif ( $post->post_type == self::VENUE_POST_TYPE ) {
|
19 |
+
$post_type = '_Venue';
|
20 |
+
} elseif ( $post->post_type == self::ORGANIZER_POST_TYPE ) {
|
21 |
+
$post_type = '_Organizer';
|
22 |
+
} else {
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
$audit_trail = get_post_meta($post->ID, $post_type.'AuditTrail', true);
|
28 |
+
|
29 |
+
$audit_trail_display = '';
|
30 |
+
|
31 |
+
foreach( $audit_trail as $at ){
|
32 |
+
|
33 |
+
$audit_trail_display .= date('Y-m-d g:i:s a', $at[1]) .' : '. $at[0].'<br>';
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
?>
|
38 |
+
<div id='eventDetails' class="inside eventForm bubble">
|
39 |
+
<table cellspacing="0" cellpadding="0" id="EventInfo">
|
40 |
+
<tr>
|
41 |
+
<td colspan="2" class="tribe_sectionheader"><h4 class="event-time"><?php _e('Auditing Information', 'tribe-events-calendar'); ?></h4></td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<td width="10%"><?php _e('Created by:', 'tribe-events-calendar'); ?></td>
|
45 |
+
<td><?php echo get_post_meta($post->ID, $post_type.'Origin', true); ?></td>
|
46 |
+
</tr>
|
47 |
+
<tr>
|
48 |
+
<td valign="top"><?php _e('Audit Trail:', 'tribe-events-calendar'); ?></td>
|
49 |
+
<td><?php echo $audit_trail_display; ?></td>
|
50 |
+
</tr>
|
51 |
+
|
52 |
+
</table>
|
53 |
+
</div>
|
54 |
+
<?php } ?>
|
admin-views/tribe-options-general.php
CHANGED
@@ -4,35 +4,35 @@ $generalTab = array(
|
|
4 |
'fields' => array(
|
5 |
'info-start' => array(
|
6 |
'type' => 'html',
|
7 |
-
'html' => '<div id="modern-tribe-info"><img src="'.plugins_url('resources/images/modern-tribe.png', dirname(__FILE__)).'" alt="Modern Tribe Inc." title="Modern Tribe Inc.">'
|
8 |
),
|
9 |
'upsell-heading' => array(
|
10 |
'type' => 'heading',
|
11 |
-
'label' => __('Add functionality to The Events Calendar', 'tribe-events-calendar'),
|
12 |
-
'conditional' => ( !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL ),
|
13 |
),
|
14 |
'upsell-info' => array(
|
15 |
'type' => 'html',
|
16 |
-
'html' => '<p>'.__('Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?', 'tribe-events-calendar' ).'<br><a href="'.self::$tribeUrl.'shop/?utm_source=generaltab&utm_medium=promolink&utm_campaign=plugin'.'">'.__('Check out the available Add-Ons', 'tribe-events-calendar').'</a></p>',
|
17 |
-
'conditional' => ( !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL ),
|
18 |
),
|
19 |
'donate-link-heading' => array(
|
20 |
'type' => 'heading',
|
21 |
-
'label' => __('We hope our plugin is helping you out.', 'tribe-events-calendar'),
|
22 |
),
|
23 |
'donate-link-info' => array(
|
24 |
'type' => 'html',
|
25 |
-
'html' => '<p>'.__('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar').'<br><a href="'.plugins_url('resources/images/donate-link-screenshot.jpg', dirname(__FILE__)).'" class="thickbox">'.__('See an example of the link', 'tribe-events-calendar').'</a></p>',
|
26 |
-
'conditional' => !class_exists('TribeEventsPro'),
|
27 |
),
|
28 |
'donate-link-pro-info' => array(
|
29 |
'type' => 'html',
|
30 |
-
'html' => '<p>'.__('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar').'<br><a href="'.plugins_url('resources/images/donate-link-pro-screenshot.jpg', dirname(__FILE__)).'" class="thickbox">'.__('See an example of the link', 'tribe-events-calendar').'</a></p>',
|
31 |
-
'conditional' => class_exists('TribeEventsPro'),
|
32 |
),
|
33 |
'donate-link' => array(
|
34 |
'type' => 'checkbox_bool',
|
35 |
-
'label' => __('Show Events Calendar Link', 'tribe-events-calendar'),
|
36 |
'default' => false,
|
37 |
'validation_type' => 'boolean',
|
38 |
),
|
@@ -42,95 +42,95 @@ $generalTab = array(
|
|
42 |
),
|
43 |
'viewOption' => array(
|
44 |
'type' => 'radio',
|
45 |
-
'label' => __('Default view for the Events', 'tribe-events-calendar'),
|
46 |
-
'tooltip' => __('Determines whether the default events view is a calendar or a list.', 'tribe-events-calendar'),
|
47 |
'default' => 'month',
|
48 |
-
'options' => array('month' => 'Calendar', 'upcoming' => 'Event List'),
|
49 |
-
'validation_type' => 'options'
|
50 |
),
|
51 |
'eventsSlug' => array(
|
52 |
'type' => 'text',
|
53 |
-
'label' => __('Events URL slug', 'tribe-events-calendar'),
|
54 |
'default' => 'events',
|
55 |
'validation_type' => 'slug',
|
56 |
-
'conditional' => ( '' != get_option('permalink_structure') ),
|
57 |
),
|
58 |
'current-events-slug' => array(
|
59 |
'type' => 'html',
|
60 |
-
'
|
61 |
-
'conditional' =>
|
62 |
),
|
63 |
'ical-info' => array(
|
64 |
'type' => 'html',
|
65 |
-
'display_callback' => '
|
66 |
-
'conditional' => function_exists('tribe_get_ical_link'),
|
67 |
),
|
68 |
'singleEventSlug' => array(
|
69 |
'type' => 'text',
|
70 |
-
'label' => __('Single Event URL slug', 'tribe-events-calendar'),
|
71 |
'default' => 'event',
|
72 |
'validation_type' => 'slug',
|
73 |
-
'conditional' => ( '' != get_option('permalink_structure') ),
|
74 |
),
|
75 |
'current-single-event-slug' => array(
|
76 |
'type' => 'html',
|
77 |
-
'
|
78 |
-
'conditional' =>
|
79 |
),
|
80 |
'postsPerPage' => array(
|
81 |
'type' => 'text',
|
82 |
-
'label' => __('Number of events to show per page in the loop', 'tribe-events-calendar'),
|
83 |
-
'tooltip' => __('This is the number of events displayed per page when returning a list of events.', 'tribe-events-calendar'),
|
84 |
'size' => 'small',
|
85 |
-
'default' => get_option('posts_per_page'),
|
86 |
'validation_type' => 'positive_int',
|
87 |
),
|
88 |
'showComments' => array(
|
89 |
'type' => 'checkbox_bool',
|
90 |
-
'label' => __('Show Comments', 'tribe-events-calendar'),
|
91 |
-
'tooltip' => __('Enables commenting on your single event view.', 'tribe-events-calendar'),
|
92 |
'default' => false,
|
93 |
-
'validation_type' => 'boolean'
|
94 |
),
|
95 |
'multiDayCutoff' => array(
|
96 |
'type' => 'dropdown',
|
97 |
-
'label' => __('Multiday Event Cutoff', 'tribe-events-calendar'),
|
98 |
-
'tooltip' => __('For multi-day events, hide the last day from grid view if it ends on or before this time.', 'tribe-events-calendar'),
|
99 |
'validation_type' => 'options',
|
100 |
'size' => 'small',
|
101 |
'default' => '12:00',
|
102 |
-
'options' => array('12:00' => '12:00 am', '12:30' => '12:30 am', '01:00' => '01:00 am', '01:30' => '01:30 am', '02:00' => '02:00 am', '02:30' => '02:30 am', '03:00' => '03:00 am', '03:30' => '03:30 am', '04:00' => '04:00 am', '04:30' => '04:30 am', '05:00' => '05:00 am', '05:30' => '05:30 am', '06:00' => '06:00 am', '06:30' => '06:30 am', '07:00' => '07:00 am', '07:30' => '07:30 am', '08:00' => '08:00 am', '08:30' => '08:30 am', '09:00' => '09:00 am', '09:30' => '09:30 am', '10:00' => '10:00 am', '10:30' => '10:30 am', '11:00' => '11:00 am', '11:30' => '11:30 am'),
|
103 |
),
|
104 |
'embedGoogleMaps' => array(
|
105 |
'type' => 'checkbox_bool',
|
106 |
-
'label' => __('Enable Google Maps', 'tribe-events-calendar'),
|
107 |
-
'tooltip' => __('If you don\'t have this turned on, your event listings won\'t have the backend map preview or frontend embedded map.', 'tribe-events-calendar'),
|
108 |
'default' => false,
|
109 |
'class' => 'google-embed-size',
|
110 |
-
'validation_type' => 'boolean'
|
111 |
),
|
112 |
'embedGoogleMapsHeight' => array(
|
113 |
'type' => 'text',
|
114 |
-
'label' => __('Google Maps Embed Height', 'tribe-events-calendar'),
|
115 |
'size' => 'small',
|
116 |
'default' => 350,
|
117 |
-
'tooltip' => __('Enter a number.', 'tribe-events-calendar'),
|
118 |
'class' => 'google-embed-field',
|
119 |
'validation_type' => 'positive_int',
|
120 |
),
|
121 |
'embedGoogleMapsWidth' => array(
|
122 |
'type' => 'text',
|
123 |
-
'label' => __('Google Maps Embed Width', 'tribe-events-calendar'),
|
124 |
'size' => 'small',
|
125 |
-
'tooltip' => __('Enter a number or %.', 'tribe-events-calendar'),
|
126 |
'default' => '100%',
|
127 |
'class' => 'google-embed-field',
|
128 |
'validation_type' => 'number_or_percent',
|
129 |
),
|
130 |
'embedGoogleMapsZoom' => array(
|
131 |
'type' => 'text',
|
132 |
-
'label' => __('Google Maps Default Zoom Level', 'tribe-events-calendar'),
|
133 |
-
'tooltip' => __('0 = zoomed-out; 21 = zoomed-in.', 'tribe_events_calendar'),
|
134 |
'size' => 'small',
|
135 |
'default' => 10,
|
136 |
'class' => 'google-embed-field',
|
@@ -138,10 +138,10 @@ $generalTab = array(
|
|
138 |
),
|
139 |
'debugEvents' => array(
|
140 |
'type' => 'checkbox_bool',
|
141 |
-
'label' => __('Debug Mode', 'tribe-events-calendar'),
|
142 |
-
'tooltip' => sprintf( __('Enable this option to log debug information. By default this will log to your server PHP error log. If you\'d like to see the log messages in your browser, then we recommend that you install the %s and look for the "Tribe" tab in the debug output.', 'tribe-events-calendar'), '<a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">'.__('Debug Bar Plugin', 'tribe-events-calendar').'</a>' ),
|
143 |
'default' => false,
|
144 |
-
'validation_type' => 'boolean'
|
145 |
),
|
146 |
),
|
147 |
);
|
4 |
'fields' => array(
|
5 |
'info-start' => array(
|
6 |
'type' => 'html',
|
7 |
+
'html' => '<div id="modern-tribe-info"><img src="' . plugins_url( 'resources/images/modern-tribe.png', dirname( __FILE__ ) ) . '" alt="Modern Tribe Inc." title="Modern Tribe Inc.">'
|
8 |
),
|
9 |
'upsell-heading' => array(
|
10 |
'type' => 'heading',
|
11 |
+
'label' => __( 'Add functionality to The Events Calendar', 'tribe-events-calendar' ),
|
12 |
+
'conditional' => ( !defined( 'TRIBE_HIDE_UPSELL' ) || !TRIBE_HIDE_UPSELL ),
|
13 |
),
|
14 |
'upsell-info' => array(
|
15 |
'type' => 'html',
|
16 |
+
'html' => '<p>' . __( 'Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?', 'tribe-events-calendar' ) . '<br><a href="' . self::$tribeUrl . 'shop/?utm_source=generaltab&utm_medium=promolink&utm_campaign=plugin'.'">' . __( 'Check out the available Add-Ons', 'tribe-events-calendar' ) . '</a></p>',
|
17 |
+
'conditional' => ( !defined( 'TRIBE_HIDE_UPSELL' ) || !TRIBE_HIDE_UPSELL ),
|
18 |
),
|
19 |
'donate-link-heading' => array(
|
20 |
'type' => 'heading',
|
21 |
+
'label' => __( 'We hope our plugin is helping you out.', 'tribe-events-calendar' ),
|
22 |
),
|
23 |
'donate-link-info' => array(
|
24 |
'type' => 'html',
|
25 |
+
'html' => '<p>' . __( 'Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar' ).'<br><a href="' . plugins_url( 'resources/images/donate-link-screenshot.jpg', dirname( __FILE__ ) ).'" class="thickbox">' . __( 'See an example of the link', 'tribe-events-calendar' ) . '</a></p>',
|
26 |
+
'conditional' => !class_exists( 'TribeEventsPro' ),
|
27 |
),
|
28 |
'donate-link-pro-info' => array(
|
29 |
'type' => 'html',
|
30 |
+
'html' => '<p>' . __( 'Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar' ) . '<br><a href="' . plugins_url( 'resources/images/donate-link-pro-screenshot.jpg', dirname( __FILE__ ) ) . '" class="thickbox">' . __( 'See an example of the link', 'tribe-events-calendar' ) . '</a></p>',
|
31 |
+
'conditional' => class_exists( 'TribeEventsPro' ),
|
32 |
),
|
33 |
'donate-link' => array(
|
34 |
'type' => 'checkbox_bool',
|
35 |
+
'label' => __( 'Show Events Calendar Link', 'tribe-events-calendar' ),
|
36 |
'default' => false,
|
37 |
'validation_type' => 'boolean',
|
38 |
),
|
42 |
),
|
43 |
'viewOption' => array(
|
44 |
'type' => 'radio',
|
45 |
+
'label' => __( 'Default view for the Events', 'tribe-events-calendar' ),
|
46 |
+
'tooltip' => __( 'Determines whether the default events view is a calendar or a list.', 'tribe-events-calendar' ),
|
47 |
'default' => 'month',
|
48 |
+
'options' => array( 'month' => 'Calendar', 'upcoming' => 'Event List' ),
|
49 |
+
'validation_type' => 'options',
|
50 |
),
|
51 |
'eventsSlug' => array(
|
52 |
'type' => 'text',
|
53 |
+
'label' => __( 'Events URL slug', 'tribe-events-calendar' ),
|
54 |
'default' => 'events',
|
55 |
'validation_type' => 'slug',
|
56 |
+
'conditional' => ( '' != get_option( 'permalink_structure' ) ),
|
57 |
),
|
58 |
'current-events-slug' => array(
|
59 |
'type' => 'html',
|
60 |
+
'html' => '<p class="tribe-field-indent tribe-field-description description">' . __( 'The slug used for building the events URL.', 'tribe-events-calendar' ) . sprintf( __( 'Your current Events URL is %s', 'tribe-events-calendar' ), '<code><a href="'.tribe_get_events_link() . '">' . tribe_get_events_link() . '</a></code>' ) . '</p>',
|
61 |
+
'conditional' => ( '' != get_option( 'permalink_structure' ) ),
|
62 |
),
|
63 |
'ical-info' => array(
|
64 |
'type' => 'html',
|
65 |
+
'display_callback' => ( function_exists( 'tribe_get_ical_link' ) ) ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . __( 'Here is the iCal feed URL for your events:', 'tribe-events-calendar' ) . ' ' . '<code>' . tribe_get_ical_link() . '</code></p>' : '',
|
66 |
+
'conditional' => function_exists( 'tribe_get_ical_link' ),
|
67 |
),
|
68 |
'singleEventSlug' => array(
|
69 |
'type' => 'text',
|
70 |
+
'label' => __( 'Single Event URL slug', 'tribe-events-calendar' ),
|
71 |
'default' => 'event',
|
72 |
'validation_type' => 'slug',
|
73 |
+
'conditional' => ( '' != get_option( 'permalink_structure' ) ),
|
74 |
),
|
75 |
'current-single-event-slug' => array(
|
76 |
'type' => 'html',
|
77 |
+
'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf( __( 'You <strong>cannot</strong> use the same slug as above. The above should ideally be plural, and this singular.<br />Your single Event URL is like: %s', 'tribe-events-calendar' ), '<code>' . trailingslashit( home_url() ) . tribe_get_option( 'singleEventSlug', 'event' ) . '/single-post-name/' . '</code>' ) . '</p>',
|
78 |
+
'conditional' => ( '' != get_option( 'permalink_structure' ) ),
|
79 |
),
|
80 |
'postsPerPage' => array(
|
81 |
'type' => 'text',
|
82 |
+
'label' => __( 'Number of events to show per page in the loop', 'tribe-events-calendar' ),
|
83 |
+
'tooltip' => __( 'This is the number of events displayed per page when returning a list of events.', 'tribe-events-calendar' ),
|
84 |
'size' => 'small',
|
85 |
+
'default' => get_option( 'posts_per_page' ),
|
86 |
'validation_type' => 'positive_int',
|
87 |
),
|
88 |
'showComments' => array(
|
89 |
'type' => 'checkbox_bool',
|
90 |
+
'label' => __( 'Show Comments', 'tribe-events-calendar' ),
|
91 |
+
'tooltip' => __( 'Enables commenting on your single event view.', 'tribe-events-calendar' ),
|
92 |
'default' => false,
|
93 |
+
'validation_type' => 'boolean',
|
94 |
),
|
95 |
'multiDayCutoff' => array(
|
96 |
'type' => 'dropdown',
|
97 |
+
'label' => __( 'Multiday Event Cutoff', 'tribe-events-calendar' ),
|
98 |
+
'tooltip' => __( 'For multi-day events, hide the last day from grid view if it ends on or before this time.', 'tribe-events-calendar' ),
|
99 |
'validation_type' => 'options',
|
100 |
'size' => 'small',
|
101 |
'default' => '12:00',
|
102 |
+
'options' => array( '12:00' => '12:00 am', '12:30' => '12:30 am', '01:00' => '01:00 am', '01:30' => '01:30 am', '02:00' => '02:00 am', '02:30' => '02:30 am', '03:00' => '03:00 am', '03:30' => '03:30 am', '04:00' => '04:00 am', '04:30' => '04:30 am', '05:00' => '05:00 am', '05:30' => '05:30 am', '06:00' => '06:00 am', '06:30' => '06:30 am', '07:00' => '07:00 am', '07:30' => '07:30 am', '08:00' => '08:00 am', '08:30' => '08:30 am', '09:00' => '09:00 am', '09:30' => '09:30 am', '10:00' => '10:00 am', '10:30' => '10:30 am', '11:00' => '11:00 am', '11:30' => '11:30 am' ),
|
103 |
),
|
104 |
'embedGoogleMaps' => array(
|
105 |
'type' => 'checkbox_bool',
|
106 |
+
'label' => __( 'Enable Google Maps', 'tribe-events-calendar' ),
|
107 |
+
'tooltip' => __( 'If you don\'t have this turned on, your event listings won\'t have the backend map preview or frontend embedded map.', 'tribe-events-calendar' ),
|
108 |
'default' => false,
|
109 |
'class' => 'google-embed-size',
|
110 |
+
'validation_type' => 'boolean',
|
111 |
),
|
112 |
'embedGoogleMapsHeight' => array(
|
113 |
'type' => 'text',
|
114 |
+
'label' => __( 'Google Maps Embed Height', 'tribe-events-calendar' ),
|
115 |
'size' => 'small',
|
116 |
'default' => 350,
|
117 |
+
'tooltip' => __( 'Enter a number.', 'tribe-events-calendar' ),
|
118 |
'class' => 'google-embed-field',
|
119 |
'validation_type' => 'positive_int',
|
120 |
),
|
121 |
'embedGoogleMapsWidth' => array(
|
122 |
'type' => 'text',
|
123 |
+
'label' => __( 'Google Maps Embed Width', 'tribe-events-calendar' ),
|
124 |
'size' => 'small',
|
125 |
+
'tooltip' => __( 'Enter a number or %.', 'tribe-events-calendar' ),
|
126 |
'default' => '100%',
|
127 |
'class' => 'google-embed-field',
|
128 |
'validation_type' => 'number_or_percent',
|
129 |
),
|
130 |
'embedGoogleMapsZoom' => array(
|
131 |
'type' => 'text',
|
132 |
+
'label' => __( 'Google Maps Default Zoom Level', 'tribe-events-calendar' ),
|
133 |
+
'tooltip' => __( '0 = zoomed-out; 21 = zoomed-in.', 'tribe_events_calendar' ),
|
134 |
'size' => 'small',
|
135 |
'default' => 10,
|
136 |
'class' => 'google-embed-field',
|
138 |
),
|
139 |
'debugEvents' => array(
|
140 |
'type' => 'checkbox_bool',
|
141 |
+
'label' => __( 'Debug Mode', 'tribe-events-calendar' ),
|
142 |
+
'tooltip' => sprintf( __( 'Enable this option to log debug information. By default this will log to your server PHP error log. If you\'d like to see the log messages in your browser, then we recommend that you install the %s and look for the "Tribe" tab in the debug output.', 'tribe-events-calendar' ), '<a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">' . __( 'Debug Bar Plugin', 'tribe-events-calendar' ).'</a>' ),
|
143 |
'default' => false,
|
144 |
+
'validation_type' => 'boolean',
|
145 |
),
|
146 |
),
|
147 |
);
|
admin-views/tribe-options-templates.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
$template_options = array(
|
4 |
-
'' => __('Default Events Template', 'tribe-events-calendar' ),
|
5 |
-
'default' => __('Default Page Template', 'tribe-events-calendar' ),
|
6 |
);
|
7 |
$templates = get_page_templates();
|
8 |
ksort( $templates );
|
9 |
-
foreach (array_keys( $templates ) as $template ) {
|
10 |
$template_options[$templates[$template]] = $template;
|
11 |
}
|
12 |
|
@@ -15,12 +15,12 @@ $templatesTab = array(
|
|
15 |
'fields' => array(
|
16 |
'template-heading' => array(
|
17 |
'type' => 'heading',
|
18 |
-
'label' => __('Template Settings', 'tribe-events-calendar'),
|
19 |
),
|
20 |
'tribeEventsTemplate' => array(
|
21 |
'type' => 'dropdown_chosen',
|
22 |
-
'label' => __('Events Template', 'tribe-events-calendar'),
|
23 |
-
'tooltip' => __('Choose a page template to control the look and feel of your calendar.', 'tribe-events-calendar'),
|
24 |
'validation_type' => 'options',
|
25 |
'size' => 'large',
|
26 |
'default' => 'default',
|
@@ -28,15 +28,15 @@ $templatesTab = array(
|
|
28 |
),
|
29 |
'tribeEventsBeforeHTML' => array(
|
30 |
'type' => 'textarea',
|
31 |
-
'label' => __('Add HTML before calendar', 'tribe-events-calendar'),
|
32 |
-
'tooltip' => __('Some themes may require that you add extra divs before the calendar list to help with styling.<br>This is displayed directly after the header.', 'tribe-events-calendar').' '.__('You may use (x)HTML.', 'tribe-events-calendar'),
|
33 |
'validation_type' => 'html',
|
34 |
'size' => 'large',
|
35 |
),
|
36 |
'tribeEventsAfterHTML' => array(
|
37 |
'type' => 'textarea',
|
38 |
-
'label' => __('Add HTML after calendar', 'tribe-events-calendar'),
|
39 |
-
'tooltip' => __('Some themes may require that you add extra divs after the calendar list to help with styling.<br>This is displayed directly above the footer.', 'tribe-events-calendar').' '.__('You may use (x)HTML.', 'tribe-events-calendar'),
|
40 |
'validation_type' => 'html',
|
41 |
'size' => 'large',
|
42 |
),
|
1 |
<?php
|
2 |
|
3 |
$template_options = array(
|
4 |
+
'' => __( 'Default Events Template', 'tribe-events-calendar' ),
|
5 |
+
'default' => __( 'Default Page Template', 'tribe-events-calendar' ),
|
6 |
);
|
7 |
$templates = get_page_templates();
|
8 |
ksort( $templates );
|
9 |
+
foreach ( array_keys( $templates ) as $template ) {
|
10 |
$template_options[$templates[$template]] = $template;
|
11 |
}
|
12 |
|
15 |
'fields' => array(
|
16 |
'template-heading' => array(
|
17 |
'type' => 'heading',
|
18 |
+
'label' => __( 'Template Settings', 'tribe-events-calendar' ),
|
19 |
),
|
20 |
'tribeEventsTemplate' => array(
|
21 |
'type' => 'dropdown_chosen',
|
22 |
+
'label' => __( 'Events Template', 'tribe-events-calendar' ),
|
23 |
+
'tooltip' => __( 'Choose a page template to control the look and feel of your calendar.', 'tribe-events-calendar' ),
|
24 |
'validation_type' => 'options',
|
25 |
'size' => 'large',
|
26 |
'default' => 'default',
|
28 |
),
|
29 |
'tribeEventsBeforeHTML' => array(
|
30 |
'type' => 'textarea',
|
31 |
+
'label' => __( 'Add HTML before calendar', 'tribe-events-calendar' ),
|
32 |
+
'tooltip' => __( 'Some themes may require that you add extra divs before the calendar list to help with styling.<br>This is displayed directly after the header.', 'tribe-events-calendar' ) . ' ' . __( 'You may use (x)HTML.', 'tribe-events-calendar' ),
|
33 |
'validation_type' => 'html',
|
34 |
'size' => 'large',
|
35 |
),
|
36 |
'tribeEventsAfterHTML' => array(
|
37 |
'type' => 'textarea',
|
38 |
+
'label' => __( 'Add HTML after calendar', 'tribe-events-calendar' ),
|
39 |
+
'tooltip' => __( 'Some themes may require that you add extra divs after the calendar list to help with styling.<br>This is displayed directly above the footer.', 'tribe-events-calendar' ) . ' ' . __( 'You may use (x)HTML.', 'tribe-events-calendar' ),
|
40 |
'validation_type' => 'html',
|
41 |
'size' => 'large',
|
42 |
),
|
admin-views/venue-meta-box.php
CHANGED
@@ -42,9 +42,6 @@ if ( !defined('ABSPATH') ) { die('-1'); }
|
|
42 |
foreach ($countries as $abbr => $fullname) {
|
43 |
echo '<option value="' . esc_attr($fullname) . '" ';
|
44 |
|
45 |
-
if($abbr == '')
|
46 |
-
echo "disabled='disabled' ";
|
47 |
-
|
48 |
selected(($current == $fullname));
|
49 |
|
50 |
echo '>' . esc_html($fullname) . '</option>';
|
42 |
foreach ($countries as $abbr => $fullname) {
|
43 |
echo '<option value="' . esc_attr($fullname) . '" ';
|
44 |
|
|
|
|
|
|
|
45 |
selected(($current == $fullname));
|
46 |
|
47 |
echo '>' . esc_html($fullname) . '</option>';
|
lang/tribe-events-calendar.pot
CHANGED
@@ -5,8 +5,8 @@ msgid ""
|
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: The Events Calendar 2.0\n"
|
7 |
"Report-Msgid-Bugs-To: \n"
|
8 |
-
"POT-Creation-Date: 2012-
|
9 |
-
"PO-Revision-Date: 2012-
|
10 |
"Last-Translator: Paul Hughes <paul@paulalexanderhughes.com>\n"
|
11 |
"Language-Team: Modern Tribe, Inc.\n"
|
12 |
"MIME-Version: 1.0\n"
|
@@ -24,6 +24,18 @@ msgstr ""
|
|
24 |
msgid "Hide From Upcoming Events List"
|
25 |
msgstr ""
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
#: ../admin-views/events-meta-box.php:25
|
28 |
msgid "Event Time & Date"
|
29 |
msgstr ""
|
@@ -112,7 +124,7 @@ msgid "Add functionality to The Events Calendar"
|
|
112 |
msgstr ""
|
113 |
|
114 |
#: ../admin-views/tribe-options-general.php:16
|
115 |
-
#: ../lib/the-events-calendar.class.php:
|
116 |
msgid "Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?"
|
117 |
msgstr ""
|
118 |
|
@@ -277,7 +289,7 @@ msgid "FAQ"
|
|
277 |
msgstr ""
|
278 |
|
279 |
#: ../admin-views/tribe-options-help.php:92
|
280 |
-
#: ../lib/the-events-calendar.class.php:
|
281 |
msgid "Help"
|
282 |
msgstr ""
|
283 |
|
@@ -375,7 +387,7 @@ msgid "Still Not Satisfied?"
|
|
375 |
msgstr ""
|
376 |
|
377 |
#: ../admin-views/tribe-options-help.php:156
|
378 |
-
#: ../lib/the-events-calendar.class.php:
|
379 |
msgid "The Events Calendar"
|
380 |
msgstr ""
|
381 |
|
@@ -517,418 +529,417 @@ msgstr ""
|
|
517 |
msgid "If you wish to customize the widget display yourself, see the file views/events-list-load-widget-display.php inside the Events Premium plugin."
|
518 |
msgstr ""
|
519 |
|
520 |
-
#: ../lib/the-events-calendar.class.php:
|
521 |
msgid "category"
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: ../lib/the-events-calendar.class.php:
|
525 |
msgid "tag"
|
526 |
msgstr ""
|
527 |
|
528 |
-
#: ../lib/the-events-calendar.class.php:
|
529 |
msgid "month"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#: ../lib/the-events-calendar.class.php:
|
533 |
msgid "upcoming"
|
534 |
msgstr ""
|
535 |
|
536 |
-
#: ../lib/the-events-calendar.class.php:
|
537 |
msgid "past"
|
538 |
msgstr ""
|
539 |
|
540 |
-
#: ../lib/the-events-calendar.class.php:
|
541 |
msgid "venue"
|
542 |
msgstr ""
|
543 |
|
544 |
-
#: ../lib/the-events-calendar.class.php:
|
545 |
#, php-format
|
546 |
msgid "Initializing Tribe Events on %s"
|
547 |
msgstr ""
|
548 |
|
549 |
-
#: ../lib/the-events-calendar.class.php:
|
550 |
#, php-format
|
551 |
msgid "Your version of %s requires version %s or higher of The Events Calendar (you are currently running %s). Visit %shelp%s for more information."
|
552 |
msgstr ""
|
553 |
|
554 |
-
#: ../lib/the-events-calendar.class.php:
|
555 |
msgid "General"
|
556 |
msgstr ""
|
557 |
|
558 |
-
#: ../lib/the-events-calendar.class.php:
|
559 |
msgid "Template"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#: ../lib/the-events-calendar.class.php:
|
563 |
msgid "Licenses"
|
564 |
msgstr ""
|
565 |
|
566 |
-
#: ../lib/the-events-calendar.class.php:
|
567 |
#, php-format
|
568 |
msgid "Sorry, The Events Calendar requires WordPress %s or higher. Please upgrade your WordPress install."
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: ../lib/the-events-calendar.class.php:
|
572 |
#, php-format
|
573 |
msgid "Sorry, The Events Calendar requires PHP %s or higher. Talk to your Web host about moving you to a newer version of PHP."
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: ../lib/the-events-calendar.class.php:
|
577 |
msgid "Upcoming Events"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: ../lib/the-events-calendar.class.php:
|
581 |
msgid "Past Events"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: ../lib/the-events-calendar.class.php:
|
585 |
-
#: ../lib/the-events-calendar.class.php:
|
586 |
#, php-format
|
587 |
msgid "Events for %s"
|
588 |
msgstr ""
|
589 |
|
590 |
-
#: ../lib/the-events-calendar.class.php:
|
591 |
msgid "Events this month"
|
592 |
msgstr ""
|
593 |
|
594 |
-
#: ../lib/the-events-calendar.class.php:
|
595 |
#, php-format
|
596 |
msgid "Events at %s"
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: ../lib/the-events-calendar.class.php:
|
600 |
msgid "No description has been entered for this event."
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: ../lib/the-events-calendar.class.php:
|
604 |
msgid "Events"
|
605 |
msgstr ""
|
606 |
|
607 |
-
#: ../lib/the-events-calendar.class.php:
|
608 |
msgid "Event"
|
609 |
msgstr ""
|
610 |
|
611 |
-
#: ../lib/the-events-calendar.class.php:
|
612 |
-
#: ../lib/the-events-calendar.class.php:
|
613 |
-
#: ../lib/the-events-calendar.class.php:
|
614 |
msgid "Add New"
|
615 |
msgstr ""
|
616 |
|
617 |
-
#: ../lib/the-events-calendar.class.php:
|
618 |
msgid "Add New Event"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#: ../lib/the-events-calendar.class.php:
|
622 |
msgid "Edit Event"
|
623 |
msgstr ""
|
624 |
|
625 |
-
#: ../lib/the-events-calendar.class.php:
|
626 |
msgid "New Event"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: ../lib/the-events-calendar.class.php:
|
630 |
msgid "View Event"
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: ../lib/the-events-calendar.class.php:
|
634 |
msgid "Search Events"
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: ../lib/the-events-calendar.class.php:
|
638 |
msgid "No events found"
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: ../lib/the-events-calendar.class.php:
|
642 |
msgid "No events found in Trash"
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: ../lib/the-events-calendar.class.php:
|
646 |
msgid "Venues"
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: ../lib/the-events-calendar.class.php:
|
650 |
msgid "Venue"
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: ../lib/the-events-calendar.class.php:
|
654 |
msgid "Add New Venue"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: ../lib/the-events-calendar.class.php:
|
658 |
msgid "Edit Venue"
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: ../lib/the-events-calendar.class.php:
|
662 |
msgid "New Venue"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: ../lib/the-events-calendar.class.php:
|
666 |
-
#: ../lib/the-events-calendar.class.php:
|
667 |
msgid "View Venue"
|
668 |
msgstr ""
|
669 |
|
670 |
-
#: ../lib/the-events-calendar.class.php:
|
671 |
msgid "Search Venues"
|
672 |
msgstr ""
|
673 |
|
674 |
-
#: ../lib/the-events-calendar.class.php:
|
675 |
msgid "No venue found"
|
676 |
msgstr ""
|
677 |
|
678 |
-
#: ../lib/the-events-calendar.class.php:
|
679 |
msgid "No venues found in Trash"
|
680 |
msgstr ""
|
681 |
|
682 |
-
#: ../lib/the-events-calendar.class.php:
|
683 |
msgid "Organizers"
|
684 |
msgstr ""
|
685 |
|
686 |
-
#: ../lib/the-events-calendar.class.php:
|
687 |
msgid "Organizer"
|
688 |
msgstr ""
|
689 |
|
690 |
-
#: ../lib/the-events-calendar.class.php:
|
691 |
msgid "Add New Organizer"
|
692 |
msgstr ""
|
693 |
|
694 |
-
#: ../lib/the-events-calendar.class.php:
|
695 |
msgid "Edit Organizer"
|
696 |
msgstr ""
|
697 |
|
698 |
-
#: ../lib/the-events-calendar.class.php:
|
699 |
msgid "New Organizer"
|
700 |
msgstr ""
|
701 |
|
702 |
-
#: ../lib/the-events-calendar.class.php:
|
703 |
msgid "Search Organizers"
|
704 |
msgstr ""
|
705 |
|
706 |
-
#: ../lib/the-events-calendar.class.php:
|
707 |
msgid "No organizer found"
|
708 |
msgstr ""
|
709 |
|
710 |
-
#: ../lib/the-events-calendar.class.php:
|
711 |
msgid "No organizers found in Trash"
|
712 |
msgstr ""
|
713 |
|
714 |
-
#: ../lib/the-events-calendar.class.php:
|
715 |
-
#: ../lib/tribe-admin-events-list.class.php:172
|
716 |
msgid "Event Categories"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: ../lib/the-events-calendar.class.php:
|
720 |
msgid "Event Category"
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: ../lib/the-events-calendar.class.php:
|
724 |
msgid "Search Event Categories"
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: ../lib/the-events-calendar.class.php:
|
728 |
msgid "All Event Categories"
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: ../lib/the-events-calendar.class.php:
|
732 |
msgid "Parent Event Category"
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: ../lib/the-events-calendar.class.php:
|
736 |
msgid "Parent Event Category:"
|
737 |
msgstr ""
|
738 |
|
739 |
-
#: ../lib/the-events-calendar.class.php:
|
740 |
msgid "Edit Event Category"
|
741 |
msgstr ""
|
742 |
|
743 |
-
#: ../lib/the-events-calendar.class.php:
|
744 |
msgid "Update Event Category"
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: ../lib/the-events-calendar.class.php:
|
748 |
msgid "Add New Event Category"
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: ../lib/the-events-calendar.class.php:
|
752 |
msgid "New Event Category Name"
|
753 |
msgstr ""
|
754 |
|
755 |
-
#: ../lib/the-events-calendar.class.php:
|
756 |
#, php-format
|
757 |
msgid "Event updated. <a href=\"%s\">View event</a>"
|
758 |
msgstr ""
|
759 |
|
760 |
-
#: ../lib/the-events-calendar.class.php:
|
761 |
-
#: ../lib/the-events-calendar.class.php:
|
762 |
-
#: ../lib/the-events-calendar.class.php:
|
763 |
msgid "Custom field updated."
|
764 |
msgstr ""
|
765 |
|
766 |
-
#: ../lib/the-events-calendar.class.php:
|
767 |
-
#: ../lib/the-events-calendar.class.php:
|
768 |
-
#: ../lib/the-events-calendar.class.php:
|
769 |
msgid "Custom field deleted."
|
770 |
msgstr ""
|
771 |
|
772 |
-
#: ../lib/the-events-calendar.class.php:
|
773 |
msgid "Event updated."
|
774 |
msgstr ""
|
775 |
|
776 |
-
#: ../lib/the-events-calendar.class.php:
|
777 |
#, php-format
|
778 |
msgid "Event restored to revision from %s"
|
779 |
msgstr ""
|
780 |
|
781 |
-
#: ../lib/the-events-calendar.class.php:
|
782 |
#, php-format
|
783 |
msgid "Event published. <a href=\"%s\">View event</a>"
|
784 |
msgstr ""
|
785 |
|
786 |
-
#: ../lib/the-events-calendar.class.php:
|
787 |
msgid "Event saved."
|
788 |
msgstr ""
|
789 |
|
790 |
-
#: ../lib/the-events-calendar.class.php:
|
791 |
#, php-format
|
792 |
msgid "Event submitted. <a target=\"_blank\" href=\"%s\">Preview event</a>"
|
793 |
msgstr ""
|
794 |
|
795 |
-
#: ../lib/the-events-calendar.class.php:
|
796 |
#, php-format
|
797 |
msgid "Event scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview event</a>"
|
798 |
msgstr ""
|
799 |
|
800 |
-
#: ../lib/the-events-calendar.class.php:
|
801 |
-
#: ../lib/the-events-calendar.class.php:
|
802 |
-
#: ../lib/the-events-calendar.class.php:
|
803 |
msgid "M j, Y @ G:i"
|
804 |
msgstr ""
|
805 |
|
806 |
-
#: ../lib/the-events-calendar.class.php:
|
807 |
#, php-format
|
808 |
msgid "Event draft updated. <a target=\"_blank\" href=\"%s\">Preview event</a>"
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: ../lib/the-events-calendar.class.php:
|
812 |
#, php-format
|
813 |
msgid "Venue updated. <a href=\"%s\">View venue</a>"
|
814 |
msgstr ""
|
815 |
|
816 |
-
#: ../lib/the-events-calendar.class.php:
|
817 |
msgid "Venue updated."
|
818 |
msgstr ""
|
819 |
|
820 |
-
#: ../lib/the-events-calendar.class.php:
|
821 |
#, php-format
|
822 |
msgid "Venue restored to revision from %s"
|
823 |
msgstr ""
|
824 |
|
825 |
-
#: ../lib/the-events-calendar.class.php:
|
826 |
#, php-format
|
827 |
msgid "Venue published. <a href=\"%s\">View venue</a>"
|
828 |
msgstr ""
|
829 |
|
830 |
-
#: ../lib/the-events-calendar.class.php:
|
831 |
msgid "Venue saved."
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: ../lib/the-events-calendar.class.php:
|
835 |
#, php-format
|
836 |
msgid "Venue submitted. <a target=\"_blank\" href=\"%s\">Preview venue</a>"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: ../lib/the-events-calendar.class.php:
|
840 |
#, php-format
|
841 |
msgid "Venue scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview venue</a>"
|
842 |
msgstr ""
|
843 |
|
844 |
-
#: ../lib/the-events-calendar.class.php:
|
845 |
#, php-format
|
846 |
msgid "Venue draft updated. <a target=\"_blank\" href=\"%s\">Preview venue</a>"
|
847 |
msgstr ""
|
848 |
|
849 |
-
#: ../lib/the-events-calendar.class.php:
|
850 |
#, php-format
|
851 |
msgid "Organizer updated. <a href=\"%s\">View organizer</a>"
|
852 |
msgstr ""
|
853 |
|
854 |
-
#: ../lib/the-events-calendar.class.php:
|
855 |
msgid "Organizer updated."
|
856 |
msgstr ""
|
857 |
|
858 |
-
#: ../lib/the-events-calendar.class.php:
|
859 |
#, php-format
|
860 |
msgid "Organizer restored to revision from %s"
|
861 |
msgstr ""
|
862 |
|
863 |
-
#: ../lib/the-events-calendar.class.php:
|
864 |
#, php-format
|
865 |
msgid "Organizer published. <a href=\"%s\">View organizer</a>"
|
866 |
msgstr ""
|
867 |
|
868 |
-
#: ../lib/the-events-calendar.class.php:
|
869 |
msgid "Organizer saved."
|
870 |
msgstr ""
|
871 |
|
872 |
-
#: ../lib/the-events-calendar.class.php:
|
873 |
#, php-format
|
874 |
msgid "Organizer submitted. <a target=\"_blank\" href=\"%s\">Preview organizer</a>"
|
875 |
msgstr ""
|
876 |
|
877 |
-
#: ../lib/the-events-calendar.class.php:
|
878 |
#, php-format
|
879 |
msgid "Organizer scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview organizer</a>"
|
880 |
msgstr ""
|
881 |
|
882 |
-
#: ../lib/the-events-calendar.class.php:
|
883 |
#, php-format
|
884 |
msgid "Organizer draft updated. <a target=\"_blank\" href=\"%s\">Preview organizer</a>"
|
885 |
msgstr ""
|
886 |
|
887 |
-
#: ../lib/the-events-calendar.class.php:
|
888 |
msgid "Next"
|
889 |
msgstr ""
|
890 |
|
891 |
-
#: ../lib/the-events-calendar.class.php:
|
892 |
msgid "Prev"
|
893 |
msgstr ""
|
894 |
|
895 |
-
#: ../lib/the-events-calendar.class.php:
|
896 |
msgid "Today"
|
897 |
msgstr ""
|
898 |
|
899 |
-
#: ../lib/the-events-calendar.class.php:
|
900 |
msgid "Done"
|
901 |
msgstr ""
|
902 |
|
903 |
-
#: ../lib/the-events-calendar.class.php:
|
904 |
msgid "Event Options"
|
905 |
msgstr ""
|
906 |
|
907 |
-
#: ../lib/the-events-calendar.class.php:
|
908 |
msgid "Venue Information"
|
909 |
msgstr ""
|
910 |
|
911 |
-
#: ../lib/the-events-calendar.class.php:
|
912 |
msgid "Organizer Information"
|
913 |
msgstr ""
|
914 |
|
915 |
-
#: ../lib/the-events-calendar.class.php:
|
916 |
msgid "Support"
|
917 |
msgstr ""
|
918 |
|
919 |
-
#: ../lib/the-events-calendar.class.php:
|
920 |
msgid "View All Add-Ons"
|
921 |
msgstr ""
|
922 |
|
923 |
-
#: ../lib/the-events-calendar.class.php:
|
924 |
msgid "News from Modern Tribe"
|
925 |
msgstr ""
|
926 |
|
927 |
-
#: ../lib/the-events-calendar.class.php:
|
928 |
msgid "Additional Functionality"
|
929 |
msgstr ""
|
930 |
|
931 |
-
#: ../lib/the-events-calendar.class.php:
|
932 |
#, php-format
|
933 |
msgid "Check out the <a href=\"%s\">available Add-Ons</a>."
|
934 |
msgstr ""
|
@@ -980,15 +991,15 @@ msgstr ""
|
|
980 |
msgid "Invalid field type specified"
|
981 |
msgstr ""
|
982 |
|
983 |
-
#: ../lib/tribe-field.class.php:
|
984 |
msgid "No radio options specified"
|
985 |
msgstr ""
|
986 |
|
987 |
-
#: ../lib/tribe-field.class.php:
|
988 |
msgid "No checkbox options specified"
|
989 |
msgstr ""
|
990 |
|
991 |
-
#: ../lib/tribe-field.class.php:
|
992 |
msgid "No select options specified"
|
993 |
msgstr ""
|
994 |
|
@@ -1084,57 +1095,58 @@ msgid "%s must be a valid absolute URL."
|
|
1084 |
msgstr ""
|
1085 |
|
1086 |
#: ../lib/tribe-validate.class.php:193
|
1087 |
-
#: ../lib/tribe-validate.class.php:
|
|
|
1088 |
#, php-format
|
1089 |
msgid "%s must have a value that's part of its options."
|
1090 |
msgstr ""
|
1091 |
|
1092 |
-
#: ../lib/tribe-validate.class.php:
|
1093 |
#, php-format
|
1094 |
msgid "Comparison validation failed because no comparison value was provided, for field %s"
|
1095 |
msgstr ""
|
1096 |
|
1097 |
-
#: ../lib/tribe-validate.class.php:
|
1098 |
#, php-format
|
1099 |
msgid "%s cannot be the same as %s."
|
1100 |
msgstr ""
|
1101 |
|
1102 |
-
#: ../lib/tribe-validate.class.php:
|
1103 |
#, php-format
|
1104 |
msgid "%s cannot be a duplicate"
|
1105 |
msgstr ""
|
1106 |
|
1107 |
-
#: ../lib/tribe-validate.class.php:
|
1108 |
#, php-format
|
1109 |
msgid "%s must be a number or percentage."
|
1110 |
msgstr ""
|
1111 |
|
1112 |
-
#: ../lib/tribe-validate.class.php:
|
1113 |
#, php-format
|
1114 |
msgid "%s must be a number between 0 and 21."
|
1115 |
msgstr ""
|
1116 |
|
1117 |
-
#: ../lib/tribe-validate.class.php:
|
1118 |
#, php-format
|
1119 |
msgid "%s must consist of letters, numbers, dashes, and spaces only."
|
1120 |
msgstr ""
|
1121 |
|
1122 |
-
#: ../lib/tribe-validate.class.php:
|
1123 |
#, php-format
|
1124 |
msgid "%s must consist of letters, spaces, and dashes."
|
1125 |
msgstr ""
|
1126 |
|
1127 |
-
#: ../lib/tribe-validate.class.php:
|
1128 |
#, php-format
|
1129 |
msgid "%s must consist of 5 numbers."
|
1130 |
msgstr ""
|
1131 |
|
1132 |
-
#: ../lib/tribe-validate.class.php:
|
1133 |
#, php-format
|
1134 |
msgid "%s must be a phone number."
|
1135 |
msgstr ""
|
1136 |
|
1137 |
-
#: ../lib/tribe-validate.class.php:
|
1138 |
msgid "Country List must be formatted as one country per line in the following format: <br>US, United States <br> UK, United Kingdom."
|
1139 |
msgstr ""
|
1140 |
|
@@ -2350,6 +2362,23 @@ msgstr ""
|
|
2350 |
msgid "Here is the iCal feed URL for your events:"
|
2351 |
msgstr ""
|
2352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2353 |
#: ../views/ecp-single-template.php:24
|
2354 |
msgid "Edit"
|
2355 |
msgstr ""
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: The Events Calendar 2.0\n"
|
7 |
"Report-Msgid-Bugs-To: \n"
|
8 |
+
"POT-Creation-Date: 2012-05-01 17:05-0500\n"
|
9 |
+
"PO-Revision-Date: 2012-05-01 17:06-0500\n"
|
10 |
"Last-Translator: Paul Hughes <paul@paulalexanderhughes.com>\n"
|
11 |
"Language-Team: Modern Tribe, Inc.\n"
|
12 |
"MIME-Version: 1.0\n"
|
24 |
msgid "Hide From Upcoming Events List"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: ../admin-views/events-audit-trail.php:41
|
28 |
+
msgid "Auditing Information"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: ../admin-views/events-audit-trail.php:44
|
32 |
+
msgid "Created by:"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: ../admin-views/events-audit-trail.php:48
|
36 |
+
msgid "Audit Trail:"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
#: ../admin-views/events-meta-box.php:25
|
40 |
msgid "Event Time & Date"
|
41 |
msgstr ""
|
124 |
msgstr ""
|
125 |
|
126 |
#: ../admin-views/tribe-options-general.php:16
|
127 |
+
#: ../lib/the-events-calendar.class.php:2500
|
128 |
msgid "Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?"
|
129 |
msgstr ""
|
130 |
|
289 |
msgstr ""
|
290 |
|
291 |
#: ../admin-views/tribe-options-help.php:92
|
292 |
+
#: ../lib/the-events-calendar.class.php:416
|
293 |
msgid "Help"
|
294 |
msgstr ""
|
295 |
|
387 |
msgstr ""
|
388 |
|
389 |
#: ../admin-views/tribe-options-help.php:156
|
390 |
+
#: ../lib/the-events-calendar.class.php:275
|
391 |
msgid "The Events Calendar"
|
392 |
msgstr ""
|
393 |
|
529 |
msgid "If you wish to customize the widget display yourself, see the file views/events-list-load-widget-display.php inside the Events Premium plugin."
|
530 |
msgstr ""
|
531 |
|
532 |
+
#: ../lib/the-events-calendar.class.php:278
|
533 |
msgid "category"
|
534 |
msgstr ""
|
535 |
|
536 |
+
#: ../lib/the-events-calendar.class.php:279
|
537 |
msgid "tag"
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: ../lib/the-events-calendar.class.php:280
|
541 |
msgid "month"
|
542 |
msgstr ""
|
543 |
|
544 |
+
#: ../lib/the-events-calendar.class.php:281
|
545 |
msgid "upcoming"
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: ../lib/the-events-calendar.class.php:282
|
549 |
msgid "past"
|
550 |
msgstr ""
|
551 |
|
552 |
+
#: ../lib/the-events-calendar.class.php:284
|
553 |
msgid "venue"
|
554 |
msgstr ""
|
555 |
|
556 |
+
#: ../lib/the-events-calendar.class.php:294
|
557 |
#, php-format
|
558 |
msgid "Initializing Tribe Events on %s"
|
559 |
msgstr ""
|
560 |
|
561 |
+
#: ../lib/the-events-calendar.class.php:374
|
562 |
#, php-format
|
563 |
msgid "Your version of %s requires version %s or higher of The Events Calendar (you are currently running %s). Visit %shelp%s for more information."
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: ../lib/the-events-calendar.class.php:412
|
567 |
msgid "General"
|
568 |
msgstr ""
|
569 |
|
570 |
+
#: ../lib/the-events-calendar.class.php:413
|
571 |
msgid "Template"
|
572 |
msgstr ""
|
573 |
|
574 |
+
#: ../lib/the-events-calendar.class.php:414
|
575 |
msgid "Licenses"
|
576 |
msgstr ""
|
577 |
|
578 |
+
#: ../lib/the-events-calendar.class.php:450
|
579 |
#, php-format
|
580 |
msgid "Sorry, The Events Calendar requires WordPress %s or higher. Please upgrade your WordPress install."
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: ../lib/the-events-calendar.class.php:453
|
584 |
#, php-format
|
585 |
msgid "Sorry, The Events Calendar requires PHP %s or higher. Talk to your Web host about moving you to a newer version of PHP."
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: ../lib/the-events-calendar.class.php:574
|
589 |
msgid "Upcoming Events"
|
590 |
msgstr ""
|
591 |
|
592 |
+
#: ../lib/the-events-calendar.class.php:576
|
593 |
msgid "Past Events"
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: ../lib/the-events-calendar.class.php:580
|
597 |
+
#: ../lib/the-events-calendar.class.php:586
|
598 |
#, php-format
|
599 |
msgid "Events for %s"
|
600 |
msgstr ""
|
601 |
|
602 |
+
#: ../lib/the-events-calendar.class.php:582
|
603 |
msgid "Events this month"
|
604 |
msgstr ""
|
605 |
|
606 |
+
#: ../lib/the-events-calendar.class.php:592
|
607 |
#, php-format
|
608 |
msgid "Events at %s"
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: ../lib/the-events-calendar.class.php:605
|
612 |
msgid "No description has been entered for this event."
|
613 |
msgstr ""
|
614 |
|
615 |
+
#: ../lib/the-events-calendar.class.php:849
|
616 |
msgid "Events"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: ../lib/the-events-calendar.class.php:850
|
620 |
msgid "Event"
|
621 |
msgstr ""
|
622 |
|
623 |
+
#: ../lib/the-events-calendar.class.php:851
|
624 |
+
#: ../lib/the-events-calendar.class.php:864
|
625 |
+
#: ../lib/the-events-calendar.class.php:877
|
626 |
msgid "Add New"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: ../lib/the-events-calendar.class.php:852
|
630 |
msgid "Add New Event"
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: ../lib/the-events-calendar.class.php:853
|
634 |
msgid "Edit Event"
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: ../lib/the-events-calendar.class.php:854
|
638 |
msgid "New Event"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: ../lib/the-events-calendar.class.php:855
|
642 |
msgid "View Event"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: ../lib/the-events-calendar.class.php:856
|
646 |
msgid "Search Events"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: ../lib/the-events-calendar.class.php:857
|
650 |
msgid "No events found"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: ../lib/the-events-calendar.class.php:858
|
654 |
msgid "No events found in Trash"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: ../lib/the-events-calendar.class.php:862
|
658 |
msgid "Venues"
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: ../lib/the-events-calendar.class.php:863
|
662 |
msgid "Venue"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: ../lib/the-events-calendar.class.php:865
|
666 |
msgid "Add New Venue"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: ../lib/the-events-calendar.class.php:866
|
670 |
msgid "Edit Venue"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: ../lib/the-events-calendar.class.php:867
|
674 |
msgid "New Venue"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: ../lib/the-events-calendar.class.php:868
|
678 |
+
#: ../lib/the-events-calendar.class.php:881
|
679 |
msgid "View Venue"
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: ../lib/the-events-calendar.class.php:869
|
683 |
msgid "Search Venues"
|
684 |
msgstr ""
|
685 |
|
686 |
+
#: ../lib/the-events-calendar.class.php:870
|
687 |
msgid "No venue found"
|
688 |
msgstr ""
|
689 |
|
690 |
+
#: ../lib/the-events-calendar.class.php:871
|
691 |
msgid "No venues found in Trash"
|
692 |
msgstr ""
|
693 |
|
694 |
+
#: ../lib/the-events-calendar.class.php:875
|
695 |
msgid "Organizers"
|
696 |
msgstr ""
|
697 |
|
698 |
+
#: ../lib/the-events-calendar.class.php:876
|
699 |
msgid "Organizer"
|
700 |
msgstr ""
|
701 |
|
702 |
+
#: ../lib/the-events-calendar.class.php:878
|
703 |
msgid "Add New Organizer"
|
704 |
msgstr ""
|
705 |
|
706 |
+
#: ../lib/the-events-calendar.class.php:879
|
707 |
msgid "Edit Organizer"
|
708 |
msgstr ""
|
709 |
|
710 |
+
#: ../lib/the-events-calendar.class.php:880
|
711 |
msgid "New Organizer"
|
712 |
msgstr ""
|
713 |
|
714 |
+
#: ../lib/the-events-calendar.class.php:882
|
715 |
msgid "Search Organizers"
|
716 |
msgstr ""
|
717 |
|
718 |
+
#: ../lib/the-events-calendar.class.php:883
|
719 |
msgid "No organizer found"
|
720 |
msgstr ""
|
721 |
|
722 |
+
#: ../lib/the-events-calendar.class.php:884
|
723 |
msgid "No organizers found in Trash"
|
724 |
msgstr ""
|
725 |
|
726 |
+
#: ../lib/the-events-calendar.class.php:888
|
|
|
727 |
msgid "Event Categories"
|
728 |
msgstr ""
|
729 |
|
730 |
+
#: ../lib/the-events-calendar.class.php:889
|
731 |
msgid "Event Category"
|
732 |
msgstr ""
|
733 |
|
734 |
+
#: ../lib/the-events-calendar.class.php:890
|
735 |
msgid "Search Event Categories"
|
736 |
msgstr ""
|
737 |
|
738 |
+
#: ../lib/the-events-calendar.class.php:891
|
739 |
msgid "All Event Categories"
|
740 |
msgstr ""
|
741 |
|
742 |
+
#: ../lib/the-events-calendar.class.php:892
|
743 |
msgid "Parent Event Category"
|
744 |
msgstr ""
|
745 |
|
746 |
+
#: ../lib/the-events-calendar.class.php:893
|
747 |
msgid "Parent Event Category:"
|
748 |
msgstr ""
|
749 |
|
750 |
+
#: ../lib/the-events-calendar.class.php:894
|
751 |
msgid "Edit Event Category"
|
752 |
msgstr ""
|
753 |
|
754 |
+
#: ../lib/the-events-calendar.class.php:895
|
755 |
msgid "Update Event Category"
|
756 |
msgstr ""
|
757 |
|
758 |
+
#: ../lib/the-events-calendar.class.php:896
|
759 |
msgid "Add New Event Category"
|
760 |
msgstr ""
|
761 |
|
762 |
+
#: ../lib/the-events-calendar.class.php:897
|
763 |
msgid "New Event Category Name"
|
764 |
msgstr ""
|
765 |
|
766 |
+
#: ../lib/the-events-calendar.class.php:907
|
767 |
#, php-format
|
768 |
msgid "Event updated. <a href=\"%s\">View event</a>"
|
769 |
msgstr ""
|
770 |
|
771 |
+
#: ../lib/the-events-calendar.class.php:908
|
772 |
+
#: ../lib/the-events-calendar.class.php:925
|
773 |
+
#: ../lib/the-events-calendar.class.php:942
|
774 |
msgid "Custom field updated."
|
775 |
msgstr ""
|
776 |
|
777 |
+
#: ../lib/the-events-calendar.class.php:909
|
778 |
+
#: ../lib/the-events-calendar.class.php:926
|
779 |
+
#: ../lib/the-events-calendar.class.php:943
|
780 |
msgid "Custom field deleted."
|
781 |
msgstr ""
|
782 |
|
783 |
+
#: ../lib/the-events-calendar.class.php:910
|
784 |
msgid "Event updated."
|
785 |
msgstr ""
|
786 |
|
787 |
+
#: ../lib/the-events-calendar.class.php:912
|
788 |
#, php-format
|
789 |
msgid "Event restored to revision from %s"
|
790 |
msgstr ""
|
791 |
|
792 |
+
#: ../lib/the-events-calendar.class.php:913
|
793 |
#, php-format
|
794 |
msgid "Event published. <a href=\"%s\">View event</a>"
|
795 |
msgstr ""
|
796 |
|
797 |
+
#: ../lib/the-events-calendar.class.php:914
|
798 |
msgid "Event saved."
|
799 |
msgstr ""
|
800 |
|
801 |
+
#: ../lib/the-events-calendar.class.php:915
|
802 |
#, php-format
|
803 |
msgid "Event submitted. <a target=\"_blank\" href=\"%s\">Preview event</a>"
|
804 |
msgstr ""
|
805 |
|
806 |
+
#: ../lib/the-events-calendar.class.php:916
|
807 |
#, php-format
|
808 |
msgid "Event scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview event</a>"
|
809 |
msgstr ""
|
810 |
|
811 |
+
#: ../lib/the-events-calendar.class.php:918
|
812 |
+
#: ../lib/the-events-calendar.class.php:935
|
813 |
+
#: ../lib/the-events-calendar.class.php:952
|
814 |
msgid "M j, Y @ G:i"
|
815 |
msgstr ""
|
816 |
|
817 |
+
#: ../lib/the-events-calendar.class.php:919
|
818 |
#, php-format
|
819 |
msgid "Event draft updated. <a target=\"_blank\" href=\"%s\">Preview event</a>"
|
820 |
msgstr ""
|
821 |
|
822 |
+
#: ../lib/the-events-calendar.class.php:924
|
823 |
#, php-format
|
824 |
msgid "Venue updated. <a href=\"%s\">View venue</a>"
|
825 |
msgstr ""
|
826 |
|
827 |
+
#: ../lib/the-events-calendar.class.php:927
|
828 |
msgid "Venue updated."
|
829 |
msgstr ""
|
830 |
|
831 |
+
#: ../lib/the-events-calendar.class.php:929
|
832 |
#, php-format
|
833 |
msgid "Venue restored to revision from %s"
|
834 |
msgstr ""
|
835 |
|
836 |
+
#: ../lib/the-events-calendar.class.php:930
|
837 |
#, php-format
|
838 |
msgid "Venue published. <a href=\"%s\">View venue</a>"
|
839 |
msgstr ""
|
840 |
|
841 |
+
#: ../lib/the-events-calendar.class.php:931
|
842 |
msgid "Venue saved."
|
843 |
msgstr ""
|
844 |
|
845 |
+
#: ../lib/the-events-calendar.class.php:932
|
846 |
#, php-format
|
847 |
msgid "Venue submitted. <a target=\"_blank\" href=\"%s\">Preview venue</a>"
|
848 |
msgstr ""
|
849 |
|
850 |
+
#: ../lib/the-events-calendar.class.php:933
|
851 |
#, php-format
|
852 |
msgid "Venue scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview venue</a>"
|
853 |
msgstr ""
|
854 |
|
855 |
+
#: ../lib/the-events-calendar.class.php:936
|
856 |
#, php-format
|
857 |
msgid "Venue draft updated. <a target=\"_blank\" href=\"%s\">Preview venue</a>"
|
858 |
msgstr ""
|
859 |
|
860 |
+
#: ../lib/the-events-calendar.class.php:941
|
861 |
#, php-format
|
862 |
msgid "Organizer updated. <a href=\"%s\">View organizer</a>"
|
863 |
msgstr ""
|
864 |
|
865 |
+
#: ../lib/the-events-calendar.class.php:944
|
866 |
msgid "Organizer updated."
|
867 |
msgstr ""
|
868 |
|
869 |
+
#: ../lib/the-events-calendar.class.php:946
|
870 |
#, php-format
|
871 |
msgid "Organizer restored to revision from %s"
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: ../lib/the-events-calendar.class.php:947
|
875 |
#, php-format
|
876 |
msgid "Organizer published. <a href=\"%s\">View organizer</a>"
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: ../lib/the-events-calendar.class.php:948
|
880 |
msgid "Organizer saved."
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: ../lib/the-events-calendar.class.php:949
|
884 |
#, php-format
|
885 |
msgid "Organizer submitted. <a target=\"_blank\" href=\"%s\">Preview organizer</a>"
|
886 |
msgstr ""
|
887 |
|
888 |
+
#: ../lib/the-events-calendar.class.php:950
|
889 |
#, php-format
|
890 |
msgid "Organizer scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview organizer</a>"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#: ../lib/the-events-calendar.class.php:953
|
894 |
#, php-format
|
895 |
msgid "Organizer draft updated. <a target=\"_blank\" href=\"%s\">Preview organizer</a>"
|
896 |
msgstr ""
|
897 |
|
898 |
+
#: ../lib/the-events-calendar.class.php:1049
|
899 |
msgid "Next"
|
900 |
msgstr ""
|
901 |
|
902 |
+
#: ../lib/the-events-calendar.class.php:1050
|
903 |
msgid "Prev"
|
904 |
msgstr ""
|
905 |
|
906 |
+
#: ../lib/the-events-calendar.class.php:1051
|
907 |
msgid "Today"
|
908 |
msgstr ""
|
909 |
|
910 |
+
#: ../lib/the-events-calendar.class.php:1052
|
911 |
msgid "Done"
|
912 |
msgstr ""
|
913 |
|
914 |
+
#: ../lib/the-events-calendar.class.php:2324
|
915 |
msgid "Event Options"
|
916 |
msgstr ""
|
917 |
|
918 |
+
#: ../lib/the-events-calendar.class.php:2326
|
919 |
msgid "Venue Information"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: ../lib/the-events-calendar.class.php:2327
|
923 |
msgid "Organizer Information"
|
924 |
msgstr ""
|
925 |
|
926 |
+
#: ../lib/the-events-calendar.class.php:2440
|
927 |
msgid "Support"
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: ../lib/the-events-calendar.class.php:2443
|
931 |
msgid "View All Add-Ons"
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: ../lib/the-events-calendar.class.php:2450
|
935 |
msgid "News from Modern Tribe"
|
936 |
msgstr ""
|
937 |
|
938 |
+
#: ../lib/the-events-calendar.class.php:2495
|
939 |
msgid "Additional Functionality"
|
940 |
msgstr ""
|
941 |
|
942 |
+
#: ../lib/the-events-calendar.class.php:2500
|
943 |
#, php-format
|
944 |
msgid "Check out the <a href=\"%s\">available Add-Ons</a>."
|
945 |
msgstr ""
|
991 |
msgid "Invalid field type specified"
|
992 |
msgstr ""
|
993 |
|
994 |
+
#: ../lib/tribe-field.class.php:387
|
995 |
msgid "No radio options specified"
|
996 |
msgstr ""
|
997 |
|
998 |
+
#: ../lib/tribe-field.class.php:424
|
999 |
msgid "No checkbox options specified"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
+
#: ../lib/tribe-field.class.php:478
|
1003 |
msgid "No select options specified"
|
1004 |
msgstr ""
|
1005 |
|
1095 |
msgstr ""
|
1096 |
|
1097 |
#: ../lib/tribe-validate.class.php:193
|
1098 |
+
#: ../lib/tribe-validate.class.php:214
|
1099 |
+
#: ../lib/tribe-validate.class.php:236
|
1100 |
#, php-format
|
1101 |
msgid "%s must have a value that's part of its options."
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: ../lib/tribe-validate.class.php:252
|
1105 |
#, php-format
|
1106 |
msgid "Comparison validation failed because no comparison value was provided, for field %s"
|
1107 |
msgstr ""
|
1108 |
|
1109 |
+
#: ../lib/tribe-validate.class.php:259
|
1110 |
#, php-format
|
1111 |
msgid "%s cannot be the same as %s."
|
1112 |
msgstr ""
|
1113 |
|
1114 |
+
#: ../lib/tribe-validate.class.php:261
|
1115 |
#, php-format
|
1116 |
msgid "%s cannot be a duplicate"
|
1117 |
msgstr ""
|
1118 |
|
1119 |
+
#: ../lib/tribe-validate.class.php:279
|
1120 |
#, php-format
|
1121 |
msgid "%s must be a number or percentage."
|
1122 |
msgstr ""
|
1123 |
|
1124 |
+
#: ../lib/tribe-validate.class.php:343
|
1125 |
#, php-format
|
1126 |
msgid "%s must be a number between 0 and 21."
|
1127 |
msgstr ""
|
1128 |
|
1129 |
+
#: ../lib/tribe-validate.class.php:360
|
1130 |
#, php-format
|
1131 |
msgid "%s must consist of letters, numbers, dashes, and spaces only."
|
1132 |
msgstr ""
|
1133 |
|
1134 |
+
#: ../lib/tribe-validate.class.php:377
|
1135 |
#, php-format
|
1136 |
msgid "%s must consist of letters, spaces, and dashes."
|
1137 |
msgstr ""
|
1138 |
|
1139 |
+
#: ../lib/tribe-validate.class.php:393
|
1140 |
#, php-format
|
1141 |
msgid "%s must consist of 5 numbers."
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: ../lib/tribe-validate.class.php:409
|
1145 |
#, php-format
|
1146 |
msgid "%s must be a phone number."
|
1147 |
msgstr ""
|
1148 |
|
1149 |
+
#: ../lib/tribe-validate.class.php:427
|
1150 |
msgid "Country List must be formatted as one country per line in the following format: <br>US, United States <br> UK, United Kingdom."
|
1151 |
msgstr ""
|
1152 |
|
2362 |
msgid "Here is the iCal feed URL for your events:"
|
2363 |
msgstr ""
|
2364 |
|
2365 |
+
#: ../vendor/wp-router/WP_Route.class.php:250
|
2366 |
+
msgid "You are not authorized to access this page"
|
2367 |
+
msgstr ""
|
2368 |
+
|
2369 |
+
#: ../vendor/wp-router/WP_Route.class.php:251
|
2370 |
+
msgid "Access Denied"
|
2371 |
+
msgstr ""
|
2372 |
+
|
2373 |
+
#: ../vendor/wp-router/WP_Router_Page.class.php:78
|
2374 |
+
msgid "WP Router Placeholder Page"
|
2375 |
+
msgstr ""
|
2376 |
+
|
2377 |
+
#: ../vendor/wp-router/WP_Router_Utility.class.php:71
|
2378 |
+
#, php-format
|
2379 |
+
msgid "%1$s requires WordPress %2$s or higher and PHP %3$s or higher."
|
2380 |
+
msgstr ""
|
2381 |
+
|
2382 |
#: ../views/ecp-single-template.php:24
|
2383 |
msgid "Edit"
|
2384 |
msgstr ""
|
lib/template-tags-deprecated.php
CHANGED
@@ -211,9 +211,11 @@ if ( class_exists('TribeEvents') ) {
|
|
211 |
}
|
212 |
|
213 |
/* SP Template Tags. Deprecated in favor of return tribe_ */
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
217 |
}
|
218 |
|
219 |
function sp_calendar_grid() {
|
211 |
}
|
212 |
|
213 |
/* SP Template Tags. Deprecated in favor of return tribe_ */
|
214 |
+
if ( !function_exists( 'sp_get_option' ) ) {
|
215 |
+
function sp_get_option($optionName, $default = '') {
|
216 |
+
_deprecated_function( __FUNCTION__, '2.0', 'tribe_get_option()' );
|
217 |
+
return tribe_get_option($optionName, $default);
|
218 |
+
}
|
219 |
}
|
220 |
|
221 |
function sp_calendar_grid() {
|
lib/the-events-calendar.class.php
CHANGED
@@ -16,7 +16,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
16 |
const VENUE_POST_TYPE = 'tribe_venue';
|
17 |
const ORGANIZER_POST_TYPE = 'tribe_organizer';
|
18 |
const PLUGIN_DOMAIN = 'tribe-events-calendar';
|
19 |
-
const VERSION = '2.0.
|
20 |
const FEED_URL = 'http://tri.be/category/products/feed/';
|
21 |
const INFO_API_URL = 'http://wpapi.org/api/plugin/the-events-calendar.php';
|
22 |
const WP_PLUGIN_URL = 'http://wordpress.org/extend/plugins/the-events-calendar/';
|
@@ -168,7 +168,6 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
168 |
require_once( $this->pluginPath.'public/template-tags/venue.php' );
|
169 |
require_once( $this->pluginPath.'public/template-tags/date.php' );
|
170 |
require_once( $this->pluginPath.'public/template-tags/link.php' );
|
171 |
-
if (is_admin()) require_once( $this->pluginPath.'public/template-tags/options.php' );
|
172 |
|
173 |
// Load Advanced Functions
|
174 |
require_once( $this->pluginPath.'public/advanced-functions/event.php' );
|
@@ -219,6 +218,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
219 |
add_action( 'save_post', array( $this, 'save_venue_data' ), 16, 2 );
|
220 |
add_action( 'save_post', array( $this, 'save_organizer_data' ), 16, 2 );
|
221 |
add_action( 'save_post', array( $this, 'addToPostAuditTrail' ), 10, 2 );
|
|
|
222 |
add_action( 'pre_get_posts', array( $this, 'setDate' ));
|
223 |
add_action( 'wp', array( $this, 'setDisplay' ));
|
224 |
add_action( 'tribe_events_post_errors', array( 'TribeEventsPostException', 'displayMessage' ) );
|
@@ -230,6 +230,10 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
230 |
add_action( "trash_" . TribeEvents::ORGANIZER_POST_TYPE, array($this, 'cleanupPostOrganizers'));
|
231 |
add_action( "wp_ajax_tribe_event_validation", array($this,'ajax_form_validate') );
|
232 |
add_action( 'tribe_debug', array( $this, 'renderDebug' ), 10, 2 );
|
|
|
|
|
|
|
|
|
233 |
// noindex grid view
|
234 |
add_action('wp_head', array( $this, 'noindex_months' ) );
|
235 |
add_action( 'plugin_row_meta', array( $this, 'addMetaLinks' ), 10, 2 );
|
@@ -248,7 +252,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
248 |
add_action( 'admin_notices', array( $this, 'checkAddOnCompatibility' ) );
|
249 |
}
|
250 |
|
251 |
-
public static function ecpActive( $version = '2.0.
|
252 |
return class_exists( 'TribeEventsPro' ) && defined('TribeEventsPro::VERSION') && version_compare( TribeEventsPro::VERSION, $version, '>=');
|
253 |
}
|
254 |
|
@@ -312,7 +316,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
312 |
}
|
313 |
|
314 |
public function maybeRenameOptions() {
|
315 |
-
if ( version_compare( get_option('tribe_events_db_version'), '2.0.
|
316 |
$option_names = array(
|
317 |
'spEventsTemplate' => 'tribeEventsTemplate',
|
318 |
'spEventsBeforeHTML' => 'tribeEventsBeforeHTML',
|
@@ -327,7 +331,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
327 |
unset( $current_options[$old_option_names[$i]] );
|
328 |
}
|
329 |
$this->setOptions( wp_parse_args( $new_options, $current_options ) );
|
330 |
-
update_option('tribe_events_db_version', '2.0.
|
331 |
}
|
332 |
}
|
333 |
|
@@ -605,7 +609,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
605 |
public function accessibleMonthForm() {
|
606 |
if ( isset($_GET['EventJumpToMonth']) && isset($_GET['EventJumpToYear'] )) {
|
607 |
$_GET['eventDisplay'] = 'month';
|
608 |
-
$_GET['eventDate'] = $_GET['EventJumpToYear'] . '-' . $_GET['EventJumpToMonth'];
|
609 |
}
|
610 |
}
|
611 |
|
@@ -652,144 +656,154 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
652 |
|
653 |
private function addCapabilities() {
|
654 |
$role = get_role( 'administrator' );
|
655 |
-
$role
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
|
|
|
|
696 |
|
697 |
$editor = get_role( 'editor' );
|
698 |
-
$editor
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
$editor->add_cap( 'edit_tribe_venue' );
|
713 |
-
$editor->add_cap( 'read_tribe_venue' );
|
714 |
-
$editor->add_cap( 'delete_tribe_venue' );
|
715 |
-
$editor->add_cap( 'delete_tribe_venues');
|
716 |
-
$editor->add_cap( 'edit_tribe_venues' );
|
717 |
-
$editor->add_cap( 'edit_others_tribe_venues' );
|
718 |
-
$editor->add_cap( 'delete_others_tribe_venues' );
|
719 |
-
$editor->add_cap( 'publish_tribe_venues' );
|
720 |
-
$editor->add_cap( 'edit_published_tribe_venues' );
|
721 |
-
$editor->add_cap( 'delete_published_tribe_venues' );
|
722 |
-
$editor->add_cap( 'delete_private_tribe_venues' );
|
723 |
-
$editor->add_cap( 'edit_private_tribe_venues' );
|
724 |
-
$editor->add_cap( 'read_private_tribe_venues' );
|
725 |
-
|
726 |
-
$editor->add_cap( 'edit_tribe_organizer' );
|
727 |
-
$editor->add_cap( 'read_tribe_organizer' );
|
728 |
-
$editor->add_cap( 'delete_tribe_organizer' );
|
729 |
-
$editor->add_cap( 'delete_tribe_organizers');
|
730 |
-
$editor->add_cap( 'edit_tribe_organizers' );
|
731 |
-
$editor->add_cap( 'edit_others_tribe_organizers' );
|
732 |
-
$editor->add_cap( 'delete_others_tribe_organizers' );
|
733 |
-
$editor->add_cap( 'publish_tribe_organizers' );
|
734 |
-
$editor->add_cap( 'edit_published_tribe_organizers' );
|
735 |
-
$editor->add_cap( 'delete_published_tribe_organizers' );
|
736 |
-
$editor->add_cap( 'delete_private_tribe_organizers' );
|
737 |
-
$editor->add_cap( 'edit_private_tribe_organizers' );
|
738 |
-
$editor->add_cap( 'read_private_tribe_organizers' );
|
739 |
-
|
740 |
-
$author = get_role( 'author' );
|
741 |
-
$author->add_cap( 'edit_tribe_event' );
|
742 |
-
$author->add_cap( 'read_tribe_event' );
|
743 |
-
$author->add_cap( 'delete_tribe_event' );
|
744 |
-
$author->add_cap( 'delete_tribe_events' );
|
745 |
-
$author->add_cap( 'edit_tribe_events' );
|
746 |
-
$author->add_cap( 'publish_tribe_events' );
|
747 |
-
$author->add_cap( 'edit_published_tribe_events' );
|
748 |
-
$author->add_cap( 'delete_published_tribe_events' );
|
749 |
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
|
|
|
|
|
|
|
|
|
|
758 |
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
$contributor->add_cap( 'edit_tribe_events' );
|
774 |
|
775 |
-
$
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
|
781 |
-
$contributor
|
782 |
-
$contributor
|
783 |
-
|
784 |
-
|
785 |
-
|
|
|
|
|
786 |
|
787 |
-
|
788 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
|
790 |
-
$subscriber
|
791 |
-
|
792 |
-
|
|
|
|
|
|
|
|
|
|
|
793 |
}
|
794 |
|
795 |
public function registerPostType() {
|
@@ -1689,10 +1703,10 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1689 |
* editing the venue/organizer from within the event.
|
1690 |
*/
|
1691 |
if( isset($_POST['Venue']['VenueID']) && !empty($_POST['Venue']['VenueID']) && class_exists('TribeEventsPro') )
|
1692 |
-
$_POST['Venue'] = array('VenueID' => $_POST['Venue']['VenueID']);
|
1693 |
|
1694 |
if( isset($_POST['Organizer']['OrganizerID']) && !empty($_POST['Organizer']['OrganizerID']) && class_exists('TribeEventsPro') )
|
1695 |
-
$_POST['Organizer'] = array('OrganizerID' => $_POST['Organizer']['OrganizerID']);
|
1696 |
|
1697 |
|
1698 |
TribeEventsAPI::saveEventMeta($postId, $_POST, $post);
|
@@ -1719,10 +1733,23 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1719 |
} else {
|
1720 |
return;
|
1721 |
}
|
1722 |
-
|
|
|
|
|
|
|
|
|
|
|
1723 |
}
|
1724 |
}
|
1725 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1726 |
/**
|
1727 |
* Adds to the '_<posttype>AuditTrail' meta field for an events-calendar post.
|
1728 |
*
|
@@ -1753,7 +1780,84 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1753 |
}
|
1754 |
}
|
1755 |
|
1756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1757 |
public function save_venue_data( $postID = null, $post=null ) {
|
1758 |
global $_POST;
|
1759 |
|
@@ -1783,8 +1887,8 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1783 |
return $venue_id;
|
1784 |
}
|
1785 |
|
1786 |
-
function get_venue_info($p = null){
|
1787 |
-
$r = new WP_Query(array('post_type' => self::VENUE_POST_TYPE, 'nopaging' => 1, 'post_status' =>
|
1788 |
if ($r->have_posts()) :
|
1789 |
return $r->posts;
|
1790 |
endif;
|
@@ -1794,7 +1898,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1794 |
//** If you are saving a new organizer along with the event, we will do this:
|
1795 |
public function save_organizer_data( $postID = null, $post=null ) {
|
1796 |
global $_POST;
|
1797 |
-
|
1798 |
// don't do anything on autosave or auto-draft either or massupdates
|
1799 |
// Or inline saves, or data being posted without a organizer Or
|
1800 |
// finally, called from the save_post action, but on save_posts that
|
@@ -1862,8 +1966,8 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1862 |
}
|
1863 |
}
|
1864 |
|
1865 |
-
function get_organizer_info($p = null){
|
1866 |
-
$r = new WP_Query(array('post_type' => self::ORGANIZER_POST_TYPE, 'nopaging' => 1, 'post_status' =>
|
1867 |
if ($r->have_posts()) :
|
1868 |
return $r->posts;
|
1869 |
endif;
|
@@ -1898,7 +2002,12 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1898 |
|
1899 |
$options = '';
|
1900 |
$style = '';
|
1901 |
-
|
|
|
|
|
|
|
|
|
|
|
1902 |
|
1903 |
foreach ( $this->metaTags as $tag ) {
|
1904 |
if ( $postId && $saved ) { //if there is a post AND the post has been saved at least once.
|
@@ -1913,7 +2022,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1913 |
|
1914 |
//allow posted data to override default data
|
1915 |
if( isset($_POST['Event'.$cleaned_tag]) ){
|
1916 |
-
$$tag = $_POST['Event'.$cleaned_tag];
|
1917 |
}else{
|
1918 |
$$tag = (class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ) ? tribe_get_option('eventsDefault'.$cleaned_tag) : "";
|
1919 |
}
|
@@ -1928,7 +2037,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1928 |
foreach($this->organizerTags as $tag) {
|
1929 |
$cleaned_tag = str_replace('_Organizer','',$tag);
|
1930 |
if( isset($_POST['organizer'][$cleaned_tag]) )
|
1931 |
-
$$tag = $_POST['organizer'][$cleaned_tag];
|
1932 |
}
|
1933 |
}
|
1934 |
|
@@ -1957,7 +2066,7 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1957 |
}
|
1958 |
|
1959 |
if( isset($_POST['venue'][$cleaned_tag]) )
|
1960 |
-
$$var_name = $_POST['venue'][$cleaned_tag];
|
1961 |
|
1962 |
}
|
1963 |
|
@@ -1971,9 +2080,9 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
1971 |
|
1972 |
if( isset($_POST['venue']['Country']) ){
|
1973 |
if( $_POST['venue']['Country'] == 'United States' ){
|
1974 |
-
$_VenueStateProvince = $_POST['venue']['State'];
|
1975 |
}else{
|
1976 |
-
$_VenueStateProvince = $_POST['venue']['Province'];
|
1977 |
}
|
1978 |
}
|
1979 |
|
@@ -2042,11 +2151,11 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
2042 |
|
2043 |
if($post->post_type == self::VENUE_POST_TYPE){
|
2044 |
|
2045 |
-
if( (is_admin() && isset($_GET['post']) && $_GET['post']) || (!is_admin() && isset($
|
2046 |
$saved = true;
|
2047 |
|
2048 |
foreach ( $this->venueTags as $tag ) {
|
2049 |
-
if ( $postId && $saved ) { //if there is a post AND the post has been saved at least once.
|
2050 |
$$tag = esc_html(get_post_meta( $postId, $tag, true ));
|
2051 |
} else {
|
2052 |
$cleaned_tag = str_replace('_Venue','',$tag);
|
@@ -2081,10 +2190,10 @@ if ( !class_exists( 'TribeEvents' ) ) {
|
|
2081 |
$style = '';
|
2082 |
$postId = $post->ID;
|
2083 |
$saved = false;
|
2084 |
-
|
2085 |
if($post->post_type == self::ORGANIZER_POST_TYPE){
|
2086 |
|
2087 |
-
if( (is_admin() && isset($_GET['post']) && $_GET['post']) || (!is_admin() && isset($
|
2088 |
$saved = true;
|
2089 |
|
2090 |
foreach ( $this->organizerTags as $tag ) {
|
16 |
const VENUE_POST_TYPE = 'tribe_venue';
|
17 |
const ORGANIZER_POST_TYPE = 'tribe_organizer';
|
18 |
const PLUGIN_DOMAIN = 'tribe-events-calendar';
|
19 |
+
const VERSION = '2.0.6';
|
20 |
const FEED_URL = 'http://tri.be/category/products/feed/';
|
21 |
const INFO_API_URL = 'http://wpapi.org/api/plugin/the-events-calendar.php';
|
22 |
const WP_PLUGIN_URL = 'http://wordpress.org/extend/plugins/the-events-calendar/';
|
168 |
require_once( $this->pluginPath.'public/template-tags/venue.php' );
|
169 |
require_once( $this->pluginPath.'public/template-tags/date.php' );
|
170 |
require_once( $this->pluginPath.'public/template-tags/link.php' );
|
|
|
171 |
|
172 |
// Load Advanced Functions
|
173 |
require_once( $this->pluginPath.'public/advanced-functions/event.php' );
|
218 |
add_action( 'save_post', array( $this, 'save_venue_data' ), 16, 2 );
|
219 |
add_action( 'save_post', array( $this, 'save_organizer_data' ), 16, 2 );
|
220 |
add_action( 'save_post', array( $this, 'addToPostAuditTrail' ), 10, 2 );
|
221 |
+
add_action( 'save_post', array( $this, 'publishAssociatedTypes'), 25, 2 );
|
222 |
add_action( 'pre_get_posts', array( $this, 'setDate' ));
|
223 |
add_action( 'wp', array( $this, 'setDisplay' ));
|
224 |
add_action( 'tribe_events_post_errors', array( 'TribeEventsPostException', 'displayMessage' ) );
|
230 |
add_action( "trash_" . TribeEvents::ORGANIZER_POST_TYPE, array($this, 'cleanupPostOrganizers'));
|
231 |
add_action( "wp_ajax_tribe_event_validation", array($this,'ajax_form_validate') );
|
232 |
add_action( 'tribe_debug', array( $this, 'renderDebug' ), 10, 2 );
|
233 |
+
|
234 |
+
if( defined('TRIBE_SHOW_EVENT_AUDITING') && TRIBE_SHOW_EVENT_AUDITING )
|
235 |
+
add_action('tribe_events_details_bottom', array($this,'showAuditingData') );
|
236 |
+
|
237 |
// noindex grid view
|
238 |
add_action('wp_head', array( $this, 'noindex_months' ) );
|
239 |
add_action( 'plugin_row_meta', array( $this, 'addMetaLinks' ), 10, 2 );
|
252 |
add_action( 'admin_notices', array( $this, 'checkAddOnCompatibility' ) );
|
253 |
}
|
254 |
|
255 |
+
public static function ecpActive( $version = '2.0.6' ) {
|
256 |
return class_exists( 'TribeEventsPro' ) && defined('TribeEventsPro::VERSION') && version_compare( TribeEventsPro::VERSION, $version, '>=');
|
257 |
}
|
258 |
|
316 |
}
|
317 |
|
318 |
public function maybeRenameOptions() {
|
319 |
+
if ( version_compare( get_option('tribe_events_db_version'), '2.0.6', '<' ) ) {
|
320 |
$option_names = array(
|
321 |
'spEventsTemplate' => 'tribeEventsTemplate',
|
322 |
'spEventsBeforeHTML' => 'tribeEventsBeforeHTML',
|
331 |
unset( $current_options[$old_option_names[$i]] );
|
332 |
}
|
333 |
$this->setOptions( wp_parse_args( $new_options, $current_options ) );
|
334 |
+
update_option('tribe_events_db_version', '2.0.6');
|
335 |
}
|
336 |
}
|
337 |
|
609 |
public function accessibleMonthForm() {
|
610 |
if ( isset($_GET['EventJumpToMonth']) && isset($_GET['EventJumpToYear'] )) {
|
611 |
$_GET['eventDisplay'] = 'month';
|
612 |
+
$_GET['eventDate'] = intval($_GET['EventJumpToYear']) . '-' . intval($_GET['EventJumpToMonth']);
|
613 |
}
|
614 |
}
|
615 |
|
656 |
|
657 |
private function addCapabilities() {
|
658 |
$role = get_role( 'administrator' );
|
659 |
+
if ( $role ) {
|
660 |
+
$role->add_cap( 'edit_tribe_event' );
|
661 |
+
$role->add_cap( 'read_tribe_event' );
|
662 |
+
$role->add_cap( 'delete_tribe_event' );
|
663 |
+
$role->add_cap( 'delete_tribe_events');
|
664 |
+
$role->add_cap( 'edit_tribe_events' );
|
665 |
+
$role->add_cap( 'edit_others_tribe_events' );
|
666 |
+
$role->add_cap( 'delete_others_tribe_events' );
|
667 |
+
$role->add_cap( 'publish_tribe_events' );
|
668 |
+
$role->add_cap( 'edit_published_tribe_events' );
|
669 |
+
$role->add_cap( 'delete_published_tribe_events' );
|
670 |
+
$role->add_cap( 'delete_private_tribe_events' );
|
671 |
+
$role->add_cap( 'edit_private_tribe_events' );
|
672 |
+
$role->add_cap( 'read_private_tribe_events' );
|
673 |
+
|
674 |
+
$role->add_cap( 'edit_tribe_venue' );
|
675 |
+
$role->add_cap( 'read_tribe_venue' );
|
676 |
+
$role->add_cap( 'delete_tribe_venue' );
|
677 |
+
$role->add_cap( 'delete_tribe_venues');
|
678 |
+
$role->add_cap( 'edit_tribe_venues' );
|
679 |
+
$role->add_cap( 'edit_others_tribe_venues' );
|
680 |
+
$role->add_cap( 'delete_others_tribe_venues' );
|
681 |
+
$role->add_cap( 'publish_tribe_venues' );
|
682 |
+
$role->add_cap( 'edit_published_tribe_venues' );
|
683 |
+
$role->add_cap( 'delete_published_tribe_venues' );
|
684 |
+
$role->add_cap( 'delete_private_tribe_venues' );
|
685 |
+
$role->add_cap( 'edit_private_tribe_venues' );
|
686 |
+
$role->add_cap( 'read_private_tribe_venues' );
|
687 |
+
|
688 |
+
$role->add_cap( 'edit_tribe_organizer' );
|
689 |
+
$role->add_cap( 'read_tribe_organizer' );
|
690 |
+
$role->add_cap( 'delete_tribe_organizer' );
|
691 |
+
$role->add_cap( 'delete_tribe_organizers');
|
692 |
+
$role->add_cap( 'edit_tribe_organizers' );
|
693 |
+
$role->add_cap( 'edit_others_tribe_organizers' );
|
694 |
+
$role->add_cap( 'delete_others_tribe_organizers' );
|
695 |
+
$role->add_cap( 'publish_tribe_organizers' );
|
696 |
+
$role->add_cap( 'edit_published_tribe_organizers' );
|
697 |
+
$role->add_cap( 'delete_published_tribe_organizers' );
|
698 |
+
$role->add_cap( 'delete_private_tribe_organizers' );
|
699 |
+
$role->add_cap( 'edit_private_tribe_organizers' );
|
700 |
+
$role->add_cap( 'read_private_tribe_organizers' );
|
701 |
+
}
|
702 |
|
703 |
$editor = get_role( 'editor' );
|
704 |
+
if ( $editor ) {
|
705 |
+
$editor->add_cap( 'edit_tribe_event' );
|
706 |
+
$editor->add_cap( 'read_tribe_event' );
|
707 |
+
$editor->add_cap( 'delete_tribe_event' );
|
708 |
+
$editor->add_cap( 'delete_tribe_events');
|
709 |
+
$editor->add_cap( 'edit_tribe_events' );
|
710 |
+
$editor->add_cap( 'edit_others_tribe_events' );
|
711 |
+
$editor->add_cap( 'delete_others_tribe_events' );
|
712 |
+
$editor->add_cap( 'publish_tribe_events' );
|
713 |
+
$editor->add_cap( 'edit_published_tribe_events' );
|
714 |
+
$editor->add_cap( 'delete_published_tribe_events' );
|
715 |
+
$editor->add_cap( 'delete_private_tribe_events' );
|
716 |
+
$editor->add_cap( 'edit_private_tribe_events' );
|
717 |
+
$editor->add_cap( 'read_private_tribe_events' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
|
719 |
+
$editor->add_cap( 'edit_tribe_venue' );
|
720 |
+
$editor->add_cap( 'read_tribe_venue' );
|
721 |
+
$editor->add_cap( 'delete_tribe_venue' );
|
722 |
+
$editor->add_cap( 'delete_tribe_venues');
|
723 |
+
$editor->add_cap( 'edit_tribe_venues' );
|
724 |
+
$editor->add_cap( 'edit_others_tribe_venues' );
|
725 |
+
$editor->add_cap( 'delete_others_tribe_venues' );
|
726 |
+
$editor->add_cap( 'publish_tribe_venues' );
|
727 |
+
$editor->add_cap( 'edit_published_tribe_venues' );
|
728 |
+
$editor->add_cap( 'delete_published_tribe_venues' );
|
729 |
+
$editor->add_cap( 'delete_private_tribe_venues' );
|
730 |
+
$editor->add_cap( 'edit_private_tribe_venues' );
|
731 |
+
$editor->add_cap( 'read_private_tribe_venues' );
|
732 |
|
733 |
+
$editor->add_cap( 'edit_tribe_organizer' );
|
734 |
+
$editor->add_cap( 'read_tribe_organizer' );
|
735 |
+
$editor->add_cap( 'delete_tribe_organizer' );
|
736 |
+
$editor->add_cap( 'delete_tribe_organizers');
|
737 |
+
$editor->add_cap( 'edit_tribe_organizers' );
|
738 |
+
$editor->add_cap( 'edit_others_tribe_organizers' );
|
739 |
+
$editor->add_cap( 'delete_others_tribe_organizers' );
|
740 |
+
$editor->add_cap( 'publish_tribe_organizers' );
|
741 |
+
$editor->add_cap( 'edit_published_tribe_organizers' );
|
742 |
+
$editor->add_cap( 'delete_published_tribe_organizers' );
|
743 |
+
$editor->add_cap( 'delete_private_tribe_organizers' );
|
744 |
+
$editor->add_cap( 'edit_private_tribe_organizers' );
|
745 |
+
$editor->add_cap( 'read_private_tribe_organizers' );
|
746 |
+
}
|
|
|
747 |
|
748 |
+
$author = get_role( 'author' );
|
749 |
+
if ( $author ) {
|
750 |
+
$author->add_cap( 'edit_tribe_event' );
|
751 |
+
$author->add_cap( 'read_tribe_event' );
|
752 |
+
$author->add_cap( 'delete_tribe_event' );
|
753 |
+
$author->add_cap( 'delete_tribe_events' );
|
754 |
+
$author->add_cap( 'edit_tribe_events' );
|
755 |
+
$author->add_cap( 'publish_tribe_events' );
|
756 |
+
$author->add_cap( 'edit_published_tribe_events' );
|
757 |
+
$author->add_cap( 'delete_published_tribe_events' );
|
758 |
+
|
759 |
+
$author->add_cap( 'edit_tribe_venue' );
|
760 |
+
$author->add_cap( 'read_tribe_venue' );
|
761 |
+
$author->add_cap( 'delete_tribe_venue' );
|
762 |
+
$author->add_cap( 'delete_tribe_venues' );
|
763 |
+
$author->add_cap( 'edit_tribe_venues' );
|
764 |
+
$author->add_cap( 'publish_tribe_venues' );
|
765 |
+
$author->add_cap( 'edit_published_tribe_venues' );
|
766 |
+
$author->add_cap( 'delete_published_tribe_venues' );
|
767 |
+
|
768 |
+
$author->add_cap( 'edit_tribe_organizer' );
|
769 |
+
$author->add_cap( 'read_tribe_organizer' );
|
770 |
+
$author->add_cap( 'delete_tribe_organizer' );
|
771 |
+
$author->add_cap( 'delete_tribe_organizers' );
|
772 |
+
$author->add_cap( 'edit_tribe_organizers' );
|
773 |
+
$author->add_cap( 'publish_tribe_organizers' );
|
774 |
+
$author->add_cap( 'edit_published_tribe_organizers' );
|
775 |
+
$author->add_cap( 'delete_published_tribe_organizers' );
|
776 |
+
}
|
777 |
|
778 |
+
$contributor = get_role( 'contributor' );
|
779 |
+
if ( $contributor ) {
|
780 |
+
$contributor->add_cap( 'edit_tribe_event' );
|
781 |
+
$contributor->add_cap( 'read_tribe_event' );
|
782 |
+
$contributor->add_cap( 'delete_tribe_event' );
|
783 |
+
$contributor->add_cap( 'delete_tribe_events' );
|
784 |
+
$contributor->add_cap( 'edit_tribe_events' );
|
785 |
|
786 |
+
$contributor->add_cap( 'edit_tribe_venue' );
|
787 |
+
$contributor->add_cap( 'read_tribe_venue' );
|
788 |
+
$contributor->add_cap( 'delete_tribe_venue' );
|
789 |
+
$contributor->add_cap( 'delete_tribe_venues' );
|
790 |
+
$contributor->add_cap( 'edit_tribe_venues');
|
791 |
+
|
792 |
+
$contributor->add_cap( 'edit_tribe_organizer' );
|
793 |
+
$contributor->add_cap( 'read_tribe_organizer' );
|
794 |
+
$contributor->add_cap( 'delete_tribe_organizer' );
|
795 |
+
$contributor->add_cap( 'delete_tribe_organizers' );
|
796 |
+
$contributor->add_cap( 'edit_tribe_organizers' );
|
797 |
+
}
|
798 |
|
799 |
+
$subscriber = get_role( 'subscriber' );
|
800 |
+
if ( $subscriber ) {
|
801 |
+
$subscriber->add_cap( 'read_tribe_event' );
|
802 |
+
|
803 |
+
$subscriber->add_cap( 'read_tribe_organizer' );
|
804 |
+
|
805 |
+
$subscriber->add_cap( 'read_tribe_venue' );
|
806 |
+
}
|
807 |
}
|
808 |
|
809 |
public function registerPostType() {
|
1703 |
* editing the venue/organizer from within the event.
|
1704 |
*/
|
1705 |
if( isset($_POST['Venue']['VenueID']) && !empty($_POST['Venue']['VenueID']) && class_exists('TribeEventsPro') )
|
1706 |
+
$_POST['Venue'] = array('VenueID' => intval($_POST['Venue']['VenueID']));
|
1707 |
|
1708 |
if( isset($_POST['Organizer']['OrganizerID']) && !empty($_POST['Organizer']['OrganizerID']) && class_exists('TribeEventsPro') )
|
1709 |
+
$_POST['Organizer'] = array('OrganizerID' => intval($_POST['Organizer']['OrganizerID']));
|
1710 |
|
1711 |
|
1712 |
TribeEventsAPI::saveEventMeta($postId, $_POST, $post);
|
1733 |
} else {
|
1734 |
return;
|
1735 |
}
|
1736 |
+
|
1737 |
+
//only set origin once
|
1738 |
+
$origin = get_post_meta($postId , $post_type . 'Origin', true);
|
1739 |
+
if( !$origin )
|
1740 |
+
update_post_meta( $postId, $post_type . 'Origin', apply_filters( 'post-origin', 'events-calendar' ) );
|
1741 |
+
|
1742 |
}
|
1743 |
}
|
1744 |
|
1745 |
+
public function showAuditingData(){
|
1746 |
+
|
1747 |
+
$events_audit_trail_template = $this->pluginPath . 'admin-views/events-audit-trail.php';
|
1748 |
+
$events_audit_trail_template = apply_filters('tribe_events_audit_trail_template', $events_audit_trail_template);
|
1749 |
+
include( $events_audit_trail_template );
|
1750 |
+
|
1751 |
+
}
|
1752 |
+
|
1753 |
/**
|
1754 |
* Adds to the '_<posttype>AuditTrail' meta field for an events-calendar post.
|
1755 |
*
|
1780 |
}
|
1781 |
}
|
1782 |
|
1783 |
+
/**
|
1784 |
+
* Publishes associated venue/organizer when an event is published
|
1785 |
+
*
|
1786 |
+
* @since 2.0.6
|
1787 |
+
* @author nciske
|
1788 |
+
* @param int $postId, the post ID
|
1789 |
+
* @param stdClass $post, the post object
|
1790 |
+
* @return void
|
1791 |
+
*/
|
1792 |
+
public function publishAssociatedTypes( $postID, $post ) {
|
1793 |
+
|
1794 |
+
remove_action( 'save_post', array( $this, 'addEventMeta' ), 15, 2 );
|
1795 |
+
remove_action( 'save_post', array( $this, 'save_venue_data' ), 16, 2 );
|
1796 |
+
remove_action( 'save_post', array( $this, 'save_organizer_data' ), 16, 2 );
|
1797 |
+
remove_action( 'save_post', array( $this, 'addToPostAuditTrail' ), 10, 2 );
|
1798 |
+
|
1799 |
+
remove_action( 'save_post', array( $this, 'publishAssociatedTypes'), 25, 2 );
|
1800 |
+
|
1801 |
+
// Only continue if the post being published is an event
|
1802 |
+
if ( wp_is_post_autosave( $postID ) || $post->post_status == 'auto-draft' ||
|
1803 |
+
isset($_GET['bulk_edit']) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') ||
|
1804 |
+
($post->post_type != self::POSTTYPE && $postID)) {
|
1805 |
+
return;
|
1806 |
+
}
|
1807 |
+
|
1808 |
+
//echo '$postID='.$postID;
|
1809 |
+
|
1810 |
+
global $wpdb;
|
1811 |
+
|
1812 |
+
if( isset( $post->post_status ) && $post->post_status == 'publish' ){
|
1813 |
+
|
1814 |
+
//get venue and organizer and publish them
|
1815 |
+
|
1816 |
+
$pm = get_post_custom($post->ID);
|
1817 |
+
|
1818 |
+
if( isset($pm['_EventVenueID']) && $pm['_EventVenueID'] ){
|
1819 |
+
|
1820 |
+
if( is_array($pm['_EventVenueID']) ){
|
1821 |
+
$venue_id = current($pm['_EventVenueID']);
|
1822 |
+
}else{
|
1823 |
+
$venue_id = $pm['_EventVenueID'];
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
|
1827 |
+
$venue_post = array(
|
1828 |
+
'ID' => $venue_id,
|
1829 |
+
'post_status' => 'publish',
|
1830 |
+
);
|
1831 |
+
|
1832 |
+
//wp_update_post( $venue_post );
|
1833 |
+
$sql = "UPDATE $wpdb->posts SET post_status = 'publish' WHERE ID = '".intval($venue_id)."' AND post_type = '".TribeEvents::VENUE_POST_TYPE."' AND post_status != 'publish'";
|
1834 |
+
$wpdb->query($sql);
|
1835 |
+
|
1836 |
+
}
|
1837 |
+
|
1838 |
+
if( isset($pm['_EventOrganizerID']) && $pm['_EventOrganizerID'] ){
|
1839 |
+
|
1840 |
+
if( is_array($pm['_EventOrganizerID']) ){
|
1841 |
+
$org_id = current($pm['_EventOrganizerID']);
|
1842 |
+
}else{
|
1843 |
+
$org_id = $pm['_EventOrganizerID'];
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
|
1847 |
+
$org_post = array(
|
1848 |
+
'ID' => $org_id,
|
1849 |
+
'post_status' => 'publish',
|
1850 |
+
);
|
1851 |
+
|
1852 |
+
//wp_update_post( $org_post );
|
1853 |
+
$sql = "UPDATE $wpdb->posts SET post_status = 'publish' WHERE ID = '".intval($org_id)."' AND post_type = '".TribeEvents::ORGANIZER_POST_TYPE."' AND post_status != 'publish'";
|
1854 |
+
$wpdb->query($sql);
|
1855 |
+
}
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
//** If you are saving a new venue separate from an event
|
1861 |
public function save_venue_data( $postID = null, $post=null ) {
|
1862 |
global $_POST;
|
1863 |
|
1887 |
return $venue_id;
|
1888 |
}
|
1889 |
|
1890 |
+
function get_venue_info($p = null, $post_status='publish'){
|
1891 |
+
$r = new WP_Query(array('post_type' => self::VENUE_POST_TYPE, 'nopaging' => 1, 'post_status' => $post_status, 'ignore_sticky_posts ' => 1,'orderby'=>'title', 'order'=>'ASC','p' => $p));
|
1892 |
if ($r->have_posts()) :
|
1893 |
return $r->posts;
|
1894 |
endif;
|
1898 |
//** If you are saving a new organizer along with the event, we will do this:
|
1899 |
public function save_organizer_data( $postID = null, $post=null ) {
|
1900 |
global $_POST;
|
1901 |
+
|
1902 |
// don't do anything on autosave or auto-draft either or massupdates
|
1903 |
// Or inline saves, or data being posted without a organizer Or
|
1904 |
// finally, called from the save_post action, but on save_posts that
|
1966 |
}
|
1967 |
}
|
1968 |
|
1969 |
+
function get_organizer_info($p = null, $post_status='publish'){
|
1970 |
+
$r = new WP_Query(array('post_type' => self::ORGANIZER_POST_TYPE, 'nopaging' => 1, 'post_status' => $post_status, 'ignore_sticky_posts ' => 1,'orderby'=>'title', 'order'=>'ASC', 'p' => $p));
|
1971 |
if ($r->have_posts()) :
|
1972 |
return $r->posts;
|
1973 |
endif;
|
2002 |
|
2003 |
$options = '';
|
2004 |
$style = '';
|
2005 |
+
|
2006 |
+
if(isset($post->ID)){
|
2007 |
+
$postId = $post->ID;
|
2008 |
+
}else{
|
2009 |
+
$postId = 0;
|
2010 |
+
}
|
2011 |
|
2012 |
foreach ( $this->metaTags as $tag ) {
|
2013 |
if ( $postId && $saved ) { //if there is a post AND the post has been saved at least once.
|
2022 |
|
2023 |
//allow posted data to override default data
|
2024 |
if( isset($_POST['Event'.$cleaned_tag]) ){
|
2025 |
+
$$tag = stripslashes_deep($_POST['Event'.$cleaned_tag]);
|
2026 |
}else{
|
2027 |
$$tag = (class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ) ? tribe_get_option('eventsDefault'.$cleaned_tag) : "";
|
2028 |
}
|
2037 |
foreach($this->organizerTags as $tag) {
|
2038 |
$cleaned_tag = str_replace('_Organizer','',$tag);
|
2039 |
if( isset($_POST['organizer'][$cleaned_tag]) )
|
2040 |
+
$$tag = stripslashes_deep($_POST['organizer'][$cleaned_tag]);
|
2041 |
}
|
2042 |
}
|
2043 |
|
2066 |
}
|
2067 |
|
2068 |
if( isset($_POST['venue'][$cleaned_tag]) )
|
2069 |
+
$$var_name = stripslashes_deep($_POST['venue'][$cleaned_tag]);
|
2070 |
|
2071 |
}
|
2072 |
|
2080 |
|
2081 |
if( isset($_POST['venue']['Country']) ){
|
2082 |
if( $_POST['venue']['Country'] == 'United States' ){
|
2083 |
+
$_VenueStateProvince = stripslashes_deep($_POST['venue']['State']);
|
2084 |
}else{
|
2085 |
+
$_VenueStateProvince = stripslashes_deep($_POST['venue']['Province']);
|
2086 |
}
|
2087 |
}
|
2088 |
|
2151 |
|
2152 |
if($post->post_type == self::VENUE_POST_TYPE){
|
2153 |
|
2154 |
+
if( (is_admin() && isset($_GET['post']) && $_GET['post']) || (!is_admin() && isset($postId) ) )
|
2155 |
$saved = true;
|
2156 |
|
2157 |
foreach ( $this->venueTags as $tag ) {
|
2158 |
+
if ( $postId && isset( $saved ) && $saved ) { //if there is a post AND the post has been saved at least once.
|
2159 |
$$tag = esc_html(get_post_meta( $postId, $tag, true ));
|
2160 |
} else {
|
2161 |
$cleaned_tag = str_replace('_Venue','',$tag);
|
2190 |
$style = '';
|
2191 |
$postId = $post->ID;
|
2192 |
$saved = false;
|
2193 |
+
|
2194 |
if($post->post_type == self::ORGANIZER_POST_TYPE){
|
2195 |
|
2196 |
+
if( (is_admin() && isset($_GET['post']) && $_GET['post']) || (!is_admin() && isset($postId) ))
|
2197 |
$saved = true;
|
2198 |
|
2199 |
foreach ( $this->organizerTags as $tag ) {
|
lib/tribe-event-api.class.php
CHANGED
@@ -26,7 +26,7 @@ if (!class_exists('TribeEventsAPI')) {
|
|
26 |
|
27 |
$args = wp_parse_args( $args, $defaults);
|
28 |
$eventId = wp_insert_post($args, true);
|
29 |
-
|
30 |
if( !is_wp_error($eventId) ) {
|
31 |
TribeEventsAPI::saveEventMeta($eventId, $args, get_post( $eventId ) );
|
32 |
return $eventId;
|
@@ -37,7 +37,7 @@ if (!class_exists('TribeEventsAPI')) {
|
|
37 |
* Update an existing event
|
38 |
*/
|
39 |
public static function updateEvent( $eventId, $args ) {
|
40 |
-
$args['ID']
|
41 |
|
42 |
if(wp_update_post($args)) {
|
43 |
TribeEventsAPI::saveEventMeta($eventId, $args, get_post( $eventId ) );
|
@@ -58,7 +58,7 @@ if (!class_exists('TribeEventsAPI')) {
|
|
58 |
*/
|
59 |
public static function saveEventMeta($event_id, $data, $event = null) {
|
60 |
$tribe_ecp = TribeEvents::instance();
|
61 |
-
|
62 |
if( isset($data['EventAllDay']) && ( $data['EventAllDay'] == 'yes' || $data['EventAllDay'] == true || !isset($data['EventStartDate'] ) ) ) {
|
63 |
$data['EventStartDate'] = TribeDateUtils::beginningOfDay($data['EventStartDate']);
|
64 |
$data['EventEndDate'] = TribeDateUtils::endOfDay($data['EventEndDate']);
|
@@ -85,12 +85,26 @@ if (!class_exists('TribeEventsAPI')) {
|
|
85 |
|
86 |
if( !isset( $data['EventShowMapLink'] ) ) update_post_meta( $event_id, '_EventShowMapLink', 'false' );
|
87 |
if( !isset( $data['EventShowMap'] ) ) update_post_meta( $event_id, '_EventShowMap', 'false' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
if (isset($data["Organizer"])) {
|
90 |
-
$data['EventOrganizerID'] = TribeEventsAPI::saveEventOrganizer($data["Organizer"], $event);
|
91 |
}
|
92 |
if (isset($data["Venue"])) {
|
93 |
-
$data['EventVenueID'] = TribeEventsAPI::saveEventVenue($data["Venue"], $event);
|
94 |
}
|
95 |
|
96 |
$tribe_ecp->do_action('tribe_events_event_save', $event_id);
|
@@ -112,7 +126,7 @@ if (!class_exists('TribeEventsAPI')) {
|
|
112 |
/**
|
113 |
* Saves the event organizer information passed via an event
|
114 |
*/
|
115 |
-
private static function saveEventOrganizer($data, $post=null) {
|
116 |
if( isset($data['OrganizerID']) && $data['OrganizerID'] > 0) {
|
117 |
if (count($data) == 1) {
|
118 |
// Only an ID was passed and we should do nothing.
|
@@ -121,14 +135,14 @@ if (!class_exists('TribeEventsAPI')) {
|
|
121 |
return TribeEventsAPI::updateOrganizer($data['OrganizerID'], $data);
|
122 |
}
|
123 |
} else {
|
124 |
-
return TribeEventsAPI::createOrganizer($data);
|
125 |
}
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
* Saves the event venue information passed via an event
|
130 |
*/
|
131 |
-
private static function saveEventVenue($data, $post=null) {
|
132 |
if( isset($data['VenueID']) && $data['VenueID'] > 0) {
|
133 |
if (count($data) == 1) {
|
134 |
// Only an ID was passed and we should do nothing.
|
@@ -137,19 +151,20 @@ if (!class_exists('TribeEventsAPI')) {
|
|
137 |
return TribeEventsAPI::updateVenue($data['VenueID'], $data);
|
138 |
}
|
139 |
} else {
|
140 |
-
return TribeEventsAPI::createVenue($data);
|
141 |
}
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
* Creates a new organizer
|
146 |
*/
|
147 |
-
public static function createOrganizer($data) {
|
148 |
if ( (isset($data['Organizer']) && $data['Organizer']) || self::someOrganizerDataSet($data) ) {
|
|
|
149 |
$postdata = array(
|
150 |
'post_title' => $data['Organizer'] ? $data['Organizer'] : "Unnamed Organizer",
|
151 |
'post_type' => TribeEvents::ORGANIZER_POST_TYPE,
|
152 |
-
'post_status' =>
|
153 |
);
|
154 |
|
155 |
$organizerId = wp_insert_post($postdata, true);
|
@@ -192,7 +207,7 @@ if (!class_exists('TribeEventsAPI')) {
|
|
192 |
|
193 |
/**
|
194 |
* Saves organizer meta
|
195 |
-
*/
|
196 |
private static function saveOrganizerMeta($organizerId, $data) {
|
197 |
foreach ($data as $key => $var) {
|
198 |
update_post_meta($organizerId, '_Organizer'.$key, $var);
|
@@ -202,12 +217,13 @@ if (!class_exists('TribeEventsAPI')) {
|
|
202 |
/**
|
203 |
* Creates a new venue
|
204 |
*/
|
205 |
-
public static function createVenue($data) {
|
|
|
206 |
if ( (isset($data['Venue']) && $data['Venue']) || self::someVenueDataSet($data) ) {
|
207 |
$postdata = array(
|
208 |
'post_title' => $data['Venue'] ? $data['Venue'] : "Unnamed Venue",
|
209 |
'post_type' => TribeEvents::VENUE_POST_TYPE,
|
210 |
-
'post_status' =>
|
211 |
);
|
212 |
|
213 |
$venueId = wp_insert_post($postdata, true);
|
26 |
|
27 |
$args = wp_parse_args( $args, $defaults);
|
28 |
$eventId = wp_insert_post($args, true);
|
29 |
+
|
30 |
if( !is_wp_error($eventId) ) {
|
31 |
TribeEventsAPI::saveEventMeta($eventId, $args, get_post( $eventId ) );
|
32 |
return $eventId;
|
37 |
* Update an existing event
|
38 |
*/
|
39 |
public static function updateEvent( $eventId, $args ) {
|
40 |
+
$args['ID'] = $eventId;
|
41 |
|
42 |
if(wp_update_post($args)) {
|
43 |
TribeEventsAPI::saveEventMeta($eventId, $args, get_post( $eventId ) );
|
58 |
*/
|
59 |
public static function saveEventMeta($event_id, $data, $event = null) {
|
60 |
$tribe_ecp = TribeEvents::instance();
|
61 |
+
|
62 |
if( isset($data['EventAllDay']) && ( $data['EventAllDay'] == 'yes' || $data['EventAllDay'] == true || !isset($data['EventStartDate'] ) ) ) {
|
63 |
$data['EventStartDate'] = TribeDateUtils::beginningOfDay($data['EventStartDate']);
|
64 |
$data['EventEndDate'] = TribeDateUtils::endOfDay($data['EventEndDate']);
|
85 |
|
86 |
if( !isset( $data['EventShowMapLink'] ) ) update_post_meta( $event_id, '_EventShowMapLink', 'false' );
|
87 |
if( !isset( $data['EventShowMap'] ) ) update_post_meta( $event_id, '_EventShowMap', 'false' );
|
88 |
+
|
89 |
+
if(isset($data['post_status'])){
|
90 |
+
$post_status = $data['post_status'];
|
91 |
+
}else{
|
92 |
+
|
93 |
+
//print_r($data);
|
94 |
+
|
95 |
+
if (isset($data["Organizer"]["OrganizerID"]))
|
96 |
+
$post_status = get_post($data["Organizer"]['OrganizerID'])->post_status;
|
97 |
+
|
98 |
+
if (isset($data['Venue']["VenueID"]))
|
99 |
+
$post_status = get_post($data['Venue']['VenueID'])->post_status;
|
100 |
+
|
101 |
+
}
|
102 |
|
103 |
if (isset($data["Organizer"])) {
|
104 |
+
$data['EventOrganizerID'] = TribeEventsAPI::saveEventOrganizer($data["Organizer"], $event, $post_status);
|
105 |
}
|
106 |
if (isset($data["Venue"])) {
|
107 |
+
$data['EventVenueID'] = TribeEventsAPI::saveEventVenue($data["Venue"], $event, $post_status);
|
108 |
}
|
109 |
|
110 |
$tribe_ecp->do_action('tribe_events_event_save', $event_id);
|
126 |
/**
|
127 |
* Saves the event organizer information passed via an event
|
128 |
*/
|
129 |
+
private static function saveEventOrganizer($data, $post=null, $post_status='publish') {
|
130 |
if( isset($data['OrganizerID']) && $data['OrganizerID'] > 0) {
|
131 |
if (count($data) == 1) {
|
132 |
// Only an ID was passed and we should do nothing.
|
135 |
return TribeEventsAPI::updateOrganizer($data['OrganizerID'], $data);
|
136 |
}
|
137 |
} else {
|
138 |
+
return TribeEventsAPI::createOrganizer($data, $post_status);
|
139 |
}
|
140 |
}
|
141 |
|
142 |
/**
|
143 |
* Saves the event venue information passed via an event
|
144 |
*/
|
145 |
+
private static function saveEventVenue($data, $post=null, $post_status='publish') {
|
146 |
if( isset($data['VenueID']) && $data['VenueID'] > 0) {
|
147 |
if (count($data) == 1) {
|
148 |
// Only an ID was passed and we should do nothing.
|
151 |
return TribeEventsAPI::updateVenue($data['VenueID'], $data);
|
152 |
}
|
153 |
} else {
|
154 |
+
return TribeEventsAPI::createVenue($data, $post_status);
|
155 |
}
|
156 |
}
|
157 |
|
158 |
/**
|
159 |
* Creates a new organizer
|
160 |
*/
|
161 |
+
public static function createOrganizer($data, $post_status='publish') {
|
162 |
if ( (isset($data['Organizer']) && $data['Organizer']) || self::someOrganizerDataSet($data) ) {
|
163 |
+
|
164 |
$postdata = array(
|
165 |
'post_title' => $data['Organizer'] ? $data['Organizer'] : "Unnamed Organizer",
|
166 |
'post_type' => TribeEvents::ORGANIZER_POST_TYPE,
|
167 |
+
'post_status' => $post_status,
|
168 |
);
|
169 |
|
170 |
$organizerId = wp_insert_post($postdata, true);
|
207 |
|
208 |
/**
|
209 |
* Saves organizer meta
|
210 |
+
*/
|
211 |
private static function saveOrganizerMeta($organizerId, $data) {
|
212 |
foreach ($data as $key => $var) {
|
213 |
update_post_meta($organizerId, '_Organizer'.$key, $var);
|
217 |
/**
|
218 |
* Creates a new venue
|
219 |
*/
|
220 |
+
public static function createVenue($data, $post_status='publish') {
|
221 |
+
|
222 |
if ( (isset($data['Venue']) && $data['Venue']) || self::someVenueDataSet($data) ) {
|
223 |
$postdata = array(
|
224 |
'post_title' => $data['Venue'] ? $data['Venue'] : "Unnamed Venue",
|
225 |
'post_type' => TribeEvents::VENUE_POST_TYPE,
|
226 |
+
'post_status' => $post_status,
|
227 |
);
|
228 |
|
229 |
$venueId = wp_insert_post($postdata, true);
|
lib/tribe-field.class.php
CHANGED
@@ -283,10 +283,14 @@ if ( !class_exists('TribeField') ) {
|
|
283 |
* @author jkudish
|
284 |
* @return string the field name
|
285 |
*/
|
286 |
-
public function doFieldName() {
|
287 |
$return = '';
|
288 |
if ($this->name)
|
289 |
-
$
|
|
|
|
|
|
|
|
|
290 |
return apply_filters( 'tribe_field_name', $return, $this->name, $this );
|
291 |
}
|
292 |
|
@@ -411,7 +415,7 @@ if ( !class_exists('TribeField') ) {
|
|
411 |
foreach ($this->options as $option_id => $title) {
|
412 |
$field .= '<label title="'.$title.'">';
|
413 |
$field .= '<input type="checkbox"';
|
414 |
-
$field .= $this->doFieldName();
|
415 |
$field .= ' value="'.$option_id.'" '.checked( in_array($option_id, $this->value), true, false ).'/>';
|
416 |
$field .= $title;
|
417 |
$field .= '</label>';
|
283 |
* @author jkudish
|
284 |
* @return string the field name
|
285 |
*/
|
286 |
+
public function doFieldName($multi = false) {
|
287 |
$return = '';
|
288 |
if ($this->name)
|
289 |
+
if( $multi ){
|
290 |
+
$return = ' name="'.$this->name.'[]"';
|
291 |
+
}else{
|
292 |
+
$return = ' name="'.$this->name.'"';
|
293 |
+
}
|
294 |
return apply_filters( 'tribe_field_name', $return, $this->name, $this );
|
295 |
}
|
296 |
|
415 |
foreach ($this->options as $option_id => $title) {
|
416 |
$field .= '<label title="'.$title.'">';
|
417 |
$field .= '<input type="checkbox"';
|
418 |
+
$field .= $this->doFieldName(true);
|
419 |
$field .= ' value="'.$option_id.'" '.checked( in_array($option_id, $this->value), true, false ).'/>';
|
420 |
$field .= $title;
|
421 |
$field .= '</label>';
|
lib/tribe-settings-tab.class.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
-
if ( !defined('ABSPATH') ) die('-1');
|
5 |
-
|
6 |
-
if ( !class_exists('TribeSettingsTab') ) {
|
7 |
|
|
|
8 |
/**
|
9 |
* helper class that creates a settings tab
|
10 |
* this is a public API, use it to create tabs
|
@@ -49,7 +48,7 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
49 |
* @param array $args additional arguments for the tab
|
50 |
* @return void
|
51 |
*/
|
52 |
-
public function __construct($id, $name, $args = array()) {
|
53 |
|
54 |
// seetup the defaults
|
55 |
$this->defaults = array(
|
@@ -60,19 +59,19 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
60 |
);
|
61 |
|
62 |
// parse args with defaults and extract them
|
63 |
-
$args = wp_parse_args($args, $this->defaults);
|
64 |
-
extract($args);
|
65 |
|
66 |
// set each instance variable and filter
|
67 |
$this->id = apply_filters( 'tribe_settings_tab_id', $id );
|
68 |
$this->name = apply_filters( 'tribe_settings_tab_name', $name );
|
69 |
-
foreach ($this->defaults as $key => $value) {
|
70 |
$this->{$key} = apply_filters( 'tribe_settings_tab_'.$key, $$key );
|
71 |
}
|
72 |
|
73 |
|
74 |
// run actions & filters
|
75 |
-
add_filter('tribe_settings_tabs', array($this, 'addTab'), $priority );
|
76 |
|
77 |
}
|
78 |
|
@@ -86,12 +85,12 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
86 |
* @param array $tabs the $tabs from TribeSettings
|
87 |
* @return array $tabs the filtered tabs
|
88 |
*/
|
89 |
-
public function addTab($tabs) {
|
90 |
-
if ( !empty($this->fields) || has_action('tribe_settings_content_tab_'
|
91 |
$tabs[$this->id] = $this->name;
|
92 |
-
add_filter('tribe_settings_fields', array($this, 'addFields') );
|
93 |
-
add_filter('tribe_settings_no_save_tabs', array($this, 'showSaveTab') );
|
94 |
-
add_filter('tribe_settings_content_tab_'.$this->id, array($this, 'doContent') );
|
95 |
}
|
96 |
return $tabs;
|
97 |
}
|
@@ -105,11 +104,12 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
105 |
* @param array $field the $fields from TribeSettings
|
106 |
* @return array $fields the filtered fields
|
107 |
*/
|
108 |
-
public function addFields($fields) {
|
109 |
-
if ( !empty($this->fields) )
|
110 |
$fields[$this->id] = $this->fields;
|
111 |
-
elseif ( has_action('tribe_settings_content_tab_'
|
112 |
-
$fields[$this->id] = $this->fields = array(0 => null); // just to trick it
|
|
|
113 |
return $fields;
|
114 |
}
|
115 |
|
@@ -122,8 +122,8 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
122 |
* @param array $noSaveTabs the $noSaveTabs from TribeSettings
|
123 |
* @return array $noSaveTabs the filtered non saving tabs
|
124 |
*/
|
125 |
-
public function showSaveTab($noSaveTabs) {
|
126 |
-
if ( !$this->show_save || empty($this->fields) )
|
127 |
$noSaveTabs[$this->id] = $this->id;
|
128 |
return $noSaveTabs;
|
129 |
}
|
@@ -136,63 +136,51 @@ if ( !class_exists('TribeSettingsTab') ) {
|
|
136 |
* @return void
|
137 |
*/
|
138 |
public function doContent() {
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
-
call_user_func($this->display_callback);
|
142 |
-
|
143 |
-
if (is_array($this->fields) && !empty($this->fields) ) {
|
144 |
-
foreach ($this->fields as $key => $field) {
|
145 |
-
|
146 |
-
if ( isset($_POST[$key]) ) {
|
147 |
|
|
|
|
|
|
|
148 |
// if we just saved [or attempted to], get the value that was inputed
|
149 |
-
$value = $
|
150 |
-
|
151 |
} else {
|
152 |
-
|
153 |
// get the field's parent_option in order to later get the field's value
|
154 |
-
$parent_option = ( isset($field['parent_option']) ) ? $field['parent_option'] : TribeEvents::OPTIONNAME;
|
155 |
-
$parent_option = apply_filters('tribe_settings_do_content_parent_option', $parent_option, $key);
|
156 |
-
$default = ( isset($field['default']) )
|
157 |
-
$default = apply_filters('tribe_settings_field_default', $default, $field);
|
158 |
|
159 |
if ( !$parent_option ) {
|
160 |
-
|
161 |
// no parent option, get the straight up value
|
162 |
-
$value = get_option($key, $default);
|
163 |
-
|
164 |
} else {
|
165 |
// there's a parent option
|
166 |
-
|
167 |
-
if ($parent_option == TribeEvents::OPTIONNAME) {
|
168 |
// get the options from TribeEvents if we're getting the main array
|
169 |
-
$value = TribeEvents::getOption($key, $default);
|
170 |
} else {
|
171 |
// else, get the parent option normally
|
172 |
-
$options = (array) get_option($parent_option);
|
173 |
-
$value = ( isset($options[$key]) ) ? $options[$key] : $default;
|
174 |
}
|
175 |
-
|
176 |
}
|
177 |
-
|
178 |
}
|
179 |
|
180 |
// filter the value
|
181 |
-
$value = apply_filters('tribe_settings_get_option_value_pre_display', $value, $key, $field);
|
182 |
|
183 |
// create the field
|
184 |
-
new TribeField($key, $field, $value);
|
185 |
-
|
186 |
}
|
187 |
} else {
|
188 |
-
|
189 |
// no fields setup for this tab yet
|
190 |
-
echo '<p>'.__('There are no fields setup for this tab yet.', 'tribe-events-calendar').'</p>';
|
191 |
}
|
192 |
-
|
193 |
}
|
194 |
|
195 |
-
|
196 |
} // end class
|
197 |
-
|
198 |
} // endif class_exists
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
+
if ( !defined( 'ABSPATH' ) ) die( '-1' );
|
|
|
|
|
5 |
|
6 |
+
if ( !class_exists( 'TribeSettingsTab' ) ) {
|
7 |
/**
|
8 |
* helper class that creates a settings tab
|
9 |
* this is a public API, use it to create tabs
|
48 |
* @param array $args additional arguments for the tab
|
49 |
* @return void
|
50 |
*/
|
51 |
+
public function __construct( $id, $name, $args = array() ) {
|
52 |
|
53 |
// seetup the defaults
|
54 |
$this->defaults = array(
|
59 |
);
|
60 |
|
61 |
// parse args with defaults and extract them
|
62 |
+
$args = wp_parse_args( $args, $this->defaults );
|
63 |
+
extract( $args );
|
64 |
|
65 |
// set each instance variable and filter
|
66 |
$this->id = apply_filters( 'tribe_settings_tab_id', $id );
|
67 |
$this->name = apply_filters( 'tribe_settings_tab_name', $name );
|
68 |
+
foreach ( $this->defaults as $key => $value ) {
|
69 |
$this->{$key} = apply_filters( 'tribe_settings_tab_'.$key, $$key );
|
70 |
}
|
71 |
|
72 |
|
73 |
// run actions & filters
|
74 |
+
add_filter( 'tribe_settings_tabs', array( $this, 'addTab' ), $priority );
|
75 |
|
76 |
}
|
77 |
|
85 |
* @param array $tabs the $tabs from TribeSettings
|
86 |
* @return array $tabs the filtered tabs
|
87 |
*/
|
88 |
+
public function addTab( $tabs ) {
|
89 |
+
if ( !empty( $this->fields ) || has_action( 'tribe_settings_content_tab_' . $this->id ) ) {
|
90 |
$tabs[$this->id] = $this->name;
|
91 |
+
add_filter( 'tribe_settings_fields', array( $this, 'addFields' ) );
|
92 |
+
add_filter( 'tribe_settings_no_save_tabs', array( $this, 'showSaveTab' ) );
|
93 |
+
add_filter( 'tribe_settings_content_tab_'.$this->id, array( $this, 'doContent' ) );
|
94 |
}
|
95 |
return $tabs;
|
96 |
}
|
104 |
* @param array $field the $fields from TribeSettings
|
105 |
* @return array $fields the filtered fields
|
106 |
*/
|
107 |
+
public function addFields( $fields ) {
|
108 |
+
if ( !empty ($this->fields ) ) {
|
109 |
$fields[$this->id] = $this->fields;
|
110 |
+
} elseif ( has_action( 'tribe_settings_content_tab_' . $this->id ) ) {
|
111 |
+
$fields[$this->id] = $this->fields = array( 0 => null ); // just to trick it
|
112 |
+
}
|
113 |
return $fields;
|
114 |
}
|
115 |
|
122 |
* @param array $noSaveTabs the $noSaveTabs from TribeSettings
|
123 |
* @return array $noSaveTabs the filtered non saving tabs
|
124 |
*/
|
125 |
+
public function showSaveTab( $noSaveTabs ) {
|
126 |
+
if ( !$this->show_save || empty( $this->fields ) )
|
127 |
$noSaveTabs[$this->id] = $this->id;
|
128 |
return $noSaveTabs;
|
129 |
}
|
136 |
* @return void
|
137 |
*/
|
138 |
public function doContent() {
|
139 |
+
if ( $this->display_callback && function_exists( $this->display_callback ) ) {
|
140 |
+
call_user_func( $this->display_callback ); return;
|
141 |
+
}
|
142 |
|
143 |
+
$sent_data = get_option( 'tribe_settings_sent_data', array() );
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
if ( is_array( $this->fields ) && !empty( $this->fields ) ) {
|
146 |
+
foreach ( $this->fields as $key => $field ) {
|
147 |
+
if ( isset( $sent_data[$key] ) ) {
|
148 |
// if we just saved [or attempted to], get the value that was inputed
|
149 |
+
$value = $sent_data[$key];
|
|
|
150 |
} else {
|
|
|
151 |
// get the field's parent_option in order to later get the field's value
|
152 |
+
$parent_option = ( isset( $field['parent_option'] ) ) ? $field['parent_option'] : TribeEvents::OPTIONNAME;
|
153 |
+
$parent_option = apply_filters( 'tribe_settings_do_content_parent_option', $parent_option, $key );
|
154 |
+
$default = ( isset( $field['default'] ) ) ? $field['default'] : null;
|
155 |
+
$default = apply_filters( 'tribe_settings_field_default', $default, $field );
|
156 |
|
157 |
if ( !$parent_option ) {
|
|
|
158 |
// no parent option, get the straight up value
|
159 |
+
$value = get_option( $key, $default );
|
|
|
160 |
} else {
|
161 |
// there's a parent option
|
162 |
+
if ( $parent_option == TribeEvents::OPTIONNAME ) {
|
|
|
163 |
// get the options from TribeEvents if we're getting the main array
|
164 |
+
$value = TribeEvents::getOption( $key, $default );
|
165 |
} else {
|
166 |
// else, get the parent option normally
|
167 |
+
$options = (array) get_option( $parent_option );
|
168 |
+
$value = ( isset( $options[$key] ) ) ? $options[$key] : $default;
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
}
|
172 |
|
173 |
// filter the value
|
174 |
+
$value = apply_filters( 'tribe_settings_get_option_value_pre_display', $value, $key, $field );
|
175 |
|
176 |
// create the field
|
177 |
+
new TribeField( $key, $field, $value );
|
|
|
178 |
}
|
179 |
} else {
|
|
|
180 |
// no fields setup for this tab yet
|
181 |
+
echo '<p>' . __( 'There are no fields setup for this tab yet.', 'tribe-events-calendar' ) . '</p>';
|
182 |
}
|
|
|
183 |
}
|
184 |
|
|
|
185 |
} // end class
|
|
|
186 |
} // endif class_exists
|
lib/tribe-settings.class.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
-
if ( !defined('ABSPATH') ) die('-1');
|
5 |
-
|
6 |
-
if ( !class_exists('TribeSettings') ) {
|
7 |
|
|
|
8 |
/**
|
9 |
* helper class that allows registration of settings
|
10 |
* this is a static class & uses the singleton design method
|
@@ -79,10 +78,10 @@ if ( !class_exists('TribeSettings') ) {
|
|
79 |
public static $errors;
|
80 |
|
81 |
/**
|
82 |
-
*
|
83 |
-
* @var
|
84 |
*/
|
85 |
-
public static $
|
86 |
|
87 |
/**
|
88 |
* the $current_screen name corresponding to the admin page
|
@@ -110,7 +109,7 @@ if ( !class_exists('TribeSettings') ) {
|
|
110 |
* @return void
|
111 |
*/
|
112 |
public static function instance() {
|
113 |
-
if (!isset(self::$instance)) {
|
114 |
$className = __CLASS__;
|
115 |
self::$instance = new $className;
|
116 |
}
|
@@ -127,20 +126,20 @@ if ( !class_exists('TribeSettings') ) {
|
|
127 |
public function __construct() {
|
128 |
|
129 |
// set instance variables
|
130 |
-
$this->menuName = apply_filters( 'tribe_settings_menu_name', __('The Events Calendar', 'tribe-events-calendar') );
|
131 |
$this->requiredCap = apply_filters( 'tribe_settings_req_cap', 'manage_options' );
|
132 |
$this->adminSlug = apply_filters( 'tribe_settings_admin_slug', 'tribe-settings' );
|
133 |
-
$this->errors =
|
134 |
-
$this->
|
135 |
-
$this->
|
136 |
$this->validated = array();
|
137 |
|
138 |
// run actions & filters
|
139 |
add_action( 'admin_menu', array( $this, 'addPage' ) );
|
140 |
-
add_action( '
|
141 |
-
add_action( 'tribe_settings_after_do_tabs', array( $this, 'validate' ) );
|
142 |
add_action( 'tribe_settings_below_tabs', array( $this, 'displayErrors' ) );
|
143 |
add_action( 'tribe_settings_below_tabs', array( $this, 'displaySuccess' ) );
|
|
|
144 |
}
|
145 |
|
146 |
/**
|
@@ -151,7 +150,7 @@ if ( !class_exists('TribeSettings') ) {
|
|
151 |
* @return void
|
152 |
*/
|
153 |
public function addPage() {
|
154 |
-
$this->admin_page = add_options_page( $this->menuName, $this->menuName, $this->requiredCap, $this->adminSlug, array(
|
155 |
}
|
156 |
|
157 |
/**
|
@@ -162,16 +161,17 @@ if ( !class_exists('TribeSettings') ) {
|
|
162 |
* @return void
|
163 |
*/
|
164 |
public function initTabs() {
|
165 |
-
|
166 |
-
|
167 |
-
do_action('tribe_settings_do_tabs'); // this is the hook to use to add new tabs
|
168 |
$this->tabs = (array) apply_filters( 'tribe_settings_tabs', array() );
|
169 |
$this->defaultTab = apply_filters( 'tribe_settings_default_tab', 'general' );
|
170 |
-
$this->currentTab = apply_filters( 'tribe_settings_current_tab', ( isset($_GET['tab']) && $_GET['tab'] ) ? esc_attr($_GET['tab']) : $this->defaultTab );
|
|
|
171 |
$this->noSaveTabs = (array) apply_filters( 'tribe_settings_no_save_tabs', array() );
|
172 |
$this->fields_for_save = (array) apply_filters( 'tribe_settings_fields', array() );
|
173 |
-
do_action('tribe_settings_after_do_tabs');
|
174 |
$this->fields = (array) apply_filters( 'tribe_settings_fields', array() );
|
|
|
175 |
}
|
176 |
}
|
177 |
|
@@ -190,7 +190,7 @@ if ( !class_exists('TribeSettings') ) {
|
|
190 |
echo '<div class="tribe_settings wrap">';
|
191 |
screen_icon();
|
192 |
echo '<h2>';
|
193 |
-
printf( _x('%s Settings', 'The Event Calendar settings heading', 'tribe-events-calendar'), $this->menuName );
|
194 |
echo '</h2>';
|
195 |
do_action( 'tribe_settings_above_tabs' );
|
196 |
$this->generateTabs( $this->currentTab );
|
@@ -204,15 +204,15 @@ if ( !class_exists('TribeSettings') ) {
|
|
204 |
do_action( 'tribe_settings_before_content_tab_'.$this->currentTab );
|
205 |
do_action( 'tribe_settings_content_tab_'.$this->currentTab );
|
206 |
if ( !has_action( 'tribe_settings_content_tab_'.$this->currentTab ) ) {
|
207 |
-
echo '<p>'.__(
|
208 |
}
|
209 |
do_action( 'tribe_settings_after_content_tab_'.$this->currentTab );
|
210 |
do_action( 'tribe_settings_after_content' );
|
211 |
-
if ( has_action('tribe_settings_content_tab_'.$this->currentTab) && !in_array($this->currentTab, $this->noSaveTabs) ) {
|
212 |
-
wp_nonce_field('saving', 'tribe-save-settings');
|
213 |
echo '<div class="clear"></div>';
|
214 |
echo '<input type="hidden" name="current-settings-tab" id="current-settings-tab" value="'.$this->currentTab.'" />';
|
215 |
-
echo '<input id="tribeSaveSettings" class="button-primary" type="submit" name="tribeSaveSettings" value="'.__('Save Changes', 'tribe-events-calendar').'" />';
|
216 |
}
|
217 |
echo apply_filters( 'tribe_settings_closing_form_element', '</form>' );
|
218 |
do_action( 'tribe_settings_after_form_element' );
|
@@ -231,13 +231,13 @@ if ( !class_exists('TribeSettings') ) {
|
|
231 |
* @return void
|
232 |
*/
|
233 |
public function generateTabs() {
|
234 |
-
if ( is_array($this->tabs) && !empty($this->tabs) ) {
|
235 |
echo '<h2 id="tribe-settings-tabs" class="nav-tab-wrapper">';
|
236 |
-
foreach ($this->tabs as $tab => $name ) {
|
237 |
-
$tab = esc_attr($tab);
|
238 |
-
$name = esc_attr($name);
|
239 |
$class = ( $tab == $this->currentTab ) ? ' nav-tab-active' : '';
|
240 |
-
echo '<a id="'
|
241 |
}
|
242 |
do_action( 'tribe_settings_after_tabs' );
|
243 |
echo '</h2>';
|
@@ -254,73 +254,69 @@ if ( !class_exists('TribeSettings') ) {
|
|
254 |
*/
|
255 |
public function validate() {
|
256 |
|
257 |
-
do_action('tribe_settings_validate_before_checks');
|
258 |
|
259 |
// check that the right POST && variables are set
|
260 |
-
if ( isset($_POST['tribeSaveSettings']) && isset($_POST['current-settings-tab']) ) {
|
261 |
-
|
262 |
// check permissions
|
263 |
-
if ( !current_user_can('manage_options') ) {
|
264 |
-
$this->errors[] = __(
|
265 |
$this->major_error = true;
|
266 |
}
|
267 |
|
268 |
// check the nonce
|
269 |
-
if ( !wp_verify_nonce($_POST['tribe-save-settings'], 'saving') ) {
|
270 |
-
$this->errors[] = __('The request was sent insecurely.', 'tribe-events-calendar');
|
271 |
$this->major_error = true;
|
272 |
}
|
273 |
|
274 |
// check that the request originated from the current tab
|
275 |
-
if ($_POST['current-settings-tab'] != $this->currentTab) {
|
276 |
-
$this->errors[] = __(
|
277 |
$this->major_error = true;
|
278 |
}
|
279 |
|
280 |
// bail if we have errors
|
281 |
-
if ( count($this->errors) )
|
282 |
-
|
|
|
|
|
|
|
|
|
283 |
|
284 |
// some hooks
|
285 |
-
do_action('tribe_settings_validate');
|
286 |
-
do_action('tribe_settings_validate_tab_'.$this->currentTab);
|
287 |
|
288 |
// set the current tab and current fields
|
289 |
$tab = $this->currentTab;
|
290 |
$fields = $this->fields_for_save[$tab];
|
291 |
|
292 |
-
if (is_array($fields)) {
|
293 |
// loop through the fields and validate them
|
294 |
-
foreach ($fields as $field_id => $field) {
|
295 |
-
|
296 |
// get the value
|
297 |
-
$value = ( isset($_POST[$field_id]) ) ? $_POST[$field_id] : null;
|
298 |
-
$value = apply_filters('tribe_settings_validate_field_value', $value, $field_id, $field);
|
299 |
|
300 |
// make sure it has validation set up for it, else do nothing
|
301 |
-
if ( isset($field['validation_type']) ||
|
302 |
-
|
303 |
// some hooks
|
304 |
-
do_action('tribe_settings_validate_field', $field_id, $value, $field);
|
305 |
-
do_action('tribe_settings_validate_field_'.$field_id, $value, $field);
|
306 |
|
307 |
// validate this sucka
|
308 |
-
$validate = new TribeValidate($field_id, $field, $value);
|
309 |
-
|
310 |
-
if (isset($validate->result->error)) {
|
311 |
|
|
|
312 |
// uh oh; validation failed
|
313 |
$this->errors[$field_id] = $validate->result->error;
|
314 |
-
|
315 |
} elseif ( $validate->result->valid ) {
|
316 |
-
|
317 |
// validation passed
|
318 |
$this->validated[$field_id] = new stdClass;
|
319 |
$this->validated[$field_id]->field = $validate->field;
|
320 |
$this->validated[$field_id]->value = $validate->value;
|
321 |
-
|
322 |
}
|
323 |
-
|
324 |
}
|
325 |
}
|
326 |
|
@@ -341,8 +337,8 @@ if ( !class_exists('TribeSettings') ) {
|
|
341 |
public function save() {
|
342 |
|
343 |
// some hooks
|
344 |
-
do_action('tribe_settings_save');
|
345 |
-
do_action('tribe_settings_save_tab_'
|
346 |
|
347 |
// we'll need this later
|
348 |
$parent_options = array();
|
@@ -353,31 +349,26 @@ if ( !class_exists('TribeSettings') ) {
|
|
353 |
* (in that case, it's a serialized option array and
|
354 |
* will be saved in the next loop)
|
355 |
*/
|
356 |
-
if ( isset($this->validated) && is_array($this->validated) ) {
|
357 |
-
foreach ($this->validated as $field_id => $validated_field) {
|
358 |
-
|
359 |
// get the value and filter it
|
360 |
$value = $validated_field->value;
|
361 |
-
$value = apply_filters('tribe_settings_save_field_value', $value, $field_id, $validated_field);
|
362 |
|
363 |
// figure out the parent option [could be set to false] and filter it
|
364 |
-
$parent_option = ( isset($validated_field->field['parent_option']) ) ? $validated_field->field['parent_option'] : TribeEvents::OPTIONNAME;
|
365 |
-
$parent_option = apply_filters('tribe_settings_save_field_parent_option', $parent_option, $field_id);
|
366 |
|
367 |
// some hooks
|
368 |
-
do_action('tribe_settings_save_field', $field_id, $value, $validated_field);
|
369 |
-
do_action('tribe_settings_save_field_'
|
370 |
|
371 |
if ( !$parent_option ) {
|
372 |
-
|
373 |
// if no parent option, then just save the option
|
374 |
-
|
375 |
-
|
376 |
} else {
|
377 |
-
|
378 |
// set the parent option
|
379 |
$parent_options[$parent_option][$field_id] = $value;
|
380 |
-
|
381 |
}
|
382 |
}
|
383 |
}
|
@@ -388,26 +379,28 @@ if ( !class_exists('TribeSettings') ) {
|
|
388 |
* NOTE: in the case of the main option Tribe Options,
|
389 |
* this will save using the TribeEvents:setOptions method.
|
390 |
*/
|
391 |
-
foreach ($parent_options as $option_id => $new_options) {
|
392 |
-
|
393 |
// get the old options
|
394 |
-
$old_options = (array) get_option($option_id);
|
395 |
|
396 |
// set the options by parsing old + new and filter that
|
397 |
-
$options = apply_filters('tribe_settings_save_option_array', wp_parse_args( $new_options, $old_options ), $option_id );
|
398 |
-
|
399 |
-
if ($option_id == TribeEvents::OPTIONNAME) {
|
400 |
|
|
|
401 |
// save using the TribeEvents method
|
402 |
-
|
403 |
} else {
|
404 |
-
|
405 |
// save using regular WP method
|
406 |
-
|
407 |
}
|
408 |
-
|
409 |
}
|
410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
412 |
|
413 |
/**
|
@@ -420,23 +413,23 @@ if ( !class_exists('TribeSettings') ) {
|
|
420 |
public function displayErrors() {
|
421 |
|
422 |
// fetch the errors and filter them
|
423 |
-
$errors = (array) apply_filters( 'tribe_settings_display_errors', $this->errors);
|
424 |
$count = apply_filters( 'tribe_settings_count_errors', count( $errors ) );
|
425 |
|
426 |
-
if (
|
427 |
// output a message if we have errors
|
428 |
|
429 |
$output = '<div id="message" class="error"><p><strong>';
|
430 |
-
$output .= __('Your form had the following errors:', 'tribe-events-calendar');
|
431 |
$output .= '</strong></p><ul class="tribe-errors-list">';
|
432 |
|
433 |
// loop through each error
|
434 |
-
foreach ($errors as $error) {
|
435 |
-
$output .='<li>'.(string) $error.'</li>';
|
436 |
}
|
437 |
|
438 |
-
if ( count($errors) ) {
|
439 |
-
$message = (isset($this->major_error) && $this->major_error) ? __('None of your settings were saved. Please try again.') : _n('The above setting was not saved. Other settings were successfully saved.', 'The above settings were not saved. Other settings were successfully saved.', $count, 'tribe-events-calendar');
|
440 |
}
|
441 |
|
442 |
$output .= '</ul><p>'.$message.'</p></div>';
|
@@ -454,22 +447,31 @@ if ( !class_exists('TribeSettings') ) {
|
|
454 |
* @return void
|
455 |
*/
|
456 |
public function displaySuccess() {
|
457 |
-
|
458 |
-
$errors = (array) apply_filters( 'tribe_settings_display_errors', $this->errors);
|
459 |
$count = apply_filters( 'tribe_settings_count_errors', count( $errors ) );
|
460 |
|
461 |
// are we coming from the saving place?
|
462 |
-
if ( isset($
|
463 |
-
|
464 |
// output the filtered message
|
465 |
-
$message = __('Settings saved.', 'tribe-events-calendar');
|
466 |
$output = '<div id="message" class="updated"><p><strong>' . $message . '</strong></p></div>';
|
467 |
echo apply_filters( 'tribe_settings_success_message', $output, $this->currentTab );
|
468 |
-
|
469 |
}
|
470 |
}
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
-
} // end class
|
474 |
|
|
|
475 |
} // endif class_exists
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
+
if ( !defined( 'ABSPATH' ) ) die( '-1' );
|
|
|
|
|
5 |
|
6 |
+
if ( !class_exists( 'TribeSettings' ) ) {
|
7 |
/**
|
8 |
* helper class that allows registration of settings
|
9 |
* this is a static class & uses the singleton design method
|
78 |
public static $errors;
|
79 |
|
80 |
/**
|
81 |
+
* POST data before/after save
|
82 |
+
* @var mixed
|
83 |
*/
|
84 |
+
public static $sent_data;
|
85 |
|
86 |
/**
|
87 |
* the $current_screen name corresponding to the admin page
|
109 |
* @return void
|
110 |
*/
|
111 |
public static function instance() {
|
112 |
+
if ( !isset( self::$instance ) ) {
|
113 |
$className = __CLASS__;
|
114 |
self::$instance = new $className;
|
115 |
}
|
126 |
public function __construct() {
|
127 |
|
128 |
// set instance variables
|
129 |
+
$this->menuName = apply_filters( 'tribe_settings_menu_name', __( 'The Events Calendar', 'tribe-events-calendar' ) );
|
130 |
$this->requiredCap = apply_filters( 'tribe_settings_req_cap', 'manage_options' );
|
131 |
$this->adminSlug = apply_filters( 'tribe_settings_admin_slug', 'tribe-settings' );
|
132 |
+
$this->errors = get_option( 'tribe_settings_errors', array() );
|
133 |
+
$this->major_error = get_option( 'tribe_settings_major_error', false );
|
134 |
+
$this->sent_data = get_option( 'tribe_settings_sent_data', array() );
|
135 |
$this->validated = array();
|
136 |
|
137 |
// run actions & filters
|
138 |
add_action( 'admin_menu', array( $this, 'addPage' ) );
|
139 |
+
add_action( 'admin_init', array( $this, 'initTabs' ) );
|
|
|
140 |
add_action( 'tribe_settings_below_tabs', array( $this, 'displayErrors' ) );
|
141 |
add_action( 'tribe_settings_below_tabs', array( $this, 'displaySuccess' ) );
|
142 |
+
add_action( 'shutdown', array( $this, 'deleteOptions' ) );
|
143 |
}
|
144 |
|
145 |
/**
|
150 |
* @return void
|
151 |
*/
|
152 |
public function addPage() {
|
153 |
+
$this->admin_page = add_options_page( $this->menuName, $this->menuName, $this->requiredCap, $this->adminSlug, array( $this, 'generatePage' ) );
|
154 |
}
|
155 |
|
156 |
/**
|
161 |
* @return void
|
162 |
*/
|
163 |
public function initTabs() {
|
164 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $this->adminSlug ) {
|
165 |
+
do_action( 'tribe_settings_do_tabs' ); // this is the hook to use to add new tabs
|
|
|
166 |
$this->tabs = (array) apply_filters( 'tribe_settings_tabs', array() );
|
167 |
$this->defaultTab = apply_filters( 'tribe_settings_default_tab', 'general' );
|
168 |
+
$this->currentTab = apply_filters( 'tribe_settings_current_tab', ( isset( $_GET['tab'] ) && $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : $this->defaultTab );
|
169 |
+
$this->url = apply_filters( 'tribe_settings_url', add_query_arg( array( 'page' => $this->adminSlug, 'tab' => $this->currentTab ), admin_url( 'options-general.php' ) ) );
|
170 |
$this->noSaveTabs = (array) apply_filters( 'tribe_settings_no_save_tabs', array() );
|
171 |
$this->fields_for_save = (array) apply_filters( 'tribe_settings_fields', array() );
|
172 |
+
do_action( 'tribe_settings_after_do_tabs' );
|
173 |
$this->fields = (array) apply_filters( 'tribe_settings_fields', array() );
|
174 |
+
$this->validate();
|
175 |
}
|
176 |
}
|
177 |
|
190 |
echo '<div class="tribe_settings wrap">';
|
191 |
screen_icon();
|
192 |
echo '<h2>';
|
193 |
+
printf( _x( '%s Settings', 'The Event Calendar settings heading', 'tribe-events-calendar' ), $this->menuName );
|
194 |
echo '</h2>';
|
195 |
do_action( 'tribe_settings_above_tabs' );
|
196 |
$this->generateTabs( $this->currentTab );
|
204 |
do_action( 'tribe_settings_before_content_tab_'.$this->currentTab );
|
205 |
do_action( 'tribe_settings_content_tab_'.$this->currentTab );
|
206 |
if ( !has_action( 'tribe_settings_content_tab_'.$this->currentTab ) ) {
|
207 |
+
echo '<p>' . __( "You've requested a non-existent tab.", 'tribe-events-calendar' ) . '</p>';
|
208 |
}
|
209 |
do_action( 'tribe_settings_after_content_tab_'.$this->currentTab );
|
210 |
do_action( 'tribe_settings_after_content' );
|
211 |
+
if ( has_action( 'tribe_settings_content_tab_'.$this->currentTab ) && !in_array( $this->currentTab, $this->noSaveTabs ) ) {
|
212 |
+
wp_nonce_field( 'saving', 'tribe-save-settings' );
|
213 |
echo '<div class="clear"></div>';
|
214 |
echo '<input type="hidden" name="current-settings-tab" id="current-settings-tab" value="'.$this->currentTab.'" />';
|
215 |
+
echo '<input id="tribeSaveSettings" class="button-primary" type="submit" name="tribeSaveSettings" value="' . __( ' Save Changes', 'tribe-events-calendar' ) . '" />';
|
216 |
}
|
217 |
echo apply_filters( 'tribe_settings_closing_form_element', '</form>' );
|
218 |
do_action( 'tribe_settings_after_form_element' );
|
231 |
* @return void
|
232 |
*/
|
233 |
public function generateTabs() {
|
234 |
+
if ( is_array( $this->tabs ) && !empty( $this->tabs ) ) {
|
235 |
echo '<h2 id="tribe-settings-tabs" class="nav-tab-wrapper">';
|
236 |
+
foreach ( $this->tabs as $tab => $name ) {
|
237 |
+
$tab = esc_attr( $tab );
|
238 |
+
$name = esc_attr( $name );
|
239 |
$class = ( $tab == $this->currentTab ) ? ' nav-tab-active' : '';
|
240 |
+
echo '<a id="' . $tab . '" class="nav-tab' . $class . '" href="?page=tribe-settings&tab=' . urlencode( $tab ) . '">' . $name . '</a>';
|
241 |
}
|
242 |
do_action( 'tribe_settings_after_tabs' );
|
243 |
echo '</h2>';
|
254 |
*/
|
255 |
public function validate() {
|
256 |
|
257 |
+
do_action( 'tribe_settings_validate_before_checks' );
|
258 |
|
259 |
// check that the right POST && variables are set
|
260 |
+
if ( isset( $_POST['tribeSaveSettings'] ) && isset( $_POST['current-settings-tab'] ) ) {
|
|
|
261 |
// check permissions
|
262 |
+
if ( !current_user_can( 'manage_options' ) ) {
|
263 |
+
$this->errors[] = __( "You don't have permission to do that.", 'tribe-events-calendar' );
|
264 |
$this->major_error = true;
|
265 |
}
|
266 |
|
267 |
// check the nonce
|
268 |
+
if ( !wp_verify_nonce( $_POST['tribe-save-settings'], 'saving' ) ) {
|
269 |
+
$this->errors[] = __( 'The request was sent insecurely.', 'tribe-events-calendar' );
|
270 |
$this->major_error = true;
|
271 |
}
|
272 |
|
273 |
// check that the request originated from the current tab
|
274 |
+
if ( $_POST['current-settings-tab'] != $this->currentTab ) {
|
275 |
+
$this->errors[] = __( "The request wasn't sent from this tab.", 'tribe-events-calendar' );
|
276 |
$this->major_error = true;
|
277 |
}
|
278 |
|
279 |
// bail if we have errors
|
280 |
+
if ( count( $this->errors ) ) {
|
281 |
+
remove_action( 'shutdown', array( $this, 'deleteOptions' ) );
|
282 |
+
add_option( 'tribe_settings_errors', $this->errors );
|
283 |
+
add_option( 'tribe_settings_major_error', $this->major_error );
|
284 |
+
wp_redirect( $this->url ); exit;
|
285 |
+
}
|
286 |
|
287 |
// some hooks
|
288 |
+
do_action( 'tribe_settings_validate' );
|
289 |
+
do_action( 'tribe_settings_validate_tab_'.$this->currentTab );
|
290 |
|
291 |
// set the current tab and current fields
|
292 |
$tab = $this->currentTab;
|
293 |
$fields = $this->fields_for_save[$tab];
|
294 |
|
295 |
+
if ( is_array( $fields ) ) {
|
296 |
// loop through the fields and validate them
|
297 |
+
foreach ( $fields as $field_id => $field ) {
|
|
|
298 |
// get the value
|
299 |
+
$value = ( isset( $_POST[$field_id] ) ) ? $_POST[$field_id] : null;
|
300 |
+
$value = apply_filters( 'tribe_settings_validate_field_value', $value, $field_id, $field );
|
301 |
|
302 |
// make sure it has validation set up for it, else do nothing
|
303 |
+
if ( ( !isset( $field['conditional'] ) || $field['conditional'] ) && ( !empty( $field['validation_type'] ) || !empty( $field['validation_callback'] ) ) ) {
|
|
|
304 |
// some hooks
|
305 |
+
do_action( 'tribe_settings_validate_field', $field_id, $value, $field );
|
306 |
+
do_action( 'tribe_settings_validate_field_'.$field_id, $value, $field );
|
307 |
|
308 |
// validate this sucka
|
309 |
+
$validate = new TribeValidate( $field_id, $field, $value );
|
|
|
|
|
310 |
|
311 |
+
if ( isset( $validate->result->error ) ) {
|
312 |
// uh oh; validation failed
|
313 |
$this->errors[$field_id] = $validate->result->error;
|
|
|
314 |
} elseif ( $validate->result->valid ) {
|
|
|
315 |
// validation passed
|
316 |
$this->validated[$field_id] = new stdClass;
|
317 |
$this->validated[$field_id]->field = $validate->field;
|
318 |
$this->validated[$field_id]->value = $validate->value;
|
|
|
319 |
}
|
|
|
320 |
}
|
321 |
}
|
322 |
|
337 |
public function save() {
|
338 |
|
339 |
// some hooks
|
340 |
+
do_action( 'tribe_settings_save' );
|
341 |
+
do_action( 'tribe_settings_save_tab_' . $this->currentTab );
|
342 |
|
343 |
// we'll need this later
|
344 |
$parent_options = array();
|
349 |
* (in that case, it's a serialized option array and
|
350 |
* will be saved in the next loop)
|
351 |
*/
|
352 |
+
if ( isset( $this->validated ) && is_array( $this->validated ) ) {
|
353 |
+
foreach ( $this->validated as $field_id => $validated_field ) {
|
|
|
354 |
// get the value and filter it
|
355 |
$value = $validated_field->value;
|
356 |
+
$value = apply_filters( 'tribe_settings_save_field_value', $value, $field_id, $validated_field );
|
357 |
|
358 |
// figure out the parent option [could be set to false] and filter it
|
359 |
+
$parent_option = ( isset( $validated_field->field['parent_option'] ) ) ? $validated_field->field['parent_option'] : TribeEvents::OPTIONNAME;
|
360 |
+
$parent_option = apply_filters( 'tribe_settings_save_field_parent_option', $parent_option, $field_id );
|
361 |
|
362 |
// some hooks
|
363 |
+
do_action( 'tribe_settings_save_field', $field_id, $value, $validated_field );
|
364 |
+
do_action( 'tribe_settings_save_field_' . $field_id, $value, $validated_field );
|
365 |
|
366 |
if ( !$parent_option ) {
|
|
|
367 |
// if no parent option, then just save the option
|
368 |
+
update_option( $field_id, $value );
|
|
|
369 |
} else {
|
|
|
370 |
// set the parent option
|
371 |
$parent_options[$parent_option][$field_id] = $value;
|
|
|
372 |
}
|
373 |
}
|
374 |
}
|
379 |
* NOTE: in the case of the main option Tribe Options,
|
380 |
* this will save using the TribeEvents:setOptions method.
|
381 |
*/
|
382 |
+
foreach ( $parent_options as $option_id => $new_options ) {
|
|
|
383 |
// get the old options
|
384 |
+
$old_options = (array) get_option( $option_id );
|
385 |
|
386 |
// set the options by parsing old + new and filter that
|
387 |
+
$options = apply_filters( 'tribe_settings_save_option_array', wp_parse_args( $new_options, $old_options ), $option_id );
|
|
|
|
|
388 |
|
389 |
+
if ( $option_id == TribeEvents::OPTIONNAME ) {
|
390 |
// save using the TribeEvents method
|
391 |
+
TribeEvents::setOptions( $options );
|
392 |
} else {
|
|
|
393 |
// save using regular WP method
|
394 |
+
update_option( $option_id, $options );
|
395 |
}
|
|
|
396 |
}
|
397 |
|
398 |
+
remove_action( 'shutdown', array( $this, 'deleteOptions' ) );
|
399 |
+
add_option( 'tribe_settings_sent_data', $_POST );
|
400 |
+
add_option( 'tribe_settings_errors', $this->errors );
|
401 |
+
add_option( 'tribe_settings_major_error', $this->major_error );
|
402 |
+
wp_redirect( add_query_arg( array( 'saved' => true ), $this->url ) ); exit;
|
403 |
+
|
404 |
}
|
405 |
|
406 |
/**
|
413 |
public function displayErrors() {
|
414 |
|
415 |
// fetch the errors and filter them
|
416 |
+
$errors = (array) apply_filters( 'tribe_settings_display_errors', $this->errors );
|
417 |
$count = apply_filters( 'tribe_settings_count_errors', count( $errors ) );
|
418 |
|
419 |
+
if ( apply_filters( 'tribe_settings_display_errors_or_not', ( $count > 0) ) ) {
|
420 |
// output a message if we have errors
|
421 |
|
422 |
$output = '<div id="message" class="error"><p><strong>';
|
423 |
+
$output .= __( 'Your form had the following errors:', 'tribe-events-calendar' );
|
424 |
$output .= '</strong></p><ul class="tribe-errors-list">';
|
425 |
|
426 |
// loop through each error
|
427 |
+
foreach ( $errors as $error ) {
|
428 |
+
$output .= '<li>' . (string) $error . '</li>';
|
429 |
}
|
430 |
|
431 |
+
if ( count( $errors ) ) {
|
432 |
+
$message = ( isset( $this->major_error ) && $this->major_error ) ? __( 'None of your settings were saved. Please try again.' ) : _n( 'The above setting was not saved. Other settings were successfully saved.', 'The above settings were not saved. Other settings were successfully saved.', $count, 'tribe-events-calendar' );
|
433 |
}
|
434 |
|
435 |
$output .= '</ul><p>'.$message.'</p></div>';
|
447 |
* @return void
|
448 |
*/
|
449 |
public function displaySuccess() {
|
450 |
+
$errors = (array) apply_filters( 'tribe_settings_display_errors', $this->errors );
|
|
|
451 |
$count = apply_filters( 'tribe_settings_count_errors', count( $errors ) );
|
452 |
|
453 |
// are we coming from the saving place?
|
454 |
+
if ( isset( $_GET['saved'] ) && !apply_filters( 'tribe_settings_display_errors_or_not', ( $count > 0 ) ) ) {
|
|
|
455 |
// output the filtered message
|
456 |
+
$message = __( 'Settings saved.', 'tribe-events-calendar' );
|
457 |
$output = '<div id="message" class="updated"><p><strong>' . $message . '</strong></p></div>';
|
458 |
echo apply_filters( 'tribe_settings_success_message', $output, $this->currentTab );
|
|
|
459 |
}
|
460 |
}
|
461 |
|
462 |
+
/**
|
463 |
+
* delete temporary options
|
464 |
+
*
|
465 |
+
* @since 2.0.6
|
466 |
+
* @author jkudish
|
467 |
+
* @return void
|
468 |
+
*/
|
469 |
+
public function deleteOptions() {
|
470 |
+
delete_option( 'tribe_settings_errors' );
|
471 |
+
delete_option( 'tribe_settings_major_error' );
|
472 |
+
delete_option( 'tribe_settings_sent_data' );
|
473 |
+
}
|
474 |
|
|
|
475 |
|
476 |
+
} // end class
|
477 |
} // endif class_exists
|
lib/tribe-validate.class.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
-
if ( !defined('ABSPATH') ) die('-1');
|
5 |
-
|
6 |
-
if ( !class_exists('TribeValidate') ) {
|
7 |
|
|
|
8 |
/**
|
9 |
* helper class that validates fields for use in Settings, MetaBoxes, Users, anywhere.
|
10 |
* Instantiate whenever you want to validate a field
|
@@ -63,7 +62,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
63 |
* @param mixed $value the value to validate
|
64 |
* @return array $result the result of the validation
|
65 |
*/
|
66 |
-
public function __construct($field_id, $field, $value, $additional_args = array()) {
|
67 |
|
68 |
// prepare object properties
|
69 |
$this->result = new stdClass;
|
@@ -73,53 +72,48 @@ if ( !class_exists('TribeValidate') ) {
|
|
73 |
$this->additional_args = $additional_args;
|
74 |
|
75 |
// if the field is invalid or incomplete, fail validation
|
76 |
-
if ( !is_array($this->field) || ( !isset($this->field['validation_type']) && !isset($this->field['validation_callback']) ) ) {
|
77 |
$this->result->valid = false;
|
78 |
-
$this->result->error = __('Invalid or incomplete field passed', 'tribe-events-calendar');
|
79 |
-
$this->result->error .= (isset($this->field['id'])) ? ' ('.__('Field ID:', 'tribe-events-calendar').' '
|
80 |
return $this->result;
|
81 |
}
|
82 |
|
83 |
// call validation callback if a validation callback function is set
|
84 |
if ( isset($this->field['validation_callback']) ) {
|
85 |
-
if ( function_exists($this->field['validation_callback']) ) {
|
86 |
-
if ( (!isset($_POST[$field_id]) || !$_POST[$field_id] || $_POST[$field_id] == '') && isset($this->field['can_be_empty']) && $this->field['can_be_empty']) {
|
87 |
$this->result->valid = true;
|
88 |
return $this->result;
|
89 |
} else {
|
90 |
-
return call_user_func($validation_callback);
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
|
95 |
|
96 |
-
if ( isset($this->field['validation_type']) ) {
|
97 |
-
|
98 |
if ( method_exists( $this, $this->field['validation_type'] ) ) {
|
99 |
-
|
100 |
// make sure there's a field validation type set for this validation and that such method exists
|
101 |
$this->type = $this->field['validation_type'];
|
102 |
$this->label = isset($this->field['label']) ? $this->field['label'] : $this->field['id'];
|
103 |
-
if ( (!isset($_POST[$field_id]) || !$_POST[$field_id] || $_POST[$field_id] == '') && isset($this->field['can_be_empty']) && $this->field['can_be_empty']) {
|
104 |
$this->result->valid = true;
|
105 |
return $this->result;
|
106 |
} else {
|
107 |
-
call_user_method($this->type, $this); // run the validation
|
108 |
}
|
109 |
-
|
110 |
} else {
|
111 |
-
|
112 |
// invalid validation type set, validation fails
|
113 |
$this->result->valid = false;
|
114 |
-
$this->result->error = __('Non-existant field validation function passed', 'tribe-events-calendar');
|
115 |
-
$this->result->error .= (isset($this->field['id'])) ? ' ('.__('Field ID:', 'tribe-events-calendar').' '
|
116 |
}
|
117 |
} else {
|
118 |
-
|
119 |
// no validation type set, validation fails
|
120 |
$this->result->valid = false;
|
121 |
-
$this->result->error = __('Invalid or incomplete field passed', 'tribe-events-calendar');
|
122 |
-
$this->result->error .= (isset($this->field['id'])) ? ' ('.__('Field ID:', 'tribe-events-calendar').' '
|
123 |
}
|
124 |
|
125 |
// return the result
|
@@ -138,7 +132,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
138 |
$this->result->valid = true;
|
139 |
} else {
|
140 |
$this->result->valid = false;
|
141 |
-
$this->result->error = sprintf( __('%s must be a positive number.', 'tribe-events-calendar'), $this->label);
|
142 |
}
|
143 |
}
|
144 |
|
@@ -152,10 +146,10 @@ if ( !class_exists('TribeValidate') ) {
|
|
152 |
public function slug() {
|
153 |
if ( preg_match( '/^[a-zA-Z0-9-_]+$/', $this->value ) ) {
|
154 |
$this->result->valid = true;
|
155 |
-
$this->value = sanitize_title($this->value);
|
156 |
} else {
|
157 |
$this->result->valid = false;
|
158 |
-
$this->result->error = sprintf( __('%s must be a valid slug (numbers, letters, dashes, and underscores).', 'tribe-events-calendar'), $this->label);
|
159 |
}
|
160 |
}
|
161 |
|
@@ -167,12 +161,12 @@ if ( !class_exists('TribeValidate') ) {
|
|
167 |
* @return stdClass validation result object
|
168 |
*/
|
169 |
public function url() {
|
170 |
-
|
171 |
if ( esc_url_raw( $this->value ) == $this->value ) {
|
172 |
$this->result->valid = true;
|
173 |
} else {
|
174 |
$this->result->valid = false;
|
175 |
-
$this->result->error = sprintf( __('%s must be a valid absolute URL.', 'tribe-events-calendar'), $this->label);
|
176 |
}
|
177 |
}
|
178 |
|
@@ -190,7 +184,27 @@ if ( !class_exists('TribeValidate') ) {
|
|
190 |
$this->result->valid = true;
|
191 |
} else {
|
192 |
$this->result->valid = false;
|
193 |
-
$this->result->error = sprintf( __(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
}
|
196 |
|
@@ -206,11 +220,11 @@ if ( !class_exists('TribeValidate') ) {
|
|
206 |
*/
|
207 |
public function options_with_label() {
|
208 |
if ( array_key_exists( $this->value, $this->field['options'] ) ) {
|
209 |
-
$this->value = ($this->value === 0) ? false : array($this->value, $this->field['options'][$this->value]);
|
210 |
$this->result->valid = true;
|
211 |
} else {
|
212 |
$this->result->valid = false;
|
213 |
-
$this->result->error = sprintf( __(
|
214 |
}
|
215 |
}
|
216 |
|
@@ -226,16 +240,16 @@ if ( !class_exists('TribeValidate') ) {
|
|
226 |
public function cannot_be_the_same_as() {
|
227 |
if ( !isset($this->additional_args['compare']) ) {
|
228 |
$this->result->valid = false;
|
229 |
-
$this->result->error = sprintf( __('Comparison validation failed because no comparison value was provided, for field %s', 'tribe-events-calendar'), $this->field['id'] );
|
230 |
} else {
|
231 |
-
if ($this->value != $this->additional_args['compare']) {
|
232 |
$this->result = true;
|
233 |
} else {
|
234 |
$this->result->valid = false;
|
235 |
-
if (isset($this->additional_args['compare_name'])) {
|
236 |
-
$this->result->error = sprintf( __('%s cannot be the same as %s.', 'tribe-events-calendar'), $this->label, $this->additional_args['compare_name']);
|
237 |
} else {
|
238 |
-
$this->result->error = sprintf( __('%s cannot be a duplicate', 'tribe-events-calendar'), $this->label );
|
239 |
}
|
240 |
}
|
241 |
}
|
@@ -253,7 +267,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
253 |
$this->result->valid = true;
|
254 |
} else {
|
255 |
$this->result->valid = false;
|
256 |
-
$this->result->error = sprintf( __('%s must be a number or percentage.', 'tribe-events-calendar'), $this->label);
|
257 |
}
|
258 |
}
|
259 |
|
@@ -265,7 +279,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
265 |
* @return stdClass validation result object
|
266 |
*/
|
267 |
public function html() {
|
268 |
-
$this->value = balanceTags($this->value);
|
269 |
$this->result->valid = true;
|
270 |
}
|
271 |
|
@@ -277,7 +291,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
277 |
* @return stdClass validation result object
|
278 |
*/
|
279 |
public function license_key() {
|
280 |
-
$this->value = trim($this->value);
|
281 |
$this->result->valid = true;
|
282 |
}
|
283 |
|
@@ -289,7 +303,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
289 |
* @return stdClass validation result object
|
290 |
*/
|
291 |
public function textarea() {
|
292 |
-
$this->value =
|
293 |
$this->result->valid = true;
|
294 |
}
|
295 |
|
@@ -317,7 +331,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
317 |
$this->result->valid = true;
|
318 |
} else {
|
319 |
$this->result->valid = false;
|
320 |
-
$this->result->error = sprintf( __('%s must be a number between 0 and 21.', 'tribe-events-calendar'), $this->label);
|
321 |
}
|
322 |
}
|
323 |
|
@@ -334,7 +348,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
334 |
$this->result->valid = true;
|
335 |
} else {
|
336 |
$this->result->valid = false;
|
337 |
-
$this->result->error = sprintf( __('%s must consist of letters, numbers, dashes, and spaces only.', 'tribe-events-calendar'), $this->label);
|
338 |
}
|
339 |
}
|
340 |
|
@@ -351,7 +365,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
351 |
$this->result->valid = true;
|
352 |
} else {
|
353 |
$this->result->valid = false;
|
354 |
-
$this->result->error = sprintf( __('%s must consist of letters, spaces, and dashes.', 'tribe-events-calendar'), $this->label);
|
355 |
}
|
356 |
}
|
357 |
|
@@ -367,7 +381,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
367 |
$this->result->valid = true;
|
368 |
} else {
|
369 |
$this->result->valid = false;
|
370 |
-
$this->result->error = sprintf( __('%s must consist of 5 numbers.', 'tribe-events-calendar'), $this->label);
|
371 |
}
|
372 |
}
|
373 |
|
@@ -383,7 +397,7 @@ if ( !class_exists('TribeValidate') ) {
|
|
383 |
$this->result->valid = true;
|
384 |
} else {
|
385 |
$this->result->valid = false;
|
386 |
-
$this->result->error = sprintf( __('%s must be a phone number.', 'tribe-events-calendar'), $this->label);
|
387 |
}
|
388 |
}
|
389 |
|
@@ -395,14 +409,14 @@ if ( !class_exists('TribeValidate') ) {
|
|
395 |
* @return stdClass validation result object
|
396 |
*/
|
397 |
public function country_list() {
|
398 |
-
$country_rows = explode("\n", $this->value);
|
399 |
-
if ( is_array($country_rows) ) {
|
400 |
-
foreach($country_rows as $crow) {
|
401 |
-
$country = explode(
|
402 |
-
if ( !isset($country[0]) || !isset($country[1]) ) {
|
403 |
$this->result->valid = false;
|
404 |
-
$this->result->error = sprintf( __('Country List must be formatted as one country per line in the following format: <br>US, United States <br> UK, United Kingdom.', 'tribe-events-calendar'), $this->label);
|
405 |
-
$this->value =
|
406 |
return;
|
407 |
}
|
408 |
}
|
@@ -423,5 +437,4 @@ if ( !class_exists('TribeValidate') ) {
|
|
423 |
}
|
424 |
|
425 |
} // end class
|
426 |
-
|
427 |
} // endif class_exists
|
1 |
<?php
|
2 |
|
3 |
// Don't load directly
|
4 |
+
if ( !defined( 'ABSPATH' ) ) die( '-1' );
|
|
|
|
|
5 |
|
6 |
+
if ( !class_exists( 'TribeValidate' ) ) {
|
7 |
/**
|
8 |
* helper class that validates fields for use in Settings, MetaBoxes, Users, anywhere.
|
9 |
* Instantiate whenever you want to validate a field
|
62 |
* @param mixed $value the value to validate
|
63 |
* @return array $result the result of the validation
|
64 |
*/
|
65 |
+
public function __construct( $field_id, $field, $value, $additional_args = array() ) {
|
66 |
|
67 |
// prepare object properties
|
68 |
$this->result = new stdClass;
|
72 |
$this->additional_args = $additional_args;
|
73 |
|
74 |
// if the field is invalid or incomplete, fail validation
|
75 |
+
if ( !is_array( $this->field ) || ( !isset( $this->field['validation_type'] ) && !isset( $this->field['validation_callback'] ) ) ) {
|
76 |
$this->result->valid = false;
|
77 |
+
$this->result->error = __( 'Invalid or incomplete field passed', 'tribe-events-calendar' );
|
78 |
+
$this->result->error .= (isset($this->field['id'])) ? ' (' . __( 'Field ID:', 'tribe-events-calendar' ) . ' ' . $this->field['id']. ' )' : '';
|
79 |
return $this->result;
|
80 |
}
|
81 |
|
82 |
// call validation callback if a validation callback function is set
|
83 |
if ( isset($this->field['validation_callback']) ) {
|
84 |
+
if ( function_exists( $this->field['validation_callback'] ) ) {
|
85 |
+
if ( (!isset( $_POST[$field_id] ) || !$_POST[$field_id] || $_POST[$field_id] == '' ) && isset( $this->field['can_be_empty'] ) && $this->field['can_be_empty'] ) {
|
86 |
$this->result->valid = true;
|
87 |
return $this->result;
|
88 |
} else {
|
89 |
+
return call_user_func( $validation_callback );
|
90 |
}
|
91 |
}
|
92 |
}
|
93 |
|
94 |
|
95 |
+
if ( isset( $this->field['validation_type'] ) ) {
|
|
|
96 |
if ( method_exists( $this, $this->field['validation_type'] ) ) {
|
|
|
97 |
// make sure there's a field validation type set for this validation and that such method exists
|
98 |
$this->type = $this->field['validation_type'];
|
99 |
$this->label = isset($this->field['label']) ? $this->field['label'] : $this->field['id'];
|
100 |
+
if ( ( !isset( $_POST[$field_id] ) || !$_POST[$field_id] || $_POST[$field_id] == '' ) && isset( $this->field['can_be_empty'] ) && $this->field['can_be_empty'] ) {
|
101 |
$this->result->valid = true;
|
102 |
return $this->result;
|
103 |
} else {
|
104 |
+
call_user_method( $this->type, $this ); // run the validation
|
105 |
}
|
|
|
106 |
} else {
|
|
|
107 |
// invalid validation type set, validation fails
|
108 |
$this->result->valid = false;
|
109 |
+
$this->result->error = __( 'Non-existant field validation function passed', 'tribe-events-calendar' );
|
110 |
+
$this->result->error .= ( isset( $this->field['id'] ) ) ? ' (' . __( 'Field ID:', 'tribe-events-calendar' ) . ' ' . $this->field['id'].' '._x( 'with function name:', 'non-existant function name passed for field validation', 'tribe-events-calendar' ).' '.$this->field['validation_type'].' )' : '';
|
111 |
}
|
112 |
} else {
|
|
|
113 |
// no validation type set, validation fails
|
114 |
$this->result->valid = false;
|
115 |
+
$this->result->error = __( 'Invalid or incomplete field passed', 'tribe-events-calendar' );
|
116 |
+
$this->result->error .= ( isset( $this->field['id'] ) ) ? ' (' . __( 'Field ID:', 'tribe-events-calendar' ) . ' ' . $this->field['id'] . ' )' : '';
|
117 |
}
|
118 |
|
119 |
// return the result
|
132 |
$this->result->valid = true;
|
133 |
} else {
|
134 |
$this->result->valid = false;
|
135 |
+
$this->result->error = sprintf( __( '%s must be a positive number.', 'tribe-events-calendar' ), $this->label );
|
136 |
}
|
137 |
}
|
138 |
|
146 |
public function slug() {
|
147 |
if ( preg_match( '/^[a-zA-Z0-9-_]+$/', $this->value ) ) {
|
148 |
$this->result->valid = true;
|
149 |
+
$this->value = sanitize_title( $this->value );
|
150 |
} else {
|
151 |
$this->result->valid = false;
|
152 |
+
$this->result->error = sprintf( __( '%s must be a valid slug (numbers, letters, dashes, and underscores).', 'tribe-events-calendar' ), $this->label );
|
153 |
}
|
154 |
}
|
155 |
|
161 |
* @return stdClass validation result object
|
162 |
*/
|
163 |
public function url() {
|
164 |
+
|
165 |
if ( esc_url_raw( $this->value ) == $this->value ) {
|
166 |
$this->result->valid = true;
|
167 |
} else {
|
168 |
$this->result->valid = false;
|
169 |
+
$this->result->error = sprintf( __( '%s must be a valid absolute URL.', 'tribe-events-calendar' ), $this->label );
|
170 |
}
|
171 |
}
|
172 |
|
184 |
$this->result->valid = true;
|
185 |
} else {
|
186 |
$this->result->valid = false;
|
187 |
+
$this->result->error = sprintf( __( "%s must have a value that's part of its options.", 'tribe-events-calendar' ), $this->label );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* validates fields that have multiple options (checkbox list, etc.)
|
193 |
+
* by making sure the value is part of the options array
|
194 |
+
*
|
195 |
+
* @since 2.0.5
|
196 |
+
* @author jkudish, nciske
|
197 |
+
* @return stdClass validation result object
|
198 |
+
*/
|
199 |
+
public function options_multi() {
|
200 |
+
foreach ( $this->value as $val ) {
|
201 |
+
if ( array_key_exists( $val, $this->field['options'] ) ) {
|
202 |
+
$this->value = ($this->value === 0) ? false : $this->value;
|
203 |
+
$this->result->valid = true;
|
204 |
+
} else {
|
205 |
+
$this->result->valid = false;
|
206 |
+
$this->result->error = sprintf( __( "%s must have a value that's part of its options.", 'tribe-events-calendar' ), $this->label );
|
207 |
+
}
|
208 |
}
|
209 |
}
|
210 |
|
220 |
*/
|
221 |
public function options_with_label() {
|
222 |
if ( array_key_exists( $this->value, $this->field['options'] ) ) {
|
223 |
+
$this->value = ( $this->value === 0 ) ? false : array( $this->value, $this->field['options'][$this->value] );
|
224 |
$this->result->valid = true;
|
225 |
} else {
|
226 |
$this->result->valid = false;
|
227 |
+
$this->result->error = sprintf( __( "%s must have a value that's part of its options.", 'tribe-events-calendar' ), $this->label );
|
228 |
}
|
229 |
}
|
230 |
|
240 |
public function cannot_be_the_same_as() {
|
241 |
if ( !isset($this->additional_args['compare']) ) {
|
242 |
$this->result->valid = false;
|
243 |
+
$this->result->error = sprintf( __( 'Comparison validation failed because no comparison value was provided, for field %s', 'tribe-events-calendar' ), $this->field['id'] );
|
244 |
} else {
|
245 |
+
if ( $this->value != $this->additional_args['compare'] ) {
|
246 |
$this->result = true;
|
247 |
} else {
|
248 |
$this->result->valid = false;
|
249 |
+
if ( isset( $this->additional_args['compare_name'] ) ) {
|
250 |
+
$this->result->error = sprintf( __( '%s cannot be the same as %s.', 'tribe-events-calendar' ), $this->label, $this->additional_args['compare_name'] );
|
251 |
} else {
|
252 |
+
$this->result->error = sprintf( __( '%s cannot be a duplicate', 'tribe-events-calendar' ), $this->label );
|
253 |
}
|
254 |
}
|
255 |
}
|
267 |
$this->result->valid = true;
|
268 |
} else {
|
269 |
$this->result->valid = false;
|
270 |
+
$this->result->error = sprintf( __( '%s must be a number or percentage.', 'tribe-events-calendar' ), $this->label );
|
271 |
}
|
272 |
}
|
273 |
|
279 |
* @return stdClass validation result object
|
280 |
*/
|
281 |
public function html() {
|
282 |
+
$this->value = balanceTags( $this->value );
|
283 |
$this->result->valid = true;
|
284 |
}
|
285 |
|
291 |
* @return stdClass validation result object
|
292 |
*/
|
293 |
public function license_key() {
|
294 |
+
$this->value = trim( $this->value );
|
295 |
$this->result->valid = true;
|
296 |
}
|
297 |
|
303 |
* @return stdClass validation result object
|
304 |
*/
|
305 |
public function textarea() {
|
306 |
+
$this->value = wp_kses( $this->value, array() );
|
307 |
$this->result->valid = true;
|
308 |
}
|
309 |
|
331 |
$this->result->valid = true;
|
332 |
} else {
|
333 |
$this->result->valid = false;
|
334 |
+
$this->result->error = sprintf( __( '%s must be a number between 0 and 21.', 'tribe-events-calendar' ), $this->label );
|
335 |
}
|
336 |
}
|
337 |
|
348 |
$this->result->valid = true;
|
349 |
} else {
|
350 |
$this->result->valid = false;
|
351 |
+
$this->result->error = sprintf( __( '%s must consist of letters, numbers, dashes, and spaces only.', 'tribe-events-calendar' ), $this->label );
|
352 |
}
|
353 |
}
|
354 |
|
365 |
$this->result->valid = true;
|
366 |
} else {
|
367 |
$this->result->valid = false;
|
368 |
+
$this->result->error = sprintf( __( '%s must consist of letters, spaces, and dashes.', 'tribe-events-calendar' ), $this->label );
|
369 |
}
|
370 |
}
|
371 |
|
381 |
$this->result->valid = true;
|
382 |
} else {
|
383 |
$this->result->valid = false;
|
384 |
+
$this->result->error = sprintf( __( '%s must consist of 5 numbers.', 'tribe-events-calendar' ), $this->label );
|
385 |
}
|
386 |
}
|
387 |
|
397 |
$this->result->valid = true;
|
398 |
} else {
|
399 |
$this->result->valid = false;
|
400 |
+
$this->result->error = sprintf( __( '%s must be a phone number.', 'tribe-events-calendar' ), $this->label );
|
401 |
}
|
402 |
}
|
403 |
|
409 |
* @return stdClass validation result object
|
410 |
*/
|
411 |
public function country_list() {
|
412 |
+
$country_rows = explode( "\n", $this->value );
|
413 |
+
if ( is_array( $country_rows ) ) {
|
414 |
+
foreach ( $country_rows as $crow ) {
|
415 |
+
$country = explode( ',', $crow );
|
416 |
+
if ( !isset( $country[0] ) || !isset( $country[1] ) ) {
|
417 |
$this->result->valid = false;
|
418 |
+
$this->result->error = sprintf( __( 'Country List must be formatted as one country per line in the following format: <br>US, United States <br> UK, United Kingdom.', 'tribe-events-calendar' ), $this->label );
|
419 |
+
$this->value = wp_kses( $this->value, array() );
|
420 |
return;
|
421 |
}
|
422 |
}
|
437 |
}
|
438 |
|
439 |
} // end class
|
|
|
440 |
} // endif class_exists
|
lib/tribe-view-helpers.class.php
CHANGED
@@ -572,7 +572,6 @@ if (!class_exists('TribeEventsViewHelpers')) {
|
|
572 |
$year = $current_year - $i;
|
573 |
$years[] = $year;
|
574 |
}
|
575 |
-
$years[] = $current_year;
|
576 |
for ($i = 0; $i <= $years_forward; $i++) {
|
577 |
$year = $current_year + $i;
|
578 |
$years[] = $year;
|
572 |
$year = $current_year - $i;
|
573 |
$years[] = $year;
|
574 |
}
|
|
|
575 |
for ($i = 0; $i <= $years_forward; $i++) {
|
576 |
$year = $current_year + $i;
|
577 |
$years[] = $year;
|
public/template-tags/google-map.php
CHANGED
@@ -82,6 +82,9 @@ if( class_exists( 'TribeEvents' ) ) {
|
|
82 |
* @since 2.0
|
83 |
*/
|
84 |
function tribe_embed_google_map($postId = null) {
|
|
|
|
|
|
|
85 |
$postId = TribeEvents::postIdHelper( $postId );
|
86 |
return get_post_meta( get_the_ID(), '_EventShowMap', 1) == 1;
|
87 |
}
|
82 |
* @since 2.0
|
83 |
*/
|
84 |
function tribe_embed_google_map($postId = null) {
|
85 |
+
if( !$postId )
|
86 |
+
return 0;
|
87 |
+
|
88 |
$postId = TribeEvents::postIdHelper( $postId );
|
89 |
return get_post_meta( get_the_ID(), '_EventShowMap', 1) == 1;
|
90 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: modern tribe, tribe, widget, events, tooltips, grid, month, list, calendar
|
|
5 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QA7QZM4CNQ342
|
6 |
Requires at least: 3.1
|
7 |
Tested up to: 3.4-alpha
|
8 |
-
Stable tag: 2.0.
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -13,7 +13,7 @@ IMPORTANT NOTICE: If you are upgrading from a pre-2.0 version of The Events Cale
|
|
13 |
|
14 |
The Events Calendar plugin enables you to rapidly create and manage events. Features include Google Maps integration as well as default templates such as a calendar grid and event list, widget and so much more. Looking for recurring events, the ability to sell tickets, manage conference schedules, accept user submitted events automatically and more? Check out the <a href="http://tri.be/products/?ref=tec-readme">available premium and community add-ons</a>. Have questions or looking to get help from our active user community, <a href="https://www.facebook.com/ModernTribeInc">join us on Facebook</a>, sign up for our newsletter (bottom of the home page) or check out <a href="http://tri.be/support/?ref=tec-readme">our support page</a>. Please note that while we are actively supporting this plugin, we don't provide support for non-paying users.
|
15 |
|
16 |
-
Just getting started? Check out our <a href="http://tri.be/
|
17 |
|
18 |
= The Events Calendar 2.0 =
|
19 |
|
@@ -135,6 +135,20 @@ Our Premium Plugins:
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 2.0.5 =
|
139 |
|
140 |
**Small features, UX and Content Tweaks:**
|
5 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QA7QZM4CNQ342
|
6 |
Requires at least: 3.1
|
7 |
Tested up to: 3.4-alpha
|
8 |
+
Stable tag: 2.0.6
|
9 |
|
10 |
== Description ==
|
11 |
|
13 |
|
14 |
The Events Calendar plugin enables you to rapidly create and manage events. Features include Google Maps integration as well as default templates such as a calendar grid and event list, widget and so much more. Looking for recurring events, the ability to sell tickets, manage conference schedules, accept user submitted events automatically and more? Check out the <a href="http://tri.be/products/?ref=tec-readme">available premium and community add-ons</a>. Have questions or looking to get help from our active user community, <a href="https://www.facebook.com/ModernTribeInc">join us on Facebook</a>, sign up for our newsletter (bottom of the home page) or check out <a href="http://tri.be/support/?ref=tec-readme">our support page</a>. Please note that while we are actively supporting this plugin, we don't provide support for non-paying users.
|
15 |
|
16 |
+
Just getting started? Check out our <a href="http://tri.be/new-user-primers/?ref=tec-readme">new user primer!</a>
|
17 |
|
18 |
= The Events Calendar 2.0 =
|
19 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 2.0.6 =
|
139 |
+
|
140 |
+
**Small features, UX and Content Tweaks:**
|
141 |
+
|
142 |
+
* Adjusted the Settings API so it now saves on page load and then redirects back to the page
|
143 |
+
* add_cap()s are now wrapped in an if-statement
|
144 |
+
* Added proper indentation and spacing to the Events Calendar PRO source files
|
145 |
+
|
146 |
+
**Bug Fixes:**
|
147 |
+
|
148 |
+
* Additional fields no longer wiped when saving changes to events/settings pages
|
149 |
+
* Plugin now removes newlines and carriage returns in the process of saving line-separated options for custom links
|
150 |
+
* Reviewed/improved $_POST and $_GET variables after a security audit to make sure they're sanitized before output/saving to the database (to prevent mySQL injects and/or cross-site scripting vulnerabilities)
|
151 |
+
|
152 |
= 2.0.5 =
|
153 |
|
154 |
**Small features, UX and Content Tweaks:**
|
the-events-calendar.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: The Events Calendar
|
4 |
Description: The Events Calendar is a fully featured event management system with multiple views, 3rd party integrations, and a slew of premium add-ons.
|
5 |
-
Version: 2.0.
|
6 |
Author: Modern Tribe, Inc.
|
7 |
Author URI: http://tri.be?ref=tec-plugin
|
8 |
Text Domain: tribe-events-calendar
|
2 |
/*
|
3 |
Plugin Name: The Events Calendar
|
4 |
Description: The Events Calendar is a fully featured event management system with multiple views, 3rd party integrations, and a slew of premium add-ons.
|
5 |
+
Version: 2.0.6
|
6 |
Author: Modern Tribe, Inc.
|
7 |
Author URI: http://tri.be?ref=tec-plugin
|
8 |
Text Domain: tribe-events-calendar
|
vendor/wp-router/WP_Route.class.php
ADDED
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: jbrinley
|
4 |
+
* Date: 5/18/11
|
5 |
+
* Time: 12:34 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class WP_Route extends WP_Router_Utility {
|
9 |
+
protected $id = '';
|
10 |
+
protected $path = '';
|
11 |
+
protected $query_vars = array();
|
12 |
+
protected $wp_rewrite = '';
|
13 |
+
protected $title = '';
|
14 |
+
protected $title_callback = '__';
|
15 |
+
protected $title_arguments = array();
|
16 |
+
protected $page_callback = '';
|
17 |
+
protected $page_arguments = array();
|
18 |
+
protected $access_callback = TRUE;
|
19 |
+
protected $access_arguments = array();
|
20 |
+
protected $template = array();
|
21 |
+
protected $properties = array();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @throws Exception
|
25 |
+
* @param string $id A unique string used to refer to this route
|
26 |
+
* @param array $properties An array of key/value pairs used to set
|
27 |
+
* the properties of the route. At a minimum, must include:
|
28 |
+
* - path
|
29 |
+
* - page_callback
|
30 |
+
*/
|
31 |
+
public function __construct( $id, array $properties ) {
|
32 |
+
$this->set('id', $id);
|
33 |
+
|
34 |
+
foreach ( array('path', 'page_callback') as $property ) {
|
35 |
+
if ( !isset($properties[$property]) || !$properties[$property] ) {
|
36 |
+
throw new Exception(self::__("Missing $property"));
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
foreach ( $properties as $property => $value ) {
|
41 |
+
$this->set($property, $value);
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( $this->access_arguments && $properties['access_callback'] ) {
|
45 |
+
$this->set('access_callback', 'current_user_can');
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the value of the the given property
|
52 |
+
*
|
53 |
+
* @throws Exception
|
54 |
+
* @param string $property
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
public function get( $property ) {
|
58 |
+
if ( isset($this->$property) ) {
|
59 |
+
return $this->$property;
|
60 |
+
} elseif ( isset($this->properties[$property]) ) {
|
61 |
+
return $this->properties[$property];
|
62 |
+
} else {
|
63 |
+
throw new Exception(self::__("Property not found: $property."));
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Set the value of the given property to $value
|
69 |
+
*
|
70 |
+
* @throws Exception
|
71 |
+
* @param string $property
|
72 |
+
* @param mixed $value
|
73 |
+
* @return void
|
74 |
+
*/
|
75 |
+
public function set( $property, $value ) {
|
76 |
+
if ( in_array($property, array('id', 'path', 'page_callback')) && !$value ) {
|
77 |
+
throw new Exception(self::__("Invalid value for $property. Value may not be empty."));
|
78 |
+
}
|
79 |
+
if ( in_array($property, array('query_vars', 'title_arguments', 'page_arguments', 'access_arguments')) && !is_array($value) ) {
|
80 |
+
throw new Exception(self::__("Invalid value for $property: $value. Value must be an array."));
|
81 |
+
}
|
82 |
+
if ( isset($this->$property) ) {
|
83 |
+
$this->$property = $value;
|
84 |
+
} else {
|
85 |
+
$this->properties[$property] = $value;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Execute the callback function for this route.
|
91 |
+
*
|
92 |
+
* @param WP $query_vars
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
public function execute( WP $query ) {
|
96 |
+
// check access
|
97 |
+
if ( !$this->check_access($query) ) {
|
98 |
+
$this->access_denied();
|
99 |
+
return; // can't get in
|
100 |
+
}
|
101 |
+
|
102 |
+
// do the callback
|
103 |
+
$page_contents = $this->get_page($query);
|
104 |
+
|
105 |
+
// if we have content, set up the page
|
106 |
+
if ( $page_contents === FALSE ) {
|
107 |
+
return; // callback explicitly told us not to do anything with output
|
108 |
+
}
|
109 |
+
|
110 |
+
$template = $this->choose_template();
|
111 |
+
|
112 |
+
if ( $template === FALSE ) {
|
113 |
+
print $page_contents;
|
114 |
+
exit();
|
115 |
+
}
|
116 |
+
|
117 |
+
$title = $this->get_title($query);
|
118 |
+
|
119 |
+
$page = new WP_Router_Page($page_contents, $title, $template);
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Return the URL for this route, with the given arguments
|
124 |
+
*
|
125 |
+
* @todo This currently only returns the non-pretty URL. If
|
126 |
+
* using permalinks, it should be a pretty URL based on
|
127 |
+
* $this->path
|
128 |
+
* @param array $args
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function url( $args = array() ) {
|
132 |
+
$args[self::QUERY_VAR] = $this->id;
|
133 |
+
return add_query_arg($args, trailingslashit(home_url()));
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @return array WordPress rewrite rules that should point to this instance's callback
|
138 |
+
*/
|
139 |
+
public function rewrite_rules() {
|
140 |
+
$this->generate_rewrite();
|
141 |
+
return array(
|
142 |
+
$this->path => $this->wp_rewrite,
|
143 |
+
);
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @return array All query vars used by this route
|
148 |
+
*/
|
149 |
+
public function get_query_vars() {
|
150 |
+
return array_keys($this->query_vars);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Get the appropriate callback function for the route, taking the HTTP method into account
|
155 |
+
*
|
156 |
+
* @return bool|string
|
157 |
+
*/
|
158 |
+
protected function get_callback( $possibilities ) {
|
159 |
+
if ( is_callable($possibilities) ) {
|
160 |
+
return $possibilities;
|
161 |
+
}
|
162 |
+
if ( is_array($possibilities) ) {
|
163 |
+
$method = $_SERVER['REQUEST_METHOD'];
|
164 |
+
if ( $method && isset($possibilities[$method]) && is_callable($possibilities[$method]) ) {
|
165 |
+
return $possibilities[$method];
|
166 |
+
}
|
167 |
+
if ( isset($possibilities['default']) && is_callable($possibilities['default']) ) {
|
168 |
+
return $possibilities['default'];
|
169 |
+
}
|
170 |
+
}
|
171 |
+
return FALSE;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Get the contents of the page
|
176 |
+
*
|
177 |
+
* @param WP $query
|
178 |
+
* @return bool|string
|
179 |
+
*/
|
180 |
+
protected function get_page( WP $query ) {
|
181 |
+
$callback = $this->get_callback($this->page_callback);
|
182 |
+
if ( !$callback ) {
|
183 |
+
return FALSE;
|
184 |
+
}
|
185 |
+
$args = $this->get_query_args($query, 'page');
|
186 |
+
ob_start();
|
187 |
+
$returned = call_user_func_array($this->page_callback, $args);
|
188 |
+
$echoed = ob_get_clean();
|
189 |
+
|
190 |
+
if ( $returned === FALSE ) {
|
191 |
+
return FALSE;
|
192 |
+
}
|
193 |
+
|
194 |
+
return $echoed.$returned;
|
195 |
+
}
|
196 |
+
|
197 |
+
protected function get_title( WP $query ) {
|
198 |
+
$callback = $this->get_callback($this->title_callback);
|
199 |
+
if ( !$callback ) {
|
200 |
+
return $this->title; // can't call it
|
201 |
+
}
|
202 |
+
$args = $this->get_query_args($query, 'title');
|
203 |
+
if ( !$args ) {
|
204 |
+
$args = array($this->title);
|
205 |
+
}
|
206 |
+
$title = call_user_func_array($this->title_callback, $args);
|
207 |
+
|
208 |
+
if ( $title === FALSE ) {
|
209 |
+
return $this->title;
|
210 |
+
}
|
211 |
+
|
212 |
+
return $title;
|
213 |
+
}
|
214 |
+
|
215 |
+
protected function check_access( WP $query ) {
|
216 |
+
if ( $this->access_callback === TRUE ) {
|
217 |
+
return TRUE;
|
218 |
+
}
|
219 |
+
$callback = $this->get_callback($this->access_callback);
|
220 |
+
if ( !$callback ) {
|
221 |
+
return FALSE; // nobody gets in
|
222 |
+
}
|
223 |
+
if ( is_callable($this->access_callback) ) {
|
224 |
+
$args = $this->get_query_args($query, 'access');
|
225 |
+
return (bool)call_user_func_array($this->access_callback, $args);
|
226 |
+
}
|
227 |
+
return (bool)$this->access_callback;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Choose an action based on logged-in status when denied access
|
232 |
+
*
|
233 |
+
* @return void
|
234 |
+
*/
|
235 |
+
protected function access_denied() {
|
236 |
+
$user_id = get_current_user_id();
|
237 |
+
if ( $user_id ) {
|
238 |
+
$this->error_403();
|
239 |
+
} else {
|
240 |
+
$this->login_redirect();
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Display a 403 error page
|
246 |
+
*
|
247 |
+
* @return void
|
248 |
+
*/
|
249 |
+
protected function error_403() {
|
250 |
+
$message = apply_filters('wp_router_access_denied_message', self::__('You are not authorized to access this page'));
|
251 |
+
$title = apply_filters('wp_router_access_denied_title', self::__('Access Denied'));
|
252 |
+
$args = apply_filters('wp_router_access_denied_args', array( 'response' => 403 ));
|
253 |
+
wp_die($message, $title, $args);
|
254 |
+
exit();
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Redirect to the login page
|
259 |
+
*
|
260 |
+
* @return void
|
261 |
+
*/
|
262 |
+
protected function login_redirect() {
|
263 |
+
$url = wp_login_url($_SERVER['REQUEST_URI']);
|
264 |
+
wp_redirect($url);
|
265 |
+
exit;
|
266 |
+
}
|
267 |
+
|
268 |
+
protected function get_query_args( WP $query, $callback_type = 'page' ) {
|
269 |
+
$property = $callback_type.'_arguments';
|
270 |
+
$args = array();
|
271 |
+
if ( $this->$property ) {
|
272 |
+
foreach ( $this->$property as $query_var ) {
|
273 |
+
if ( $this->is_a_query_var($query_var, $query) ) {
|
274 |
+
if ( isset($query->query_vars[$query_var]) ) {
|
275 |
+
$args[] = $query->query_vars[$query_var];
|
276 |
+
} else {
|
277 |
+
$args[] = NULL;
|
278 |
+
}
|
279 |
+
} else {
|
280 |
+
$args[] = $query_var;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
return $args;
|
285 |
+
}
|
286 |
+
|
287 |
+
protected function is_a_query_var( $var, WP $query ) {
|
288 |
+
// $query->public_query_vars should be set and filtered before we get here
|
289 |
+
if ( in_array($var, $query->public_query_vars) ) {
|
290 |
+
return TRUE;
|
291 |
+
}
|
292 |
+
return FALSE;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Generate the WP rewrite rule for this route
|
297 |
+
*
|
298 |
+
* @return void
|
299 |
+
*/
|
300 |
+
protected function generate_rewrite() {
|
301 |
+
$rule = "index.php?";
|
302 |
+
$vars = array();
|
303 |
+
foreach ( $this->query_vars as $var => $value ) {
|
304 |
+
if ( is_int($value) ) {
|
305 |
+
$vars[] = $var.'='.$this->preg_index($value);
|
306 |
+
} else {
|
307 |
+
$vars[] = $var.'='.$value;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
$vars[] = self::QUERY_VAR.'='.$this->id;
|
311 |
+
$rule .= implode('&', $vars);
|
312 |
+
$this->wp_rewrite = $rule;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Pass an integer through $wp_rewrite->preg_index()
|
317 |
+
*
|
318 |
+
* @param int $matches
|
319 |
+
* @return string
|
320 |
+
*/
|
321 |
+
protected function preg_index( $int ) {
|
322 |
+
global $wp_rewrite;
|
323 |
+
$wp_rewrite->matches = 'matches'; // because it may not be set, yet
|
324 |
+
return $wp_rewrite->preg_index($int);
|
325 |
+
}
|
326 |
+
|
327 |
+
protected function choose_template() {
|
328 |
+
if ( $this->template === FALSE ) {
|
329 |
+
return FALSE;
|
330 |
+
}
|
331 |
+
$template = '';
|
332 |
+
$extra = array(
|
333 |
+
'route-$id.php',
|
334 |
+
'route.php',
|
335 |
+
'page-$id.php',
|
336 |
+
'page.php',
|
337 |
+
);
|
338 |
+
if ( $this->template ) {
|
339 |
+
foreach ( (array) $this->template as $path ) {
|
340 |
+
$path = str_replace('$id', $this->id, $path);
|
341 |
+
if ( $this->is_absolute_path($path) ) {
|
342 |
+
if ( file_exists($path) ) {
|
343 |
+
$template = $path;
|
344 |
+
break;
|
345 |
+
}
|
346 |
+
} else { // relative path, look in the theme
|
347 |
+
$template = locate_template(array($path));
|
348 |
+
if ( $template ) {
|
349 |
+
break;
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
foreach ( $extra as $key => $path ) {
|
355 |
+
$extra[$key] = str_replace('$id', $this->id, $path);
|
356 |
+
}
|
357 |
+
if ( !$template ) {
|
358 |
+
$template = locate_template($extra);
|
359 |
+
}
|
360 |
+
return $template;
|
361 |
+
}
|
362 |
+
|
363 |
+
protected function is_absolute_path( $filename ) {
|
364 |
+
$char_1 = substr($filename, 0, 1);
|
365 |
+
if ( $char_1 == '/' || $char_1 == '\\' ) {
|
366 |
+
return TRUE; // unix absolute path
|
367 |
+
}
|
368 |
+
$char_2 = substr($filename, 1, 1);
|
369 |
+
$char_3 = substr($filename, 2, 1);
|
370 |
+
if ( ctype_alpha($char_1) && $char_2 == ':' && ( $char_3 == '/' || $char_3 == '\\') ) {
|
371 |
+
return TRUE; // windows absolute path
|
372 |
+
}
|
373 |
+
return FALSE;
|
374 |
+
}
|
375 |
+
}
|
vendor/wp-router/WP_Router.class.php
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: jbrinley
|
4 |
+
* Date: 5/18/11
|
5 |
+
* Time: 12:29 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class WP_Router extends WP_Router_Utility {
|
9 |
+
const ROUTE_CACHE_OPTION = 'WP_Router_route_hash';
|
10 |
+
private $routes = array();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var WP_Router The one instance of this singleton class
|
14 |
+
*/
|
15 |
+
private static $instance;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Exist!
|
19 |
+
*
|
20 |
+
* @static
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public static function init() {
|
24 |
+
self::$instance = self::get_instance();
|
25 |
+
}
|
26 |
+
|
27 |
+
/****************************************************
|
28 |
+
* PUBLIC API
|
29 |
+
****************************************************/
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Add a new route
|
33 |
+
*
|
34 |
+
* @param string $id
|
35 |
+
* @param array $properties
|
36 |
+
* @return null|WP_Route
|
37 |
+
*/
|
38 |
+
public function add_route( $id, array $properties ) {
|
39 |
+
if ( $route = $this->create_route($id, $properties) ) {
|
40 |
+
$this->routes[$id] = $route;
|
41 |
+
}
|
42 |
+
return $route;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get a previously registered route
|
47 |
+
*
|
48 |
+
* @param string $id
|
49 |
+
* @return null|WP_Route
|
50 |
+
*/
|
51 |
+
public function get_route( $id ) {
|
52 |
+
if ( isset($this->routes[$id]) ) {
|
53 |
+
return $this->routes[$id];
|
54 |
+
} else {
|
55 |
+
return NULL;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Update each property included in $changes for the given route
|
61 |
+
*
|
62 |
+
* @param string $id
|
63 |
+
* @param array $changes
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
public function edit_route( $id, array $changes ) {
|
67 |
+
if ( !isset($this->routes[$id]) ) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
foreach ( $changes as $key => $value ) {
|
71 |
+
if ( $key != 'id' ) {
|
72 |
+
try {
|
73 |
+
$this->routes[$id]->set($key, $value);
|
74 |
+
} catch ( Exception $e ) {
|
75 |
+
// Error setting the property. Failing silently
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Get rid of the route with the given $id
|
83 |
+
*
|
84 |
+
* @param string $id
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
public function remove_route( $id ) {
|
88 |
+
if ( isset($this->routes[$id]) ) {
|
89 |
+
unset($this->routes[$id]);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
public function get_url( $route_id, $arguments ) {
|
94 |
+
$route = $this->get_route($route_id);
|
95 |
+
if ( !$route ) {
|
96 |
+
return home_url();
|
97 |
+
} else {
|
98 |
+
return $route->url($arguments);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/****************************************************
|
103 |
+
* PLUMBING
|
104 |
+
****************************************************/
|
105 |
+
|
106 |
+
/*
|
107 |
+
* Singleton Design Pattern
|
108 |
+
* ------------------------------------------------- */
|
109 |
+
|
110 |
+
public static function get_instance() {
|
111 |
+
if ( !self::$instance ) {
|
112 |
+
self::$instance = new self();
|
113 |
+
}
|
114 |
+
return self::$instance;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Hook into WordPress
|
119 |
+
*/
|
120 |
+
private function __construct() {
|
121 |
+
add_action('init', array($this, 'generate_routes'), 1000, 0);
|
122 |
+
add_action('parse_request', array($this, 'parse_request'), 10, 1);
|
123 |
+
add_filter('rewrite_rules_array', array($this, 'add_rewrite_rules'), 10, 1);
|
124 |
+
add_filter('query_vars', array($this, 'add_query_vars'), 10, 1);
|
125 |
+
}
|
126 |
+
|
127 |
+
private function __clone() {
|
128 |
+
// cannot be cloned
|
129 |
+
trigger_error(__CLASS__.' may not be cloned', E_USER_ERROR);
|
130 |
+
}
|
131 |
+
|
132 |
+
private function __sleep() {
|
133 |
+
// cannot be serialized
|
134 |
+
trigger_error(__CLASS__.' may not be serialized', E_USER_ERROR);
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* WordPress hook callbacks
|
139 |
+
* ------------------------------------------------- */
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Announce to other plugins that it's time to create rules
|
143 |
+
* Action: init
|
144 |
+
*
|
145 |
+
* @uses do_action() Calls 'wp_router_generate_routes'
|
146 |
+
* @uses do_action() Calls 'wp_router_alter_routes'
|
147 |
+
* @return void
|
148 |
+
*/
|
149 |
+
public function generate_routes() {
|
150 |
+
do_action('wp_router_generate_routes', $this);
|
151 |
+
do_action('wp_router_alter_routes', $this);
|
152 |
+
$rules = $this->rewrite_rules();
|
153 |
+
if ( $this->hash($rules) != get_option(self::ROUTE_CACHE_OPTION) ) {
|
154 |
+
$this->flush_rewrite_rules();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Update WordPress's rewrite rules array with registered routes
|
160 |
+
* Filter: rewrite_rules_array
|
161 |
+
*
|
162 |
+
* @param array $rules
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
+
public function add_rewrite_rules( $rules ) {
|
166 |
+
$new_rules = $this->rewrite_rules();
|
167 |
+
update_option(self::ROUTE_CACHE_OPTION, $this->hash($new_rules));
|
168 |
+
return $new_rules + $rules;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Add all query vars from registered routes to WP's recognized query vars
|
173 |
+
*
|
174 |
+
* @param array $vars
|
175 |
+
* @return array
|
176 |
+
*/
|
177 |
+
public function add_query_vars( $vars ) {
|
178 |
+
$route_vars = $this->query_vars();
|
179 |
+
$vars = array_merge($vars, $route_vars);
|
180 |
+
return $vars;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* If a callback is in order, call it.
|
185 |
+
* Action: parse_request
|
186 |
+
*
|
187 |
+
* @param WP $query
|
188 |
+
* @return
|
189 |
+
*/
|
190 |
+
public function parse_request( WP $query ) {
|
191 |
+
if ( $id = $this->identify_route($query) ) {
|
192 |
+
$this->routes[$id]->execute($query);
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Identify the route based on the request's query variables
|
198 |
+
*
|
199 |
+
* @param WP|WP_Query $query
|
200 |
+
* @return string|NULL
|
201 |
+
*/
|
202 |
+
protected function identify_route( $query ) {
|
203 |
+
if ( !isset($query->query_vars[self::QUERY_VAR]) ) {
|
204 |
+
return NULL;
|
205 |
+
}
|
206 |
+
$id = $query->query_vars[self::QUERY_VAR];
|
207 |
+
if ( !isset($this->routes[$id]) || !is_a($this->routes[$id], 'WP_Route') ) {
|
208 |
+
return NULL;
|
209 |
+
}
|
210 |
+
return $id;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Create a new WP_Route with the given id and properties
|
215 |
+
*
|
216 |
+
* protected so it can be mocked in testing
|
217 |
+
*
|
218 |
+
* @param string $id
|
219 |
+
* @param array $properties
|
220 |
+
* @return null|WP_Route
|
221 |
+
*/
|
222 |
+
protected function create_route( $id, array $properties ) {
|
223 |
+
try {
|
224 |
+
$route = new WP_Route($id, $properties);
|
225 |
+
} catch ( Exception $e ) {
|
226 |
+
// invalid route $properties
|
227 |
+
return NULL;
|
228 |
+
}
|
229 |
+
return $route;
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Get the array of rewrite rules from all registered routes
|
234 |
+
*
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
protected function rewrite_rules() {
|
238 |
+
$rules = array();
|
239 |
+
foreach ( $this->routes as $id => $route ) {
|
240 |
+
$rules = array_merge($rules, $route->rewrite_rules());
|
241 |
+
}
|
242 |
+
return $rules;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get an array of all query vars used by registered routes
|
247 |
+
*
|
248 |
+
* @return array
|
249 |
+
*/
|
250 |
+
protected function query_vars() {
|
251 |
+
$vars = array();
|
252 |
+
foreach ( $this->routes as $id => $route ) {
|
253 |
+
$vars = array_merge($vars, $route->get_query_vars());
|
254 |
+
}
|
255 |
+
$vars[] = self::QUERY_VAR;
|
256 |
+
return $vars;
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Create a hash of the registered rewrite rules
|
261 |
+
*
|
262 |
+
* @param array $rules
|
263 |
+
* @return string
|
264 |
+
*/
|
265 |
+
protected function hash( $rules ) {
|
266 |
+
return md5(serialize($rules));
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Tell WordPress to flush its rewrite rules
|
271 |
+
*
|
272 |
+
* @return void
|
273 |
+
*/
|
274 |
+
protected function flush_rewrite_rules() {
|
275 |
+
flush_rewrite_rules();
|
276 |
+
}
|
277 |
+
}
|
vendor/wp-router/WP_Router_Page.class.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: jbrinley
|
4 |
+
* Date: 5/18/11
|
5 |
+
* Time: 2:31 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class WP_Router_Page extends WP_Router_Utility {
|
9 |
+
const POST_TYPE = 'wp_router_page';
|
10 |
+
|
11 |
+
protected static $rewrite_slug = 'WP_Router';
|
12 |
+
protected static $post_id = 0; // The ID of the post this plugin uses
|
13 |
+
|
14 |
+
protected $contents = '';
|
15 |
+
protected $title = '';
|
16 |
+
protected $template = '';
|
17 |
+
|
18 |
+
public static function init() {
|
19 |
+
self::register_post_type();
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Register a post type to use when displaying pages
|
24 |
+
* @static
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
private static function register_post_type() {
|
28 |
+
// a very quiet post type
|
29 |
+
$args = array(
|
30 |
+
'public' => FALSE,
|
31 |
+
'show_ui' => FALSE,
|
32 |
+
'exclude_from_search' => TRUE,
|
33 |
+
'publicly_queryable' => TRUE,
|
34 |
+
'show_in_menu' => FALSE,
|
35 |
+
'show_in_nav_menus' => FALSE,
|
36 |
+
'supports' => array('title'),
|
37 |
+
'has_archive' => TRUE,
|
38 |
+
'rewrite' => array(
|
39 |
+
'slug' => self::$rewrite_slug,
|
40 |
+
'with_front' => FALSE,
|
41 |
+
'feeds' => FALSE,
|
42 |
+
'pages' => FALSE,
|
43 |
+
)
|
44 |
+
);
|
45 |
+
register_post_type(self::POST_TYPE, $args);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get the ID of the placeholder post
|
50 |
+
*
|
51 |
+
* @static
|
52 |
+
* @return int
|
53 |
+
*/
|
54 |
+
protected static function get_post_id() {
|
55 |
+
if ( !self::$post_id ) {
|
56 |
+
$posts = get_posts(array(
|
57 |
+
'post_type' => self::POST_TYPE,
|
58 |
+
'post_status' => 'publish',
|
59 |
+
'posts_per_page' => 1,
|
60 |
+
));
|
61 |
+
if ( $posts ) {
|
62 |
+
self::$post_id = $posts[0]->ID;
|
63 |
+
} else {
|
64 |
+
self::$post_id = self::make_post();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
return self::$post_id;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Make a new placeholder post
|
72 |
+
*
|
73 |
+
* @static
|
74 |
+
* @return int The ID of the new post
|
75 |
+
*/
|
76 |
+
private static function make_post() {
|
77 |
+
$post = array(
|
78 |
+
'post_title' => self::__('WP Router Placeholder Page'),
|
79 |
+
'post_status' => 'publish',
|
80 |
+
'post_type' => self::POST_TYPE,
|
81 |
+
);
|
82 |
+
$id = wp_insert_post($post);
|
83 |
+
if ( is_wp_error($id) ) {
|
84 |
+
return 0;
|
85 |
+
}
|
86 |
+
return $id;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function __construct( $contents, $title, $template = '' ) {
|
90 |
+
$this->contents = $contents;
|
91 |
+
$this->title = $title;
|
92 |
+
$this->template = $template;
|
93 |
+
$this->add_hooks();
|
94 |
+
}
|
95 |
+
|
96 |
+
protected function add_hooks() {
|
97 |
+
add_action('pre_get_posts', array($this, 'edit_query'), 10, 1);
|
98 |
+
add_action('the_post', array($this, 'set_post_contents'), 10, 1);
|
99 |
+
add_filter('the_title', array($this, 'get_title'), 10, 2);
|
100 |
+
add_filter('single_post_title', array($this, 'get_single_post_title'), 10, 2);
|
101 |
+
if ( $this->template ) {
|
102 |
+
add_filter('template_include', array($this, 'override_template'), 10, 1);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Edit WordPress's query so it finds our placeholder page
|
108 |
+
*
|
109 |
+
* @param WP_Query $query
|
110 |
+
* @return void
|
111 |
+
*/
|
112 |
+
public function edit_query( WP_Query $query ) {
|
113 |
+
if ( isset($query->query_vars[self::QUERY_VAR]) ) {
|
114 |
+
// make sure we get the right post
|
115 |
+
$query->query_vars['post_type'] = self::POST_TYPE;
|
116 |
+
$query->query_vars['p'] = self::get_post_id();
|
117 |
+
|
118 |
+
// override any vars WordPress set based on the original query
|
119 |
+
$query->is_single = TRUE;
|
120 |
+
$query->is_singular = TRUE;
|
121 |
+
$query->is_404 = FALSE;
|
122 |
+
$query->is_home = FALSE;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Override the global $pages array to yield our content
|
128 |
+
*
|
129 |
+
* @param object $post
|
130 |
+
* @return void
|
131 |
+
*/
|
132 |
+
public function set_post_contents( $post ) {
|
133 |
+
global $pages;
|
134 |
+
$pages = array($this->contents);
|
135 |
+
// TODO: add a facility for multi-page documents?
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Set the title for the placeholder page
|
140 |
+
*
|
141 |
+
* @param string $title
|
142 |
+
* @param int $post_id
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
public function get_title( $title, $post_id ) {
|
146 |
+
if ( $post_id == self::get_post_id() ) {
|
147 |
+
$title = $this->title;
|
148 |
+
}
|
149 |
+
return $title;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Set the title for the placeholder page (again)
|
154 |
+
*
|
155 |
+
* @param string $title
|
156 |
+
* @param object $post
|
157 |
+
* @return string
|
158 |
+
*/
|
159 |
+
public function get_single_post_title( $title, $post = NULL ) {
|
160 |
+
// in WP 3.0.x, $post might be NULL. Not true in WP 3.1
|
161 |
+
if ( !$post ) {
|
162 |
+
$post = $GLOBALS['post'];
|
163 |
+
}
|
164 |
+
return $this->get_title($title, $post->ID);
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Use the specified template file
|
169 |
+
*
|
170 |
+
* @param string $template
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function override_template( $template ) {
|
174 |
+
if ( $this->template && file_exists($template) ) { // these checks shouldn't be necessary, but no harm
|
175 |
+
return $this->template;
|
176 |
+
}
|
177 |
+
return $template;
|
178 |
+
}
|
179 |
+
}
|
vendor/wp-router/WP_Router_Sample.class.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: jbrinley
|
4 |
+
* Date: 5/22/11
|
5 |
+
* Time: 4:14 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class WP_Router_Sample {
|
9 |
+
public static function init() {
|
10 |
+
add_action('wp_router_generate_routes', array(get_class(), 'generate_routes'), 10, 1);
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function generate_routes( WP_Router $router ) {
|
14 |
+
$router->add_route('wp-router-sample', array(
|
15 |
+
'path' => '^wp_router/(.*?)$',
|
16 |
+
'query_vars' => array(
|
17 |
+
'sample_argument' => 1,
|
18 |
+
),
|
19 |
+
'page_callback' => array(get_class(), 'sample_callback'),
|
20 |
+
'page_arguments' => array('sample_argument'),
|
21 |
+
'access_callback' => TRUE,
|
22 |
+
'title' => 'WP Router Sample Page',
|
23 |
+
));
|
24 |
+
}
|
25 |
+
|
26 |
+
public static function sample_callback( $argument ) {
|
27 |
+
echo '<p>Welcome to the WP Router sample page. You can find the code that generates this page in '.__FILE__.'</p>';
|
28 |
+
echo '<p>This page helpfully tells you the value of the <code>sample_argument</code> query variable: '.esc_html($argument).'</p>';
|
29 |
+
}
|
30 |
+
}
|
vendor/wp-router/WP_Router_Utility.class.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: jbrinley
|
4 |
+
* Date: 5/18/11
|
5 |
+
* Time: 1:46 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class WP_Router_Utility {
|
9 |
+
const QUERY_VAR = 'WP_Route';
|
10 |
+
const PLUGIN_NAME = 'WP Router';
|
11 |
+
const TEXT_DOMAIN = 'wp-router';
|
12 |
+
const DEBUG = FALSE;
|
13 |
+
const MIN_PHP_VERSION = '5.2';
|
14 |
+
const MIN_WP_VERSION = '3.0';
|
15 |
+
const DB_VERSION = 1;
|
16 |
+
const PLUGIN_INIT_HOOK = 'wp_router_init';
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* A wrapper around WP's __() to add the plugin's text domain
|
21 |
+
*
|
22 |
+
* @param string $string
|
23 |
+
* @return string|void
|
24 |
+
*/
|
25 |
+
public static function __( $string ) {
|
26 |
+
return __($string, self::TEXT_DOMAIN);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* A wrapper around WP's _e() to add the plugin's text domain
|
31 |
+
*
|
32 |
+
* @param string $string
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public static function _e( $string ) {
|
36 |
+
_e($string, self::TEXT_DOMAIN);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @static
|
41 |
+
* @return string The system path to this plugin's directory, with no trailing slash
|
42 |
+
*/
|
43 |
+
public static function plugin_path() {
|
44 |
+
return WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @static
|
49 |
+
* @return string The url to this plugin's directory, with no trailing slash
|
50 |
+
*/
|
51 |
+
public static function plugin_url() {
|
52 |
+
return WP_PLUGIN_URL . '/' . basename( dirname( __FILE__ ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Check that the minimum PHP and WP versions are met
|
57 |
+
*
|
58 |
+
* @static
|
59 |
+
* @param string $php_version
|
60 |
+
* @param string $wp_version
|
61 |
+
* @return bool Whether the test passed
|
62 |
+
*/
|
63 |
+
public static function prerequisites_met( $php_version, $wp_version ) {
|
64 |
+
$pass = TRUE;
|
65 |
+
$pass = $pass && version_compare( $php_version, self::MIN_PHP_VERSION, '>=');
|
66 |
+
$pass = $pass && version_compare( $wp_version, self::MIN_WP_VERSION, '>=');
|
67 |
+
return $pass;
|
68 |
+
}
|
69 |
+
|
70 |
+
public static function failed_to_load_notices( $php_version = self::MIN_PHP_VERSION, $wp_version = self::MIN_WP_VERSION ) {
|
71 |
+
printf( '<div class="error"><p>%s</p></div>', sprintf( self::__( '%1$s requires WordPress %2$s or higher and PHP %3$s or higher.' ), self::PLUGIN_NAME, $wp_version, $php_version ) );
|
72 |
+
}
|
73 |
+
|
74 |
+
public static function init() {
|
75 |
+
do_action(self::PLUGIN_INIT_HOOK);
|
76 |
+
}
|
77 |
+
}
|
vendor/wp-router/readme.txt
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Router ===
|
2 |
+
Contributors: jbrinley
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A69NZPKWGB6H2
|
4 |
+
Tags: URL mapping, callback functions
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.1
|
7 |
+
Stable tag: trunk
|
8 |
+
|
9 |
+
Provides a simple API for mapping requests to callback functions.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
WordPress's rewrite rules and query variables provide a powerful system
|
14 |
+
for mapping URL strings to collections of posts. Every request is parsed
|
15 |
+
into query variables and turned into a SQL query via `$wp_query->query()`.
|
16 |
+
|
17 |
+
Sometimes, though, you don't want to display a list of posts. You just want
|
18 |
+
a URL to map to a callback function, with the output displayed in place of
|
19 |
+
posts in whatever theme you happen to be using.
|
20 |
+
|
21 |
+
That's where WP Router comes in. It handles all the messy bits of registering
|
22 |
+
post types, query variables, rewrite rules, etc., and lets you write code to
|
23 |
+
do what you want it to do. One function call is all it takes to map a
|
24 |
+
URL to your designated callback function and display the return value in the page.
|
25 |
+
|
26 |
+
Created by [Adelie Design](http://www.AdelieDesign.com)
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
1. Download and unzip the plugin
|
31 |
+
1. Upload the `WP-Router` folder to the `/wp-content/plugins/` directory
|
32 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
33 |
+
1. You should see the sample page at http://example.org/wp_router/sample/. Apart from that, there is no public UI for this plugin. You will not see any changes unless the plugin's API is called by another active plugin.
|
34 |
+
|
35 |
+
== Usage ==
|
36 |
+
|
37 |
+
= Creating Routes =
|
38 |
+
|
39 |
+
* Your plugin should hook into the `wp_router_generate_routes` action.
|
40 |
+
The callback should take one argument, a `WP_Router` object.
|
41 |
+
* Register a route and its callback using `WP_Router::add_route( $id, $args )`
|
42 |
+
* `$id` is a unique string your plugin should use to identify the route
|
43 |
+
* `$args` is an associative array, that sets the following properties for your route.
|
44 |
+
Any omitted argument will use the default value.
|
45 |
+
* `path` (required) - A regular expression to match against the request path.
|
46 |
+
This corresponds to the array key you would use when creating rewrite rules for WordPress.
|
47 |
+
|
48 |
+
* `query_vars` - An associative array, with the keys being query vars, and the
|
49 |
+
values being explicit strings or integers corresponding to matches in the path regexp.
|
50 |
+
Any query variables included here will be automatically registered.
|
51 |
+
|
52 |
+
* `title` - The title of the page.
|
53 |
+
|
54 |
+
* `title_callback` - A callback to use for dynamically generating the title.
|
55 |
+
Defaults to `__()`. If `NULL`, the `title` argument will be used as-is. if
|
56 |
+
`page_callback` or `access_callback` returns `FALSE`, `title_callback` will not be called.
|
57 |
+
|
58 |
+
`title_callback` can be either a single callback function or an array specifying
|
59 |
+
callback functions for specific HTTP methods (e.g., `GET`, `POST`, `PUT`, `DELETE`, etc.).
|
60 |
+
If the latter, the `default` key will be used if no other keys match the current
|
61 |
+
request method.
|
62 |
+
|
63 |
+
* `title_arguments` - An array of query variables whose values will be passed
|
64 |
+
as arguments to `title_callback`. Defaults to the value of `title`. If an argument
|
65 |
+
is not a registered query variable, it will be passed as-is.
|
66 |
+
|
67 |
+
* `page_callback` (required) - A callback to use for dynamically generating the
|
68 |
+
contents of the page. The callback should either echo or return the contents of
|
69 |
+
the page (if both, the returned value will be appended to the echoed value). If
|
70 |
+
`FALSE` is returned, nothing will be output, and control of the page contents will
|
71 |
+
be handed back to WordPress. The callback will be called during the `parse_request`
|
72 |
+
phase of WordPress's page load. If `access_callback` returns `FALSE`, `page_callback`
|
73 |
+
will not be called.
|
74 |
+
|
75 |
+
`page_callback` can be either a single callback function or an array specifying
|
76 |
+
callback functions for specific HTTP methods (e.g., `GET`, `POST`, `PUT`, `DELETE`, etc.).
|
77 |
+
If the latter, the `default` key will be used if no other keys match the current
|
78 |
+
request method.
|
79 |
+
|
80 |
+
* `page_arguments` - An array of query variables whose values will be passed as
|
81 |
+
arguments to `page_callback`. If an argument is not a registered query variable,
|
82 |
+
it will be passed as-is.
|
83 |
+
|
84 |
+
* `access_callback` - A callback to determine if the user has permission to access
|
85 |
+
this page. If `access_arguments` is provided, default is `current_user_can`, otherwise
|
86 |
+
default is `TRUE`. If the callback returns `FALSE`, anonymous users are redirected to
|
87 |
+
the login page, authenticated users get a 403 error.
|
88 |
+
|
89 |
+
`access_callback` can be either a single callback function or an array specifying
|
90 |
+
callback functions for specific HTTP methods (e.g., `GET`, `POST`, `PUT`, `DELETE`, etc.).
|
91 |
+
If the latter, the `default` key will be used if no other keys match the current
|
92 |
+
request method.
|
93 |
+
|
94 |
+
* `access_arguments` - An array of query variables whose values will be passed
|
95 |
+
as arguments to `access_callback`. If an argument is not a registered query variable,
|
96 |
+
it will be passed as-is.
|
97 |
+
|
98 |
+
* `template` - An array of templates that can be used to display the page. If a path
|
99 |
+
is absolute, it will be used as-is; relative paths allow for overrides by the theme.
|
100 |
+
The string `$id` will be replaced with the ID of the route. If no template is found,
|
101 |
+
fallback templates are (in this order): `route-$id.php`, `route.php`, `page-$id.php`,
|
102 |
+
`page.php`, `index.php`. If FALSE is given instead of an array, the page contents will
|
103 |
+
be printed before calling `exit()` (you can also accomplish this by printing your output
|
104 |
+
and exiting directly from your callback function).
|
105 |
+
|
106 |
+
Example:
|
107 |
+
`$router->add_route('wp-router-sample', array(
|
108 |
+
'path' => '^wp_router/(.*?)$',
|
109 |
+
'query_vars' => array(
|
110 |
+
'sample_argument' => 1,
|
111 |
+
),
|
112 |
+
'page_callback' => array(get_class(), 'sample_callback'),
|
113 |
+
'page_arguments' => array('sample_argument'),
|
114 |
+
'access_callback' => TRUE,
|
115 |
+
'title' => 'WP Router Sample Page',
|
116 |
+
'template' => array('sample-page.php', dirname(__FILE__).DIRECTORY_SEPARATOR.'sample-page.php')
|
117 |
+
));`
|
118 |
+
|
119 |
+
In this example, the path `http://example.com/wp_router/my_sample_path/` will call
|
120 |
+
the function `sample_callback` in the calling class. The value of the `sample_argument`
|
121 |
+
query variable, in this case "my_sample_path", will be provided as the first and only
|
122 |
+
argument to the callback function. If the file `sample-page.php` is found in the theme,
|
123 |
+
it will be used as the template, otherwise `sample-page.php` in your plugin directory will
|
124 |
+
be used (if that's not found either, fall back to `route-wp-router-sample.php`, etc.).
|
125 |
+
|
126 |
+
= Editing Routes =
|
127 |
+
|
128 |
+
* You can hook into the `wp_router_alter_routes` action to modify routes created by other plugins. The callback should take one argument, a `WP_Router` object.
|
129 |
+
|
130 |
+
= Public API Functions =
|
131 |
+
|
132 |
+
Creating or changing routes should always occur in the context of the `wp_router_generate_routes` or `wp_router_alter_routes` actions, using the `WP_Router` object supplied to your callback function.
|
133 |
+
|
134 |
+
* `WP_Router::edit_route( string $id, array $changes )` - update each
|
135 |
+
property given in `$changes` for the route with the given ID. Any properties
|
136 |
+
not given in `$changes` will be left unaltered.
|
137 |
+
* `WP_Router::remove_route( string $id )` - delete the route with the given ID
|
138 |
+
* `WP_Router::get_route( string $id )` - get the `WP_Route` object for the given ID
|
139 |
+
* `WP_Router::get_url( string $id, array $arguments )` - get the URL to reach the route with the given ID, with the given query variables and their values
|
140 |
+
* `WP_Route::get( string $property )` - get the value of the specified property for
|
141 |
+
the `WP_Route` instance
|
142 |
+
|
143 |
+
== Changelog ==
|
144 |
+
|
145 |
+
= 0.1 =
|
146 |
+
|
147 |
+
* Initial version
|
148 |
+
|
149 |
+
= 0.2 =
|
150 |
+
|
151 |
+
* Added the `template` argument
|
152 |
+
|
153 |
+
= 0.3 =
|
154 |
+
|
155 |
+
* Added `FALSE` option to template parameter to indicate immediate `exit()`
|
156 |
+
* Added option to specify different callback functions depending on the HTTP request method
|
157 |
+
* Verified compatibility with WordPress 3.0
|
158 |
+
* Added WP_Router::get_url() function
|
vendor/wp-router/wp-router.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP Router
|
4 |
+
Plugin URI: http://www.adeliedesign.com/
|
5 |
+
Description: Provides a simple API for mapping requests to callback functions.
|
6 |
+
Author: Adelie Design
|
7 |
+
Author URI: http://www.adeliedesign.com/
|
8 |
+
Version: 0.3.1
|
9 |
+
*/
|
10 |
+
/*
|
11 |
+
Copyright (c) 2011 Adelie Design, Inc. http://www.AdelieDesign.com/
|
12 |
+
|
13 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
14 |
+
a copy of this software and associated documentation files (the
|
15 |
+
"Software"), to deal in the Software without restriction, including
|
16 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
17 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
18 |
+
permit persons to whom the Software is furnished to do so, subject to
|
19 |
+
the following conditions:
|
20 |
+
|
21 |
+
The above copyright notice and this permission notice shall be included
|
22 |
+
in all copies or substantial portions of the Software.
|
23 |
+
|
24 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
25 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
26 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
27 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
28 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
29 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
30 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
31 |
+
*/
|
32 |
+
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Load all the plugin files and initialize appropriately
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
if ( !function_exists('WP_Router_load') ) {
|
40 |
+
function WP_Router_load() {
|
41 |
+
// load the base class
|
42 |
+
require_once 'WP_Router_Utility.class.php';
|
43 |
+
|
44 |
+
if ( WP_Router_Utility::prerequisites_met(phpversion(), get_bloginfo('version')) ) {
|
45 |
+
// we can continue. Load all supporting files and hook into wordpress
|
46 |
+
require_once 'WP_Router.class.php';
|
47 |
+
require_once 'WP_Route.class.php';
|
48 |
+
require_once 'WP_Router_Page.class.php';
|
49 |
+
add_action('init', array('WP_Router_Utility', 'init'), -100, 0);
|
50 |
+
add_action(WP_Router_Utility::PLUGIN_INIT_HOOK, array('WP_Router_Page', 'init'), 0, 0);
|
51 |
+
add_action(WP_Router_Utility::PLUGIN_INIT_HOOK, array('WP_Router', 'init'), 1, 0);
|
52 |
+
|
53 |
+
// Sample page
|
54 |
+
require_once 'WP_Router_Sample.class.php';
|
55 |
+
add_action(WP_Router_Utility::PLUGIN_INIT_HOOK, array('WP_Router_Sample', 'init'), 1, 0);
|
56 |
+
} else {
|
57 |
+
// let the user know prerequisites weren't met
|
58 |
+
add_action('admin_head', array('WP_Router_Utility', 'failed_to_load_notices'), 0, 0);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
// Fire it up!
|
62 |
+
WP_Router_load();
|
63 |
+
}
|