Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
.DS_STORE
.DS_STORE
.idea/
24 changes: 22 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2
version: 2.1

jobs:
build:
php-tests:
docker:
- image: php:7
working_directory: ~/build
Expand Down Expand Up @@ -29,3 +30,22 @@ jobs:

- store_test_results:
path: "./tmp/"

javascript-tests:
docker:
- image: cimg/node:20.19
working_directory: ~/build
steps:
- checkout
- run:
name: "Run Calendar Parameter Tests"
command: npm run test:calendar
- run:
name: "Run Card Image Widget Tests"
command: npm run test:card-images

workflows:
tests:
jobs:
- php-tests
- javascript-tests
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"format:js": "wp-scripts format-js",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"test:card-images": "node tests/card-image-widgets.test.js",
"test:calendar": "node tests/calendar-params.test.js",
"start": "wp-scripts start showpass-block-src/index.js --output-path=plugin/build-blocks",
"packages-update": "wp-scripts packages-update"
},
Expand Down
14 changes: 12 additions & 2 deletions plugin/inc/default-grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
foreach ($events as $key => $event) {
// default event link does nothing
$event_href = 'javascript:void(0);';
$image_opens_widget = false;
if (isset($event['external_link'])) {
$event_href = $event['external_link'];
}
Expand All @@ -35,13 +36,22 @@
*/
if (isset($detail_page)) {
$event_href = sprintf('/%s/?slug=%s', $detail_page, $event['slug']);
} else {
$image_opens_widget = true;
}
}
?>
<div class="showpass-flex-column showpass-no-border showpass-event-card showpass-grid">
<div class="showpass-event-grid showpass-layout-flex m15">
<div class="flex-100 showpass-flex-column showpass-no-border showpass-no-padding p0">
<a href="<?= $event_href ?>" class="showpass-image ratio banner">
<a href="<?= $event_href ?>"
class="showpass-image ratio banner<?php if ($image_opens_widget) echo ' open-ticket-widget'; ?>"
<?php if ($image_opens_widget) { ?>id="<?php echo $event['slug']; ?>"
data-show-description="<?= $show_widget_description ?>"<?php } ?>
<?php if ($image_opens_widget && isset($event_data['tracking_id'])) { ?>
data-tracking="<?php echo $event_data['tracking_id']; ?>"<?php } ?>
<?php if ($image_opens_widget && isset($lang) && $lang !== '') { ?>
data-lang="<?= esc_attr($lang) ?>"<?php } ?>>
<?= isset($event['image_banner'])
? $showpass_image_formatter->getResponsiveImage($event['image_banner'], ['alt' => $event['name'], 'title' => $event['name'], 'breakpoints' => $image_breakpoints])
: sprintf('<img src="%s" alt="%s" />', plugin_dir_url(__FILE__).'../images/default-banner.jpg', $event['name']);
Expand Down Expand Up @@ -159,4 +169,4 @@
</div>
<?php } ?>
</div>
</div>
</div>
19 changes: 14 additions & 5 deletions plugin/inc/default-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,37 @@
$event_href = sprintf('/%s/?slug=%s', $detail_page, $event['slug']);
}
}
$image_opens_widget = !isset($event['external_link'])
&& !isset($detail_page)
&& !showpass_ticket_sold_out($event);
?>

