- Cambios
git-svn-id: https://192.168.0.254/svn/Proyectos.FundacionLQDVI_Web/trunk@16 77ab8c26-3d69-2c4d-86f2-786f4ba54905
BIN
src/webcam/images/1371C581-8C6D-45D9-D9EF-77BD16F352C8.jpg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src/webcam/images/23017F7E-D698-FABC-62D3-C7F2A64C4BF4.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
src/webcam/images/ABE23EE8-8E8F-ED31-B224-E8AADD996AA2.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
376
src/wp-content/plugins/google-calendar-events/admin/add.php
Normal file
@ -0,0 +1,376 @@
|
||||
<?php
|
||||
//Redirect to the main plugin options page if form has been submitted
|
||||
if ( isset( $_GET['action'] ) ) {
|
||||
if ( 'add' == $_GET['action'] && isset( $_GET['updated'] ) )
|
||||
wp_redirect( admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php&updated=added' ) );
|
||||
}
|
||||
|
||||
add_settings_section( 'gce_add', __( 'Add a Feed', GCE_TEXT_DOMAIN ), 'gce_add_main_text', 'add_feed' );
|
||||
//Unique ID //Title //Function //Page //Section ID
|
||||
add_settings_field( 'gce_add_id_field', __( 'Feed ID', GCE_TEXT_DOMAIN ), 'gce_add_id_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_title_field', __( 'Feed Title', GCE_TEXT_DOMAIN ), 'gce_add_title_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_url_field', __( 'Feed URL', GCE_TEXT_DOMAIN ), 'gce_add_url_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_retrieve_from_field', __( 'Retrieve events from', GCE_TEXT_DOMAIN ), 'gce_add_retrieve_from_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_retrieve_until_field', __( 'Retrieve events until', GCE_TEXT_DOMAIN ), 'gce_add_retrieve_until_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_max_events_field', __( 'Maximum number of events to retrieve', GCE_TEXT_DOMAIN ), 'gce_add_max_events_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_date_format_field', __( 'Date format', GCE_TEXT_DOMAIN ), 'gce_add_date_format_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_time_format_field', __( 'Time format', GCE_TEXT_DOMAIN ), 'gce_add_time_format_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_timezone_field', __( 'Timezone adjustment', GCE_TEXT_DOMAIN ), 'gce_add_timezone_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_cache_duration_field', __( 'Cache duration', GCE_TEXT_DOMAIN ), 'gce_add_cache_duration_field', 'add_feed', 'gce_add' );
|
||||
add_settings_field( 'gce_add_multiple_field', __( 'Show multiple day events on each day?', GCE_TEXT_DOMAIN ), 'gce_add_multiple_field', 'add_feed', 'gce_add' );
|
||||
|
||||
add_settings_section( 'gce_add_display', __( 'Display Options', GCE_TEXT_DOMAIN ), 'gce_add_display_main_text', 'add_display' );
|
||||
add_settings_field( 'gce_add_use_builder_field', __( 'Select display customization method', GCE_TEXT_DOMAIN ), 'gce_add_use_builder_field', 'add_display', 'gce_add_display' );
|
||||
|
||||
add_settings_section( 'gce_add_builder', __( 'Event Display Builder' ), 'gce_add_builder_main_text', 'add_builder' );
|
||||
add_settings_field( 'gce_add_builder_field', __( 'Event display builder HTML and shortcodes', GCE_TEXT_DOMAIN ), 'gce_add_builder_field', 'add_builder', 'gce_add_builder' );
|
||||
|
||||
add_settings_section( 'gce_add_simple_display', __('Simple Display Options'), 'gce_add_simple_display_main_text', 'add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_start_field', __( 'Display start time / date?', GCE_TEXT_DOMAIN ), 'gce_add_display_start_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_end_field', __( 'Display end time / date?', GCE_TEXT_DOMAIN ), 'gce_add_display_end_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_separator_field', __( 'Separator text / characters', GCE_TEXT_DOMAIN ), 'gce_add_display_separator_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_location_field', __( 'Display location?', GCE_TEXT_DOMAIN ), 'gce_add_display_location_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_desc_field', __( 'Display description?', GCE_TEXT_DOMAIN ), 'gce_add_display_desc_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
add_settings_field( 'gce_add_display_link_field', __( 'Display link to event?', GCE_TEXT_DOMAIN ), 'gce_add_display_link_field', 'add_simple_display', 'gce_add_simple_display' );
|
||||
|
||||
//Main text
|
||||
function gce_add_main_text() {
|
||||
?>
|
||||
<p><?php _e( 'Enter the feed details below, then click the Add Feed button.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
//ID
|
||||
function gce_add_id_field() {
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
$id = 1;
|
||||
if ( !empty( $options ) ) { //If there are no saved feeds
|
||||
//Go to last saved feed
|
||||
end( $options );
|
||||
//Set id to last feed id + 1
|
||||
$id = key( $options ) + 1;
|
||||
}
|
||||
|
||||
?>
|
||||
<input type="text" disabled="disabled" value="<?php echo $id; ?>" size="3" />
|
||||
<input type="hidden" name="gce_options[id]" value="<?php echo $id; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Title
|
||||
function gce_add_title_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'Anything you like. \'Upcoming Club Events\', for example.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[title]" size="50" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//URL
|
||||
function gce_add_url_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'This will probably be something like:', GCE_TEXT_DOMAIN ); ?> <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/basic</code>.</span>
|
||||
<br />
|
||||
<span class="description"><?php _e( 'or:', GCE_TEXT_DOMAIN ); ?> <code>http://www.google.com/calendar/feeds/your-email@gmail.com/private-d65741b037h695ff274247f90746b2ty/basic</code>.</span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[url]" size="100" class="required" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Retrieve events from
|
||||
function gce_add_retrieve_from_field() {
|
||||
?>
|
||||
<span class="description">
|
||||
<?php _e( 'The point in time at which to start retrieving events. Use the text-box to specify an additional offset from you chosen start point. The offset should be provided in seconds (3600 = 1 hour, 86400 = 1 day) and can be negative. If you have selected the \'Specific date / time\' option, enter a', GCE_TEXT_DOMAIN ); ?>
|
||||
<a href="http://www.timestampgenerator.com" target="_blank"><?php _e( 'UNIX timestamp', GCE_TEXT_DOMAIN ); ?></a>
|
||||
<?php _e( 'in the text-box.', GCE_TEXT_DOMAIN ); ?>
|
||||
</span>
|
||||
<br />
|
||||
<select name="gce_options[retrieve_from]">
|
||||
<option value="now"><?php _e( 'Now', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="today" selected="selected"><?php _e( '00:00 today', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="week"><?php _e( 'Start of current week', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="month-start"><?php _e( 'Start of current month', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="month-end"><?php _e( 'End of current month', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="any"><?php _e( 'The beginning of time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date"><?php _e( 'Specific date / time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
<input type="text" name="gce_options[retrieve_from_value]" value="0" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Retrieve events until
|
||||
function gce_add_retrieve_until_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'The point in time at which to stop retrieving events. The instructions for the above option also apply here.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[retrieve_until]">
|
||||
<option value="now"><?php _e( 'Now', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="today"><?php _e( '00:00 today', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="week"><?php _e( 'Start of current week', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="month-start"><?php _e( 'Start of current month', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="month-end"><?php _e( 'End of current month', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="any" selected="selected"><?php _e( 'The end of time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date"><?php _e( 'Specific date / time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
|
||||
</select>
|
||||
<input type="text" name="gce_options[retrieve_until_value]" value="0" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Max events
|
||||
function gce_add_max_events_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'Set this to a few more than you actually want to display (due to caching and timezone issues). The exact number to display can be configured per shortcode / widget.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[max_events]" value="25" size="3" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Date format
|
||||
function gce_add_date_format_field(){
|
||||
?>
|
||||
<span class="description"><?php _e( 'In <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a>. Leave this blank if you\'d rather stick with the default format for your blog.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[date_format]" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Time format
|
||||
function gce_add_time_format_field(){
|
||||
?>
|
||||
<span class="description"><?php _e( 'In <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a>. Again, leave this blank to stick with the default.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[time_format]" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Timezone offset
|
||||
function gce_add_timezone_field() {
|
||||
require_once 'timezone-choices.php';
|
||||
$timezone_list = gce_get_timezone_choices();
|
||||
//Set selected="selected" for default option
|
||||
$timezone_list = str_replace( '<option value="default">Default</option>', '<option value="default" selected="selected">Default</option>', $timezone_list );
|
||||
?>
|
||||
<span class="description"><?php _e( 'If you are having problems with dates and times displaying in the wrong timezone, select a city in your required timezone here.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<?php echo $timezone_list; ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Cache duration
|
||||
function gce_add_cache_duration_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'The length of time, in seconds, to cache the feed (43200 = 12 hours). If this feed changes regularly, you may want to reduce the cache duration.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[cache_duration]" value="43200" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Multiple day events
|
||||
function gce_add_multiple_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'Show events that span multiple days on each day that they span, rather than just the first day.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_options[multiple_day]" value="true" />
|
||||
<br /><br />
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
//Display options
|
||||
function gce_add_display_main_text() {
|
||||
?>
|
||||
<p><?php _e( 'These settings control what information will be displayed for this feed in the tooltip (for grids), or in a list.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_use_builder_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'It is recommended that you use the event display builder option, as it provides much more flexibility than the simple display options. The event display builder can do everything the simple display options can, plus lots more!', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[use_builder]">
|
||||
<option value="true" selected="selected"><?php _e( 'Event display builder', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="false"><?php _e( 'Simple display options', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Event display builder
|
||||
function gce_add_builder_main_text() {
|
||||
?>
|
||||
<p class="gce-event-builder">
|
||||
<?php _e( 'Use the event display builder to customize how event information will be displayed in the grid tooltips and in lists. Use HTML and the shortcodes (explained below) to display the information you require. A basic example display format is provided as a starting point. For more information, take a look at the', GCE_TEXT_DOMAIN ); ?>
|
||||
<a href="http://www.rhanney.co.uk/plugins/google-calendar-events/event-display-builder" target="_blank"><?php _e( 'event display builder guide', GCE_TEXT_DOMAIN ); ?></a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_builder_field() {
|
||||
?>
|
||||
<textarea name="gce_options[builder]" rows="10" cols="80">
|
||||
<div class="gce-list-event gce-tooltip-event">[event-title]</div>
|
||||
<div><span>Starts:</span> [start-time]</div>
|
||||
<div><span>Ends:</span> [end-date] - [end-time]</div>
|
||||
[if-location]<div><span>Location:</span> [location]</div>[/if-location]
|
||||
[if-description]<div><span>Description:</span> [description]</div>[/if-description]
|
||||
<div>[link newwindow="true"]More details...[/link]</div>
|
||||
</textarea>
|
||||
<br />
|
||||
<p style="margin-top:20px;">
|
||||
<?php _e( '(More information on all of the below shortcodes and attributes, and working examples, can be found in the', GCE_TEXT_DOMAIN ); ?>
|
||||
<a href="http://www.rhanney.co.uk/plugins/google-calendar-events/event-display-builder" target="_blank"><?php _e( 'event display builder guide', GCE_TEXT_DOMAIN ); ?></a>)
|
||||
</p>
|
||||
<h4><?php _e( 'Event information shortcodes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<ul>
|
||||
<li><code>[event-title]</code><span class="description"> - <?php _e( 'The event title (possible attributes: <code>html</code>, <code>markdown</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-time]</code><span class="description"> - <?php _e( 'The event start time. Will use the time format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-date]</code><span class="description"> - <?php _e( 'The event start date. Will use the date format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-custom]</code><span class="description"> - <?php _e( 'The event start date / time. Will use the format specified in the <code>format</code> attribute (possible attributes: <code>format</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-human]</code><span class="description"> - <?php _e( 'The difference between the start time of the event and the time now, in human-readable format, such as \'1 hour\', \'4 days\', \'15 mins\' (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-time]</code><span class="description"> - <?php _e( 'The event end time. Will use the time format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-date]</code><span class="description"> - <?php _e( 'The event end date. Will use the date format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-custom]</code><span class="description"> - <?php _e( 'The event end date / time. Will use the format specified in the <code>format</code> attribute (possible attributes: <code>format</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-human]</code><span class="description"> - <?php _e( 'The difference between the end time of the event and the time now, in human-readable format (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[location]</code><span class="description"> - <?php _e( 'The event location (possible attributes: <code>html</code>, <code>markdown</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[maps-link]…[/maps-link]</code><span class="description"> - <?php _e( 'Anything between the opening and closing shortcode tags (inlcuding further shortcodes) will be linked to Google Maps, using the event location as a search parameter (possible attributes: <code>newwindow</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[description]</code><span class="description"> - <?php _e( 'The event description (possible attributes: <code>html</code>, <code>markdown</code>, <code>limit</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[link]…[/link]</code><span class="description"> - <?php _e( 'Anything between the opening and closing shortcode tags (inlcuding further shortcodes) will be linked to the Google Calendar page for the event (possible attributes: <code>newwindow</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[url]</code><span class="description"> - <?php _e( 'The raw URL to the Google Calendar page for the event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[length]</code><span class="description"> - <?php _e( 'The length of the event, in human-readable format (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[event-num]</code><span class="description"> - <?php _e( 'The position of the event in the current list, or the position of the event in the current month (for grids)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[event-id]</code><span class="description"> - <?php _e( 'The event UID (a unique identifier assigned to the event by Google)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Feed information shortcodes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<ul>
|
||||
<li><code>[feed-title]</code><span class="description"> - <?php _e( 'The title of the feed from which the event comes', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[feed-id]</code><span class="description"> - <?php _e( 'The ID of the feed from which the event comes', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[cal-id]</code><span class="description"> - <?php _e( 'The calendar ID (a unique identifier assigned to the calendar by Google)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Conditional shortcodes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<p class="description" style="margin-bottom:18px;"><?php _e( 'Anything entered between the opening and closing tags of each of the following shortcodes will only be displayed if its condition (below) is met.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<ul>
|
||||
<li><code>[if-all-day]…[/if-all-day]</code><span class="description"> - <?php _e( 'The event is an all-day event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-all-day]…[/if-not-all-day]</code><span class="description"> - <?php _e( 'The event is not an all-day event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-title]…[/if-title]</code><span class="description"> - <?php _e( 'The event has a title', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-description]…[/if-description]</code><span class="description"> - <?php _e( 'The event has a description', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-location]…[/if-location]</code><span class="description"> - <?php _e( 'The event has a location', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-tooltip]…[/if-tooltip]</code><span class="description"> - <?php _e( 'The event is to be displayed in a tooltip (not a list)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-list]…[/if-list]</code><span class="description"> - <?php _e( 'The event is to be displayed in a list (not a tooltip)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-now]…[/if-now]</code><span class="description"> - <?php _e( 'The event is taking place now (after the start time, but before the end time)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-now]…[/if-not-now]</code><span class="description"> - <?php _e( 'The event is not taking place now (may have ended or not yet started)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-started]…[/if-started]</code><span class="description"> - <?php _e( 'The event has started (even if it has also ended)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-started]…[/if-not-started]</code><span class="description"> - <?php _e( 'The event has not started', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-ended]…[/if-ended]</code><span class="description"> - <?php _e( 'The event has ended', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-ended]…[/if-not-ended]</code><span class="description"> - <?php _e( 'The event has not ended (even if it hasn\'t started)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-first]…[/if-first]</code><span class="description"> - <?php _e( 'The event is the first of the day', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-first]…[/if-not-first]</code><span class="description"> - <?php _e( 'The event is not the first of the day', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-multi-day]…[/if-multi-day]</code><span class="description"> - <?php _e( 'The event spans multiple days', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-single-day]…[/if-single-day]</code><span class="description"> - <?php _e( 'The event does not span multiple days', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Attributes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<p class="description" style="margin-bottom:18px;"><?php _e( 'The possible attributes mentioned above are explained here:', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<ul>
|
||||
<li><code>html</code><span class="description"> - <?php _e( 'Whether or not to parse HTML that has been entered in the relevant field. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>markdown</code><span class="description"> - <?php _e( 'Whether or not to parse <a href="http://daringfireball.net/projects/markdown" target="_blank">Markdown</a> that has been entered in the relevant field. <a href="http://michelf.com/projects/php-markdown" target="_blank">PHP Markdown</a> must be installed for this to work. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>limit</code><span class="description"> - <?php _e( 'The word limit for the field. Should be specified as a positive integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>format</code><span class="description"> - <?php _e( 'The date / time format to use. Should specified as a <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a> string', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>newwindow</code><span class="description"> - <?php _e( 'Whether or not the link should open in a new window / tab. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>precision</code><span class="description"> - <?php _e( 'How precise to be when displaying a time difference in human-readable format. Should be specified as a positive integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>offset</code><span class="description"> - <?php _e( 'An offset (in seconds) to apply to start / end times before display. Should be specified as a (positive or negative) integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>autolink</code><span class="description"> - <?php _e( 'Whether or not to automatically convert URLs in the description to links. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Simple display options
|
||||
function gce_add_simple_display_main_text() {
|
||||
?>
|
||||
<p class="gce-simple-display-options"><?php _e( 'You can use some HTML in the text fields, but ensure it is valid or things might go wonky. Text fields can be empty too.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_start_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'Select how to display the start date / time.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[display_start]">
|
||||
<option value="none"><?php _e( 'Don\'t display start time or date', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="time" selected="selected"><?php _e( 'Display start time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date"><?php _e( 'Display start date', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="time-date"><?php _e( 'Display start time and date (in that order)', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date-time"><?php _e( 'Display start date and time (in that order)', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'Text to display before the start time.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_start_text]" value="Starts:" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_end_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'Select how to display the end date / time.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[display_end]">
|
||||
<option value="none"><?php _e( 'Don\'t display end time or date', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="time"><?php _e( 'Display end time', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date"><?php _e( 'Display end date', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="time-date" selected="selected"><?php _e( 'Display end time and date (in that order)', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="date-time"><?php _e( 'Display end date and time (in that order)', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'Text to display before the end time.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_end_text]" value="Ends:" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_separator_field() {
|
||||
?>
|
||||
<span class="description"><?php _e( 'If you have chosen to display both the time and date above, enter the text / characters to display between the time and date here (including any spaces).', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_separator]" value=", " />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_location_field() {
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_location]" value="on" />
|
||||
<span class="description"><?php _e( 'Show the location of events?', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'Text to display before the location.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_location_text]" value="Location:" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_desc_field() {
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_desc]" value="on" />
|
||||
<span class="description"><?php _e( 'Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'Text to display before the description.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_desc_text]" value="Description:" />
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'Maximum number of words to show from description. Leave blank for no limit.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_desc_limit]" size="3" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_add_display_link_field() {
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_link]" value="on" checked="checked" />
|
||||
<span class="description"><?php _e( 'Show a link to the Google Calendar page for an event?', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_options[display_link_target]" value="on" />
|
||||
<span class="description"><?php _e( 'Links open in a new window / tab?', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e( 'The link text to be displayed.', GCE_TEXT_DOMAIN ); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_link_text]" value="More details" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
//Redirect to the main plugin options page if form has been submitted
|
||||
if(isset($_GET['action'])){
|
||||
if($_GET['action'] == 'delete' && isset($_GET['updated'])){
|
||||
wp_redirect(admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&updated=deleted'));
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_section('gce_delete', __('Delete Feed', GCE_TEXT_DOMAIN), 'gce_delete_main_text', 'delete_feed');
|
||||
//Unique ID //Title //Function //Page //Section ID
|
||||
add_settings_field('gce_delete_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_delete_id_field', 'delete_feed', 'gce_delete');
|
||||
add_settings_field('gce_delete_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_delete_title_field', 'delete_feed', 'gce_delete');
|
||||
|
||||
//Main text
|
||||
function gce_delete_main_text(){
|
||||
?>
|
||||
<p><?php _e('Are you want you want to delete this feed? (Remember to remove / adjust any widgets or shortcodes associated with this feed).', GCE_TEXT_DOMAIN); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
//ID
|
||||
function gce_delete_id_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="text" disabled="disabled" value="<?php echo $options['id']; ?>" size="3" />
|
||||
<input type="hidden" name="gce_options[id]" value="<?php echo $options['id']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Title
|
||||
function gce_delete_title_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="text" name="gce_options[title]" disabled="disabled" value="<?php echo $options['title']; ?>" size="50" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
389
src/wp-content/plugins/google-calendar-events/admin/edit.php
Normal file
@ -0,0 +1,389 @@
|
||||
<?php
|
||||
//Redirect to the main plugin options page if form has been submitted
|
||||
if(isset($_GET['action'])){
|
||||
if($_GET['action'] == 'edit' && isset($_GET['updated'])){
|
||||
wp_redirect(admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&updated=edited'));
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_section('gce_edit', __('Edit Feed', GCE_TEXT_DOMAIN), 'gce_edit_main_text', 'edit_feed');
|
||||
//Unique ID //Title //Function //Page //Section ID
|
||||
add_settings_field('gce_edit_id_field', __('Feed ID', GCE_TEXT_DOMAIN), 'gce_edit_id_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_title_field', __('Feed Title', GCE_TEXT_DOMAIN), 'gce_edit_title_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_url_field', __('Feed URL', GCE_TEXT_DOMAIN), 'gce_edit_url_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_retrieve_from_field', __('Retrieve events from', GCE_TEXT_DOMAIN), 'gce_edit_retrieve_from_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_retrieve_until_field', __('Retrieve events until', GCE_TEXT_DOMAIN), 'gce_edit_retrieve_until_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_max_events_field', __('Maximum number of events to retrieve', GCE_TEXT_DOMAIN), 'gce_edit_max_events_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_date_format_field', __('Date format', GCE_TEXT_DOMAIN), 'gce_edit_date_format_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_time_format_field', __('Time format', GCE_TEXT_DOMAIN), 'gce_edit_time_format_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_timezone_field', __('Timezone adjustment', GCE_TEXT_DOMAIN), 'gce_edit_timezone_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_cache_duration_field', __('Cache duration', GCE_TEXT_DOMAIN), 'gce_edit_cache_duration_field', 'edit_feed', 'gce_edit');
|
||||
add_settings_field('gce_edit_multiple_field', __('Show multiple day events on each day?', GCE_TEXT_DOMAIN), 'gce_edit_multiple_field', 'edit_feed', 'gce_edit');
|
||||
|
||||
add_settings_section('gce_edit_display', __('Display Options', GCE_TEXT_DOMAIN), 'gce_edit_display_main_text', 'edit_display');
|
||||
add_settings_field('gce_edit_use_builder_field', __('Select display customization method', GCE_TEXT_DOMAIN), 'gce_edit_use_builder_field', 'edit_display', 'gce_edit_display');
|
||||
|
||||
add_settings_section('gce_edit_builder', __('Event Display Builder'), 'gce_edit_builder_main_text', 'edit_builder');
|
||||
add_settings_field('gce_edit_builder_field', __('Event display builder HTML and shortcodes', GCE_TEXT_DOMAIN), 'gce_edit_builder_field', 'edit_builder', 'gce_edit_builder');
|
||||
|
||||
add_settings_section('gce_edit_simple_display', __('Simple Display Options'), 'gce_edit_simple_display_main_text', 'edit_simple_display');
|
||||
add_settings_field('gce_edit_display_start_field', __('Display start time / date?', GCE_TEXT_DOMAIN), 'gce_edit_display_start_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
add_settings_field('gce_edit_display_end_field', __('Display end time / date?', GCE_TEXT_DOMAIN), 'gce_edit_display_end_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
add_settings_field('gce_edit_display_separator_field', __('Separator text / characters', GCE_TEXT_DOMAIN), 'gce_edit_display_separator_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
add_settings_field('gce_edit_display_location_field', __('Display location?', GCE_TEXT_DOMAIN), 'gce_edit_display_location_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
add_settings_field('gce_edit_display_desc_field', __('Display description?', GCE_TEXT_DOMAIN), 'gce_edit_display_desc_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
add_settings_field('gce_edit_display_link_field', __('Display link to event?', GCE_TEXT_DOMAIN), 'gce_edit_display_link_field', 'edit_simple_display', 'gce_edit_simple_display');
|
||||
|
||||
//Main text
|
||||
function gce_edit_main_text(){
|
||||
?>
|
||||
<p><?php _e('Make any changes you require to the feed details below, then click the Save Changes button.', GCE_TEXT_DOMAIN); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
//ID
|
||||
function gce_edit_id_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="text" disabled="disabled" value="<?php echo $options['id']; ?>" size="3" />
|
||||
<input type="hidden" name="gce_options[id]" value="<?php echo $options['id']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Title
|
||||
function gce_edit_title_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('Anything you like. \'Upcoming Club Events\', for example.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[title]" value="<?php echo $options['title']; ?>" size="50" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//URL
|
||||
function gce_edit_url_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('This will probably be something like: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/full</code>.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<span class="description"><?php _e('or: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/private-d65741b037h695ff274247f90746b2ty/basic</code>.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[url]" value="<?php echo $options['url']; ?>" size="100" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Retrieve events from
|
||||
function gce_edit_retrieve_from_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('The point in time at which to start retrieving events. Use the text-box to specify an additional offset from you chosen start point. The offset should be provided in seconds (3600 = 1 hour, 86400 = 1 day) and can be negative. If you have selected the \'Specific date / time\' option, enter a <a href="http://www.timestampgenerator.com" target="_blank">UNIX timestamp</a> in the text-box.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[retrieve_from]">
|
||||
<option value="now"<?php selected($options['retrieve_from'], 'now'); ?>>Now</option>
|
||||
<option value="today"<?php selected($options['retrieve_from'], 'today'); ?>>00:00 today</option>
|
||||
<option value="week"<?php selected($options['retrieve_from'], 'week'); ?>>Start of current week</option>
|
||||
<option value="month-start"<?php selected($options['retrieve_from'], 'month-start'); ?>>Start of current month</option>
|
||||
<option value="month-end"<?php selected($options['retrieve_from'], 'month-end'); ?>>End of current month</option>
|
||||
<option value="any"<?php selected($options['retrieve_from'], 'any'); ?>>The beginning of time</option>
|
||||
<option value="date"<?php selected($options['retrieve_from'], 'date'); ?>>Specific date / time</option>
|
||||
</select>
|
||||
<input type="text" name="gce_options[retrieve_from_value]" value="<?php echo $options['retrieve_from_value']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Retrieve events until
|
||||
function gce_edit_retrieve_until_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('The point in time at which to stop retrieving events. The instructions for the above option also apply here.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[retrieve_until]">
|
||||
<option value="now"<?php selected($options['retrieve_until'], 'now'); ?>>Now</option>
|
||||
<option value="today"<?php selected($options['retrieve_until'], 'today'); ?>>00:00 today</option>
|
||||
<option value="week"<?php selected($options['retrieve_until'], 'week'); ?>>Start of current week</option>
|
||||
<option value="month-start"<?php selected($options['retrieve_until'], 'month-start'); ?>>Start of current month</option>
|
||||
<option value="month-end"<?php selected($options['retrieve_until'], 'month-end'); ?>>End of current month</option>
|
||||
<option value="any"<?php selected($options['retrieve_until'], 'any'); ?>>The end of time</option>
|
||||
<option value="date"<?php selected($options['retrieve_until'], 'date'); ?>>Specific date / time</option>
|
||||
|
||||
</select>
|
||||
<input type="text" name="gce_options[retrieve_until_value]" value="<?php echo $options['retrieve_until_value']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Max events
|
||||
function gce_edit_max_events_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('Set this to a few more than you actually want to display (due to caching and timezone issues). The exact number to display can be configured per shortcode / widget.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[max_events]" value="<?php echo $options['max_events']; ?>" size="3" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Date format
|
||||
function gce_edit_date_format_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('In <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a>. Leave this blank if you\'d rather stick with the default format for your blog.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[date_format]" value="<?php echo $options['date_format']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Time format
|
||||
function gce_edit_time_format_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('In <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a>. Again, leave this blank to stick with the default.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[time_format]" value="<?php echo $options['time_format']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Timezone offset
|
||||
function gce_edit_timezone_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
require_once 'timezone-choices.php';
|
||||
$timezone_list = gce_get_timezone_choices();
|
||||
//Set selected="selected" for selected timezone
|
||||
$timezone_list = str_replace(('<option value="' . $options['timezone'] . '"'), ('<option value="' . $options['timezone'] . '" selected="selected"'), $timezone_list);
|
||||
?>
|
||||
<span class="description"><?php _e('If you are having problems with dates and times displaying in the wrong timezone, select a city in your required timezone here.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<?php echo $timezone_list; ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Cache duration
|
||||
function gce_edit_cache_duration_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('The length of time, in seconds, to cache the feed (43200 = 12 hours). If this feed changes regularly, you may want to reduce the cache duration.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[cache_duration]" value="<?php echo $options['cache_duration']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Multiple day events
|
||||
function gce_edit_multiple_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('Show events that span multiple days on each day that they span, rather than just the first day.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_options[multiple_day]" value="true"<?php checked($options['multiple_day'], 'true'); ?> />
|
||||
<br /><br />
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
//Display options
|
||||
function gce_edit_display_main_text(){
|
||||
?>
|
||||
<p><?php _e('These settings control what information will be displayed for this feed in the tooltip (for grids), or in a list.', GCE_TEXT_DOMAIN); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_use_builder_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('It is recommended that you use the event display builder option, as it provides much more flexibility than the simple display options. The event display builder can do everything the simple display options can, plus lots more!', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[use_builder]">
|
||||
<option value="true"<?php selected($options['use_builder'], 'true'); ?>><?php _e('Event display builder', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="false"<?php selected($options['use_builder'], 'false'); ?>><?php _e('Simple display options', GCE_TEXT_DOMAIN); ?></option>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Event display builder
|
||||
function gce_edit_builder_main_text(){
|
||||
?>
|
||||
<p class="gce-event-builder"><?php _e('Use the event display builder to customize how event information will be displayed in the grid tooltips and in lists. Use HTML and the shortcodes (explained below) to display the information you require. A basic example display format is provided as a starting point. For more information, take a look at the <a href="http://www.rhanney.co.uk/plugins/google-calendar-events/event-display-builder" target="_blank">event display builder guide</a>.', GCE_TEXT_DOMAIN); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_builder_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<textarea name="gce_options[builder]" rows="10" cols="80"><?php echo $options['builder']; ?></textarea>
|
||||
<br />
|
||||
<p style="margin-top:20px;"><?php _e('(More information on all of the below shortcodes and attributes, and working examples, can be found in the <a href="http://www.rhanney.co.uk/plugins/google-calendar-events/event-display-builder" target="_blank">event display builder guide</a>)', GCE_TEXT_DOMAIN); ?></p>
|
||||
<h4><?php _e('Event information shortcodes:', GCE_TEXT_DOMAIN); ?></h4>
|
||||
<ul>
|
||||
<li><code>[event-title]</code><span class="description"> - <?php _e( 'The event title (possible attributes: <code>html</code>, <code>markdown</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-time]</code><span class="description"> - <?php _e( 'The event start time. Will use the time format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-date]</code><span class="description"> - <?php _e( 'The event start date. Will use the date format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-custom]</code><span class="description"> - <?php _e( 'The event start date / time. Will use the format specified in the <code>format</code> attribute (possible attributes: <code>format</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[start-human]</code><span class="description"> - <?php _e( 'The difference between the start time of the event and the time now, in human-readable format, such as \'1 hour\', \'4 days\', \'15 mins\' (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-time]</code><span class="description"> - <?php _e( 'The event end time. Will use the time format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-date]</code><span class="description"> - <?php _e( 'The event end date. Will use the date format specified in the above settings', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-custom]</code><span class="description"> - <?php _e( 'The event end date / time. Will use the format specified in the <code>format</code> attribute (possible attributes: <code>format</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[end-human]</code><span class="description"> - <?php _e( 'The difference between the end time of the event and the time now, in human-readable format (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[location]</code><span class="description"> - <?php _e( 'The event location (possible attributes: <code>html</code>, <code>markdown</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[maps-link]…[/maps-link]</code><span class="description"> - <?php _e( 'Anything between the opening and closing shortcode tags (inlcuding further shortcodes) will be linked to Google Maps, using the event location as a search parameter (possible attributes: <code>newwindow</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[description]</code><span class="description"> - <?php _e( 'The event description (possible attributes: <code>html</code>, <code>markdown</code>, <code>limit</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[link]…[/link]</code><span class="description"> - <?php _e( 'Anything between the opening and closing shortcode tags (inlcuding further shortcodes) will be linked to the Google Calendar page for the event (possible attributes: <code>newwindow</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[url]</code><span class="description"> - <?php _e( 'The raw URL to the Google Calendar page for the event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[length]</code><span class="description"> - <?php _e( 'The length of the event, in human-readable format (possible attributes: <code>precision</code>)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[event-num]</code><span class="description"> - <?php _e( 'The position of the event in the current list, or the position of the event in the current month (for grids)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[event-id]</code><span class="description"> - <?php _e( 'The event UID (a unique identifier assigned to the event by Google)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Feed information shortcodes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<ul>
|
||||
<li><code>[feed-title]</code><span class="description"> - <?php _e( 'The title of the feed from which the event comes', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[feed-id]</code><span class="description"> - <?php _e( 'The ID of the feed from which the event comes', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[cal-id]</code><span class="description"> - <?php _e( 'The calendar ID (a unique identifier assigned to the calendar by Google)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Conditional shortcodes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<p class="description" style="margin-bottom:18px;"><?php _e( 'Anything entered between the opening and closing tags of each of the following shortcodes will only be displayed if its condition (below) is met.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<ul>
|
||||
<li><code>[if-all-day]…[/if-all-day]</code><span class="description"> - <?php _e( 'The event is an all-day event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-all-day]…[/if-not-all-day]</code><span class="description"> - <?php _e( 'The event is not an all-day event', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-title]…[/if-title]</code><span class="description"> - <?php _e( 'The event has a title', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-description]…[/if-description]</code><span class="description"> - <?php _e( 'The event has a description', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-location]…[/if-location]</code><span class="description"> - <?php _e( 'The event has a location', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-tooltip]…[/if-tooltip]</code><span class="description"> - <?php _e( 'The event is to be displayed in a tooltip (not a list)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-list]…[/if-list]</code><span class="description"> - <?php _e( 'The event is to be displayed in a list (not a tooltip)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-now]…[/if-now]</code><span class="description"> - <?php _e( 'The event is taking place now (after the start time, but before the end time)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-now]…[/if-not-now]</code><span class="description"> - <?php _e( 'The event is not taking place now (may have ended or not yet started)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-started]…[/if-started]</code><span class="description"> - <?php _e( 'The event has started (even if it has also ended)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-started]…[/if-not-started]</code><span class="description"> - <?php _e( 'The event has not started', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-ended]…[/if-ended]</code><span class="description"> - <?php _e( 'The event has ended', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-ended]…[/if-not-ended]</code><span class="description"> - <?php _e( 'The event has not ended (even if it hasn\'t started)', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-first]…[/if-first]</code><span class="description"> - <?php _e( 'The event is the first of the day', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-not-first]…[/if-not-first]</code><span class="description"> - <?php _e( 'The event is not the first of the day', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-multi-day]…[/if-multi-day]</code><span class="description"> - <?php _e( 'The event spans multiple days', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>[if-single-day]…[/if-single-day]</code><span class="description"> - <?php _e( 'The event does not span multiple days', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<h4><?php _e( 'Attributes:', GCE_TEXT_DOMAIN ); ?></h4>
|
||||
<p class="description" style="margin-bottom:18px;"><?php _e( 'The possible attributes mentioned above are explained here:', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<ul>
|
||||
<li><code>html</code><span class="description"> - <?php _e( 'Whether or not to parse HTML that has been entered in the relevant field. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>markdown</code><span class="description"> - <?php _e( 'Whether or not to parse <a href="http://daringfireball.net/projects/markdown" target="_blank">Markdown</a> that has been entered in the relevant field. <a href="http://michelf.com/projects/php-markdown" target="_blank">PHP Markdown</a> must be installed for this to work. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>limit</code><span class="description"> - <?php _e( 'The word limit for the field. Should be specified as a positive integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>format</code><span class="description"> - <?php _e( 'The date / time format to use. Should specified as a <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date format</a> string', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>newwindow</code><span class="description"> - <?php _e( 'Whether or not the link should open in a new window / tab. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>precision</code><span class="description"> - <?php _e( 'How precise to be when displaying a time difference in human-readable format. Should be specified as a positive integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>offset</code><span class="description"> - <?php _e( 'An offset (in seconds) to apply to start / end times before display. Should be specified as a (positive or negative) integer', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
<li><code>autolink</code><span class="description"> - <?php _e( 'Whether or not to automatically convert URLs in the description to links. Can be <code>true</code> or <code>false</code>', GCE_TEXT_DOMAIN ); ?></span></li>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Simple display options
|
||||
function gce_edit_simple_display_main_text(){
|
||||
?>
|
||||
<p class="gce-simple-display-options"><?php _e('You can use some HTML in the text fields, but ensure it is valid or things might go wonky. Text fields can be empty too.', GCE_TEXT_DOMAIN); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_start_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('Select how to display the start date / time.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[display_start]">
|
||||
<option value="none"<?php selected($options['display_start'], 'none'); ?>><?php _e('Don\'t display start time or date', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="time"<?php selected($options['display_start'], 'time'); ?>><?php _e('Display start time', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="date"<?php selected($options['display_start'], 'date'); ?>><?php _e('Display start date', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="time-date"<?php selected($options['display_start'], 'time-date'); ?>><?php _e('Display start time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="date-time"<?php selected($options['display_start'], 'date-time'); ?>><?php _e('Display start date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
|
||||
</select>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('Text to display before the start time.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_start_text]" value="<?php echo $options['display_start_text']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_end_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('Select how to display the end date / time.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<select name="gce_options[display_end]">
|
||||
<option value="none"<?php selected($options['display_end'], 'none'); ?>><?php _e('Don\'t display end time or date', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="time"<?php selected($options['display_end'], 'time'); ?>><?php _e('Display end time', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="date"<?php selected($options['display_end'], 'date'); ?>><?php _e('Display end date', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="time-date"<?php selected($options['display_end'], 'time-date'); ?>><?php _e('Display end time and date (in that order)', GCE_TEXT_DOMAIN); ?></option>
|
||||
<option value="date-time"<?php selected($options['display_end'], 'date-time'); ?>><?php _e('Display end date and time (in that order)', GCE_TEXT_DOMAIN); ?></option>
|
||||
</select>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('Text to display before the end time.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_end_text]" value="<?php echo $options['display_end_text']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_separator_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<span class="description"><?php _e('If you have chosen to display both the time and date above, enter the text / characters to display between the time and date here (including any spaces).', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_separator]" value="<?php echo $options['display_separator']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_location_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_location]"<?php checked($options['display_location'], 'on'); ?> value="on" />
|
||||
<span class="description"><?php _e('Show the location of events?', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('Text to display before the location.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_location_text]" value="<?php echo stripslashes(esc_html($options['display_location_text'])); ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_desc_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_desc]"<?php checked($options['display_desc'], 'on'); ?> value="on" />
|
||||
<span class="description"><?php _e('Show the description of events? (URLs in the description will be made into links).', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('Text to display before the description.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_desc_text]" value="<?php echo stripslashes(esc_html($options['display_desc_text'])); ?>" />
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('Maximum number of words to show from description. Leave blank for no limit.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_desc_limit]" value="<?php echo $options['display_desc_limit']; ?>" size="3" />
|
||||
<?php
|
||||
}
|
||||
|
||||
function gce_edit_display_link_field(){
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="checkbox" name="gce_options[display_link]"<?php checked($options['display_link'], 'on'); ?> value="on" />
|
||||
<span class="description"><?php _e('Show a link to the Google Calendar page for an event?', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_options[display_link_target]"<?php checked($options['display_link_target'], 'on'); ?> value="on" />
|
||||
<span class="description"><?php _e('Links open in a new window / tab?', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br /><br />
|
||||
<span class="description"><?php _e('The link text to be displayed.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_options[display_link_text]" value="<?php echo stripslashes(esc_html($options['display_link_text'])); ?>" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
112
src/wp-content/plugins/google-calendar-events/admin/main.php
Normal file
@ -0,0 +1,112 @@
|
||||
<div class="wrap">
|
||||
<h3><?php _e('Add a New Feed', GCE_TEXT_DOMAIN); ?></h3>
|
||||
|
||||
<a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=add'); ?>" class="button-secondary" title="<?php _e('Click here to add a new feed', GCE_TEXT_DOMAIN); ?>"><?php _e('Add Feed', GCE_TEXT_DOMAIN); ?></a>
|
||||
|
||||
<br /><br />
|
||||
<h3><?php _e('Current Feeds', GCE_TEXT_DOMAIN); ?></h3>
|
||||
|
||||
<?php
|
||||
//Get saved feed options
|
||||
$options = get_option(GCE_OPTIONS_NAME);
|
||||
//If there are no saved feeds
|
||||
if(empty($options)){
|
||||
?>
|
||||
|
||||
<p><?php _e('You haven\'t added any Google Calendar feeds yet.', GCE_TEXT_DOMAIN); ?></p>
|
||||
|
||||
<?php //If there are saved feeds, display them ?>
|
||||
<?php }else{ ?>
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('ID', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"><?php _e('Title', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"><?php _e('URL', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('ID', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"><?php _e('Title', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"><?php _e('URL', GCE_TEXT_DOMAIN); ?></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($options as $key => $event){ ?>
|
||||
<tr>
|
||||
<td><?php echo $key; ?></td>
|
||||
<td><?php echo $event['title']; ?></td>
|
||||
<td><?php echo $event['url']; ?></td>
|
||||
<td align="right">
|
||||
<a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=refresh&id=' . $key); ?>"><?php _e('Refresh', GCE_TEXT_DOMAIN); ?></a> | <a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=edit&id=' . $key); ?>"><?php _e('Edit', GCE_TEXT_DOMAIN); ?></a> | <a href="<?php echo admin_url('options-general.php?page=' . GCE_PLUGIN_NAME . '.php&action=delete&id=' . $key); ?>"><?php _e('Delete', GCE_TEXT_DOMAIN); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<?php }
|
||||
//Get saved general options
|
||||
$options = get_option(GCE_GENERAL_OPTIONS_NAME);
|
||||
?>
|
||||
|
||||
<br />
|
||||
<h3><?php _e('General Options', GCE_TEXT_DOMAIN); ?></h3>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Custom stylesheet URL', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('If you want to alter the default plugin styling, create a new stylesheet on your server (not in the <code>google-calendar-events</code> directory) and then enter its URL below.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_general[stylesheet]" value="<?php echo $options['stylesheet']; ?>" size="100" />
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th scope="row"><?php _e('Add JavaScript to footer?', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('If you are having issues with tooltips not appearing or the AJAX functionality not working, try ticking the checkbox below.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_general[javascript]"<?php checked($options['javascript'], true); ?> value="on" />
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th scope="row"><?php _e('Loading text', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('Text to display while calendar data is loading (on AJAX requests).', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_general[loading]" value="<?php echo $options['loading']; ?>" />
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th scope="row"><?php _e('Error message', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('An error message to display to non-admin users if events cannot be displayed for any reason (admins will see a message indicating the cause of the problem).', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="text" name="gce_general[error]" value="<?php echo $options['error']; ?>" size="100" />
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th scope="row"><?php _e('Optimise event retrieval?', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('If this option is enabled, the plugin will use an experimental feature of the Google Data API, which can improve performance significantly, especially with large numbers of events. Google could potentially remove / change this feature at any time.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_general[fields]"<?php checked($options['fields'], true); ?> value="on" />
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th scope="row"><?php _e('Use old styles?', GCE_TEXT_DOMAIN); ?></th>
|
||||
<td>
|
||||
<span class="description"><?php _e('Some CSS changes were made in version 0.7. If this option is enabled, the old CSS will still be added along with the main stylesheet. You should consider updating your stylesheet so that you don\'t need this enabled.', GCE_TEXT_DOMAIN); ?></span>
|
||||
<br />
|
||||
<input type="checkbox" name="gce_general[old_stylesheet]"<?php checked($options['old_stylesheet'], true); ?> value="on" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save', GCE_TEXT_DOMAIN); ?>" />
|
||||
</div>
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
//Redirect to the main plugin options page if form has been submitted
|
||||
if ( isset( $_GET['action'] ) ) {
|
||||
if ( 'refresh' == $_GET['action'] && isset( $_GET['updated'] ) ) {
|
||||
wp_redirect( admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php&updated=refreshed' ) );
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_section( 'gce_refresh', __( 'Refresh Feed Cache', GCE_TEXT_DOMAIN ), 'gce_refresh_main_text', 'refresh_feed' );
|
||||
//Unique ID //Title //Function //Page //Section ID
|
||||
add_settings_field( 'gce_refresh_id_field', __( 'Feed ID', GCE_TEXT_DOMAIN ), 'gce_refresh_id_field', 'refresh_feed', 'gce_refresh' );
|
||||
add_settings_field( 'gce_refresh_title_field', __( 'Feed Title', GCE_TEXT_DOMAIN ), 'gce_refresh_title_field', 'refresh_feed', 'gce_refresh' );
|
||||
|
||||
//Main text
|
||||
function gce_refresh_main_text() {
|
||||
?>
|
||||
<p><?php _e( 'The plugin will automatically refresh the cache when it expires, but you can manually clear the cache now by clicking the button below.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<p><?php _e( 'Are you want you want to clear the cache data for this feed?', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
//ID
|
||||
function gce_refresh_id_field() {
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="text" disabled="disabled" value="<?php echo $options['id']; ?>" size="3" />
|
||||
<input type="hidden" name="gce_options[id]" value="<?php echo $options['id']; ?>" />
|
||||
<?php
|
||||
}
|
||||
|
||||
//Title
|
||||
function gce_refresh_title_field() {
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
$options = $options[$_GET['id']];
|
||||
?>
|
||||
<input type="text" name="gce_options[title]" disabled="disabled" value="<?php echo $options['title']; ?>" size="50" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,429 @@
|
||||
<?php
|
||||
function gce_get_timezone_choices(){
|
||||
return '
|
||||
<select name="gce_options[timezone]">
|
||||
<option value="default">Default</option>
|
||||
<optgroup label="Africa">
|
||||
<option value="Africa/Abidjan">Abidjan</option>
|
||||
<option value="Africa/Accra">Accra</option>
|
||||
<option value="Africa/Addis_Ababa">Addis Ababa</option>
|
||||
<option value="Africa/Algiers">Algiers</option>
|
||||
<option value="Africa/Asmara">Asmara</option>
|
||||
<option value="Africa/Bamako">Bamako</option>
|
||||
<option value="Africa/Bangui">Bangui</option>
|
||||
<option value="Africa/Banjul">Banjul</option>
|
||||
<option value="Africa/Bissau">Bissau</option>
|
||||
<option value="Africa/Blantyre">Blantyre</option>
|
||||
<option value="Africa/Brazzaville">Brazzaville</option>
|
||||
<option value="Africa/Bujumbura">Bujumbura</option>
|
||||
<option value="Africa/Cairo">Cairo</option>
|
||||
<option value="Africa/Casablanca">Casablanca</option>
|
||||
<option value="Africa/Ceuta">Ceuta</option>
|
||||
<option value="Africa/Conakry">Conakry</option>
|
||||
<option value="Africa/Dakar">Dakar</option>
|
||||
<option value="Africa/Dar_es_Salaam">Dar es Salaam</option>
|
||||
<option value="Africa/Djibouti">Djibouti</option>
|
||||
<option value="Africa/Douala">Douala</option>
|
||||
<option value="Africa/El_Aaiun">El Aaiun</option>
|
||||
<option value="Africa/Freetown">Freetown</option>
|
||||
<option value="Africa/Gaborone">Gaborone</option>
|
||||
<option value="Africa/Harare">Harare</option>
|
||||
<option value="Africa/Johannesburg">Johannesburg</option>
|
||||
<option value="Africa/Kampala">Kampala</option>
|
||||
<option value="Africa/Khartoum">Khartoum</option>
|
||||
<option value="Africa/Kigali">Kigali</option>
|
||||
<option value="Africa/Kinshasa">Kinshasa</option>
|
||||
<option value="Africa/Lagos">Lagos</option>
|
||||
<option value="Africa/Libreville">Libreville</option>
|
||||
<option value="Africa/Lome">Lome</option>
|
||||
<option value="Africa/Luanda">Luanda</option>
|
||||
<option value="Africa/Lubumbashi">Lubumbashi</option>
|
||||
<option value="Africa/Lusaka">Lusaka</option>
|
||||
<option value="Africa/Malabo">Malabo</option>
|
||||
<option value="Africa/Maputo">Maputo</option>
|
||||
<option value="Africa/Maseru">Maseru</option>
|
||||
<option value="Africa/Mbabane">Mbabane</option>
|
||||
<option value="Africa/Mogadishu">Mogadishu</option>
|
||||
<option value="Africa/Monrovia">Monrovia</option>
|
||||
<option value="Africa/Nairobi">Nairobi</option>
|
||||
<option value="Africa/Ndjamena">Ndjamena</option>
|
||||
<option value="Africa/Niamey">Niamey</option>
|
||||
<option value="Africa/Nouakchott">Nouakchott</option>
|
||||
<option value="Africa/Ouagadougou">Ouagadougou</option>
|
||||
<option value="Africa/Porto-Novo">Porto-Novo</option>
|
||||
<option value="Africa/Sao_Tome">Sao Tome</option>
|
||||
<option value="Africa/Tripoli">Tripoli</option>
|
||||
<option value="Africa/Tunis">Tunis</option>
|
||||
<option value="Africa/Windhoek">Windhoek</option>
|
||||
</optgroup>
|
||||
<optgroup label="America">
|
||||
<option value="America/Adak">Adak</option>
|
||||
<option value="America/Anchorage">Anchorage</option>
|
||||
<option value="America/Anguilla">Anguilla</option>
|
||||
<option value="America/Antigua">Antigua</option>
|
||||
<option value="America/Araguaina">Araguaina</option>
|
||||
<option value="America/Argentina/Buenos_Aires">Argentina - Buenos Aires</option>
|
||||
<option value="America/Argentina/Catamarca">Argentina - Catamarca</option>
|
||||
<option value="America/Argentina/Cordoba">Argentina - Cordoba</option>
|
||||
<option value="America/Argentina/Jujuy">Argentina - Jujuy</option>
|
||||
<option value="America/Argentina/La_Rioja">Argentina - La Rioja</option>
|
||||
<option value="America/Argentina/Mendoza">Argentina - Mendoza</option>
|
||||
<option value="America/Argentina/Rio_Gallegos">Argentina - Rio Gallegos</option>
|
||||
<option value="America/Argentina/Salta">Argentina - Salta</option>
|
||||
<option value="America/Argentina/San_Juan">Argentina - San Juan</option>
|
||||
<option value="America/Argentina/San_Luis">Argentina - San Luis</option>
|
||||
<option value="America/Argentina/Tucuman">Argentina - Tucuman</option>
|
||||
<option value="America/Argentina/Ushuaia">Argentina - Ushuaia</option>
|
||||
<option value="America/Aruba">Aruba</option>
|
||||
<option value="America/Asuncion">Asuncion</option>
|
||||
<option value="America/Atikokan">Atikokan</option>
|
||||
<option value="America/Bahia">Bahia</option>
|
||||
<option value="America/Barbados">Barbados</option>
|
||||
<option value="America/Belem">Belem</option>
|
||||
<option value="America/Belize">Belize</option>
|
||||
<option value="America/Blanc-Sablon">Blanc-Sablon</option>
|
||||
<option value="America/Boa_Vista">Boa Vista</option>
|
||||
<option value="America/Bogota">Bogota</option>
|
||||
<option value="America/Boise">Boise</option>
|
||||
<option value="America/Cambridge_Bay">Cambridge Bay</option>
|
||||
<option value="America/Campo_Grande">Campo Grande</option>
|
||||
<option value="America/Cancun">Cancun</option>
|
||||
<option value="America/Caracas">Caracas</option>
|
||||
<option value="America/Cayenne">Cayenne</option>
|
||||
<option value="America/Cayman">Cayman</option>
|
||||
<option value="America/Chicago">Chicago</option>
|
||||
<option value="America/Chihuahua">Chihuahua</option>
|
||||
<option value="America/Costa_Rica">Costa Rica</option>
|
||||
<option value="America/Cuiaba">Cuiaba</option>
|
||||
<option value="America/Curacao">Curacao</option>
|
||||
<option value="America/Danmarkshavn">Danmarkshavn</option>
|
||||
<option value="America/Dawson">Dawson</option>
|
||||
<option value="America/Dawson_Creek">Dawson Creek</option>
|
||||
<option value="America/Denver">Denver</option>
|
||||
<option value="America/Detroit">Detroit</option>
|
||||
<option value="America/Dominica">Dominica</option>
|
||||
<option value="America/Edmonton">Edmonton</option>
|
||||
<option value="America/Eirunepe">Eirunepe</option>
|
||||
<option value="America/El_Salvador">El Salvador</option>
|
||||
<option value="America/Fortaleza">Fortaleza</option>
|
||||
<option value="America/Glace_Bay">Glace Bay</option>
|
||||
<option value="America/Godthab">Godthab</option>
|
||||
<option value="America/Goose_Bay">Goose Bay</option>
|
||||
<option value="America/Grand_Turk">Grand Turk</option>
|
||||
<option value="America/Grenada">Grenada</option>
|
||||
<option value="America/Guadeloupe">Guadeloupe</option>
|
||||
<option value="America/Guatemala">Guatemala</option>
|
||||
<option value="America/Guayaquil">Guayaquil</option>
|
||||
<option value="America/Guyana">Guyana</option>
|
||||
<option value="America/Halifax">Halifax</option>
|
||||
<option value="America/Havana">Havana</option>
|
||||
<option value="America/Hermosillo">Hermosillo</option>
|
||||
<option value="America/Indiana/Indianapolis">Indiana - Indianapolis</option>
|
||||
<option value="America/Indiana/Knox">Indiana - Knox</option>
|
||||
<option value="America/Indiana/Marengo">Indiana - Marengo</option>
|
||||
<option value="America/Indiana/Petersburg">Indiana - Petersburg</option>
|
||||
<option value="America/Indiana/Tell_City">Indiana - Tell City</option>
|
||||
<option value="America/Indiana/Vevay">Indiana - Vevay</option>
|
||||
<option value="America/Indiana/Vincennes">Indiana - Vincennes</option>
|
||||
<option value="America/Indiana/Winamac">Indiana - Winamac</option>
|
||||
<option value="America/Inuvik">Inuvik</option>
|
||||
<option value="America/Iqaluit">Iqaluit</option>
|
||||
<option value="America/Jamaica">Jamaica</option>
|
||||
<option value="America/Juneau">Juneau</option>
|
||||
<option value="America/Kentucky/Louisville">Kentucky - Louisville</option>
|
||||
<option value="America/Kentucky/Monticello">Kentucky - Monticello</option>
|
||||
<option value="America/La_Paz">La Paz</option>
|
||||
<option value="America/Lima">Lima</option>
|
||||
<option value="America/Los_Angeles">Los Angeles</option>
|
||||
<option value="America/Maceio">Maceio</option>
|
||||
<option value="America/Managua">Managua</option>
|
||||
<option value="America/Manaus">Manaus</option>
|
||||
<option value="America/Marigot">Marigot</option>
|
||||
<option value="America/Martinique">Martinique</option>
|
||||
<option value="America/Mazatlan">Mazatlan</option>
|
||||
<option value="America/Menominee">Menominee</option>
|
||||
<option value="America/Merida">Merida</option>
|
||||
<option value="America/Mexico_City">Mexico City</option>
|
||||
<option value="America/Miquelon">Miquelon</option>
|
||||
<option value="America/Moncton">Moncton</option>
|
||||
<option value="America/Monterrey">Monterrey</option>
|
||||
<option value="America/Montevideo">Montevideo</option>
|
||||
<option value="America/Montreal">Montreal</option>
|
||||
<option value="America/Montserrat">Montserrat</option>
|
||||
<option value="America/Nassau">Nassau</option>
|
||||
<option value="America/New_York">New York</option>
|
||||
<option value="America/Nipigon">Nipigon</option>
|
||||
<option value="America/Nome">Nome</option>
|
||||
<option value="America/Noronha">Noronha</option>
|
||||
<option value="America/North_Dakota/Center">North Dakota - Center</option>
|
||||
<option value="America/North_Dakota/New_Salem">North Dakota - New Salem</option>
|
||||
<option value="America/Panama">Panama</option>
|
||||
<option value="America/Pangnirtung">Pangnirtung</option>
|
||||
<option value="America/Paramaribo">Paramaribo</option>
|
||||
<option value="America/Phoenix">Phoenix</option>
|
||||
<option value="America/Port-au-Prince">Port-au-Prince</option>
|
||||
<option value="America/Port_of_Spain">Port of Spain</option>
|
||||
<option value="America/Porto_Velho">Porto Velho</option>
|
||||
<option value="America/Puerto_Rico">Puerto Rico</option>
|
||||
<option value="America/Rainy_River">Rainy River</option>
|
||||
<option value="America/Rankin_Inlet">Rankin Inlet</option>
|
||||
<option value="America/Recife">Recife</option>
|
||||
<option value="America/Regina">Regina</option>
|
||||
<option value="America/Resolute">Resolute</option>
|
||||
<option value="America/Rio_Branco">Rio Branco</option>
|
||||
<option value="America/Santarem">Santarem</option>
|
||||
<option value="America/Santiago">Santiago</option>
|
||||
<option value="America/Santo_Domingo">Santo Domingo</option>
|
||||
<option value="America/Sao_Paulo">Sao Paulo</option>
|
||||
<option value="America/Scoresbysund">Scoresbysund</option>
|
||||
<option value="America/Shiprock">Shiprock</option>
|
||||
<option value="America/St_Barthelemy">St Barthelemy</option>
|
||||
<option value="America/St_Johns">St Johns</option>
|
||||
<option value="America/St_Kitts">St Kitts</option>
|
||||
<option value="America/St_Lucia">St Lucia</option>
|
||||
<option value="America/St_Thomas">St Thomas</option>
|
||||
<option value="America/St_Vincent">St Vincent</option>
|
||||
<option value="America/Swift_Current">Swift Current</option>
|
||||
<option value="America/Tegucigalpa">Tegucigalpa</option>
|
||||
<option value="America/Thule">Thule</option>
|
||||
<option value="America/Thunder_Bay">Thunder Bay</option>
|
||||
<option value="America/Tijuana">Tijuana</option>
|
||||
<option value="America/Toronto">Toronto</option>
|
||||
<option value="America/Tortola">Tortola</option>
|
||||
<option value="America/Vancouver">Vancouver</option>
|
||||
<option value="America/Whitehorse">Whitehorse</option>
|
||||
<option value="America/Winnipeg">Winnipeg</option>
|
||||
<option value="America/Yakutat">Yakutat</option>
|
||||
<option value="America/Yellowknife">Yellowknife</option>
|
||||
</optgroup>
|
||||
<optgroup label="Antarctica">
|
||||
<option value="Antarctica/Casey">Casey</option>
|
||||
<option value="Antarctica/Davis">Davis</option>
|
||||
<option value="Antarctica/DumontDUrville">DumontDUrville</option>
|
||||
<option value="Antarctica/Mawson">Mawson</option>
|
||||
<option value="Antarctica/McMurdo">McMurdo</option>
|
||||
<option value="Antarctica/Palmer">Palmer</option>
|
||||
<option value="Antarctica/Rothera">Rothera</option>
|
||||
<option value="Antarctica/South_Pole">South Pole</option>
|
||||
<option value="Antarctica/Syowa">Syowa</option>
|
||||
<option value="Antarctica/Vostok">Vostok</option>
|
||||
</optgroup>
|
||||
<optgroup label="Arctic">
|
||||
<option value="Arctic/Longyearbyen">Longyearbyen</option>
|
||||
</optgroup>
|
||||
<optgroup label="Asia">
|
||||
<option value="Asia/Aden">Aden</option>
|
||||
<option value="Asia/Almaty">Almaty</option>
|
||||
<option value="Asia/Amman">Amman</option>
|
||||
<option value="Asia/Anadyr">Anadyr</option>
|
||||
<option value="Asia/Aqtau">Aqtau</option>
|
||||
<option value="Asia/Aqtobe">Aqtobe</option>
|
||||
<option value="Asia/Ashgabat">Ashgabat</option>
|
||||
<option value="Asia/Baghdad">Baghdad</option>
|
||||
<option value="Asia/Bahrain">Bahrain</option>
|
||||
<option value="Asia/Baku">Baku</option>
|
||||
<option value="Asia/Bangkok">Bangkok</option>
|
||||
<option value="Asia/Beirut">Beirut</option>
|
||||
<option value="Asia/Bishkek">Bishkek</option>
|
||||
<option value="Asia/Brunei">Brunei</option>
|
||||
<option value="Asia/Choibalsan">Choibalsan</option>
|
||||
<option value="Asia/Chongqing">Chongqing</option>
|
||||
<option value="Asia/Colombo">Colombo</option>
|
||||
<option value="Asia/Damascus">Damascus</option>
|
||||
<option value="Asia/Dhaka">Dhaka</option>
|
||||
<option value="Asia/Dili">Dili</option>
|
||||
<option value="Asia/Dubai">Dubai</option>
|
||||
<option value="Asia/Dushanbe">Dushanbe</option>
|
||||
<option value="Asia/Gaza">Gaza</option>
|
||||
<option value="Asia/Harbin">Harbin</option>
|
||||
<option value="Asia/Ho_Chi_Minh">Ho Chi Minh</option>
|
||||
<option value="Asia/Hong_Kong">Hong Kong</option>
|
||||
<option value="Asia/Hovd">Hovd</option>
|
||||
<option value="Asia/Irkutsk">Irkutsk</option>
|
||||
<option value="Asia/Jakarta">Jakarta</option>
|
||||
<option value="Asia/Jayapura">Jayapura</option>
|
||||
<option value="Asia/Jerusalem">Jerusalem</option>
|
||||
<option value="Asia/Kabul">Kabul</option>
|
||||
<option value="Asia/Kamchatka">Kamchatka</option>
|
||||
<option value="Asia/Karachi">Karachi</option>
|
||||
<option value="Asia/Kashgar">Kashgar</option>
|
||||
<option value="Asia/Kathmandu">Kathmandu</option>
|
||||
<option value="Asia/Kolkata">Kolkata</option>
|
||||
<option value="Asia/Krasnoyarsk">Krasnoyarsk</option>
|
||||
<option value="Asia/Kuala_Lumpur">Kuala Lumpur</option>
|
||||
<option value="Asia/Kuching">Kuching</option>
|
||||
<option value="Asia/Kuwait">Kuwait</option>
|
||||
<option value="Asia/Macau">Macau</option>
|
||||
<option value="Asia/Magadan">Magadan</option>
|
||||
<option value="Asia/Makassar">Makassar</option>
|
||||
<option value="Asia/Manila">Manila</option>
|
||||
<option value="Asia/Muscat">Muscat</option>
|
||||
<option value="Asia/Nicosia">Nicosia</option>
|
||||
<option value="Asia/Novosibirsk">Novosibirsk</option>
|
||||
<option value="Asia/Omsk">Omsk</option>
|
||||
<option value="Asia/Oral">Oral</option>
|
||||
<option value="Asia/Phnom_Penh">Phnom Penh</option>
|
||||
<option value="Asia/Pontianak">Pontianak</option>
|
||||
<option value="Asia/Pyongyang">Pyongyang</option>
|
||||
<option value="Asia/Qatar">Qatar</option>
|
||||
<option value="Asia/Qyzylorda">Qyzylorda</option>
|
||||
<option value="Asia/Rangoon">Rangoon</option>
|
||||
<option value="Asia/Riyadh">Riyadh</option>
|
||||
<option value="Asia/Sakhalin">Sakhalin</option>
|
||||
<option value="Asia/Samarkand">Samarkand</option>
|
||||
<option value="Asia/Seoul">Seoul</option>
|
||||
<option value="Asia/Shanghai">Shanghai</option>
|
||||
<option value="Asia/Singapore">Singapore</option>
|
||||
<option value="Asia/Taipei">Taipei</option>
|
||||
<option value="Asia/Tashkent">Tashkent</option>
|
||||
<option value="Asia/Tbilisi">Tbilisi</option>
|
||||
<option value="Asia/Tehran">Tehran</option>
|
||||
<option value="Asia/Thimphu">Thimphu</option>
|
||||
<option value="Asia/Tokyo">Tokyo</option>
|
||||
<option value="Asia/Ulaanbaatar">Ulaanbaatar</option>
|
||||
<option value="Asia/Urumqi">Urumqi</option>
|
||||
<option value="Asia/Vientiane">Vientiane</option>
|
||||
<option value="Asia/Vladivostok">Vladivostok</option>
|
||||
<option value="Asia/Yakutsk">Yakutsk</option>
|
||||
<option value="Asia/Yekaterinburg">Yekaterinburg</option>
|
||||
<option value="Asia/Yerevan">Yerevan</option>
|
||||
</optgroup>
|
||||
<optgroup label="Atlantic">
|
||||
<option value="Atlantic/Azores">Azores</option>
|
||||
<option value="Atlantic/Bermuda">Bermuda</option>
|
||||
<option value="Atlantic/Canary">Canary</option>
|
||||
<option value="Atlantic/Cape_Verde">Cape Verde</option>
|
||||
<option value="Atlantic/Faroe">Faroe</option>
|
||||
<option value="Atlantic/Madeira">Madeira</option>
|
||||
<option value="Atlantic/Reykjavik">Reykjavik</option>
|
||||
<option value="Atlantic/South_Georgia">South Georgia</option>
|
||||
<option value="Atlantic/Stanley">Stanley</option>
|
||||
<option value="Atlantic/St_Helena">St Helena</option>
|
||||
</optgroup>
|
||||
<optgroup label="Australia">
|
||||
<option value="Australia/Adelaide">Adelaide</option>
|
||||
<option value="Australia/Brisbane">Brisbane</option>
|
||||
<option value="Australia/Broken_Hill">Broken Hill</option>
|
||||
<option value="Australia/Currie">Currie</option>
|
||||
<option value="Australia/Darwin">Darwin</option>
|
||||
<option value="Australia/Eucla">Eucla</option>
|
||||
<option value="Australia/Hobart">Hobart</option>
|
||||
<option value="Australia/Lindeman">Lindeman</option>
|
||||
<option value="Australia/Lord_Howe">Lord Howe</option>
|
||||
<option value="Australia/Melbourne">Melbourne</option>
|
||||
<option value="Australia/Perth">Perth</option>
|
||||
<option value="Australia/Sydney">Sydney</option>
|
||||
</optgroup>
|
||||
<optgroup label="Europe">
|
||||
<option value="Europe/Amsterdam">Amsterdam</option>
|
||||
<option value="Europe/Andorra">Andorra</option>
|
||||
<option value="Europe/Athens">Athens</option>
|
||||
<option value="Europe/Belgrade">Belgrade</option>
|
||||
<option value="Europe/Berlin">Berlin</option>
|
||||
<option value="Europe/Bratislava">Bratislava</option>
|
||||
<option value="Europe/Brussels">Brussels</option>
|
||||
<option value="Europe/Bucharest">Bucharest</option>
|
||||
<option value="Europe/Budapest">Budapest</option>
|
||||
<option value="Europe/Chisinau">Chisinau</option>
|
||||
<option value="Europe/Copenhagen">Copenhagen</option>
|
||||
<option value="Europe/Dublin">Dublin</option>
|
||||
<option value="Europe/Gibraltar">Gibraltar</option>
|
||||
<option value="Europe/Guernsey">Guernsey</option>
|
||||
<option value="Europe/Helsinki">Helsinki</option>
|
||||
<option value="Europe/Isle_of_Man">Isle of Man</option>
|
||||
<option value="Europe/Istanbul">Istanbul</option>
|
||||
<option value="Europe/Jersey">Jersey</option>
|
||||
<option value="Europe/Kaliningrad">Kaliningrad</option>
|
||||
<option value="Europe/Kiev">Kiev</option>
|
||||
<option value="Europe/Lisbon">Lisbon</option>
|
||||
<option value="Europe/Ljubljana">Ljubljana</option>
|
||||
<option value="Europe/London">London</option>
|
||||
<option value="Europe/Luxembourg">Luxembourg</option>
|
||||
<option value="Europe/Madrid">Madrid</option>
|
||||
<option value="Europe/Malta">Malta</option>
|
||||
<option value="Europe/Mariehamn">Mariehamn</option>
|
||||
<option value="Europe/Minsk">Minsk</option>
|
||||
<option value="Europe/Monaco">Monaco</option>
|
||||
<option value="Europe/Moscow">Moscow</option>
|
||||
<option value="Europe/Oslo">Oslo</option>
|
||||
<option value="Europe/Paris">Paris</option>
|
||||
<option value="Europe/Podgorica">Podgorica</option>
|
||||
<option value="Europe/Prague">Prague</option>
|
||||
<option value="Europe/Riga">Riga</option>
|
||||
<option value="Europe/Rome">Rome</option>
|
||||
<option value="Europe/Samara">Samara</option>
|
||||
<option value="Europe/San_Marino">San Marino</option>
|
||||
<option value="Europe/Sarajevo">Sarajevo</option>
|
||||
<option value="Europe/Simferopol">Simferopol</option>
|
||||
<option value="Europe/Skopje">Skopje</option>
|
||||
<option value="Europe/Sofia">Sofia</option>
|
||||
<option value="Europe/Stockholm">Stockholm</option>
|
||||
<option value="Europe/Tallinn">Tallinn</option>
|
||||
<option value="Europe/Tirane">Tirane</option>
|
||||
<option value="Europe/Uzhgorod">Uzhgorod</option>
|
||||
<option value="Europe/Vaduz">Vaduz</option>
|
||||
<option value="Europe/Vatican">Vatican</option>
|
||||
<option value="Europe/Vienna">Vienna</option>
|
||||
<option value="Europe/Vilnius">Vilnius</option>
|
||||
<option value="Europe/Volgograd">Volgograd</option>
|
||||
<option value="Europe/Warsaw">Warsaw</option>
|
||||
<option value="Europe/Zagreb">Zagreb</option>
|
||||
<option value="Europe/Zaporozhye">Zaporozhye</option>
|
||||
<option value="Europe/Zurich">Zurich</option>
|
||||
</optgroup>
|
||||
<optgroup label="Indian">
|
||||
<option value="Indian/Antananarivo">Antananarivo</option>
|
||||
<option value="Indian/Chagos">Chagos</option>
|
||||
<option value="Indian/Christmas">Christmas</option>
|
||||
<option value="Indian/Cocos">Cocos</option>
|
||||
<option value="Indian/Comoro">Comoro</option>
|
||||
<option value="Indian/Kerguelen">Kerguelen</option>
|
||||
<option value="Indian/Mahe">Mahe</option>
|
||||
<option value="Indian/Maldives">Maldives</option>
|
||||
<option value="Indian/Mauritius">Mauritius</option>
|
||||
<option value="Indian/Mayotte">Mayotte</option>
|
||||
<option value="Indian/Reunion">Reunion</option>
|
||||
</optgroup>
|
||||
<optgroup label="Pacific">
|
||||
<option value="Pacific/Apia">Apia</option>
|
||||
<option value="Pacific/Auckland">Auckland</option>
|
||||
<option value="Pacific/Chatham">Chatham</option>
|
||||
<option value="Pacific/Easter">Easter</option>
|
||||
<option value="Pacific/Efate">Efate</option>
|
||||
<option value="Pacific/Enderbury">Enderbury</option>
|
||||
<option value="Pacific/Fakaofo">Fakaofo</option>
|
||||
<option value="Pacific/Fiji">Fiji</option>
|
||||
<option value="Pacific/Funafuti">Funafuti</option>
|
||||
<option value="Pacific/Galapagos">Galapagos</option>
|
||||
<option value="Pacific/Gambier">Gambier</option>
|
||||
<option value="Pacific/Guadalcanal">Guadalcanal</option>
|
||||
<option value="Pacific/Guam">Guam</option>
|
||||
<option value="Pacific/Honolulu">Honolulu</option>
|
||||
<option value="Pacific/Johnston">Johnston</option>
|
||||
<option value="Pacific/Kiritimati">Kiritimati</option>
|
||||
<option value="Pacific/Kosrae">Kosrae</option>
|
||||
<option value="Pacific/Kwajalein">Kwajalein</option>
|
||||
<option value="Pacific/Majuro">Majuro</option>
|
||||
<option value="Pacific/Marquesas">Marquesas</option>
|
||||
<option value="Pacific/Midway">Midway</option>
|
||||
<option value="Pacific/Nauru">Nauru</option>
|
||||
<option value="Pacific/Niue">Niue</option>
|
||||
<option value="Pacific/Norfolk">Norfolk</option>
|
||||
<option value="Pacific/Noumea">Noumea</option>
|
||||
<option value="Pacific/Pago_Pago">Pago Pago</option>
|
||||
<option value="Pacific/Palau">Palau</option>
|
||||
<option value="Pacific/Pitcairn">Pitcairn</option>
|
||||
<option value="Pacific/Ponape">Ponape</option>
|
||||
<option value="Pacific/Port_Moresby">Port Moresby</option>
|
||||
<option value="Pacific/Rarotonga">Rarotonga</option>
|
||||
<option value="Pacific/Saipan">Saipan</option>
|
||||
<option value="Pacific/Tahiti">Tahiti</option>
|
||||
<option value="Pacific/Tarawa">Tarawa</option>
|
||||
<option value="Pacific/Tongatapu">Tongatapu</option>
|
||||
<option value="Pacific/Truk">Truk</option>
|
||||
<option value="Pacific/Wake">Wake</option>
|
||||
<option value="Pacific/Wallis">Wallis</option>
|
||||
</optgroup>
|
||||
</select>';
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,28 @@
|
||||
.gce-page-grid .gce-calendar th{
|
||||
padding:0 !important;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar th abbr,
|
||||
.gce-widget-grid .gce-calendar th abbr{
|
||||
border-bottom:none !important;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list p{
|
||||
margin:0 !important;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list ul,
|
||||
.gce-widget-list .gce-list ul{
|
||||
margin:0 !important;
|
||||
padding:0 !important;
|
||||
}
|
||||
|
||||
.gce-event-info .gce-tooltip-title{
|
||||
margin:5px !important;
|
||||
}
|
||||
|
||||
.gce-event-info ul{
|
||||
padding:0 !important;
|
||||
margin:5px !important;
|
||||
list-style-type:none !important;
|
||||
}
|
||||
203
src/wp-content/plugins/google-calendar-events/css/gce-style.css
Normal file
@ -0,0 +1,203 @@
|
||||
/* PAGE GRID */
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-caption{ /* Caption at top of calendar */
|
||||
color:#333333;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar{ /* Main calendar table */
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
border:1px solid #CCCCCC;
|
||||
color:#CCCCCC;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar th{ /* Day headings (S, M etc.) */
|
||||
border:1px solid #CCCCCC;
|
||||
text-align:center;
|
||||
width:14.29%;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar td{ /* Day table cells */
|
||||
border:1px solid #CCCCCC;
|
||||
text-align:center;
|
||||
height:80px;
|
||||
vertical-align:middle;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-has-events{ /* Table cells with events */
|
||||
color:#333333;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-event-info{ /* Event information */
|
||||
display:none; /* Important! */
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-day-number{ /* Day number span */
|
||||
font-size:2em;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-today{ /* Table cell that represents today */
|
||||
background-color:#DDDDDD;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-next,
|
||||
.gce-page-grid .gce-calendar .gce-prev{ /* Previous and next month links */
|
||||
cursor:pointer;
|
||||
display:inline-block;
|
||||
width:3%;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar .gce-month-title{ /* Month title */
|
||||
display:inline-block;
|
||||
width:90%;
|
||||
}
|
||||
|
||||
.gce-page-grid .gce-calendar th abbr{ /* Day letter abbreviation */
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
/* PAGE LIST */
|
||||
|
||||
.gce-page-list .gce-list p{ /* Each piece of information in the list */
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list p span,
|
||||
.gce-page-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */
|
||||
color:#999999;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list .gce-list-event{ /* The event title */
|
||||
background-color:#DDDDDD;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list .gce-list-title{ /* The title (not the same as event title) */
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.gce-page-list .gce-list ul{
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
/* WIDGET GRID */
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-caption{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar{ /* Main calendar table */
|
||||
width:100%;
|
||||
border:1px solid #CCCCCC;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar th{ /* Day headings (S, M etc.) */
|
||||
width:14.29%;
|
||||
border:1px solid #CCCCCC;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar td{ /* Day table cells */
|
||||
color:#CCCCCC;
|
||||
width:14.29%;
|
||||
border:1px solid #CCCCCC;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-has-events{ /* Table cells with events */
|
||||
cursor:pointer;
|
||||
color:#666666;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-today{ /* Table cell that represents today */
|
||||
background-color:#DDDDDD;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-event-info{ /* Event information */
|
||||
display:none; /* Important! */
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-next,
|
||||
.gce-widget-grid .gce-calendar .gce-prev{ /* Prev and next month links */
|
||||
cursor:pointer;
|
||||
display:inline-block;
|
||||
width:5%;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar .gce-month-title{ /* Month title in caption at top of table */
|
||||
display:inline-block;
|
||||
width:80%;
|
||||
}
|
||||
|
||||
.gce-widget-grid .gce-calendar th abbr{ /* Day name abbreviations */
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
/* WIDGET LIST */
|
||||
|
||||
.gce-widget-list .gce-list p{ /* Each piece of information in the list */
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.gce-widget-list .gce-list p span,
|
||||
.gce-widget-list .gce-list div span{ /* The text displayed before each piece of info, 'Starts:' for example */
|
||||
color:#999999;
|
||||
}
|
||||
|
||||
.gce-widget-list .gce-list .gce-list-event{ /* The event title */
|
||||
background-color:#DDDDDD;
|
||||
}
|
||||
|
||||
.gce-widget-list .gce-list .gce-list-title{ /* The title (not the same as event title) */
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.gce-widget-list .gce-list ul{
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
/* TOOLTIP */
|
||||
|
||||
.gce-event-info{ /* Tooltip container */
|
||||
background-color:#FFFFFF;
|
||||
border:1px solid #333333;
|
||||
max-width:300px;
|
||||
}
|
||||
|
||||
.gce-event-info .gce-tooltip-title{ /* 'Events on...' text */
|
||||
margin:5px;
|
||||
font-weight:bold;
|
||||
font-size:1.2em;
|
||||
}
|
||||
|
||||
.gce-event-info ul{ /* Events list */
|
||||
padding:0;
|
||||
margin:5px;
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
.gce-event-info ul li{ /* Event list item */
|
||||
margin:10px 0 0 0;
|
||||
}
|
||||
|
||||
.gce-event-info ul li p{ /* Each piece of information */
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.gce-event-info ul li p span,
|
||||
.gce-event-info ul li div span{ /* The text displayed before each piece of info, 'Starts:' for example */
|
||||
color:#999999;
|
||||
}
|
||||
|
||||
.gce-event-info .gce-tooltip-event{ /* The event title */
|
||||
background-color:#DDDDDD;
|
||||
font-weight:bold;
|
||||
}
|
||||
@ -0,0 +1,689 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Google Calendar Events
|
||||
Plugin URI: http://www.rhanney.co.uk/plugins/google-calendar-events
|
||||
Description: Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
|
||||
Version: 0.7
|
||||
Author: Ross Hanney
|
||||
Author URI: http://www.rhanney.co.uk
|
||||
License: GPL2
|
||||
|
||||
---
|
||||
|
||||
Copyright 2010 Ross Hanney (email: rosshanney@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
---
|
||||
|
||||
Contains code inspired by and adapted from GCalendar - http://g4j.laoneo.net/content/extensions/download/cat_view/2-simplepie-gcalendar.html
|
||||
|
||||
GCalendar: Copyright 2007-2009 Allon Moritz
|
||||
*/
|
||||
|
||||
define( 'GCE_PLUGIN_NAME', str_replace( '.php', '', basename( __FILE__ ) ) );
|
||||
define( 'GCE_TEXT_DOMAIN', 'google-calendar-events' );
|
||||
define( 'GCE_OPTIONS_NAME', 'gce_options' );
|
||||
define( 'GCE_GENERAL_OPTIONS_NAME', 'gce_general' );
|
||||
define( 'GCE_VERSION', 0.7 );
|
||||
|
||||
if ( ! class_exists( 'Google_Calendar_Events' ) ) {
|
||||
class Google_Calendar_Events {
|
||||
function __construct() {
|
||||
register_activation_hook( __FILE__, array( $this, 'activate_plugin' ) );
|
||||
add_action( 'init', array( $this, 'init_plugin' ) );
|
||||
add_action( 'wp_ajax_gce_ajax', array( $this, 'gce_ajax' ) );
|
||||
add_action( 'wp_ajax_nopriv_gce_ajax', array( $this, 'gce_ajax' ) );
|
||||
add_action( 'widgets_init', array( $this, 'add_widget' ) );
|
||||
|
||||
//No point doing any of this if currently processing an AJAX request
|
||||
if ( ! defined( 'DOING_AJAX' ) || !DOING_AJAX ) {
|
||||
add_action( 'admin_menu', array( $this, 'setup_admin' ) );
|
||||
add_action( 'admin_init', array( $this, 'init_admin' ) );
|
||||
add_action( 'wp_print_styles', array( $this, 'add_styles' ) );
|
||||
add_action( 'wp_print_scripts', array( $this, 'add_scripts' ) );
|
||||
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
|
||||
add_shortcode( 'google-calendar-events', array( $this, 'shortcode_handler' ) );
|
||||
}
|
||||
}
|
||||
|
||||
//PHP 5.2 is required (json_decode), so if PHP version is lower then 5.2, display an error message and deactivate the plugin
|
||||
function activate_plugin(){
|
||||
if( version_compare( PHP_VERSION, '5.2', '<' ) ) {
|
||||
if( is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ) {
|
||||
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
||||
deactivate_plugins( basename( __FILE__ ) );
|
||||
wp_die( 'Google Calendar Events requires the server on which your site resides to be running PHP 5.2 or higher. As of version 3.2, WordPress itself will also <a href="http://wordpress.org/news/2010/07/eol-for-php4-and-mysql4">have this requirement</a>. You should get in touch with your web hosting provider and ask them to update PHP.<br /><br /><a href="' . admin_url( 'plugins.php' ) . '">Back to Plugins</a>' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If any new options have been added between versions, this will update any saved feeds with defaults for new options (shouldn't overwrite anything saved)
|
||||
function update_settings() {
|
||||
//If there are some plugin options in the database, but no version info, then this must be an upgrade from version 0.5 or below, so add flag that will provide user with option to clear old transients
|
||||
if ( get_option( GCE_OPTIONS_NAME ) && ! get_option( 'gce_version' ) )
|
||||
add_option( 'gce_clear_old_transients', true );
|
||||
|
||||
add_option( 'gce_version', GCE_VERSION );
|
||||
|
||||
add_option( GCE_OPTIONS_NAME );
|
||||
add_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
|
||||
//Get feed options
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
if ( ! empty( $options ) ) {
|
||||
foreach ( $options as $key => $saved_feed_options ) {
|
||||
$defaults = array(
|
||||
'id' => 1,
|
||||
'title' => '',
|
||||
'url' => '',
|
||||
'retrieve_from' => 'today',
|
||||
'retrieve_from_value' => 0,
|
||||
'retrieve_until' => 'any',
|
||||
'retrieve_until_value' => 0,
|
||||
'max_events' => 25,
|
||||
'date_format' => '',
|
||||
'time_format' => '',
|
||||
'timezone' => 'default',
|
||||
'cache_duration' => 43200,
|
||||
'multiple_day' => 'false',
|
||||
'display_start' => 'time',
|
||||
'display_end' => 'time-date',
|
||||
'display_location' => '',
|
||||
'display_desc' => '',
|
||||
'display_link' => 'on',
|
||||
'display_start_text' => 'Starts:',
|
||||
'display_end_text' => 'Ends:',
|
||||
'display_location_text' => 'Location:',
|
||||
'display_desc_text' => 'Description:',
|
||||
'display_desc_limit' => '',
|
||||
'display_link_text' => 'More details',
|
||||
'display_link_target' => '',
|
||||
'display_separator' => ', ',
|
||||
'use_builder' => 'false',
|
||||
'builder' => ''
|
||||
);
|
||||
|
||||
//If necessary, copy saved behaviour of old show_past_events and day_limit options into the new from / until options
|
||||
if ( isset( $saved_feed_options['show_past_events'] ) ) {
|
||||
if ( 'true' == $saved_feed_options['show_past_events'] ) {
|
||||
$saved_feed_options['retrieve_from'] = 'month-start';
|
||||
} else {
|
||||
$saved_feed_options['retrieve_from'] = 'today';
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $saved_feed_options['day_limit'] ) && '' != $saved_feed_options['day_limit'] ) {
|
||||
$saved_feed_options['retrieve_until'] = 'today';
|
||||
$saved_feed_options['retrieve_until_value'] = (int) $saved_feed_options['day_limit'] * 86400;
|
||||
}
|
||||
|
||||
//Update old display_start / display_end values
|
||||
if ( ! isset( $saved_feed_options['display_start'] ) )
|
||||
$saved_feed_options['display_start'] = 'none';
|
||||
elseif ( 'on' == $saved_feed_options['display_start'] )
|
||||
$saved_feed_options['display_start'] = 'time';
|
||||
|
||||
if( ! isset( $saved_feed_options['display_end'] ) )
|
||||
$saved_feed_options['display_end'] = 'none';
|
||||
elseif ( 'on' == $saved_feed_options['display_end'] )
|
||||
$saved_feed_options['display_end'] = 'time-date';
|
||||
|
||||
//Merge saved options with defaults
|
||||
foreach ( $saved_feed_options as $option_name => $option ) {
|
||||
$defaults[$option_name] = $saved_feed_options[$option_name];
|
||||
}
|
||||
|
||||
$options[$key] = $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
//Save feed options
|
||||
update_option( GCE_OPTIONS_NAME, $options );
|
||||
|
||||
//Get general options
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
|
||||
$defaults = array(
|
||||
'stylesheet' => '',
|
||||
'javascript' => false,
|
||||
'loading' => 'Loading...',
|
||||
'error' => 'Events cannot currently be displayed, sorry! Please check back later.',
|
||||
'fields' => true,
|
||||
'old_stylesheet' => false
|
||||
);
|
||||
|
||||
$old_stylesheet_option = get_option( 'gce_stylesheet' );
|
||||
|
||||
//If old custom stylesheet option was set, add it to general options, then delete old option
|
||||
if( false !== $old_stylesheet_option ) {
|
||||
$defaults['stylesheet'] = $old_stylesheet_option;
|
||||
delete_option( 'gce_stylesheet' );
|
||||
} elseif ( isset($options['stylesheet'] ) ) {
|
||||
$defaults['stylesheet'] = $options['stylesheet'];
|
||||
}
|
||||
|
||||
if ( isset($options['javascript'] ) )
|
||||
$defaults['javascript'] = $options['javascript'];
|
||||
|
||||
if ( isset( $options['loading'] ) )
|
||||
$defaults['loading'] = $options['loading'];
|
||||
|
||||
if ( isset($options['error'] ) )
|
||||
$defaults['error'] = $options['error'];
|
||||
|
||||
if ( isset($options['fields'] ) )
|
||||
$defaults['fields'] = $options['fields'];
|
||||
|
||||
if( isset( $options['old_stylesheet'] ) )
|
||||
$defaults['old_stylesheet'] = $options['old_stylesheet'];
|
||||
|
||||
//Save general options
|
||||
update_option( GCE_GENERAL_OPTIONS_NAME, $defaults );
|
||||
}
|
||||
|
||||
function init_plugin() {
|
||||
//Load text domain for i18n
|
||||
load_plugin_textdomain( GCE_TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
||||
}
|
||||
|
||||
//Adds 'Settings' link to main WordPress Plugins page
|
||||
function add_settings_link( $links ) {
|
||||
array_unshift( $links, '<a href="options-general.php?page=google-calendar-events.php">' . __( 'Settings', GCE_TEXT_DOMAIN ) . '</a>' );
|
||||
return $links;
|
||||
}
|
||||
|
||||
//Setup admin settings page
|
||||
function setup_admin(){
|
||||
if ( function_exists( 'add_options_page' ) )
|
||||
add_options_page( 'Google Calendar Events', 'Google Calendar Events', 'manage_options', basename( __FILE__ ), array( $this, 'admin_page' ) );
|
||||
}
|
||||
|
||||
//Prints admin settings page
|
||||
function admin_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div id="icon-options-general" class="icon32"><br /></div>
|
||||
|
||||
<h2><?php _e( 'Google Calendar Events', GCE_TEXT_DOMAIN ); ?></h2>
|
||||
|
||||
<?php if ( get_option( 'gce_clear_old_transients' ) ): ?>
|
||||
<div class="error">
|
||||
<p><strong><?php _e( 'Notice:', GCE_TEXT_DOMAIN ); ?></strong> <?php _e( 'The way in which Google Calendar Events stores cached data has been much improved in version 0.6. As you have upgraded from a previous version of the plugin, there is likely to be some data from the old caching system hanging around in your database that is now useless. Click below to clear expired cached data from your database.', GCE_TEXT_DOMAIN); ?></p>
|
||||
<p><a href="<?php echo wp_nonce_url( add_query_arg( array( 'gce_action' => 'clear_old_transients' ) ), 'gce_action_clear_old_transients' ); ?>"><?php _e( 'Clear expired cached data', GCE_TEXT_DOMAIN ); ?></a></p>
|
||||
<p><?php _e( 'or', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<p><a href="<?php echo wp_nonce_url( add_query_arg( array( 'gce_action' => 'ignore_old_transients' ) ), 'gce_action_ignore_old_transients' ); ?>"><?php _e( 'Ignore this notice', GCE_TEXT_DOMAIN ); ?></a></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="options.php" id="test-form">
|
||||
<?php
|
||||
if ( isset( $_GET['action'] ) && ! isset( $_GET['settings-updated'] ) ) {
|
||||
switch ( $_GET['action'] ) {
|
||||
//Add feed section
|
||||
case 'add':
|
||||
settings_fields( 'gce_options' );
|
||||
do_settings_sections( 'add_feed' );
|
||||
do_settings_sections( 'add_display' );
|
||||
do_settings_sections( 'add_builder' );
|
||||
do_settings_sections( 'add_simple_display' );
|
||||
?><p class="submit"><input type="submit" class="button-primary submit" name="gce_options[submit_add]" value="<?php _e( 'Add Feed', GCE_TEXT_DOMAIN ); ?>" /></p>
|
||||
<p><a href="<?php echo admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php' ); ?>" class="button-secondary"><?php _e( 'Cancel', GCE_TEXT_DOMAIN ); ?></a></p><?php
|
||||
break;
|
||||
case 'refresh':
|
||||
settings_fields( 'gce_options' );
|
||||
do_settings_sections( 'refresh_feed' );
|
||||
?><p class="submit"><input type="submit" class="button-primary submit" name="gce_options[submit_refresh]" value="<?php _e( 'Refresh Feed', GCE_TEXT_DOMAIN ); ?>" /></p>
|
||||
<p><a href="<?php echo admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php' ); ?>" class="button-secondary"><?php _e( 'Cancel', GCE_TEXT_DOMAIN ); ?></a></p><?php
|
||||
break;
|
||||
//Edit feed section
|
||||
case 'edit':
|
||||
settings_fields( 'gce_options' );
|
||||
do_settings_sections( 'edit_feed' );
|
||||
do_settings_sections( 'edit_display' );
|
||||
do_settings_sections( 'edit_builder' );
|
||||
do_settings_sections( 'edit_simple_display' );
|
||||
?><p class="submit"><input type="submit" class="button-primary submit" name="gce_options[submit_edit]" value="<?php _e( 'Save Changes', GCE_TEXT_DOMAIN ); ?>" /></p>
|
||||
<p><a href="<?php echo admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php' ); ?>" class="button-secondary"><?php _e( 'Cancel', GCE_TEXT_DOMAIN ); ?></a></p><?php
|
||||
break;
|
||||
//Delete feed section
|
||||
case 'delete':
|
||||
settings_fields( 'gce_options' );
|
||||
do_settings_sections( 'delete_feed' );
|
||||
?><p class="submit"><input type="submit" class="button-primary submit" name="gce_options[submit_delete]" value="<?php _e( 'Delete Feed', GCE_TEXT_DOMAIN ); ?>" /></p>
|
||||
<p><a href="<?php echo admin_url( 'options-general.php?page=' . GCE_PLUGIN_NAME . '.php' ); ?>" class="button-secondary"><?php _e( 'Cancel', GCE_TEXT_DOMAIN ); ?></a></p><?php
|
||||
}
|
||||
}else{
|
||||
//Main admin section
|
||||
settings_fields( 'gce_general' );
|
||||
require_once 'admin/main.php';
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
//Initialize admin stuff
|
||||
function init_admin() {
|
||||
$version = get_option( 'gce_version' );
|
||||
|
||||
//If updating from before 0.7, set old_stylesheet option to true
|
||||
if ( false === $version || version_compare( $version, '0.7', '<' ) ) {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
$options['old_stylesheet'] = true;
|
||||
}
|
||||
|
||||
//If updating from a previous version, update the settings
|
||||
if ( false === $version || version_compare( $version, GCE_VERSION, '<' ) )
|
||||
$this->update_settings();
|
||||
|
||||
//If the message about old transients was displayed, check authority and intention, and then either clear transients or clear flag
|
||||
if ( isset( $_GET['gce_action'] ) && current_user_can( 'manage_options' ) ) {
|
||||
switch ( $_GET['gce_action'] ) {
|
||||
case 'clear_old_transients':
|
||||
check_admin_referer( 'gce_action_clear_old_transients' );
|
||||
$this->clear_old_transients();
|
||||
add_settings_error( 'gce_options', 'gce_cleared_old_transients', __( 'Old cached data cleared.', GCE_TEXT_DOMAIN ), 'updated' );
|
||||
break;
|
||||
case 'ignore_old_transients':
|
||||
check_admin_referer( 'gce_action_ignore_old_transients' );
|
||||
delete_option( 'gce_clear_old_transients' );
|
||||
}
|
||||
}
|
||||
|
||||
register_setting( 'gce_options', 'gce_options', array( $this, 'validate_feed_options' ) );
|
||||
register_setting( 'gce_general', 'gce_general', array( $this, 'validate_general_options' ) );
|
||||
|
||||
require_once 'admin/add.php';
|
||||
require_once 'admin/edit.php';
|
||||
require_once 'admin/delete.php';
|
||||
require_once 'admin/refresh.php';
|
||||
}
|
||||
|
||||
//Clears any expired transients from the database
|
||||
function clear_old_transients() {
|
||||
global $wpdb;
|
||||
|
||||
//Retrieve names of all transients
|
||||
$transients = $wpdb->get_results( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%transient%' AND option_name NOT LIKE '%transient_timeout%'" );
|
||||
|
||||
if ( ! empty( $transients ) ) {
|
||||
foreach ( $transients as $transient ) {
|
||||
//Attempt to retrieve the transient. If it has expired, it will be deleted
|
||||
get_transient( str_replace( '_transient_', '', $transient->option_name ) );
|
||||
}
|
||||
}
|
||||
|
||||
//Remove the flag
|
||||
delete_option( 'gce_clear_old_transients' );
|
||||
}
|
||||
|
||||
//Register the widget
|
||||
function add_widget() {
|
||||
require_once 'widget/gce-widget.php';
|
||||
return register_widget( 'GCE_Widget' );
|
||||
}
|
||||
|
||||
//Check / validate submitted feed options data before being stored
|
||||
function validate_feed_options( $input ) {
|
||||
//Get saved options
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
if ( isset( $input['submit_delete'] ) ) {
|
||||
//If delete button was clicked, delete feed from options array and remove associated transients
|
||||
unset( $options[$input['id']] );
|
||||
$this->delete_feed_transients( (int) $input['id'] );
|
||||
add_settings_error( 'gce_options', 'gce_deleted', __( sprintf('Feed %s deleted.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' );
|
||||
} elseif ( isset($input['submit_refresh'] ) ) {
|
||||
//If refresh button was clicked, delete transients associated with feed
|
||||
$this->delete_feed_transients( (int) $input['id'] );
|
||||
add_settings_error( 'gce_options', 'gce_refreshed', __( sprintf('Cached data for feed %s cleared.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' );
|
||||
} else {
|
||||
//Otherwise, validate options and add / update them
|
||||
|
||||
//Check id is positive integer
|
||||
$id = absint( $input['id'] );
|
||||
//Escape title text
|
||||
$title = esc_html( $input['title'] );
|
||||
//Escape feed url
|
||||
$url = esc_url( $input['url'] );
|
||||
|
||||
//Array of valid options for retrieve_from and retrieve_until settings
|
||||
$valid_retrieve_options = array( 'now', 'today', 'week', 'month-start', 'month-end', 'any', 'date' );
|
||||
|
||||
$retrieve_from = 'today';
|
||||
$retrieve_from_value = 0;
|
||||
|
||||
//Ensure retrieve_from is valid
|
||||
if( in_array( $input['retrieve_from'], $valid_retrieve_options ) ) {
|
||||
$retrieve_from = $input['retrieve_from'];
|
||||
$retrieve_from_value = (int) $input['retrieve_from_value'];
|
||||
}
|
||||
|
||||
$retrieve_until = 'any';
|
||||
$retrieve_until_value = 0;
|
||||
|
||||
//Ensure retrieve_until is valid
|
||||
if ( in_array( $input['retrieve_until'], $valid_retrieve_options ) ) {
|
||||
$retrieve_until = $input['retrieve_until'];
|
||||
$retrieve_until_value = (int) $input['retrieve_until_value'];
|
||||
}
|
||||
|
||||
//Check max events is a positive integer. If absint returns 0, reset to default (25)
|
||||
$max_events = ( 0 == absint($input['max_events'] ) ) ? 25 : absint( $input['max_events'] );
|
||||
|
||||
$date_format = wp_filter_kses( $input['date_format'] );
|
||||
$time_format = wp_filter_kses( $input['time_format'] );
|
||||
|
||||
//Escape timezone
|
||||
$timezone = esc_html( $input['timezone'] );
|
||||
|
||||
//Make sure cache duration is a positive integer or 0. If user has typed 0, leave as 0 but if 0 is returned from absint, set to default (43200)
|
||||
$cache_duration = $input['cache_duration'];
|
||||
if ( '0' != $cache_duration )
|
||||
$cache_duration = ( 0 == absint( $cache_duration ) ) ? 43200 : absint( $cache_duration );
|
||||
|
||||
$multiple_day = ( isset( $input['multiple_day'] ) ) ? 'true' : 'false';
|
||||
|
||||
$display_start = esc_html( $input['display_start'] );
|
||||
$display_end = esc_html( $input['display_end'] );
|
||||
|
||||
//Display options must be 'on' or null
|
||||
$display_location = ( isset( $input['display_location'] ) ) ? 'on' : null;
|
||||
$display_desc = ( isset( $input['display_desc'] ) ) ? 'on' : null;
|
||||
$display_link = ( isset( $input['display_link'] ) ) ? 'on' : null;
|
||||
$display_link_target = ( isset( $input['display_link_target'] ) ) ? 'on' : null;
|
||||
|
||||
//Filter display text
|
||||
$display_start_text = wp_filter_kses( $input['display_start_text'] );
|
||||
$display_end_text = wp_filter_kses( $input['display_end_text'] );
|
||||
$display_location_text = wp_filter_kses( $input['display_location_text'] );
|
||||
$display_desc_text = wp_filter_kses( $input['display_desc_text'] );
|
||||
$display_link_text = wp_filter_kses( $input['display_link_text'] );
|
||||
|
||||
$display_separator = wp_filter_kses( $input['display_separator'] );
|
||||
|
||||
$display_desc_limit = ( 0 == absint( $input['display_desc_limit'] ) ) ? '' : absint( $input['display_desc_limit'] );
|
||||
|
||||
$use_builder = ( 'false' == $input['use_builder'] ) ? 'false' : 'true';
|
||||
$builder = wp_kses_post( $input['builder'] );
|
||||
|
||||
//Fill options array with validated values
|
||||
$options[$id] = array(
|
||||
'id' => $id,
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'retrieve_from' => $retrieve_from,
|
||||
'retrieve_until' => $retrieve_until,
|
||||
'retrieve_from_value' => $retrieve_from_value,
|
||||
'retrieve_until_value' => $retrieve_until_value,
|
||||
'max_events' => $max_events,
|
||||
'date_format' => $date_format,
|
||||
'time_format' => $time_format,
|
||||
'timezone' => $timezone,
|
||||
'cache_duration' => $cache_duration,
|
||||
'multiple_day' => $multiple_day,
|
||||
'display_start' => $display_start,
|
||||
'display_end' => $display_end,
|
||||
'display_location' => $display_location,
|
||||
'display_desc' => $display_desc,
|
||||
'display_link' => $display_link,
|
||||
'display_start_text' => $display_start_text,
|
||||
'display_end_text' => $display_end_text,
|
||||
'display_location_text' => $display_location_text,
|
||||
'display_desc_text' => $display_desc_text,
|
||||
'display_desc_limit' => $display_desc_limit,
|
||||
'display_link_text' => $display_link_text,
|
||||
'display_link_target' => $display_link_target,
|
||||
'display_separator' => $display_separator,
|
||||
'use_builder' => $use_builder,
|
||||
'builder' => $builder
|
||||
);
|
||||
|
||||
if ( isset( $input['submit_add'] ) )
|
||||
add_settings_error( 'gce_options', 'gce_added', __( sprintf( 'Feed %s added.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' );
|
||||
else
|
||||
add_settings_error( 'gce_options', 'gce_edited', __( sprintf( 'Settings for feed %s updated.', absint( $input['id'] ) ), GCE_TEXT_DOMAIN ), 'updated' );
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
//Validate submitted general options
|
||||
function validate_general_options( $input ) {
|
||||
$options = get_option(GCE_GENERAL_OPTIONS_NAME);
|
||||
|
||||
$options['stylesheet'] = esc_url( $input['stylesheet'] );
|
||||
$options['javascript'] = ( isset( $input['javascript'] ) ) ? true : false;
|
||||
$options['loading'] = esc_html( $input['loading'] );
|
||||
$options['error'] = wp_filter_kses( $input['error'] );
|
||||
$options['fields'] = ( isset( $input['fields'] ) ) ? true : false;
|
||||
$options['old_stylesheet'] = ( isset( $input['old_stylesheet'] ) ) ? true : false;
|
||||
|
||||
add_settings_error( 'gce_general', 'gce_general_updated', __( 'General options updated.', GCE_TEXT_DOMAIN ), 'updated' );
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
//Delete all transients (cached feed data) associated with feed specified
|
||||
function delete_feed_transients( $id ) {
|
||||
delete_transient( 'gce_feed_' . $id );
|
||||
delete_transient( 'gce_feed_' . $id . '_url' );
|
||||
}
|
||||
|
||||
//Handles the shortcode stuff
|
||||
function shortcode_handler( $atts ) {
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
//Check that any feeds have been added
|
||||
if ( is_array( $options ) && ! empty( $options ) ) {
|
||||
extract( shortcode_atts( array(
|
||||
'id' => '',
|
||||
'type' => 'grid',
|
||||
'title' => false,
|
||||
'max' => 0,
|
||||
'order' => 'asc'
|
||||
), $atts ) );
|
||||
|
||||
$no_feeds_exist = true;
|
||||
$feed_ids = array();
|
||||
|
||||
if ( '' != $id ) {
|
||||
//Break comma delimited list of feed ids into array
|
||||
$feed_ids = explode( ',', str_replace( ' ', '', $id ) );
|
||||
|
||||
//Check each id is an integer, if not, remove it from the array
|
||||
foreach ( $feed_ids as $key => $feed_id ) {
|
||||
if ( 0 == absint( $feed_id ) )
|
||||
unset( $feed_ids[$key] );
|
||||
}
|
||||
|
||||
//If at least one of the feed ids entered exists, set no_feeds_exist to false
|
||||
foreach ( $feed_ids as $feed_id ) {
|
||||
if ( isset($options[$feed_id] ) )
|
||||
$no_feeds_exist = false;
|
||||
}
|
||||
} else {
|
||||
foreach ( $options as $feed ) {
|
||||
$feed_ids[] = $feed['id'];
|
||||
}
|
||||
|
||||
$no_feeds_exist = false;
|
||||
}
|
||||
|
||||
//Ensure max events is a positive integer
|
||||
$max_events = absint( $max );
|
||||
|
||||
//Ensure sort order is asc or desc
|
||||
$sort_order = ( 'desc' == $order ) ? 'desc' : 'asc';
|
||||
|
||||
//Check that at least one valid feed id has been entered
|
||||
if ( empty( $feed_ids ) || $no_feeds_exist ) {
|
||||
return __( 'No valid Feed IDs have been entered for this shortcode. Please check that you have entered the IDs correctly and that the Feeds have not been deleted.', GCE_TEXT_DOMAIN );
|
||||
} else {
|
||||
//Turns feed_ids back into string of feed ids delimited by '-' ('1-2-3-4' for example)
|
||||
$feed_ids = implode( '-', $feed_ids );
|
||||
|
||||
//If title has been omitted from shortcode, set title_text to null, otherwise set to title (even if empty string)
|
||||
$title_text = ( false === $title ) ? null : $title;
|
||||
|
||||
switch ( $type ) {
|
||||
case 'grid':
|
||||
return gce_print_grid( $feed_ids, $title_text, $max_events );
|
||||
case 'ajax':
|
||||
return gce_print_grid( $feed_ids, $title_text, $max_events, true );
|
||||
case 'list':
|
||||
return gce_print_list( $feed_ids, $title_text, $max_events, $sort_order );
|
||||
case 'list-grouped':
|
||||
return gce_print_list( $feed_ids, $title_text, $max_events, $sort_order, true );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return __( 'No feeds have been added yet. You can add a feed in the Google Calendar Events settings.', GCE_TEXT_DOMAIN );
|
||||
}
|
||||
}
|
||||
|
||||
//Adds the required CSS
|
||||
function add_styles() {
|
||||
//Don't add styles if on admin screens
|
||||
if( ! is_admin() ) {
|
||||
wp_enqueue_style( 'gce_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-style.css' );
|
||||
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
|
||||
//If old stylesheet option is enabled, enqueue old styles
|
||||
if ( $options['old_stylesheet'] )
|
||||
wp_enqueue_style( 'gce_old_styles', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/css/gce-old-style.css' );
|
||||
|
||||
//If user has entered a URL to a custom stylesheet, enqueue it too
|
||||
if( '' != $options['stylesheet'] )
|
||||
wp_enqueue_style( 'gce_custom_styles', $options['stylesheet'] );
|
||||
}
|
||||
}
|
||||
|
||||
//Adds the required scripts
|
||||
function add_scripts() {
|
||||
//Don't add scripts if on admin screens
|
||||
if ( ! is_admin() ) {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
$add_to_footer = (bool) $options['javascript'];
|
||||
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'gce_jquery_qtip', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/jquery-qtip.js', array( 'jquery' ), null, $add_to_footer );
|
||||
wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-script.js', array( 'jquery' ), null, $add_to_footer );
|
||||
wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'loading' => $options['loading']
|
||||
) );
|
||||
} else {
|
||||
wp_enqueue_script( 'gce_scripts', WP_PLUGIN_URL . '/' . GCE_PLUGIN_NAME . '/js/gce-admin-script.js', array( 'jquery' ) );
|
||||
}
|
||||
}
|
||||
|
||||
//AJAX stuffs
|
||||
function gce_ajax() {
|
||||
if ( isset( $_GET['gce_feed_ids'] ) ) {
|
||||
$ids = esc_html( $_GET['gce_feed_ids'] );
|
||||
$title = esc_html( $_GET['gce_title_text'] );
|
||||
$max = absint( $_GET['gce_max_events'] );
|
||||
$month = absint( $_GET['gce_month'] );
|
||||
$year = absint( $_GET['gce_year'] );
|
||||
|
||||
if ( 'page' == $_GET['gce_type'] ) {
|
||||
//The page grid markup to be returned via AJAX
|
||||
echo gce_print_grid( $ids, $title, $max, true, $month, $year );
|
||||
} elseif ( 'widget' == $_GET['gce_type'] ) {
|
||||
$widget = esc_html( $_GET['gce_widget_id'] );
|
||||
|
||||
//The widget grid markup to be returned via AJAX
|
||||
gce_widget_content_grid( $ids, $title, $max, $widget, true, $month, $year );
|
||||
}
|
||||
}
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function gce_print_list( $feed_ids, $title_text, $max_events, $sort_order, $grouped = false ) {
|
||||
require_once 'inc/gce-parser.php';
|
||||
|
||||
$ids = explode( '-', $feed_ids );
|
||||
|
||||
//Create new GCE_Parser object, passing array of feed id(s)
|
||||
$list = new GCE_Parser( $ids, $title_text, $max_events, $sort_order );
|
||||
|
||||
$num_errors = $list->get_num_errors();
|
||||
|
||||
//If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the list
|
||||
if ( $num_errors < count( $ids ) ) {
|
||||
$markup = '<div class="gce-page-list">' . $list->get_list( $grouped ) . '</div>';
|
||||
|
||||
//If there was at least one error, return the list markup with error messages (for admins only)
|
||||
if ( $num_errors > 0 && current_user_can( 'manage_options' ) )
|
||||
return $list->error_messages() . $markup;
|
||||
|
||||
//Otherwise just return the list markup
|
||||
return $markup;
|
||||
} else {
|
||||
//If current user is an admin, display an error message explaining problem(s). Otherwise, display a 'nice' error messsage
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return $list->error_messages();
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
return $options['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function gce_print_grid( $feed_ids, $title_text, $max_events, $ajaxified = false, $month = null, $year = null ) {
|
||||
require_once 'inc/gce-parser.php';
|
||||
|
||||
$ids = explode( '-', $feed_ids );
|
||||
|
||||
//Create new GCE_Parser object, passing array of feed id(s) returned from gce_get_feed_ids()
|
||||
$grid = new GCE_Parser( $ids, $title_text, $max_events );
|
||||
|
||||
$num_errors = $grid->get_num_errors();
|
||||
|
||||
//If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the grid
|
||||
if ( $num_errors < count( $ids ) ) {
|
||||
$markup = '<div class="gce-page-grid" id="gce-page-grid-' . $feed_ids .'">';
|
||||
|
||||
//Add AJAX script if required
|
||||
if ( $ajaxified )
|
||||
$markup .= '<script type="text/javascript">jQuery(document).ready(function($){gce_ajaxify("gce-page-grid-' . $feed_ids . '", "' . $feed_ids . '", "' . $max_events . '", "' . $title_text . '", "page");});</script>';
|
||||
|
||||
$markup .= $grid->get_grid( $year, $month, $ajaxified ) . '</div>';
|
||||
|
||||
//If there was at least one error, return the grid markup with an error message (for admins only)
|
||||
if ( $num_errors > 0 && current_user_can( 'manage_options' ) )
|
||||
return $grid->error_messages() . $markup;
|
||||
|
||||
//Otherwise just return the grid markup
|
||||
return $markup;
|
||||
} else {
|
||||
//If current user is an admin, display an error message explaining problem. Otherwise, display a 'nice' error messsage
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
return $grid->error_messages();
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
return $options['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$gce = new Google_Calendar_Events();
|
||||
?>
|
||||
536
src/wp-content/plugins/google-calendar-events/inc/gce-event.php
Normal file
@ -0,0 +1,536 @@
|
||||
<?php
|
||||
class GCE_Event{
|
||||
private $id;
|
||||
private $title;
|
||||
private $description;
|
||||
private $location;
|
||||
private $start_time;
|
||||
private $end_time;
|
||||
private $link;
|
||||
private $type;
|
||||
private $num_in_day;
|
||||
private $pos;
|
||||
private $feed;
|
||||
private $day_type;
|
||||
|
||||
function __construct( $id, $title, $description, $location, $start_time, $end_time, $link ) {
|
||||
$this->id = $id;
|
||||
$this->title = $title;
|
||||
$this->description = $description;
|
||||
$this->location = $location;
|
||||
$this->start_time = $start_time;
|
||||
$this->end_time = $end_time;
|
||||
$this->link = $link;
|
||||
|
||||
//Calculate which day type this event is (SWD = single whole day, SPD = single part day, MWD = multiple whole day, MPD = multiple part day)
|
||||
if ( ( $start_time + 86400 ) <= $end_time ) {
|
||||
if ( ( $start_time + 86400 ) == $end_time ) {
|
||||
$this->day_type = 'SWD';
|
||||
} else {
|
||||
if ( ( '12:00 am' == date( 'g:i a', $start_time ) ) && ( '12:00 am' == date( 'g:i a', $end_time ) ) ) {
|
||||
$this->day_type = 'MWD';
|
||||
} else {
|
||||
$this->day_type = 'MPD';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->day_type = 'SPD';
|
||||
}
|
||||
}
|
||||
|
||||
function set_feed( $feed ) {
|
||||
$this->feed = $feed;
|
||||
}
|
||||
|
||||
function get_feed() {
|
||||
return $this->feed;
|
||||
}
|
||||
|
||||
function get_start_time() {
|
||||
return $this->start_time;
|
||||
}
|
||||
|
||||
function get_end_time() {
|
||||
return $this->end_time;
|
||||
}
|
||||
|
||||
function get_day_type() {
|
||||
return $this->day_type;
|
||||
}
|
||||
|
||||
//Returns an array of days (as UNIX timestamps) that this events spans
|
||||
function get_days() {
|
||||
//Round start date to nearest day
|
||||
$start_time = mktime( 0, 0, 0, date( 'm', $this->start_time ), date( 'd', $this->start_time ) , date( 'Y', $this->start_time ) );
|
||||
|
||||
$days = array();
|
||||
|
||||
//If multiple day events should be handled, and this event is a multi-day event, add multiple day event to required days
|
||||
if ( $this->feed->get_multi_day() && ( $this->day_type == 'MPD' || $this->day_type == 'MWD' ) ) {
|
||||
$on_next_day = true;
|
||||
$next_day = $start_time;
|
||||
|
||||
while ( $on_next_day ) {
|
||||
//If the end time of the event is after 00:00 on the next day (therefore, not doesn't end on this day)
|
||||
if ( $this->end_time > $next_day ) {
|
||||
//If $next_day is within the event retrieval date range (specified by retrieve events from / until settings)
|
||||
if ( $next_day >= $this->feed->get_feed_start() && $next_day < $this->feed->get_feed_end() ) {
|
||||
$days[] = $next_day;
|
||||
}
|
||||
} else {
|
||||
$on_next_day = false;
|
||||
}
|
||||
$next_day += 86400;
|
||||
}
|
||||
} else {
|
||||
//Add event into array of events for that day
|
||||
$days[] = $start_time;
|
||||
}
|
||||
|
||||
return $days;
|
||||
}
|
||||
|
||||
//Returns the markup for this event, so that it can be used in the construction of a grid / list
|
||||
function get_event_markup( $display_type, $num_in_day, $num ) {
|
||||
//Set the display type (either tooltip or list)
|
||||
$this->type = $display_type;
|
||||
|
||||
//Set which number event this is in day (first in day etc)
|
||||
$this->num_in_day = $num_in_day;
|
||||
|
||||
//Set the position of this event in array of events currently being processed
|
||||
$this->pos = $num;
|
||||
|
||||
//Use the builder or the old display options to create the markup, depending on user choice
|
||||
if ( $this->feed->get_use_builder() )
|
||||
return $this->use_builder();
|
||||
|
||||
return $this->use_old_display_options();
|
||||
}
|
||||
|
||||
//Return the event markup using the builder
|
||||
function use_builder() {
|
||||
//Array of valid shortcodes
|
||||
$shortcodes = array(
|
||||
//Event / feed information shortcodes
|
||||
|
||||
'event-title', //The event title
|
||||
'start-time', //The start time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format)
|
||||
'start-date', //The start date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format)
|
||||
'start-custom', //The start time / date of the event (uses a custom PHP date format, specified in the 'format' attribute)
|
||||
'start-human', //The difference between the start time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins'
|
||||
'end-time', //The end time of the event (uses the time format from the feed options, if it is set. Otherwise uses the default WordPress time format)
|
||||
'end-date', //The end date of the event (uses the date format from the feed options, if it is set. Otherwise uses the default WordPress date format)
|
||||
'end-custom', //The end time / date of the event (uses a custom PHP date format, specified in the 'format' attribute)
|
||||
'end-human', //The difference between the end time of the event and the time now, in human-readable format, such as '1 hour', '4 days', '15 mins'
|
||||
'location', //The event location
|
||||
'description', //The event deescription (number of words can be limited by the 'limit' attribute)
|
||||
'link', //Anything within this shortcode (including further shortcodes) will be linked to the Google Calendar page for this event
|
||||
'url', //The raw link URL to the Google Calendar page for this event (can be used to construct more customized links)
|
||||
'feed-id', //The ID of this feed (Can be useful for constructing feed specific CSS classes)
|
||||
'feed-title', //The feed title
|
||||
'maps-link', //Anything within this shortcode (including further shortcodes) will be linked to a Google Maps page based on whatever is specified for the event location
|
||||
'length', //How long the events lasts, in human-readable format
|
||||
'event-num', //The position of the event in the current list, or the position of the event in the current month (for grids)
|
||||
'event-id', //The event UID (unique identifier assigned by Google)
|
||||
'cal-id', //The calendar ID
|
||||
|
||||
//Anything between the opening and closing tags of the following logical shortcodes (including further shortcodes) will only be displayed if:
|
||||
|
||||
'if-all-day', //This is an all-day event
|
||||
'if-not-all-day', //This is not an all-day event
|
||||
'if-title', //The event has a title
|
||||
'if-description', //The event has a description
|
||||
'if-location', //The event has a location
|
||||
'if-tooltip', //The current display type is 'tooltip'
|
||||
'if-list', //The current display type is 'list'
|
||||
'if-now', //The event is taking place now (after the start time, but before the end time)
|
||||
'if-not-now', //The event is not taking place now (may have ended or not yet started)
|
||||
'if-started', //The event has started (and even if it has ended)
|
||||
'if-not-started', //The event has not yet started
|
||||
'if-ended', //The event has ended
|
||||
'if-not-ended', //The event has not ended (and even if it hasn't started)
|
||||
'if-first', //The event is the first in the day
|
||||
'if-not-first', //The event is not the first in the day
|
||||
'if-multi-day', //The event spans multiple days
|
||||
'if-single-day' //The event does not span multiple days
|
||||
);
|
||||
|
||||
$shortcodes = implode( '|', $shortcodes );
|
||||
|
||||
$markup = $this->feed->get_builder();
|
||||
|
||||
$count = 0;
|
||||
|
||||
//Go through the builder text looking for valid shortcodes. If one is found, send it to parse_shortcodes(). Once $count reaches 0, there are no un-parsed shortcodes
|
||||
//left, so return the markup (which now contains all the appropriate event information)
|
||||
do {
|
||||
$markup = preg_replace_callback(
|
||||
'/(.?)\[(' . $shortcodes . ')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s',
|
||||
array( $this, 'parse_shortcode' ),
|
||||
$markup,
|
||||
-1,
|
||||
$count
|
||||
);
|
||||
} while ( $count > 0 );
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
//Parse a shortcode, returning the appropriate event information
|
||||
//Much of this code is 'borrowed' from WordPress' own shortcode handling stuff!
|
||||
function parse_shortcode( $m ) {
|
||||
if ( '[' == $m[1] && ']' == $m[6] )
|
||||
return substr( $m[0], 1, -1 );
|
||||
|
||||
//Extract any attributes contained in the shortcode
|
||||
extract( shortcode_atts( array(
|
||||
'newwindow' => 'false',
|
||||
'format' => '',
|
||||
'limit' => '0',
|
||||
'html' => 'false',
|
||||
'markdown' => 'false',
|
||||
'precision' => '1',
|
||||
'offset' => '0',
|
||||
'autolink' => 'true'
|
||||
), shortcode_parse_atts( $m[3] ) ) );
|
||||
|
||||
//Sanitize the attributes
|
||||
$newwindow = ( 'true' === $newwindow );
|
||||
$format = esc_attr( $format );
|
||||
$limit = absint( $limit );
|
||||
$html = ( 'true' === $html );
|
||||
$markdown = ( 'true' === $markdown );
|
||||
$precision = absint( $precision );
|
||||
$offset = intval( $offset );
|
||||
$autolink = ( 'true' === $autolink );
|
||||
|
||||
$time_now = current_time( 'timestamp' );
|
||||
|
||||
//Do the appropriate stuff depending on which shortcode we're looking at. See valid shortcode list (above) for explanation of each shortcode
|
||||
switch ( $m[2] ) {
|
||||
case 'event-title':
|
||||
$title = esc_html( trim( $this->title ) );
|
||||
|
||||
if ( $markdown && function_exists( 'Markdown' ) )
|
||||
$title = Markdown( $title );
|
||||
|
||||
if ( $html )
|
||||
$title = wp_kses_post( html_entity_decode( $title ) );
|
||||
|
||||
return $m[1] . $title . $m[6];
|
||||
|
||||
case 'start-time':
|
||||
return $m[1] . date_i18n( $this->feed->get_time_format(), $this->start_time + $offset ) . $m[6];
|
||||
|
||||
case 'start-date':
|
||||
return $m[1] . date_i18n( $this->feed->get_date_format(), $this->start_time + $offset ) . $m[6];
|
||||
|
||||
case 'start-custom':
|
||||
return $m[1] . date_i18n( $format, $this->start_time + $offset ) . $m[6];
|
||||
|
||||
case 'start-human':
|
||||
return $m[1] . $this->gce_human_time_diff( $this->start_time + $offset, $time_now, $precision ) . $m[6];
|
||||
|
||||
case 'end-time':
|
||||
return $m[1] . date_i18n( $this->feed->get_time_format(), $this->end_time + $offset ) . $m[6];
|
||||
|
||||
case 'end-date':
|
||||
return $m[1] . date_i18n( $this->feed->get_date_format(), $this->end_time + $offset ) . $m[6];
|
||||
|
||||
case 'end-custom':
|
||||
return $m[1] . date_i18n( $format, $this->end_time + $offset ) . $m[6];
|
||||
|
||||
case 'end-human':
|
||||
return $m[1] . $this->gce_human_time_diff( $this->end_time + $offset, $time_now, $precision ) . $m[6];
|
||||
|
||||
case 'location':
|
||||
$location = esc_html( trim( $this->location ) );
|
||||
|
||||
if ( $markdown && function_exists( 'Markdown' ) )
|
||||
$location = Markdown( $location );
|
||||
|
||||
if ( $html )
|
||||
$location = wp_kses_post( html_entity_decode( $location ) );
|
||||
|
||||
return $m[1] . $location . $m[6];
|
||||
|
||||
case 'description':
|
||||
$description = esc_html( trim( $this->description ) );
|
||||
|
||||
//If a word limit has been set, trim the description to the required length
|
||||
if ( 0 != $limit ) {
|
||||
preg_match( '/([\S]+\s*){0,' . $limit . '}/', esc_html( $this->description ), $description );
|
||||
$description = trim( $description[0] );
|
||||
}
|
||||
|
||||
if ( $markdown || $html ) {
|
||||
if ( $markdown && function_exists( 'Markdown' ) )
|
||||
$description = Markdown( $description );
|
||||
|
||||
if ( $html )
|
||||
$description = wp_kses_post( html_entity_decode( $description ) );
|
||||
}else{
|
||||
//Otherwise, preserve line breaks
|
||||
$description = nl2br( $description );
|
||||
|
||||
//Make URLs clickable if required
|
||||
if ( $autolink )
|
||||
$description = make_clickable( $description );
|
||||
}
|
||||
|
||||
return $m[1] . $description . $m[6];
|
||||
|
||||
case 'link':
|
||||
$new_window = ( $newwindow ) ? ' target="_blank"' : '';
|
||||
return $m[1] . '<a href="' . $this->link . '&ctz=' . $this->feed->get_timezone() . '"' . $new_window . '>' . $m[5] . '</a>' . $m[6];
|
||||
|
||||
case 'url':
|
||||
return $m[1] . $this->link . '&ctz=' . $this->feed->get_timezone() . $m[6];
|
||||
|
||||
case 'feed-id':
|
||||
return $m[1] . $this->feed->get_feed_id() . $m[6];
|
||||
|
||||
case 'feed-title':
|
||||
return $m[1] . $this->feed->get_feed_title() . $m[6];
|
||||
|
||||
case 'maps-link':
|
||||
$new_window = ( $newwindow ) ? ' target="_blank"' : '';
|
||||
return $m[1] . '<a href="http://maps.google.com?q=' . urlencode( $this->location ) . '"' . $new_window . '>' . $m[5] . '</a>' . $m[6];
|
||||
|
||||
case 'length':
|
||||
return $m[1] . $this->gce_human_time_diff( $this->start_time, $this->end_time, $precision ) . $m[6];
|
||||
|
||||
case 'event-num':
|
||||
return $m[1] . $this->pos . $m[6];
|
||||
|
||||
case 'event-id':
|
||||
return $m[1] . $this->id . $m[6];
|
||||
|
||||
case 'cal-id':
|
||||
$cal_id = explode( '/', $this->feed->get_feed_url() );
|
||||
return $m[1] . $cal_id[5] . $m[6];
|
||||
|
||||
case 'if-all-day':
|
||||
if ( 'SWD' == $this->day_type || 'MWD' == $this->day_type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-not-all-day':
|
||||
if ( 'SPD' == $this->day_type || 'MPD' == $this->day_type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-title':
|
||||
if ( '' != $this->title )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-description':
|
||||
if ( '' != $this->description )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-location':
|
||||
if ( '' != $this->location )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-tooltip':
|
||||
if ( 'tooltip' == $this->type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-list':
|
||||
if ( 'list' == $this->type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-now':
|
||||
if ( $time_now >= $this->start_time && $time_now < $this->end_time )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-not-now':
|
||||
if ( $this->end_time < $time_now || $this->start_time > $time_now )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-started':
|
||||
if ( $this->start_time < $time_now )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-not-started':
|
||||
if ( $this->start_time > $time_now )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-ended':
|
||||
if ( $this->end_time < $time_now )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-not-ended':
|
||||
if ( $this->end_time > $time_now )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-first':
|
||||
if ( 0 == $this->num_in_day )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-not-first':
|
||||
if ( 0 != $this->num_in_day )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-multi-day':
|
||||
if ( 'MPD' == $this->day_type || 'MWD' == $this->day_type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
|
||||
case 'if-single-day':
|
||||
if ( 'SPD' == $this->day_type || 'SWD' == $this->day_type )
|
||||
return $m[1] . $m[5] . $m[6];
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
//Return the event markup using the old display options
|
||||
function use_old_display_options() {
|
||||
$display_options = $this->feed->get_display_options();
|
||||
|
||||
$markup = '<p class="gce-' . $this->type . '-event">' . esc_html( $this->title ) . '</p>';
|
||||
|
||||
$start_end = array();
|
||||
|
||||
//If start date / time should be displayed, set up array of start date and time
|
||||
if ( 'none' != $display_options['display_start'] ) {
|
||||
$sd = $this->start_time;
|
||||
$start_end['start'] = array(
|
||||
'time' => date_i18n( $this->feed->get_time_format(), $sd ),
|
||||
'date' => date_i18n( $this->feed->get_date_format(), $sd )
|
||||
);
|
||||
}
|
||||
|
||||
//If end date / time should be displayed, set up array of end date and time
|
||||
if ( 'none' != $display_options['display_end'] ) {
|
||||
$ed = $this->end_time;
|
||||
$start_end['end'] = array(
|
||||
'time' => date_i18n( $this->feed->get_time_format(), $ed ),
|
||||
'date' => date_i18n( $this->feed->get_date_format(), $ed )
|
||||
);
|
||||
}
|
||||
|
||||
//Add the correct start / end, date / time information to $markup
|
||||
foreach ( $start_end as $start_or_end => $info ) {
|
||||
$markup .= '<p class="gce-' . $this->type . '-' . $start_or_end . '"><span>' . $display_options['display_' . $start_or_end . '_text'] . '</span> ';
|
||||
|
||||
switch ( $display_options['display_' . $start_or_end] ) {
|
||||
case 'time': $markup .= $info['time'];
|
||||
break;
|
||||
case 'date': $markup .= $info['date'];
|
||||
break;
|
||||
case 'time-date': $markup .= $info['time'] . $display_options['display_separator'] . $info['date'];
|
||||
break;
|
||||
case 'date-time': $markup .= $info['date'] . $display_options['display_separator'] . $info['time'];
|
||||
}
|
||||
|
||||
$markup .= '</p>';
|
||||
}
|
||||
|
||||
//If location should be displayed (and is not empty) add to $markup
|
||||
if ( isset( $display_options['display_location'] ) ) {
|
||||
$event_location = $this->location;
|
||||
if ( '' != $event_location )
|
||||
$markup .= '<p class="gce-' . $this->type . '-loc"><span>' . $display_options['display_location_text'] . '</span> ' . esc_html( $event_location ) . '</p>';
|
||||
}
|
||||
|
||||
//If description should be displayed (and is not empty) add to $markup
|
||||
if ( isset($display_options['display_desc'] ) ) {
|
||||
$event_desc = $this->description;
|
||||
|
||||
if ( '' != $event_desc ) {
|
||||
//Limit number of words of description to display, if required
|
||||
if ( '' != $display_options['display_desc_limit'] ) {
|
||||
preg_match( '/([\S]+\s*){0,' . $display_options['display_desc_limit'] . '}/', $this->description, $event_desc );
|
||||
$event_desc = trim( $event_desc[0] );
|
||||
}
|
||||
|
||||
$markup .= '<p class="gce-' . $this->type . '-desc"><span>' . $display_options['display_desc_text'] . '</span> ' . make_clickable( nl2br( esc_html( $event_desc ) ) ) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
//If link should be displayed add to $markup
|
||||
if ( isset($display_options['display_link'] ) ) //Below: add target="_blank" if required
|
||||
$markup .= '<p class="gce-' . $this->type . '-link"><a href="' . $this->link . '&ctz=' . $this->feed->get_timezone() . '"' . ( ( isset( $display_options['display_link_target'] ) ) ? ' target="_blank"' : '' ) . '>' . $display_options['display_link_text'] . '</a></p>';
|
||||
|
||||
return $markup;
|
||||
}
|
||||
|
||||
//Returns the difference between two times in human-readable format. Based on a patch for human_time_diff posted in the WordPress trac (http://core.trac.wordpress.org/ticket/9272) by Viper007Bond
|
||||
function gce_human_time_diff( $from, $to = '', $limit = 1 ) {
|
||||
$units = array(
|
||||
31556926 => array( __( '%s year', GCE_TEXT_DOMAIN ), __( '%s years', GCE_TEXT_DOMAIN ) ),
|
||||
2629744 => array( __( '%s month', GCE_TEXT_DOMAIN ), __( '%s months', GCE_TEXT_DOMAIN ) ),
|
||||
604800 => array( __( '%s week', GCE_TEXT_DOMAIN ), __( '%s weeks', GCE_TEXT_DOMAIN ) ),
|
||||
86400 => array( __( '%s day', GCE_TEXT_DOMAIN ), __( '%s days', GCE_TEXT_DOMAIN ) ),
|
||||
3600 => array( __( '%s hour', GCE_TEXT_DOMAIN ), __( '%s hours', GCE_TEXT_DOMAIN ) ),
|
||||
60 => array( __( '%s min', GCE_TEXT_DOMAIN ), __( '%s mins', GCE_TEXT_DOMAIN ) ),
|
||||
);
|
||||
|
||||
if ( empty( $to ) )
|
||||
$to = time();
|
||||
|
||||
$from = (int) $from;
|
||||
$to = (int) $to;
|
||||
$diff = (int) abs( $to - $from );
|
||||
|
||||
$items = 0;
|
||||
$output = array();
|
||||
|
||||
foreach ( $units as $unitsec => $unitnames ) {
|
||||
if ( $items >= $limit )
|
||||
break;
|
||||
|
||||
if ( $diff < $unitsec )
|
||||
continue;
|
||||
|
||||
$numthisunits = floor( $diff / $unitsec );
|
||||
$diff = $diff - ( $numthisunits * $unitsec );
|
||||
$items++;
|
||||
|
||||
if ( $numthisunits > 0 )
|
||||
$output[] = sprintf( _n( $unitnames[0], $unitnames[1], $numthisunits ), $numthisunits );
|
||||
}
|
||||
|
||||
$seperator = _x( ', ', 'human_time_diff' );
|
||||
|
||||
if ( ! empty( $output ) ) {
|
||||
return implode( $seperator, $output );
|
||||
} else {
|
||||
$smallest = array_pop( $units );
|
||||
return sprintf( $smallest[0], 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
244
src/wp-content/plugins/google-calendar-events/inc/gce-feed.php
Normal file
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
class GCE_Feed{
|
||||
private $feed_id = 1;
|
||||
private $feed_title = '';
|
||||
private $feed_url = '';
|
||||
private $max_events = 25;
|
||||
private $cache_duration = 43200;
|
||||
private $date_format = '';
|
||||
private $time_format = '';
|
||||
private $timezone = '';
|
||||
private $display_opts = array();
|
||||
private $multi_day = false;
|
||||
private $feed_start = 0;
|
||||
private $feed_end = 2145916800;
|
||||
private $use_builder = true;
|
||||
private $builder = '';
|
||||
private $events = array();
|
||||
private $error = false;
|
||||
|
||||
function init() {
|
||||
require_once 'gce-event.php';
|
||||
|
||||
//Break the feed URL up into its parts (scheme, host, path, query)
|
||||
$url_parts = parse_url( $this->feed_url );
|
||||
|
||||
$scheme_and_host = $url_parts['scheme'] . '://' . $url_parts['host'];
|
||||
|
||||
//Remove the exisitng projection from the path, and replace it with '/full-noattendees'
|
||||
$path = substr( $url_parts['path'], 0, strrpos( $url_parts['path'], '/' ) ) . '/full-noattendees';
|
||||
|
||||
//Add the default parameters to the querystring (retrieving JSON, not XML)
|
||||
$query = '?alt=json&singleevents=true&sortorder=ascending&orderby=starttime';
|
||||
|
||||
//Append the feed specific parameters to the querystring
|
||||
$query .= '&start-min=' . date( 'Y-m-d\TH:i:s', $this->feed_start );
|
||||
$query .= '&start-max=' . date( 'Y-m-d\TH:i:s', $this->feed_end );
|
||||
$query .= '&max-results=' . $this->max_events;
|
||||
|
||||
if ( ! empty( $this->timezone ) )
|
||||
$query .= '&ctz=' . $this->timezone;
|
||||
|
||||
//If enabled, use experimental 'fields' parameter of Google Data API, so that only necessary data is retrieved. This *significantly* reduces amount of data to retrieve and process
|
||||
$general_options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
if ( $general_options['fields'] )
|
||||
$query .= '&fields=entry(title,link[@rel="alternate"],content,gd:where,gd:when,gCal:uid)';
|
||||
|
||||
//Put the URL back together
|
||||
$url = $scheme_and_host . $path . $query;
|
||||
|
||||
//Attempt to retrieve the cached feed data
|
||||
$this->events = get_transient( 'gce_feed_' . $this->feed_id );
|
||||
|
||||
//If the cached feed data isn't valid any more (has expired), or the URL has changed (settings have changed), then the feed data needs to be retrieved and decoded again
|
||||
if ( false === $this->events || get_transient( 'gce_feed_' . $this->feed_id . '_url' ) != $url ) {
|
||||
$this->events = array();
|
||||
|
||||
//Retrieve the feed data
|
||||
$raw_data = wp_remote_get( $url, array(
|
||||
'sslverify' => false, //sslverify is set to false to ensure https URLs work reliably. Data source is Google's servers, so is trustworthy
|
||||
'timeout' => 10 //Increase timeout from the default 5 seconds to ensure even large feeds are retrieved successfully
|
||||
) );
|
||||
|
||||
//If $raw_data is a WP_Error, something went wrong
|
||||
if ( ! is_wp_error( $raw_data ) ) {
|
||||
//If response code isn't 200, something went wrong
|
||||
if ( 200 == $raw_data['response']['code'] ) {
|
||||
//Attempt to convert the returned JSON into an array
|
||||
$raw_data = json_decode( $raw_data['body'], true );
|
||||
|
||||
//If decoding was successful
|
||||
if ( ! empty( $raw_data ) ) {
|
||||
//If there are some entries (events) to process
|
||||
if ( isset( $raw_data['feed']['entry'] ) ) {
|
||||
//Loop through each event, extracting the relevant information
|
||||
foreach ( $raw_data['feed']['entry'] as $event ) {
|
||||
$id = esc_html( substr( $event['gCal$uid']['value'], 0, strpos( $event['gCal$uid']['value'], '@' ) ) );
|
||||
$title = esc_html( $event['title']['$t'] );
|
||||
$description = esc_html( $event['content']['$t'] );
|
||||
$link = esc_url( $event['link'][0]['href'] );
|
||||
$location = esc_html( $event['gd$where'][0]['valueString'] );
|
||||
$start_time = $this->iso_to_ts( $event['gd$when'][0]['startTime'] );
|
||||
$end_time = $this->iso_to_ts( $event['gd$when'][0]['endTime'] );
|
||||
|
||||
//Create a GCE_Event using the above data. Add it to the array of events
|
||||
$this->events[] = new GCE_Event( $id, $title, $description, $location, $start_time, $end_time, $link );
|
||||
}
|
||||
|
||||
//Cache the feed data
|
||||
set_transient( 'gce_feed_' . $this->feed_id, $this->events, $this->cache_duration );
|
||||
set_transient( 'gce_feed_' . $this->feed_id . '_url', $url, $this->cache_duration );
|
||||
}
|
||||
} else {
|
||||
//json_decode failed
|
||||
$this->error = __( 'Some data was retrieved, but could not be parsed successfully. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN );
|
||||
}
|
||||
} else {
|
||||
//The response code wasn't 200, so generate a helpful(ish) error message depending on error code
|
||||
switch ( $raw_data['response']['code'] ) {
|
||||
case 404:
|
||||
$this->error = __( 'The feed could not be found (404). Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN );
|
||||
break;
|
||||
case 403:
|
||||
$this->error = __( 'Access to this feed was denied (403). Please ensure you have public sharing enabled for your calendar.', GCE_TEXT_DOMAIN );
|
||||
break;
|
||||
default:
|
||||
$this->error = sprintf( __( 'The feed data could not be retrieved. Error code: %s. Please ensure your feed URL is correct.', GCE_TEXT_DOMAIN ), $raw_data['response']['code'] );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//Generate an error message from the returned WP_Error
|
||||
$this->error = $raw_data->get_error_message() . ' Please ensure your feed URL is correct.';
|
||||
}
|
||||
}
|
||||
|
||||
//Makes sure each event knows it came from this feed
|
||||
foreach ( $this->events as $event ) {
|
||||
$event->set_feed( $this );
|
||||
}
|
||||
}
|
||||
|
||||
//Convert an ISO date/time to a UNIX timestamp
|
||||
function iso_to_ts( $iso ) {
|
||||
sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second );
|
||||
return mktime( $hour, $minute, $second, $month, $day, $year );
|
||||
}
|
||||
|
||||
//Return error message, or false if no error occurred
|
||||
function error() {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
//Setters
|
||||
|
||||
function set_feed_id( $v ) {
|
||||
$this->feed_id = $v;
|
||||
}
|
||||
|
||||
function set_feed_title( $v ) {
|
||||
$this->feed_title = $v;
|
||||
}
|
||||
|
||||
function set_feed_url( $v ) {
|
||||
$this->feed_url = $v;
|
||||
}
|
||||
|
||||
function set_max_events( $v ) {
|
||||
$this->max_events = $v;
|
||||
}
|
||||
|
||||
function set_cache_duration( $v ) {
|
||||
$this->cache_duration = $v;
|
||||
}
|
||||
|
||||
function set_date_format( $v ) {
|
||||
$this->date_format = $v;
|
||||
}
|
||||
|
||||
function set_time_format( $v ) {
|
||||
$this->time_format = $v;
|
||||
}
|
||||
|
||||
function set_timezone( $v ) {
|
||||
$this->timezone = $v;
|
||||
}
|
||||
|
||||
function set_display_options( $v ) {
|
||||
$this->display_opts = $v;
|
||||
}
|
||||
|
||||
function set_multi_day( $v ) {
|
||||
$this->multi_day = $v;
|
||||
}
|
||||
|
||||
function set_feed_start( $v ) {
|
||||
$this->feed_start = $v;
|
||||
}
|
||||
|
||||
function set_feed_end( $v ) {
|
||||
$this->feed_end = $v;
|
||||
}
|
||||
|
||||
function set_use_builder( $v ) {
|
||||
$this->use_builder = $v;
|
||||
}
|
||||
|
||||
function set_builder( $v ) {
|
||||
$this->builder = $v;
|
||||
}
|
||||
|
||||
//Getters
|
||||
|
||||
function get_events() {
|
||||
return $this->events;
|
||||
}
|
||||
|
||||
function get_feed_id() {
|
||||
return $this->feed_id;
|
||||
}
|
||||
|
||||
function get_feed_title() {
|
||||
return $this->feed_title;
|
||||
}
|
||||
|
||||
function get_feed_url() {
|
||||
return $this->feed_url;
|
||||
}
|
||||
|
||||
function get_date_format() {
|
||||
return $this->date_format;
|
||||
}
|
||||
|
||||
function get_time_format() {
|
||||
return $this->time_format;
|
||||
}
|
||||
|
||||
function get_display_options() {
|
||||
return $this->display_opts;
|
||||
}
|
||||
|
||||
function get_multi_day() {
|
||||
return $this->multi_day;
|
||||
}
|
||||
|
||||
function get_feed_start() {
|
||||
return $this->feed_start;
|
||||
}
|
||||
|
||||
function get_feed_end() {
|
||||
return $this->feed_end;
|
||||
}
|
||||
|
||||
function get_timezone() {
|
||||
return $this->timezone;
|
||||
}
|
||||
|
||||
function get_use_builder() {
|
||||
return $this->use_builder;
|
||||
}
|
||||
|
||||
function get_builder() {
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
?>
|
||||
357
src/wp-content/plugins/google-calendar-events/inc/gce-parser.php
Normal file
@ -0,0 +1,357 @@
|
||||
<?php
|
||||
class GCE_Parser {
|
||||
private $feeds = array();
|
||||
private $merged_feed_data = array();
|
||||
private $errors = array();
|
||||
private $title = null;
|
||||
private $max_events_display = 0;
|
||||
private $start_of_week = 0;
|
||||
private $sort_order = 'asc';
|
||||
|
||||
function __construct( $feed_ids, $title_text = null, $max_events = 0, $sort_order = 'asc' ) {
|
||||
require_once 'gce-feed.php';
|
||||
|
||||
$this->title = $title_text;
|
||||
$this->max_events_display = $max_events;
|
||||
$this->sort_order = $sort_order;
|
||||
|
||||
//Get the feed options
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
$this->start_of_week = get_option( 'start_of_week' );
|
||||
|
||||
foreach ( $feed_ids as $single_feed ) {
|
||||
//Get the options for this particular feed
|
||||
if ( isset( $options[$single_feed] ) ) {
|
||||
$feed_options = $options[$single_feed];
|
||||
|
||||
$feed = new GCE_Feed();
|
||||
|
||||
$feed->set_feed_id( $feed_options['id'] );
|
||||
$feed->set_feed_title( $feed_options['title'] );
|
||||
$feed->set_feed_url( $feed_options['url'] );
|
||||
$feed->set_max_events( $feed_options['max_events'] );
|
||||
$feed->set_cache_duration( $feed_options['cache_duration'] );
|
||||
|
||||
//Set the timezone if anything other than default
|
||||
if ( 'default' != $feed_options['timezone'] )
|
||||
$feed->set_timezone( $feed_options['timezone'] );
|
||||
|
||||
$gmt_offset = get_option( 'gmt_offset' ) * 3600;
|
||||
|
||||
//Set the start date to the appropriate value based on the retrieve_from option
|
||||
switch ( $feed_options['retrieve_from'] ) {
|
||||
//Don't just use time() for 'now', as this will effectively make cache duration 1 second. Instead set to previous minute. Events in Google Calendar cannot be set to precision of seconds anyway
|
||||
case 'now':
|
||||
$feed->set_feed_start( mktime( date( 'H' ), date( 'i' ), 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'today':
|
||||
$feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'week':
|
||||
$feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $this->start_of_week ), date( 'Y' ) ) + $feed_options['retrieve_from_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'month-start':
|
||||
$feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ) + $feed_options['retrieve_from_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'month-end':
|
||||
$feed->set_feed_start( mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ) + $feed_options['retrieve_from_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'date':
|
||||
$feed->set_feed_start( $feed_options['retrieve_from_value'] );
|
||||
break;
|
||||
default:
|
||||
$feed->set_feed_start( 0 ); //any - 1970-01-01 00:00
|
||||
}
|
||||
|
||||
//Set the end date to the appropriate value based on the retrieve_until option
|
||||
switch ( $feed_options['retrieve_until'] ) {
|
||||
case 'now':
|
||||
$feed->set_feed_end( mktime( date( 'H' ), date( 'i' ), 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'today':
|
||||
$feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), date( 'j' ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'week':
|
||||
$feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $this->start_of_week ), date( 'Y' ) ) + $feed_options['retrieve_until_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'month-start':
|
||||
$feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ), 1, date( 'Y' ) ) + $feed_options['retrieve_until_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'month-end':
|
||||
$feed->set_feed_end( mktime( 0, 0, 0, date( 'm' ) + 1, 1, date( 'Y' ) ) + $feed_options['retrieve_until_value'] + $gmt_offset );
|
||||
break;
|
||||
case 'date':
|
||||
$feed->set_feed_end( $feed_options['retrieve_until_value'] );
|
||||
break;
|
||||
case 'any':
|
||||
$feed->set_feed_end( 2145916800 ); //any - 2038-01-01 00:00
|
||||
}
|
||||
|
||||
//Set date and time formats. If they have not been set by user, set to global WordPress formats
|
||||
$feed->set_date_format( ( empty( $feed_options['date_format'] ) ) ? get_option( 'date_format' ) : $feed_options['date_format'] );
|
||||
$feed->set_time_format( ( empty( $feed_options['time_format'] ) ) ? get_option( 'time_format' ) : $feed_options['time_format'] );
|
||||
//Set whether to handle multiple day events
|
||||
$feed->set_multi_day( ( 'true' == $feed_options['multiple_day'] ) ? true : false );
|
||||
|
||||
//Sets all display options
|
||||
$feed->set_display_options( array(
|
||||
'display_start' => $feed_options['display_start'],
|
||||
'display_end' => $feed_options['display_end'],
|
||||
'display_location' => $feed_options['display_location'],
|
||||
'display_desc' => $feed_options['display_desc'],
|
||||
'display_link' => $feed_options['display_link'],
|
||||
'display_start_text' => $feed_options['display_start_text'],
|
||||
'display_end_text' => $feed_options['display_end_text'],
|
||||
'display_location_text' => $feed_options['display_location_text'],
|
||||
'display_desc_text' => $feed_options['display_desc_text'],
|
||||
'display_desc_limit' => $feed_options['display_desc_limit'],
|
||||
'display_link_text' => $feed_options['display_link_text'],
|
||||
'display_link_target' => $feed_options['display_link_target'],
|
||||
'display_separator' => $feed_options['display_separator']
|
||||
) );
|
||||
|
||||
$feed->set_use_builder( ( 'true' == $feed_options['use_builder'] ) ? true : false );
|
||||
$feed->set_builder( $feed_options['builder'] );
|
||||
|
||||
//Parse the feed
|
||||
$feed->init();
|
||||
|
||||
//Add feed object to array of feeds
|
||||
$this->feeds[$single_feed] = $feed;
|
||||
}
|
||||
}
|
||||
|
||||
$this->merged_feed_data = array();
|
||||
|
||||
//Merge the feeds together into one array of events
|
||||
foreach ( $this->feeds as $feed_id => $feed ) {
|
||||
$errors_occurred = $feed->error();
|
||||
|
||||
if ( false === $errors_occurred )
|
||||
$this->merged_feed_data = array_merge( $this->merged_feed_data, $feed->get_events() );
|
||||
else
|
||||
$this->errors[$feed_id] = $errors_occurred;
|
||||
}
|
||||
|
||||
//Sort the items into date order
|
||||
if ( ! empty( $this->merged_feed_data ) )
|
||||
usort( $this->merged_feed_data, array( $this, 'compare' ) );
|
||||
}
|
||||
|
||||
//Comparison function for use when sorting merged feed data (with usort)
|
||||
function compare( $event1, $event2 ) {
|
||||
//Sort ascending or descending
|
||||
if ( 'asc' == $this->sort_order )
|
||||
return $event1->get_start_time() - $event2->get_start_time();
|
||||
|
||||
return $event2->get_start_time() - $event1->get_start_time();
|
||||
}
|
||||
|
||||
//Returns number of errors that have occurred
|
||||
function get_num_errors() {
|
||||
return count( $this->errors );
|
||||
}
|
||||
|
||||
//Outputs a message describing each error that has occurred
|
||||
function error_messages() {
|
||||
$message = '<p>' . __( '1 or more of your feeds could not be displayed. The following errors occurred:', GCE_TEXT_DOMAIN ) . '</p><ul>';
|
||||
|
||||
foreach ( $this->errors as $feed_id => $error ) {
|
||||
$message .= '<li><strong>' . sprintf( __( 'Feed %s:', GCE_TEXT_DOMAIN ), $feed_id ) . '</strong> ' . $error . '</li>';
|
||||
}
|
||||
|
||||
return $message . '</ul>';
|
||||
}
|
||||
|
||||
//Returns array of days with events, with sub-arrays of events for that day
|
||||
function get_event_days() {
|
||||
$event_days = array();
|
||||
|
||||
//Total number of events retrieved
|
||||
$count = count( $this->merged_feed_data );
|
||||
|
||||
//If maximum events to display is 0 (unlimited) set $max to 1, otherwise use maximum of events specified by user
|
||||
$max = ( 0 == $this->max_events_display ) ? 1 : $this->max_events_display;
|
||||
|
||||
//Loop through entire array of events, or until maximum number of events to be displayed has been reached
|
||||
for ( $i = 0; $i < $count && $max > 0; $i++ ) {
|
||||
$event = $this->merged_feed_data[$i];
|
||||
|
||||
//Check that event end time isn't before start time of feed (ignores events from before start time that may have been inadvertently retrieved)
|
||||
if ( $event->get_end_time() > $event->get_feed()->get_feed_start() ) {
|
||||
foreach ( $event->get_days() as $day ) {
|
||||
$event_days[$day][] = $event;
|
||||
}
|
||||
|
||||
//If maximum events to display isn't 0 (unlimited) decrement $max counter
|
||||
if ( 0 != $this->max_events_display )
|
||||
$max--;
|
||||
}
|
||||
}
|
||||
|
||||
return $event_days;
|
||||
}
|
||||
|
||||
//Returns grid markup
|
||||
function get_grid ( $year = null, $month = null, $ajaxified = false ) {
|
||||
require_once 'php-calendar.php';
|
||||
|
||||
$time_now = current_time( 'timestamp' );
|
||||
|
||||
//If year and month have not been passed as paramaters, use current month and year
|
||||
if( ! isset( $year ) )
|
||||
$year = date( 'Y', $time_now );
|
||||
|
||||
if( ! isset( $month ) )
|
||||
$month = date( 'm', $time_now );
|
||||
|
||||
//Get timestamps for the start and end of current month
|
||||
$current_month_start = mktime( 0, 0, 0, date( 'm', $time_now ), 1, date( 'Y', $time_now ) );
|
||||
$current_month_end = mktime( 0, 0, 0, date( 'm', $time_now ) + 1, 1, date( 'Y', $time_now ) );
|
||||
|
||||
//Get timestamps for the start and end of the month to be displayed in the grid
|
||||
$display_month_start = mktime( 0, 0, 0, $month, 1, $year );
|
||||
$display_month_end = mktime( 0, 0, 0, $month + 1, 1, $year );
|
||||
|
||||
//It should always be possible to navigate to the current month, even if it doesn't have any events
|
||||
//So, if the display month is before the current month, set $nav_next to true, otherwise false
|
||||
//If the display month is after the current month, set $nav_prev to true, otherwise false
|
||||
$nav_next = ( $display_month_start < $current_month_start );
|
||||
$nav_prev = ( $display_month_start >= $current_month_end );
|
||||
|
||||
//Get events data
|
||||
$event_days = $this->get_event_days();
|
||||
|
||||
//If event_days is empty, then there are no events in the feed(s), so set ajaxified to false (Prevents AJAX calendar from allowing to endlessly click through months with no events)
|
||||
if ( empty( $event_days ) )
|
||||
$ajaxified = false;
|
||||
|
||||
$today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) );
|
||||
|
||||
$i = 1;
|
||||
|
||||
foreach ( $event_days as $key => $event_day ) {
|
||||
//If event day is in the month and year specified (by $month and $year)
|
||||
if ( $key >= $display_month_start && $key < $display_month_end ) {
|
||||
//Create array of CSS classes. Add gce-has-events
|
||||
$css_classes = array( 'gce-has-events' );
|
||||
|
||||
//Create markup for display
|
||||
$markup = '<div class="gce-event-info">';
|
||||
|
||||
//If title option has been set for display, add it
|
||||
if ( isset( $this->title ) )
|
||||
$markup .= '<div class="gce-tooltip-title">' . $this->title . ' ' . date_i18n( $event_day[0]->get_feed()->get_date_format(), $key ) . '</div>';
|
||||
|
||||
$markup .= '<ul>';
|
||||
|
||||
foreach ( $event_day as $num_in_day => $event ) {
|
||||
$feed_id = $event->get_feed()->get_feed_id();
|
||||
$markup .= '<li class="gce-tooltip-feed-' . $feed_id . '">' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '</li>';
|
||||
|
||||
//Add CSS class for the feed from which this event comes. If there are multiple events from the same feed on the same day, the CSS class will only be added once.
|
||||
$css_classes['feed-' . $feed_id] = 'gce-feed-' . $feed_id;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$markup .= '</ul></div>';
|
||||
|
||||
//If number of CSS classes is greater than 2 ('gce-has-events' plus one specific feed class) then there must be events from multiple feeds on this day, so add gce-multiple CSS class
|
||||
if ( count( $css_classes ) > 2 )
|
||||
$css_classes[] = 'gce-multiple';
|
||||
|
||||
//If event day is today, add gce-today CSS class, otherwise add past or future class
|
||||
if ( $key == $today )
|
||||
$css_classes[] = 'gce-today gce-today-has-events';
|
||||
elseif ( $key < $today )
|
||||
$css_classes[] = 'gce-day-past';
|
||||
else
|
||||
$css_classes[] = 'gce-day-future';
|
||||
|
||||
//Change array entry to array of link href, CSS classes, and markup for use in gce_generate_calendar (below)
|
||||
$event_days[$key] = array( null, implode( ' ', $css_classes ), $markup );
|
||||
} elseif ( $key < $display_month_start ) {
|
||||
//This day is before the display month, so set $nav_prev to true. Remove the day from $event_days, as it's no use for displaying this month
|
||||
$nav_prev = true;
|
||||
unset( $event_days[$key] );
|
||||
} else {
|
||||
//This day is after the display month, so set $nav_next to true. Remove the day from $event_days, as it's no use for displaying this month
|
||||
$nav_next = true;
|
||||
unset( $event_days[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
//Ensures that gce-today CSS class is added even if there are no events for 'today'. A bit messy :(
|
||||
if ( ! isset( $event_days[$today] ) )
|
||||
$event_days[$today] = array( null, 'gce-today gce-today-no-events', null );
|
||||
|
||||
$pn = array();
|
||||
|
||||
//Only add previous / next functionality if AJAX grid is enabled
|
||||
if ( $ajaxified ) {
|
||||
//If there are events to display in a previous month, add previous month link
|
||||
$prev_key = ( $nav_prev ) ? '«' : ' ';
|
||||
$prev = ( $nav_prev ) ? date( 'm-Y', mktime( 0, 0, 0, $month - 1, 1, $year ) ) : null;
|
||||
|
||||
//If there are events to display in a future month, add next month link
|
||||
$next_key = ( $nav_next ) ? '»' : ' ';
|
||||
$next = ( $nav_next ) ? date( 'm-Y', mktime( 0, 0, 0, $month + 1, 1, $year ) ) : null;
|
||||
|
||||
//Array of previous and next link stuff for use in gce_generate_calendar (below)
|
||||
$pn = array( $prev_key => $prev, $next_key => $next );
|
||||
}
|
||||
|
||||
//Generate the calendar markup and return it
|
||||
return gce_generate_calendar( $year, $month, $event_days, 1, null, $this->start_of_week, $pn );
|
||||
}
|
||||
|
||||
function get_list( $grouped = false ) {
|
||||
$time_now = current_time( 'timestamp' );
|
||||
|
||||
$event_days = $this->get_event_days();
|
||||
|
||||
//If event_days is empty, there are no events in the feed(s), so return a message indicating this
|
||||
if( empty( $event_days) )
|
||||
return '<p>' . __( 'There are currently no events to display.', GCE_TEXT_DOMAIN ) . '</p>';
|
||||
|
||||
$today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) );
|
||||
|
||||
$i = 1;
|
||||
|
||||
$markup = '<ul class="gce-list">';
|
||||
|
||||
foreach ( $event_days as $key => $event_day ) {
|
||||
//If this is a grouped list, add the date title and begin the nested list for this day
|
||||
if ( $grouped ) {
|
||||
$markup .=
|
||||
'<li' . ( ( $key == $today ) ? ' class="gce-today"' : '' ) . '>' .
|
||||
'<div class="gce-list-title">' . $this->title . ' ' . date_i18n( $event_day[0]->get_feed()->get_date_format(), $key ) . '</div>' .
|
||||
'<ul>';
|
||||
}
|
||||
|
||||
foreach ( $event_day as $num_in_day => $event ) {
|
||||
//Create the markup for this event
|
||||
$markup .=
|
||||
'<li class="gce-feed-' . $event->get_feed()->get_feed_id() . '">' .
|
||||
//If this isn't a grouped list and a date title should be displayed, add the date title
|
||||
( ( ! $grouped && isset( $this->title ) ) ? '<div class="gce-list-title">' . $this->title . ' ' . date_i18n( $event->get_feed()->get_date_format(), $key ) . '</div>' : '' ) .
|
||||
//Add the event markup
|
||||
$event->get_event_markup( 'list', $num_in_day, $i ) .
|
||||
'</li>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
//If this is a grouped list, close the nested list for this day
|
||||
if ( $grouped )
|
||||
$markup .= '</ul></li>';
|
||||
}
|
||||
|
||||
$markup .= '</ul>';
|
||||
|
||||
return $markup;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
# PHP Calendar (version 2.3), written by Keith Devens
|
||||
# http://keithdevens.com/software/php_calendar
|
||||
# see example at http://keithdevens.com/weblog
|
||||
# License: http://keithdevens.com/software/license
|
||||
|
||||
/*
|
||||
Changes made to original PHP Calendar script by me (Ross Hanney):
|
||||
|
||||
- Renamed CSS classes to fit with my plugin
|
||||
- Slight modification of lines 63-71 to use Unix timestamp rather than day number
|
||||
- Renamed function to prevent conflicts
|
||||
- Replaced strftime with date_i18n
|
||||
- Use of $wp_locale to get weekday initials
|
||||
- Replaced htmlentities() with esc_attr() and esc_html()
|
||||
- Other small markup changes
|
||||
- Replaced gmmktime() with mktime()
|
||||
*/
|
||||
|
||||
function gce_generate_calendar( $year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array() ) {
|
||||
global $wp_locale;
|
||||
|
||||
$first_of_month = mktime( 0, 0, 0, $month, 1, $year );
|
||||
#remember that mktime will automatically correct if invalid dates are entered
|
||||
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
|
||||
# this provides a built in "rounding" feature to generate_calendar()
|
||||
|
||||
$day_names = array(); #generate all the day names according to the current locale
|
||||
for ( $n = 0, $t = ( 3 + $first_day ) * 86400; $n < 7; $n++, $t += 86400 ) { #January 4, 1970 was a Sunday
|
||||
$day_names[$n]['full'] = date_i18n( 'l', $t, true );
|
||||
$day_names[$n]['initial'] = $wp_locale->get_weekday_initial( date_i18n( 'l', $t, true ) );
|
||||
}
|
||||
|
||||
list( $month, $year, $month_name, $weekday ) = explode( ',', date_i18n( 'm, Y, F, w', $first_of_month ) );
|
||||
$weekday = ( $weekday + 7 - $first_day ) % 7; #adjust for $first_day
|
||||
$title = esc_html( $month_name ) . ' ' . $year; #note that some locales don't capitalize month and day names
|
||||
|
||||
#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
|
||||
list( $p, $pl ) = each( $pn );
|
||||
list( $n, $nl ) = each( $pn ); #previous and next links, if applicable
|
||||
|
||||
if ( $p )
|
||||
$p = '<span class="gce-prev">' . ( ( $pl ) ? ( '<a class="gce-change-month" title="Previous month" name="' . $pl . '">' . $p . '</a>' ) : $p ) . '</span> ';
|
||||
if ( $n )
|
||||
$n = ' <span class="gce-next">' . ( ( $nl ) ? ( '<a class="gce-change-month" title="Next month" name="' . $nl . '">' . $n . '</a>' ) : $n ) . '</span>';
|
||||
|
||||
$calendar = '<table class="gce-calendar">' . "\n" . '<caption class="gce-caption">' . $p . '<span class="gce-month-title">' . ( ( $month_href ) ? ( '<a href="' . esc_attr( $month_href ) . '">' . $title . '</a>' ) : $title ) . '</span>' . $n . "</caption>\n<tr>";
|
||||
|
||||
if ( $day_name_length ) { #if the day names should be shown ($day_name_length > 0)
|
||||
#if day_name_length is >3, the full name of the day will be printed
|
||||
foreach ( $day_names as $d ) {
|
||||
$calendar .= '<th><abbr title="' . esc_attr( $d['full'] ) . '">' . esc_html( $d['initial'] ) . '</abbr></th>';
|
||||
}
|
||||
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
|
||||
$time_now = current_time( 'timestamp' );
|
||||
$today = mktime( 0, 0, 0, date( 'm', $time_now ), date( 'd', $time_now ), date( 'Y', $time_now ) );
|
||||
|
||||
if ( $weekday > 0 ) $calendar .= '<td colspan="' . $weekday . '"> </td>'; #initial 'empty' days
|
||||
for ( $day = 1, $days_in_month = date( 't', $first_of_month ); $day <= $days_in_month; $day++, $weekday++ ) {
|
||||
if ( 7 == $weekday ) {
|
||||
$weekday = 0; #start a new week
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
|
||||
$timestamp = mktime( 0, 0, 0, $month, $day, $year );
|
||||
|
||||
if ( isset( $days[$timestamp] ) && is_array( $days[$timestamp] ) ) {
|
||||
list( $link, $classes, $content ) = $days[$timestamp];
|
||||
$calendar .= '<td' . ( ( $classes ) ? ( ' class="' . $classes . '">' ) : '>' ) . ( ( $link ) ? ( '<a href="' . $link . '"><span class="gce-day-number">' . $day . '</span></a>' . $content ) : '<span class="gce-day-number">' . $day . '</span>' . $content ) . '</td>';
|
||||
}else{
|
||||
$css_class = ( $timestamp < $time_now ) ? 'gce-day-past' : 'gce-day-future';
|
||||
$calendar .= '<td class="' . $css_class . '"><span class="gce-day-number">' . $day . '</span></td>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 7 != $weekday ) $calendar .= '<td colspan="' . ( 7 - $weekday ) . '"> </td>'; #remaining "empty" days
|
||||
|
||||
return $calendar . "</tr>\n</table>\n";
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,29 @@
|
||||
function correct_options(){
|
||||
val = jQuery('select[name="gce_options[use_builder]"]').val();
|
||||
|
||||
if(val == 'true'){
|
||||
jQuery('.gce-simple-display-options').next('.form-table').hide();
|
||||
jQuery('.gce-simple-display-options').hide();
|
||||
jQuery('.gce-simple-display-options').prev('h3').hide();
|
||||
|
||||
jQuery('.gce-event-builder').next('.form-table').show();
|
||||
jQuery('.gce-event-builder').show();
|
||||
jQuery('.gce-event-builder').prev('h3').show();
|
||||
}else{
|
||||
jQuery('.gce-simple-display-options').next('.form-table').show();
|
||||
jQuery('.gce-simple-display-options').show();
|
||||
jQuery('.gce-simple-display-options').prev('h3').show();
|
||||
|
||||
jQuery('.gce-event-builder').next('.form-table').hide();
|
||||
jQuery('.gce-event-builder').hide();
|
||||
jQuery('.gce-event-builder').prev('h3').hide();
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
correct_options();
|
||||
|
||||
jQuery('select[name="gce_options[use_builder]"]').change(function(e){
|
||||
correct_options();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,45 @@
|
||||
function gce_ajaxify(target, feed_ids, max_events, title_text, type){
|
||||
//Add click event to change month links
|
||||
jQuery('#' + target + ' .gce-change-month').click(function(){
|
||||
//Extract month and year
|
||||
var month_year = jQuery(this).attr('name').split('-', 2);
|
||||
//Add loading text to table caption
|
||||
jQuery('#' + target + ' caption').html(GoogleCalendarEvents.loading);
|
||||
//Send AJAX request
|
||||
jQuery.get(GoogleCalendarEvents.ajaxurl,{
|
||||
action:'gce_ajax',
|
||||
gce_type:type,
|
||||
gce_feed_ids:feed_ids,
|
||||
gce_title_text:title_text,
|
||||
gce_widget_id:target,
|
||||
gce_max_events:max_events,
|
||||
gce_month:month_year[0],
|
||||
gce_year:month_year[1]
|
||||
}, function(data){
|
||||
//Replace existing data with returned AJAX data
|
||||
if(type == 'widget'){
|
||||
jQuery('#' + target).html(data);
|
||||
}else{
|
||||
jQuery('#' + target).replaceWith(data);
|
||||
}
|
||||
gce_tooltips('#' + target + ' .gce-has-events');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function gce_tooltips(target_items){
|
||||
jQuery(target_items).each(function(){
|
||||
//Add qtip to all target items
|
||||
jQuery(this).qtip({
|
||||
content: jQuery(this).children('.gce-event-info'),
|
||||
position: { corner: { target: 'center', tooltip: 'bottomLeft' }, adjust: { screen: true } },
|
||||
hide: { fixed: true, delay: 100, effect: { length: 0 } },
|
||||
show: { solo: true, delay: 0, effect: { length: 0 } },
|
||||
style: { padding: "0", classes: { tooltip: 'gce-qtip', tip: 'gce-qtip-tip', title: 'gce-qtip-title', content: 'gce-qtip-content', active: 'gce-qtip-active' }, border: { width: 0 } }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
gce_tooltips('.gce-has-events');
|
||||
});
|
||||
15
src/wp-content/plugins/google-calendar-events/js/jquery-qtip.js
vendored
Normal file
@ -0,0 +1,500 @@
|
||||
# Translation of the WordPress plugin Google Calendar Events 0.4 by Ross Hanney.
|
||||
# Copyright (C) 2010 Ross Hanney
|
||||
# This file is distributed under the same license as the Google Calendar Events package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Google Calendar Events 0.4\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/google-calendar-events\n"
|
||||
"POT-Creation-Date: 2010-08-19 10:31+0000\n"
|
||||
"PO-Revision-Date: 2010-08-31 09:01+0100\n"
|
||||
"Last-Translator: Takács Dániel <daniel.takacs@gmail.com>\n"
|
||||
"Language-Team: Hungarian <daniel.takacs@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Hungarian\n"
|
||||
"X-Poedit-Country: Hungary\n"
|
||||
|
||||
#: admin/add.php:9
|
||||
msgid "Add a Feed"
|
||||
msgstr "Csatorna hozzáadása"
|
||||
|
||||
#: admin/add.php:11
|
||||
#: admin/delete.php:11
|
||||
#: admin/edit.php:11
|
||||
msgid "Feed ID"
|
||||
msgstr "Csatorna azonosítója"
|
||||
|
||||
#: admin/add.php:12
|
||||
#: admin/delete.php:12
|
||||
#: admin/edit.php:12
|
||||
msgid "Feed Title"
|
||||
msgstr "Csatorna címe"
|
||||
|
||||
#: admin/add.php:13
|
||||
#: admin/edit.php:13
|
||||
msgid "Feed URL"
|
||||
msgstr "Csatorna URL"
|
||||
|
||||
#: admin/add.php:14
|
||||
#: admin/edit.php:14
|
||||
msgid "Retrieve past events for current month?"
|
||||
msgstr "A jelenlegi hónapban történt, de már eltelt eseményeket is lekérdezzem?"
|
||||
|
||||
#: admin/add.php:15
|
||||
#: admin/edit.php:15
|
||||
msgid "Maximum number of events to retrieve"
|
||||
msgstr "A lekérdezendő események maximális száma"
|
||||
|
||||
#: admin/add.php:16
|
||||
#: admin/edit.php:16
|
||||
msgid "Number of days in the future to retrieve events for"
|
||||
msgstr "A lekérdezendő következő napok száma"
|
||||
|
||||
#: admin/add.php:17
|
||||
#: admin/edit.php:17
|
||||
msgid "Date format"
|
||||
msgstr "Dátum formátuma"
|
||||
|
||||
#: admin/add.php:18
|
||||
#: admin/edit.php:18
|
||||
msgid "Time format"
|
||||
msgstr "Idő formátuma"
|
||||
|
||||
#: admin/add.php:19
|
||||
#: admin/edit.php:19
|
||||
msgid "Timezone adjustment"
|
||||
msgstr "Időzóna beállítása"
|
||||
|
||||
#: admin/add.php:20
|
||||
#: admin/edit.php:20
|
||||
msgid "Cache duration"
|
||||
msgstr "Tároló frissítése"
|
||||
|
||||
#: admin/add.php:21
|
||||
#: admin/edit.php:21
|
||||
msgid "Show multiple day events on each day?"
|
||||
msgstr "A több napos események minden nap külön látszódjanak?"
|
||||
|
||||
#: admin/add.php:23
|
||||
#: admin/edit.php:23
|
||||
msgid "Display Options"
|
||||
msgstr "Megjelenítési beállítások"
|
||||
|
||||
#: admin/add.php:24
|
||||
#: admin/edit.php:24
|
||||
msgid "Display start time / date?"
|
||||
msgstr "Látszódjon a kezdő idő / dátum?"
|
||||
|
||||
#: admin/add.php:25
|
||||
#: admin/edit.php:25
|
||||
msgid "Display end time / date?"
|
||||
msgstr "Látszódjon a befejező idő / dátum?"
|
||||
|
||||
#: admin/add.php:26
|
||||
#: admin/edit.php:26
|
||||
msgid "Separator text / characters"
|
||||
msgstr "Elválasztó szöveg / karakterek"
|
||||
|
||||
#: admin/add.php:27
|
||||
#: admin/edit.php:27
|
||||
msgid "Display location?"
|
||||
msgstr "Látszódjon a hely?"
|
||||
|
||||
#: admin/add.php:28
|
||||
#: admin/edit.php:28
|
||||
msgid "Display description?"
|
||||
msgstr "Látszódjon a leírás?"
|
||||
|
||||
#: admin/add.php:29
|
||||
#: admin/edit.php:29
|
||||
msgid "Display link to event?"
|
||||
msgstr "Látszódjon az eseményre mutató linK:"
|
||||
|
||||
#: admin/add.php:34
|
||||
msgid "Enter the feed details below, then click the Add Feed button."
|
||||
msgstr "Addja meg a csatorna részleteit, majd nyomja meg a Csatorna hozzáadása gombot."
|
||||
|
||||
#: admin/add.php:58
|
||||
#: admin/edit.php:53
|
||||
msgid "Anything you like. 'Upcoming Club Events', for example."
|
||||
msgstr "Ami tetszik, pl. \"A következő Klub programok.\""
|
||||
|
||||
#: admin/add.php:67
|
||||
#: admin/edit.php:64
|
||||
msgid "This will probably be something like: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/full</code>."
|
||||
msgstr "Ez valahogy így fog kinézni: <code>http://www.google.com/calendar/feeds/your-email@gmail.com/public/full</code>."
|
||||
|
||||
#: admin/add.php:76
|
||||
#: admin/edit.php:75
|
||||
msgid "If checked, events will be retrieved from the first of this month onwards. If unchecked, events will be retrieved from today onwards."
|
||||
msgstr "Ha be van jelölve, akkor a jelenlegi hónap első napjától lesznek listázva az események, ha nem, akkor csak az adott naptól."
|
||||
|
||||
#: admin/add.php:85
|
||||
#: admin/edit.php:86
|
||||
msgid "The default number of events to retrieve from a Google Calendar feed is 25, but you may want less for a list, or more for a calendar grid."
|
||||
msgstr "A Google Naptár csatornájának alapértelmezett beállítása 25 esemény lekérdezése egyszerre, de ennél lehet többet és kevesebbet is beállítani."
|
||||
|
||||
#: admin/add.php:94
|
||||
#: admin/edit.php:97
|
||||
msgid "The number of days in the future to retrieve events for (from 12:00am today). Leave blank for no day limit."
|
||||
msgstr "Ahány napot lekérdezzen a jövőben (ma déli 12 órától kezdve). Hagyja üresen, ha nem akar limitet beállítani."
|
||||
|
||||
#: admin/add.php:103
|
||||
#: admin/edit.php:108
|
||||
msgid "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</a>. Leave this blank if you'd rather stick with the default format for your blog."
|
||||
msgstr "<a href=\"http://php.net/manual/en/function.date.php\">PHP dátum formátum</a>. Hagyja üresen, ha a honlap alapértelmezését szeretné meghagyni."
|
||||
|
||||
#: admin/add.php:112
|
||||
#: admin/edit.php:119
|
||||
msgid "In <a href=\"http://php.net/manual/en/function.date.php\">PHP date format</a>. Again, leave this blank to stick with the default."
|
||||
msgstr "<a href=\"http://php.net/manual/en/function.date.php\">PHP dátum formátum</a>. Hagyja üresen ezt is, ha a honlap alapértelmezését szeretné meghagyni."
|
||||
|
||||
#: admin/add.php:125
|
||||
#: admin/edit.php:134
|
||||
msgid "If you are having problems with dates and times displaying in the wrong timezone, select a city in your required timezone here."
|
||||
msgstr "Ha valami probléma adódik a dátumokkal és az idővel, itt tudja kiválasztani az időzónájának megfelelő várost."
|
||||
|
||||
#: admin/add.php:134
|
||||
#: admin/edit.php:145
|
||||
msgid "The length of time, in seconds, to cache the feed (43200 = 12 hours). If this feed changes regularly, you may want to reduce the cache duration."
|
||||
msgstr "A tároló lejáratának ideje, másodpercben (43200 másodperc = 1 óra). Ha a csatorna rendszeresen frissül, érdemes kisebb időközre állítani."
|
||||
|
||||
#: admin/add.php:143
|
||||
#: admin/edit.php:156
|
||||
msgid "Show events that span multiple days on each day that they span (There are some limitations of this feature to be aware of)."
|
||||
msgstr "A több napon keresztül tartó események az időtartamuk alatt minden egyes nap külön jelenjenek meg. (Néhány korlátozást figyelembe kell venni ennél a lehetőségnél.)"
|
||||
|
||||
#: admin/add.php:154
|
||||
#: admin/edit.php:167
|
||||
msgid "These settings control what information will be displayed for this feed in the tooltip (for grids), or in a list."
|
||||
msgstr "Ezek a beállítások adják meg azt, hogy milyen információk jelenjenek meg a csatornáról a tippek közt (a naptárdobozban) vagy egy listában."
|
||||
|
||||
#: admin/add.php:155
|
||||
#: admin/edit.php:168
|
||||
msgid "You can use some HTML in the text fields, but ensure it is valid or things might go wonky. Text fields can be empty too."
|
||||
msgstr "Használhat HTML-t is a szövegmezőkben, de mindig győződjön meg, hogy szabványos kódot adott meg, különben könnyen összekuszálódhatnak a dolgok. A szövegmezők üresen is maradhatnak."
|
||||
|
||||
#: admin/add.php:161
|
||||
#: admin/edit.php:176
|
||||
msgid "Select how to display the start date / time."
|
||||
msgstr "Válassza ki, hogyan jelenjen meg a kezdő idő / dátum."
|
||||
|
||||
#: admin/add.php:164
|
||||
#: admin/edit.php:179
|
||||
msgid "Don't display start time or date"
|
||||
msgstr "Ne mutassa a kezdő időt vagy dátumot"
|
||||
|
||||
#: admin/add.php:165
|
||||
#: admin/edit.php:180
|
||||
msgid "Display start time"
|
||||
msgstr "Mutassa a kezdő időt"
|
||||
|
||||
#: admin/add.php:166
|
||||
#: admin/edit.php:181
|
||||
msgid "Display start date"
|
||||
msgstr "Mutassa a kezdő dátumot"
|
||||
|
||||
#: admin/add.php:167
|
||||
#: admin/edit.php:182
|
||||
msgid "Display start time and date (in that order)"
|
||||
msgstr "Mutassa a kezdő időt és dátumot (ebben a sorrendben)"
|
||||
|
||||
#: admin/add.php:168
|
||||
#: admin/edit.php:183
|
||||
msgid "Display start date and time (in that order)"
|
||||
msgstr "Mutassa a kezdő dátumot és időt (ebben a sorrendben)"
|
||||
|
||||
#: admin/add.php:171
|
||||
#: admin/edit.php:186
|
||||
msgid "Text to display before the start time."
|
||||
msgstr "A kezdő idő előtt megjelenítendő szöveg."
|
||||
|
||||
#: admin/add.php:179
|
||||
#: admin/edit.php:196
|
||||
msgid "Select how to display the end date / time."
|
||||
msgstr "Válassza ki, hogyan jelenjen meg a befejező idő / dátum."
|
||||
|
||||
#: admin/add.php:182
|
||||
#: admin/edit.php:199
|
||||
msgid "Don't display end time or date"
|
||||
msgstr "Ne mutassa a befejező időt vagy dátumot"
|
||||
|
||||
#: admin/add.php:183
|
||||
#: admin/edit.php:200
|
||||
msgid "Display end time"
|
||||
msgstr "Mutassa a befejező időt"
|
||||
|
||||
#: admin/add.php:184
|
||||
#: admin/edit.php:201
|
||||
msgid "Display end date"
|
||||
msgstr "Mutassa a befejező dátumot"
|
||||
|
||||
#: admin/add.php:185
|
||||
#: admin/edit.php:202
|
||||
msgid "Display end time and date (in that order)"
|
||||
msgstr "Mutassa a befejező időt és dátumot (ebben a sorrendben)"
|
||||
|
||||
#: admin/add.php:186
|
||||
#: admin/edit.php:203
|
||||
msgid "Display end date and time (in that order)"
|
||||
msgstr "Mutassa a befejező dátumot és időt (ebben a sorrendben)"
|
||||
|
||||
#: admin/add.php:189
|
||||
#: admin/edit.php:206
|
||||
msgid "Text to display before the end time."
|
||||
msgstr "A befejező idő előtt megjelenítendő szöveg."
|
||||
|
||||
#: admin/add.php:197
|
||||
#: admin/edit.php:216
|
||||
msgid "If you have chosen to display both the time and date above, enter the text / characters to display between the time and date here (including any spaces)."
|
||||
msgstr "Ha azt választotta feljebb, hogy mind az idő, mind a dátum látszódjék, írja be az elválasztó szöveget / karaktereket, ami az idő és a dátum közt legyen (akármennyi szóközzel)."
|
||||
|
||||
#: admin/add.php:206
|
||||
#: admin/edit.php:227
|
||||
msgid "Show the location of events?"
|
||||
msgstr "Látszódjon az esemény helye?"
|
||||
|
||||
#: admin/add.php:208
|
||||
#: admin/edit.php:229
|
||||
msgid "Text to display before the location."
|
||||
msgstr "A hely előtt megjelenítendő szöveg."
|
||||
|
||||
#: admin/add.php:217
|
||||
msgid "Show the description of events? (URLs in the description will be made into links)."
|
||||
msgstr "Látszódjon az esemény leírása? (A leírásban lévő URL-ek linkként jelennek meg)."
|
||||
|
||||
#: admin/add.php:219
|
||||
#: admin/edit.php:242
|
||||
msgid "Text to display before the description."
|
||||
msgstr "A leírás előtt megjelenítendő szöveg."
|
||||
|
||||
#: admin/add.php:223
|
||||
#: admin/edit.php:246
|
||||
msgid "Maximum number of words to show from description. Leave blank for no limit."
|
||||
msgstr "A leírásból megjelenítendő szavak maximális száma. Hagyja üresen, ha nem akar limitet beállítani."
|
||||
|
||||
#: admin/add.php:232
|
||||
#: admin/edit.php:257
|
||||
msgid "Show a link to the Google Calendar page for an event?"
|
||||
msgstr "Mutasson link a Google Naptárra az eseményeknél?"
|
||||
|
||||
#: admin/add.php:235
|
||||
#: admin/edit.php:260
|
||||
msgid "Links open in a new window / tab?"
|
||||
msgstr "A link új ablakon / fülön nyíljon?"
|
||||
|
||||
#: admin/add.php:237
|
||||
#: admin/edit.php:262
|
||||
msgid "The link text to be displayed."
|
||||
msgstr "A megjelenítendő link szövege"
|
||||
|
||||
#: admin/delete.php:9
|
||||
#: google-calendar-events.php:201
|
||||
msgid "Delete Feed"
|
||||
msgstr "Csatorna törlése"
|
||||
|
||||
#: admin/delete.php:17
|
||||
msgid "Are you want you want to delete this feed? (Remember to remove / adjust any widgets or shortcodes associated with this feed)."
|
||||
msgstr "Biztosan törölni akarja a csatornát? (Ne felejtse el eltávolítani vagy módosítani a csatornára hivatkozó összes dobozt vagy kódrészletet)."
|
||||
|
||||
#: admin/edit.php:9
|
||||
msgid "Edit Feed"
|
||||
msgstr "Csatorna szerkesztése"
|
||||
|
||||
#: admin/edit.php:34
|
||||
msgid "Make any changes you require to the feed details below, then click the Save Changes button."
|
||||
msgstr "Végezze el a szükséges módosításokat alább, majd nyomja meg a Változtatások mentése gombot."
|
||||
|
||||
#: admin/edit.php:240
|
||||
msgid "Show the description of events? (URLs in the description will be made into links)."
|
||||
msgstr "Látszódjon az esemény leírása? (A leírásban lévő URL-ek linkként jelennek meg)."
|
||||
|
||||
#: admin/main.php:2
|
||||
msgid "Add a New Feed"
|
||||
msgstr "Új csatorna hozzáadása"
|
||||
|
||||
#: admin/main.php:4
|
||||
msgid "Click here to add a new feed"
|
||||
msgstr "Kattintson ide új csatorna hozzáadásához"
|
||||
|
||||
#: admin/main.php:4
|
||||
#: google-calendar-events.php:186
|
||||
msgid "Add Feed"
|
||||
msgstr "Csatorna hozzáadása"
|
||||
|
||||
#: admin/main.php:7
|
||||
msgid "Current Feeds"
|
||||
msgstr "Jelenlegi csatornák"
|
||||
|
||||
#: admin/main.php:16
|
||||
msgid "You haven't added any Google Calendar feeds yet."
|
||||
msgstr "Még nem adott hozzá egyetlen Google Naptár csatornát sem."
|
||||
|
||||
#: admin/main.php:24
|
||||
#: admin/main.php:32
|
||||
msgid "ID"
|
||||
msgstr "Azonosító"
|
||||
|
||||
#: admin/main.php:25
|
||||
#: admin/main.php:33
|
||||
msgid "Title"
|
||||
msgstr "Cím"
|
||||
|
||||
#: admin/main.php:26
|
||||
#: admin/main.php:34
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
#: admin/main.php:47
|
||||
msgid "Edit"
|
||||
msgstr "Szerkeszt"
|
||||
|
||||
#: admin/main.php:47
|
||||
msgid "Delete"
|
||||
msgstr "Töröl"
|
||||
|
||||
#: admin/main.php:61
|
||||
msgid "General Options"
|
||||
msgstr "Beállítások"
|
||||
|
||||
#: admin/main.php:65
|
||||
msgid "Custom stylesheet URL"
|
||||
msgstr "Saját stíluslap elérési útvonala"
|
||||
|
||||
#: admin/main.php:67
|
||||
msgid ""
|
||||
"If you want to make changes to the default CSS, make a copy of <code>google-calendar-events/css/gce-style.css</code> on your server. Make any \r\n"
|
||||
"\t\t\t\tchanges to the copy. Enter the URL to the copied file below."
|
||||
msgstr ""
|
||||
"Ha szeretné megváltoztatni az eredeti CSS-t, készítsen egy másolatot a <code>google-calendar-events/css/gce-style.css</code> fájlról a szerveren. \r\n"
|
||||
"\t\t\t\tVégezze el a módosításokat, majd írja be a másolat URL-jét alább."
|
||||
|
||||
#: admin/main.php:73
|
||||
msgid "Add JavaScript to footer?"
|
||||
msgstr "Adhatok JavaScriptet a lábléchez?"
|
||||
|
||||
#: admin/main.php:75
|
||||
msgid "If you are having issues with tooltips not appearing or the AJAX functionality not working, try ticking the checkbox below."
|
||||
msgstr "Ha nem jelennek meg a tippek, vagy az AJAX-funkciók nem működnek, próbálkozzon az alábbi jelölőnégyzet kipipálásával."
|
||||
|
||||
#: admin/main.php:80
|
||||
msgid "Loading text"
|
||||
msgstr "Töltés közbeni szöveg"
|
||||
|
||||
#: admin/main.php:82
|
||||
msgid "Text to display while calendar data is loading (on AJAX requests)"
|
||||
msgstr "Az AJAX-kérések töltődése során megjelenő szöveg."
|
||||
|
||||
#: admin/main.php:91
|
||||
msgid "Save"
|
||||
msgstr "Mentés"
|
||||
|
||||
#: google-calendar-events.php:148
|
||||
msgid "Settings"
|
||||
msgstr "Beállítások"
|
||||
|
||||
#: google-calendar-events.php:163
|
||||
msgid "New Feed Added Successfully."
|
||||
msgstr "Az új csatorná sikeresen hozzáadta."
|
||||
|
||||
#: google-calendar-events.php:166
|
||||
msgid "Feed Details Updated Successfully."
|
||||
msgstr "A csatorna részletei sikeresen frissültek."
|
||||
|
||||
#: google-calendar-events.php:169
|
||||
msgid "Feed Deleted Successfully."
|
||||
msgstr "A csatorna sikeresen törlődött."
|
||||
|
||||
#. #-#-#-#-# plugin.pot (Google Calendar Events 0.3.1) #-#-#-#-#
|
||||
#. Plugin Name of the plugin/theme
|
||||
#: google-calendar-events.php:176
|
||||
#: widget/gce-widget.php:6
|
||||
msgid "Google Calendar Events"
|
||||
msgstr "Google Naptár Események"
|
||||
|
||||
#: google-calendar-events.php:187
|
||||
#: google-calendar-events.php:195
|
||||
#: google-calendar-events.php:202
|
||||
msgid "Cancel"
|
||||
msgstr "Mégsem"
|
||||
|
||||
#: google-calendar-events.php:194
|
||||
msgid "Save Changes"
|
||||
msgstr "Változások mentése"
|
||||
|
||||
#: google-calendar-events.php:353
|
||||
msgid "No valid Feed IDs have been entered for this shortcode. Please check that you have entered the IDs correctly and that the Feeds have not been deleted."
|
||||
msgstr "Nincs érvényes Csatornaazonosító megadva ehhez a kódrészlethez. Kérem, ellenőrizze, hogy az azonosítót helyesen adta-e meg, és hogy a csatornát nem törölte-e."
|
||||
|
||||
#: google-calendar-events.php:369
|
||||
#: widget/gce-widget.php:76
|
||||
msgid "No feeds have been added yet. You can add a feed in the Google Calendar Events settings."
|
||||
msgstr "Még nem adott meg csatornát. Csatornát a Google Naptár Események beállításánál tud hozzáadni."
|
||||
|
||||
#: google-calendar-events.php:428
|
||||
#: google-calendar-events.php:445
|
||||
#: widget/gce-widget.php:146
|
||||
#: widget/gce-widget.php:158
|
||||
#, php-format
|
||||
msgid "The following feeds were not parsed successfully: %s. Please check that the feed URLs are correct and that the feeds have public sharing enabled."
|
||||
msgstr "A következő csatornákat nem lehetett feldolgozni: %s. Kérem, ellenőrizze, hogy a csatornák URL-je helyes-e, és hogy a csatornák nyilvánossá lettek-e téve."
|
||||
|
||||
#: inc/gce-parser.php:213
|
||||
msgid "There are currently no upcoming events."
|
||||
msgstr "Nincs esemény a közeljövőben."
|
||||
|
||||
#: widget/gce-widget.php:6
|
||||
msgid "Display a list or calendar grid of events from one or more Google Calendar feeds you have added"
|
||||
msgstr "Listát vagy hagyományos naptárat jelenít meg a megadott Google Naptár csatornából vagy csatornákból."
|
||||
|
||||
#: widget/gce-widget.php:40
|
||||
msgid "No valid Feed IDs have been entered for this widget. Please check that you have entered the IDs correctly and that the Feeds have not been deleted."
|
||||
msgstr "Nincs érvényes azonosító adva ehhez a dobozhoz. Kérem, ellenőrizze, hogy helyesen adta-e meg az azonosítót, és hogy a csatoránt nem törölte-e."
|
||||
|
||||
#: widget/gce-widget.php:99
|
||||
msgid "No feeds have been added yet. You can add feeds in the Google Calendar Events settings."
|
||||
msgstr "Még nem adott meg csatornát. Csatornát a Google Naptár Események beállításánál tud hozzáadni."
|
||||
|
||||
#: widget/gce-widget.php:113
|
||||
msgid "Feed IDs to display in this widget, separated by commas (e.g. 1, 2, 4):"
|
||||
msgstr "A dobozban megjelenítendő csatornák azonosítója, vesszővel elválasztva (pl. 1, 2, 4):"
|
||||
|
||||
#: widget/gce-widget.php:117
|
||||
msgid "Display as:"
|
||||
msgstr "Megjelenítés mint:"
|
||||
|
||||
#: widget/gce-widget.php:119
|
||||
msgid "Calendar Grid"
|
||||
msgstr "Naptárdoboz"
|
||||
|
||||
#: widget/gce-widget.php:120
|
||||
msgid "Calendar Grid - with AJAX"
|
||||
msgstr "Naptárdoboz - AJAX"
|
||||
|
||||
#: widget/gce-widget.php:121
|
||||
msgid "List"
|
||||
msgstr "Lista"
|
||||
|
||||
#: widget/gce-widget.php:122
|
||||
msgid "List - grouped by date"
|
||||
msgstr "Lista dátum szerint csoportosítva"
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "http://www.rhanney.co.uk/plugins/google-calendar-events"
|
||||
msgstr "http://www.rhanney.co.uk/plugins/google-calendar-events"
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid "Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget."
|
||||
msgstr "Google Naptár csatornákat dolgoz fel és jeleníti meg naptárdobozként vagy listában a megadott oldalon, bejegyzésben vagy dobozban."
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Ross Hanney"
|
||||
msgstr "Ross Hanney"
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://www.rhanney.co.uk"
|
||||
msgstr "http://www.rhanney.co.uk"
|
||||
|
||||
288
src/wp-content/plugins/google-calendar-events/license.txt
Normal file
@ -0,0 +1,288 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
WRITTEN OFFER
|
||||
|
||||
The source code for any program binaries or compressed scripts that are
|
||||
included with WordPress can be freely obtained at the following URL:
|
||||
|
||||
http://wordpress.org/download/source/
|
||||
143
src/wp-content/plugins/google-calendar-events/readme.txt
Normal file
@ -0,0 +1,143 @@
|
||||
=== Google Calendar Events ===
|
||||
Contributors: rosshanney
|
||||
Donate link: http://www.rhanney.co.uk/plugins/google-calendar-events/#donate
|
||||
Tags: google, google calendar, calendar, event, events, ajax, widget
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.2
|
||||
Stable tag: 0.7
|
||||
|
||||
Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
|
||||
|
||||
== Description ==
|
||||
|
||||
Parses Google Calendar feeds and displays the events as a calendar grid or list on a page, post or widget.
|
||||
|
||||
= Features =
|
||||
|
||||
* Parses Google Calendar feeds to extract events
|
||||
* Displays events as a list or within a calendar grid
|
||||
* Events from multiple Google Calendar feeds can be shown in a single list / grid
|
||||
* Lists and grids can be displayed in posts, pages or within a widget
|
||||
* Options to change the number of events retrieved, date / time format, cache duration etc
|
||||
* Complete customisation of the event information displayed
|
||||
* Calendar grids can have the ability to change the month displayed
|
||||
|
||||
Please visit the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events) for how to get started and other help.
|
||||
|
||||
There is also a [demonstration page](http://www.rhanney.co.uk/plugins/google-calendar-events/gce-demo) showing the plugin in action.
|
||||
|
||||
[Changes in 0.7](http://www.rhanney.co.uk/2011/06/25/google-calendar-events-0-7).
|
||||
|
||||
== Installation ==
|
||||
|
||||
Use the automatic installer from within the WordPress admin, or:
|
||||
|
||||
1. Download the `.zip` file by clicking on the Download button on the right
|
||||
1. Unzip the file
|
||||
1. Upload the `google-calendar-events` directory to your `plugins` directory
|
||||
1. Go to the Plugins page from within the WordPress administration
|
||||
1. Click Activate for Google Calendar Events
|
||||
|
||||
After activation a new Google Calendar Events options menu will appear under Settings.
|
||||
|
||||
You can now start adding feeds. Visit the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events) for a more in-depth guide on getting started.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The main plugin admin screen.
|
||||
1. The add feed admin screen.
|
||||
1. A page showing a full page calendar grid and various widgets.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.7 =
|
||||
* Fixed bug causing event dates / times to be displayed in the wrong timezone
|
||||
* Changed the [link-path] Event Display Builder shortcode to [url]
|
||||
* Fixed an Opera specific CSS issue causing page lists to be hidden
|
||||
* Lists can now be displayed in descending or ascending order
|
||||
* Added [event-id] and [cal-id] Event Display Builder shortcodes
|
||||
* Added an offset parameter for date / time based Event Display Builder shortcodes
|
||||
* Added an autolink parameter for enabling / disabling automatic linking of URLs
|
||||
* Added gce-day-past or gce-day-future classes to calendar grid cells
|
||||
* Cleaned up CSS
|
||||
|
||||
= 0.6 =
|
||||
* Drastically reduced memory usage
|
||||
* Improved feed data caching system
|
||||
* Improved error reporting
|
||||
* General performance and efficiency improvements
|
||||
* Added a few more shortcodes to the event display builder
|
||||
* Other [miscellaneous changes / additions and bug fixes](http://www.rhanney.co.uk/2011/04/29/google-calendar-events-0-6)
|
||||
|
||||
= 0.5 =
|
||||
* Added [event display builder](http://www.rhanney.co.uk/plugins/google-calendar-events/event-display-builder) feature, which vastly improves the customization possibilities of the plugin. This feature encompasses many of the most requested features, such as:
|
||||
- All-day events can be handled differently than 'normal' events
|
||||
- Start and end times / dates can be displayed on the same line (as can any other event information)
|
||||
- HTML (and Markdown) entered in Google Calendar fields can be properly parsed
|
||||
* Start and end times for retrieval of events are now much more flexible
|
||||
* A custom error message for non-admin users can now be specified
|
||||
* No longer loads SimplePie when it is not required
|
||||
|
||||
= 0.4.1 =
|
||||
* Fix / workaround for the long-running timezone bug. Please take a look at [this](http://www.rhanney.co.uk/2011/01/16/google-calendar-events-0-4-1) for more information.
|
||||
* Added additional 'Maximum no. events to display' option to widget / shortcode (mainly to address a further issue caused by the above fix)
|
||||
* i18n related bug fix
|
||||
* Added support for widget_title filter (courtesy of [James](http://lunasea-studios.com))
|
||||
* Added Hungarian (hu_HU) translation ([danieltakacs](http://ek.klog.hu))
|
||||
* Now using minified version of jQuery qTip script
|
||||
|
||||
= 0.4 =
|
||||
* More control over how start and end dates / times are displayed
|
||||
* Events can now be limited to a specified timeframe (number of days)
|
||||
* Events on the same day in lists can now be shown under a single date title
|
||||
* JavaScript can now be added to the footer rather than the header, via an option
|
||||
* The 'Loading...' text can now be customized
|
||||
* Description text can now be limited to a specified number of words
|
||||
* Multi-day events can be shown on each day that they span ([sort of](http://www.rhanney.co.uk/2010/08/19/google-calendar-events-0-4#multiday))
|
||||
* Bug fixes
|
||||
* i18n / l10n fixes
|
||||
|
||||
= 0.3.1 =
|
||||
* l10n / i18n fixes. Dates should now be localized correctly and should maintain localization after an AJAX request
|
||||
* MU / Multi-site issues. Issues preventing adding of feeds have been addressed
|
||||
|
||||
= 0.3 =
|
||||
* Now allows events from multiple Google Calendar feeds to be displayed on a single calendar grid / list
|
||||
* Internationalization support added
|
||||
|
||||
= 0.2.1 =
|
||||
* Added option to allow 'More details' links to open in new window / tab.
|
||||
* Added option to choose a specific timezone for each feed
|
||||
* Line breaks in an event description will now be preserved
|
||||
* Fixed a bug casing the title to not be displayed on lists
|
||||
* Other minor bug fixes
|
||||
|
||||
= 0.2 =
|
||||
* Added customization options for how information is displayed.
|
||||
* Can now display: start time, end time and date, location, description and event link.
|
||||
* Tooltips now using qTip jQuery plugin.
|
||||
|
||||
= 0.1.4 =
|
||||
* More bug fixes.
|
||||
|
||||
= 0.1.3 =
|
||||
* Several bug fixes, including fixing JavaScript problems that prevented tooltips appearing.
|
||||
|
||||
= 0.1.2 =
|
||||
* Bug fixes.
|
||||
|
||||
= 0.1.1 =
|
||||
* Fix to prevent conflicts with other plugins.
|
||||
* Changes to readme.txt.
|
||||
|
||||
= 0.1 =
|
||||
* Initial release.
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 0.5 =
|
||||
Event retrieval date / time range is now much more flexible. Also adds event display builder, which allows much greater customization of the event information displayed.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
Please visit the [FAQ page](http://www.rhanney.co.uk/plugins/google-calendar-events/frequently-asked-questions). If you have further questions, leave a comment on the [plugin homepage](http://www.rhanney.co.uk/plugins/google-calendar-events), or [send me an email](http://www.rhanney.co.uk/contact).
|
||||
BIN
src/wp-content/plugins/google-calendar-events/screenshot-1.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/wp-content/plugins/google-calendar-events/screenshot-2.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/wp-content/plugins/google-calendar-events/screenshot-3.jpg
Normal file
|
After Width: | Height: | Size: 28 KiB |
19
src/wp-content/plugins/google-calendar-events/uninstall.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
|
||||
die();
|
||||
|
||||
$gce_options = get_option( 'gce_options' );
|
||||
|
||||
//Remove any cached feed data
|
||||
foreach ( $gce_options as $gce_feed ) {
|
||||
if ( isset( $gce_feed['id'] ) ) {
|
||||
delete_transient( 'gce_feed_' . $gce_feed['id'] );
|
||||
delete_transient( 'gce_feed_' . $gce_feed['id'] . '_url' );
|
||||
}
|
||||
}
|
||||
|
||||
//Delete plugin options
|
||||
delete_option( 'gce_options' );
|
||||
delete_option( 'gce_general' );
|
||||
delete_option( 'gce_version' );
|
||||
?>
|
||||
@ -0,0 +1,235 @@
|
||||
<?php
|
||||
class GCE_Widget extends WP_Widget {
|
||||
function GCE_Widget() {
|
||||
parent::WP_Widget(
|
||||
false,
|
||||
$name = __( 'Google Calendar Events', GCE_TEXT_DOMAIN ),
|
||||
array( 'description' => __( 'Display a list or calendar grid of events from one or more Google Calendar feeds you have added', GCE_TEXT_DOMAIN ) )
|
||||
);
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract( $args );
|
||||
|
||||
//Output before widget stuff
|
||||
echo $before_widget;
|
||||
|
||||
//Get saved feed options
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
//Check whether any feeds have been added yet
|
||||
if( is_array( $options ) && ! empty( $options ) ) {
|
||||
//Output title stuff
|
||||
$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', $instance['title'] );
|
||||
|
||||
if ( ! empty( $title ) )
|
||||
echo $before_title . $title . $after_title;
|
||||
|
||||
$no_feeds_exist = true;
|
||||
$feed_ids = array();
|
||||
|
||||
if ( '' != $instance['id'] ) {
|
||||
//Break comma delimited list of feed ids into array
|
||||
$feed_ids = explode( ',', str_replace( ' ', '', $instance['id'] ) );
|
||||
|
||||
//Check each id is an integer, if not, remove it from the array
|
||||
foreach ( $feed_ids as $key => $feed_id ) {
|
||||
if ( 0 == absint( $feed_id ) )
|
||||
unset( $feed_ids[$key] );
|
||||
}
|
||||
|
||||
//If at least one of the feed ids entered exists, set no_feeds_exist to false
|
||||
foreach ( $feed_ids as $feed_id ) {
|
||||
if ( isset($options[$feed_id] ) )
|
||||
$no_feeds_exist = false;
|
||||
}
|
||||
} else {
|
||||
foreach ( $options as $feed ) {
|
||||
$feed_ids[] = $feed['id'];
|
||||
}
|
||||
|
||||
$no_feeds_exist = false;
|
||||
}
|
||||
|
||||
//Check that at least one valid feed id has been entered
|
||||
if ( empty( $feed_ids ) || $no_feeds_exist ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
_e( 'No valid Feed IDs have been entered for this widget. Please check that you have entered the IDs correctly in the widget settings (Appearance > Widgets), and that the Feeds have not been deleted.', GCE_TEXT_DOMAIN );
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
echo $options['error'];
|
||||
}
|
||||
} else {
|
||||
//Turns feed_ids back into string or feed ids delimited by '-' ('1-2-3-4' for example)
|
||||
$feed_ids = implode( '-', $feed_ids );
|
||||
|
||||
$title_text = ( $instance['display_title'] ) ? $instance['display_title_text'] : null;
|
||||
$max_events = ( isset( $instance['max_events'] ) ) ? $instance['max_events'] : 0;
|
||||
$sort_order = ( isset( $instance['order'] ) ) ? $instance['order'] : 'asc';
|
||||
|
||||
//Output correct widget content based on display type chosen
|
||||
switch ( $instance['display_type'] ) {
|
||||
case 'grid':
|
||||
echo '<div class="gce-widget-grid" id="' . $args['widget_id'] . '-container">';
|
||||
//Output main widget content as grid (no AJAX)
|
||||
gce_widget_content_grid( $feed_ids, $title_text, $max_events, $args['widget_id'] . '-container' );
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'ajax':
|
||||
echo '<div class="gce-widget-grid" id="' . $args['widget_id'] . '-container">';
|
||||
//Output main widget content as grid (with AJAX)
|
||||
gce_widget_content_grid( $feed_ids, $title_text, $max_events, $args['widget_id'] . '-container', true );
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'list':
|
||||
echo '<div class="gce-widget-list" id="' . $args['widget_id'] . '-container">';
|
||||
//Output main widget content as list
|
||||
gce_widget_content_list( $feed_ids, $title_text, $max_events, $sort_order );
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'list-grouped':
|
||||
echo '<div class="gce-widget-list" id="' . $args['widget_id'] . '-container">';
|
||||
//Output main widget content as a grouped list
|
||||
gce_widget_content_list( $feed_ids, $title_text, $max_events, $sort_order, true );
|
||||
echo '</div>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
_e( 'No feeds have been added yet. You can add a feed in the Google Calendar Events settings.', GCE_TEXT_DOMAIN );
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
echo $options['error'];
|
||||
}
|
||||
}
|
||||
|
||||
//Output after widget stuff
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = esc_html( $new_instance['title'] );
|
||||
$instance['id'] = esc_html( $new_instance['id'] );
|
||||
$instance['display_type'] = esc_html( $new_instance['display_type'] );
|
||||
$instance['max_events'] = absint( $new_instance['max_events'] );
|
||||
$instance['order'] = ( 'asc' == $new_instance['order'] ) ? 'asc' : 'desc';
|
||||
$instance['display_title'] = ( 'on' == $new_instance['display_title'] ) ? true : false;
|
||||
$instance['display_title_text'] = wp_filter_kses( $new_instance['display_title_text'] );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
//Get saved feed options
|
||||
$options = get_option( GCE_OPTIONS_NAME );
|
||||
|
||||
if ( empty( $options ) ) {
|
||||
//If no feeds or groups ?>
|
||||
<p><?php _e( 'No feeds have been added yet. You can add feeds in the Google Calendar Events settings.', GCE_TEXT_DOMAIN ); ?></p>
|
||||
<?php
|
||||
}else{
|
||||
$title = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
|
||||
$ids = ( isset( $instance['id'] ) ) ? $instance['id'] : '';
|
||||
$display_type = ( isset( $instance['display_type'] ) ) ? $instance['display_type'] : 'grid';
|
||||
$max_events = ( isset( $instance['max_events'] ) ) ? $instance['max_events'] : 0;
|
||||
$order = ( isset( $instance['order'] ) ) ? $instance['order'] : 'asc';
|
||||
$display_title = ( isset($instance['display_title'] ) ) ? $instance['display_title'] : true;
|
||||
$title_text = ( isset($instance['display_title_text'] ) ) ? $instance['display_title_text'] : 'Events on';
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
|
||||
<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $title; ?>" class="widefat" />
|
||||
</p><p>
|
||||
<label for="<?php echo $this->get_field_id( 'id' ); ?>">
|
||||
<?php _e( 'Feeds to display, as a comma separated list (e.g. 1, 2, 4). Leave blank to display all feeds:', GCE_TEXT_DOMAIN ); ?>
|
||||
</label>
|
||||
<input type="text" id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" value="<?php echo $ids; ?>" class="widefat" />
|
||||
</p><p>
|
||||
<label for="<?php echo $this->get_field_id( 'display_type' ); ?>"><?php _e( 'Display events as:', GCE_TEXT_DOMAIN ); ?></label>
|
||||
<select id="<?php echo $this->get_field_id( 'display_type' ); ?>" name="<?php echo $this->get_field_name( 'display_type' ); ?>" class="widefat">
|
||||
<option value="grid"<?php selected( $display_type, 'grid' ); ?>><?php _e( 'Calendar Grid', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="ajax"<?php selected( $display_type, 'ajax' ); ?>><?php _e( 'Calendar Grid - with AJAX', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="list"<?php selected( $display_type, 'list' ); ?>><?php _e( 'List', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="list-grouped"<?php selected( $display_type, 'list-grouped' );?>><?php _e( 'List - grouped by date', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
</p><p>
|
||||
<label for="<?php echo $this->get_field_id( 'max_events' ); ?>"><?php _e( 'Maximum no. events to display. Enter 0 to show all retrieved.' ); ?></label>
|
||||
<input type="text" id="<?php echo $this->get_field_id( 'max_events' ); ?>" name="<?php echo $this->get_field_name( 'max_events' ); ?>" value="<?php echo $max_events; ?>" class="widefat" />
|
||||
</p><p>
|
||||
<label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort order (only applies to lists):' ); ?></label>
|
||||
<select id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat">
|
||||
<option value="asc"<?php selected( $order, 'asc' ); ?>><?php _e( 'Ascending', GCE_TEXT_DOMAIN ); ?></option>
|
||||
<option value="desc"<?php selected( $order, 'desc' ); ?>><?php _e( 'Descending', GCE_TEXT_DOMAIN ); ?></option>
|
||||
</select>
|
||||
</p><p>
|
||||
<label for="<?php echo $this->get_field_id( 'display_title' ); ?>"><?php _e( 'Display title on tooltip / list item? (e.g. \'Events on 7th March\') Grouped lists always have a title displayed.', GCE_TEXT_DOMAIN ); ?></label>
|
||||
<br />
|
||||
<input type="checkbox" id="<?php echo $this->get_field_id( 'display_title' ); ?>" name="<?php echo $this->get_field_name( 'display_title' ); ?>"<?php checked( $display_title, true ); ?> value="on" />
|
||||
<input type="text" id="<?php echo $this->get_field_id( 'display_title_text' ); ?>" name="<?php echo $this->get_field_name( 'display_title_text' ); ?>" value="<?php echo $title_text; ?>" style="width:90%;" />
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function gce_widget_content_grid( $feed_ids, $title_text, $max_events, $widget_id, $ajaxified = false, $month = null, $year = null ) {
|
||||
require_once WP_PLUGIN_DIR . '/' . GCE_PLUGIN_NAME . '/inc/gce-parser.php';
|
||||
|
||||
$ids = explode( '-', $feed_ids );
|
||||
|
||||
//Create new GCE_Parser object, passing array of feed id(s)
|
||||
$grid = new GCE_Parser( $ids, $title_text, $max_events );
|
||||
|
||||
$num_errors = $grid->get_num_errors();
|
||||
|
||||
//If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the grid
|
||||
if ( $num_errors < count( $ids ) ) {
|
||||
//If there was at least one error, and user is an admin, output error messages
|
||||
if ( $num_errors > 0 && current_user_can( 'manage_options' ) )
|
||||
echo $grid->error_messages();
|
||||
|
||||
//Add AJAX script if required
|
||||
if ( $ajaxified )
|
||||
?><script type="text/javascript">jQuery(document).ready(function($){gce_ajaxify("<?php echo $widget_id; ?>", "<?php echo $feed_ids; ?>", "<?php echo $max_events; ?>", "<?php echo $title_text; ?>", "widget");});</script><?php
|
||||
|
||||
echo $grid->get_grid( $year, $month, $ajaxified );
|
||||
} else {
|
||||
//If current user is an admin, display an error message explaining problem. Otherwise, display a 'nice' error messsage
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
echo $grid->error_messages();
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
echo $options['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function gce_widget_content_list( $feed_ids, $title_text, $max_events, $sort_order, $grouped = false ) {
|
||||
require_once WP_PLUGIN_DIR . '/' . GCE_PLUGIN_NAME . '/inc/gce-parser.php';
|
||||
|
||||
$ids = explode( '-', $feed_ids );
|
||||
|
||||
//Create new GCE_Parser object, passing array of feed id(s)
|
||||
$list = new GCE_Parser( $ids, $title_text, $max_events, $sort_order );
|
||||
|
||||
$num_errors = $list->get_num_errors();
|
||||
|
||||
//If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the list
|
||||
if ( $num_errors < count( $ids ) ) {
|
||||
//If there was at least one error, and user is an admin, output error messages
|
||||
if ( $num_errors > 0 && current_user_can( 'manage_options' ) )
|
||||
echo $list->error_messages();
|
||||
|
||||
echo $list->get_list( $grouped );
|
||||
} else {
|
||||
//If current user is an admin, display an error message explaining problem(s). Otherwise, display a 'nice' error messsage
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
echo $list->error_messages();
|
||||
} else {
|
||||
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
|
||||
echo $options['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 865 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 687 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 850 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1000 B |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 779 B |
|
After Width: | Height: | Size: 777 B |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 951 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 776 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 816 B |
|
After Width: | Height: | Size: 836 B |
|
After Width: | Height: | Size: 985 B |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 999 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 856 B |
|
After Width: | Height: | Size: 843 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 860 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 817 B |
|
After Width: | Height: | Size: 902 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 849 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 841 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |