/** * Registration Form * * @since 1.0 * @global $post * @param str $redirect Redirect page URL * @return str Login form */ function kbs_register_form($redirect = '') { global $kbs_register_redirect; if (empty($redirect)) { $redirect = kbs_get_current_page_url(); } $kbs_register_redirect = $redirect; ob_start(); if (!is_user_logged_in()) { kbs_get_template_part('shortcode', 'register'); } return apply_filters('kbs_register_form', ob_get_clean()); }
/** * Build the final email * * @since 0.1 * @param string $message * * @return string */ public function build_email($message) { if (false === $this->html) { return apply_filters('kbs_email_message', wp_strip_all_tags($message), $this); } $message = $this->text_to_html($message); ob_start(); kbs_get_template_part('emails/header', $this->get_template(), true); /** * Hooks into the email header * * @since 0.1 */ do_action('kbs_email_header', $this); if (has_action('kbs_email_template_' . $this->get_template())) { /** * Hooks into the template of the email * * @param string $this->template Gets the enabled email template * @since 0.1 */ do_action('kbs_email_template_' . $this->get_template()); } else { kbs_get_template_part('emails/body', $this->get_template(), true); } /** * Hooks into the body of the email * * @since 0.1 */ do_action('kbs_email_body', $this); kbs_get_template_part('emails/footer', $this->get_template(), true); /** * Hooks into the footer of the email * * @since 0.1 */ do_action('kbs_email_footer', $this); $body = ob_get_clean(); $message = str_replace('{email}', $message, $body); return apply_filters('kbs_email_message', $message, $this); }
/** * Display Form * * @since 1.0 * @global $kbs_form * @param str $form_id Form post ID * @return str Form */ function kbs_display_form($form_id = 0) { global $kbs_form; if (empty($form_id)) { return __('Submission form not found', 'kb-support'); } $kbs_form = new KBS_Form($form_id); if (!$kbs_form) { return __('Submission form not found', 'kb-support'); } ob_start(); kbs_get_template_part('shortcode', apply_filters('kbs_form_template', 'form')); return apply_filters('kbs_submit_form', ob_get_clean()); }