<div class="flex-100 showpass-flex-column list-layout-flex showpass-no-border showpass-event-card">
<div class="showpass-event-layout-list showpass-layout-flex m15">
<div class="card-image showpass-flex-column list-layout-flex showpass-no-border showpass-no-padding p0">
<a id="<?php echo $event['slug']; ?>"
class="showpass-image showpass-hide-mobile ratio full-height <?php if (showpass_ticket_sold_out($event) && !isset($event['external_link'])) echo 'showpass-soldout' ?>"
class="showpass-image showpass-hide-mobile ratio full-height<?php if ($image_opens_widget) echo ' open-ticket-widget'; ?><?php if (showpass_ticket_sold_out($event) && !isset($event['external_link'])) echo ' showpass-soldout'; ?>"
href="<?= $event_href ?>" <?php if (isset($event_data['tracking_id'])) : ?>
data-tracking="<?php echo $event_data['tracking_id']; ?>" <?php endif ?>
<?php if (isset($event_data['show_eyereturn'])) : ?>
data-eyereturn="<?= $event_data['show_eyereturn'] ?>" <?php endif ?>>
data-eyereturn="<?= $event_data['show_eyereturn'] ?>" <?php endif ?>
<?php if ($image_opens_widget) { ?>data-show-description="<?= $show_widget_description ?>"<?php } ?>
<?php if ($image_opens_widget && isset($lang) && $lang !== '') { ?>
data-lang="<?= esc_attr($lang) ?>"<?php } ?>>
<?= isset($event['image'])
? $showpass_image_formatter->getResponsiveImage($event['image'], ['alt' => $event['name']])
: sprintf('<img src="%s" alt="%s" />', plugin_dir_url(__FILE__).'../images/default-square.jpg', $event['name']);
?>
</a>
<a id="<?php echo $event['slug']; ?>"
class="showpass-image showpass-hide-large ratio banner <?php if (showpass_ticket_sold_out($event) && !isset($event['external_link'])) echo 'showpass-soldout' ?>"
class="showpass-image showpass-hide-large ratio banner<?php if ($image_opens_widget) echo ' open-ticket-widget'; ?><?php if (showpass_ticket_sold_out($event) && !isset($event['external_link'])) echo ' showpass-soldout'; ?>"
href="<?= $event_href ?>" <?php if (isset($event_data['tracking_id'])) : ?>
data-tracking="<?php echo $event_data['tracking_id']; ?>" <?php endif ?>
<?php if (isset($event_data['show_eyereturn'])) : ?>
data-eyereturn="<?= $event_data['show_eyereturn'] ?>" <?php endif ?>>
data-eyereturn="<?= $event_data['show_eyereturn'] ?>" <?php endif ?>
<?php if ($image_opens_widget) { ?>data-show-description="<?= $show_widget_description ?>"<?php } ?>
<?php if ($image_opens_widget && isset($lang) && $lang !== '') { ?>
data-lang="<?= esc_attr($lang) ?>"<?php } ?>>
<?= isset($event['image_banner'])
? $showpass_image_formatter->getResponsiveImage($event['image_banner'], ['alt' => $event['name']])
: sprintf('<img src="%s" alt="%s" />', plugin_dir_url(__FILE__).'../images/default-banner.jpg', $event['name']);
Expand Down Expand Up @@ -176,4 +185,4 @@ class="flex-50 showpass-flex-column list-layout-flex showpass-no-border showpass
</div>
<?php } ?>
</div>
</div>
</div>
7 changes: 5 additions & 2 deletions plugin/inc/default-membership-grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
<div class="showpass-flex-column showpass-no-border showpass-event-card showpass-grid">
<div class="showpass-membership-grid showpass-layout-flex m15">
<div class="flex-100 showpass-flex-column showpass-no-border showpass-no-padding p0">
<a href="<?= $membership_href ?>" class="showpass-image ratio banner">
<a class="showpass-image ratio banner open-membership-widget"
id="<?php echo $membership['id']; ?>"
data-show-description="<?= $show_widget_description ?>"
<?php if (isset($lang) && $lang !== '') {?>data-lang="<?= esc_attr($lang) ?>"<?php } ?>>
<?= isset($membership['image'])
? $showpass_image_formatter->getResponsiveImage($membership['image'], ['alt' => $membership['name'], 'title' => $membership['name'], 'breakpoints' => $image_breakpoints])
: sprintf('<img src="%s" alt="%s" />', plugin_dir_url(__FILE__).'../images/default-banner.jpg', $membership['name']);
Expand Down Expand Up @@ -98,4 +101,4 @@ class="showpass-list-ticket-button showpass-button open-membership-widget"
</div>
<?php } ?>
</div>
</div>
</div>
99 changes: 99 additions & 0 deletions plugin/js/showpass-calendar-params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
(function (root) {
"use strict";

function getAttribute(element, name) {
if (!element || typeof element.getAttribute !== "function") {
return "";
}

var value = element.getAttribute(name);
return typeof value === "string" ? value.trim() : "";
}

function parsePositiveInteger(value) {
if (!/^[1-9][0-9]*$/.test(value)) {
return undefined;
}

var parsed = Number(value);
return parsed <= 9007199254740991 ? parsed : undefined;
}

function parseBoolean(value) {
if (value === "true") {
return true;
}
if (value === "false") {
return false;
}

return undefined;
}

function parseSpecialEvent(value) {
var keys = value
.split(",")
.map(function (key) {
return key.trim();
})
.filter(function (key) {
return key !== "";
});

if (keys.length === 0) {
return undefined;
}

return keys.length === 1 ? keys[0] : keys;
}

function fromElement(element) {
var params = {};
var calendarOpenState = getAttribute(element, "data-calendar-open-state");
var calendarDate = getAttribute(element, "data-calendar-date");
var calendarTimeslot = getAttribute(element, "data-calendar-timeslot");
var calendarSpecialEvent = parseSpecialEvent(
getAttribute(element, "data-calendar-special-event")
);
var displayPricePatronTypeId = parsePositiveInteger(
getAttribute(element, "data-display-price-patron-type-id")
);
var hidePrice = parseBoolean(getAttribute(element, "data-hide-price"));
var highlightMultiDayEventsOnStartDateOnly = parseBoolean(
getAttribute(
element,
"data-highlight-multi-day-events-on-start-date-only"
)
);

if (calendarOpenState === "calendar" || calendarOpenState === "special-events") {
params.calendarOpenState = calendarOpenState;
}

if (calendarDate !== "") {
params.calendarDate = calendarDate;
}
if (calendarTimeslot !== "") {
params.calendarTimeslot = calendarTimeslot;
}
if (calendarSpecialEvent !== undefined) {
params.calendarSpecialEvent = calendarSpecialEvent;
}
if (displayPricePatronTypeId !== undefined) {
params.displayPricePatronTypeId = displayPricePatronTypeId;
}
if (hidePrice !== undefined) {
params.hidePrice = hidePrice;
}
if (highlightMultiDayEventsOnStartDateOnly !== undefined) {
params.highlightMultiDayEventsOnStartDateOnly =
highlightMultiDayEventsOnStartDateOnly;
}

return params;
}

root.ShowpassCalendarParams = {
fromElement: fromElement,
};
})(window);
10 changes: 10 additions & 0 deletions plugin/js/showpass-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@

