Helper_Frontend
A trait containing various helper functions for frontend operations
Event Visibility
getVisibleEvent
Determines if an event should be visible based on its visibility settings.
The event object to check visibility for
Returns the event object if visible, false otherwise
Google Analytics
googleAnalytics
Sends pageview data to Google Analytics.
The Google Analytics service object
getResults
Retrieves session data from Google Analytics for the last 7 days.
The Google Analytics service object
The Google Analytics profile ID
printResults
Prints the results from a Google Analytics query.
The results object from a Google Analytics query
Event Management
get_events_with_js_return
Retrieves events for a specific date and returns them as JSON.
JSON object containing the formatted date and event items
Filtering
js_filter
Prepares data for JavaScript-based filtering of webinars.
get_filter
Prepares data for filtering artworks.
get_filters_for
Generates filter options for different types of items (case studies, projects, news, shop).
The type of items to generate filters for
The array of items to generate filters from
An array of filter options
Image Handling
getArtworkZoom
Retrieves zoom images for an artwork.
upload_image
Handles image upload and resizing.
replace_img
Replaces an existing image.
Cookie Management
set_cookie
Sets a cookie with the given name and value.
The name of the cookie
The value to set for the cookie
saveCookie
Saves cookie preferences.
send_internal_email
Sends an internal email using PHPMailer.
The data to be used in the email template
Returns ‘ok’ on success, or an error message on failure
Mailchimp Integration
add_to_mailchimp
Adds an email address to a Mailchimp list.
addToMailchimp
Adds a subscriber to a Mailchimp list with additional details.
The subscriber’s email address
The subscriber’s first name
The subscriber’s last name
Search Functionality
getResultSearchString
Extracts and formats a snippet of text around a search term.
The item containing the content to search
The term to search for
A formatted string containing the search term and surrounding context
search_save
Saves a search term, updating its count if it already exists.
Optional tag ID associated with the search