[*] PDF : PDF is now rendered by TCPDF throught HTML template
This commit is contained in:
@@ -65,7 +65,8 @@ define('_PS_TOOL_DIR_', _PS_ROOT_DIR_.'/tools/');
|
||||
define('_PS_GEOIP_DIR_', _PS_TOOL_DIR_.'geoip/');
|
||||
define('_PS_SWIFT_DIR_', _PS_TOOL_DIR_.'swift/');
|
||||
define('_PS_GENDERS_DIR_', _PS_IMG_DIR_.'genders/');
|
||||
define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/');
|
||||
define('_PS_FPDF_PATH_', _PS_TOOL_DIR_.'fpdf/'); // @deprecated will be removed in 1.6
|
||||
define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/');
|
||||
define('_PS_TAASC_PATH_', _PS_TOOL_DIR_.'taasc/');
|
||||
define('_PS_PEAR_XML_PARSER_PATH_', _PS_TOOL_DIR_.'pear_xml_parser/');
|
||||
define('_PS_CACHE_DIR_', _PS_ROOT_DIR_.'/cache/');
|
||||
|
||||
@@ -31,8 +31,34 @@ function smartyTranslate($params, &$smarty)
|
||||
{
|
||||
global $_LANGADM;
|
||||
$htmlentities = !isset($params['js']);
|
||||
$pdf = isset($params['pdf']);
|
||||
$addslashes = !isset($params['slashes']);
|
||||
|
||||
if ($pdf)
|
||||
{
|
||||
global $_LANGPDF;
|
||||
$iso = Context::getContext()->language->iso_code;
|
||||
if (!Validate::isLanguageIsoCode($iso))
|
||||
throw PrestashopException('Invalid iso lang!');
|
||||
|
||||
$translationsFile = _PS_THEME_DIR_.'pdf/lang/'.$iso.'.php';
|
||||
|
||||
if (Tools::file_exists_cache($translationsFile))
|
||||
@include_once($translationsFile);
|
||||
|
||||
$key = 'PDF'.md5($params['s']);
|
||||
$lang_array = $_LANGPDF;
|
||||
|
||||
$msg = $params['s'];
|
||||
if (is_array($lang_array) AND key_exists($key, $lang_array))
|
||||
$msg = $lang_array[$key];
|
||||
elseif (is_array($lang_array) AND key_exists(Tools::strtolower($key), $lang_array))
|
||||
$msg = $lang_array[Tools::strtolower($key)];
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
|
||||
$filename = ((!isset($smarty->compiler_object) OR !is_object($smarty->compiler_object->template)) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath());
|
||||
$class = Tools::substr(basename($filename), 0, -4);
|
||||
|
||||
|
||||
@@ -29,8 +29,9 @@ $smarty->template_dir = _PS_THEME_DIR_.'tpl';
|
||||
|
||||
function smartyTranslate($params, &$smarty)
|
||||
{
|
||||
global $_LANG, $_MODULES, $cookie, $_MODULE;
|
||||
global $_LANG, $_MODULES, $cookie, $_MODULE, $_LANGPDF;
|
||||
if (!isset($params['js'])) $params['js'] = 0;
|
||||
if (!isset($params['pdf'])) $params['pdf'] = false;
|
||||
if (!isset($params['mod'])) $params['mod'] = false;
|
||||
|
||||
$string = str_replace('\'', '\\\'', $params['s']);
|
||||
@@ -58,7 +59,18 @@ function smartyTranslate($params, &$smarty)
|
||||
if(is_array($_MODULE))
|
||||
$_MODULES = array_merge($_MODULES, $_MODULE);
|
||||
$lang_array = $_MODULES;
|
||||
}
|
||||
}
|
||||
else if ($params['pdf'])
|
||||
{
|
||||
$iso = Language::getIsoById($cookie->id_lang);
|
||||
$translationsFile = _PS_THEME_DIR_.'pdf/lang/'.$iso.'.php';
|
||||
|
||||
if (Tools::file_exists_cache($translationsFile))
|
||||
@include_once($translationsFile);
|
||||
|
||||
$key = 'PDF'.md5($string);
|
||||
$lang_array = $_LANGPDF;
|
||||
}
|
||||
|
||||
if (is_array($lang_array) AND key_exists($key, $lang_array))
|
||||
$msg = $lang_array[$key];
|
||||
@@ -69,5 +81,6 @@ function smartyTranslate($params, &$smarty)
|
||||
|
||||
if ($msg != $params['s'])
|
||||
$msg = $params['js'] ? addslashes($msg) : stripslashes($msg);
|
||||
|
||||
return $params['js'] ? $msg : Tools::htmlentitiesUTF8($msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user