From c5d19cdea5a35c9e89c711728f963c8114a936b5 Mon Sep 17 00:00:00 2001 From: rica-carv Date: Wed, 15 Jan 2025 12:49:18 +0000 Subject: [PATCH 1/3] Add files via upload --- e107_core/templates/emailprint_template.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 e107_core/templates/emailprint_template.php diff --git a/e107_core/templates/emailprint_template.php b/e107_core/templates/emailprint_template.php new file mode 100644 index 0000000000..6bcb0ca2fb --- /dev/null +++ b/e107_core/templates/emailprint_template.php @@ -0,0 +1,17 @@ +"; //$tp->toGlyph('fa-envelope',false); + $EMAILPRINT_TEMPLATE['ICON_PRINT'] = ""; //$tp->toGlyph('fa-print',false); +} +else // BC +{ + $EMAILPRINT_TEMPLATE['ICON_EMAIL'] = "".LAN_EMAIL_7.""; + $EMAILPRINT_TEMPLATE['ICON_PRINT'] = "".LAN_PRINT_1.""; +} + +$EMAILPRINT_TEMPLATE['email'] = "452553523".$EMAILPRINT_TEMPLATE['ICON_EMAIL'].""; +$EMAILPRINT_TEMPLATE['print'] = "".$EMAILPRINT_TEMPLATE['ICON_PRINT'].""; \ No newline at end of file From ce99d9e0ebe94d6d287e41a2fa025136a0029184 Mon Sep 17 00:00:00 2001 From: rica-carv Date: Wed, 15 Jan 2025 12:50:25 +0000 Subject: [PATCH 2/3] Add files via upload --- e107_handlers/emailprint_class.php | 56 ++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/e107_handlers/emailprint_class.php b/e107_handlers/emailprint_class.php index b3e7692012..fe18b955d5 100644 --- a/e107_handlers/emailprint_class.php +++ b/e107_handlers/emailprint_class.php @@ -35,9 +35,17 @@ class emailprint */ static function render_emailprint($mode, $id, $look = 0, $parm=array()) { + //currently only used in news_shortcodes -> sc_emailicon & sc_printicon + // failsafe for output single button data, if you request all buttons parm can't be used.... + $parm = ($look == 0)?null:$parm; + // $look = 0 --->display all icons // $look = 1 --->display email icon only // $look = 2 --->display print icon only + + // $parm['url'] --->output url only + // no $parm or $parm['class']--> output full button render + // $parm['class'] --->used to inject class in output, redundant if using templates $tp = e107::getParser(); $text_emailprint = ""; @@ -68,33 +76,61 @@ static function render_emailprint($mode, $id, $look = 0, $parm=array()) } } + $TEMPLATE = e107::getCoreTemplate('emailprint'); + $sc = e107::getScBatch($mode); - + $genericMail = $tp->parseTemplate($TEMPLATE['ICON_EMAIL'], true, $sc); + $genericPrint = $tp->parseTemplate($TEMPLATE['ICON_PRINT'], true, $sc); +// Default icons if there's no templated icons if(deftrue('BOOTSTRAP')) { - $genericMail = $tp->toGlyph('fa-envelope',false); // ""; - $genericPrint = $tp->toGlyph('fa-print',false); // ""; +// $genericMail = $tp->toGlyph('fa-envelope',false); // ""; +// $genericPrint = $tp->toGlyph('fa-print',false); // ""; + $genericMail = $genericMail?:$tp->toGlyph('fa-envelope',false); // ""; + $genericPrint = $genericPrint?:$tp->toGlyph('fa-print',false); // ""; + // Probably redundant if using templates. Left here for legacy purposes? $class = !empty($parm['class']) ? $parm['class'] : "btn btn-default btn-secondary"; } else // BC { - $genericMail = "".LAN_EMAIL_7.""; - $genericPrint = "".LAN_PRINT_1.""; +// $genericMail = "".LAN_EMAIL_7.""; +// $genericPrint = "".LAN_PRINT_1.""; + $genericMail = $genericMail?:"".LAN_EMAIL_7.""; + $genericPrint = $genericPrint?:"".LAN_PRINT_1.""; $class = ""; } - if ($look == 0 || $look == 1) { + // Probably redundant if using templates. Left here for legacy purposes? $ico_mail = (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL) ? "".LAN_EMAIL_7."" : $genericMail); - //TDOD CSS class - $text_emailprint .= "".$ico_mail." "; + $url_mail = e_HTTP."email.php?".$email.".".$id; + if (!$parm || !empty($parm['class'])){ + // Default output without templates. Left here for legacy purposes? + //TODO CSS class + // $text_emailprint .= "".$ico_mail." "; + + $text_emailprint .= $tp->parseTemplate($TEMPLATE['email'], true, $sc)?:"".$ico_mail." "; + + } else if (!empty($parm['url'])) { + $text_emailprint .= $url_mail; + } } if ($look == 0 || $look == 2) { + // Probably redundant if using templates. Left here for legacy purposes? $ico_print = (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT) ? "".LAN_PRINT_1."" : $genericPrint); - //TODO CSS class - $text_emailprint .= "".$ico_print.""; + $url_print = e_HTTP."print.php?".$print.".".$id; + if (!$parm || !empty($parm['class'])){ + // Default output without templates. Left here for legacy purposes? + //TODO CSS class + // $text_emailprint .= "".$ico_print.""; + + $text_emailprint .= $tp->parseTemplate($TEMPLATE['print'], true, $sc)?:"".$ico_print.""; + + } else if (!empty($parm['url'])) { + $text_emailprint .= $url_print; + } } return $text_emailprint; } From 1b16be775f13043df9b5b893a987d599a6bfac24 Mon Sep 17 00:00:00 2001 From: rica-carv Date: Sun, 19 Jan 2025 18:22:41 +0000 Subject: [PATCH 3/3] Update emailprint_template.php --- e107_core/templates/emailprint_template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_core/templates/emailprint_template.php b/e107_core/templates/emailprint_template.php index 6bcb0ca2fb..bfcd9969d3 100644 --- a/e107_core/templates/emailprint_template.php +++ b/e107_core/templates/emailprint_template.php @@ -13,5 +13,5 @@ $EMAILPRINT_TEMPLATE['ICON_PRINT'] = "".LAN_PRINT_1.""; } -$EMAILPRINT_TEMPLATE['email'] = "452553523".$EMAILPRINT_TEMPLATE['ICON_EMAIL'].""; -$EMAILPRINT_TEMPLATE['print'] = "".$EMAILPRINT_TEMPLATE['ICON_PRINT'].""; \ No newline at end of file +$EMAILPRINT_TEMPLATE['email'] = "".$EMAILPRINT_TEMPLATE['ICON_EMAIL'].""; +$EMAILPRINT_TEMPLATE['print'] = "".$EMAILPRINT_TEMPLATE['ICON_PRINT']."";