From 1e933f0fddecd8db85be987352df46b130a243ce Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jan 2017 13:59:55 -0800 Subject: [PATCH] toFile() - needs to be completed. --- e107_core/shortcodes/batch/page_shortcodes.php | 4 ++++ e107_handlers/e_parse_class.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index 7b1e5dd3b..2251b3264 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -685,6 +685,10 @@ class cpage_shortcodes extends e_shortcode return ($raw) ? $value : $tp->toDate($value); break; + case "file": + return ($raw) ? $tp->toFile($value, array('raw'=>1)) : $tp->toFile($value); + break; + case "url": case "email": return ($raw) ? $value : $tp->toHtml($value); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 407807530..3babb048f 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3669,9 +3669,16 @@ class e_parser * @param $text * @return string */ - public function toFile($text) + public function toFile($text, $parm=array()) { + $link = e_HTTP."request.php?".str_replace('{e_MEDIA_FILE}', '',$text); + if(!empty($parm['raw'])) + { + return $link; + } + + return "-attachment-"; //TODO Add pref for this. } /**