| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/system/classes/external/shipcloud/ |
Upload File : |
<?php
/* --------------------------------------------------------------
ShipcloudText.inc.php 2016-02-08
Gambio GmbH
http://www.gambio.de
Copyright (c) 2015 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* Utility class providing text replacements using the 'shipcloud' section.
*/
class ShipcloudText {
/**
* @var LanguageTextManager used to retrieve phrases
*/
protected $languageTextManager;
/**
* initializes for the given languages_id or session language.
* Uses session language as a default if no languages_id is given.
* @param int|null $languages_id a Gambio languages_id
*/
public function __construct($languages_id = null)
{
$languages_id = is_null($languages_id) ? $_SESSION['languages_id'] : (int)$languages_id;
$this->languageTextManager = MainFactory::create_object('LanguageTextManager', array('shipcloud', $languages_id));
}
/**
* returns a single phrase
* @param string $placeholder phrase name
* @return string phrase value
*/
public function get_text($placeholder)
{
return $this->languageTextManager->get_text($placeholder);
}
/**
* replaces phrases denoted by phrase tags ('##phrase_name') in the content.
* @param string $content text containing phrase tags
* @return string the content with tags replaced by phrases
*/
public function replaceLanguagePlaceholders($content)
{
while(preg_match('/##(\w+)\b/', $content, $matches) == 1)
{
$replacement = $this->get_text($matches[1]);
if(empty($replacement))
{
$replacement = $matches[1];
}
$replacement = str_replace('ยป', '­', $replacement);
$content = preg_replace('/##'.$matches[1].'/', $replacement.'$1', $content, 1);
}
return $content;
}
}