lang: $(this).attr("data-lang"),
};
Object.assign(
params,
window.ShowpassCalendarParams.fromElement(this)
);

params["redirect-url"] = encodeURIComponent(
window.location.href
Expand Down Expand Up @@ -247,6 +251,12 @@
"#option_widget_color"
).val(),
};
Object.assign(
params,
window.ShowpassCalendarParams.fromElement(
embeddedCalendarWidget
)
);
if (
embeddedCalendarWidget.getAttribute("data-tags")
) {
Expand Down
24 changes: 23 additions & 1 deletion plugin/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tags: showpass, events, tickets, sell tickets, event calendar, purchase tickets, custom event pages
Requires at least: 4.9
Tested up to: 6.8.2
Stable tag: 4.0.8
Stable tag: 4.0.9
Requires PHP: 5.4.45
Contributors: marcshowpass, spapril, spzachary, cgarrovillosp

Expand All @@ -14,6 +14,24 @@ List events, display event details and products. Use the Showpass purchase widge

Showpass is a full event management solution, allowing organizations and individuals to organize and execute successful events.

== Calendar shortcode attributes ==

Both `[showpass_calendar_widget]` and `[showpass_embed_calendar]` accept these optional attributes:

* `display_price_patron_type_id` - a positive venue-local PatronType ID. This changes displayed prices only and never filters availability, calendar contents, or ticket choices.
* `hide_price` - `true` or `false`. This hides calendar price text and the price-range filter without changing availability or ticket selection.
* `calendar_date` - a venue-local date such as `2026-09-14`.
* `calendar_timeslot` - a public timeslot key used with `calendar_date`.
* `calendar_special_event` - one attraction special-event key, multiple comma-separated keys, or `all` to select every currently filterable special event.
* `calendar_open_state` - `calendar` (default) or `special-events`. Opens the Special Events tab when rich special-event content is available; otherwise keeps the calendar view. This controls the view independently of special-event filtering. When combined with a date/timeslot target, the Special Events view opens first. Any configured quantity prompt still comes first.
* `highlight_multi_day_events_on_start_date_only` - `true` or `false`. Highlights multi-day events only on their local start date.

Example: `[showpass_embed_calendar calendar_date="2026-09-14" calendar_timeslot="evening" calendar_special_event="opening,closing" display_price_patron_type_id="17" hide_price="false"]`

Special Events example: `[showpass_embed_calendar is_attraction="true" event_id="YOUR_ATTRACTION_ID" calendar_special_event="all" calendar_open_state="special-events"]`

The new options require the corresponding calendar frontend and rebuilt SDK to be deployed before releasing this plugin update.

Whether you are selling tickets to your fundraiser, or an assigned seating theatre show, Showpass has the technology you need to get the job done.

Wordpress version 5.3 is required for editor blocks
Expand Down Expand Up @@ -55,6 +73,10 @@ Please visit our support documentation at [http://support.showpass.com](http://s

== Changelog ==

= 4.0.9 =
* Expose current calendar SDK options through the modal and embedded calendar shortcodes
* Make event and membership card images open the same destination as their titles while preserving external links, detail pages, and sold-out behavior

= 4.0.7 =
* Force redirect-url param for Affirm support

Expand Down
Loading