/** * This works just like get_template_part(), except that it uses wpsc_locate_template_path() * to search for the template part in 2 extra WP eCommerce specific paths. * * @since 4.0 * @see get_template() * @see wpsc_locate_theme_file() * @uses apply_filters() Applies 'wpsc_get_template_part_paths_for_{$slug}' filter. * @uses do_action() Calls 'wpsc_get_template_part_{$slug}' action. * @uses do_action() Calls 'wpsc_template_before_{$slug}-{$name}' action. * @uses do_action() Calls 'wpsc_template_after_{$slug}-{$name}' action. * @uses wpsc_locate_template_path() * * @param string $slug The slug name for the generic template. * @param string $name The name of the specialised template. Optional. Default null. */ function wpsc_get_template_part($slug = false, $name = null) { if (!$slug) { $controller = _wpsc_get_current_controller(); $slug = $controller->view; } do_action("wpsc_get_template_part_{$slug}", $slug, $name); $templates = array(); if (isset($name)) { $templates[] = "{$slug}-{$name}.php"; } $templates[] = "{$slug}.php"; $templates = apply_filters("wpsc_get_template_part_paths_for_{$slug}", $templates, $slug, $name); do_action(trim("wpsc_template_before_{$slug}-{$name}", '-')); wpsc_locate_template_part($templates, true, false); do_action(trim("wpsc_template_after_{$slug}-{$name}", '-')); }
/** * Retrieves the email template path (and subject) for declined email notifications. * * @since 4.0 * @param boolean $hard Whether or not decline is "hard". Hard declined methods may not be retried. * * @return array<string> Array of template part path and subject line. */ protected function get_declined_email_template($hard = false) { $language = substr(get_locale(), 0, 2); $decline = $hard ? 'hard' : 'soft'; $whitelist = apply_filters('wpsc_amazon_decline_email_locales', array('en' => array('hard' => __('Please contact us about your order', 'wpsc'), 'soft' => __('Please update your payment information', 'wpsc')), 'de' => array('hard' => __('Bitte kontaktieren Sie uns wegen Ihrer Bestellung', 'wpsc'), 'soft' => __('Bitte aktualisieren Sie Ihre Zahlungsinformationen', 'wpsc')), 'it' => array('hard' => __('La preghiamo di contattarci per informazioni riguardo al suo ordine', 'wpsc'), 'soft' => __('Aggiorna i tuoi dati di pagamento', 'wpsc')), 'fr' => array('hard' => __('Veuillez nous contacter pour votre commande', 'wpsc'), 'soft' => __('Veuillez mettre à jour vos informations de paiement', 'wpsc')), 'es' => array('hard' => __('Por favor, contáctanos en referencia a tu pedido', 'wpsc'), 'soft' => __('Por favor, actualiza tu información de pago.', 'wpsc')))); if (!in_array($language, array_keys($whitelist))) { $language = 'en'; } $template_part = apply_filters('wpsc_amazon_declined_email_template_part', "emails/{$decline}-decline-email-{$language}.php", $decline, $language); if (file_exists(WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/' . $template_part)) { $template = WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/' . $template_part; } else { $template = wpsc_locate_template_part($template_part); } if (!empty($template)) { return array(); } $template = apply_filters('wpsc_amazon_declined_email_template_path', $template, $decline, $language); $subject = apply_filters('wpsc_amazon_declined_email_subject', $whitelist[$language][$decline], $decline, $language); return array('template_part' => $template, 'subject' => $subject); }