Example #1
0
/**
 * Login Form
 *
 * @since	1.3
 * @global	$post
 * @param	str		$redirect	Redirect page URL
 * @return	str		Login form
 */
function mdjm_login_form($redirect = '')
{
    global $mdjm_login_redirect;
    if (empty($redirect)) {
        $redirect = mdjm_do_content_tags('{application_home}');
    }
    $mdjm_login_redirect = remove_query_arg('mdjm_message', $redirect);
    ob_start();
    mdjm_get_template_part('login', 'form');
    $output = ob_get_clean();
    $output = mdjm_do_content_tags($output);
    return apply_filters('mdjm_login_form', $output);
}
    /**
     * 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'];
    }
 /**
  * Build the final email
  *
  * @since	1.3
  * @param	str	$to
  * @param	str	$subject
  * @param	str	$message
  * @param	str	$attachments
  * @param	str	$source
  *
  * @return	str
  */
 public function build_email($to, $subject, $message, $attachments, $source)
 {
     if (false === $this->html) {
         return apply_filters('mdjm_email_message', wp_strip_all_tags($message), $this);
     }
     $message = $this->text_to_html($message);
     $message = $this->log_email($to, $subject, $message, $attachments, $source);
     ob_start();
     mdjm_get_template_part('email', 'header', true);
     /**
      * Hooks into the email header
      *
      * @since	1.3
      */
     do_action('mdjm_email_header', $this);
     if (has_action('mdjm_email_template_' . $this->get_template())) {
         /**
          * Hooks into the template of the email
          *
          * @param string $this->template Gets the enabled email template
          * @since	1.3
          */
         do_action('mdjm_email_template_' . $this->get_template());
     } else {
         mdjm_get_template_part('email', 'body', true);
     }
     /**
      * Hooks into the body of the email
      *
      * @since	1.3
      */
     do_action('mdjm_email_body', $this);
     mdjm_get_template_part('email', 'footer', true);
     /**
      * Hooks into the footer of the email
      *
      * @since 2.1
      */
     do_action('mdjm_email_footer', $this);
     $body = ob_get_clean();
     $message = str_replace('{email}', $message, $body);
     return apply_filters('mdjm_email_message', $message, $this);
 }
Example #4
0
/**
 * Renders the credit card info form.
 *
 * @since	1.3.8
 * @return	void
 */
function mdjm_get_cc_form()
{
    ob_start();
    ?>

	<?php 
    do_action('mdjm_before_cc_fields');
    ?>

		<?php 
    mdjm_get_template_part('payments', 'cc');
    ?>

	<?php 
    do_action('mdjm_after_cc_fields');
    echo ob_get_clean();
}
Example #5
0
/**
 * MDJM Availability Checker Shortcode.
 *
 * Displays the MDJM Availability Checker form which allows clients to determine if you are
 * available on their chosen event date.
 * 
 * @since	1.3
 *
 * @return	string
 */
function mdjm_shortcode_availability($atts)
{
    $atts = shortcode_atts(array('label' => __('Select Date', 'mobile-dj-manager') . ':', 'label_class' => 'mdjm-label', 'field_class' => '', 'submit_text' => __('Check Availability', 'mobile-dj-manager'), 'submit_class' => '', 'please_wait_text' => __('Please wait...', 'mobile-dj-manager'), 'please_wait_class' => '', 'display' => 'horizontal'), $atts, 'mdjm-availability');
    $field_id = 'mdjm-availability-datepicker';
    $search = array('{label}', '{label_class}', '{field}', '{field_class}', '{submit_text}', '{submit_class}', '{please_wait_text}', '{please_wait_class}');
    $replace = array($atts['label'], $atts['label_class'], $field_id, $atts['field_class'], $atts['submit_text'], $atts['submit_class'], $atts['please_wait_text'], $atts['please_wait_class']);
    ob_start();
    mdjm_insert_datepicker(array('class' => '', 'id' => $field_id, 'altfield' => 'availability_check_date', 'mindate' => '1'));
    echo '<!-- ' . __('MDJM Availability Checker', 'mobile-dj-manager') . ' (' . MDJM_VERSION_NUM . ') -->';
    echo '<form name="mdjm-availability-check" id="mdjm-availability-check" method="post">';
    wp_nonce_field('do_availability_check', 'mdjm_nonce', true, true);
    mdjm_action_field('do_availability_check');
    echo '<input type="hidden" name="availability_check_date" id="availability_check_date" />';
    mdjm_get_template_part('availability', $atts['display'], true);
    echo '</form>';
    $output = ob_get_clean();
    $output = str_replace($search, $replace, $output);
    $output = mdjm_do_content_tags($output);
    $output .= '<!-- ' . __('MDJM Availability Checker', 'mobile-dj-manager') . ' (' . MDJM_VERSION_NUM . ') -->';
    return apply_filters('mdjm_availability_form', $output);
}