/** * Fill a template with given element. Replace some code by content before output the html * * @param string $template_to_fill The complete html code we want to display with element to change * @param array $feed The different element to put in place of the code into the tempalte part * * @return string The html code to display */ public static function feed_template($template_to_fill, $feed) { /* Add general element */ $feed['CURRENCY'] = wpshop_tools::wpshop_get_currency(); $feed['CURRENCY_CHOOSEN'] = wpshop_tools::wpshop_get_currency(); $feed['CURRENCY_SELECTOR'] = wpshop_attributes_unit::wpshop_shop_currency_list_field(); $feed['CART_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_cart_page_id'))); $available_key = array(); foreach ($feed as $element => $value) { $available_key[] = '{WPSHOP_' . $element . '}'; if (!is_array($value)) { $template_to_fill = str_replace('{WPSHOP_' . $element . '}', $value, $template_to_fill); } } if (WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE) { $template_to_fill = '<!-- Available keys : ' . implode(' / ', $available_key) . ' -->' . $template_to_fill; } return $template_to_fill; }
/** * Display the current configuration for a given product * @param array $shortcode_attribute Some parameters given by the shortcode for display */ function wpshop_product_variations_summary($shortcode_attribute) { global $wp_query; $output = ''; if ($wp_query->query_vars['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) { $output .= wpshop_display::display_template_element('wpshop_product_configuration_summary', array('CURRENCY_SELECTOR' => wpshop_attributes_unit::wpshop_shop_currency_list_field())); } echo $output; }
public static function wpshop_shop_default_currency_field() { echo wpshop_attributes_unit::wpshop_shop_currency_list_field() . '<a href="#" title="' . __('This is the currency the shop will use', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; }