Mailing list search is back (-mailman), plugins++

This commit is contained in:
nikolark committed 2015-03-28 18:02:49 +01:00
1 parent 671f1ecdfc
commit ac109c06dc
58 files changed
+9555 -1434

No files matched your search

+1
View File
@@ -2,3 +2,4 @@
node_modules
wp-content/uploads
wp-config.php
.idea
+6 -1
View File
@@ -340,11 +340,16 @@ h2.ak-header {
text-align: center;
}
.akismet-settings th.strictness {
.akismet-settings th:first-child {
vertical-align: top;
padding-top: 15px;
}
.akismet-settings th.akismet-api-key {
vertical-align: middle;
padding-top: 0;
}
.akismet-settings input[type=text] {
width: 75%;
}
+4 -2
View File
@@ -18,9 +18,11 @@ jQuery( function ( $ ) {
var thisId = $(this).attr('commentid');
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
});
$('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title ^= "http://"], .column-author a[title ^= "https://"]').each(function () {
$('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title]').each(function () {
// Comment author URLs are the only URL with a title attribute in the author column.
var thisTitle = $(this).attr('title');
thisCommentId = $(this).parents('tr:first').attr('id').split("-");
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
$(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
+3 -3
View File
@@ -6,7 +6,7 @@
Plugin Name: Akismet
Plugin URI: http://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.0.4
Version: 3.1.1
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
@@ -35,8 +35,8 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
define( 'AKISMET_VERSION', '3.0.4' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.1' );
define( 'AKISMET_VERSION', '3.1.1' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
+133 -4
View File
@@ -23,7 +23,7 @@ class Akismet {
self::$initiated = true;
add_action( 'wp_insert_comment', array( 'Akismet', 'auto_check_update_meta' ), 10, 2 );
add_action( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 );
add_filter( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 );
add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments' ) );
add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments_meta' ) );
add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) );
@@ -42,6 +42,9 @@ class Akismet {
add_action( 'transition_comment_status', array( 'Akismet', 'transition_comment_status' ), 10, 3 );
// Run this early in the pingback call, before doing a remote fetch of the source uri
add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ) );
if ( '3.0.5' == $GLOBALS['wp_version'] ) {
remove_filter( 'comment_text', 'wp_kses_data' );
if ( is_admin() )
@@ -161,6 +164,7 @@ class Akismet {
if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) {
if ( !wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) {
wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] );
}
}
@@ -180,7 +184,7 @@ class Akismet {
self::set_last_comment( $commentdata );
self::fix_scheduled_recheck();
return self::$last_comment;
return $commentdata;
}
public static function get_last_comment() {
@@ -547,6 +551,7 @@ class Akismet {
if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) {
// since there is currently a problem with the key, reschedule a check for 6 hours hence
wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status );
return false;
}
@@ -608,6 +613,7 @@ class Akismet {
delete_comment_meta( $comment_id, 'akismet_rechecking' );
wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status );
return;
}
delete_comment_meta( $comment_id, 'akismet_rechecking' );
@@ -616,6 +622,7 @@ class Akismet {
$remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" );
if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) {
wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'remaining' );
}
}
@@ -633,6 +640,7 @@ class Akismet {
if ( $future_check > $check_range ) {
wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' );
wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' );
do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' );
}
}
@@ -809,11 +817,71 @@ class Akismet {
'timeout' => 15
);
$akismet_url = "http://{$http_host}/1.1/{$path}";
$akismet_url = $http_akismet_url = "http://{$http_host}/1.1/{$path}";
/**
* Try SSL first; if that fails, try without it and don't try it again for a while.
*/
$ssl = $ssl_failed = false;
// Check if SSL requests were disabled fewer than X hours ago.
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
if ( $ssl_disabled && $ssl_disabled < ( time() - 60 * 60 * 24 ) ) { // 24 hours
$ssl_disabled = false;
delete_option( 'akismet_ssl_disabled' );
}
else if ( $ssl_disabled ) {
do_action( 'akismet_ssl_disabled' );
}
if ( ! $ssl_disabled && function_exists( 'wp_http_supports') && ( $ssl = wp_http_supports( array( 'ssl' ) ) ) ) {
$akismet_url = set_url_scheme( $akismet_url, 'https' );
do_action( 'akismet_https_request_pre' );
}
$response = wp_remote_post( $akismet_url, $http_args );
Akismet::log( compact( 'akismet_url', 'http_args', 'response' ) );
if ( is_wp_error( $response ) )
if ( $ssl && is_wp_error( $response ) ) {
do_action( 'akismet_https_request_failure', $response );
// Intermittent connection problems may cause the first HTTPS
// request to fail and subsequent HTTP requests to succeed randomly.
// Retry the HTTPS request once before disabling SSL for a time.
$response = wp_remote_post( $akismet_url, $http_args );
Akismet::log( compact( 'akismet_url', 'http_args', 'response' ) );
if ( is_wp_error( $response ) ) {
$ssl_failed = true;
do_action( 'akismet_https_request_failure', $response );
do_action( 'akismet_http_request_pre' );
// Try the request again without SSL.
$response = wp_remote_post( $http_akismet_url, $http_args );
Akismet::log( compact( 'http_akismet_url', 'http_args', 'response' ) );
}
}
if ( is_wp_error( $response ) ) {
do_action( 'akismet_request_failure', $response );
return array( '', '' );
}
if ( $ssl_failed ) {
// The request failed when using SSL but succeeded without it. Disable SSL for future requests.
update_option( 'akismet_ssl_disabled', time() );
do_action( 'akismet_https_disabled' );
}
return array( $response['headers'], $response['body'] );
}
@@ -956,4 +1024,65 @@ p {
error_log( print_r( compact( 'akismet_debug' ), true ) );
}
}
public static function pre_check_pingback( $method ) {
if ( $method !== 'pingback.ping' )
return;
global $wp_xmlrpc_server;
if ( !is_object( $wp_xmlrpc_server ) )
return false;
// Lame: tightly coupled with the IXR class.
$args = $wp_xmlrpc_server->message->params;
if ( !empty( $args[1] ) ) {
$post_id = url_to_postid( $args[1] );
// If this gets through the pre-check, make sure we properly identify the outbound request as a pingback verification
Akismet::pingback_forwarded_for( null, $args[0] );
add_filter( 'http_request_args', array( 'Akismet', 'pingback_forwarded_for' ), 10, 2 );
$comment = array(
'comment_author_url' => $args[0],
'comment_post_ID' => $post_id,
'comment_author' => '',
'comment_author_email' => '',
'comment_content' => '',
'comment_type' => 'pingback',
'akismet_pre_check' => '1',
'comment_pingback_target' => $args[1],
);
$comment = Akismet::auto_check_comment( $comment );
if ( isset( $comment['akismet_result'] ) && 'true' == $comment['akismet_result'] ) {
// Lame: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything.
$wp_xmlrpc_server->error( new IXR_Error( 0, 'Invalid discovery target' ) );
}
}
}
public static function pingback_forwarded_for( $r, $url ) {
static $urls = array();
// Call this with $r == null to prime the callback to add headers on a specific URL
if ( is_null( $r ) && !in_array( $url, $urls ) ) {
$urls[] = $url;
}
// Add X-Pingback-Forwarded-For header, but only for requests to a specific URL (the apparent pingback source)
if ( is_array( $r ) && is_array( $r['headers'] ) && !isset( $r['headers']['X-Pingback-Forwarded-For'] ) && in_array( $url, $urls ) ) {
$remote_ip = preg_replace( '/[^a-fx0-9:.,]/i', '', $_SERVER['REMOTE_ADDR'] );
// Note: this assumes REMOTE_ADDR is correct, and it may not be if a reverse proxy or CDN is in use
$r['headers']['X-Pingback-Forwarded-For'] = $remote_ip;
// Also identify the request as a pingback verification in the UA string so it appears in logs
$r['user-agent'] .= '; verifying pingback from ' . $remote_ip;
}
return $r;
}
}
+15 -3
View File
@@ -1,9 +1,9 @@
=== Akismet ===
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
Tags: akismet, comments, spam
Requires at least: 3.1
Tested up to: 4.1
Stable tag: 3.0.4
Requires at least: 3.2
Tested up to: 4.1.1
Stable tag: 3.1.1
License: GPLv2 or later
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
@@ -30,6 +30,18 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
= 3.1.1 =
*Release Date - 17th March, 2015*
* Improvements to the "Remove comment author URL" JavaScript
* Include the pingback pre-check from the 2.6 branch.
= 3.1 =
*Release Date - 11th March, 2015*
* Use HTTPS by default for all requests to Akismet.
* Fix for a situation where Akismet might strip HTML from a comment.
= 3.0.4 =
*Release Date - 11th December, 2014*
+32 -2
View File
@@ -64,13 +64,43 @@
<tbody>
<?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
<tr>
<th width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span class="api-key"><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
</td>
</tr>
<?php endif; ?>
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
<tr>
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
<td></td>
<td align="left">
<p>
<?php
if ( ! function_exists( 'wp_http_supports' ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php printf( esc_html( 'Your WordPress installation does not include the function %s; upgrade to the latest version of WordPress.', 'akismet' ), '<code>wp_http_supports</code>' ); ?><?php
}
else if ( ! wp_http_supports( array( 'ssl' ) ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
}
else {
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
if ( $ssl_disabled ) {
?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
}
else {
?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
}
}
?>
</p>
</td>
</tr>
<?php } ?>
<tr>
<th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
<td></td>
@@ -95,7 +125,7 @@
printf(
_n(
'Spam in the <a href="%s">spam folder</a> older than 1 day is deleted automatically.',
'Spam in the <a href="%1$s">spam folder</a> older than 1 day is deleted automatically.',
'Spam in the <a href="%1$s">spam folder</a> older than %2$d days is deleted automatically.',
$delete_interval,
'akismet'
+1 -1
View File
@@ -93,7 +93,7 @@
<div class="wrap alert critical">
<?php if ( $level == 'yellow' ): ?>
<h3 class="key-status failed"><?php esc_html_e("You're using your Akismet key on more sites than your Pro subscription allows.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('If you would like to use Akismet on more than 10 sites, you will need to <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>. If you have any questions, please <a href="%s" target="_blank">get in touch with our support team</a>', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<p class="description"><?php printf( __('Your Pro subscription allows the use of Akismet on only one site. Please <a href="http://docs.akismet.com/billing/add-more-sites/">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.<br /><br />If you have any questions, please get in touch with our support team.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<?php elseif ( $level == 'red' ): ?>
<h3 class="key-status failed"><?php esc_html_e("You're using Akismet on far too many sites for your Pro subscription.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
+6 -86
View File
@@ -7,46 +7,32 @@ $akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com';
$akismet_api_port = 80;
function akismet_test_mode() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::is_test_mode()' );
return Akismet::is_test_mode();
}
function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::http_post()' );
$path = str_replace( '/1.1/', '', $path );
return Akismet::http_post( $request, $path, $ip );
}
function akismet_microtime() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::_get_microtime()' );
return Akismet::_get_microtime();
}
function akismet_delete_old() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::delete_old_comments()' );
return Akismet::delete_old_comments();
}
function akismet_delete_old_metadata() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::delete_old_comments_meta()' );
return Akismet::delete_old_comments_meta();
}
function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::check_db_comment()' );
return Akismet::check_db_comment( $id, $recheck_reason );
}
function akismet_rightnow() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::rightnow_stats()' );
if ( !class_exists( 'Akismet_Admin' ) )
return false;
@@ -63,13 +49,9 @@ function akismet_load_js_and_css() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_nonce_field( $action = -1 ) {
_deprecated_function( __FUNCTION__, '3.0', 'wp_nonce_field' );
return wp_nonce_field( $action );
}
function akismet_plugin_action_links( $links, $file ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::plugin_action_links()' );
return Akismet_Admin::plugin_action_links( $links, $file );
}
function akismet_conf() {
@@ -79,21 +61,15 @@ function akismet_stats_display() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_stats() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::dashboard_stats()' );
return Akismet_Admin::dashboard_stats();
}
function akismet_admin_warnings() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_comment_row_action( $a, $comment ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::comment_row_action()' );
return Akismet_Admin::comment_row_actions( $a, $comment );
}
function akismet_comment_status_meta_box( $comment ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::comment_status_meta_box()' );
return Akismet_Admin::comment_status_meta_box( $comment );
}
function akismet_comments_columns( $columns ) {
@@ -105,63 +81,39 @@ function akismet_comment_column_row( $column, $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_text_add_link_callback( $m ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::text_add_link_callback()' );
return Akismet_Admin::text_add_link_callback( $m );
}
function akismet_text_add_link_class( $comment_text ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::text_add_link_class()' );
return Akismet_Admin::text_add_link_class( $comment_text );
}
function akismet_check_for_spam_button( $comment_status ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::check_for_spam_button()' );
return Akismet_Admin::check_for_spam_button( $comment_status );
}
function akismet_submit_nonspam_comment( $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::submit_nonspam_comment()' );
return Akismet::submit_nonspam_comment( $comment_id );
}
function akismet_submit_spam_comment( $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::submit_spam_comment()' );
return Akismet::submit_spam_comment( $comment_id );
}
function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::transition_comment_status()' );
return Akismet::transition_comment_status( $new_status, $old_status, $comment );
}
function akismet_spam_count( $type = false ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::get_spam_count()' );
return Akismet_Admin::get_spam_count( $type );
}
function akismet_recheck_queue() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::recheck_queue()' );
return Akismet_Admin::recheck_queue();
}
function akismet_remove_comment_author_url() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::remove_comment_author_url()' );
return Akismet_Admin::remove_comment_author_url();
}
function akismet_add_comment_author_url() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::add_comment_author_url()' );
return Akismet_Admin::add_comment_author_url();
}
function akismet_check_server_connectivity() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::check_server_connectivity()' );
return Akismet_Admin::check_server_connectivity();
}
function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::()' );
return Akismet_Admin::get_server_connectivity( $cache_timeout );
}
function akismet_server_connectivity_ok() {
@@ -170,101 +122,63 @@ function akismet_server_connectivity_ok() {
return true;
}
function akismet_admin_menu() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::admin_menu()' );
return Akismet_Admin::admin_menu();
}
function akismet_load_menu() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::load_menu()' );
return Akismet_Admin::load_menu();
}
function akismet_init() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_get_key() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_api_key()' );
return Akismet::get_api_key();
}
function akismet_check_key_status( $key, $ip = null ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::check_key_status()' );
return Akismet::check_key_status( $key, $ip );
}
function akismet_update_alert( $response ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::update_alert()' );
return Akismet::update_alert( $response );
}
function akismet_verify_key( $key, $ip = null ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::verify_key()' );
return Akismet::verify_key( $key, $ip );
}
function akismet_get_user_roles( $user_id ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_user_roles()' );
return Akismet::get_user_roles( $user_id );
}
function akismet_result_spam( $approved ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::comment_is_spam()' );
return Akismet::comment_is_spam( $approved );
}
function akismet_result_hold( $approved ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::comment_needs_moderation()' );
return Akismet::comment_needs_moderation( $approved );
}
function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_user_comments_approved()' );
return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url );
}
function akismet_update_comment_history( $comment_id, $message, $event = null ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::update_comment_history()' );
return Akismet::update_comment_history( $comment_id, $message, $event );
}
function akismet_get_comment_history( $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_comment_history()' );
return Akismet::get_comment_history( $comment_id );
}
function akismet_cmp_time( $a, $b ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::_cmp_time()' );
return Akismet::_cmp_time( $a, $b );
}
function akismet_auto_check_update_meta( $id, $comment ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::auto_check_update_meta()' );
return Akismet::auto_check_update_meta( $id, $comment );
}
function akismet_auto_check_comment( $commentdata ) {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::auto_check_comment()' );
return Akismet::auto_check_comment( $commentdata );
}
function akismet_get_ip_address() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_ip_address()' );
return Akismet::get_ip_address();
}
function akismet_cron_recheck() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::cron_recheck()' );
return Akismet::cron_recheck();
}
function akismet_add_comment_nonce() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::add_comment_nonce()' );
return Akismet::add_comment_nonce( $post_id );
}
function akismet_fix_scheduled_recheck() {
_deprecated_function( __FUNCTION__, '3.0', 'Akismet::fix_scheduled_recheck()' );
return Akismet::fix_scheduled_recheck();
}
function akismet_spam_comments() {
@@ -290,4 +204,10 @@ function akismet_kill_proxy_check( $option ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
}
function akismet_pingback_forwarded_for( $r, $url ) {
return Akismet::pingback_forwarded_for( $r, $url );
}
function akismet_pre_check_pingback( $method ) {
return Akismet::pre_check_pingback( $method );
}
@@ -1,8 +1,8 @@
=== Google Calendar Events ===
Contributors: pderksen, nickyoung87, rosshanney
Tags: google calendar, google, calendar, events, gcal
Requires at least: 3.8.5
Tested up to: 4.1
Requires at least: 3.9.3
Tested up to: 4.2
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -89,9 +89,58 @@ There are three ways to install this plugin.
== Changelog ==
= 2.2.3 - March 26, 2015 =
* Tested up to WordPress 4.2.
* Fixed bug with the "More details..." link encoding.
* Added note about total event limit of 2,500 now enforced by the Google Calendar API.
* Updated earliest feed event date default to 1 (one) month back.
* 0 (zero) value now allowed for earliest and latest feed event dates (sets them to the current date).
* Minor public script improvements.
* Added Brazilian Portuguese translation files.
* Updated jQuery UI datepicker CSS CDN reference for feed settings pages.
= 2.2.2.1 - March 17, 2015 =
* The option to always enqueue scripts & styles should now be enabled by default for new installs and upgrades.
= 2.2.2 - March 15, 2015 =
* Added option to always enqueue scripts and styles on every post and page.
* Added custom date range grid option to display modes.
* Added option to disable the plugin CSS file.
* Fixed bug with list intervals.
* Fixed bug with event list showing past events.
* Minor public JavaScript performance updates.
= 2.2.1 - February 28, 2015 =
* Enqueue scripts & styles on all posts & pages temporarily until better detection can be put in place.
* Fixed GCal ID encoding in feed settings.
* Updated Italian translation.
* Updated French translation.
= 2.2.0 - February 25, 2015 =
* Added custom date range options.
* Added option to hide tooltips on grid display.
* Added additional save button at the bottom of the feed settings.
* Performance updates to script enqueues.
* Updated Catalan translation files.
* Updated list output logic.
* Fixed bug with multi-day events sometimes not showing up in list view.
* Fixed bug with calendar ID field not getting encoded.
* Fixed bug with tooltips scrolling on mobile.
* Fixed bug with Google Hangout event links.
* Fixed bug with widget settings not being unique.
* Widget UI enhancements.
* Feed settings UI enhancements.
* Error messaging updates.
* Security improvements.
= 2.1.7 =
* Restructured pagination JavaScript.
* Restructured next and back paging navigation script.
* Updated Italian translation files.
= 2.1.6.1 =
@@ -53,16 +53,14 @@ class Google_Calendar_Events_Admin {
// Add admin styles
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
// Add admin JS
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
// Add the options page and menu item.
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 );
// Add admin notice for users upgrading from before 2.1.0.
if( version_compare( $this->version, '2.1.0', '<' ) ) {
add_action( 'admin_notices', array( $this, 'show_admin_notice' ) );
}
// Add admin notice after plugin activation. Also check if should be hidden.
add_action( 'admin_notices', array( $this, 'admin_api_settings_notice' ) );
add_action( 'admin_notices', array( $this, 'show_admin_notice' ) );
}
/**
@@ -71,7 +69,7 @@ class Google_Calendar_Events_Admin {
*
* @since 2.1.0
*/
public function admin_api_settings_notice() {
public function show_admin_notice() {
// Exit all of this is stored value is false/0 or not set.
if ( false == get_option( 'gce_show_admin_install_notice' ) ) {
return;
@@ -80,14 +78,14 @@ class Google_Calendar_Events_Admin {
$screen = get_current_screen();
// Delete stored value if "hide" button click detected (custom querystring value set to 1).
if ( ! empty( $_REQUEST['gce-dismiss-install-nag'] ) || in_array( $screen->id, $this->plugin_screen_hook_suffix ) ) {
if ( ! empty( $_REQUEST['gce-dismiss-install-nag'] ) || in_array( $screen->id, $this->plugin_screen_hook_suffix ) || $this->viewing_this_plugin() ) {
delete_option( 'gce_show_admin_install_notice' );
return;
}
// At this point show install notice. Show it only on the plugin screen.
if( get_current_screen()->id == 'plugins' || $this->viewing_this_plugin() ) {
include_once( 'views/admin/api-settings-notice.php' );
if( get_current_screen()->id == 'plugins' ) {
include_once( 'includes/admin/admin-notice.php' );
}
}
@@ -95,7 +93,7 @@ class Google_Calendar_Events_Admin {
* Check if viewing one of this plugin's admin pages.
*
* @since 2.1.0
*
*$this->viewing_this_plugin()
* @return bool
*/
private function viewing_this_plugin() {
@@ -105,7 +103,7 @@ class Google_Calendar_Events_Admin {
$screen = get_current_screen();
if ( $screen->id == 'edit-gce_feed' || $screen->id == 'gce_feed' || in_array( $screen->id, $this->plugin_screen_hook_suffix ) ) {
if ( $screen->id == 'edit-gce_feed' || $screen->id == 'gce_feed' || in_array( $screen->id, $this->plugin_screen_hook_suffix ) || $screen->id == 'widgets' ) {
return true;
} else {
return false;
@@ -137,6 +135,19 @@ class Google_Calendar_Events_Admin {
include_once( 'views/admin/admin.php' );
}
/**
* Enqueue JS for the admin area
*
* @since 2.0.0
*/
public function enqueue_admin_scripts() {
if( $this->viewing_this_plugin() ) {
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_script( 'gce-admin', plugins_url( 'js/gce-admin.js', __FILE__ ), array( 'jquery' ), $this->version, true );
}
}
/**
* Enqueue styles for the admin area
*
@@ -144,11 +155,17 @@ class Google_Calendar_Events_Admin {
*/
public function enqueue_admin_styles() {
//wp_enqueue_style( 'jquery-ui-datepicker-css', plugins_url( 'css/jquery-ui-1.10.4.custom.min.css', __FILE__ ), array(), $this->version );
if( $this->viewing_this_plugin() ) {
wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
}
global $wp_scripts;
// get the jquery ui object
$queryui = $wp_scripts->query( 'jquery-ui-datepicker' );
// Use minified CSS from CDN referenced at https://code.jquery.com/ui/
wp_enqueue_style( 'jquery-ui-smoothness', '//code.jquery.com/ui/' . $queryui->ver . '/themes/smoothness/jquery-ui.min.css', array(), $this->version );
wp_enqueue_style( 'gce-admin', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
}
}
/**
@@ -203,21 +220,4 @@ class Google_Calendar_Events_Admin {
$links
);
}
/**
* Use to show an important admin notice.
*
* @since 2.0.7.1
*/
/**
* Example use in constructor:
if( version_compare( $this->version, '2.1.0', '<' ) ) {
add_action( 'admin_notices', array( $this, 'show_admin_notice' ) );
}
*/
function show_admin_notice() {
include_once( 'includes/admin/admin-notice.php' );
}
}
@@ -18,7 +18,7 @@ class Google_Calendar_Events {
*
* @var string
*/
protected $version = '2.1.7';
protected $version = '2.2.3';
/**
* Unique identifier for the plugin.
@@ -37,6 +37,8 @@ class Google_Calendar_Events {
* @var object
*/
protected static $instance = null;
public $show_scripts = false;
/**
* Initialize the plugin by setting localization and loading public scripts
@@ -58,15 +60,75 @@ class Google_Calendar_Events {
$this->upgrade();
}
$this->setup_constants();
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_public_scripts' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_public_styles' ) );
add_action( 'init', array( $this, 'enqueue_public_scripts' ) );
add_action( 'init', array( $this, 'enqueue_public_styles' ) );
// Load scripts when posts load so we know if we need to include them or not
add_filter( 'the_posts', array( $this, 'load_scripts' ) );
// Load plugin text domain
$this->plugin_textdomain();
add_action( 'wp_footer', array( $this, 'localize_main_script' ) );
}
public function localize_main_script() {
if( $this->show_scripts ) {
global $localize;
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce_grid', $localize );
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce',
array(
'script_debug' => ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'ajaxnonce' => wp_create_nonce( 'gce_ajax_nonce' ),
'loadingText' => __( 'Loading...', 'gce' )
) );
}
}
public function load_scripts( $posts ) {
global $gce_options;
// Init enqueue flag.
$do_enqueue = false;
if ( isset( $gce_options['always_enqueue'] ) ) {
$do_enqueue = true;
} elseif ( ! empty( $posts ) ) {
foreach ( $posts as $post ) {
if ( ( strpos( $post->post_content, '[gcal' ) !== false ) || ( $post->post_type == 'gce_feed' ) ) {
$do_enqueue = true;
break;
}
}
}
if ( true == $do_enqueue ) {
// Load CSS after checking to see if it is supposed to be disabled or not (based on settings)
if( ! isset( $gce_options['disable_css'] ) ) {
wp_enqueue_style( $this->plugin_slug . '-public' );
}
// Load JS
wp_enqueue_script( $this->plugin_slug . '-public' );
$this->show_scripts = true;
}
return $posts;
}
/**
@@ -74,7 +136,7 @@ class Google_Calendar_Events {
*
* @since 2.0.0
*/
private function upgrade() {
public function upgrade() {
include_once( 'includes/admin/upgrade.php' );
}
@@ -143,8 +205,8 @@ class Google_Calendar_Events {
* @since 2.0.0
*/
public function enqueue_public_styles() {
wp_enqueue_style( $this->plugin_slug . '-qtip', plugins_url( 'css/jquery.qtip.min.css', __FILE__ ), array(), $this->version );
wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array( $this->plugin_slug . '-qtip' ), $this->version );
wp_register_style( $this->plugin_slug . '-qtip', plugins_url( 'css/jquery.qtip.min.css', __FILE__ ), array(), $this->version );
wp_register_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array( $this->plugin_slug . '-qtip' ), $this->version );
}
/**
@@ -54,3 +54,7 @@
#gce_feed_meta .inside code {
word-break: break-all;
}
.gce-custom-range input {
width: 120px;
}
@@ -1,7 +0,0 @@
/*! jQuery UI - v1.10.4 - 2014-05-14
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.datepicker.css, jquery.ui.theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hoverLine truncated
@@ -11,8 +11,8 @@
* @wordpress-plugin
* Plugin Name: Google Calendar Events
* Plugin URI: https://github.com/pderksen/WP-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: 2.1.7
* Description: Show off your Google calendar in grid (month) or list view, in a post, page or widget, and in a style that matches your site.
* Version: 2.2.3
* Author: Phil Derksen
* Author URI: http://philderksen.com
* License: GPL-2.0+
@@ -44,13 +44,12 @@ function gce_default_editor_content( $content, $post ) {
add_post_meta( $post->ID, 'gce_retrieve_until', 'end_time' );
add_post_meta( $post->ID, 'gce_cache', 43200 );
add_post_meta( $post->ID, 'gce_paging', 1 );
add_post_meta( $post->ID, 'gce_list_max_num', 7 );
add_post_meta( $post->ID, 'gce_list_max_length', 'days' );
add_post_meta( $post->ID, 'gce_list_start_offset_num', '0' );
add_post_meta( $post->ID, 'gce_feed_start', '1' );
add_post_meta( $post->ID, 'gce_feed_start_interval', 'months' );
add_post_meta( $post->ID, 'gce_feed_end', '2' );
add_post_meta( $post->ID, 'gce_feed_end_interval', 'years' );
add_post_meta( $post->ID, 'gce_feed_end_num', 2 );
add_post_meta( $post->ID, 'gce_feed_start_num', 1 );
add_post_meta( $post->ID, 'gce_feed_end', 'years' );
add_post_meta( $post->ID, 'gce_feed_start', 'months' );
add_post_meta( $post->ID, 'gce_show_tooltips', 1 );
// Default Simple Display Options
add_post_meta( $post->ID, 'gce_display_start', 'time' );
@@ -1,11 +1,11 @@
<?php
/**
* Show important upgrade notice.
* Show notice for API Settings
*
* @package GCE
* @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
* @license GPL-2.0+
* @copyright 2014 Phil Derksen
* @package GCE
* @subpackage admin/views
* @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
*/
// Exit if accessed directly.
@@ -15,12 +15,23 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<!-- class="updated" or class="error" -->
<div id="gce-admin-notice" class="error">
<style>
#gce-install-notice .button-secondary {
margin-left: 15px;
}
</style>
<div id="gce-install-notice" class="updated">
<p>
<strong>GCal Events Important Update Nov. 17, 2014:</strong><br/>
Google took version 2 of the GCal API offline, which breaks all calendar feed displays.<br/>
<strong><a href="https://wordpress.org/support/topic/nov-17-temporary-easy-embed-display-fix" target="_blank">Here's a temporary fix for your calendar display</a></strong>
while we move the plugin to using the new GCal API this week. Thanks for your patience.
<h3><?php _e( 'GCal API Key Notice', 'gce' ); ?></h3>
<?php _e( 'GCal Events uses the Google Calendar API version 3. By default this plugin uses a public shared key across all plugin users.', 'gce' ); ?>
<br/><br/>
<?php _e( 'This key is limited to 500,000 requests per day and 5 requests per second. To avoid running into any potential limits you can use your own Google API key.', 'gce' ); ?>
</p>
</div>
<p>
<a href="<?php echo admin_url( 'edit.php?post_type=gce_feed&page=google-calendar-events_general_settings' ); ?>" class="button-primary"><?php _e( 'Enter your GCal API key', 'gce' ); ?></a>
<a href="<?php echo admin_url( 'edit.php?post_type=gce_feed' ); ?>" class="button-secondary"><?php _e( 'Configure GCal feeds', 'gce' ); ?></a>
<a href="<?php echo add_query_arg( 'gce-dismiss-install-nag', 1 ); ?>" class="button-secondary"><?php _e( 'Hide this', 'gce' ); ?></a>
</p>
</div>
@@ -44,6 +44,14 @@ function gce_upgrade() {
if( version_compare( $version, '2.1.0', '<' ) ) {
gce_v210_upgrade();
}
if( version_compare( $version, '2.2.0', '<' ) ) {
gce_v220_upgrade();
}
if( version_compare( $version, '2.2.2', '<' ) ) {
gce_v222_upgrade();
}
}
$new_version = Google_Calendar_Events::get_instance()->get_plugin_version();
@@ -52,6 +60,67 @@ function gce_upgrade() {
add_option( 'gce_upgrade_has_run', 1 );
}
function gce_v222_upgrade() {
// Need to set the new option for always enqueuing scripts as default enabled for upgrading users
$options = get_option( 'gce_settings_general' );
if( false !== $options ) {
$options['always_enqueue'] = 1;
update_option( 'gce_settings_general', $options );
}
}
function gce_v220_upgrade() {
// Update feeds
$q = new WP_Query( 'post_type=gce_feed' );
if( $q->have_posts() ) {
while( $q->have_posts() ) {
$q->the_post();
$gce_list_max_num = get_post_meta( get_the_ID(), 'gce_list_max_num', true );
$gce_list_max_length = get_post_meta( get_the_ID(), 'gce_list_max_length', true );
$gce_feed_start_interval = get_post_meta( get_the_ID(), 'gce_feed_start_interval', true );
$gce_feed_start = get_post_meta( get_the_ID(), 'gce_feed_start', true );
$gce_feed_end_interval = get_post_meta( get_the_ID(), 'gce_feed_end_interval', true );
$gce_feed_end = get_post_meta( get_the_ID(), 'gce_feed_end', true );
update_post_meta( get_the_ID(), 'gce_per_page_num', $gce_list_max_num );
update_post_meta( get_the_ID(), 'gce_events_per_page', $gce_list_max_length );
update_post_meta( get_the_ID(), 'gce_feed_start', $gce_feed_start_interval );
update_post_meta( get_the_ID(), 'gce_feed_start_num', $gce_feed_start );
update_post_meta( get_the_ID(), 'gce_feed_end', $gce_feed_end_interval );
update_post_meta( get_the_ID(), 'gce_feed_end_num', $gce_feed_end );
// Add new show tooltips option checked as default
update_post_meta( get_the_ID(), 'gce_show_tooltips', 1 );
}
}
wp_reset_postdata();
// Update widgets for new UI
$widget = get_option( 'widget_gce_widget' );
if( is_array( $widget ) && ! empty( $widget ) ) {
foreach( $widget as $a => $b ) {
if( ! is_array( $b ) ) {
continue;
}
foreach( $b as $k => $v ) {
$widget[$a]['per_page_num'] = $widget[$a]['list_max_num'];
$widget[$a]['events_per_page'] = $widget[$a]['list_max_length'];
}
}
update_option( 'widget_gce_widget', $widget );
}
}
/*
* Run the upgrade to version 2.1.0
*/
@@ -11,7 +11,7 @@
class GCE_Display {
private $feeds, $merged_feeds;
public $feeds, $merged_feeds;
public function __construct( $ids, $title_text = null, $sort_order = 'asc' ) {
@@ -131,7 +131,7 @@ class GCE_Display {
foreach ( $event_day as $num_in_day => $event ) {
$feed_id = absint( $event->feed->id );
$markup .= '<li class="gce-tooltip-feed-' . $feed_id . '">' . $event->get_event_markup( 'tooltip', $num_in_day, $i ) . '</li>';
$markup .= '<li class="gce-tooltip-feed-' . esc_attr( $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;
@@ -198,11 +198,11 @@ class GCE_Display {
*
* @since 2.0.0
*/
public function get_list( $grouped = false, $start = null, $paging = null, $paging_interval = null, $start_offset = null, $max_events = null, $paging_type = null ) {
public function get_list( $grouped = false, $start = null, $paging = null, $paging_interval = null, $start_offset = null, $max_events = null, $paging_type = null, $max_num = null ) {
$paging_type = $paging_type;
$max_length = null;
if( $paging_type == 'events' ) {
$max_length = 'events';
}
@@ -216,15 +216,21 @@ class GCE_Display {
$an_event_feed_id = current( $event_days );
$an_event_feed_id = $an_event_feed_id[0]->feed->id;
if( $paging_interval == null ) {
$max_num = get_post_meta( $an_event_feed_id, 'gce_list_max_num', true );
$max_num = get_post_meta( $an_event_feed_id, 'gce_per_page_num', true );
if( $paging_type == null ) {
$max_length = get_post_meta( $an_event_feed_id, 'gce_list_max_length', true );
$max_length = get_post_meta( $an_event_feed_id, 'gce_events_per_page', true );
$paging_type = $max_length;
}
}
$use_range = ( $paging_interval == 'date-range' ? true : false );
if( $use_range ) {
$max_length = 'date-range';
}
if( $paging === null ) {
$paging = get_post_meta( $an_event_feed_id, 'gce_paging', true );
@@ -239,8 +245,21 @@ class GCE_Display {
$max_num = 7;
}
if( $max_length == 'days' ) {
$paging_interval = $max_num * 86400;
if( $paging_type == 'days' ) {
if( $paging_interval == null ) {
$paging_interval = $max_num * 86400;
}
} else if( $paging_type == 'week' ) {
$paging_interval = 604800;
// Set week start here too
$start_of_week = get_option( 'start_of_week' );
$start = mktime( 0, 0, 0, date( 'm' ), ( date( 'j' ) - date( 'w' ) + $start_of_week ), date( 'Y' ) );
} else if( $paging_type == 'month' ) {
$paging_interval = 2629743;
// Set month start here too
$start = mktime( 0, 0, 0, date( 'm', current_time( 'timestamp' ) ), 1, date( 'Y', current_time( 'timestamp' ) ) );
}
if( $start_offset === null ) {
@@ -263,7 +282,7 @@ class GCE_Display {
$feeds = implode( $this->id, '-' );
$markup = '<div class="gce-list" data-gce-start-offset="' . $start_offset . '" data-gce-start="' . ( $start + $paging_interval ) . '" data-gce-paging-interval="' . $paging_interval . '" data-gce-paging="' . $paging . '" data-gce-feeds="' . $feeds . '" data-gce-title="' . stripslashes( $this->title ) . '" data-gce-grouped="' . $grouped . '" data-gce-sort="' . $this->sort . '">' . "\n";
$markup = '<div class="gce-list" data-gce-start-offset="' . esc_attr( $start_offset ) . '" data-gce-start="' . esc_attr( ( $start + $paging_interval ) ) . '" data-gce-paging-interval="' . esc_attr( $paging_interval ) . '" data-gce-paging="' . esc_attr( $paging ) . '" data-gce-feeds="' . esc_attr( $feeds ) . '" data-gce-title="' . esc_attr( stripslashes( $this->title ) ) . '" data-gce-grouped="' . esc_attr( $grouped ) . '" data-gce-sort="' . esc_attr( $this->sort ) . '">' . "\n";
if( ( $paging != 0 ) && $max_length != 'events' ) {
@@ -273,23 +292,21 @@ class GCE_Display {
$prev_text = apply_filters( 'gce_prev_text', $prev_text );
$next_text = apply_filters( 'gce_next_text', $next_text );
$p = '<div class="gce-prev"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Previous month', 'gce' ) . '" data-gce-paging-direction="back" data-gce-paging-type="' . $paging_type . '">'. $prev_text . '</a></div>';
$n = '<div class="gce-next"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Next month', 'gce' ) . '" data-gce-paging-direction="forward" data-gce-paging-type="' . $paging_type . '">' . $next_text . '</a></div>';
$p = '<div class="gce-prev"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Previous month', 'gce' ) . '" data-gce-paging-direction="back" data-gce-paging-type="' . esc_attr( $paging_type ) . '">'. esc_html( $prev_text ) . '</a></div>';
$n = '<div class="gce-next"><a href="#" class="gce-change-month-list" title="' . esc_attr__( 'Next month', 'gce' ) . '" data-gce-paging-direction="forward" data-gce-paging-type="' . esc_attr( $paging_type ) . '">' . esc_html( $next_text ) . '</a></div>';
$markup .= '<caption class="gce-caption">' .
'<div class="gce-navbar">' .
$markup .= '<div class="gce-navbar">' .
$p .
$n .
'<div class="gce-month-title"></div>' .
'</div>' .
'</caption>' . "\n";
'</div>' . "\n";
}
$max_count = 1;
$has_events = false;
$event_counter = 0;
if( $max_length == 'events' ) {
if( $start_offset === null ) {
if( $start_offset === null || $start_offset == 0 ) {
$time_now = current_time( 'timestamp' );
} else {
@@ -328,25 +345,25 @@ class GCE_Display {
if( ( $max_length != 'events' && (( $event->start_time >= $start && // Condition for limited by days
$event->end_time <= $end_time ) ||
( $event->day_type == 'MWD' &&
$event->start_time > $start &&
$event->start_time < $end_time )
$event->start_time >= $start &&
$event->start_time <= $end_time )
)
) ||
( $max_length == 'events' && ( $event->end_time >= $time_now && // Condition for limited by events
$event_counter < $max_events )
)
) ||
( $max_length == 'date-range' )
) {
if( $show_title && $grouped ) {
$day_markup .= '<div class="gce-list-title">' . stripslashes( $this->title ) . ' ' . date_i18n( $event->feed->date_format, $key ) . '</div>';
$day_markup .= '<div class="gce-list-title">' . esc_html( stripslashes( $this->title ) ) . ' ' . date_i18n( $event->feed->date_format, $key ) . '</div>';
$show_title = false;
}
$day_markup .=
'<div class="gce-feed gce-feed-' . $event->feed->id . '">' .
'<div class="gce-feed gce-feed-' . esc_attr( $event->feed->id ) . '">' .
//If this isn't a grouped list, generate a per-event title with date.
( ( ! $grouped ) ? ( ( isset( $this->title ) && $this->title !== '' ) )
? '<div class="gce-list-title">' . stripslashes( $this->title ) . ' ' . date_i18n( $event->feed->date_format, $event->start_time ) . '</div>'
? '<div class="gce-list-title">' . esc_html( stripslashes( $this->title ) ) . ' ' . date_i18n( $event->feed->date_format, $event->start_time ) . '</div>'
: '' : '' ) .
//Add the event markup
$event->get_event_markup( 'list', $num_in_day, $i ) .
@@ -355,7 +372,7 @@ class GCE_Display {
$has_events = true;
$i++;
$event_counter++;
}
}
}
if ( $day_markup != '' ) {
@@ -35,13 +35,21 @@ class GCE_Event {
$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';
if( $end_time - $start_time > 86400 ) {
$this->day_type = 'MWD';
} else {
$this->day_type = 'SWD';
}
} else {
$this->day_type = 'MPD';
}
}
} else {
$this->day_type = 'SPD';
if( date( 'D', $start_time ) == date( 'D', $end_time ) ) {
$this->day_type = 'SPD';
} else {
$this->day_type = 'MPD';
}
}
}
@@ -107,9 +115,7 @@ class GCE_Event {
return $this->use_builder();
}
// Setup the markup to return
//$display_options = get_option( 'gce_settings_general' );
// Setup the markup to return
$display_options['display_start'] = get_post_meta( $this->feed->id, 'gce_display_start', true );
$display_options['display_start_text'] = get_post_meta( $this->feed->id, 'gce_display_start_text', true );
$display_options['display_end'] = get_post_meta( $this->feed->id, 'gce_display_end', true );
@@ -124,7 +130,7 @@ class GCE_Event {
$display_options['display_separator'] = get_post_meta( $this->feed->id, 'gce_display_separator', true );
$display_options['display_link_target'] = get_post_meta( $this->feed->id, 'gce_display_link_tab', true );
$markup = '<p class="gce-' . $this->type . '-event">' . esc_html( $this->title ) . '</p>';
$markup = '<p class="gce-' . esc_attr( $this->type ) . '-event">' . esc_html( $this->title ) . '</p>';
$start_end = array();
@@ -148,7 +154,7 @@ class GCE_Event {
//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>' . esc_html( $display_options['display_' . $start_or_end . '_text'] ) . '</span> ';
$markup .= '<p class="gce-' . esc_attr( $this->type ) . '-' . $start_or_end . '"><span>' . esc_html( $display_options['display_' . $start_or_end . '_text'] ) . '</span> ';
if( ! empty( $display_options['display_' . $start_or_end] ) ) {
switch ( $display_options['display_' . $start_or_end] ) {
@@ -169,7 +175,7 @@ class GCE_Event {
if ( ! empty( $display_options['display_location'] ) ) {
$event_location = $this->location;
if ( '' != $event_location )
$markup .= '<p class="gce-' . $this->type . '-loc"><span>' . esc_html( $display_options['display_location_text'] ) . '</span> ' . esc_html( $event_location ) . '</p>';
$markup .= '<p class="gce-' . esc_attr( $this->type ) . '-loc"><span>' . esc_html( $display_options['display_location_text'] ) . '</span> ' . esc_html( $event_location ) . '</p>';
}
//If description should be displayed (and is not empty) add to $markup
@@ -183,7 +189,7 @@ class GCE_Event {
$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>';
$markup .= '<p class="gce-' . esc_attr( $this->type ) . '-desc"><span>' . esc_html( $display_options['display_desc_text'] ) . '</span> ' . make_clickable( nl2br( esc_html( $event_desc ) ) ) . '</p>';
}
}
@@ -193,9 +199,14 @@ class GCE_Event {
$ctz = get_option( 'timezone_string' );
$link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' );
// Check if it is a hangouts link first
if( strpos( $this->link, 'plus.google.com/events/' ) !== false ) {
$link = $this->link;
} else {
$link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' );
}
$markup .= '<p class="gce-' . $this->type . '-link"><a href="' . esc_url( $link ) . '" ' . $target . '>' . esc_html( $display_options['display_link_text'] ) . '</a></p>';
$markup .= '<p class="gce-' . esc_attr( $this->type ) . '-link"><a href="' . esc_url( $link ) . '" ' . esc_attr( $target ) . '>' . esc_html( $display_options['display_link_text'] ) . '</a></p>';
}
return $markup;
@@ -365,7 +376,14 @@ class GCE_Event {
case 'link':
$new_window = ( $newwindow ) ? ' target="_blank"' : '';
$ctz = get_option( 'timezone_string' );
$link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' );
// Check if it is a hangouts link first
if( strpos( $this->link, 'plus.google.com/events/' ) !== false ) {
$link = $this->link;
} else {
$link = $this->link . ( ! empty( $ctz ) ? '&ctz=' . $ctz : '' );
}
return $m[1] . '<a href="' . esc_url( $link ) . '"' . $new_window . '>' . $this->look_for_shortcodes( $m[5] ) . '</a>' . $m[6];
case 'url':
@@ -379,7 +397,7 @@ class GCE_Event {
case 'maps-link':
$new_window = ( $newwindow ) ? ' target="_blank"' : '';
return $m[1] . '<a href="' . esc_url( '//maps.google.com?q=' . urlencode( $this->location ) ) . '"' . $new_window . '>' . $this->look_for_shortcodes( $m[5] ) . '</a>' . $m[6];
return $m[1] . '<a href="' . esc_url( '//maps.google.com?q=' . urlencode( $this->location ) ) . '"' . esc_attr( $new_window ) . '>' . $this->look_for_shortcodes( $m[5] ) . '</a>' . $m[6];
case 'length':
return $m[1] . $this->gce_human_time_diff( $this->start_time, $this->end_time, $precision ) . $m[6];
@@ -21,7 +21,9 @@ class GCE_Feed {
$display_url,
$search_query,
$expand_recurring,
$title;
$title,
$feed_start,
$feed_end;
public $events = array();
@@ -72,6 +74,8 @@ class GCE_Feed {
$this->search_query = get_post_meta( $this->id, 'gce_search_query', true );
$this->expand_recurring = get_post_meta( $this->id, 'gce_expand_recurring', true );
$this->title = get_the_title( $this->id );
$this->feed_start = $this->get_feed_start();
$this->feed_end = $this->get_feed_end();
}
/**
@@ -86,7 +90,7 @@ class GCE_Feed {
if( empty( $this->feed_url ) ) {
if( current_user_can( 'manage_options' ) ) {
echo '<p>' . __( 'The feed URL has not been set. Please make sure to set it correctly in the Feed settings.', 'gce' ) . '</p>';
echo '<p>' . __( 'The Google Calendar ID has not been set. Please make sure to set it correctly in the Feed settings.', 'gce' ) . '</p>';
}
return;
@@ -106,11 +110,11 @@ class GCE_Feed {
$query .= '?key=' . $api_key;
$args['timeMin'] = urlencode( $this->get_feed_start() );
$args['timeMin'] = urlencode( date( 'c', $this->feed_start ) );
$args['timeMax'] = urlencode( $this->get_feed_end() );
$args['timeMax'] = urlencode( date( 'c', $this->feed_end ) );
$args['maxResults'] = 10000;
$args['maxResults'] = 2500;
$ctz = get_option( 'timezone_string' );
@@ -161,7 +165,6 @@ class GCE_Feed {
//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['items'] as $event ) {
$id = ( isset( $event['id'] ) ? esc_html( $event['id'] ) : '' );
@@ -227,38 +230,74 @@ class GCE_Feed {
private function get_feed_start() {
$start = get_post_meta( $this->id, 'gce_feed_start', true );
$interval = get_post_meta( $this->id, 'gce_feed_start_interval', true );
$range = get_post_meta( $this->id, 'gce_display_mode', true );
$use_range = ( ( $range == 'date-range-list' || $range == 'date-range-grid' ) ? true : false );
if( $use_range ) {
$start = get_post_meta( $this->id, 'gce_feed_range_start', true );
$start = gce_date_unix( $start );
$interval = 'date-range';
} else {
$start = get_post_meta( $this->id, 'gce_feed_start_num', true );
$interval = get_post_meta( $this->id, 'gce_feed_start', true );
if( empty( $start ) && $start !== '0' ) {
$start = 1;
}
}
switch( $interval ) {
case 'days':
return date( 'c', time() - ( $start * 86400 ) );
return time() - ( $start * 86400 );
case 'months':
return date( 'c', time() - ( $start * 2629743 ) );
return time() - ( $start * 2629743 );
case 'years':
return date( 'c', time() - ( $start * 31556926 ) );
return time() - ( $start * 31556926 );
case 'date-range':
return $start;
}
// fall back just in case. Falls back to 1 year ago
return date( 'c', time() - 31556926 );
return time() - 31556926;
}
private function get_feed_end() {
$end = get_post_meta( $this->id, 'gce_feed_end', true );
$interval = get_post_meta( $this->id, 'gce_feed_end_interval', true );
$range = get_post_meta( $this->id, 'gce_display_mode', true );
$use_range = ( ( $range == 'date-range-list' || $range == 'date-range-grid' ) ? true : false );
if( $use_range ) {
$end = get_post_meta( $this->id, 'gce_feed_range_end', true );
$end = gce_date_unix( $end );
$interval = 'date-range';
} else {
$end = get_post_meta( $this->id, 'gce_feed_end_num', true );
$interval = get_post_meta( $this->id, 'gce_feed_end', true );
if( empty( $end ) && $end !== '0' ) {
$end = 1;
}
}
switch( $interval ) {
case 'days':
return date( 'c', time() + ( $end * 86400 ) );
return time() + ( $end * 86400 );
case 'months':
return date( 'c', time() + ( $end * 2629743 ) );
return time() + ( $end * 2629743 );
case 'years':
return date( 'c', time() + ( $end * 31556926 ) );
return time() + ( $end * 31556926 );
case 'date-range':
return mktime( 23, 59, 59, date( 'n', $end ), date( 'j', $end ), date( 'Y', $end ) );
}
// Falls back to 1 year ahead just in case
return date( 'c', time() + 31556926 );
return time() + 31556926;
}
function get_builder() {
@@ -66,7 +66,7 @@ add_action( 'init', 'gce_setup_cpt' );
function gce_feed_messages( $messages ) {
global $post, $post_ID;
$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
$url1 = '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">';
$url2 = __( 'feed', 'gce' );
$url3 = '</a>';
$s1 = __( 'Feed', 'gce' );
@@ -153,15 +153,23 @@ function gce_save_meta( $post_id ) {
'gce_custom_until',
'gce_search_query',
'gce_expand_recurring',
'gce_show_tooltips',
'gce_paging',
'gce_list_max_num',
'gce_list_max_length',
'gce_events_per_page',
'gce_per_page_num',
'gce_per_page_from',
'gce_per_page_to',
'gce_list_start_offset_num',
'gce_list_start_offset_direction',
'gce_feed_start',
'gce_feed_start_interval',
'gce_feed_start_num',
'gce_feed_start_custom',
'gce_feed_end',
'gce_feed_end_interval',
'gce_feed_end_num',
'gce_feed_end_custom',
'gce_feed_use_range',
'gce_feed_range_start',
'gce_feed_range_end',
// Display options
'gce_display_start',
'gce_display_start_text',
@@ -184,17 +192,29 @@ function gce_save_meta( $post_id ) {
if ( current_user_can( 'edit_post', $post_id ) ) {
// Loop through our array and make sure it is posted and not empty in order to update it, otherwise we delete it
foreach ( $post_meta_fields as $pmf ) {
if ( isset( $_POST[$pmf] ) && ! empty( $_POST[$pmf] ) ) {
if ( isset( $_POST[$pmf] ) && ( ! empty( $_POST[$pmf] ) || $_POST[$pmf] == 0 ) ) {
if( $pmf == 'gce_feed_url' ) {
$str = $_POST[$pmf];
$id = $_POST[$pmf];
// convert from URL if user enters a URL link (like the old versions required)
$id = str_replace( 'https://www.google.com/calendar/feeds/', '', $str );
$id = str_replace( '/public/basic', '', $id );
$id = str_replace( '%40', '@', $id );
if ( strpos( $id, 'https://www.google.com/calendar/feeds/' ) !== false ) {
$id = str_replace( 'https://www.google.com/calendar/feeds/', '', $id );
$id = str_replace( '/public/basic', '', $id );
$id = str_replace( '%40', '@', $id );
}
update_post_meta( $post_id, $pmf, trim( $id ) );
// decode first before re-encoding it
$id = urldecode( $id );
$id = trim( $id );
$at = strpos( $id, '@' );
if ( $at !== false ) {
$id = substr_replace( $id, urlencode( substr( $id, 0, $at ) ), 0, $at );
}
update_post_meta( $post_id, $pmf, $id );
} else {
update_post_meta( $post_id, $pmf, stripslashes( $_POST[$pmf] ) );
}
@@ -241,18 +261,21 @@ function gce_column_content( $column_name, $post_ID ) {
echo $post_ID;
break;
case 'feed-sc':
echo '<code>[gcal id="' . $post_ID . '"]</code>';
echo '<code>[gcal id="' . esc_attr( $post_ID ) . '"]</code>';
break;
case 'display-type':
$display = get_post_meta( $post_ID, 'gce_display_mode', true );
if( $display == 'grid' ) {
if ( $display == 'grid' ) {
echo __( 'Grid', 'gce' );
} else if( $display == 'list' ) {
} elseif ( $display == 'list' ) {
echo __( 'List', 'gce' );
} else {
} elseif ( $display == 'list-grouped' ) {
echo __( 'Grouped List', 'gce' );
} elseif ( $display == 'date-range' ) {
echo __( 'Custom Date Range', 'gce' );
}
break;
}
}
@@ -5,20 +5,19 @@
*
* @since 2.0.0
*/
function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $widget = false ) {
function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $widget = false, $uid = null ) {
// Set static unique ID for setting id attributes
if( $uid == null ) {
STATIC $uid = 1;
}
// Load scripts
wp_enqueue_script( GCE_PLUGIN_SLUG . '-images-loaded' );
wp_enqueue_script( GCE_PLUGIN_SLUG . '-qtip' );
wp_enqueue_script( GCE_PLUGIN_SLUG . '-public' );
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce',
array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'ajaxnonce' => wp_create_nonce( 'gce_ajax_nonce' ),
'loadingText' => __( 'Loading...', 'gce' )
) );
$defaults = array(
'title_text' => '',
'sort' => 'asc',
@@ -30,7 +29,10 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
'max_events' => null,
'start_offset' => null,
'paging_type' => null,
'paging' => null
'paging' => null,
'max_num' => null,
'range_start' => null,
'show_tooltips' => null
);
$args = array_merge( $defaults, $args );
@@ -62,38 +64,78 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
if( $paging === null ) {
$paging = get_post_meta( $id, 'gce_paging', true );
}
if( empty( $show_tooltips ) && $show_tooltips != 0 ) {
$tooltips = get_post_meta( $id, 'gce_show_tooltips', true );
} else {
$tooltips = $show_tooltips;
}
if( ! empty( $tooltips ) && ( $tooltips === true || $tooltips == 'true' || $tooltips == '1' || $tooltips == 1 ) ) {
$show_tooltips = 'true';
} else {
$show_tooltips = 'false';
}
}
if( 'grid' == $display ) {
global $localize;
$target = ( $widget == 1 ? 'gce-widget-' : 'gce-page-grid-' ) . $feed_ids;
$target = 'gce-' . $uid;
$localize[$target] = array(
'target_element' => $target,
'feed_ids' => $feed_ids,
'title_text' => $title_text,
'type' => ( $widget == 1 ? 'widget' : 'page' )
'feed_ids' => $feed_ids,
'title_text' => $title_text,
'type' => ( $widget == 1 ? 'widget' : 'page' ),
'show_tooltips' => ( $show_tooltips == 'true' || $show_tooltips == '1' ? 'true' : 'false' )
);
wp_localize_script( GCE_PLUGIN_SLUG . '-public', 'gce_grid', $localize );
if( $widget == 1 ) {
$markup .= '<div class="gce-widget-grid" id="gce-widget-' . $feed_ids . '">';
$markup .= '<div class="gce-widget-grid gce-widget-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">';
} else {
$markup .= '<div class="gce-page-grid" id="gce-page-grid-' . $feed_ids . '">';
$markup .= '<div class="gce-page-grid gce-page-grid-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">';
}
$markup .= $d->get_grid( $year, $month, $widget, $paging );
$markup .= '</div>';
} else if( 'list' == $display || 'list-grouped' == $display ) {
if( $widget ) {
$markup = '<div class="gce-widget-list" id="gce-widget-list-' . $feed_ids . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '</div>';
$markup = '<div class="gce-widget-list gce-widget-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type, $max_num ) . '</div>';
} else {
$markup = '<div class="gce-page-list" id="gce-page-list-' . $feed_ids . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '</div>';
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, ( $start + $start_offset ), $paging, $paging_interval, $start_offset, $max_events, $paging_type ) . '</div>';
}
} else if( 'date-range-list' == $display ) {
$paging_interval = 'date-range';
if( $widget ) {
$markup = '<div class="gce-widget-list gce-widget-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, $range_start, false, $paging_interval, $start_offset, INF, $paging_type, $max_num ) . '</div>';
} else {
$markup = '<div class="gce-page-list gce-page-list-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $d->get_list( $grouped, $range_start, false, $paging_interval, $start_offset, INF, $paging_type, INF ) . '</div>';
}
} elseif ( 'date-range-grid' == $display ) {
global $localize;
$target = 'gce-' . $uid;
$localize[$target] = array(
'target_element' => $target,
'feed_ids' => $feed_ids,
'title_text' => $title_text,
'type' => ( $widget == 1 ? 'widget' : 'page' ),
'show_tooltips' => ( $show_tooltips == 'true' || $show_tooltips == '1' ? 'true' : 'false' )
);
if( $widget ) {
$markup = '<div class="gce-widget-grid gce-widget-grid-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $markup .= $d->get_grid( $year, $month, $widget, $paging ) . '</div>';
} else {
$markup = '<div class="gce-page-grid gce-page-grid-' . esc_attr( $feed_ids ) . '" id="gce-' . $uid . '">' . $markup .= $d->get_grid( $year, $month, $widget, $paging ) . '</div>';
}
}
@@ -106,7 +148,9 @@ function gce_print_calendar( $feed_ids, $display = 'grid', $args = array(), $wid
$i++;
}
}
$uid++;
return $markup;
}
@@ -123,16 +167,20 @@ function gce_ajax() {
die( 'Request has failed.' );
}
$ids = esc_html( $_POST['gce_feed_ids'] );
$title = esc_html( $_POST['gce_title_text'] );
$month = esc_html( $_POST['gce_month'] );
$year = esc_html( $_POST['gce_year'] );
$paging = esc_html( $_POST['gce_paging'] );
$type = esc_html( $_POST['gce_type'] );
$uid = esc_html( $_POST['gce_uid'] );
$ids = esc_html( $_POST['gce_feed_ids'] );
$title = esc_html( $_POST['gce_title_text'] );
$month = esc_html( $_POST['gce_month'] );
$year = esc_html( $_POST['gce_year'] );
$paging = esc_html( $_POST['gce_paging'] );
$type = esc_html( $_POST['gce_type'] );
// Split ID and pass as UID to function
$uid = explode( '-', $uid );
$title = ( 'null' == $title ) ? null : $title;
$title = ( 'null' == $title ) ? null : $title;
$args = array(
$args = array(
'title_text' => $title,
'month' => $month,
'year' => $year,
@@ -140,10 +188,10 @@ function gce_ajax() {
);
if ( 'page' == $type ) {
echo gce_print_calendar( $ids, 'grid', $args );
echo gce_print_calendar( $ids, 'grid', $args, 0, $uid[1] );
} elseif ( 'widget' == $type ) {
$args['widget'] = 1;
echo gce_print_calendar( $ids, 'grid', $args );
echo gce_print_calendar( $ids, 'grid', $args, 1, $uid[1] );
}
die();
@@ -164,7 +212,7 @@ function gce_ajax_list() {
if( ! check_ajax_referer( 'gce_ajax_nonce', 'gce_nonce' ) ) {
die( 'Request has failed.' );
}
$grouped = esc_html( $_POST['gce_grouped'] );
$start = esc_html( $_POST['gce_start'] );
$ids = esc_html( $_POST['gce_feed_ids'] );
@@ -216,7 +264,7 @@ function gce_feed_content( $content ) {
global $post;
if( $post->post_type == 'gce_feed' ) {
$content = '[gcal id="' . $post->ID . '"]';
$content = '[gcal id="' . esc_attr( $post->ID ) . '"]';
}
return $content;
@@ -243,6 +291,20 @@ function gce_ga_campaign_url( $base_url, $source, $medium, $campaign ) {
'utm_campaign' => $campaign
), $base_url );
return $url;
return esc_url( $url );
}
/**
* Function to convert date format mm/dd/YYYY to unix timestamp
*/
function gce_date_unix( $date ) {
$date = explode( '/', $date );
$month = $date[0];
$day = $date[1];
$year = $date[2];
$timestamp = mktime( 0, 0, 0, $month, $day, $year );
return $timestamp;
}
@@ -52,15 +52,15 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length
$n = apply_filters( 'gce_next_text', $n );
if( $widget ) {
$p = '<div class="gce-prev">' . ( ( $pl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Previous month', 'gce' ) . '" name="' . $pl . '" data-gce-grid-paging="' . $paging . '">' . $p . '</a>' ) : $p ) . '</div>';
$p = '<div class="gce-prev">' . ( ( $pl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Previous month', 'gce' ) . '" name="' . esc_attr( $pl ) . '" data-gce-grid-paging="' . esc_attr( $paging ) . '">' . $p . '</a>' ) : $p ) . '</div>';
} else {
$p = '<div class="gce-prev">' . ( ( $pl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Previous month', 'gce' ) . '" name="' . $pl . '" data-gce-grid-paging="' . $paging . '">' . $p . '</a>' ) : $p ) . '</div>';
$p = '<div class="gce-prev">' . ( ( $pl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Previous month', 'gce' ) . '" name="' . esc_attr( $pl ) . '" data-gce-grid-paging="' . esc_attr( $paging ) . '">' . $p . '</a>' ) : $p ) . '</div>';
}
if( $widget ) {
$n = '<div class="gce-next">' . ( ( $nl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Next month', 'gce' ) . '" name="' . $nl . '" data-gce-grid-paging="' . $paging . '">' . $n . '</a>' ) : $n ) . '</div>';
$n = '<div class="gce-next">' . ( ( $nl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Next month', 'gce' ) . '" name="' . esc_attr( $nl ) . '" data-gce-grid-paging="' . esc_attr( $paging ) . '">' . $n . '</a>' ) : $n ) . '</div>';
} else {
$n = '<div class="gce-next">' . ( ( $nl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Next month', 'gce' ) . '" name="' . $nl . '" data-gce-grid-paging="' . $paging . '">' . $n . '</a>' ) : $n ) . '</div>';
$n = '<div class="gce-next">' . ( ( $nl ) ? ( '<a href="#" class="gce-change-month" title="' . esc_attr__( 'Next month', 'gce' ) . '" name="' . esc_attr( $nl ) . '" data-gce-grid-paging="' . esc_attr( $paging ) . '">' . $n . '</a>' ) : $n ) . '</div>';
}
$calendar = '<table class="gce-calendar">' . "\n" .
@@ -68,7 +68,7 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length
'<div class="gce-navbar">' .
$p .
$n .
'<div class="gce-month-title">' . ( ( $month_href ) ? ( '<a href="' . esc_attr( $month_href ) . '">' . $title . '</a>' ) : $title ) . '</div>' .
'<div class="gce-month-title">' . ( ( $month_href ) ? ( '<a href="' . esc_attr( $month_href ) . '">' . esc_html( $title ) . '</a>' ) : esc_html( $title ) ) . '</div>' .
'</div>' .
'</caption>' . "\n" .
'<tr>' . "\n";
@@ -85,7 +85,7 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length
$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 . '">&nbsp;</td>'; #initial 'empty' days
if ( $weekday > 0 ) $calendar .= '<td colspan="' . esc_attr( $weekday ) . '">&nbsp;</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
@@ -96,14 +96,14 @@ function gce_generate_calendar( $year, $month, $days = array(), $day_name_length
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>';
$calendar .= '<td' . ( ( $classes ) ? ( ' class="' . esc_attr( $classes ) . '">' ) : '>' ) . ( ( $link ) ? ( '<a href="' . esc_url( $link ) . '"><span class="gce-day-number">' . esc_html( $day ) . '</span></a>' . $content ) : '<span class="gce-day-number">' . esc_html( $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>';
$calendar .= '<td class="' . esc_attr( $css_class ) . '"><span class="gce-day-number">' . esc_html( $day ) . '</span></td>';
}
}
if ( 7 != $weekday ) $calendar .= '<td colspan="' . ( 7 - $weekday ) . '">&nbsp;</td>'; #remaining "empty" days
if ( 7 != $weekday ) $calendar .= '<td colspan="' . esc_attr( ( 7 - $weekday ) ) . '">&nbsp;</td>'; #remaining "empty" days
return $calendar . "</tr>\n</table>\n";
}
@@ -34,6 +34,18 @@ function gce_register_settings() {
'size' => 'regular-text',
'type' => 'text'
),
'always_enqueue' => array(
'id' => 'always_enqueue',
'name' => __( 'Always Enqueue Scripts & Styles', 'sc' ),
'desc' => __( sprintf( 'Enqueue this plugin\'s scripts and styles on every post and page. Useful if using shortcodes in widgets or other non-standard locations.' ), 'gce' ),
'type' => 'checkbox'
),
'disable_css' => array(
'id' => 'disable_css',
'name' => __( 'Disable Plugin CSS', 'sc' ),
'desc' => __( "If this option is checked, this plugin's CSS file will not be referenced.", 'gce' ),
'type' => 'checkbox'
),
'save_settings' => array(
'id' => 'save_settings',
'name' => __( 'Save Settings', 'gce' ),
@@ -112,11 +124,11 @@ function gce_checkbox_callback( $args ) {
global $gce_options;
$checked = isset( $gce_options[$args['id']] ) ? checked( 1, $gce_options[$args['id']], false ) : '';
$html = "\n" . '<input type="checkbox" id="gce_settings_' . $args['section'] . '[' . $args['id'] . ']" name="gce_settings_' . $args['section'] . '[' . $args['id'] . ']" value="1" ' . $checked . '/>' . "\n";
$html = "\n" . '<input type="checkbox" id="gce_settings_' . esc_attr( $args['section'] ) . '[' . esc_attr( $args['id'] ) . ']" name="gce_settings_' . esc_attr( $args['section'] ) . '[' . esc_attr( $args['id'] ) . ']" value="1" ' . $checked . '/>' . "\n";
// Render description text directly to the right in a label if it exists.
if ( ! empty( $args['desc'] ) )
$html .= '<label for="gce_settings_' . $args['section'] . '[' . $args['id'] . ']"> ' . $args['desc'] . '</label>' . "\n";
$html .= '<label for="gce_settings_' . esc_attr( $args['section'] ) . '[' . esc_attr( $args['id'] ) . ']"> ' . $args['desc'] . '</label>' . "\n";
echo $html;
}
@@ -138,7 +150,7 @@ function gce_text_callback( $args ) {
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : '';
$html = "\n" . '<input type="text" class="' . $size . '" id="gce_settings_' . $args['section'] . '[' . $args['id'] . ']" name="gce_settings_' . $args['section'] . '[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>' . "\n";
$html = "\n" . '<input type="text" class="' . esc_attr( $size ) . '" id="gce_settings_' . esc_attr( $args['section'] ) . '[' . esc_attr( $args['id'] ) . ']" name="gce_settings_' . esc_attr( $args['section'] ) . '[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>' . "\n";
// Render and style description text underneath if it exists.
if ( ! empty( $args['desc'] ) ) {
@@ -184,6 +196,7 @@ function gce_get_settings() {
$general = get_option( 'gce_settings_general' );
$general['save_settings'] = 1;
$general['always_enqueue'] = 1;
update_option( 'gce_settings_general', $general );
}
@@ -28,7 +28,8 @@ function gce_gcal_shortcode( $attr ) {
'interval' => null,
'interval_count' => null,
'offset_interval_count' => null,
'offset_direction' => null
'offset_direction' => null,
'show_tooltips' => null
), $attr, 'gce_feed' ) );
// If no ID is specified then return
@@ -36,6 +37,8 @@ function gce_gcal_shortcode( $attr ) {
return;
}
$invalid_id = false;
$paging_interval = null;
$max_events = null;
@@ -59,11 +62,11 @@ function gce_gcal_shortcode( $attr ) {
}
if( $interval == null ) {
$interval = get_post_meta( $v, 'gce_list_max_length', true );
$interval = get_post_meta( $v, 'gce_events_per_page', true );
}
if( $interval_count == null ) {
$interval_count = get_post_meta( $v, 'gce_list_max_num', true );
$interval_count = get_post_meta( $v, 'gce_per_page_num', true );
}
if( $offset_interval_count == null ) {
@@ -77,6 +80,20 @@ function gce_gcal_shortcode( $attr ) {
if( $paging == null ) {
$paging = get_post_meta( $v, 'gce_paging', true );
}
if( $show_tooltips == null ) {
$show_tooltips = get_post_meta( $v, 'gce_show_tooltips', true );
}
if( ! ( 'publish' == get_post_status( $v ) ) ) {
$invalid_id = true;
}
}
if( $invalid_id ) {
if( current_user_can( 'manage_options' ) ) {
return '<p>' . __( 'There was a problem with one or more of your feed IDs. Please check your shortcode settings and make sure they are correct.', 'gce' ) . '</p>';
}
}
if( $paging == 'false' ) {
@@ -100,6 +117,10 @@ function gce_gcal_shortcode( $attr ) {
} else if( $interval == 'events' ) {
$max_events = $interval_count;
$paging_type = 'events';
} else if( $interval == 'week' ) {
$paging_interval = 604800;
} else if( $interval == 'month' ) {
$paging_interval = 2629743;
}
// Port over old options
@@ -116,15 +137,16 @@ function gce_gcal_shortcode( $attr ) {
}
$args = array(
'title_text' => $title,
'sort' => $order,
'grouped' => ( $display == 'list-grouped' ? 1 : 0 ),
'month' => null,
'year' => null,
'widget' => 0,
'title_text' => $title,
'sort' => $order,
'grouped' => ( $display == 'list-grouped' ? 1 : 0 ),
'month' => null,
'year' => null,
'widget' => 0,
'paging_interval' => $paging_interval,
'max_events' => $max_events,
'paging' => $paging
'max_events' => $max_events,
'paging' => $paging,
'show_tooltips' => $show_tooltips
);
$args['start_offset'] = $start_offset;
@@ -0,0 +1,70 @@
/* global jQuery */
/**
* Admin JavaScript functions
*
* @package GCE
* @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
* @license GPL-2.0+
* @copyright 2014 Phil Derksen
*/
(function ($) {
"use strict";
$(function () {
// Show the hidden text box if custom date is selected (Events per Page)
$('body').on('change', 'select[id*=events_per_page]', function() {
// Hide everything before showing what we want
$(this).parent().children('.gce_per_page_num_wrap').hide();
if( $(this).val() == 'days' || $(this).val() == 'events' ) {
$(this).parent().children('.gce_per_page_num_wrap').show();
}
});
$('body').on('change', 'select[id*=display_type]', function() {
if( $(this).val() == 'date-range-list' || $(this).val() == 'date-range-grid' ) {
$(this).parent().parent().children('.gce-display-option').hide();
$(this).parent().parent().children('.gce-custom-range').show();
} else {
$(this).parent().parent().children('.gce-display-option').show();
$(this).parent().parent().children('.gce-custom-range').hide();
}
});
// For main settings page
$('body').on('change', 'select[id*=gce_display_mode]', function() {
if( $(this).val() == 'date-range-list' || $(this).val() == 'date-range-grid' ) {
$('.gce-display-option').hide();
$('.gce-custom-range').show();
} else {
$('.gce-display-option').show();
$('.gce-custom-range').hide();
}
});
// Add jQuery date picker to our custom date fields
// We have to do it this way because the widget will break after clicking "Save" and this method fixes this problem
// REF: http://stackoverflow.com/a/10433307/3578774
$('body').on('focus', 'input[id*=feed_range_start]', function(){
$(this).datepicker();
});
$('body').on('focus', 'input[id*=feed_range_end]', function(){
$(this).datepicker();
});
// Trigger CPT Publish/Update click from another button.
// Form post trigger still pops up JS warning on new CPT.
$('.gce-feed-update-button').click(function(e) {
e.preventDefault();
$('#publish').click();
});
});
}(jQuery));
@@ -1,5 +1,3 @@
/* global jQuery, gce, gce_grid */
/**
* Public JS functions
*
@@ -8,18 +6,44 @@
* @license GPL-2.0+
* @copyright 2014 Phil Derksen
*/
/* global jQuery, gce, gce_grid */
(function($) {
'use strict';
// Set debug flag.
var script_debug = ( (typeof gce != 'undefined') && gce.script_debug == true);
$(function() {
gce_tooltips($('.gce-has-events'));
var $body = $( 'body' );
if( typeof gce_grid != 'undefined' ) {
$('body').on( 'click', '.gce-change-month', function(e) {
if (script_debug) {
console.log('gce_grid', gce_grid);
}
var tooltip_elements = '';
e.preventDefault();
$body.find('.gce-page-grid, .gce-widget-grid').each( function() {
var id = $(this).attr('id');
if( gce_grid[id].show_tooltips == 'true' || gce_grid[id].show_tooltips == true ) {
tooltip_elements += '#' + gce_grid[id].target_element + ' .gce-has-events,';
}
});
tooltip_elements = tooltip_elements.substring( 0, tooltip_elements.length - 1 );
gce_tooltips(tooltip_elements);
// Month nav link click for Grid view.
// TODO Unbind other attached clicks here?
$body.on( 'click.gceNavLink', '.gce-change-month', function( event ) {
event.preventDefault();
var navLink = $(this);
@@ -28,16 +52,18 @@
if( typeof id == 'undefined' ) {
id = navLink.closest('.gce-widget-grid').attr('id');
}
//Extract month and year
var month_year = navLink.attr('name').split('-', 2);
var paging = navLink.attr('data-gce-grid-paging');
//Add loading text to table caption
$('#' + gce_grid[id].target_element + ' caption').html(gce.loadingText);
$body.find('#' + gce_grid[id].target_element + ' caption').html(gce.loadingText);
//Send AJAX request
$.post(gce.ajaxurl,{
action:'gce_ajax',
gce_uid: id,
gce_type: gce_grid[id].type,
gce_feed_ids: gce_grid[id].feed_ids,
gce_title_text: gce_grid[id].title_text,
@@ -46,23 +72,31 @@
gce_year: month_year[1],
gce_paging: paging,
gce_nonce: gce.ajaxnonce
}, function(data){
//Replace existing data with returned AJAX data
if(gce_grid[id].type == 'widget'){
$('#' + gce_grid[id].target_element).html(data);
}else{
$('#' + gce_grid[id].target_element).replaceWith(data);
}
gce_tooltips($('#' + gce_grid[id].target_element + ' .gce-has-events'));
});
e.stopPropagation();
}, function(data) {
//Replace existing data with returned AJAX data.
var targetEle = $body.find('#' + gce_grid[id].target_element);
if (gce_grid[id].type == 'widget') {
targetEle.html(data);
} else {
targetEle.replaceWith(data);
}
gce_tooltips(tooltip_elements);
}).fail(function(data) {
console.log( data );
});
});
}
$('body').on( 'click', '.gce-change-month-list', function(e) {
// Month nav link click for List view.
// TODO Unbind other attached clicks here?
$body.on( 'click.gceNavLink', '.gce-change-month-list', function( event ) {
e.preventDefault();
event.preventDefault();
var navLink = $(this);
@@ -80,7 +114,7 @@
var paging_type = navLink.data('gce-paging-type');
//Add loading text to table caption
navLink.parent().parent().parent().find('.gce-month-title').html(gce.loadingText);
navLink.parents('.gce-navbar').find('.gce-month-title').html(gce.loadingText);
//Send AJAX request
$.post(gce.ajaxurl,{
@@ -96,25 +130,30 @@
gce_start_offset: start_offset,
gce_paging_type: paging_type,
gce_nonce: gce.ajaxnonce
}, function(data){
navLink.parents('.gce-list').replaceWith(data);
});
e.stopPropagation();
}).fail(function(data) {
console.log( data );
});
});
// Tooltip config using qTip2 jQuery plugin.
function gce_tooltips(target_items) {
target_items.each(function(){
$(target_items).each(function() {
//Add qtip to all target items
$(this).qtip({
content: $(this).children('.gce-event-info'),
content: $(this).find('.gce-event-info'),
position: {
my: 'bottom left',
at: 'center',
viewport: true,
adjust: {
method: 'shift'
method: 'shift',
scroll: false
}
},
show: {
@@ -129,13 +168,6 @@
style: {
classes: 'qtip-light qtip-shadow qtip-rounded'
}
/* Old qTip 1 settings */
//position: { corner: { target: 'center', tooltip: 'bottomLeft' }, adjust: { screen: true } },
//show: { solo: true, delay: 0, effect: { length: 0 } },
//hide: { fixed: true, delay: 100, 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 } }
});
});
}
File diff suppressed because it is too large. Load diff
@@ -13,7 +13,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Poedit 1.6.10\n"
"X-Generator: Poedit 1.7.4\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
@@ -21,6 +21,8 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: .\n"
# changelog 2015-03-02:
# see https://github.com/pderksen/WP-Google-Calendar-Events/pull/30
# changelog 2014-10-26:
# removed inactive French translations from file
# switched translation header to de_DE
@@ -54,7 +56,7 @@ msgstr "Cache leeren"
#: google-calendar-events/views/admin/gce-feed-meta-display.php:170
#: google-calendar-events/views/widgets.php:252
msgid "Back"
msgstr "zurück"
msgstr "Zurück"
#: google-calendar-events/includes/class-gce-display.php:192
#: google-calendar-events/includes/class-gce-display.php:278
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,884 @@
# Copyright (C) 2015 WebPress - CodeLayer
# This file is distributed under the same license as the WordPress package.
msgid ""
msgstr ""
"Project-Id-Version: Google Calendar Events\n"
"Report-Msgid-Bugs-To: http://support.codelayer.org\n"
"POT-Creation-Date: 2015-03-24 01:49-0300\n"
"PO-Revision-Date: \n"
"Last-Translator: CodeLayer <codelayer@codelayer.org>\n"
"Language-Team: CodeLayer <info@codelayer.org>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
"esc_html_e\n"
"X-Poedit-Basepath: ../\n"
"X-Textdomain-Support: yes\n"
"X-Generator: Poedit 1.7.5\n"
"X-Poedit-SearchPath-0: .\n"
#: class-google-calendar-events-admin.php:126
#: class-google-calendar-events-admin.php:127
#: class-google-calendar-events-admin.php:218
#: includes/register-settings.php:66
msgid "General Settings"
msgstr "Configurações Gerais"
#: class-google-calendar-events-admin.php:206 views/widgets.php:27
msgid "Google Calendar Events"
msgstr "Google Calendar Events"
#: class-google-calendar-events-admin.php:219
msgid "Feeds"
msgstr "Feeds"
#: class-google-calendar-events.php:90
msgid "Loading..."
msgstr "Carregando..."
#: includes/admin/admin-functions.php:20
msgid "Cache has been cleared for this feed."
msgstr "Cache foi esvaziado para este feed."
#: includes/admin/admin-functions.php:35 includes/admin/admin-functions.php:55
msgid "Starts:"
msgstr "Inicia:"
#: includes/admin/admin-functions.php:36 includes/admin/admin-functions.php:57
msgid "Ends:"
msgstr "Termina:"
#: includes/admin/admin-functions.php:37 includes/admin/admin-functions.php:59
msgid "Location:"
msgstr "Local:"
#: includes/admin/admin-functions.php:38 includes/admin/admin-functions.php:60
msgid "Description:"
msgstr "Descrição:"
#: includes/admin/admin-functions.php:39
msgid "More details..."
msgstr "Mais detalhes..."
#: includes/admin/admin-functions.php:62
msgid "More Details"
msgstr "Mais Detalhes"
#: includes/admin/admin-functions.php:76 includes/gce-feed-cpt.php:291
msgid "Clear Cache"
msgstr "Limpar Cache"
#: includes/admin/admin-notice.php:26
msgid "GCal API Key Notice"
msgstr "GCal API Key Notice"
#: includes/admin/admin-notice.php:28
msgid ""
"GCal Events uses the Google Calendar API version 3. By default this plugin "
"uses a public shared key across all plugin users."
msgstr ""
"GCal Events usa a API versão 3 do Google Calendar. Por padrão este plugin "
"usa uma chave compartilhada pública para todos os usuários deste plugin."
#: includes/admin/admin-notice.php:30
msgid ""
"This key is limited to 500,000 requests per day and 5 requests per second. "
"To avoid running into any potential limits you can use your own Google API "
"key."
msgstr ""
"Esta chave é limitada a 500.000 requisições por dia e 5 requisições por "
"segundo. Para evitar ultrapassar limites você pode usar a sua própria chave "
"API."
#: includes/admin/admin-notice.php:33
msgid "Enter your GCal API key"
msgstr "Digite a sua chave GCal API"
#: includes/admin/admin-notice.php:34
msgid "Configure GCal feeds"
msgstr "Configurar feeds GCal"
#: includes/admin/admin-notice.php:35
msgid "Hide this"
msgstr "Esconder isto"
#: includes/class-gce-display.php:179 includes/class-gce-display.php:289
msgid "Back"
msgstr "Voltar"
#: includes/class-gce-display.php:183 includes/class-gce-display.php:290
msgid "Next"
msgstr "Próximo"
#: includes/class-gce-display.php:392
msgid "No events to display."
msgstr "Nenhum evento para exibir"
#: includes/class-gce-event.php:522
#, php-format
msgid "%s year"
msgstr "%s ano"
#: includes/class-gce-event.php:522
#, php-format
msgid "%s years"
msgstr "%s anos"
#: includes/class-gce-event.php:523
#, php-format
msgid "%s month"
msgstr "%s mês"
#: includes/class-gce-event.php:523
#, php-format
msgid "%s months"
msgstr "%s meses"
#: includes/class-gce-event.php:524
#, php-format
msgid "%s week"
msgstr "%s semana"
#: includes/class-gce-event.php:524
#, php-format
msgid "%s weeks"
msgstr "%s semanas"
#: includes/class-gce-event.php:525
#, php-format
msgid "%s day"
msgstr "%s dia"
#: includes/class-gce-event.php:525
#, php-format
msgid "%s days"
msgstr "%s dias"
#: includes/class-gce-event.php:526
#, php-format
msgid "%s hour"
msgstr "%s hora"
#: includes/class-gce-event.php:526
#, php-format
msgid "%s hours"
msgstr "%s horas"
#: includes/class-gce-event.php:527
#, php-format
msgid "%s min"
msgstr "%s min"
#: includes/class-gce-event.php:527
#, php-format
msgid "%s mins"
msgstr "%s mins"
#: includes/class-gce-event.php:555
msgctxt "human_time_diff"
msgid ", "
msgstr ", "
#: includes/class-gce-feed.php:93
msgid ""
"The Google Calendar ID has not been set. Please make sure to set it "
"correctly in the Feed settings."
msgstr ""
"A ID do Google Calendar não foi definida. Por favor certifique-se de definí-"
"la corretamente nas configurações do Feed."
#: includes/class-gce-feed.php:197
msgid ""
"Some data was retrieved, but could not be parsed successfully. Please ensure "
"your feed settings are correct."
msgstr ""
"Dados foram recebidos, mas não foi possível interpretá-los corretamente. "
"Certifique-se que suas configurações do feed estão corretas."
#: includes/class-gce-feed.php:200
msgid "An error has occured."
msgstr "Um erro ocorreu."
#: includes/class-gce-feed.php:205
msgid " Please ensure your calendar ID is correct."
msgstr "Por favor certifique-se que a ID do calendário está correta"
#: includes/gce-feed-cpt.php:21
msgid "Google Calendar Feeds"
msgstr "Feeds do Google Calendas"
#: includes/gce-feed-cpt.php:22 includes/gce-feed-cpt.php:24
#: includes/gce-feed-cpt.php:72
msgid "Feed"
msgstr "Feed"
#: includes/gce-feed-cpt.php:23
msgid "GCal Events"
msgstr "Eventos GCal"
#: includes/gce-feed-cpt.php:25
msgid "Add New"
msgstr "Adicionar Novo"
#: includes/gce-feed-cpt.php:26
msgid "Add New Feed"
msgstr "Adicionar novo feed"
#: includes/gce-feed-cpt.php:27
msgid "New Feed"
msgstr "Novo feed"
#: includes/gce-feed-cpt.php:28
msgid "Edit Feed"
msgstr "Editar feed"
#: includes/gce-feed-cpt.php:29
msgid "View Feed"
msgstr "Visualizar feed"
#: includes/gce-feed-cpt.php:30
msgid "All GCal Feeds"
msgstr "Todos os feeds GCal"
#: includes/gce-feed-cpt.php:31
msgid "Search GCal Feeds"
msgstr "Pesquisar Feeds GCal"
#: includes/gce-feed-cpt.php:32
msgid "No feeds found."
msgstr "Nenhum fed encontrado."
#: includes/gce-feed-cpt.php:33
msgid "No feeds found in Trash."
msgstr "Nenhum feed encontrado na lixeira."
#: includes/gce-feed-cpt.php:70
msgid "feed"
msgstr "feed"
#: includes/gce-feed-cpt.php:75 includes/gce-feed-cpt.php:76
#, php-format
msgid "%4$s updated. %1$sView %2$s%3$s"
msgstr "%4$s atualizado. %1$sVer %2$s%3$s"
#: includes/gce-feed-cpt.php:77
#, php-format
msgid "%4$s published. %1$sView %2$s%3$s"
msgstr "%4$s publicado. %1$sVer %2$s%3$s"
#: includes/gce-feed-cpt.php:78
#, php-format
msgid "%4$s saved. %1$sView %2$s%3$s"
msgstr "%4$s salvo. %1$sVer %2$s%3$s"
#: includes/gce-feed-cpt.php:79
#, php-format
msgid "%4$s submitted. %1$sView %2$s%3$s"
msgstr "%4$s submetido. %1$sVer %2$s%3$s"
#: includes/gce-feed-cpt.php:80
#, php-format
msgid "%4$s draft updated. %1$sView %2$s%3$s"
msgstr "Rascunho %4$s atualizado. %1$sVer %2$s%3$s"
#: includes/gce-feed-cpt.php:94
msgid "Feed Settings"
msgstr "Configurações de Feed"
#: includes/gce-feed-cpt.php:97
msgid "Helpful Links"
msgstr "Links úteis"
#: includes/gce-feed-cpt.php:99
msgid "Display Options"
msgstr "Opções de exibição"
#: includes/gce-feed-cpt.php:241
msgid "Feed ID"
msgstr "ID Feed"
#: includes/gce-feed-cpt.php:242 views/admin/gce-feed-meta-display.php:87
msgid "Feed Shortcode"
msgstr "Shortcode Feed"
#: includes/gce-feed-cpt.php:243
msgid "Display Type"
msgstr "Tipo de exibição"
#: includes/gce-feed-cpt.php:270
msgid "Grid"
msgstr "Grid"
#: includes/gce-feed-cpt.php:272 views/admin/gce-feed-meta-display.php:137
#: views/widgets.php:295
msgid "List"
msgstr "Lista"
#: includes/gce-feed-cpt.php:274 views/admin/gce-feed-meta-display.php:138
#: views/widgets.php:296
msgid "Grouped List"
msgstr "Lista agrupada"
#: includes/gce-feed-cpt.php:276
msgid "Custom Date Range"
msgstr "Faixa de datas personalizada"
#: includes/register-settings.php:29
msgid "Google API Key"
msgstr "Chave API Google"
#: includes/register-settings.php:30
msgid ""
"If left blank all displayed Google calendars will use a public Google API "
"key shared across all plugin users."
msgstr ""
"Se deixado em branco todos os Google Calendars usarão uma chave de API "
"pública, compartilhada entre todos os usuários do plugin. "
#: includes/register-settings.php:31
msgid ""
"Currently the shared key is limited to 500,000 requests per day and 5 "
"requests per second."
msgstr ""
"Atualmente a chave compartilhada é limitada a 500.000 requisições por dia e "
"5 por segundo."
#: includes/register-settings.php:32
#, php-format
msgid ""
"To avoid these limits <a href=\"%s\" target=\"_blank\">click here for "
"instructions on how to generate and use your own Google API key.</a>"
msgstr ""
"Para evitar ultrapassar limites você pode usar a sua <a href=\"%s\" target="
"\"_blank\">própria chave API</a>."
#: includes/register-settings.php:39
msgid "Always Enqueue Scripts & Styles"
msgstr "Sempre carregar scripts e estilos"
#: includes/register-settings.php:45
msgid "Disable Plugin CSS"
msgstr "Desativar CSS do plugin"
#: includes/register-settings.php:46
msgid ""
"If this option is checked, this plugin's CSS file will not be referenced."
msgstr "Se a opção é marcada, o CSS deste plugin não será referenciado."
#: includes/register-settings.php:51
msgid "Save Settings"
msgstr "Salvar Configurações"
#: includes/register-settings.php:52
msgid ""
"Save your settings when uninstalling this plugin. Useful when upgrading or "
"re-installing."
msgstr ""
"Salvar suas configurações ao desinstalar este plugin, útil ao atualizar ou "
"reinstalar."
#: includes/register-settings.php:181
#, php-format
msgid ""
"The callback function used for the <strong>%s</strong> setting is missing."
msgstr ""
"A função de callback usada para configuração <strong>%s</strong> está "
"ausente."
#: includes/shortcodes.php:95
msgid ""
"There was a problem with one or more of your feed IDs. Please check your "
"shortcode settings and make sure they are correct."
msgstr ""
"Há um problema com um ou mais IDs de feed. Verifique se a configuração do "
"shortcode está correta."
#: views/admin/display-options-meta.php:39
msgid ""
"Check this box to use the simple display options below instead of the Event "
"Builder code on the left."
msgstr ""
"Marque esta cauxa para usar as opções de exição simples abaixo ao invés do "
"código do Contrutor de Evento à esquerda."
#: views/admin/display-options-meta.php:44
msgid "Start date / time display"
msgstr "Exibição data / hora inicial"
#: views/admin/display-options-meta.php:45
msgid "Select how to display the start date / time."
msgstr "Selecione como exibir data / hora inicial."
#: views/admin/display-options-meta.php:47
#: views/admin/display-options-meta.php:61
msgid "None"
msgstr "Nenhuma"
#: views/admin/display-options-meta.php:48
msgid "Start time"
msgstr "Hora inicial"
#: views/admin/display-options-meta.php:49
msgid "Start date"
msgstr "Data inicial"
#: views/admin/display-options-meta.php:50
msgid "Start time and date"
msgstr "Hora e data inicial"
#: views/admin/display-options-meta.php:51
msgid "Start date and time"
msgstr "Data e hora inicial"
#: views/admin/display-options-meta.php:53
msgid "Text to display before the start time."
msgstr "Texto para exibir antes da hora inicial."
#: views/admin/display-options-meta.php:58
msgid "End time/date display"
msgstr "Exibição data / hora final"
#: views/admin/display-options-meta.php:59
msgid "Select how to display the end date / time."
msgstr "Selecione como exibir data / hora final."
#: views/admin/display-options-meta.php:62
msgid "End time"
msgstr "Hora final"
#: views/admin/display-options-meta.php:63
msgid "End date"
msgstr "Data final"
#: views/admin/display-options-meta.php:64
msgid "End time and date"
msgstr "Hora e data final"
#: views/admin/display-options-meta.php:65
msgid "End date and time"
msgstr "Data e hora final"
#: views/admin/display-options-meta.php:67
msgid "Text to display before the end time."
msgstr "Texto para exibir antes da hora final."
#: views/admin/display-options-meta.php:72
msgid "Separator"
msgstr "Separador"
#: views/admin/display-options-meta.php:74
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 ""
"Se você escolher para exibir data e hora acima, digite o texto/caracteres "
"para exibir entre a hora e data aqui (incluindo espaços)."
#: views/admin/display-options-meta.php:80
msgid "Location"
msgstr "Local"
#: views/admin/display-options-meta.php:82
msgid "Show the location of events?"
msgstr "Exibir local de eventos?"
#: views/admin/display-options-meta.php:83
msgid "Text to display before the location."
msgstr "Texto para exibir antes do local."
#: views/admin/display-options-meta.php:88
msgid "Description"
msgstr "Descrição"
#: views/admin/display-options-meta.php:91
msgid ""
"Show the description of events? (URLs in the description will be made into "
"links)."
msgstr ""
"Exibir a descrição dos eventos? (URLS na descrição serão transformadas em "
"links)."
#: views/admin/display-options-meta.php:93
msgid "Text to display before the description."
msgstr "Texto para exibir antes da descrição."
#: views/admin/display-options-meta.php:95
msgid ""
"Maximum number of words to show from description. Leave blank for no limit."
msgstr ""
"Número máximo de palavras para exibir na descrição. Deixe em branco para "
"nenhum limite."
#: views/admin/display-options-meta.php:100
msgid "Event Link"
msgstr "Link do evento"
#: views/admin/display-options-meta.php:103
msgid "Show a link to the Google Calendar page for an event?"
msgstr "Exibir um link para a página do Google Calendar para um evento?"
#: views/admin/display-options-meta.php:107
msgid "Links open in a new window / tab?"
msgstr "Links abertos em nova aba / janela?"
#: views/admin/display-options-meta.php:109
msgid "The link text to be displayed."
msgstr "O texto do link para ser exibido."
#: views/admin/gce-feed-meta-display.php:77
msgid "Want to be in the know?"
msgstr "Quer estar a saber?"
#: views/admin/gce-feed-meta-display.php:80
msgid "Get notified when new features are released"
msgstr "Seja notificado quando novos recursos forem lançados"
#: views/admin/gce-feed-meta-display.php:91
msgid ""
"Copy and paste this shortcode to display this Google Calendar feed on any "
"post or page."
msgstr ""
"Copie e cole este shortcode para exibir este Feed do Google Calendar em "
"qualquer post ou página."
#: views/admin/gce-feed-meta-display.php:92
msgid ""
"To avoid display issues, make sure to paste the shortcode in the Text tab of "
"the post editor."
msgstr ""
"Para evitar problemas de exibição, certifique-se de colar o shortcode na aba "
"texto do editor do post/página."
#: views/admin/gce-feed-meta-display.php:97
msgid "Google Calendar ID"
msgstr "ID Google Calendar"
#: views/admin/gce-feed-meta-display.php:101
msgid "The Google Calendar ID."
msgstr "A ID do Google Calendar."
#: views/admin/gce-feed-meta-display.php:101
msgid "Example"
msgstr "Exemplo"
#: views/admin/gce-feed-meta-display.php:103
msgid "How to find your Google Calendar ID"
msgstr "Como encontrar ID do Google Calendar"
#: views/admin/gce-feed-meta-display.php:109
msgid "Search Query"
msgstr "Consulta"
#: views/admin/gce-feed-meta-display.php:112
msgid "Find and show events based on a search query."
msgstr "Enontre e exiba eventos baseado em consulta."
#: views/admin/gce-feed-meta-display.php:117
msgid "Expand Recurring Events?"
msgstr "Expandir eventos recorrentes?"
#: views/admin/gce-feed-meta-display.php:119
msgid "Yes"
msgstr "Sim"
#: views/admin/gce-feed-meta-display.php:120
msgid ""
"Display recurring events each time they occur. If disabled, events will be "
"displayed only the first time they occur."
msgstr ""
"Exibir eventos recorrentes cada vez que ocorrer. Se desativado, eventos "
"aparecerão apenas na primeira vez que ocorre."
#: views/admin/gce-feed-meta-display.php:125
msgid "Multiple Day Events"
msgstr "Eventos de múltiplos dias."
#: views/admin/gce-feed-meta-display.php:127
msgid "Show on each day"
msgstr "Exibir em cada dia"
#: views/admin/gce-feed-meta-display.php:128
msgid ""
"Display multiple day events on each day that they span. If disabled, "
"multiple day events will be displayed only on the first day they occur."
msgstr ""
"Exibir eventos de múltiplos dias em cada dia de sua duração. Se desativado, "
"eventos de múltiplos dias serão exibidos apenas no primeiro dia que ocorrem. "
#: views/admin/gce-feed-meta-display.php:133
msgid "Display Mode"
msgstr "Modo de exibição"
#: views/admin/gce-feed-meta-display.php:136 views/widgets.php:294
msgid "Grid (Month view)"
msgstr "Grade (Mês)"
#: views/admin/gce-feed-meta-display.php:139 views/widgets.php:297
msgid "Custom Date Range (List)"
msgstr "Intervalo de datas personalizado (lista)"
#: views/admin/gce-feed-meta-display.php:140 views/widgets.php:298
msgid "Custom Date Range (Grid)"
msgstr "Intervalo de datas personalizado (grade)"
#: views/admin/gce-feed-meta-display.php:142
msgid "Select how to display this feed."
msgstr "Selecione como exibir este feed."
#: views/admin/gce-feed-meta-display.php:147
msgid "Events per Page"
msgstr "Eventos por págian"
#: views/admin/gce-feed-meta-display.php:150 views/widgets.php:313
msgid "Number of Days"
msgstr "Número de dias"
#: views/admin/gce-feed-meta-display.php:151 views/widgets.php:314
msgid "Number of Events"
msgstr "Número de eventos"
#: views/admin/gce-feed-meta-display.php:152 views/widgets.php:315
msgid "One Week"
msgstr "Uma semana"
#: views/admin/gce-feed-meta-display.php:153 views/widgets.php:316
msgid "One Month"
msgstr "Um mês"
#: views/admin/gce-feed-meta-display.php:158
msgid "How many events to display per page (List View only)."
msgstr "Quantos eventos exibir por página (apenas lista)."
#: views/admin/gce-feed-meta-display.php:163
msgid "Display Start Date Offset"
msgstr "Offset de exibição de data inicial"
#: views/admin/gce-feed-meta-display.php:166
#: views/admin/gce-feed-meta-display.php:178 views/widgets.php:330
msgid "Number of Days Back"
msgstr "Número de dias antes"
#: views/admin/gce-feed-meta-display.php:167
#: views/admin/gce-feed-meta-display.php:193 views/widgets.php:331
msgid "Number of Days Forward"
msgstr "Número de dias depois"
#: views/admin/gce-feed-meta-display.php:170 views/widgets.php:335
msgid ""
"Change to initially display events on a date other than today (List View "
"only)."
msgstr ""
"Mudar para exibir inicialmente eventos em uma data diferente de hoje (apenas "
"lista)."
#: views/admin/gce-feed-meta-display.php:175
msgid "Earliest Feed Event Date"
msgstr "Primeira Data de evento do Feed"
#: views/admin/gce-feed-meta-display.php:179
msgid "Number of Months Back"
msgstr "Número de meses antes"
#: views/admin/gce-feed-meta-display.php:180
msgid "Number of Years Back"
msgstr "Número de anos antes"
#: views/admin/gce-feed-meta-display.php:185
msgid "Set how far back to retrieve events regardless of initial display."
msgstr ""
"Defina o quão longe no passado para recuperar eventos independente da "
"exibição inicial."
#: views/admin/gce-feed-meta-display.php:190
msgid "Latest Feed Event Date"
msgstr "Última Data de evento do Feed"
#: views/admin/gce-feed-meta-display.php:194
msgid "Number of Months Forward"
msgstr "Número de meses depois"
#: views/admin/gce-feed-meta-display.php:195
msgid "Number of Years Forward"
msgstr "Número de anos depois"
#: views/admin/gce-feed-meta-display.php:200
msgid ""
"Set how far in the future to retrieve events regardless of initial display."
msgstr ""
"Defina o quão longe no futuro para recuperar eventos independente da "
"exibição inicial."
#: views/admin/gce-feed-meta-display.php:205
msgid "Use Custom Date Range"
msgstr "Usar intervalo de datas personalizado"
#: views/admin/gce-feed-meta-display.php:209
msgctxt "separator between custom date range fields"
msgid "to"
msgstr "à"
#: views/admin/gce-feed-meta-display.php:211
msgid "Set a specific range of events to retrieve."
msgstr "Definir um intervalo específico de eventos para coletar."
#: views/admin/gce-feed-meta-display.php:217 views/widgets.php:345
msgid "Show Paging Links"
msgstr "Exibir links de paginação"
#: views/admin/gce-feed-meta-display.php:220
msgid "Display Next and Back navigation links."
msgstr "Exibir links de navegação Próximo e Anterior"
#: views/admin/gce-feed-meta-display.php:225 views/widgets.php:348
msgid "Show Tooltips"
msgstr "Exibir Tooltips"
#: views/admin/gce-feed-meta-display.php:228
msgid "Display tooltips when hovering over events (Grid View only)."
msgstr "Exibir dicas ao pair sobre eventos (apenas grade)."
#: views/admin/gce-feed-meta-display.php:233
msgid "Date Format"
msgstr "Formato de Data"
#: views/admin/gce-feed-meta-display.php:237
#: views/admin/gce-feed-meta-display.php:248
#, php-format
msgid "Use %sPHP date formatting%s."
msgstr "Usar %sformato de data PHP%s."
#: views/admin/gce-feed-meta-display.php:238
#: views/admin/gce-feed-meta-display.php:249
msgid "Leave blank to use the default."
msgstr "Deixar em branco para padrão."
#: views/admin/gce-feed-meta-display.php:244
msgid "Time Format"
msgstr "Formato de Hora"
#: views/admin/gce-feed-meta-display.php:255
msgid "Cache Duration"
msgstr "Duração do cache"
#: views/admin/gce-feed-meta-display.php:258
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 duração do tempo, em segundos do cache do feed (43200 = 12 horas). Se este "
"feed se altera regularmente, você vai querer reduzir a duração do cache."
#: views/admin/gce-feed-sidebar-help.php:6
msgid "Documentation & getting started"
msgstr "Documentação & Primeiros passos"
#: views/admin/gce-feed-sidebar-help.php:11
msgid "Community support forums"
msgstr "Fóruns de suporte"
#: views/admin/gce-feed-sidebar-help.php:16
msgid "Rate this plugin"
msgstr "Avalie este plugin"
#: views/admin/gce-feed-sidebar-help.php:21
msgid "View our roadmap & vote"
msgstr "Veja nossos planos & vote"
#: views/admin/gce-feed-sidebar-help.php:26
msgid "Get notified of new features"
msgstr "Seja notificado de novos recursos"
#: views/widgets.php:28
msgid ""
"Display a list or calendar grid of events from one or more Google Calendar "
"feeds you have added"
msgstr ""
"Exibir uma lista ou grade de calendário de eventos de um ou mais feeds do "
"Google Calendar adicionado"
#: views/widgets.php:167
msgid ""
"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."
msgstr ""
"Nenhum ID de feed válido foi digitado para este widget. Por favor verifique "
"se você digitou corretamente na configuração do widget (Aparência > "
"Widgets), e que os seus feeds não foram excluídos."
#: views/widgets.php:207
msgid ""
"There was a problem with one or more of your feed IDs. Please check your "
"widget settings and make sure they are correct."
msgstr ""
"Há um problema com um ou mais IDs de Feed. Por favor verifique se as "
"configurações do widget estão corretas."
#: views/widgets.php:213
msgid "You have not added any feeds yet."
msgstr "Você não adicionou nenhum feed ainda."
#: views/widgets.php:256
msgid "There are no feeds created yet."
msgstr "Não foram criados feeds ainda."
#: views/widgets.php:257
msgid "Add your first feed!"
msgstr "Adicione seu primeiro feed!"
#: views/widgets.php:267
msgid "Events on"
msgstr "Eventos em"
#: views/widgets.php:281
msgid "Title:"
msgstr "Título:"
#: views/widgets.php:286
msgid "Feeds to Display (comma separated list - i.e. 101,102,103):"
msgstr "Feeds para Exibir (separados por vírgula, ex.: 101,102,103):"
#: views/widgets.php:292
msgid "Display Events as:"
msgstr "Exibir eventos como:"
#: views/widgets.php:303
msgid "Sort Order (List View only):"
msgstr "Ordenação (apenas lista):"
#: views/widgets.php:305
msgid "Ascending"
msgstr "Ascendente"
#: views/widgets.php:306
msgid "Descending"
msgstr "Descendente"
#: views/widgets.php:311
msgid "Events per Page (List View only):"
msgstr "Eventos por página (apenas lista):"
#: views/widgets.php:324
msgid ""
"This setting will pull from the custom date range set in the main feed "
"settings and cannot be changed here."
msgstr ""
"Essa configuração vai puxar a partir do intervalo de datas personalizado "
"definido nas configurações principais do feed e não pode ser alterada aqui."
#: views/widgets.php:328
msgid "Display Start Date Offset (List View only):"
msgstr "Exibir offset de data incial (apenas lista):"
#: views/widgets.php:339
msgid ""
"Display Title on Tooltip/List Item (e.g. 'Events on 7th March'). Grouped "
"lists always have a title displayed."
msgstr ""
"Exibir título na tooltop/lista (ex.: 'Eventos em 7 de março'). Listas "
"agrupadas sempre tem um título exibido."
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Google Calendar Events\n"
"POT-Creation-Date: 2014-11-22 16:21-0700\n"
"PO-Revision-Date: 2014-11-22 16:21-0700\n"
"POT-Creation-Date: 2015-02-25 15:34-0700\n"
"PO-Revision-Date: 2015-02-25 15:34-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en\n"
@@ -15,43 +15,47 @@ msgstr ""
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-SearchPath-0: google-calendar-events\n"
#: google-calendar-events/class-google-calendar-events-admin.php:128
#: google-calendar-events/class-google-calendar-events-admin.php:129
#: google-calendar-events/class-google-calendar-events-admin.php:200
#: google-calendar-events/class-google-calendar-events-admin.php:126
#: google-calendar-events/class-google-calendar-events-admin.php:127
#: google-calendar-events/class-google-calendar-events-admin.php:218
#: google-calendar-events/includes/register-settings.php:54
msgid "General Settings"
msgstr ""
#: google-calendar-events/class-google-calendar-events-admin.php:188
#: google-calendar-events/class-google-calendar-events-admin.php:206
#: google-calendar-events/views/widgets.php:27
msgid "Google Calendar Events"
msgstr ""
#: google-calendar-events/class-google-calendar-events-admin.php:201
#: google-calendar-events/class-google-calendar-events-admin.php:219
msgid "Feeds"
msgstr ""
#: google-calendar-events/class-google-calendar-events.php:90
msgid "Loading..."
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:20
msgid "Cache has been cleared for this feed."
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:35
#: google-calendar-events/includes/admin/admin-functions.php:57
#: google-calendar-events/includes/admin/admin-functions.php:55
msgid "Starts:"
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:36
#: google-calendar-events/includes/admin/admin-functions.php:59
#: google-calendar-events/includes/admin/admin-functions.php:57
msgid "Ends:"
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:37
#: google-calendar-events/includes/admin/admin-functions.php:61
#: google-calendar-events/includes/admin/admin-functions.php:59
msgid "Location:"
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:38
#: google-calendar-events/includes/admin/admin-functions.php:62
#: google-calendar-events/includes/admin/admin-functions.php:60
msgid "Description:"
msgstr ""
@@ -59,108 +63,135 @@ msgstr ""
msgid "More details..."
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:64
#: google-calendar-events/includes/admin/admin-functions.php:62
msgid "More Details"
msgstr ""
#: google-calendar-events/includes/admin/admin-functions.php:78
#: google-calendar-events/includes/gce-feed-cpt.php:264
#: google-calendar-events/includes/admin/admin-functions.php:76
#: google-calendar-events/includes/gce-feed-cpt.php:279
msgid "Clear Cache"
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:26
msgid "GCal API Key Notice"
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:28
msgid ""
"GCal Events uses the Google Calendar API version 3. By default this plugin "
"uses a public shared key across all plugin users."
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:30
msgid ""
"This key is limited to 500,000 requests per day and 5 requests per second. "
"To avoid running into any potential limits you can use your own Google API "
"key."
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:33
msgid "Enter your GCal API key"
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:34
msgid "Configure GCal feeds"
msgstr ""
#: google-calendar-events/includes/admin/admin-notice.php:35
msgid "Hide this"
msgstr ""
#: google-calendar-events/includes/class-gce-display.php:179
#: google-calendar-events/includes/class-gce-display.php:270
#: google-calendar-events/views/admin/gce-feed-meta-display.php:185
#: google-calendar-events/views/widgets.php:252
#: google-calendar-events/includes/class-gce-display.php:289
msgid "Back"
msgstr ""
#: google-calendar-events/includes/class-gce-display.php:183
#: google-calendar-events/includes/class-gce-display.php:271
#: google-calendar-events/includes/class-gce-display.php:290
msgid "Next"
msgstr ""
#: google-calendar-events/includes/class-gce-display.php:371
#: google-calendar-events/includes/class-gce-display.php:392
msgid "No events to display."
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:504
#: google-calendar-events/includes/class-gce-event.php:518
#, php-format
msgid "%s year"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:504
#: google-calendar-events/includes/class-gce-event.php:518
#, php-format
msgid "%s years"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:505
#: google-calendar-events/includes/class-gce-event.php:519
#, php-format
msgid "%s month"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:505
#: google-calendar-events/includes/class-gce-event.php:519
#, php-format
msgid "%s months"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:506
#: google-calendar-events/includes/class-gce-event.php:520
#, php-format
msgid "%s week"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:506
#: google-calendar-events/includes/class-gce-event.php:520
#, php-format
msgid "%s weeks"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:507
#: google-calendar-events/includes/class-gce-event.php:521
#, php-format
msgid "%s day"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:507
#: google-calendar-events/includes/class-gce-event.php:521
#, php-format
msgid "%s days"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:508
#: google-calendar-events/includes/class-gce-event.php:522
#, php-format
msgid "%s hour"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:508
#: google-calendar-events/includes/class-gce-event.php:522
#, php-format
msgid "%s hours"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:509
#: google-calendar-events/includes/class-gce-event.php:523
#, php-format
msgid "%s min"
msgstr ""
#: google-calendar-events/includes/class-gce-event.php:509
#: google-calendar-events/includes/class-gce-event.php:523
#, php-format
msgid "%s mins"
msgstr ""
#: google-calendar-events/includes/class-gce-feed.php:89
#: google-calendar-events/includes/class-gce-feed.php:93
msgid ""
"The feed URL has not been set. Please make sure to set it correctly in the "
"Feed settings."
"The Google Calendar ID has not been set. Please make sure to set it "
"correctly in the Feed settings."
msgstr ""
#: google-calendar-events/includes/class-gce-feed.php:194
#: google-calendar-events/includes/class-gce-feed.php:197
msgid ""
"Some data was retrieved, but could not be parsed successfully. Please ensure "
"your feed settings are correct."
msgstr ""
#: google-calendar-events/includes/class-gce-feed.php:197
#: google-calendar-events/includes/class-gce-feed.php:200
msgid "An error has occured."
msgstr ""
#: google-calendar-events/includes/class-gce-feed.php:202
#: google-calendar-events/includes/class-gce-feed.php:205
msgid " Please ensure your calendar ID is correct."
msgstr ""
@@ -256,41 +287,35 @@ msgstr ""
msgid "Display Options"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:217
#: google-calendar-events/includes/gce-feed-cpt.php:232
msgid "Feed ID"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:218
#: google-calendar-events/views/admin/gce-feed-meta-display.php:73
#: google-calendar-events/includes/gce-feed-cpt.php:233
#: google-calendar-events/views/admin/gce-feed-meta-display.php:87
msgid "Feed Shortcode"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:219
#: google-calendar-events/includes/gce-feed-cpt.php:234
msgid "Display Type"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:246
#: google-calendar-events/views/admin/gce-feed-meta-display.php:152
#: google-calendar-events/views/widgets.php:218
#: google-calendar-events/includes/gce-feed-cpt.php:261
msgid "Grid"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:248
#: google-calendar-events/views/admin/gce-feed-meta-display.php:153
#: google-calendar-events/views/widgets.php:219
#: google-calendar-events/includes/gce-feed-cpt.php:263
#: google-calendar-events/views/admin/gce-feed-meta-display.php:137
#: google-calendar-events/views/widgets.php:287
msgid "List"
msgstr ""
#: google-calendar-events/includes/gce-feed-cpt.php:250
#: google-calendar-events/views/admin/gce-feed-meta-display.php:154
#: google-calendar-events/views/widgets.php:220
#: google-calendar-events/includes/gce-feed-cpt.php:265
#: google-calendar-events/views/admin/gce-feed-meta-display.php:138
#: google-calendar-events/views/widgets.php:288
msgid "Grouped List"
msgstr ""
#: google-calendar-events/includes/misc-functions.php:21
msgid "Loading..."
msgstr ""
#: google-calendar-events/includes/register-settings.php:29
msgid "Google API Key"
msgstr ""
@@ -330,32 +355,10 @@ msgid ""
"The callback function used for the <strong>%s</strong> setting is missing."
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:27
msgid "GCal Events Important Update (Nov. 19, 2014):"
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:28
#: google-calendar-events/includes/shortcodes.php:95
msgid ""
"GCal Events now uses the Google API version 3, which requires use of a "
"public key."
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:29
msgid ""
"By default a shared key is used across all plugin users, which is limited to "
"500,000 requests per day and 5 requests per second."
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:30
msgid "To avoid these limits you can use your own Google API key."
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:33
msgid "Update your API settings now"
msgstr ""
#: google-calendar-events/views/admin/api-settings-notice.php:34
msgid "Hide this"
"There was a problem with one or more of your feed IDs. Please check your "
"shortcode settings and make sure they are correct."
msgstr ""
#: google-calendar-events/views/admin/display-options-meta.php:39
@@ -482,223 +485,253 @@ msgstr ""
msgid "The link text to be displayed."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:54
msgid ""
"We're <strong>smack dab</strong> in the middle of building additional "
"features for this plugin. Have ideas?"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:57
msgid "Visit our roadmap and tell us what you're looking for"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:63
#: google-calendar-events/views/admin/gce-feed-meta-display.php:77
msgid "Want to be in the know?"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:66
#: google-calendar-events/views/admin/gce-feed-meta-display.php:80
msgid "Get notified when new features are released"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:77
#: google-calendar-events/views/admin/gce-feed-meta-display.php:91
msgid ""
"Copy and paste this shortcode to display this Google Calendar feed on any "
"post or page."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:78
#: google-calendar-events/views/admin/gce-feed-meta-display.php:92
msgid ""
"To avoid display issues, make sure to paste the shortcode in the Text tab of "
"the post editor."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:83
#: google-calendar-events/views/admin/gce-feed-meta-display.php:97
msgid "Google Calendar ID"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:87
#: google-calendar-events/views/admin/gce-feed-meta-display.php:101
msgid "The Google Calendar ID."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:87
#: google-calendar-events/views/admin/gce-feed-meta-display.php:101
msgid "Example"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:89
msgid "How to find your GCal calendar ID"
#: google-calendar-events/views/admin/gce-feed-meta-display.php:103
msgid "How to find your Google Calendar ID"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:95
#: google-calendar-events/views/admin/gce-feed-meta-display.php:109
msgid "Search Query"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:98
#: google-calendar-events/views/admin/gce-feed-meta-display.php:112
msgid "Find and show events based on a search query."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:103
#: google-calendar-events/views/admin/gce-feed-meta-display.php:117
msgid "Expand Recurring Events?"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:105
#: google-calendar-events/views/admin/gce-feed-meta-display.php:119
msgid "Yes"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:106
#: google-calendar-events/views/admin/gce-feed-meta-display.php:120
msgid ""
"This will show recurring events each time they occur, otherwise it will only "
"show the event the first time it occurs."
"Display recurring events each time they occur. If disabled, events will be "
"displayed only the first time they occur."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:111
#: google-calendar-events/views/admin/gce-feed-meta-display.php:125
msgid "Multiple Day Events"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:127
msgid "Show on each day"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:128
msgid ""
"Display multiple day events on each day that they span. If disabled, "
"multiple day events will be displayed only on the first day they occur."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:133
msgid "Display Mode"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:136
#: google-calendar-events/views/widgets.php:286
msgid "Grid (Month view)"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:139
#: google-calendar-events/views/widgets.php:289
msgid "Custom Date Range (List)"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:141
msgid "Select how to display this feed."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:146
msgid "Events per Page"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:149
#: google-calendar-events/views/widgets.php:304
msgid "Number of Days"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:150
#: google-calendar-events/views/widgets.php:305
msgid "Number of Events"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:151
#: google-calendar-events/views/widgets.php:306
msgid "One Week"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:152
#: google-calendar-events/views/widgets.php:307
msgid "One Month"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:157
msgid "How many events to display per page (List View only)."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:162
msgid "Display Start Date Offset"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:165
#: google-calendar-events/views/admin/gce-feed-meta-display.php:177
#: google-calendar-events/views/widgets.php:321
msgid "Number of Days Back"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:166
#: google-calendar-events/views/admin/gce-feed-meta-display.php:192
#: google-calendar-events/views/widgets.php:322
msgid "Number of Days Forward"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:169
#: google-calendar-events/views/widgets.php:326
msgid ""
"Change to initially display events on a date other than today (List View "
"only)."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:174
msgid "Earliest Feed Event Date"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:178
msgid "Number of Months Back"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:179
msgid "Number of Years Back"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:184
msgid "Set how far back to retrieve events regardless of initial display."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:189
msgid "Latest Feed Event Date"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:193
msgid "Number of Months Forward"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:194
msgid "Number of Years Forward"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:199
msgid ""
"Set how far in the future to retrieve events regardless of initial display."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:204
msgid "Use Custom Date Range"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:210
msgid "Set a specific range of events to retrieve."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:216
#: google-calendar-events/views/widgets.php:336
msgid "Show Paging Links"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:219
msgid "Display Next and Back navigation links."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:224
#: google-calendar-events/views/widgets.php:339
msgid "Show Tooltips"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:227
msgid "Display tooltips when hovering over events (Grid View only)."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:232
msgid "Date Format"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:115
#: google-calendar-events/views/admin/gce-feed-meta-display.php:126
#: google-calendar-events/views/admin/gce-feed-meta-display.php:236
#: google-calendar-events/views/admin/gce-feed-meta-display.php:247
#, php-format
msgid "Use %sPHP date formatting%s."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:116
#: google-calendar-events/views/admin/gce-feed-meta-display.php:127
#: google-calendar-events/views/admin/gce-feed-meta-display.php:237
#: google-calendar-events/views/admin/gce-feed-meta-display.php:248
msgid "Leave blank to use the default."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:122
#: google-calendar-events/views/admin/gce-feed-meta-display.php:243
msgid "Time Format"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:133
#: google-calendar-events/views/admin/gce-feed-meta-display.php:254
msgid "Cache Duration"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:136
#: google-calendar-events/views/admin/gce-feed-meta-display.php:257
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 ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:141
msgid "Multiple Day Events"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:143
msgid "Show on each day"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:144
msgid ""
"Show events that span multiple days on each day that they span, rather than "
"just the first day."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:149
msgid "Display Mode"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:156
msgid "Choose how you want your calendar to be displayed."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:161
msgid "Show Paging Links"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:163
#: google-calendar-events/views/widgets.php:227
msgid "Check this option to display Next and Back navigation links."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:168
msgid "Number of Events per Page"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:172
#: google-calendar-events/views/admin/gce-feed-meta-display.php:183
#: google-calendar-events/views/admin/gce-feed-meta-display.php:197
#: google-calendar-events/views/admin/gce-feed-meta-display.php:211
#: google-calendar-events/views/widgets.php:242
#: google-calendar-events/views/widgets.php:250
msgid "Days"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:173
#: google-calendar-events/views/widgets.php:243
msgid "Events"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:175
msgid "How many events to display per page (List View only)."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:180
msgid "Display Start Date Offset"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:186
#: google-calendar-events/views/widgets.php:253
msgid "Ahead"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:188
msgid ""
"Change if you need to initially display events on a date other than today "
"(List View only)."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:193
msgid "Minimum Feed Start Date"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:198
#: google-calendar-events/views/admin/gce-feed-meta-display.php:212
msgid "Months"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:199
#: google-calendar-events/views/admin/gce-feed-meta-display.php:213
msgid "Years"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:201
msgid "back"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:202
msgid ""
"Set how far back to retrieve events regardless of month or page being "
"displayed."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:207
msgid "Maximum Feed End Date"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:215
msgid "forward"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-meta-display.php:216
msgid ""
"Set how far in the future to retrieve events regardless of month or page "
"being displayed."
msgstr ""
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:6
msgid "Documentation & getting started"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:12
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:11
msgid "Community support forums"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:18
msgid "Get notified of new features"
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:16
msgid "Rate this plugin"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:24
msgid "Rate this plugin"
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:21
msgid "View our roadmap & vote"
msgstr ""
#: google-calendar-events/views/admin/gce-feed-sidebar-help.php:26
msgid "Get notified of new features"
msgstr ""
#: google-calendar-events/views/widgets.php:28
@@ -707,66 +740,74 @@ msgid ""
"feeds you have added"
msgstr ""
#: google-calendar-events/views/widgets.php:111
#: google-calendar-events/views/widgets.php:159
msgid ""
"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."
msgstr ""
#: google-calendar-events/views/widgets.php:144
#: google-calendar-events/views/widgets.php:199
msgid ""
"There was a problem with one or more of your feed IDs. Please check your "
"widget settings and make sure they are correct."
msgstr ""
#: google-calendar-events/views/widgets.php:205
msgid "You have not added any feeds yet."
msgstr ""
#: google-calendar-events/views/widgets.php:186
#: google-calendar-events/views/widgets.php:248
msgid "There are no feeds created yet."
msgstr ""
#: google-calendar-events/views/widgets.php:187
#: google-calendar-events/views/widgets.php:249
msgid "Add your first feed!"
msgstr ""
#: google-calendar-events/views/widgets.php:197
#: google-calendar-events/views/widgets.php:259
msgid "Events on"
msgstr ""
#: google-calendar-events/views/widgets.php:206
#: google-calendar-events/views/widgets.php:273
msgid "Title:"
msgstr ""
#: google-calendar-events/views/widgets.php:211
#: google-calendar-events/views/widgets.php:278
msgid "Feeds to Display (comma separated list - i.e. 101,102,103):"
msgstr ""
#: google-calendar-events/views/widgets.php:216
#: google-calendar-events/views/widgets.php:284
msgid "Display Events as:"
msgstr ""
#: google-calendar-events/views/widgets.php:225
msgid "Show Paging Links:"
msgstr ""
#: google-calendar-events/views/widgets.php:231
#: google-calendar-events/views/widgets.php:294
msgid "Sort Order (List View only):"
msgstr ""
#: google-calendar-events/views/widgets.php:233
#: google-calendar-events/views/widgets.php:296
msgid "Ascending"
msgstr ""
#: google-calendar-events/views/widgets.php:234
#: google-calendar-events/views/widgets.php:297
msgid "Descending"
msgstr ""
#: google-calendar-events/views/widgets.php:239
msgid "Number of Events per Page (List View only):"
#: google-calendar-events/views/widgets.php:302
msgid "Events per Page (List View only):"
msgstr ""
#: google-calendar-events/views/widgets.php:248
#: google-calendar-events/views/widgets.php:315
msgid ""
"This setting will pull from the custom date range set in the main feed "
"settings and cannot be changed here."
msgstr ""
#: google-calendar-events/views/widgets.php:319
msgid "Display Start Date Offset (List View only):"
msgstr ""
#: google-calendar-events/views/widgets.php:258
#: google-calendar-events/views/widgets.php:330
msgid ""
"Display Title on Tooltip/List Item (e.g. 'Events on 7th March'). Grouped "
"lists always have a title displayed."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 25 KiB

@@ -26,7 +26,13 @@ if ( empty( $general['save_settings'] ) ) {
'post_status' => array(
'any',
'trash',
'auto-draft'
'auto-draft',
'trash',
'draft',
'pending',
'future',
'private',
'inherit'
)
));
@@ -55,6 +61,32 @@ if ( empty( $general['save_settings'] ) ) {
delete_post_meta_by_key( 'gce_list_max_length' );
delete_post_meta_by_key( 'gce_list_start_offset_num' );
delete_post_meta_by_key( 'gce_list_start_offset_direction' );
delete_post_meta_by_key( 'old_gce_id' );
delete_post_meta_by_key( 'gce_display_link' );
delete_post_meta_by_key( 'gce_display_link_text' );
delete_post_meta_by_key( 'gce_display_end' );
delete_post_meta_by_key( 'gce_display_end_text' );
delete_post_meta_by_key( 'gce_display_separator' );
delete_post_meta_by_key( 'gce_display_location_text' );
delete_post_meta_by_key( 'gce_display_description_text' );
delete_post_meta_by_key( 'gce_expand_recurring' );
delete_post_meta_by_key( 'gce_feed_end' );
delete_post_meta_by_key( 'gce_feed_end_interval' );
delete_post_meta_by_key( 'gce_display_start' );
delete_post_meta_by_key( 'gce_display_start_text' );
delete_post_meta_by_key( 'gce_paging_widget' );
delete_post_meta_by_key( 'gce_widget_paging_interval' );
delete_post_meta_by_key( 'gce_feed_end_custom' );
delete_post_meta_by_key( 'gce_feed_end_num' );
delete_post_meta_by_key( 'gce_feed_start_custom' );
delete_post_meta_by_key( 'gce_feed_start_num' );
delete_post_meta_by_key( 'gce_per_page_to' );
delete_post_meta_by_key( 'gce_per_page_from' );
delete_post_meta_by_key( 'gce_per_page_num' );
delete_post_meta_by_key( 'gce_events_per_page' );
delete_post_meta_by_key( 'gce_end_date' );
delete_post_meta_by_key( 'gce_date_range' );
delete_post_meta_by_key( 'gce_start_date' );
// Remove options
delete_option( 'gce_upgrade_has_run' );
@@ -1,36 +0,0 @@
<?php
/**
* Show notice for API Settings
*
* @package GCE
* @subpackage admin/views
* @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
/* #gce-install-notice .button-primary, */
#gce-install-notice .button-secondary {
margin-left: 15px;
}
</style>
<div id="gce-install-notice" class="updated">
<p>
<strong><?php echo __( 'GCal Events Important Update (Nov. 19, 2014):', 'gce' ); ?></strong><br/>
<?php echo __( 'GCal Events now uses the Google API version 3, which requires use of a public key.', 'gce' ); ?>
<?php echo __( 'By default a shared key is used across all plugin users, which is limited to 500,000 requests per day and 5 requests per second.', 'gce' ); ?>
<?php echo __( 'To avoid these limits you can use your own Google API key.', 'gce' ); ?>
</p>
<p>
<a href="<?php echo admin_url( 'edit.php?post_type=gce_feed&page=google-calendar-events_general_settings' ); ?>" class="button-primary"><?php _e( 'Update your API settings now', 'gce' ); ?></a>
<a href="<?php echo add_query_arg( 'gce-dismiss-install-nag', 1 ); ?>" class="button-secondary"><?php _e( 'Hide this', 'gce' ); ?></a>
</p>
</div>
@@ -51,7 +51,7 @@
<option value="date-time" <?php selected( $gce_display_start, 'date-time', true ); ?>><?php _e( 'Start date and time', 'gce' ); ?></option>
</select>
<label class="description" for="gce_display_start_text"><?php _e( 'Text to display before the start time.', 'gce' ); ?></label>
<input type="text" name="gce_display_start_text" id="gce_display_start_text" value="<?php echo $gce_display_start_text; ?>" />
<input type="text" name="gce_display_start_text" id="gce_display_start_text" value="<?php echo esc_attr( $gce_display_start_text ); ?>" />
</div>
<div class="gce-meta-control">
@@ -65,7 +65,7 @@
<option value="date-time" <?php selected( $gce_display_end, 'date-time', true ); ?>><?php _e( 'End date and time', 'gce' ); ?></option>
</select>
<label class="description" for="gce_display_end_text"><?php _e( 'Text to display before the end time.', 'gce' ); ?></label>
<input type="text" name="gce_display_end_text" id="gce_display_end_text" value="<?php echo $gce_display_end_text; ?>" />
<input type="text" name="gce_display_end_text" id="gce_display_end_text" value="<?php echo esc_attr( $gce_display_end_text ); ?>" />
</div>
<div class="gce-meta-control">
@@ -73,7 +73,7 @@
<label class="description" for="gce_display_separator">
<?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' ); ?>
</label>
<input type="text" name="gce_display_separator" id="gce_display_separator" value="<?php echo $gce_display_separator; ?>" />
<input type="text" name="gce_display_separator" id="gce_display_separator" value="<?php echo esc_attr( $gce_display_separator ); ?>" />
</div>
<div class="gce-meta-control">
@@ -81,7 +81,7 @@
<p><input type="checkbox" name="gce_display_location" id="gce_display_location" value="1" <?php checked( $gce_display_location, '1' ); ?> />
<label for="gce_display_location"><?php _e( 'Show the location of events?', 'gce' ); ?></label></p>
<label class="description" for="gce_display_location_text"><?php _e( 'Text to display before the location.', 'gce' ); ?></label>
<input type="text" name="gce_display_location_text" id="gce_display_location_text" value="<?php echo $gce_display_location_text; ?>" />
<input type="text" name="gce_display_location_text" id="gce_display_location_text" value="<?php echo esc_attr( $gce_display_location_text ); ?>" />
</div>
<div class="gce-meta-control">
@@ -91,9 +91,9 @@
<label for="gce_display_description"><?php _e( 'Show the description of events? (URLs in the description will be made into links).', 'gce' ); ?></label>
</p>
<label class="description" for="gce_display_description_text"><?php _e( 'Text to display before the description.', 'gce' ); ?></label>
<input type="text" name="gce_display_description_text" id="gce_display_description_text" value="<?php echo $gce_display_description_text; ?>" />
<input type="text" name="gce_display_description_text" id="gce_display_description_text" value="<?php echo esc_attr( $gce_display_description_text ); ?>" />
<label class="description" for="gce_display_description_max"><?php _e( 'Maximum number of words to show from description. Leave blank for no limit.', 'gce' ); ?></label>
<input type="text" name="gce_display_description_max" id="gce_display_description_max" value="<?php echo $gce_display_description_max; ?>" />
<input type="text" name="gce_display_description_max" id="gce_display_description_max" value="<?php echo esc_attr( $gce_display_description_max ); ?>" />
</div>
<div class="gce-meta-control">
@@ -107,6 +107,6 @@
<label for="gce_display_link_tab"><?php _e( 'Links open in a new window / tab?', 'gce' ); ?></label>
</p>
<label class="description" for="gce_display_link_text"><?php _e( 'The link text to be displayed.', 'gce' ); ?></label>
<input type="text" name="gce_display_link_text" id="gce_display_link_text" value="<?php echo $gce_display_link_text; ?>" />
<input type="text" name="gce_display_link_text" id="gce_display_link_text" value="<?php echo esc_attr( $gce_display_link_text ); ?>" />
</div>
</div>
@@ -28,38 +28,44 @@
$gce_search_query = get_post_meta( $post->ID, 'gce_search_query', true );
$gce_expand_recurring = get_post_meta( $post->ID, 'gce_expand_recurring', true );
$gce_paging = get_post_meta( $post->ID, 'gce_paging', true );
$gce_list_max_num = get_post_meta( $post->ID, 'gce_list_max_num', true );
$gce_list_max_length = get_post_meta( $post->ID, 'gce_list_max_length', true );
$gce_events_per_page = get_post_meta( $post->ID, 'gce_events_per_page', true );
$gce_per_page_num = get_post_meta( $post->ID, 'gce_per_page_num', true );
$gce_list_start_offset_num = get_post_meta( $post->ID, 'gce_list_start_offset_num', true );
$gce_list_start_offset_direction = get_post_meta( $post->ID, 'gce_list_start_offset_direction', true );
$gce_feed_start = get_post_meta( $post->ID, 'gce_feed_start', true );
$gce_feed_start_interval = get_post_meta( $post->ID, 'gce_feed_start_interval', true );
$gce_feed_start_num = get_post_meta( $post->ID, 'gce_feed_start_num', true );
$gce_feed_end = get_post_meta( $post->ID, 'gce_feed_end', true );
$gce_feed_end_interval = get_post_meta( $post->ID, 'gce_feed_end_interval', true );
$gce_feed_end_num = get_post_meta( $post->ID, 'gce_feed_end_num', true );
$gce_feed_range_start = get_post_meta( $post->ID, 'gce_feed_range_start', true );
$gce_feed_range_end = get_post_meta( $post->ID, 'gce_feed_range_end', true );
$range = selected( $gce_display_mode, 'date-range-list', false ) || selected( $gce_display_mode, 'date-range-grid', false );
$use_range = ( $range ? true : false );
if( empty( $gce_events_per_page ) ) {
$gce_events_per_page = 'days';
}
$gce_show_tooltips = get_post_meta( $post->ID, 'gce_show_tooltips', true );
if( empty( $gce_list_start_offset_num ) ) {
$gce_list_start_offset_num = 0;
}
if( empty( $gce_feed_start ) ) {
$gce_feed_start = 0;
$gce_feed_start = 'years';
}
if( empty( $gce_feed_end ) ) {
$gce_feed_end = 0;
$gce_feed_end = 'years';
}
if( empty( $gce_per_page_num ) ) {
$gce_per_page_num = 7;
}
?>
<div id="gce-admin-promo">
<?php echo __( 'We\'re <strong>smack dab</strong> in the middle of building additional features for this plugin. Have ideas?', 'gce' ); ?>
<strong>
<a href="https://trello.com/b/ZQSzsarY" target="_blank">
<?php echo __( 'Visit our roadmap and tell us what you\'re looking for', 'gce' ); ?>
</a>
</strong>
<br/>
<br/>
<?php echo __( 'Want to be in the know?', 'gce' ); ?>
<strong>
<a href="http://eepurl.com/0_VsT" target="_blank">
@@ -82,11 +88,11 @@
<tr>
<th scope="row"><label for="gce_feed_url"><?php _e( 'Google Calendar ID', 'gce' ); ?></label></th>
<td>
<input type="text" class="regular-text" style="width: 30em;" name="gce_feed_url" id="gce_feed_url" value="<?php echo $gce_feed_url; ?>" />
<input type="text" class="regular-text" style="width: 30em;" name="gce_feed_url" id="gce_feed_url" value="<?php echo esc_attr( $gce_feed_url ); ?>" />
<p class="description">
<?php _e( 'The Google Calendar ID.', 'gce' ); ?> <?php _e( 'Example', 'gce' ); ?>:<br/>
<code>umsb0ekhivs1a2ubtq6vlqvcjk@group.calendar.google.com</code><br/>
<a href="<?php echo gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/getting-started/find-calendar-id/', 'gce_lite', 'settings_link', 'docs' ); ?>" target="_blank"><?php _e( 'How to find your GCal calendar ID', 'gce' ); ?></a>
<a href="<?php echo gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/getting-started/find-calendar-id/', 'gce_lite', 'settings_link', 'docs' ); ?>" target="_blank"><?php _e( 'How to find your Google Calendar ID', 'gce' ); ?></a>
</p>
</td>
</tr>
@@ -94,7 +100,7 @@
<tr>
<th scope="row"><label for="gce_search_query"><?php _e( 'Search Query', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_search_query" id="gce_search_query" value="<?php echo $gce_search_query; ?>" />
<input type="text" class="" name="gce_search_query" id="gce_search_query" value="<?php echo esc_attr( $gce_search_query ); ?>" />
<p class="description"><?php _e( 'Find and show events based on a search query.', 'gce' ); ?></p>
</td>
</tr>
@@ -103,45 +109,15 @@
<th scope="row"><label for="gce_expand_recurring"><?php _e( 'Expand Recurring Events?', 'gce' ); ?></label></th>
<td>
<input type="checkbox" name="gce_expand_recurring" id="gce_expand_recurring" value="1" <?php checked( $gce_expand_recurring, '1' ); ?> /> <?php _e( 'Yes', 'gce' ); ?>
<p class="description"><?php _e( 'This will show recurring events each time they occur, otherwise it will only show the event the first time it occurs.', 'gce' ); ?></p>
<p class="description"><?php _e( 'Display recurring events each time they occur. If disabled, events will be displayed only the first time they occur.', 'gce' ); ?></p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_date_format"><?php _e( 'Date Format', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_date_format" id="gce_date_format" value="<?php echo $gce_date_format; ?>" />
<p class="description">
<?php printf( __( 'Use %sPHP date formatting%s.', 'gce' ), '<a href="http://php.net/manual/en/function.date.php" target="_blank">', '</a>' ); ?>
<?php _e( 'Leave blank to use the default.', 'gce' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_time_format"><?php _e( 'Time Format', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_time_format" id="gce_time_format" value="<?php echo $gce_time_format; ?>" />
<p class="description">
<?php printf( __( 'Use %sPHP date formatting%s.', 'gce' ), '<a href="http://php.net/manual/en/function.date.php" target="_blank">', '</a>' ); ?>
<?php _e( 'Leave blank to use the default.', 'gce' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_cache"><?php _e( 'Cache Duration', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_cache" id="gce_cache" value="<?php echo $gce_cache; ?>" />
<p 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' ); ?></p>
<td>
</tr>
<tr>
<th scope="row"><label for="gce_multi_day_events"><?php _e( 'Multiple Day Events', 'gce' ); ?></label></th>
<td>
<input type="checkbox" name="gce_multi_day_events" id="gce_multi_day_events" value="1" <?php checked( $gce_multi_day_events, '1' ); ?> /> <?php _e( 'Show on each day', 'gce' ); ?>
<p class="description"><?php _e( 'Show events that span multiple days on each day that they span, rather than just the first day.', 'gce' ); ?></p>
<p class="description"><?php _e( 'Display multiple day events on each day that they span. If disabled, multiple day events will be displayed only on the first day they occur.', 'gce' ); ?></p>
</td>
</tr>
@@ -149,71 +125,139 @@
<th scope="row"><label for="gce_display_mode"><?php _e( 'Display Mode', 'gce' ); ?></label></th>
<td>
<select name="gce_display_mode" id="gce_display_mode">
<option value="grid" <?php selected( $gce_display_mode, 'grid', true ); ?>><?php _e( 'Grid', 'gce' ); ?></option>
<option value="grid" <?php selected( $gce_display_mode, 'grid', true ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
<option value="list" <?php selected( $gce_display_mode, 'list', true ); ?>><?php _e( 'List', 'gce' ); ?></option>
<option value="list-grouped" <?php selected( $gce_display_mode, 'list-grouped', true ); ?>><?php _e( 'Grouped List', 'gce' ); ?></option>
<option value="date-range-list" <?php selected( $gce_display_mode, 'date-range-list', true ); ?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
<option value="date-range-grid" <?php selected( $gce_display_mode, 'date-range-grid', true ); ?>><?php _e( 'Custom Date Range (Grid)', 'gce' ); ?></option>
</select>
<p class="description"><?php _e( 'Choose how you want your calendar to be displayed.', 'gce' ); ?></p>
<p class="description"><?php _e( 'Select how to display this feed.', 'gce' ); ?></p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_paging"><?php _e( 'Show Paging Links', 'gce' ); ?></label></th>
<tr class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<th scope="row"><label for="gce_events_per_page"><?php _e( 'Events per Page', 'gce' ); ?></label></th>
<td>
<input type="checkbox" name="gce_paging" id="gce_paging" value="1" <?php checked( $gce_paging, '1' ); ?> /> <?php _e( 'Check this option to display Next and Back navigation links.', 'gce' ); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_list_max_num"><?php _e( 'Number of Events per Page', 'gce' ); ?></label></th>
<td>
<input type="number" min="0" step="1" class="small-text" id="gce_list_max_num" name="gce_list_max_num" value="<?php echo $gce_list_max_num; ?>" />
<select name="gce_list_max_length" id="gce_list_max_length">
<option value="days" <?php selected( $gce_list_max_length, 'days', true ); ?>><?php _e( 'Days', 'gce' ); ?></option>
<option value="events" <?php selected( $gce_list_max_length, 'events', true ); ?>><?php _e( 'Events', 'gce' ); ?></option>
<select id="gce_events_per_page" name="gce_events_per_page">
<option value="days" <?php selected( $gce_events_per_page, 'days', true ); ?>><?php _e( 'Number of Days', 'gce' ); ?></option>
<option value="events" <?php selected( $gce_events_per_page, 'events', true ); ?>><?php _e( 'Number of Events', 'gce' ); ?></option>
<option value="week" <?php selected( $gce_events_per_page, 'week', true ); ?>><?php _e( 'One Week', 'gce' ); ?></option>
<option value="month" <?php selected( $gce_events_per_page, 'month', true ); ?>><?php _e( 'One Month', 'gce' ); ?></option>
</select>
<span class="gce_per_page_num_wrap <?php echo ( $gce_events_per_page != 'days' && $gce_events_per_page != 'events' ? 'gce-admin-hidden' : '' ); ?>">
<input type="number" min="0" step="1" class="small-text" name="gce_per_page_num" id="gce_per_page_num" value="<?php echo esc_attr( $gce_per_page_num ); ?>" />
</span>
<p class="description"><?php _e( 'How many events to display per page (List View only).', 'gce' ); ?></p>
</td>
</tr>
<tr>
<tr class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<th scope="row"><label for="gce_list_start_offset_num"><?php _e( 'Display Start Date Offset', 'gce' ); ?></label></th>
<td>
<input type="number" min="0" step="1" class="small-text" id="gce_list_start_offset_num" name="gce_list_start_offset_num" value="<?php echo $gce_list_start_offset_num; ?>" />
<?php _e( 'Days', 'gce' ); ?>
<select name="gce_list_start_offset_direction" id="gce_list_start_offset_direction">
<option value="back" <?php selected( $gce_list_start_offset_direction, 'back', true ); ?>><?php _e( 'Back', 'gce' ); ?></option>
<option value="ahead" <?php selected( $gce_list_start_offset_direction, 'ahead', true ); ?>><?php _e( 'Ahead', 'gce' ); ?></option>
<option value="back" <?php selected( $gce_list_start_offset_direction, 'back', true ); ?>><?php _e( 'Number of Days Back', 'gce' ); ?></option>
<option value="ahead" <?php selected( $gce_list_start_offset_direction, 'ahead', true ); ?>><?php _e( 'Number of Days Forward', 'gce' ); ?></option>
</select>
<p class="description"><?php _e( 'Change if you need to initially display events on a date other than today (List View only).', 'gce' ); ?></p>
<input type="number" min="0" step="1" class="small-text" id="gce_list_start_offset_num" name="gce_list_start_offset_num" value="<?php echo esc_attr( $gce_list_start_offset_num ); ?>" />
<p class="description"><?php _e( 'Change to initially display events on a date other than today (List View only).', 'gce' ); ?></p>
</td>
</tr>
<tr class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<th scope="row"><label for="gce_feed_start"><?php _e( 'Earliest Feed Event Date', 'gce' ); ?></label></th>
<td>
<select id="gce_feed_start" name="gce_feed_start">
<option value="days" <?php selected( $gce_feed_start, 'days', true ); ?>><?php _e( 'Number of Days Back', 'gce' ); ?></option>
<option value="months" <?php selected( $gce_feed_start, 'months', true ); ?>><?php _e( 'Number of Months Back', 'gce' ); ?></option>
<option value="years" <?php selected( $gce_feed_start, 'years', true ); ?>><?php _e( 'Number of Years Back', 'gce' ); ?></option>
</select>
<span class="gce_feed_start_num_wrap <?php echo ( $gce_feed_start == 'custom' ? 'gce-admin-hidden' : '' ); ?>">
<input type="number" min="0" step="1" class="small-text" id="gce_feed_start_num" name="gce_feed_start_num" value="<?php echo esc_attr( $gce_feed_start_num ); ?>" />
</span>
<p class="description">
<?php _e( 'Set how far back to retrieve events regardless of initial display.', 'gce' ); ?>
<br>
<?php _e( '<strong>Note:</strong> Total events are currently limited to 2,500 by the Google Calendar API.', 'gce' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_feed_start"><?php _e( 'Minimum Feed Start Date', 'gce' ); ?></label></th>
<tr class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<th scope="row"><label for="gce_feed_end"><?php _e( 'Latest Feed Event Date', 'gce' ); ?></label></th>
<td>
<input type="number" min="0" step="1" class="small-text" id="gce_feed_start" name="gce_feed_start" value="<?php echo $gce_feed_start; ?>" />
<select name="gce_feed_start_interval" id="gce_feed_start_interval">
<option value="days" <?php selected( $gce_feed_start_interval, 'days', true ); ?>><?php _e( 'Days', 'gce' ); ?></option>
<option value="months" <?php selected( $gce_feed_start_interval, 'months', true ); ?>><?php _e( 'Months', 'gce' ); ?></option>
<option value="years" <?php selected( $gce_feed_start_interval, 'years', true ); ?>><?php _e( 'Years', 'gce' ); ?></option>
<select id="gce_feed_end" name="gce_feed_end">
<option value="days" <?php selected( $gce_feed_end, 'days', true ); ?>><?php _e( 'Number of Days Forward', 'gce' ); ?></option>
<option value="months" <?php selected( $gce_feed_end, 'months', true ); ?>><?php _e( 'Number of Months Forward', 'gce' ); ?></option>
<option value="years" <?php selected( $gce_feed_end, 'years', true ); ?>><?php _e( 'Number of Years Forward', 'gce' ); ?></option>
</select>
<?php _e( 'back', 'gce' ); ?>
<p class="description"><?php _e( 'Set how far back to retrieve events regardless of month or page being displayed.', 'gce' ); ?></p>
</td>
<span class="gce_feed_end_num_wrap <?php echo ( $gce_feed_end == 'custom' ? 'gce-admin-hidden' : '' ); ?>">
<input type="number" min="0" step="1" class="small-text" id="gce_feed_end_num" name="gce_feed_end_num" value="<?php echo esc_attr( $gce_feed_end_num ); ?>" />
</span>
<p class="description"><?php _e( 'Set how far in the future to retrieve events regardless of initial display.', 'gce' ); ?></p>
</td>
</tr>
<tr class="gce-custom-range <?php echo ( $use_range == true ? '' : 'gce-admin-hidden' ); ?>">
<th scope="row"><label for="gce_feed_use_range"><?php _e( 'Use Custom Date Range', 'gce' ); ?></label></th>
<td>
<span>
<input type="text" name="gce_feed_range_start" id="gce_feed_range_start" value="<?php echo esc_attr( $gce_feed_range_start ); ?>" />
<?php _ex( 'to', 'separator between custom date range fields', 'gce' ); ?>
<input type="text" id="gce_feed_range_end" name="gce_feed_range_end" value="<?php echo esc_attr( $gce_feed_range_end ); ?>" />
<p class="description"><?php _e( 'Set a specific range of events to retrieve.', 'gce' ); ?></p>
</span>
</td>
</tr>
<tr class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<th scope="row"><label for="gce_paging"><?php _e( 'Show Paging Links', 'gce' ); ?></label></th>
<td>
<input type="checkbox" name="gce_paging" id="gce_paging" value="1" <?php checked( $gce_paging, '1' ); ?> />
<?php _e( 'Display Next and Back navigation links.', 'gce' ); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_feed_end"><?php _e( 'Maximum Feed End Date', 'gce' ); ?></label></th>
<th scope="row"><label for="gce_show_tooltips"><?php _e( 'Show Tooltips', 'gce' ); ?></label></th>
<td>
<input type="number" min="0" step="1" class="small-text" id="gce_feed_end" name="gce_feed_end" value="<?php echo $gce_feed_end; ?>" />
<select name="gce_feed_end_interval" id="gce_feed_end_interval">
<option value="days" <?php selected( $gce_feed_end_interval, 'days', true ); ?>><?php _e( 'Days', 'gce' ); ?></option>
<option value="months" <?php selected( $gce_feed_end_interval, 'months', true ); ?>><?php _e( 'Months', 'gce' ); ?></option>
<option value="years" <?php selected( $gce_feed_end_interval, 'years', true ); ?>><?php _e( 'Years', 'gce' ); ?></option>
</select>
<?php _e( 'forward', 'gce' ); ?>
<p class="description"><?php _e( 'Set how far in the future to retrieve events regardless of month or page being displayed.', 'gce' ); ?></p>
</td>
<input type="checkbox" name="gce_show_tooltips" id="gce_show_tooltips" value="1" <?php checked( $gce_show_tooltips, '1' ); ?> />
<?php _e( 'Display tooltips when hovering over events (Grid View only).', 'gce' ); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_date_format"><?php _e( 'Date Format', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_date_format" id="gce_date_format" value="<?php echo esc_attr( $gce_date_format ); ?>" />
<p class="description">
<?php printf( __( 'Use %sPHP date formatting%s.', 'gce' ), '<a href="http://php.net/manual/en/function.date.php" target="_blank">', '</a>' ); ?>
<?php _e( 'Leave blank to use the default.', 'gce' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_time_format"><?php _e( 'Time Format', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_time_format" id="gce_time_format" value="<?php echo esc_attr( $gce_time_format ); ?>" />
<p class="description">
<?php printf( __( 'Use %sPHP date formatting%s.', 'gce' ), '<a href="http://php.net/manual/en/function.date.php" target="_blank">', '</a>' ); ?>
<?php _e( 'Leave blank to use the default.', 'gce' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="gce_cache"><?php _e( 'Cache Duration', 'gce' ); ?></label></th>
<td>
<input type="text" class="" name="gce_cache" id="gce_cache" value="<?php echo esc_attr( $gce_cache ); ?>" />
<p 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' ); ?></p>
<td>
</tr>
<tr>
<td colspan="2">
<input type="button" class="button button-primary button-large gce-feed-update-button" value="Save Changes">
</td>
</tr>
</table>
@@ -5,23 +5,25 @@
<a href="<?php echo gce_ga_campaign_url( 'http://wpdocs.philderksen.com/google-calendar-events/', 'gce_lite', 'sidebar_link', 'docs' ); ?>" target="_blank">
<?php _e( 'Documentation & getting started', 'gce' ); ?></a>
</li>
<li>
<div class="dashicons dashicons-arrow-right-alt2"></div>
<a href="https://wordpress.org/support/plugin/google-calendar-events" target="_blank">
<?php _e( 'Community support forums', 'gce' ); ?></a>
</li>
<li>
<div class="dashicons dashicons-arrow-right-alt2"></div>
<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events#postform" target="_blank">
<?php _e( 'Rate this plugin', 'gce' ); ?></a>
</li>
<li>
<div class="dashicons dashicons-arrow-right-alt2"></div>
<a href="https://trello.com/b/ZQSzsarY" target="_blank">
<?php _e( 'View our roadmap & vote', 'gce' ); ?></a>
</li>
<li>
<div class="dashicons dashicons-arrow-right-alt2"></div>
<a href="http://eepurl.com/0_VsT" target="_blank">
<?php _e( 'Get notified of new features', 'gce' ); ?></a>
</li>
<li>
<div class="dashicons dashicons-arrow-right-alt2"></div>
<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events" target="_blank">
<?php _e( 'Rate this plugin', 'gce' ); ?></a>
</li>
</ul>
</div>
@@ -27,6 +27,27 @@ class GCE_Widget extends WP_Widget {
$name = __( 'Google Calendar Events', 'gce' ),
array( 'description' => __( 'Display a list or calendar grid of events from one or more Google Calendar feeds you have added', 'gce' ) )
);
if ( is_active_widget( false, false, $this->id_base, true ) ) {
Google_Calendar_Events::get_instance()->show_scripts = true;
// Call action to load CSS for widget
add_action( 'wp_enqueue_scripts', array( $this, 'gce_widget_add_styles' ) );
// Load JS
wp_enqueue_script( 'google-calendar-events-public' );
}
}
function gce_widget_add_styles() {
global $gce_options;
// Load CSS
if( ! isset( $gce_options['disable_css'] ) ) {
wp_enqueue_style( 'google-calendar-events-public' );
}
}
/**
@@ -40,16 +61,40 @@ class GCE_Widget extends WP_Widget {
//Output before widget stuff
echo $before_widget;
$paging = ( isset( $instance['paging'] ) ? $instance['paging'] : null );
$max_num = ( isset( $instance['list_max_num'] ) ? $instance['list_max_num'] : null );
$max_length = ( isset( $instance['list_max_length'] ) ? $instance['list_max_length'] : null );
$max_events = null;
$paging = ( isset( $instance['paging'] ) ? $instance['paging'] : null );
$max_num = ( isset( $instance['per_page_num'] ) ? $instance['per_page_num'] : null );
$max_length = ( isset( $instance['events_per_page'] ) ? $instance['events_per_page'] : null );
$max_events = null;
$display_type = ( isset( $instance['display_type'] ) ? $instance['display_type'] : null );
// Start offset
$offset_num = ( isset( $instance['list_start_offset_num'] ) ? $instance['list_start_offset_num'] : 0 );
$offset_length = 86400;
$offset_direction = ( isset( $instance['list_start_offset_direction'] ) ? $instance['list_start_offset_direction'] : null );
$invalid_id = false;
// Get custom date range if set
if( 'date-range-list' == $display_type || 'date-range-grid' == $display_type ) {
$range_start = ( isset( $instance['feed_range_start'] ) ? $instance['feed_range_start'] : null );
$range_end = ( isset( $instance['feed_range_end'] ) ? $instance['feed_range_end'] : null );
if( $range_start !== null && ! empty( $range_start ) ) {
$range_start = gce_date_unix( $range_start );
}
if( $range_end !== null && ! empty( $range_end ) ) {
$range_end = gce_date_unix( $range_end );
}
}
if( ! isset( $instance['show_tooltips'] ) ) {
$show_tooltips = 1;
} else {
$show_tooltips = ( isset( $instance['show_tooltips'] ) ? $instance['show_tooltips'] : 'false' );
}
if( $offset_direction == 'back' ) {
$offset_direction = -1;
@@ -61,12 +106,18 @@ class GCE_Widget extends WP_Widget {
$paging_interval = null;
if( $display_type == 'date-range-list' || $display_type == 'date-range-grid' ) {
$max_length = 'date-range';
}
if( $max_length == 'days' ) {
$paging_interval = $max_num * 86400;
}
if( $max_length == 'events' ) {
} else if( $max_length == 'events' ) {
$max_events = $max_num;
} else if( $max_length == 'week' ) {
$paging_interval = 604800;
} else if( $max_length == 'month' ) {
$paging_interval = 2629743;
}
// Check whether any feeds have been added yet
@@ -87,8 +138,13 @@ class GCE_Widget extends WP_Widget {
//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 ) )
if ( 0 == absint( $feed_id ) ) {
unset( $feed_ids[$key] );
}
if( ! ( 'publish' == get_post_status( $feed_id ) ) ) {
$invalid_id = true;
}
}
//If at least one of the feed ids entered exists, set no_feeds_exist to false
@@ -121,29 +177,42 @@ class GCE_Widget extends WP_Widget {
$sort_order = ( isset( $instance['order'] ) ) ? $instance['order'] : 'asc';
$args = array(
'title_text' => $title_text,
'sort' => $sort_order,
'month' => null,
'year' => null,
'widget' => 1,
'max_events' => $max_events,
'start_offset' => $start_offset,
'paging_type' => $max_length
'title_text' => $title_text,
'sort' => $sort_order,
'month' => null,
'year' => null,
'widget' => 1,
'max_events' => $max_events,
'start_offset' => $start_offset,
'paging_type' => $max_length,
'max_num' => $max_num,
'show_tooltips' => $show_tooltips
);
if( 'list-grouped' == $instance['display_type'] ) {
if( 'list-grouped' == $display_type ) {
$args['grouped'] = 1;
}
$markup = gce_print_calendar( $feed_ids, $instance['display_type'], $args, true );
if( 'date-range-list' == $display_type ) {
$args['max_events'] = INF;
$args['max_num'] = INF;
}
echo $markup;
$markup = gce_print_calendar( $feed_ids, $display_type, $args, true );
if( ! $invalid_id ) {
echo $markup;
} else {
if( current_user_can( 'manage_options' ) ) {
echo '<p>' . __( 'There was a problem with one or more of your feed IDs. Please check your widget settings and make sure they are correct.', 'gce' ) . '</p>';
}
}
}
} else {
if( current_user_can( 'manage_options' ) ) {
_e( 'You have not added any feeds yet.', 'gce' );
} else {
return;
echo '';
}
}
@@ -161,14 +230,15 @@ class GCE_Widget extends WP_Widget {
$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['display_type'] = esc_html( $new_instance['display_type'] );
$instance['order'] = ( 'asc' == $new_instance['order'] ) ? 'asc' : 'desc';
$instance['display_title_text'] = esc_html( $new_instance['display_title_text'] );
$instance['paging'] = ( isset( $new_instance['paging'] ) ? 1 : 0 );
$instance['list_max_num'] = $new_instance['list_max_num'];
$instance['list_max_length'] = $new_instance['list_max_length'];
$instance['list_start_offset_num'] = $new_instance['list_start_offset_num'];
$instance['list_start_offset_direction'] = $new_instance['list_start_offset_direction'];
$instance['per_page_num'] = $new_instance['per_page_num'];
$instance['events_per_page'] = $new_instance['events_per_page'];
$instance['show_tooltips'] = ( isset( $new_instance['show_tooltips'] ) ? 1 : 0 );
return $instance;
}
@@ -191,43 +261,45 @@ class GCE_Widget extends WP_Widget {
$title = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
$ids = ( isset( $instance['id'] ) ) ? $instance['id'] : '';
$display_type = ( isset( $instance['display_type'] ) ) ? $instance['display_type'] : 'grid';
$display_type = ( isset( $instance['display_type'] ) ) ? $instance['display_type'] : 'grid';
$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', 'gce' );
$paging = ( isset( $instance['paging'] ) ? $instance['paging'] : 1 );
$list_max_num = ( isset( $instance['list_max_num'] ) ? $instance['list_max_num'] : 7 );
$list_max_length = ( isset( $instance['list_max_length'] ) ? $instance['list_max_length'] : 'days' );
$list_start_offset_num = ( isset( $instance['list_start_offset_num'] ) ? $instance['list_start_offset_num'] : 0 );
$per_page_num = ( isset( $instance['per_page_num'] ) && ! empty( $instance['per_page_num'] ) ? $instance['per_page_num'] : 7 );
$events_per_page = ( isset( $instance['events_per_page'] ) ? $instance['events_per_page'] : 'days' );
$list_start_offset_num = ( isset( $instance['list_start_offset_num'] ) && ! empty( $instance['list_start_offset_num'] ) ? $instance['list_start_offset_num'] : 0 );
$list_start_offset_direction = ( isset( $instance['list_start_offset_direction'] ) ? $instance['list_start_offset_direction'] : 'back' );
$show_tooltips = ( isset( $instance['show_tooltips'] ) ? $instance['show_tooltips'] : 1 );
$use_range = ( ( selected( $display_type, 'date-range-list', false ) || selected( $display_type, 'date-range-grid', false ) ) ? true : false );
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gce' ); ?></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" />
<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" class="widefat" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'id' ); ?>">
<?php _e( 'Feeds to Display (comma separated list - i.e. 101,102,103):', 'gce' ); ?>
</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" />
<input type="text" id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" value="<?php echo esc_attr( $ids ); ?>" class="widefat" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'display_type' ); ?>"><?php _e( 'Display Events as:', 'gce' ); ?></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( 'Grid', 'gce' ); ?></option>
<option value="list"<?php selected( $display_type, 'list' ); ?>><?php _e( 'List', 'gce' ); ?></option>
<option value="list-grouped"<?php selected( $display_type, 'list-grouped' );?>><?php _e( 'Grouped List', 'gce' ); ?></option>
<option value="grid" <?php selected( $display_type, 'grid' ); ?>><?php _e( 'Grid (Month view)', 'gce' ); ?></option>
<option value="list" <?php selected( $display_type, 'list' ); ?>><?php _e( 'List', 'gce' ); ?></option>
<option value="list-grouped" <?php selected( $display_type, 'list-grouped' );?>><?php _e( 'Grouped List', 'gce' ); ?></option>
<option value="date-range-list" <?php selected( $display_type, 'date-range-list' );?>><?php _e( 'Custom Date Range (List)', 'gce' ); ?></option>
<option value="date-range-grid" <?php selected( $display_type, 'date-range-grid' );?>><?php _e( 'Custom Date Range (Grid)', 'gce' ); ?></option>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id( 'paging' ); ?>"><?php _e( 'Show Paging Links:', 'gce' ); ?></label><br>
<input type="checkbox" id="<?php echo $this->get_field_id( 'paging' ); ?>" name="<?php echo $this->get_field_name( 'paging' ); ?>" class="widefat" value="1" <?php checked( $paging, 1 ); ?>>
<?php _e( 'Check this option to display Next and Back navigation links.', 'gce' ); ?>
</p>
<p>
<p class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort Order (List View only):', 'gce' ); ?></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' ); ?></option>
@@ -235,28 +307,45 @@ class GCE_Widget extends WP_Widget {
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id( 'list_max_num' ); ?>"><?php _e( 'Number of Events per Page (List View only):', 'gce' ); ?></label><br>
<input type="number" min="0" step="1" class="small-text" id="<?php echo $this->get_field_id( 'list_max_num' ); ?>" name="<?php echo $this->get_field_name( 'list_max_num' ); ?>" value="<?php echo $list_max_num; ?>" />
<select name="<?php echo $this->get_field_name( 'list_max_length' ); ?>" id="<?php echo $this->get_field_id( 'list_max_length' ); ?>">
<option value="days" <?php selected( $list_max_length, 'days', true ); ?>><?php _e( 'Days', 'gce' ); ?></option>
<option value="events" <?php selected( $list_max_length, 'events', true ); ?>><?php _e( 'Events', 'gce' ); ?></option>
<p class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<label for="<?php echo $this->get_field_id( 'events_per_page' ); ?>"><?php _e( 'Events per Page (List View only):', 'gce' ); ?></label><br/>
<select id="<?php echo $this->get_field_id( 'events_per_page' ); ?>" name="<?php echo $this->get_field_name( 'events_per_page' ); ?>">
<option value="days" <?php selected( $events_per_page, 'days', true ); ?>><?php _e( 'Number of Days', 'gce' ); ?></option>
<option value="events" <?php selected( $events_per_page, 'events', true ); ?>><?php _e( 'Number of Events', 'gce' ); ?></option>
<option value="week" <?php selected( $events_per_page, 'week', true ); ?>><?php _e( 'One Week', 'gce' ); ?></option>
<option value="month" <?php selected( $events_per_page, 'month', true ); ?>><?php _e( 'One Month', 'gce' ); ?></option>
</select>
<span class="gce_per_page_num_wrap <?php echo ( $events_per_page != 'days' && $events_per_page != 'events' ? 'gce-admin-hidden' : '' ); ?>">
<input type="number" min="0" step="1" class="small-text" name="<?php echo $this->get_field_name( 'per_page_num' ); ?>" id="<?php echo $this->get_field_id( 'per_page_num' ); ?>" value="<?php echo esc_attr( $per_page_num ); ?>" />
</span>
</p>
<span class="gce-custom-range <?php echo ( $use_range == true ? '' : 'gce-admin-hidden' ); ?>">
<small><?php _e( 'This setting will pull from the custom date range set in the main feed settings and cannot be changed here.', 'gce' ); ?></small>
</span>
<p>
<p class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<label for="<?php echo $this->get_field_id( 'list_start_offset_num' ); ?>"><?php _e( 'Display Start Date Offset (List View only):', 'gce' ); ?></label><br>
<input type="number" min="0" step="1" class="small-text" id="<?php echo $this->get_field_id( 'list_start_offset_num' ); ?>" name="<?php echo $this->get_field_name( 'list_start_offset_num' ); ?>" value="<?php echo $list_start_offset_num; ?>" />
<?php _e( 'Days', 'gce' ); ?>
<select name="<?php echo $this->get_field_name( 'list_start_offset_direction' ); ?>" id="<?php echo $this->get_field_id( 'list_start_offset_direction' ); ?>">
<option value="back" <?php selected( $list_start_offset_direction, 'back', true ); ?>><?php _e( 'Back', 'gce' ); ?></option>
<option value="ahead" <?php selected( $list_start_offset_direction, 'ahead', true ); ?>><?php _e( 'Ahead', 'gce' ); ?></option>
<option value="back" <?php selected( $list_start_offset_direction, 'back', true ); ?>><?php _e( 'Number of Days Back', 'gce' ); ?></option>
<option value="ahead" <?php selected( $list_start_offset_direction, 'ahead', true ); ?>><?php _e( 'Number of Days Forward', 'gce' ); ?></option>
</select>
<input type="number" min="0" step="1" class="small-text" id="<?php echo $this->get_field_id( 'list_start_offset_num' ); ?>" name="<?php echo $this->get_field_name( 'list_start_offset_num' ); ?>" value="<?php echo esc_attr( $list_start_offset_num ); ?>" />
<br>
<small><?php _e( 'Change to initially display events on a date other than today (List View only).', 'gce' ); ?></small>
</p>
<p>
<p class="gce-display-option gce-display-control <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<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' ); ?></label>
<input type="text" class="widefat" 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; ?>" />
<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'display_title_text' ); ?>" name="<?php echo $this->get_field_name( 'display_title_text' ); ?>" value="<?php echo esc_attr( $title_text ); ?>" />
</p>
<p class="gce-display-option <?php echo ( $use_range == true ? 'gce-admin-hidden' : '' ); ?>">
<input type="checkbox" id="<?php echo $this->get_field_id( 'paging' ); ?>" name="<?php echo $this->get_field_name( 'paging' ); ?>" class="widefat" value="1" <?php checked( $paging, 1 ); ?>>
<label for="<?php echo $this->get_field_id( 'paging' ); ?>"><?php _e( 'Show Paging Links', 'gce' ); ?></label>
<br>
<input type="checkbox" id="<?php echo $this->get_field_id( 'show_tooltips' ); ?>" name="<?php echo $this->get_field_name( 'show_tooltips' ); ?>" class="widefat" value="1" <?php checked( $show_tooltips, 1 ); ?>>
<label for="<?php echo $this->get_field_id( 'show_tooltips' ); ?>"><?php _e( 'Show Tooltips', 'gce' ); ?></label>
</p>
<?php
+25 -20
View File
@@ -80,7 +80,7 @@ function do_search() {
}
var params = {
q: $('.search-field').val(),
filter_groups: groupString,
filter_groups: groupString
};
if(validMembershipToggle.hasClass('active')) {
params.has_valid_membership = true;
@@ -186,36 +186,38 @@ function get_user_meta(key, callback) {
callback(data);
});
}
function mailinglist_show(q) {
function mailing_list_show(q) {
$.getJSON(
email_endpoint,
{
'do': 'list',
q: q,
_wpnonce: $('meta[name=x-inside-api-nonce]').attr('content')
},
function(data) {
var list = '<h5 class="list-members-title">Medlemmer på ' + data.meta.list +'</h5><span class="list-num-members"><%= members.length %> stk</span><ul id="members-result"><% _.each(members, function(m) { %>' +
'<li><a href="mailto:<%= m %>"><span class="dashicons dashicons-email"></span> <%= m %></a></li>' +
var _list_data = data.lists[0];
console.log(_list_data);
var list = '<h5 class="list-members-title">Medlemmer på <%= name %></h5><span class="list-num-members">' +
'<%= destinations.length %> stk</span><ul id="members-result"><% _.each(destinations, function(d) { %>' +
'<li><a href="mailto:<%= d %>"><span class="dashicons dashicons-email"></span> <%= d %></a></li>' +
'<% }); %></ul>';
var html = _.template(list, data);
var html = _.template(list, _list_data);
$('.list-members').html(html);
$('.lists-list-wrap .meta').html('<a href="#members-result" class="button radius list-members-button">Vis medlemmer på '+ data.meta.list +'</a>');
$('.lists-list-wrap .meta').html('<a href="#members-result" class="button radius list-members-button">Vis medlemmer på ' + _list_data.name + '</a>');
/* Highlight selected list */
$('[data-list-name=\''+q+'\']').addClass('selected');
}
);
}
function mailinglists_load_initial() {
function mailing_lists_load_initial() {
var q = getParameterByName('q');
if(q && q.length > 0) {
mailinglist_show(q);
mailing_list_show(q);
}
}
jQuery(document).ready(function() {
moment.locale('nb');
moment.locale('nb');
var $ = jQuery;
/* Menu toggle */
@@ -249,8 +251,8 @@ jQuery(document).ready(function() {
}
/* Program page */
var program_entrypoint = '.program-list';
if( $(program_entrypoint).length ) {
var program_entry_point = '.program-list';
if( $(program_entry_point).length ) {
/* Load program */
$.getJSON(
program_endpoint+'?callback=?',
@@ -259,7 +261,7 @@ jQuery(document).ready(function() {
if(data && data.events) {
// render template
var html = format_posts(data.events);
$(program_entrypoint).html(html);
$(program_entry_point).html(html);
}
}
);
@@ -312,19 +314,22 @@ jQuery(document).ready(function() {
/* Load list of lists*/
$.getJSON(
email_endpoint,
{
'do': 'list',
_wpnonce: $('meta[name=x-inside-api-nonce]').attr('content')
},
{ _wpnonce: $('meta[name=x-inside-api-nonce]').attr('content') },
function(data) {
var list = '<% _.each(lists, function(l) { %>' +
if(data.error) {
$('.lists-list').html(data.error);
return;
}
data.lists = _.filter(data.lists, function(l) { return l.num > 1; }); //{ lists: _.groupBy(data, function(x){ return x.source; }) };
console.log(data);
var list_template = '<% _.each(lists, function(l) { %>' +
'<li data-list-name="<%= l.name %>"><a href="'+ window.location.pathname + '?q=<%= l.name %>" class="list-name"><%= l.name %></a><br>' +
'<span class="list-num-members"><%= l.num %> medlemmer</span>'+
'<a href="<%= l.admin_url %>" class="email-<%= l.type %> button-alt" title="<%= l.type %>"> '+
'<span class="dashicons dashicons-<% if( l.admin_type == "selfservice" ) { %>edit<% } else { %>email<% } %>"> </span>Endre'+
'</a></li>' +
'<% }); %>';
var html = _.template(list, data);
var html = _.template(list_template, data);
$('.lists-list').html(html);
/* Index list and make searchable and sortable */
@@ -332,7 +337,7 @@ jQuery(document).ready(function() {
valueNames: [ 'list-name', 'list-num-members' ]
};
new List('mailinglists', options);
mailinglists_load_initial();
mailing_lists_load_initial();
}
);
}
@@ -160,7 +160,7 @@ body {
@extend .card;
@media #{$medium-up} { max-width: 400px; }
.login-remember {
display: inline-block;
padding: 6px 0;
@@ -349,9 +349,9 @@ input[type=submit]{
}
.list-members {
.list-members-title{
line-height: 1.15;
display: inline-block;
line-height: 1;
margin-right: rem-calc(4);
margin-bottom: 0;
}
ul {
@@ -378,6 +378,9 @@ input[type=submit]{
font-size: rem-calc(14);
color: #666;
}
#members-result {
margin-top: 8px;
}
.email-aliases,
.email-mailman {
position: absolute;
+399 -1
View File
@@ -1 +1,399 @@
"use strict";function getParameterByName(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),a=t.exec(location.search);return null===a?"":decodeURIComponent(a[1].replace(/\+/g," "))}function format_posts(e){var t="",a=0;if(0===e.length)return"Idag er det stille på huset :-/";for(a=0;a<e.length;a++){var s=e[a];t+='<li class="fadein">',t+='<span class="entry-starttime">'+moment.unix(s.custom_fields._neuf_events_starttime).utc().format("HH.mm")+"</span>: ",t+='<a href="'+s.url+'">'+s.title+"</a>",t+=' <span class="entry-venue">'+s.custom_fields._neuf_events_venue+"</span>",t+="</li>"}return t}function format_results(e){var t="<table><thead><tr><th>Navn</th><th>Brukernavn</th><th>Epost</th><th>Telefon</th><th>Har medlemskap</th><th>Grupper</th></tr></thead>";if(e.error)return console.log(e.error),$(".search-result-list").html(""),void $(".search-results .meta").html("");if(0===e.meta.num_results)return $(".search-result-list").html("Uffda, ingen treff."),void $(".search-results .meta").html("");var a='<tbody><% _.each(results, function(u) { %><tr><td><a href="'+user_profile_url+'?username=<%= u.username %>"><%= u.firstname %> <%= u.lastname %></a></td><td><%= u.username %></td><td><a href="mailto:<%= u.email %>"><%= u.email %></a></td><td><a href="tlf:<%= u.number %>"><%= u.number %></a></td><td><% if(u.is_member != 0) { %>Ja<% } else { %>Nei<% } %></td><td class="groups"><% _.each(u.groups, function(g, i) { %><%= g.name %><% if(u.groups.length !== i +1){ %>, <% } %><% }); %></td></tr> <% }); %></tbody></table>',s=t+_.template(a,e);$(".search-result-list").html(s);var n="Antall treff: <%= meta.num_results %>";$(".search-results .meta").html(_.template(n,e))}function do_search(){var e=$('.filters [data-search-filter="has_valid_membership"]'),t="",a=$(".groups-select").val();null!==a&&(t=a.join());var s={q:$(".search-field").val(),filter_groups:t};e.hasClass("active")&&(s.has_valid_membership=!0);var n=$.param(s);window.History.pushState(null,null,"?"+n),s._wpnonce=$("meta[name=x-inside-api-nonce]").attr("content"),$.getJSON(user_search_endpoint,s,format_results)}function user_search_load_initial_values(){var e=!1,t=getParameterByName("q");t&&t.length>0&&($(".search-field").val(t),e=!0);var a=getParameterByName("has_valid_membership");a&&"true"===a&&($('.filters [data-search-filter="has_valid_membership"]').addClass("active"),e=!0);var s=getParameterByName("filter_groups"),n=[];if(s&&s.length>0){n=-1!==s.indexOf(",")?s.split(","):[s];var r=!1,i=0;for(i=0;i<n.length;i++){var l=n[i];$.isNumeric(l)||(r=!0)}r||(e=!0,$(".groups-select").val(n),$(".groups-select").trigger("chosen:updated"))}e&&do_search()}function save_user_meta(e,t){try{localStorage.setItem(e,t)}catch(a){}var s=$("meta[name=x-siteurl]").attr("content")+"/wp-admin/admin-ajax.php",n={action:"neuf_save_user_meta",meta_key:e,meta_value:t,unique:!0,user_id:parseInt($("meta[name=x-user-id]").attr("content"),10),_wpnonce:$("meta[name=x-user-meta-nonce]").attr("content")};$.post(s,n)}function get_user_meta(e,t){try{var a=localStorage.getItem(e);if(null!==a)return void t({result:a})}catch(s){}var n=$("meta[name=x-siteurl]").attr("content")+"/wp-admin/admin-ajax.php",r={action:"neuf_get_user_meta",meta_key:e,single:!0,user_id:parseInt($("meta[name=x-user-id]").attr("content"),10),_wpnonce:$("meta[name=x-user-meta-nonce]").attr("content")};$.getJSON(n,r,function(a){if(a.hasOwnProperty("result")&&""!==a.result)try{localStorage.setItem(e,a.result)}catch(s){}t(a)})}function mailinglist_show(e){$.getJSON(email_endpoint,{"do":"list",q:e,_wpnonce:$("meta[name=x-inside-api-nonce]").attr("content")},function(t){var a='<h5 class="list-members-title">Medlemmer på '+t.meta.list+'</h5><span class="list-num-members"><%= members.length %> stk</span><ul id="members-result"><% _.each(members, function(m) { %><li><a href="mailto:<%= m %>"><span class="dashicons dashicons-email"></span> <%= m %></a></li><% }); %></ul>',s=_.template(a,t);$(".list-members").html(s),$(".lists-list-wrap .meta").html('<a href="#members-result" class="button radius list-members-button">Vis medlemmer på '+t.meta.list+"</a>"),$("[data-list-name='"+e+"']").addClass("selected")})}function mailinglists_load_initial(){var e=getParameterByName("q");e&&e.length>0&&mailinglist_show(e)}var program_endpoint="https://studentersamfundet.no/api/events/get_today/",inside_url="https://inside.studentersamfundet.no",inside_groups_url=inside_url+"/api/groups.php",user_search_endpoint="/inside-api/",email_endpoint="/email-api/",user_profile_url="/profil/",query_params={};jQuery(document).ready(function(){moment.locale("nb");var e=jQuery;e("#menu .menu-toggle").on("click",function(t){t.preventDefault();var a=e("#menu .main-menu, #menu .user-menu-wrap");a.toggleClass("visible")}),e("#menu a.profile-badge").on("click",function(t){t.preventDefault();var a=e("#menu .user-menu");a.toggleClass("visible")}),e("[data-toggle-introduction]").on("click",function(){e(this).parent().fadeOut(6Line truncated
'use strict';
/*global moment, jQuery, document, _, $, window, List */
var program_endpoint = 'https://studentersamfundet.no/api/events/get_today/';
var inside_url = 'https://inside.studentersamfundet.no';
var inside_groups_url = inside_url + '/api/groups.php';
var user_search_endpoint = '/inside-api/';
var email_endpoint = '/email-api/';
var user_profile_url = '/profil/';
var query_params = {
//meta_key: '_neuf_events_starttime',
//meta_value: moment().add('days', 1).format('X'),
//meta_compare: '<='
//count: 10
};
function getParameterByName(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
function format_posts(posts) {
var html = '';
var i=0;
//var stylesheet_dir = jQuery('meta[name=x-stylesheet-directory]').attr('content');
if(posts.length === 0) {
return 'Idag er det stille på huset :-/';
}
for(i=0; i< posts.length; i++) {
var post = posts[i];
html += '<li class="fadein">';
html += '<span class="entry-starttime">'+ moment.unix(post.custom_fields._neuf_events_starttime).utc().format('HH.mm') +'</span>: ';
html += '<a href="'+ post.url +'">'+ post.title +'</a>';
html += ' <span class="entry-venue">'+ post.custom_fields._neuf_events_venue +'</span>';
html += '</li>';
}
return html;
}
function format_results(data) {
var header_template = '<table><thead><tr><th>Navn</th><th>Brukernavn</th><th>Epost</th><th>Telefon</th><th>Har medlemskap</th><th>Grupper</th></tr></thead>';
if(data.error) {
console.log(data.error);
$('.search-result-list').html('');
$('.search-results .meta').html('');
return;
}
if(data.meta.num_results === 0) {
$('.search-result-list').html('Uffda, ingen treff.');
$('.search-results .meta').html('');
return;
}
var list = '<tbody><% _.each(results, function(u) { %>' +
'<tr>' +
'<td><a href="'+ user_profile_url +'?username=<%= u.username %>"><%= u.firstname %> <%= u.lastname %></a></td>' +
'<td><%= u.username %></td>' +
'<td><a href="mailto:<%= u.email %>"><%= u.email %></a></td>' +
'<td><a href="tlf:<%= u.number %>"><%= u.number %></a></td>' +
'<td><% if(u.is_member != 0) { %>Ja<% } else { %>Nei<% } %></td>' +
'<td class="groups"><% _.each(u.groups, function(g, i) { %><%= g.name %><% if(u.groups.length !== i +1){ %>, <% } %><% }); %></td>'+
'</tr> <% }); %>' +
'</tbody></table>';
var html = header_template + _.template(list, data);
$('.search-result-list').html(html);
var search_meta = 'Antall treff: <%= meta.num_results %>';
$('.search-results .meta').html(_.template(search_meta, data));
}
function do_search() {
var validMembershipToggle = $('.filters [data-search-filter="has_valid_membership"]');
var groupString = '';
var groupSelect = $('.groups-select').val();
if( groupSelect !== null) {
groupString = groupSelect.join();
}
var params = {
q: $('.search-field').val(),
filter_groups: groupString
};
if(validMembershipToggle.hasClass('active')) {
params.has_valid_membership = true;
}
var querystring = $.param(params);
window.History.pushState(null, null, '?'+querystring);
params._wpnonce = $('meta[name=x-inside-api-nonce]').attr('content');
$.getJSON(
user_search_endpoint,
params,
format_results
);
}
function user_search_load_initial_values() {
var param_set = false;
var q = getParameterByName('q');
if(q && q.length > 0) {
$('.search-field').val(q);
param_set = true;
}
var hvm = getParameterByName('has_valid_membership');
if(hvm && hvm === 'true') {
$('.filters [data-search-filter="has_valid_membership"]').addClass('active');
param_set = true;
}
var fg = getParameterByName('filter_groups');
var groups = [];
if(fg && fg.length > 0) {
if( fg.indexOf(',') !== -1 ) {
// has comma
groups = fg.split(',');
} else {
groups = [fg];
}
// is every group numeric?
var has_invalid_group = false;
var i=0;
for(i=0; i<groups.length; i++) {
var g = groups[i];
if( !$.isNumeric(g) ) {
has_invalid_group = true;
}
}
if(!has_invalid_group) {
param_set = true;
$('.groups-select').val(groups);
$('.groups-select').trigger('chosen:updated');
}
}
if(param_set) {
do_search();
}
}
function save_user_meta(key, value) {
/* set localstorage first, then update database with usermeta key and value */
try {
localStorage.setItem(key, value);
} catch(err) { /* do nothing */ }
var url = $('meta[name=x-siteurl]').attr('content') + '/wp-admin/admin-ajax.php';
var params = {
action: 'neuf_save_user_meta',
meta_key: key,
meta_value: value,
unique: true,
user_id: parseInt($('meta[name=x-user-id]').attr('content'), 10),
_wpnonce: $('meta[name=x-user-meta-nonce]').attr('content')
};
$.post(url, params);
}
function get_user_meta(key, callback) {
/* Check localstorage first, then database for usermeta key */
try {
var value = localStorage.getItem(key);
if(value !== null) {
callback({result:value});
return;
}
} catch(err) { /* Do nothing */ }
var url = $('meta[name=x-siteurl]').attr('content') + '/wp-admin/admin-ajax.php';
var params = {
action: 'neuf_get_user_meta',
meta_key: key,
single: true,
user_id: parseInt($('meta[name=x-user-id]').attr('content'), 10),
_wpnonce: $('meta[name=x-user-meta-nonce]').attr('content')
};
$.getJSON(url, params, function(data) {
// Update localstorage if it's set
if(data.hasOwnProperty('result') && data.result !== '') {
try {
localStorage.setItem(key, data.result);
} catch(err) { /* do nothing */ }
}
// continue
callback(data);
});
}
function mailing_list_show(q) {
$.getJSON(
email_endpoint,
{
q: q,
_wpnonce: $('meta[name=x-inside-api-nonce]').attr('content')
},
function(data) {
var _list_data = data.lists[0];
console.log(_list_data);
var list = '<h5 class="list-members-title">Medlemmer på <%= name %></h5><span class="list-num-members">' +
'<%= destinations.length %> stk</span><ul id="members-result"><% _.each(destinations, function(d) { %>' +
'<li><a href="mailto:<%= d %>"><span class="dashicons dashicons-email"></span> <%= d %></a></li>' +
'<% }); %></ul>';
var html = _.template(list, _list_data);
$('.list-members').html(html);
$('.lists-list-wrap .meta').html('<a href="#members-result" class="button radius list-members-button">Vis medlemmer på ' + _list_data.name + '</a>');
/* Highlight selected list */
$('[data-list-name=\''+q+'\']').addClass('selected');
}
);
}
function mailing_lists_load_initial() {
var q = getParameterByName('q');
if(q && q.length > 0) {
mailing_list_show(q);
}
}
jQuery(document).ready(function() {
moment.locale('nb');
var $ = jQuery;
/* Menu toggle */
$('#menu .menu-toggle').on('click', function(e) {
e.preventDefault();
// add open css class
var menu = $('#menu .main-menu, #menu .user-menu-wrap');
menu.toggleClass('visible');
});
/* User Menu toggle */
$('#menu a.profile-badge').on('click', function(e) {
e.preventDefault();
// add open css class
var menu = $('#menu .user-menu');
menu.toggleClass('visible');
});
/* User intro dismiss and save */
$('[data-toggle-introduction]').on('click', function() {
$(this).parent().fadeOut(600);
save_user_meta('introduction_dismissed', true);
});
if( $('.front-page .introduction').length ) {
get_user_meta('introduction_dismissed', function(data) {
if(data.hasOwnProperty('result') && data.result !== 'true') {
$('.introduction').show();
$('.introduction').addClass('fadein');
}
});
}
/* Program page */
var program_entry_point = '.program-list';
if( $(program_entry_point).length ) {
/* Load program */
$.getJSON(
program_endpoint+'?callback=?',
query_params,
function(data) {
if(data && data.events) {
// render template
var html = format_posts(data.events);
$(program_entry_point).html(html);
}
}
);
}
/* Search page */
if( $('.search-form').length ) {
$.getJSON(inside_groups_url, function(data) {
// create select fields
var list = '<select multiple class="groups-select" data-placeholder="Velg en gruppe..."><option value=""></option><% _.each(results, function(g) { %>' +
'<option value="<%=g.group_id %>"><%= g.group_name %></option>' +
'<% }); %></select>';
var html = _.template(list, data);
$('.groups-select-wrap').html(html);
// run chosen
$('.groups-select').chosen({
no_results_text: 'Uffda, ingen treff!',
allow_single_deselect: true
}).change(function() {
do_search();
});
/* Load intial values from url query */
user_search_load_initial_values();
});
$('.search-field').on('keyup keypress', function(e) {
// No <enter>
if (e.keyCode === 10 || e.keyCode === 13) {
e.preventDefault();
}
});
$('.search-field').on('keyup keypress', _.debounce(function() {
do_search();
}, 300));
/* Toggles */
$('.roles a').on('click', function(e) {
e.preventDefault();
$(this).toggleClass('active');
do_search();
});
}
/* Mailinglists page */
if( $('.page-mailinglists').length ) {
// TODO: better mobile layout
// TODO: dynamic show/hide of members
/* Load list of lists*/
$.getJSON(
email_endpoint,
{ _wpnonce: $('meta[name=x-inside-api-nonce]').attr('content') },
function(data) {
if(data.error) {
$('.lists-list').html(data.error);
return;
}
data.lists = _.filter(data.lists, function(l) { return l.num > 1; }); //{ lists: _.groupBy(data, function(x){ return x.source; }) };
console.log(data);
var list_template = '<% _.each(lists, function(l) { %>' +
'<li data-list-name="<%= l.name %>"><a href="'+ window.location.pathname + '?q=<%= l.name %>" class="list-name"><%= l.name %></a><br>' +
'<span class="list-num-members"><%= l.num %> medlemmer</span>'+
'<a href="<%= l.admin_url %>" class="email-<%= l.type %> button-alt" title="<%= l.type %>"> '+
'<span class="dashicons dashicons-<% if( l.admin_type == "selfservice" ) { %>edit<% } else { %>email<% } %>"> </span>Endre'+
'</a></li>' +
'<% }); %>';
var html = _.template(list_template, data);
$('.lists-list').html(html);
/* Index list and make searchable and sortable */
var options = {
valueNames: [ 'list-name', 'list-num-members' ]
};
new List('mailinglists', options);
mailing_lists_load_initial();
}
);
}
/* Profile page */
if( $('.profile').length ) {
/* Load groups and memberships */
var params = {
q: $('meta[name=x-username]').attr('content'),
exact: true,
_wpnonce: $('meta[name=x-inside-api-nonce]').attr('content')
};
if(getParameterByName('username') !== '') {
params.q = getParameterByName('username');
}
$.getJSON(
user_search_endpoint,
params,
function(data) {
if( data.hasOwnProperty('results') && data.results.length === 1) {
var u = data.results[0];
var group_html = '';
for(var i=0;i<u.groups.length; i++) {
group_html += '<li>' + u.groups[i].name + '</li>';
}
$('.group-list').html(group_html);
var is_member_field = $('.is-member');
if(u.is_member === '1') {
is_member_field.html('Gyldig medlemskap.');
} else {
is_member_field.html('Du har ikke et gyldig medlemskap. Du kan forny medlemskapet ditt via SMS, via <a href="http://snappordel.com">SnappOrder</a> eller via nettbutikken i <a href="https://inside.studentersamfundet.no">Inside</a>.');
}
// if other profile, add link to profile
$('.js-inside-link').attr('href', 'https://inside.studentersamfundet.no/?page=display-user&userid='+u.id);
}
}
);
/* Load email aliases */
params.q = $('.profile-details .user-email').text();
params.inherited = true;
$.getJSON(
email_endpoint,
params,
function(data) {
var list = '<% _.each(results, function(r) { %>' +
'<li><%= r.name %> <a href="<%= r.admin_url %>" class="email-<%= r.type %>" title="<%= r.type %>"><span class="dashicons dashicons-<% if( r.admin_type == "selfservice" ) { %>edit<% } else { %>email<% } %>"></span></a></li>' +
'<% }); %>';
var html = _.template(list, data);
$('.account-details .email-list').html(html);
if( params.inherited ) {
data.results = data.inherited_results; // reuse template
html = _.template(list, data);
$('.account-details .email-list-inherited').html(html);
}
}
);
}
});
File diff suppressed because it is too large. Load diff
+3 -2
View File
@@ -18,8 +18,8 @@
<link href="<?php bloginfo( 'stylesheet_directory' ); ?>/dist/styles/main.css" rel="stylesheet" type="text/css" />
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,700,800,600' rel='stylesheet' type='text/css'>
<?php wp_head(); ?>
<script src="<?php bloginfo( 'stylesheet_directory' ); ?>/dist/scripts/vendor.js"></script>
<script>jQuery.migrateMute = true;</script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script src="<?php bloginfo( 'stylesheet_directory' ); ?>/dist/scripts/main.js"></script>
@@ -28,6 +28,7 @@
</head>
<body <?php neuf_body_class(); ?>>
<!-- Google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -47,6 +48,6 @@
<?php get_template_part( 'menu' ); ?>
</div>
</div>
</header><!-- #site-header -->
@@ -7,8 +7,8 @@ function return_json($result) {
die(json_encode($result));
}
if(!defined('EMAIL_API_KEY') || !defined('EMAIL_URL') ) {
return_json(array("error" => "Looks like youre missing EMAIL_API_KEY or EMAIL_URL in wp-config.php"));
if(!defined('EMAIL_API_USERNAME') || !defined('EMAIL_API_PASSWORD') || !defined('EMAIL_URL')) {
return_json(array("error" => "Looks like you are missing a setting in wp-config.php"));
}
$nonce_action = 'inside-api';
@@ -17,29 +17,42 @@ if(!wp_verify_nonce($_GET['_wpnonce'], $nonce_action)) {
return_json($result);
}
$args = $_GET;
$endpoint_map = array(
'search' => 'email_search.php',
'list' => 'email_list.php'
$args = array(
'domain__name' => 'studentersamfundet.no',
);
$do = "search";
if( isset($args['do']) ) {
$do = $args['do'];
unset($_GET['do']);
if( !in_array($do, array('search', 'list')) ) {
die(json_encode(array('result' => 'Invalid do value: '.$do)));
}
if(isset($_GET['q'])) {
$args['source_regex'] = $_GET['q'];
}
$args = array_merge($args, array('apikey' => EMAIL_API_KEY));
// FIXME on error
//wp_mail( $to, $subject, $message, $headers);
$ch = curl_init(EMAIL_URL.$endpoint_map[$do].'?'.http_build_query($args));
$ch = curl_init(EMAIL_URL."aliases/".'?'.http_build_query($args));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING ,"");
curl_setopt($ch, CURLOPT_USERPWD, EMAIL_API_USERNAME.":".EMAIL_API_PASSWORD);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=UTF-8'));
$result = curl_exec($ch);
echo $result;
$aliases = json_decode(curl_exec($ch));
$result = array();
foreach ($aliases as $alias) {
if(array_key_exists($alias->source, $result)) {
$result[$alias->source]['num'] += 1;
$result[$alias->source]['destinations'][] = $alias->destination;
} else {
$result[$alias->source] = array(
'name' => $alias->source,
'href' => '&q=' . $alias->source,
'num' => 1,
'type' => 'aliases',
'admin_url' => 'https://lister.neuf.no',
'admin_type' => 'selfservice',
'destinations' => array($alias->source)
);
}
}
sort($result);
echo json_encode(array(
'meta' => array('num' => count($result)),
'lists' => $result
));