.
*/
/*
Historique
1.0.0 10/02/2011
Version initiale
1.0.1 10/02/2011
Ajout du Plugin URI pour permettre les mises à jours
Traduction en Anglais du Plugin Name et du nom du répertoire
1.0.2 10/02/2011
Correction du problème de compatibilité avec exif view (double affichage des boutons)
1.0.3 15/02/2011
Add lv_LV (Latvian) thanks to Aivars Baldone
1.0.4 17/02/2011
Add de_DE and it_IT (par Sugar888)
1.0.5 27/02/2011
Correction pb compatibilité avec certains thèmes
Déplacement des boutons PayPal en début de table info
1.0.6 05/03/2011
Add sk_SK (by dodo)
1.0.7 26/03/2011
Add hu_HU language (Hungarian) thanks to samli
*/
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
define('PPPPP_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
include_once (PPPPP_PATH.'/constants.php');
function ppppp_append_form($tpl_source, &$smarty){
$pattern = '#<.*\"infoTable\".*>#';
$replacement = '
{\'Buy this picture\'|@translate} |
|
|
{literal}
{/literal}
';
if(!preg_match($pattern,$tpl_source)) {
$pattern='#{if isset\(\$COMMENT_IMG\)}#';
$replacement='';
$replacement=$replacement.'$0';
}
else
$replacement='$0'.$replacement;
return preg_replace($pattern, $replacement, $tpl_source,1);
}
function ppppp_picture_handler(){
global $template;
$template->set_prefilter('picture', 'ppppp_append_form');
load_language('plugin.lang', PPPPP_PATH);
$query='SELECT * FROM '.PPPPP_SIZE_TABLE.';';
$result = pwg_query($query);
while($row = mysql_fetch_array($result)){
$template->append('ppppp_array_size',$row);
}
$query='SELECT value FROM '.PPPPP_CONFIG_TABLE.' WHERE param = \'fixed_shipping\';';
$result = pwg_query($query);
$row = mysql_fetch_array($result);
$template->assign('ppppp_fixed_shipping',$row[0]);
$query='SELECT value FROM '.PPPPP_CONFIG_TABLE.' WHERE param = \'currency\';';
$result = pwg_query($query);
$row = mysql_fetch_array($result);
$template->assign('ppppp_currency',$row[0]);
$template->assign('ppppp_e_mail',get_webmaster_mail_address());
$template->append('footer_elements',' - PayPal plugin by queguineur.fr');
}
add_event_handler('loc_begin_picture', 'ppppp_picture_handler');
function ppppp_append_js($tpl_source, &$smarty){
load_language('plugin.lang', PPPPP_PATH);
if(strstr($tpl_source,"{'Menu'|@translate}")==false)
return $tpl_source;
$pattern = '#{/foreach}#';
$replacement = '{/foreach}
'.l10n('View Shopping Cart').'
';
return preg_replace($pattern, $replacement, $tpl_source);
}
function ppppp_index_handler(){
global $template;
$template->set_prefilter('menubar', 'ppppp_append_js');
$template->assign('ppppp_e_mail',get_webmaster_mail_address());
}
add_event_handler('loc_begin_index', 'ppppp_index_handler');
function ppppp_admin_menu($menu){
load_language('plugin.lang', PPPPP_PATH);
array_push($menu, array(
'NAME' => l10n('PayPal Shopping Cart'),
'URL' => get_admin_plugin_menu_link(PPPPP_PATH . 'admin.php')));
return $menu;
}
add_event_handler('get_admin_plugin_menu_links', 'ppppp_admin_menu');
?>