/** * Generates an enquire now button. * * @since 1.4 * @param arr Array of arguments. See @defaults. * @return str Enquire Now HTML button */ function mdjm_get_enquire_now_button($args) { $defaults = array('type' => 'package', 'id' => 0); $args = wp_parse_args($args, $defaults); $label = esc_html(mdjm_get_option('package_contact_btn_text', __('Enquire Now', 'mobile-dj-manager'))); $label = apply_filters('mdjm_enquire_now_' . $args['type'] . '_label', $label); $name = 'mdjm-' . $args['type'] . '-enquiry-button'; $class = 'mdjm_' . $args['type'] . '_enquiry_button'; $value = 'test'; ob_start(); ?> <a href="<?php echo mdjm_get_formatted_url(mdjm_get_option('contact_page')) . $args['type'] . '=' . $args['id']; ?> "> <button type="button" name="<?php echo $name; ?> " class="<?php echo $class; ?> " formmethod="get" value="test"><?php echo $label; ?> </button> </a> <?php $enquire_link = ob_get_clean(); return apply_filters('mdjm_enquire_now_' . $args['type'] . '_button', $enquire_link, $args); }
/** * Load Scripts * * Enqueues the required scripts. * * @since 1.3 * @global $post * @return void */ function mdjm_load_scripts() { $js_dir = MDJM_PLUGIN_URL . '/assets/js/'; wp_register_script('mdjm-ajax', $js_dir . 'mdjm-ajax.js', array('jquery'), MDJM_VERSION_NUM); wp_enqueue_script('mdjm-ajax'); wp_localize_script('mdjm-ajax', 'mdjm_vars', apply_filters('mdjm_script_vars', array('ajaxurl' => mdjm_get_ajax_url(), 'rest_url' => esc_url_raw(rest_url('mdjm/v1/')), 'ajax_loader' => MDJM_PLUGIN_URL . '/assets/images/loading.gif', 'required_date_message' => __('Please select a date', 'mobile-dj-manager'), 'availability_ajax' => mdjm_get_option('avail_ajax', false), 'available_redirect' => mdjm_get_option('availability_check_pass_page', 'text') != 'text' ? mdjm_get_formatted_url(mdjm_get_option('availability_check_pass_page')) : 'text', 'available_text' => mdjm_get_option('availability_check_pass_text', false), 'unavailable_redirect' => mdjm_get_option('availability_check_fail_page', 'text'), 'unavailable_text' => mdjm_get_option('availability_check_fail_text', false), 'is_payment' => mdjm_is_payment() ? '1' : '0', 'default_gateway' => mdjm_get_default_gateway(), 'payment_loading' => __('Please Wait...', 'mobile-dj-manager'), 'no_payment_amount' => __('Select Payment Amount', 'mobile-dj-manager'), 'no_card_name' => __('Enter the name printed on your card', 'mobile-dj-manager'), 'complete_payment' => mdjm_get_payment_button_text()))); wp_register_script('jquery-validation-plugin', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js', array('jquery')); wp_enqueue_script('jquery-validation-plugin'); wp_enqueue_script('jquery-ui-datepicker', array('jquery')); }
/** * Redirect to payments. * * @since 1.3 * @param * @return void */ function mdjm_goto_payments_action($data) { if (!isset($data['event_id'])) { return; } if (!mdjm_event_exists($data['event_id'])) { wp_die('Sorry but no event exists', 'mobile-dj-manager'); } wp_redirect(add_query_arg('event_id', $data['event_id'], mdjm_get_formatted_url(mdjm_get_option('payments_page')))); die; }
/** * Sign the contract. * * @since 1.3 * @param * @return */ function mdjm_sign_event_contract_action($data) { // Check the password is correct $user = wp_get_current_user(); $password_confirmation = wp_authenticate($user->user_login, $data['mdjm_verify_password']); $data['mdjm_accept_terms'] = !empty($data['mdjm_accept_terms']) ? $data['mdjm_accept_terms'] : false; $data['mdjm_confirm_client'] = !empty($data['mdjm_confirm_client']) ? $data['mdjm_confirm_client'] : false; if (is_wp_error($password_confirmation)) { $message = 'password_error'; } elseif (!wp_verify_nonce($data['mdjm_nonce'], 'sign_contract')) { $message = 'nonce_fail'; } else { // Setup the signed contract details $posted = array(); foreach ($data as $key => $value) { if ($key != 'mdjm_nonce' && $key != 'mdjm_action' && $key != 'mdjm_redirect' && $key != 'mdjm_submit_sign_contract') { // All fields are required if (empty($value)) { wp_redirect(add_query_arg(array('event_id' => $data['event_id'], 'mdjm_message' => 'contract_data_missing'), mdjm_get_formatted_url(mdjm_get_option('contracts_page')))); die; } elseif (is_string($value) || is_int($value)) { $posted[$key] = strip_tags(addslashes($value)); } elseif (is_array($value)) { $posted[$key] = array_map('absint', $value); } } } if (mdjm_sign_event_contract($data['event_id'], $posted)) { $message = 'contract_signed'; } else { $message = 'contract_not_signed'; } } wp_redirect(add_query_arg(array('event_id' => $data['event_id'], 'mdjm_message' => $message), mdjm_get_formatted_url(mdjm_get_option('contracts_page')))); die; }
function client_form() { global $my_mdjm, $mdjm, $mdjm_settings; /* -- Playlist Additions -- */ if (isset($_POST['submit']) && $_POST['submit'] == 'Add Song') { $this->add_song(); } /* -- Playlist Removal -- */ if (isset($_GET['remove_song']) && !empty($_GET['remove_song'])) { $this->remove_song($_GET['remove_song']); } /* -- Enqueue jQuery validation -- */ wp_enqueue_script('mdjm-validation'); /* WELCOME TEXT */ echo parent::__text('playlist_welcome', '<p>Welcome to the ' . MDJM_COMPANY . ' event playlist management system.</p>'); /* INTRO TEXT */ echo parent::__text('playlist_intro', '<p>Use this tool to let your DJ know the songs that you would like played (or perhaps not played) ' . 'during your event on <strong>' . date('l, jS F Y', $this->eventinfo['date']) . '</strong>.</p>'); /* If client has more than one event, allow them to switch between events */ if (count($my_mdjm['active']) > 1) { ?> <?php /* EDITING PLAYLIST TEXT */ echo parent::__text('playlist_edit', '<p>You are currently editing the playlist for your event on ' . date('l, jS F Y', $this->eventinfo['date']) . '. To edit the playlist for one of your other events, ' . 'return to the <a href="' . mdjm_get_formatted_url(MDJM_HOME, false) . '">' . MDJM_APP . ' home page</a> and select Edit Playlist from the drop down list displayed next to the event for ' . 'which you want to edit the playlist.</p>'); } // if( count( $my_mdjm['active'] ) > 1 ) $num_songs = MDJM()->events->count_playlist_entries($this->event->ID); /* Display the form to add songs to playlist */ if (MDJM()->events->playlist_status($this->eventinfo['date'])) { // Display form echo '<hr />' . "\r\n"; echo '<div id="mdjm-playlist-container">' . "\r\n"; echo '<div id="mdjm-playlist-table">' . "\r\n"; echo '<form action="' . mdjm_get_formatted_url(MDJM_PLAYLIST_PAGE) . 'event_id=' . $this->event->ID . '" method="post" enctype="multipart/form-data" name="client-playlist" id="client-playlist">' . "\r\n"; wp_nonce_field('manage_playlist', '__mdjm_playlist') . "\r\n"; echo '<table id="mdjm-playlist-display">' . "\r\n"; echo '<tr>' . "\r\n"; echo '<td><label for="playlist_song">' . __('Song Name') . '</label>:<br />' . '<input name="playlist_song" id="playlist_song" type="text" size="25" class="required" /></td>' . "\r\n"; echo '<td><label for="playlist_artist">' . __('Artist') . '</label>?<br />' . '<input name="playlist_artist" id="playlist_artist" type="text" size="25" class="required" /></td>' . "\r\n"; echo '<td><label for="playlist_when">' . __('When to Play') . '</label>:<br />' . '<select name="playlist_when" id="playlist_when">' . "\r\n"; $pl_when = explode("\n", $mdjm_settings['playlist']['playlist_cats']); foreach ($pl_when as $when) { echo '<option value="' . $when . '">' . $when . '</option>' . "\r\n"; } // foreach( $pl_when as $when ) echo '</select></td>' . "\r\n"; echo '<td><label for="playlist_info">' . __('Info') . '</label>:<br />' . '<textarea name="playlist_info" id="playlist_info" placeholder="Optional: add information if you selected Other from the drop down list">' . '</textarea></td>' . "\r\n"; echo '</tr>' . "\r\n"; echo '<tr>' . "\r\n"; echo '<td colspan="4" style="text-align: left;"><input name="submit" id="submit" type="submit" value="Add Song" /></td>' . "\r\n"; echo '</tr>' . "\r\n"; // End the table display echo '</table>' . "\r\n"; echo '</form>' . "\r\n"; echo '</div>' . "\r\n"; // End div mdjm-playlist-table echo '</div>' . "\r\n"; // End div mdjm-playlist-container } else { echo parent::display_notice(1, parent::__text('playlist_closed', '<p>Additions to your playlist are disabled to allow your ' . MDJM_DJ . ' to prepare for your event.</p>')); if ($num_songs > 0) { echo '<p>' . __('Existing playlist entries are displayed below') . '.</p>'; } } /* -- Display existing entries if we have them -- */ if ($num_songs > 0) { // Songs to display $categories = MDJM()->events->get_playlist_by_cat($this->event->ID); echo '<div id="mdjm_song_container">' . "\r\n"; foreach ($categories as $category => $songs) { echo '<table class="mdjm_song_table">' . "\r\n"; echo '<tr>' . "\r\n"; echo '<th colspan="4">' . $category . '</th>' . "\r\n"; echo '</tr>' . "\r\n"; foreach ($songs as $song) { echo '<tr>' . "\r\n"; echo '<td>' . $song->song . '</td>' . "\r\n"; echo '<td>' . $song->artist . '</td>' . "\r\n"; if ($category == 'Guest Added') { echo '<td>' . $song->added_by . '</td>' . "\r\n"; } else { echo '<td>' . (!empty($song->info) ? stripslashes($song->info) : '') . '</td>' . "\r\n"; } echo '<td style="text-align: right;"><a href="' . mdjm_get_formatted_url(MDJM_PLAYLIST_PAGE) . 'remove_song=' . $song->id . '">' . __('Remove') . '</a></td>' . "\r\n"; echo '</tr>' . "\r\n"; } echo '<tr>' . "\r\n"; echo '<td colspan="4" style="font-weight: bold; border-top: 2px solid;">' . count($songs) . _n(' Song', ' Songs', count($songs)) . '</td>' . "\r\n"; echo '</tr>' . "\r\n"; echo '</table>' . "\r\n"; } // End foreach echo '</div>' . "\r\n"; // End div mdjm_song_container } // if( $num_songs > 0 ) }
/** * Remove admin bar & do not allow admin UI for Clients. * Redirect to Client Zone. * * @called init * * @params * * @return void */ public function remove_client_admin() { if (current_user_can('client') || current_user_can('inactive_client')) { add_filter('show_admin_bar', '__return_false'); if (is_admin()) { if (!defined('DOING_AJAX') || !DOING_AJAX) { wp_redirect(mdjm_get_formatted_url(MDJM_HOME, false)); exit; } } } }
/** * Execute the availability check * * @params * * @return */ public static function check_availability() { global $mdjm, $mdjm_settings; if (!isset($_POST['mdjm_avail_submit']) || !isset($_POST['check_date'])) { return; } self::$dj_avail = dj_available('', '', $_POST['check_date']); if (isset(self::$dj_avail)) { // Available & redirect activatated if (!empty(self::$dj_avail['available']) && isset($mdjm_settings['availability']['availability_check_pass_page']) && $mdjm_settings['availability']['availability_check_pass_page'] != 'text') { wp_redirect(mdjm_get_formatted_url($mdjm_settings['availability']['availability_check_pass_page']) . 'mdjm_avail=1&mdjm_avail_date=' . $_POST['check_date']); exit; } else { if (isset($mdjm_settings['availability']['availability_check_fail_page']) && $mdjm_settings['availability']['availability_check_fail_page'] != 'text') { wp_redirect(mdjm_get_formatted_url($mdjm_settings['availability']['availability_check_fail_page'])); exit; } } } }
function edit_event_link($text, $event_id) { global $mdjm; if (MDJM_EDIT_EVENT != true) { return; } $date = get_post_meta($event_id, '_mdjm_event_date', true); if (time() > $date - MDJM_EDIT_EVENT_DISABLE * DAY_IN_SECONDS) { return '<a href="' . mdjm_get_formatted_url(MDJM_HOME, true) . 'action=edit_event_detail&event_id=' . $event_id . '">' . $text . '</a>'; } else { return; } }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { global $mdjm_settings, $mdjm; if (!empty($instance['ajax'])) { self::ajax($args, $instance); } echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } /* Check for form submission & process */ if (isset($_POST['mdjm_widget_avail_submit']) && $_POST['mdjm_widget_avail_submit'] == $instance['submit_text']) { $dj_avail = dj_available('', '', $_POST['widget_check_date']); if (isset($dj_avail)) { if (!empty($dj_avail['available'])) { if (isset($instance['available_action']) && $instance['available_action'] != 'text') { ?> <script type="text/javascript"> window.location = '<?php echo mdjm_get_formatted_url($instance['available_action'], true) . 'mdjm_avail=1&mdjm_avail_date=' . $_POST['widget_check_date']; ?> '; </script> <?php } } else { if (isset($instance['unavailable_action']) && $instance['unavailable_action'] != 'text') { ?> <script type="text/javascript"> window.location = '<?php echo mdjm_get_formatted_url($instance['unavailable_action']); ?> '; </script> <?php } } } // if( isset( $dj_avail ) ) } // if( isset( $_POST['mdjm_avail_submit'] ) ... if (isset($instance['intro']) && !empty($instance['intro'])) { if (isset($_POST['mdjm_widget_avail_submit']) && $_POST['mdjm_widget_avail_submit'] == $instance['submit_text']) { $search = array('{EVENT_DATE}', '{EVENT_DATE_SHORT}'); $replace = array(date('l, jS F Y', strtotime($_POST['widget_check_date'])), date(MDJM_SHORTDATE_FORMAT, strtotime($_POST['widget_check_date']))); } if (!isset($_POST['mdjm_widget_avail_submit']) || $_POST['mdjm_widget_avail_submit'] != $instance['submit_text']) { echo '<div id="widget_avail_intro">' . $instance['intro'] . '</div>'; } else { if (!empty($instance['ajax'])) { ?> <div id="widget_availability_result"></div> <?php } else { if (!empty($dj_avail['available']) && $instance['available_action'] == 'text' && !empty($instance['available_text'])) { echo str_replace($search, $replace, $instance['available_text']); } else { echo str_replace($search, $replace, $instance['unavailable_text']); } } } } $widget_template = mdjm_get_template_part('availability', 'widget', false); include_once $widget_template; echo $args['after_widget']; }
public function event_detail($post_id) { global $mdjm; if (empty($post_id) || !is_string(get_post_status($post_id))) { return; } $event_stati = mdjm_all_event_status(); $name = get_post_meta($post_id, '_mdjm_event_name', true); $date = get_post_meta($post_id, '_mdjm_event_date', true); $end_date = get_post_meta($post_id, '_mdjm_event_end_date', true); $client = get_post_meta($post_id, '_mdjm_event_client', true); $dj = get_post_meta($post_id, '_mdjm_event_dj', true); $dj_wage = get_post_meta($post_id, '_mdjm_event_dj_wage', true); $cost = get_post_meta($post_id, '_mdjm_event_cost', true); $deposit = get_post_meta($post_id, '_mdjm_event_deposit', true); $deposit_status = get_post_meta($post_id, '_mdjm_event_deposit_status', true); $paid = MDJM()->txns->get_transactions($post_id, 'mdjm-income'); $balance_status = get_post_meta($post_id, '_mdjm_event_balance_status', true); $start = get_post_meta($post_id, '_mdjm_event_start', true); $finish = get_post_meta($post_id, '_mdjm_event_finish', true); $status = !empty($event_stati[get_post_status($post_id)]) ? $event_stati[get_post_status($post_id)] : ''; $setup_date = get_post_meta($post_id, '_mdjm_event_djsetup', true); $setup_time = get_post_meta($post_id, '_mdjm_event_djsetup_time', true); $contract = get_post_meta($post_id, '_mdjm_event_contract', true); $contract_date = get_post_meta($post_id, '_mdjm_event_contract_approved', true); $signed_contract = get_post_meta($post_id, '_mdjm_event_signed_contract', true); $notes = get_post_meta($post_id, '_mdjm_event_notes', true); $dj_notes = get_post_meta($post_id, '_mdjm_event_dj_notes', true); $admin_notes = get_post_meta($post_id, '_mdjm_event_admin_notes', true); $package = get_post_meta($post_id, '_mdjm_event_package', true); $addons = get_post_meta($post_id, '_mdjm_event_addons', true); $online_quote = get_post_meta($post_id, '_mdjm_online_quote', true); $guest_playlist = get_post_meta($post_id, '_mdjm_event_playlist_access', true); $eventinfo = array('name' => !empty($name) ? $name : '', 'date' => !empty($date) && is_int(strtotime($date)) ? strtotime($date) : __('Not Specified', 'mobile-dj-manager'), 'end_date' => !empty($end_date) && is_int(strtotime($end_date)) ? strtotime($end_date) : __('Not Specified', 'mobile-dj-manager'), 'client' => !empty($client) ? get_userdata($client) : '', 'dj' => !empty($dj) ? get_userdata($dj) : __('Not Assigned', 'mobile-dj-manager'), 'dj_wage' => !empty($dj_wage) ? mdjm_currency_filter(mdjm_sanitize_amount($dj_wage)) : __('Not Specified', 'mobile-dj-manager'), 'start' => !empty($start) ? date(MDJM_TIME_FORMAT, strtotime($start)) : __('Not Specified', 'mobile-dj-manager'), 'finish' => !empty($finish) ? date(MDJM_TIME_FORMAT, strtotime($finish)) : __('Not Specified', 'mobile-dj-manager'), 'status' => !empty($status) ? $status : '', 'setup_date' => !empty($setup_date) ? strtotime($setup_date) : __('Not Specified', 'mobile-dj-manager'), 'setup_time' => !empty($setup_time) ? date(MDJM_TIME_FORMAT, strtotime($setup_time)) : __('Not Specified', 'mobile-dj-manager'), 'cost' => !empty($cost) ? mdjm_currency_filter(mdjm_sanitize_amount($cost)) : __('Not Specified', 'mobile-dj-manager'), 'deposit' => !empty($deposit) ? mdjm_currency_filter(mdjm_sanitize_amount($deposit)) : '0.00', 'balance' => !empty($paid) && $paid != '0.00' && !empty($cost) ? mdjm_currency_filter(mdjm_sanitize_amount($cost - $paid)) : mdjm_currency_filter(mdjm_sanitize_amount($cost)), 'deposit_status' => !empty($deposit_status) ? $deposit_status : __('Due', 'mobile-dj-manager'), 'balance_status' => !empty($balance_status) ? $balance_status : __('Due', 'mobile-dj-manager'), 'payment_history' => MDJM()->txns->list_event_transactions($post_id), 'type' => $this->get_event_type($post_id), 'online_quote' => mdjm_get_option('online_enquiry', false) && !empty($online_quote) ? $online_quote : '', 'contract' => !empty($contract) ? $contract : '', 'contract_date' => !empty($contract_date) ? date(MDJM_SHORTDATE_FORMAT, strtotime($contract_date)) : date(MDJM_SHORTDATE_FORMAT), 'signed_contract' => !empty($signed_contract) ? $signed_contract : '', 'notes' => !empty($notes) ? $notes : '', 'dj_notes' => !empty($dj_notes) ? $dj_notes : '', 'admin_notes' => !empty($admin_notes) ? $admin_notes : '', 'package' => !empty($package) ? $package : '', 'addons' => !empty($addons) ? implode("\n", $addons) : '', 'guest_playlist' => !empty($guest_playlist) ? mdjm_get_formatted_url(MDJM_PLAYLIST_PAGE) . 'mdjmeventid=' . $guest_playlist : ''); // Allow the $eventinfo array to be filtered $eventinfo = apply_filters('mdjm_event_info', $eventinfo); return $eventinfo; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param arr $args Widget arguments. * @param arr $instance Saved values from database. */ public function widget($args, $instance) { add_action('wp_head', array(&$this, 'datepicker')); if (!empty($instance['ajax'])) { self::ajax($args, $instance); } echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } /* Check for form submission & process */ if (isset($_POST['mdjm_widget_avail_submit']) && $_POST['mdjm_widget_avail_submit'] == $instance['submit_text']) { $dj_avail = dj_available('', $_POST['widget_check_date']); if (isset($dj_avail)) { if (!empty($dj_avail['available'])) { if (isset($instance['available_action']) && $instance['available_action'] != 'text') { ?> <script type="text/javascript"> window.location = '<?php echo mdjm_get_formatted_url($instance['available_action']) . 'mdjm_avail=1&mdjm_avail_date=' . $_POST['widget_check_date']; ?> '; </script> <?php } } else { if (isset($instance['unavailable_action']) && $instance['unavailable_action'] != 'text') { ?> <script type="text/javascript"> window.location = '<?php echo mdjm_get_formatted_url($instance['unavailable_action']); ?> '; </script> <?php } } } // if( isset( $dj_avail ) ) } // if( isset( $_POST['mdjm_avail_submit'] ) ... /* We need the jQuery Calendar */ wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); mdjm_insert_datepicker(array('class' => 'mdjm_widget_date', 'altfield' => 'widget_check_date', 'mindate' => '1')); if (isset($instance['intro']) && !empty($instance['intro'])) { if (isset($_POST['mdjm_widget_avail_submit']) && $_POST['mdjm_widget_avail_submit'] == $instance['submit_text']) { $search = array('{EVENT_DATE}', '{EVENT_DATE_SHORT}'); $replace = array(date('l, jS F Y', strtotime($_POST['widget_check_date'])), mdjm_format_short_date($_POST['widget_check_date'])); } if (!isset($_POST['mdjm_widget_avail_submit']) || $_POST['mdjm_widget_avail_submit'] != $instance['submit_text']) { echo '<div id="widget_avail_intro">' . $instance['intro'] . '</div>'; } else { if (!empty($instance['ajax'])) { ?> <div id="widget_availability_result"></div> <?php } else { if (!empty($dj_avail['available']) && $instance['available_action'] == 'text' && !empty($instance['available_text'])) { echo str_replace($search, $replace, $instance['available_text']); } else { echo str_replace($search, $replace, $instance['unavailable_text']); } } } } ?> <form name="mdjm-widget-availability-check" id="mdjm-widget-availability-check" method="post"> <label for="widget_avail_date"><?php echo $instance['label']; ?> </label> <input type="text" name="widget_avail_date" id="widget_avail_date" class="mdjm_widget_date" style="z-index:99;" placeholder="<?php echo mdjm_format_datepicker_date(); ?> " /> <input type="hidden" name="widget_check_date" id="widget_check_date" value="" /> <p<?php echo isset($instance['submit_centre']) && $instance['submit_centre'] == 'Y' ? ' style="text-align:center"' : ''; ?> > <input type="submit" name="mdjm_widget_avail_submit" id="mdjm_widget_avail_submit" value="<?php echo $instance['submit_text']; ?> " /> <div id="widget_pleasewait" class="page-content" style="display: none;"><?php _e('Please wait...', 'mobile-dj-manager'); ?> <img src="<?php echo MDJM_PLUGIN_URL; ?> /assets/images/loading.gif" alt="<?php _e('Please wait...', 'mobile-dj-manager'); ?> " /></div> </form> <script type="text/javascript"> jQuery(document).ready(function($){ // Configure the field validator $('#mdjm-widget-availability-check').validate({ rules: { widget_avail_date: { required: true, }, }, messages: { widget_avail_date: { required: "<?php _e('Please enter a date', 'mobile-dj-manager'); ?> ", }, }, errorClass: "mdjm-form-error", validClass: "mdjm-form-valid", } ); }); </script> <?php echo $args['after_widget']; }
/** * Print the playlist. * * @since 1.3 * @param arr $data Form data from the $_POST super global. * @return void */ function mdjm_print_playlist_action($data) { if (!wp_verify_nonce($data['mdjm_nonce'], 'print_playlist')) { $message = 'nonce_fail'; } elseif (!isset($data['event_id'])) { $message = 'playlist_data_missing'; } else { // Setup the playlist entry details $posted = array(); foreach ($data as $key => $value) { if ($key != 'mdjm_nonce' && $key != 'mdjm_action' && $key != 'mdjm_redirect' && $key != 'entry_addnew') { if (is_string($value) || is_int($value)) { $posted[$key] = strip_tags(addslashes($value)); } elseif (is_array($value)) { $posted[$key] = array_map('absint', $value); } } } if (mdjm_store_playlist_entry($posted)) { $message = 'playlist_added'; } else { $message = 'playlist_not_added'; } } wp_redirect(add_query_arg(array('event_id' => $data['entry_event'], 'mdjm_message' => $message), mdjm_get_formatted_url(mdjm_get_option('playlist_page')))); die; }
/** * Content tag: quotes_url. * The URL to the online quotes page. * * @param int The event ID. * * @return str The online quote page URL for clients. */ function mdjm_content_tag_quotes_url($event_id = '') { $return = add_query_arg(array('event_id' => $event_id), mdjm_get_formatted_url(mdjm_get_option('quotes_page'), true)); return apply_filters('mdjm_content_tag_quotes_url', $return, $event_id); }
/** * MDJM Playlist Shortcode. * * Displays the MDJM playlist management system which will render a client interface for clients * or a guest interface for event guests with the access URL. * * @since 1.3 * * @return string */ function mdjm_shortcode_playlist($atts) { global $mdjm_event; if (isset($_GET['mdjmeventid'])) { $_GET['guest_playlist'] = $_GET['mdjmeventid']; } $visitor = isset($_GET['guest_playlist']) ? 'guest' : 'client'; $output = ''; $event_id = ''; if (!empty($_GET['event_id'])) { $event_id = $_GET['event_id']; } else { $next_event = mdjm_get_clients_next_event(get_current_user_id()); if ($next_event) { $event_id = $next_event[0]->ID; } } if (!isset($event_id) && !isset($_GET['guest_playlist'])) { ob_start(); mdjm_get_template_part('playlist', 'noevent'); $output .= mdjm_do_content_tags(ob_get_contents(), '', get_current_user_id()); } else { $mdjm_event = $visitor == 'client' ? mdjm_get_event($event_id) : mdjm_get_event_by_playlist_code($_GET['guest_playlist']); if ($visitor == 'client') { if (!is_user_logged_in()) { echo mdjm_login_form(add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('playlist_page')))); } } ob_start(); if ($mdjm_event) { mdjm_get_template_part('playlist', $visitor); $output .= mdjm_do_content_tags(ob_get_contents(), $mdjm_event->ID, $mdjm_event->client); } else { mdjm_get_template_part('playlist', 'noevent'); $output .= mdjm_do_content_tags(ob_get_contents(), '', get_current_user_id()); } } ob_get_clean(); // Reset global var $mdjm_event = ''; return apply_filters('mdjm_playlist_form', $output); }
<?php } else { ?> <?php echo '–'; ?> <?php } // endif( $category == 'Guest Added' ) ?> </div> <div class="mdjm-playlist-remove last"><a href="<?php echo wp_nonce_url(mdjm_get_formatted_url(mdjm_get_option('playlist_page')) . 'mdjm_action=remove_playlist_entry&id=' . $entry->ID . '&event_id=' . $mdjm_event->ID, 'remove_playlist_entry', 'mdjm_nonce'); ?> "><?php _e('Remove'); ?> </a> </div> </div> <?php } // end foreach( $entries as $entry ) ?> <?php }
public function sign_contract() { global $mdjm, $my_mdjm, $clientzone, $mdjm_settings; /* -- Validate the nonce -- */ if (!isset($_POST['mdjm_sign_event_contract']) || !wp_verify_nonce($_POST['mdjm_sign_event_contract'], 'sign_event_contract')) { echo '<script type="text/javascript">' . "\r\n" . 'alert("WordPress Security Validation failed. Please try again");' . "\r\n" . 'history.back();' . "\r\n" . '</script>' . "\r\n"; } /* -- Check the users password is correct -- */ $pass_cfm = wp_authenticate($my_mdjm['me']->user_login, $_POST['sign_pass_confirm']); /* -- Incorrect Password -- */ if (is_wp_error($pass_cfm)) { echo '<script type="text/javascript">' . "\r\n" . 'alert("ERROR: Your password was not entered correctly. Please try again.");' . "\r\n" . 'history.back();' . "\r\n" . '</script>' . "\r\n"; } else { /* -- Remove the save post hook to avoid loops -- */ remove_action('save_post_mdjm-event', 'mdjm_save_event_post', 10, 3); /* -- Create a new signed contract instance -- */ $contract_data = array('post_title' => 'Event Contract: ' . MDJM_EVENT_PREFIX . $this->event->ID, 'post_author' => $my_mdjm['me']->ID, 'post_type' => 'mdjm-signed-contract', 'post_status' => 'publish', 'post_parent' => $this->event->ID, 'ping_status' => 'closed', 'comment_status' => 'closed'); /* -- Prepare the contract content -- */ $content = $this->event_contract->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); /* -- Shortcode replacements -- */ $contract_data['post_content'] = $mdjm->filter_content($my_mdjm['me']->ID, $this->event->ID, $content); /* -- Append Signatory info -- */ $contract_data['post_content'] .= '<hr>' . "\r\n"; $contract_data['post_content'] .= '<p style="font-weight: bold">' . __('Signatory') . ': <span style="text-decoration: underline;">' . ucfirst($_POST['sign_first_name']) . ' ' . ucfirst($_POST['sign_last_name']) . '</span></p>' . "\r\n"; $contract_data['post_content'] .= '<p style="font-weight: bold">' . __('Date of Signature') . ': <span style="text-decoration: underline;">' . date('jS F Y') . '</span></p>' . "\r\n"; $contract_data['post_content'] .= '<p style="font-weight: bold">' . __('Verification Method') . ': User Password Confirmation</p>' . "\r\n"; /* -- Create the Signed Contract Post -- */ $signed_contract = wp_insert_post($contract_data, true); // Success if (!is_wp_error($signed_contract)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Client event signed contract created (' . $signed_contract . ')', true); } add_post_meta($signed_contract, '_mdjm_contract_signed_name', ucfirst($_POST['sign_first_name']) . ' ' . ucfirst($_POST['sign_last_name']), true); /* -- Update the event -- */ $event_meta = array('_mdjm_event_signed_contract' => $signed_contract, '_mdjm_event_contract_approved' => date('Y-m-d H:i:s'), '_mdjm_event_contract_approver' => ucfirst($_POST['sign_first_name']) . ' ' . ucfirst($_POST['sign_last_name']), '_mdjm_event_contract_approver_ip' => $_SERVER['REMOTE_ADDR'], '_mdjm_event_last_updated_by' => $my_mdjm['me']->ID); /* -- Initiate actions for status change -- */ wp_transition_post_status('mdjm-approved', $this->event->post_status, $this->event); /* -- Update the post status -- */ wp_update_post(array('ID' => $this->event->ID, 'post_status' => 'mdjm-approved')); foreach ($event_meta as $event_meta_key => $event_meta_value) { update_post_meta($this->event->ID, $event_meta_key, $event_meta_value); } /* -- Update Journal with event updates -- */ if (MDJM_JOURNAL == true) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' -- Adding journal entry'); } mdjm_add_journal(array('user_id' => $my_mdjm['me']->ID, 'event_id' => $this->event->ID, 'comment_content' => 'Contract Approval completed by ' . ucfirst($_POST['sign_first_name']) . ' ' . ucfirst($_POST['sign_last_name'] . '<br>')), array('type' => 'update-event', 'visibility' => '2')); } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' -- Journalling is disabled'); } } /* -- Email booking confirmations -- */ $contact_client = isset($mdjm_settings['templates']['booking_conf_to_client']) ? true : false; $contact_dj = isset($mdjm_settings['templates']['booking_conf_to_dj']) ? true : false; $client_email = isset($mdjm_settings['templates']['booking_conf_client']) ? $mdjm_settings['templates']['booking_conf_client'] : false; $dj_email = isset($mdjm_settings['templates']['email_dj_confirm']) ? $mdjm_settings['templates']['email_dj_confirm'] : false; if (!is_string(get_post_status($client_email))) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('ERROR: No email template for the contract has been found ' . __FUNCTION__, $stampit = true); } wp_die('ERROR: Either no email template is defined or an error has occured. Check your Settings.'); } if ($contact_client == true) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Configured to email client with template ID ' . $client_email); } if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Generating email...'); } $email_args = array('content' => $client_email, 'to' => get_post_meta($this->event->ID, '_mdjm_event_client', true), 'from' => $mdjm_settings['templates']['booking_conf_from'] == 'dj' ? get_post_meta($this->event->ID, '_mdjm_event_dj', true) : 0, 'journal' => 'email-client', 'event_id' => $this->event->ID, 'html' => true, 'cc_dj' => isset($mdjm_settings['email']['bcc_dj_to_client']) ? true : false, 'cc_admin' => isset($mdjm_settings['email']['bcc_admin_to_client']) ? true : false, 'source' => 'Event Status to Approved'); // Filter the email args $email_args = apply_filters('mdjm_booking_conf_email_args', $email_args); // Send the email $approval_email = $mdjm->send_email($email_args); if ($approval_email) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' -- Confrmation email sent to client '); } } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' ERROR: Confrmation email was not sent'); } } } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Not configured to email client'); } } if ($contact_dj == true) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Configured to email DJ with template ID ' . $dj_email); } if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Generating email...'); } $approval_dj_email = $mdjm->send_email(array('content' => $dj_email, 'to' => get_post_meta($this->event->ID, '_mdjm_event_dj', true), 'from' => 0, 'journal' => 'email-dj', 'event_id' => $this->event->ID, 'html' => true, 'cc_dj' => false, 'cc_admin' => isset($mdjm_settings['email']['bcc_admin_to_dj']) ? true : false, 'source' => 'Event Status to Approved')); if ($approval_dj_email) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' -- Approval email sent to DJ '); } } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' ERROR: Approval email was not sent to DJ'); } } } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Not configured to email DJ'); } } } /* -- Re-add the save post hook -- */ add_action('save_post_mdjm-event', 'mdjm_save_event_post', 10, 3); if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Completed client signing of contract ' . __METHOD__, true); } /* -- Email admin to notify of changes -- */ if (MDJM_NOTIFY_ADMIN == true) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Sending event status change notification to admin (Contract Signed)'); } $content = '<html>' . "\n" . '<body>' . "\n"; $content .= '<p>' . sprintf(__('Good news... %s has just signed their event contract via %s', 'mobile-dj-manager'), '{CLIENT_FULLNAME}', MDJM_APP) . '</p>'; $content .= '<hr />' . "\n"; $content .= '<h4><a href="' . get_edit_post_link($this->event->ID) . '">' . __('Event ID', 'mobile-dj-manager') . ': ' . MDJM_EVENT_PREFIX . $this->event->ID . '</a></h4>' . "\n"; $content .= '<p>' . "\n"; $content .= __('Date', 'mobile-dj-manager') . ': {EVENT_DATE}<br />' . "\n"; $content .= __('Type', 'mobile-dj-manager') . ': ' . MDJM()->events->get_event_type($this->event->ID) . '<br />' . "\n"; $event_stati = mdjm_all_event_status(); $content .= __('Status', 'mobile-dj-manager') . ': ' . $event_stati[get_post_status($this->event->ID)] . '<br />' . "\n"; $content .= __('Client', 'mobile-dj-manager') . ': {CLIENT_FULLNAME}<br />' . "\n"; $content .= __('Value', 'mobile-dj-manager') . ': {TOTAL_COST}<br />' . "\n"; $deposit = get_post_meta($this->event->ID, '_mdjm_event_deposit'); $deposit_status = get_post_meta($this->event->ID, '_mdjm_event_deposit_status'); if (!empty($deposit) && $deposit != '0.00') { $content .= __('Deposit', 'mobile-dj-manager') . ': {DEPOSIT} ({DEPOSIT_STATUS})<br />' . "\n"; } $content .= __('Balance Due', 'mobile-dj-manager') . ': {BALANCE}</p>' . "\n"; $content .= '<p>' . sprintf(__('%sView Event%s', 'mobile-dj-manager'), '<a href="=' . get_edit_post_link($this->event->ID) . '">', '</a>') . '</p>' . "\n"; $content .= '</body>' . "\n" . '</html>' . "\n"; $mdjm->send_email(array('content' => $mdjm->filter_content(get_post_meta($this->event->ID, '_mdjm_event_client', true), $this->event->ID, $content), 'to' => $mdjm_settings['email']['system_email'], 'subject' => __('Event Contract Signed', 'mobile-dj-manager'), 'journal' => false, 'event_id' => $this->event->ID, 'cc_dj' => false, 'cc_admin' => false, 'filter' => false, 'log_comm' => false)); } else { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Skipping admin notification'); } } ?> <script type="text/javascript"> window.location.replace("<?php echo mdjm_get_formatted_url(MDJM_CONTRACT_PAGE) . 'event_id=' . $this->event->ID . '&message=3&class=2'; ?> "); </script> <?php exit; } }
/** * * * * */ public function no_permission() { global $mdjm, $mdjm_settings; echo '<p>' . __('ERROR: You do not have permission to view this page. ') . '</p>' . "\r\n" . '<p>' . __('Please contact the <a href="mailto:' . $mdjm_settings['email']['system_email'] . '">website administrator</a> or <a href="' . mdjm_get_formatted_url(MDJM_HOME) . '">' . 'Click here to return to the ' . MDJM_COMPANY . ' ' . MDJM_APP . ' home page.') . '</p>'; }
function profile_header() { global $mdjm; // Are we processing an update? if (isset($_POST['submit'])) { $this->update_profile(); } // Create validation code $this->validation_script(); $default_text = __('<p>Please keep your details up to date as incorrect information may cause problems with your event.</p>'); echo parent::__text('profile_intro', $default_text); echo '<form action="' . mdjm_get_formatted_url(MDJM_PROFILE_PAGE, false) . '" method="post" enctype="multipart/form-data" name="mdjm-user-profile" id="mdjm-user-profile">' . "\r\n"; // For security wp_nonce_field('manage_client_profile', '__mdjm_user') . "\r\n"; echo '<div id="mdjm-user-profile-container">' . "\r\n"; echo '<div id="mdjm-user-profile-table">' . "\r\n"; echo '<table class="mdjm-user-profile-display">' . "\r\n"; }
/** * Return all relevant action buttons for the event. * * Allow filtering of the buttons so they can be re-ordered, re-named etc. * * @since 1.3 * @param int $event_id The event ID. * @param bool $min True returns only minimal action buttons used within loop. * @return arr Array of event action buttons. */ function mdjm_get_event_action_buttons($event_id, $min = true) { $event_status = get_post_status($event_id); $buttons = array(); // Buttons for events in enquiry state if ($event_status == 'mdjm-enquiry') { if (mdjm_get_option('online_enquiry', '0')) { $buttons[5] = apply_filters('mdjm_quote_action_button', array('label' => __('View Quote', 'mobile-dj-manager'), 'id' => 'mdjm-quote-button', 'fa' => 'fa fa-file', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('quotes_page'), true)))); } $buttons[10] = apply_filters('mdjm_book_action_button', array('label' => sprintf(__('Book %s', 'mobile-dj-manager'), mdjm_get_label_singular()), 'id' => 'mdjm-book-button', 'fa' => 'fa fa-check', 'url' => add_query_arg(array('mdjm_action' => 'accept_enquiry', 'mdjm_nonce' => wp_create_nonce('accept_enquiry')), mdjm_get_event_uri($event_id)))); } // Buttons for events in awaiting contract state if ($event_status == 'mdjm-contract') { $buttons[15] = apply_filters('mdjm_sign_contract_action_button', array('label' => __('Sign Contract', 'mobile-dj-manager'), 'id' => 'mdjm-sign-contract-button', 'fa' => 'fa fa-pencil', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('contracts_page'), true)))); } // Buttons for events in approved state if ($event_status == 'mdjm-approved' && mdjm_contract_is_signed($event_id)) { $buttons[20] = apply_filters('mdjm_view_contract_action_button', array('label' => __('View Contract', 'mobile-dj-manager'), 'id' => 'mdjm-view-contract-button', 'fa' => 'fa fa-file-text', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('contracts_page'), true)))); } // Playlist action button if (mdjm_playlist_is_open($event_id)) { if ($event_status == 'mdjm-approved' || $event_status == 'mdjm-contract') { $buttons[25] = apply_filters('mdjm_manage_playlist_action_button', array('label' => __('Manage Playlist', 'mobile-dj-manager'), 'id' => 'mdjm-manage-playlist-button', 'fa' => 'fa fa-music', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('playlist_page'), true)))); } } // Payment button if (mdjm_has_gateway() && mdjm_get_event_balance($event_id) > 0) { $buttons[30] = apply_filters('mdjm_make_payment_button', array('label' => __('Make a Payment', 'mobile-dj-manager'), 'id' => 'mdjm-make-a-payment-button', 'fa' => 'fa fa-credit-card-alt', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('payments_page'), true)))); } if (empty($min)) { $buttons[50] = apply_filters('mdjm_update_profile_action_button', array('label' => __('Update Profile', 'mobile-dj-manager'), 'id' => 'mdjm-update-profile-button', 'fa' => 'fa fa-user', 'url' => mdjm_get_formatted_url(mdjm_get_option('profile_page'), false))); } $buttons = apply_filters('mdjm_event_action_buttons', $buttons, $event_id); ksort($buttons); return $buttons; }
/** * filter_content * Search and replace through the $content * * * * @param int $client Optional: the user ID of the client * int $event Optional: the post ID of the event * str $content Required: the content to be filtered * * @return str|bool New string on success | false on fail * @since 1.1.3 */ public function filter_content($client = '', $event = '', $content = '') { global $mdjm_settings; if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Starting ' . __FUNCTION__, true); } if (empty($content)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' ERROR: No content passed for filtering '); } return false; } /* -- Setup Client Data -- */ if (!empty($client)) { /* -- Retrieve the user info -- */ $c = !is_array($client) ? get_userdata($client) : $client; // Client password reset action $c_pw = sprintf(__('Please <a href="%s">click here</a> to reset your password', 'mobile-dj-manager'), home_url('/wp-login.php?action=lostpassword')); $reset = get_user_meta($c->ID, 'mdjm_pass_action', true); if (!empty($reset)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it(' -- Password reset for user ' . $c->ID); } $reset = wp_generate_password(mdjm_get_option('pass_length', 8), mdjm_get_option('complex_passwords', true)); wp_set_password($reset, $c->ID); $c_pw = $reset; } /* -- Client Address -- */ if (!empty($c->address1)) { $c_address[] = $c->address1; if (!empty($c->address2)) { $c_address[] = $c->address2; } if (!empty($c->town)) { $c_address[] = $c->town; } if (!empty($c->county)) { $c_address[] = $c->county; } if (!empty($c->county)) { $c_address[] = $c->postcode; } } } /* -- Setup Event, DJ & Venue Data -- */ if (!empty($event)) { /* -- Retrieve the event info -- */ $e = !is_array($event) ? get_post($event) : $event; $eventinfo = MDJM()->events->event_detail($e->ID); $venue_details = MDJM()->events->mdjm_get_venue_details(get_post_meta($e->ID, '_mdjm_event_venue_id', true), $e->ID); } /* -- Replacements -- */ $pairs = array('{ADMIN_URL}' => admin_url(), '{APPLICATION_HOME}' => mdjm_get_formatted_url(MDJM_HOME, false), '{APPLICATION_NAME}' => MDJM_APP, '{COMPANY_NAME}' => MDJM_COMPANY, '{CONTACT_PAGE}' => mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false), '{DDMMYYYY}' => date(MDJM_SHORTDATE_FORMAT), '{WEBSITE_URL}' => home_url(), '{CLIENT_FIRSTNAME}' => !empty($c->first_name) ? $c->first_name : '', '{CLIENT_LASTNAME}' => !empty($c->last_name) ? $c->last_name : '', '{CLIENT_FULLNAME}' => !empty($c->display_name) ? $c->display_name : '', '{CLIENT_FULL_ADDRESS}' => !empty($c_address) ? implode('<br />', $c_address) : '', '{CLIENT_EMAIL}' => !empty($c->user_email) ? $c->user_email : '', '{CLIENT_PRIMARY_PHONE}' => !empty($c->phone1) ? $c->phone1 : '', '{CLIENT_USERNAME}' => !empty($c->user_login) ? $c->user_login : '', '{CLIENT_PASSWORD}' => !empty($c_pw) ? $c_pw : '', '{ADMIN_NOTES}' => !empty($eventinfo['admin_notes']) ? $eventinfo['admin_notes'] : '', '{BALANCE}' => !empty($eventinfo['balance']) ? $eventinfo['balance'] : '', '{CONTRACT_DATE}' => !empty($eventinfo['contract_date']) ? $eventinfo['contract_date'] : date(MDJM_SHORTDATE_FORMAT), '{CONTRACT_ID}' => !empty($e) ? $e->post_title : '', '{CONTRACT_URL}' => !empty($e) ? mdjm_get_formatted_url(MDJM_CONTRACT_PAGE) . 'event_id=' . $e->ID : '', '{DEPOSIT}' => !empty($eventinfo['deposit']) ? $eventinfo['deposit'] : '', '{DEPOSIT_STATUS}' => !empty($eventinfo['deposit_status']) ? $eventinfo['deposit_status'] : __('Due'), '{DJ_EMAIL}' => !empty($eventinfo['dj']->user_email) ? $eventinfo['dj']->user_email : __('Not Assigned'), '{DJ_FIRSTNAME}' => !empty($eventinfo['dj']->user_firstname) ? $eventinfo['dj']->user_firstname : '', '{DJ_FULLNAME}' => !empty($eventinfo['dj']->display_name) ? $eventinfo['dj']->display_name : '', '{DJ_NOTES}' => !empty($eventinfo['dj_notes']) ? $eventinfo['dj_notes'] : '', '{DJ_PRIMARY_PHONE}' => !empty($eventinfo['dj']->phone1) ? $eventinfo['dj']->phone1 : '', '{DJ_SETUP_DATE}' => !empty($eventinfo['setup_date']) && $eventinfo['setup_date'] != 'Not Specified' ? date(MDJM_SHORTDATE_FORMAT, $eventinfo['setup_date']) : __('Not Specified'), '{DJ_SETUP_TIME}' => !empty($eventinfo['setup_time']) ? $eventinfo['setup_time'] : '', '{END_TIME}' => !empty($eventinfo['finish']) ? $eventinfo['finish'] : '', '{END_DATE}' => !empty($eventinfo['end_date']) && is_numeric($eventinfo['end_date']) ? date(MDJM_SHORTDATE_FORMAT, $eventinfo['end_date']) : __('Not Specified'), '{EVENT_DATE}' => !empty($eventinfo['date']) && is_numeric($eventinfo['date']) ? date('l, jS F Y', $eventinfo['date']) : __('Not Specified'), '{EVENT_DATE_SHORT}' => !empty($eventinfo['date']) && is_numeric($eventinfo['date']) ? date(MDJM_SHORTDATE_FORMAT, $eventinfo['date']) : __('Not Specified'), '{EVENT_DESCRIPTION}' => !empty($eventinfo['notes']) ? $eventinfo['notes'] : '', '{EVENT_NAME}' => !empty($eventinfo['name']) ? $eventinfo['name'] : '', '{EVENT_STATUS}' => !empty($eventinfo['status']) ? $eventinfo['status'] : '', '{EVENT_TYPE}' => !empty($eventinfo['type']) ? $eventinfo['type'] : '', '{PAYMENT_URL}' => !empty($e) ? mdjm_get_formatted_url(MDJM_PAYMENT_PAGE) . 'event_id=' . $e->ID : '', '{PAYMENT_HISTORY}' => !empty($eventinfo['payment_history']) ? $eventinfo['payment_history'] : __('No payments', 'mobile-dj-manager'), '{PLAYLIST_CLOSE}' => $mdjm_settings['playlist']['close'] != 0 ? $mdjm_settings['playlist']['close'] : 'never', '{PLAYLIST_URL}' => mdjm_get_formatted_url(MDJM_PLAYLIST_PAGE, false), '{QUOTES_URL}' => !empty($e->ID) ? mdjm_get_formatted_url(MDJM_QUOTES_PAGE, true) . 'event_id=' . $e->ID : '', '{GUEST_PLAYLIST_URL}' => !empty($eventinfo['guest_playlist']) ? $eventinfo['guest_playlist'] : '', '{START_TIME}' => !empty($eventinfo['start']) ? $eventinfo['start'] : '', '{TOTAL_COST}' => !empty($eventinfo['cost']) ? $eventinfo['cost'] : '', '{VENUE}' => !empty($venue_details['name']) ? stripslashes($venue_details['name']) : '', '{VENUE_CONTACT}' => !empty($venue_details['venue_contact']) ? stripslashes($venue_details['venue_contact']) : '', '{VENUE_DETAILS}' => !empty($venue_details['details']) ? implode('<br />', $venue_details['details']) : '', '{VENUE_EMAIL}' => !empty($venue_details['venue_email']) ? stripslashes($venue_details['venue_email']) : '', '{VENUE_FULL_ADDRESS}' => !empty($venue_details['full_address']) ? implode('<br />', $venue_details['full_address']) : '', '{VENUE_NOTES}' => !empty($venue_details['venue_information']) ? stripslashes($venue_details['venue_information']) : '', '{VENUE_TELEPHONE}' => !empty($venue_details['venue_phone']) ? stripslashes($venue_details['venue_phone']) : '', '{AVAILABLE_PACKAGES}' => !empty($eventinfo['dj']->ID) ? get_available_packages($eventinfo['dj']->ID, false) : get_available_packages('', false), '{AVAILABLE_PACKAGES_COST}' => !empty($eventinfo['dj']->ID) ? get_available_packages($eventinfo['dj']->ID, true) : get_available_packages('', true), '{EVENT_PACKAGE}' => !empty($eventinfo['package']) && !empty($e->ID) ? get_event_package($e->ID, false) : 'N/A', '{EVENT_PACKAGE_COST}' => !empty($e) ? get_event_package($e->ID, true) : 'N/A', '{EVENT_ADDONS}' => !empty($eventinfo['addons']) ? $eventinfo['addons'] : 'N/A', '{EVENT_ADDONS_COST}' => !empty($e) ? get_event_addons($e->ID, true) : 'N/A'); // Allow the $pairs array to be filtered $pairs = apply_filters('mdjm_shortcode_filter_pairs', $pairs, !empty($e->ID) ? $e->ID : '', !empty($eventinfo) ? $eventinfo : ''); /* -- Create the Search/Replace Array's -- */ foreach ($pairs as $key => $value) { $search[] = $key; $replace[] = $value; } /* -- Return the filtered data -- */ if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Completed ' . __FUNCTION__, true); } return str_replace($search, $replace, $content); }
/** * Returns the URL for the events guest playlist. * * @since 1.3 * @param int $event_id The event ID. * @return str URL to access the guest playlist. */ function mdjm_guest_playlist_url($event_id) { $access_code = get_post_meta($event_id, '_mdjm_event_playlist_access', true); if (empty($access_code)) { $url = ''; } else { $url = mdjm_get_formatted_url(mdjm_get_option('playlist_page'), true) . 'guest_playlist=' . $access_code; } return $url; }
function display_quote($event_id) { global $mdjm, $my_mdjm, $post; $online_template = MDJM()->events->retrieve_quote($event_id); if (empty($online_template) || !is_string(get_post_status($online_template))) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('The online template associated with event with ID ' . $event_id . ' could not be found in ' . __METHOD__, true); } parent::display_notice(4, sprintf(__('Unable to process request. Please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>')); return; } if (!$this->update_event_quote($event_id, $online_template)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Unable to update quote post for event with ID ' . $event_id . ' in ' . __METHOD__, true); } } $post = get_post($online_template); // Make sure we have the template if (!is_object($post)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('The online template with ID ' . $online_template . ' could not be retrieved in ' . __METHOD__, true); } parent::display_notice(4, sprintf(__('Unable to process request. Please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>')); return; } $eventinfo = MDJM()->events->event_detail($event_id); // Make sure we have the event info if (empty($eventinfo)) { if (MDJM_DEBUG == true) { MDJM()->debug->log_it('Could not retrieve event information for event ' . $event_id . ' in ' . __METHOD__, true); } parent::display_notice(4, sprintf(__('Unable to process request. Please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>')); return; } // Display the online quotation /* -- Retrieve the quote content -- */ $content = $post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); /* -- Shortcode replacements -- */ $content = $mdjm->filter_content($my_mdjm['me']->ID, $event_id, $content); if (!empty($content)) { if ($this->button_loc == 'before' || $this->button_loc == 'both') { $this->display_book_button($event_id); } print $content; if ($this->button_loc == 'after' || $this->button_loc == 'both') { $this->display_book_button($event_id); } } else { parent::display_notice(4, sprintf(__('An error has occured, please %scontact us%s for assistance', 'mobile-dj-manager'), '<a href="' . mdjm_get_formatted_url(MDJM_CONTACT_PAGE, false) . '">', '</a>')); } }
/** * Returns the URL for an event. * * @since 1.3 * @param int $event_id The event ID. * @return str URL to Client Zone page for the event. */ function mdjm_get_event_uri($event_id) { return add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('app_home_page'))); }