*/
class WP_ABL_Plugin_Public {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $WP_ABL_Plugin The ID of this plugin.
*/
private $WP_ABL_Plugin;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $WP_ABL_Plugin The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $WP_ABL_Plugin, $version ) {
$this->WP_ABL_Plugin = $WP_ABL_Plugin;
$this->version = $version;
}
/**
* Register the stylesheets for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_styles() {
wp_enqueue_style( $this->WP_ABL_Plugin, plugin_dir_url( __FILE__ ) . 'css/wp-abl-plugin-public.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
wp_enqueue_script( $this->WP_ABL_Plugin, plugin_dir_url( __FILE__ ) . 'js/wp-abl-plugin-public.js', array( 'jquery' ), $this->version, false );
}
public function abl_button_shortcode(){
function abl_button($atts){
$options = get_option( 'wp_abl_plugin_settings' );
$atts = shortcode_atts( array('label' => 'Book Now', 'merchant' => '', 'activity' => '', 'event' => '', 'style' => ''), $atts, 'abl-button' );
$merchant = '';
$event = '';
if( isset($options['wp_abl_plugin_settings_public_key']) ){
$atts['merchant'] = $options['wp_abl_plugin_settings_public_key'];
$merchant = 'data-merchant="'.$atts['merchant'].'"';
}else{
$merchant = 'data-merchant="'.$atts['merchant'].'"';
}
if(isset( $atts['event'] ) && $atts['event'] != ''){
$event = 'data-event="'.$atts['event'].'"';
}
return ''.$atts['label'].'';
}
add_shortcode("abl-button", "abl_button");
}
public function abl_redirect_shortcode(){
function abl_redirect($atts){
$options = get_option( 'wp_abl_plugin_settings' );
$atts = shortcode_atts( array('label' => 'Book Now', 'merchant' => '', 'activity' => '', 'event' => '', 'style' => ''), $atts, 'abl-redirect' );
$merchant = '';
$activity = '';
$event = '';
if( isset($options['wp_abl_plugin_settings_public_key']) ){
$atts['merchant'] = $options['wp_abl_plugin_settings_public_key'];
}
if(isset( $atts['activity'] ) && $atts['activity'] != ''){
$activity = '/activity/'.$atts['activity'];
}
if(isset( $atts['event'] ) && $atts['event'] != ''){
$event = '/event/'.$atts['event'];
}
$link = ABL_ENV_URL_REDIRECT . '#/merchant/' . $atts['merchant'];
if($activity != ''){
$link .= $activity;
}
if($event != ''){
$link .= $event;
}
return '' . $atts['label'] . '';
}
add_shortcode("abl-redirect", "abl_redirect");
}
public function abl_widget_shortcode(){
function abl_widget($atts){
$options = get_option( 'wp_abl_plugin_settings' );
$width = '';
$height = '';
$atts = shortcode_atts( array('merchant' => '', 'width' => '1001', 'height' => '503'), $atts, 'abl-widget' );
if( isset($options['wp_abl_plugin_settings_public_key']) ){
$atts['merchant'] = $options['wp_abl_plugin_settings_public_key'];
}
if(isset( $atts['width'] ) && $atts['width'] != ''){
$width = $atts['width'];
}
if(isset( $atts['height'] ) && $atts['height'] != ''){
$height = $atts['height'];
}
return '';
}
add_shortcode("abl-widget", "abl_widget");
}
public function abl_calendar_shortcode(){
function abl_calendar_assets() {
wp_enqueue_style('abl-css', ABL_ENV_URL_LOADER . 'styles.css');
wp_enqueue_script('abl-js', ABL_ENV_URL_LOADER . 'scripts.js', array( 'jquery'), '1.0.1', false);
}
function abl_calendar($atts){
$options = get_option('wp_abl_plugin_settings');
$merchant = '';
$activity = '';
$event = '';
$date = '';
$id = '';
$type = '';
$object = '';
$width = '';
$height = '';
$label = '';
$atts = shortcode_atts( array('merchant' => '', 'activity' => '', 'event' => '', 'date' => '', 'type' => 'embedded', 'id' => '', 'label' => '', 'width' => '100%', 'height' => '1200px'), $atts, 'abl-calendar' );
if( isset($options['wp_abl_plugin_settings_public_key']) ){
$atts['merchant'] = $options['wp_abl_plugin_settings_public_key'];
}
if(isset( $atts['merchant'] ) && $atts['merchant'] != ''){
$merchant = $atts['merchant'];
$object .= '{merchant:\'' . $merchant . '\'';
}
if(isset( $atts['activity'] ) && $atts['activity'] != ''){
$activity = $atts['activity'];
$object .= ', activity:\'' . $activity . '\'';
}
if(isset( $atts['event'] ) && $atts['event'] != ''){
$event = $atts['event'];
$object .= ', event:\'' . $event . '\'';
}
if(isset( $atts['date'] ) && $atts['date'] != ''){
$date = $atts['date'];
$object .= ', date:\'' . $date . '\'';
}
if(isset( $atts['type'] ) && $atts['type'] != ''){
$type = $atts['type'];
$object .= ', type:\'' . $type . '\'';
}else{
$object .= ', type:\'default\', ';
}
if(isset( $atts['id'] ) && $atts['id'] != ''){
$id = $atts['id'];
$object .= ', id:\'' . $atts['id'] . '\'';
}
if(isset( $atts['label'] ) && $atts['label'] != ''){
$label = $atts['label'];
$object .= ', label:\'' . $atts['label'] . '\'';
}
if(isset( $atts['width'] ) && $atts['width'] != ''){
$width = $atts['width'];
$object .= ', width:\'' . $atts['width'] . '\'';
}
if(isset( $atts['height'] ) && $atts['height'] != ''){
$height = $atts['height'];
$object .= ', height:\'' . $atts['height'] . '\'';
}
$object .= '}';
return '';
}
add_action('wp_enqueue_scripts', 'abl_calendar_assets');//add boostrap library
add_shortcode("abl-calendar", "abl_calendar");
}
public function abl_activity_shortcode(){
function abl_activity_assets() {
wp_enqueue_style('abl-css', ABL_ENV_URL_LOADER . 'styles.css');
wp_enqueue_script('abl-js', ABL_ENV_URL_LOADER . 'scripts.js', array( 'jquery'), '1.0.1', false);
}
function abl_activity($atts){
$options = get_option('wp_abl_plugin_settings');
$merchant = '';
$activity = '';
$event = '';
$id = '';
$type = '';
$object = '';
$width = '';
$height = '';
$label = '';
$atts = shortcode_atts( array('merchant' => '', 'activity' => '', 'event' => '', 'type' => 'embedded', 'id' => '', 'label' => '', 'width' => '100%', 'height' => '1200px'), $atts, 'abl-calendar' );
if( isset($options['wp_abl_plugin_settings_public_key']) ){
$atts['merchant'] = $options['wp_abl_plugin_settings_public_key'];
}
if(isset( $atts['merchant'] ) && $atts['merchant'] != ''){
$merchant = $atts['merchant'];
$object .= '{merchant:\'' . $merchant . '\'';
}
if(isset( $atts['activity'] ) && $atts['activity'] != ''){
$activity = $atts['activity'];
$object .= ', activity:\'' . $activity . '\'';
}
if(isset( $atts['event'] ) && $atts['event'] != ''){
$event = $atts['event'];
$object .= ', event:\'' . $event . '\'';
}
if(isset( $atts['type'] ) && $atts['type'] != ''){
$type = $atts['type'];
$object .= ', type:\'' . $type . '\'';
}else{
$object .= ', type:\'default\', ';
}
if(isset( $atts['id'] ) && $atts['id'] != ''){
$id = $atts['id'];
$object .= ', id:\'' . $atts['id'] . '\'';
}
if(isset( $atts['label'] ) && $atts['label'] != ''){
$label = $atts['label'];
$object .= ', label:\'' . $atts['label'] . '\'';
}
if(isset( $atts['width'] ) && $atts['width'] != ''){
$width = $atts['width'];
$object .= ', width:\'' . $atts['width'] . '\'';
}
if(isset( $atts['height'] ) && $atts['height'] != ''){
$height = $atts['height'];
$object .= ', height:\'' . $atts['height'] . '\'';
}
$object .= '}';
return '';
}
add_action('wp_enqueue_scripts', 'abl_activity_assets');//add boostrap library
add_shortcode("abl-activity", "abl_activity");
}
}