/** * Processes a Bank Transfer Order to display * instructions to the user * @param APP_Order $order Order to display information for * @param array $options User entered options * @return void */ public function process($order, $options) { $sent = get_post_meta($order->get_ID(), 'bt-sentemail', true); if (empty($sent)) { appthemes_bank_transfer_pending_email(get_post($order->get_ID())); update_post_meta($order->get_ID(), 'bt-sentemail', true); } $templates = appthemes_payments_get_args('templates'); $template_name = $templates['bank-transfer']; $located = appthemes_locate_template($template_name); if ($located) { // load theme template $order = appthemes_get_order($order->get_ID()); appthemes_load_template($template_name, array('order' => $order)); } else { // load bundled template require_once dirname(__FILE__) . '/template/' . $template_name; } }
function display() { $template_path = appthemes_locate_template(basename($this->template)); // retrieve the user meta for each gateway field foreach (self::get_fields_names() as $field) { $user_meta[$field] = get_user_option($field); } // prepare the vars to pass to the escrow settings template $vars = array('fields' => $this->fields, 'formdata' => $user_meta, 'user' => wp_get_current_user()); ob_start(); if (!$template_path) { extract($vars); require $this->template; } else { appthemes_load_template($template_path, $vars); } $output = ob_get_clean(); $output .= html('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'manage-escrow')); $output .= html('input', array('type' => 'submit', 'value' => esc_attr__('Save Changes', APP_TD), 'class' => 'button')); $output = scbForms::form_wrap($output, 'app-manage-escrow'); echo apply_filters('appthemes_escrow_settings_form', $output, $vars); do_action('appthemes_escrow_after_settings_form', $vars); }
/** * Retrieves the Order template path and adds specific content variable * * @param string $content * * @return string located template path */ function get_template($content = 'summary') { appthemes_add_template_var('app_order_content', $content); return appthemes_locate_template(array('single-' . APPTHEMES_ORDER_PTYPE . '.php', "order-{$content}.php")); }
/** * Load a template part into a template * * Modified version of WP `get_template_part()` function * with the only difference, that function uses `appthemes_locate_template()` * instead of `locate_template()`. What allows to locate templates in the * custom folder or framework folder * * @uses appthemes_locate_template() * @uses do_action() * * @todo deprecate it in future, {@link https://core.trac.wordpress.org/attachment/ticket/22355/22355.4.patch} * * @param string $slug The slug name for the generic template. * @param string $name The name of the specialised template. */ function appthemes_get_template_part($slug, $name = null) { /** * Fires before the specified template part file is loaded. * * The dynamic portion of the hook name, $slug, refers to the slug name * for the generic template part. * * @param string $slug The slug name for the generic template. * @param string $name The name of the specialized template. */ do_action("get_template_part_{$slug}", $slug, $name); $templates = array(); $name = (string) $name; if ('' !== $name) { $templates[] = "{$slug}-{$name}.php"; } $templates[] = "{$slug}.php"; appthemes_locate_template($templates, true, false); }