From 8c859ee7534c3000fb96a02b520479b860702573 Mon Sep 17 00:00:00 2001 From: Harald Ponce de Leon Date: Thu, 27 Oct 2016 11:16:16 +0200 Subject: [PATCH] use {{keyword}} instead of :keyword for language definitions --- catalog/admin/includes/languages/english/server_info.txt | 2 +- catalog/admin/server_info.php | 4 ++-- catalog/includes/OSC/OM/Language.php | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/catalog/admin/includes/languages/english/server_info.txt b/catalog/admin/includes/languages/english/server_info.txt index fa8ee30f9..6b524d8d7 100644 --- a/catalog/admin/includes/languages/english/server_info.txt +++ b/catalog/admin/includes/languages/english/server_info.txt @@ -16,7 +16,7 @@ title_database = Database: title_database_date = Database Date: title_database_name = Database Name: -text_export_intro = The following information can be submitted to osCommerce by clicking on the :button_submit_to_oscommerce button. You can also save the information to a file by clicking :button_save. This information is completely anonymous, cannot be used to identify an individual system, and is used for support and development purposes only. +text_export_intro = The following information can be submitted to osCommerce by clicking on the {{button_submit_to_oscommerce}} button. You can also save the information to a file by clicking {{button_save}}. This information is completely anonymous, cannot be used to identify an individual system, and is used for support and development purposes only. success_info_submit = Your server information has been submitted sucessfully to the osCommerce website. Thanks! error_info_submit = Could not connect to the osCommerce website to submit your server information. Please try again later. diff --git a/catalog/admin/server_info.php b/catalog/admin/server_info.php index f8993606e..02ac157c8 100644 --- a/catalog/admin/server_info.php +++ b/catalog/admin/server_info.php @@ -81,8 +81,8 @@

OSCOM::getDef('button_submit_to_oscommerce'), - ':button_save' => IMAGE_SAVE + 'button_submit_to_oscommerce' => OSCOM::getDef('button_submit_to_oscommerce'), + 'button_save' => IMAGE_SAVE ]); ?>

diff --git a/catalog/includes/OSC/OM/Language.php b/catalog/includes/OSC/OM/Language.php index 93021b39b..07444b873 100644 --- a/catalog/includes/OSC/OM/Language.php +++ b/catalog/includes/OSC/OM/Language.php @@ -172,7 +172,9 @@ public function getDef($key, $values = null, $scope = 'global') $def = $this->definitions[$scope][$key]; if (is_array($values) && !empty($values)) { - $def = str_replace(array_keys($values), array_values($values), $def); + $def = preg_replace_callback('/\{\{([A-Za-z0-9-_]+)\}\}/', function($matches) use ($values) { + return isset($values[$matches[1]]) ? $values[$matches[1]] : $matches[1]; + }, $def); } return $def;