Plugin Directory

Changeset 786521


Ignore:
Timestamp:
10/11/2013 05:34:49 PM (12 years ago)
Author:
WebsiteBakery
Message:

Additional functions added to use event details from product/cart context (1.2)

Location:
woot-library
Files:
7 added
8 edited

Legend:

Unmodified
Added
Removed
  • woot-library/branches/1.x/aliases.php

    r785018 r786521  
    6161
    6262/**
     63 * Determines if the current or specified product functions as an event ticket.
     64 *
     65 * @param null $product
     66 * @return bool
     67 */
     68function woot_is_event_ticket($product = null) {
     69    return (false === woot_get_event($product)) ? false : true;
     70}
     71
     72/**
    6373 * Returns the event associated with the current product (this can explicitly
    6474 * be specified as either a post ID or object or else not be supplied, and
     
    7383    if (null === $product) $product = get_the_ID();
    7484    return Woot_Library::get_event_from_product($product);
     85}
     86
     87/**
     88 * Returns the event start date associated with the current product (or a
     89 * specific product ID/object can be explicitly passed in). It varies from
     90 * tribe_get_event_date() in that it will by default return that date only
     91 * and not the time (but see woot_get_event_time()).
     92 *
     93 * A specific date format string can optionally be passed.
     94 *
     95 * @param null $product
     96 * @param string $format
     97 * @return bool|string
     98 */
     99function woot_get_event_date($product = null, $format = '') {
     100    $event = woot_get_event($product);
     101    if (false === $event) return false;
     102    return tribe_get_start_date($event, false, $format);
     103}
     104
     105/**
     106 * Returns the event start time associated with the current product (or a
     107 * specific product ID/object can be explicitly passed in).
     108 *
     109 * A specific date format string can optionally be passed if there's a need
     110 * to deviate from the default format.
     111 *
     112 * @param null $product
     113 * @param string $format
     114 * @return bool|string
     115 */
     116function woot_get_event_time($product = null, $format = '') {
     117    $event = woot_get_event($product);
     118    if (false === $event) return false;
     119    if (empty($format)) return tribe_get_start_date($event, true, ' ');
     120    else return tribe_get_start_date($event, false, ' ' . $format);
     121}
     122
     123function woot_get_event_title($product = null) {
     124    $event = woot_get_event($product);
     125    if (false === $event) return false;
     126    return apply_filters('the_title', $event->post_title, $event->ID);
    75127}
    76128
  • woot-library/branches/1.x/readme.md

    r784792 r786521  
    99* WooCommerce
    1010
    11 It is packaged as a plugin and must be installed and activated before the helper functions can be used. The advantage
    12 of the plugin approach (as opposed to embedding the functions in your theme's functions.php file for instance - though
    13 you are of course welcome to do so if you wish) is that if a problem is found and fixed, or new helpers are added,
    14 you need only update the latest version of the plugin to benefit.
     11It is [packaged as a plugin](http://wordpress.org/plugins/woot-library/) and must be installed and activated before the
     12helper functions can be used. The advantage of the plugin approach (as opposed to embedding the functions in your
     13theme's functions.php file for instance - though you are of course welcome to do so if you wish) is that if a problem is
     14found and fixed, or new helpers are added, you need only update the latest version of the plugin to benefit.
     15
     16Grab a copy
     17-----------
     18
     19You can obtain this [from the WordPress plugin directory](http://wordpress.org/plugins/woot-library/) (recommended,
     20since that will facilitate automated updates) or else download a release zip here on the GitHub repo.
  • woot-library/branches/1.x/readme.txt

    r785018 r786521  
    66Requires at least: 3.6
    77Tested up to: 3.6.1
    8 Stable tag: 1.1
     8Stable tag: 1.2
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2323* Pulling event details into catalog views
    2424
    25 Dramatic, eh?
     25Dramatic, eh? Recipes for various tasks can be found
     26[on the project wiki](https://github.com/barryhughes/woot-library/wiki)
     27for those wanting some hints as to how to use this thang.
    2628
    2729== Installation ==
     
    4143By itself, nothing. It simply provides a number of "helpers" to let people selling tickets with WooCommerce Tickets
    4244build customizations just a little more easily than is normally possible.
     45
     46= How on earth do I use it? =
     47
     48Please go ahead and
     49[visit the project wiki](https://github.com/barryhughes/woot-library/wiki) -
     50this has a number of recipes to get you started and I will add more as time permits / in line with requests :-)
    4351
    4452= How can I request a new helper? =
  • woot-library/branches/1.x/woot-library.php

    r785018 r786521  
    55 * Description: Simple helper library - to help you build customizations relating to your WooCommerce Tickets powered website.
    66 * Author: Barry Hughes
    7  * Version: 1.1
     7 * Version: 1.2
    88 * Author URI: http://codingkills.me
    99 */
  • woot-library/trunk/aliases.php

    r785018 r786521  
    6161
    6262/**
     63 * Determines if the current or specified product functions as an event ticket.
     64 *
     65 * @param null $product
     66 * @return bool
     67 */
     68function woot_is_event_ticket($product = null) {
     69    return (false === woot_get_event($product)) ? false : true;
     70}
     71
     72/**
    6373 * Returns the event associated with the current product (this can explicitly
    6474 * be specified as either a post ID or object or else not be supplied, and
     
    7383    if (null === $product) $product = get_the_ID();
    7484    return Woot_Library::get_event_from_product($product);
     85}
     86
     87/**
     88 * Returns the event start date associated with the current product (or a
     89 * specific product ID/object can be explicitly passed in). It varies from
     90 * tribe_get_event_date() in that it will by default return that date only
     91 * and not the time (but see woot_get_event_time()).
     92 *
     93 * A specific date format string can optionally be passed.
     94 *
     95 * @param null $product
     96 * @param string $format
     97 * @return bool|string
     98 */
     99function woot_get_event_date($product = null, $format = '') {
     100    $event = woot_get_event($product);
     101    if (false === $event) return false;
     102    return tribe_get_start_date($event, false, $format);
     103}
     104
     105/**
     106 * Returns the event start time associated with the current product (or a
     107 * specific product ID/object can be explicitly passed in).
     108 *
     109 * A specific date format string can optionally be passed if there's a need
     110 * to deviate from the default format.
     111 *
     112 * @param null $product
     113 * @param string $format
     114 * @return bool|string
     115 */
     116function woot_get_event_time($product = null, $format = '') {
     117    $event = woot_get_event($product);
     118    if (false === $event) return false;
     119    if (empty($format)) return tribe_get_start_date($event, true, ' ');
     120    else return tribe_get_start_date($event, false, ' ' . $format);
     121}
     122
     123function woot_get_event_title($product = null) {
     124    $event = woot_get_event($product);
     125    if (false === $event) return false;
     126    return apply_filters('the_title', $event->post_title, $event->ID);
    75127}
    76128
  • woot-library/trunk/readme.md

    r784792 r786521  
    99* WooCommerce
    1010
    11 It is packaged as a plugin and must be installed and activated before the helper functions can be used. The advantage
    12 of the plugin approach (as opposed to embedding the functions in your theme's functions.php file for instance - though
    13 you are of course welcome to do so if you wish) is that if a problem is found and fixed, or new helpers are added,
    14 you need only update the latest version of the plugin to benefit.
     11It is [packaged as a plugin](http://wordpress.org/plugins/woot-library/) and must be installed and activated before the
     12helper functions can be used. The advantage of the plugin approach (as opposed to embedding the functions in your
     13theme's functions.php file for instance - though you are of course welcome to do so if you wish) is that if a problem is
     14found and fixed, or new helpers are added, you need only update the latest version of the plugin to benefit.
     15
     16Grab a copy
     17-----------
     18
     19You can obtain this [from the WordPress plugin directory](http://wordpress.org/plugins/woot-library/) (recommended,
     20since that will facilitate automated updates) or else download a release zip here on the GitHub repo.
  • woot-library/trunk/readme.txt

    r785018 r786521  
    66Requires at least: 3.6
    77Tested up to: 3.6.1
    8 Stable tag: 1.1
     8Stable tag: 1.2
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2323* Pulling event details into catalog views
    2424
    25 Dramatic, eh?
     25Dramatic, eh? Recipes for various tasks can be found
     26[on the project wiki](https://github.com/barryhughes/woot-library/wiki)
     27for those wanting some hints as to how to use this thang.
    2628
    2729== Installation ==
     
    4143By itself, nothing. It simply provides a number of "helpers" to let people selling tickets with WooCommerce Tickets
    4244build customizations just a little more easily than is normally possible.
     45
     46= How on earth do I use it? =
     47
     48Please go ahead and
     49[visit the project wiki](https://github.com/barryhughes/woot-library/wiki) -
     50this has a number of recipes to get you started and I will add more as time permits / in line with requests :-)
    4351
    4452= How can I request a new helper? =
  • woot-library/trunk/woot-library.php

    r785018 r786521  
    55 * Description: Simple helper library - to help you build customizations relating to your WooCommerce Tickets powered website.
    66 * Author: Barry Hughes
    7  * Version: 1.1
     7 * Version: 1.2
    88 * Author URI: http://codingkills.me
    99 */
Note: See TracChangeset for help on using the changeset viewer.