Title: GCal Days
Author: Scott Reilly
Published: <strong>25 de marzo de 2014</strong>
Last modified: 25 de mayo de 2016

---

Buscar plugins

![](https://ps.w.org/gcal-days/assets/banner-772x250.png?rev=883190)

Este plugin **no se ha probado con las últimas 3 versiones mayores de WordPress**.
Puede que ya no tenga soporte ni lo mantenga nadie, o puede que tenga problemas 
de compatibilidad cuando se usa con las versiones más recientes de WordPress.

![](https://ps.w.org/gcal-days/assets/icon-128x128.png?rev=1107414)

# GCal Days

 Por [Scott Reilly](https://profiles.wordpress.org/coffee2code/)

[Descargar](https://downloads.wordpress.org/plugin/gcal-days.1.2.zip)

 * [Detalles](https://es.wordpress.org/plugins/gcal-days/#description)
 * [Valoraciones](https://es.wordpress.org/plugins/gcal-days/#reviews)
 *  [Instalación](https://es.wordpress.org/plugins/gcal-days/#installation)
 * [Desarrollo](https://es.wordpress.org/plugins/gcal-days/#developers)

 [Soporte](https://wordpress.org/support/plugin/gcal-days/)

## Descripción

This plugin provides a shortcode and a set of functions to return the number of 
days since the most recent past event in your Google Calendar matching specified
search terms. The shortcode can also be used to return the number of days until 
the closest upcoming event matching specified search terms.

#### The Shortcode

    ```
    [gcal-days search="" type="" id=""]
    ```

The shortcode name is `gcal-days`. It has three attributes, but only one of which
is absolutely necessary:

 * `search`: (Required.) The search term.
 * `type`: (Optional.) The direction in time to search. Defaults to «since», which
   searches past events. «until» will search future events.
 * `id`: (Conditionally optional.) The ID of the calendar to search. You can discover
   the IDs of calendars via the plugin’s settings page. This shortcode attribute
   can only be optionally omitted from shortcodes if you define a default calendar
   in the plugin’s settings.

The shortcode outputs a number representing the number of days until a matching 
event. If no event is found, a -1 will be displayed.

Examples: `[gcal-days search="dentist"]`, `[gcal-days type="until" search="vacation"
id="test_lkjsadf987asdf24@group.calendar.google.com"]`

Links: [Plugin Homepage](http://coffee2code.com/wp-plugins/gcal-days/) | [Plugin Directory Page](https://wordpress.org/plugins/gcal-days/)
| [Author Homepage](http://coffee2code.com)

### Functions

The plugin provides two functions for use in your theme templates, functions.php,
or in plugins.

#### Functions

 * `<?php function gcal_days_since( $search, $calendar_id = '' ) ?>`
 * `<?php function gcal_days_until( $search, $calendar_id = '' ) ?>`

#### Arguments

 * `$search` (string)
    Required. The word or phrase to search for
 * `$calendar_id` (string)
    Optional. The ID for the Google Calendar. Check the 
   plugin’s settings page for calendar IDs. This argument is only optional if you
   have defined a default calendar via the plugin’s settings.

#### Return Value

An integer value of the number of days since/until the matching event. -1 is returned
if no event was found or an error was encountered.

#### Examples

 * `<?php // Days until next dentist appointment
    $days_until = gcal_days_until('
   dentist' ); ?>
 * `<?php
    // Get the days since my last day off $days_since = gcal_days_since( '
   day off' ); // Echo a message using that number if ( -1 == $days_since ) { echo"
   You've never had a day off?! Take one soon!"; } else { printf( _n( 'Your last
   day off was %d day ago.', 'Your last day off was $d days ago.', $days_since ),
   $days_since ); } ?>

## Capturas

 * [[
 * A screenshot of the plugin’s admin settings page.

## Instalación

 1. Unzip `gcal-days.zip` inside the `/wp-content/plugins/` directory for your site(
    or install via the built-in WordPress plugin installer).
 2. Activate the plugin through the ‘Plugins’ admin menu in WordPress.
 3. Visit the plugin’s setting page, ‘Settings’ -> ‘GCal Days’, and follow the link
    to obtain an authorization code from Google that permits the plugin access to your
    Google Calendar data.
 4. Use the provided shortcode or functions, as per instructions.

## FAQ

  Does that mean I am granting you (the plugin author) access to my Google Calendar
data?

No. Google’s API allows for an app (such as this plugin) to be granted specific 
access (see next question). The access token is requested by the plugin and stored
in your database. The data is only communicated back and forth between your site
and Google via HTTPS.

  What sort of access from Google is the plugin requesting?

The plugin is only requesting read-only access to Google Calendars. As such, the
plugin will not be able to make any changes to your calendars, nor will it be able
to access data associated with other Google services.

  Why isn’t a calendar change I just made in Google Calendar being recognized by
the plugin?

To avoid the expense of making network connections to Google for every page load,
information is cached for a short period of time. You may have to wait a few minutes
after calendar changes before expecting to see those changes reflected in the plugin.

## Reseñas

No hay valoraciones para este plugin.

## Colaboradores y desarrolladores

«GCal Days» es un software de código abierto. Las siguientes personas han colaborado
con este plugin.

Colaboradores

 *   [ Scott Reilly ](https://profiles.wordpress.org/coffee2code/)

[Traduce «GCal Days» a tu idioma.](https://translate.wordpress.org/projects/wp-plugins/gcal-days)

### ¿Interesado en el desarrollo?

[Revisa el código](https://plugins.trac.wordpress.org/browser/gcal-days/) , echa
un vistazo al [repositorio SVN](https://plugins.svn.wordpress.org/gcal-days/) o 
suscríbete al [registro de desarrollo](https://plugins.trac.wordpress.org/log/gcal-days/)
por [RSS](https://plugins.trac.wordpress.org/log/gcal-days/?limit=100&mode=stop_on_copy&format=rss).

## Registro de cambios

#### 1.2 (2016-04-12)

 * New: Add `c2c_GCalDaysGoogle::get_calendar_name()` to get the name of a specific
   calendar.
 * New: In the result notice when testing, specify calendar by name.
 * New: Add error message for the test feature if no calendar ID is specified.
 * New: Add error message for the test feature if an invalid calendar ID is specified.
 * New: Add help message recommending a reset if the authorization code is being
   changed.
 * Bugfix: The test should use the default calendar if no calendar to test against
   was specified.
 * Change: Use `DIRECTORY_SEPARATOR` rather than hardcoded `/` for path separator
   when requiring include files.
 * Change: Add support for language packs:
    - Load the plugin textdomain.
    - Remove .pot file and /lang subdirectory.
    - Remove ‘Domain Path’ from plugin header.
    - Allow translations of more strings.
 * Change: `c2c_GCalDaysGoogle::is_valid_calendar()` now actual checks that the 
   calendar ID is valid.
 * Change: Minor code reformatting.
 * Change: Sanitize class variables when being output as HTML tag attributes (as
   a precaution; they should be safe already).
 * Change: Add more on-screen help text for ‘Test the API’ fields.
 * Change: Prevent direct loading of include files.
 * New: Add LICENSE file.
 * New: Add empty index.php to prevent files from being listed if web server has
   enabled directory listings.
 * New: Add docblocks to `is_api_error()` and `get_api_error()`.
 * Change: Note compatibility through WP 4.5+.
 * Change: Update copyright date (2016).

#### 1.1.1 (2015-03-06)

 * Declare `shortcode()` to be static
 * Add support for localization
 * Note compatibility through WP 4.1+
 * Change documentation links to wp.org to be https
 * Update copyright date (2015)
 * Add plugin icon

#### 1.1

 * Apply do_shortcode to widget_text so the shortcode works in text widgets
 * Add actual documentation for the shortcode
 * Add screenshot
 * Add banner
 * Add another FAQ item

#### 1.0

 * Initial release

## Meta

 *  Versión **1.2**
 *  Última actualización **hace 10 años**
 *  Instalaciones activas **10+**
 *  Versión de WordPress ** 3.6 o superior **
 *  Probado hasta **4.5.33**
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/gcal-days/)
 * Etiquetas:
 * [calendar](https://es.wordpress.org/plugins/tags/calendar/)[gcal](https://es.wordpress.org/plugins/tags/gcal/)
   [google](https://es.wordpress.org/plugins/tags/google/)[shortcode](https://es.wordpress.org/plugins/tags/shortcode/)
 *  [Vista avanzada](https://es.wordpress.org/plugins/gcal-days/advanced/)

## Valoraciones

Aún no se han enviado valoraciones.

[Your review](https://wordpress.org/support/plugin/gcal-days/reviews/#new-post)

[Ver todas las valoraciones](https://wordpress.org/support/plugin/gcal-days/reviews/)

## Colaboradores

 *   [ Scott Reilly ](https://profiles.wordpress.org/coffee2code/)

## Soporte

¿Tienes algo que decir? ¿Necesitas ayuda?

 [Ver el foro de soporte](https://wordpress.org/support/plugin/gcal-days/)

## Donar

¿Te gustaría apoyar el progreso de este plugin?

 [ Dona a este plugin ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ARCFJ9TX3522)