From 442b22a378aabaa70d44ec30ec2b33ee0785e0a2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 19 Jul 2010 15:52:23 -0600 Subject: [PATCH] Create Horde_Text_Filter binder/factory. --- agora/lib/Messages.php | 4 +- ansel/lib/Ajax/Imple/EditCaption.php | 6 +- ansel/lib/Storage.php | 2 +- ansel/lib/Tile/Image.php | 2 +- ansel/lib/View/Base.php | 2 +- ansel/templates/captions/captions.inc | 2 +- ansel/templates/image/crop_image.inc | 2 +- ansel/templates/image/edit_image.inc | 2 +- ansel/templates/image/preview_cropimage.inc | 2 +- ansel/templates/image/preview_image.inc | 2 +- ansel/templates/image/resize_image.inc | 2 +- ansel/templates/view/gallery.inc | 2 +- ansel/templates/view/gallerylightbox.inc | 2 +- ansel/templates/view/image.inc | 2 +- chora/annotate.php | 4 +- chora/browsedir.php | 4 +- chora/cvsgraph.php | 2 +- chora/diff.php | 2 +- chora/history.php | 2 +- chora/lib/Chora.php | 4 +- chora/stats.php | 2 +- chora/templates/checkout/checkout.inc | 2 +- folks/lib/Driver.php | 3 +- folks/lib/Forms/Activity.php | 2 +- folks/lib/Notification/facebook.php | 2 +- framework/Core/lib/Horde.php | 2 +- framework/Core/lib/Horde/Config.php | 4 +- .../Core/lib/Horde/Core/Binder/TextFilter.php | 17 +++ .../Core/lib/Horde/Core/Factory/TextFilter.php | 148 +++++++++++++++++++++ .../Core/lib/Horde/Core/Text/Filter/Emails.php | 15 +-- framework/Core/lib/Horde/Registry.php | 1 + framework/Core/lib/Horde/Themes.php | 2 +- framework/Core/package.xml | 4 + framework/Mime/lib/Horde/Mime/Mail.php | 2 +- .../Rampage/scripts/Horde/Rampage/rampage.php | 2 +- framework/Text_Filter/lib/Horde/Text/Filter.php | 9 +- .../Text_Filter/lib/Horde/Text/Filter/Emails.php | 17 ++- .../lib/Horde/Text/Filter/Text2html.php | 52 +++++--- .../Text_Filter/test/Horde/Text/Filter/emails.phpt | 2 +- horde/lib/Block/fortune.php | 4 +- horde/lib/Block/twitter_timeline.php | 2 +- horde/services/twitter.php | 8 +- horde/templates/javascript/open_html_helper.js | 2 +- imp/lib/Compose.php | 12 +- imp/lib/Contents.php | 2 +- imp/lib/IMP.php | 13 +- imp/lib/Mime/Viewer/Html.php | 4 +- imp/lib/Mime/Viewer/Pgp.php | 2 +- imp/lib/Mime/Viewer/Plain.php | 7 +- imp/lib/Prefs/Ui.php | 2 +- imp/lib/Ui/Compose.php | 2 +- imp/lib/Ui/Mailbox.php | 2 +- imp/lib/Ui/Message.php | 6 +- imp/mailbox.php | 2 +- imp/message-mimp.php | 2 +- imp/view.php | 2 +- ingo/lib/Ingo.php | 2 +- jonah/delivery/rss.php | 2 +- jonah/lib/Api.php | 6 +- jonah/lib/Block/latest.php | 2 +- jonah/lib/Block/story.php | 2 +- jonah/lib/Driver.php | 4 +- jonah/lib/News.php | 6 +- jonah/stories/pdf.php | 2 +- jonah/stories/view.php | 2 +- kronolith/templates/itip/notification.html.php | 2 +- kronolith/templates/view/view.inc | 6 +- luxor/lib/Lang/Generic.php | 2 +- luxor/lib/Luxor.php | 4 +- mnemo/lib/Block/note.php | 4 +- mnemo/templates/view/memo.inc | 2 +- nag/lib/Task.php | 2 +- whups/lib/Renderer/Comment.php | 4 +- 73 files changed, 333 insertions(+), 135 deletions(-) create mode 100644 framework/Core/lib/Horde/Core/Binder/TextFilter.php create mode 100644 framework/Core/lib/Horde/Core/Factory/TextFilter.php diff --git a/agora/lib/Messages.php b/agora/lib/Messages.php index 570fbda77..c08dcaf00 100644 --- a/agora/lib/Messages.php +++ b/agora/lib/Messages.php @@ -1063,7 +1063,7 @@ class Agora_Messages { $filters_params[0]['parselevel'] = Horde_Text_Filter_Text2html::NOHTML; } - return Horde_Text_Filter::filter($body, $filters, $filters_params); + return $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body, $filters, $filters_params); } /** @@ -1148,7 +1148,7 @@ class Agora_Messages { $message['message_id'] = $id; $message['message_author'] = htmlspecialchars($message['message_author']); $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); - $message['message_body'] = Horde_Text_Filter::filter($this->convertFromDriver($message['body']), 'highlightquotes'); + $message['message_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')filter($this->convertFromDriver($message['body']), 'highlightquotes'); if ($message['attachments']) { $message['message_attachment'] = $this->getAttachmentLink($id); } diff --git a/ansel/lib/Ajax/Imple/EditCaption.php b/ansel/lib/Ajax/Imple/EditCaption.php index 65f2e5da1..799f1de9e 100644 --- a/ansel/lib/Ajax/Imple/EditCaption.php +++ b/ansel/lib/Ajax/Imple/EditCaption.php @@ -76,10 +76,10 @@ class Ansel_Ajax_Imple_EditCaption extends Horde_Core_Ajax_Imple return ''; } } - $imageCaption = Horde_Text_Filter::filter( - $image->caption, 'text2html', + return $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter( + $image->caption, + 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); - return $imageCaption; } } diff --git a/ansel/lib/Storage.php b/ansel/lib/Storage.php index f4cbdeafc..5b9b5ec91 100644 --- a/ansel/lib/Storage.php +++ b/ansel/lib/Storage.php @@ -966,7 +966,7 @@ class Ansel_Storage if ($galleries[$gallery_id]['perm']) { $data = array((string)Ansel::getImageUrl($image->id, $image_view, $full, $style), htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()), - Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), + $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), $image->id, 0); diff --git a/ansel/lib/Tile/Image.php b/ansel/lib/Tile/Image.php index 179254d2b..8eacff0f8 100644 --- a/ansel/lib/Tile/Image.php +++ b/ansel/lib/Tile/Image.php @@ -101,7 +101,7 @@ class Ansel_Tile_Image ? str_replace('%i', $image->id, $params['image_onclick']) : ''); - $imageCaption = Horde_Text_Filter::filter( + $imageCaption = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter( $image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); diff --git a/ansel/lib/View/Base.php b/ansel/lib/View/Base.php index 2e56cedad..93da194c3 100644 --- a/ansel/lib/View/Base.php +++ b/ansel/lib/View/Base.php @@ -260,7 +260,7 @@ abstract class Ansel_View_Base $data = array((string)Ansel::getImageUrl($image->id, $params['image_view'], $params['full'], $style['name']), htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()), - Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), + $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), $image->id, $curpage); if ($params['view_links']) { diff --git a/ansel/templates/captions/captions.inc b/ansel/templates/captions/captions.inc index cc147240b..ad48c7528 100644 --- a/ansel/templates/captions/captions.inc +++ b/ansel/templates/captions/captions.inc @@ -12,7 +12,7 @@ get('desc')): ?>

- get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> + getInstance('Horde_Text_Filter')->filter($gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>

diff --git a/ansel/templates/image/crop_image.inc b/ansel/templates/image/crop_image.inc index 83cff1f62..4055440b7 100644 --- a/ansel/templates/image/crop_image.inc +++ b/ansel/templates/image/crop_image.inc @@ -120,7 +120,7 @@ echo $selfUrl->copy()->add('actionID', 'resizeedit')->link() . Horde::img('image ' ?>
- caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> + caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
diff --git a/ansel/templates/image/edit_image.inc b/ansel/templates/image/edit_image.inc index 138878fa7..f24b5de13 100644 --- a/ansel/templates/image/edit_image.inc +++ b/ansel/templates/image/edit_image.inc @@ -35,5 +35,5 @@ echo $selfUrl->copy()->add('actionID', 'resizeedit')->link() . Horde::img('image
' ?>
- caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> + caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
diff --git a/ansel/templates/image/preview_cropimage.inc b/ansel/templates/image/preview_cropimage.inc index f312f306f..f3fb6af41 100644 --- a/ansel/templates/image/preview_cropimage.inc +++ b/ansel/templates/image/preview_cropimage.inc @@ -30,5 +30,5 @@ if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT))
'?>
-caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> +caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
diff --git a/ansel/templates/image/preview_image.inc b/ansel/templates/image/preview_image.inc index e5d564fab..358752f8d 100644 --- a/ansel/templates/image/preview_image.inc +++ b/ansel/templates/image/preview_image.inc @@ -32,5 +32,5 @@ if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT))
' ?>
-caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> +caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
diff --git a/ansel/templates/image/resize_image.inc b/ansel/templates/image/resize_image.inc index 2ff1d7211..69f82ed59 100644 --- a/ansel/templates/image/resize_image.inc +++ b/ansel/templates/image/resize_image.inc @@ -79,5 +79,5 @@ echo $selfUrl->copy()->add(array('actionID' => 'resizeedit'))->link() . Horde::i
' ?>
- caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?> + caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
diff --git a/ansel/templates/view/gallery.inc b/ansel/templates/view/gallery.inc index 54d6b2fb0..9d5f9c92b 100644 --- a/ansel/templates/view/gallery.inc +++ b/ansel/templates/view/gallery.inc @@ -109,7 +109,7 @@ function downloadSelected()
view->gallery->get('desc')): ?> diff --git a/ansel/templates/view/gallerylightbox.inc b/ansel/templates/view/gallerylightbox.inc index 49eea91fc..e4dbf22c7 100644 --- a/ansel/templates/view/gallerylightbox.inc +++ b/ansel/templates/view/gallerylightbox.inc @@ -126,7 +126,7 @@ function downloadSelected() view->gallery->get('desc')): ?>
diff --git a/ansel/templates/view/image.inc b/ansel/templates/view/image.inc index fd3b4b55b..5e7a619c3 100644 --- a/ansel/templates/view/image.inc +++ b/ansel/templates/view/image.inc @@ -105,7 +105,7 @@ function arrowHandler(e) 'photodiv', 'width' => $this->_geometry['width'], 'height' => $this->_geometry['height'])) ?>
diff --git a/chora/annotate.php b/chora/annotate.php index 1a8d7764b..f07bff4e3 100644 --- a/chora/annotate.php +++ b/chora/annotate.php @@ -42,7 +42,7 @@ try { Chora::fatal($e); } -$title = sprintf(_("Source Annotation of %s (revision %s)"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $rev); +$title = sprintf(_("Source Annotation of %s (revision %s)"), $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true)), $rev); $extraLink = sprintf('%s | %s', Chora::url('co', $where, array('r' => $rev)), _("View"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download")); @@ -72,7 +72,7 @@ while (list(,$line) = each($lines)) { } $prev = $fl->queryPreviousRevision($rev); - $line = Horde_Text_Filter::filter($line['line'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); + $line = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($line['line'], 'space2html', array('encode' => true, 'encode_all' => true)); include CHORA_TEMPLATES . '/annotate/line.inc'; } diff --git a/chora/browsedir.php b/chora/browsedir.php index 5d7bae5f6..b0de3f228 100644 --- a/chora/browsedir.php +++ b/chora/browsedir.php @@ -88,7 +88,7 @@ if ($dirList) { continue; } $url = Chora::url('browsedir', $where . '/' . $currentDir . '/', array('onb' => $onb)); - $currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); + $currDir = $injector->getInstance('Horde_Text_Filter')->filter($currentDir, 'space2html', array('encode' => true, 'encode_all' => true)); require CHORA_TEMPLATES . '/directory/dir.inc'; } echo ''; @@ -115,7 +115,7 @@ if ($fileList) { $log = $lg->queryLog(); $attic = $currFile->isDeleted(); $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname; - $name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); + $name = $injector->getInstance('Horde_Text_Filter')->filter($realname, 'space2html', array('encode' => true, 'encode_all' => true)); $url = Chora::url('browsefile', $fileName, array('onb' => $onb)); $readableDate = Chora::readableTime($date); if ($log) { diff --git a/chora/cvsgraph.php b/chora/cvsgraph.php index 3776e5906..5be547f11 100644 --- a/chora/cvsgraph.php +++ b/chora/cvsgraph.php @@ -49,7 +49,7 @@ if (Horde_Util::getFormData('show_image')) { passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file); } else { // Display the wrapper page for the image. - $title = sprintf(_("Graph for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); + $title = sprintf(_("Graph for %s"), $injector->getInstance('Horde_Text_Filter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true))); $extraLink = Chora::getFileViews($where, 'cvsgraph'); require CHORA_TEMPLATES . '/common-header.inc'; diff --git a/chora/diff.php b/chora/diff.php index ccf9e5690..bbd9318a4 100644 --- a/chora/diff.php +++ b/chora/diff.php @@ -55,7 +55,7 @@ if ($type != 'colored') { $abbrev_r1 = $VC->abbrev($r1); $abbrev_r2 = $VC->abbrev($r2); $title = sprintf(_("Diff for %s between version %s and %s"), - Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2); + $injector->getInstance('Horde_Text_Filter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2); /* Format log entries. */ $log_messages = array(); diff --git a/chora/history.php b/chora/history.php index 11e6035e6..6e2a5ece6 100644 --- a/chora/history.php +++ b/chora/history.php @@ -127,7 +127,7 @@ foreach ($grid as $cols) { $maxCol = max($val, $maxCol); } -$title = sprintf(_("Source Branching View for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); +$title = sprintf(_("Source Branching View for %s"), $injector->getInstance('Horde_Text_Filter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true))); $extraLink = Chora::getFileViews($where, 'history'); require CHORA_TEMPLATES . '/common-header.inc'; diff --git a/chora/lib/Chora.php b/chora/lib/Chora.php index 864738e66..aaa72d850 100644 --- a/chora/lib/Chora.php +++ b/chora/lib/Chora.php @@ -60,7 +60,7 @@ class Chora if (!empty($onb)) { $url = Horde_Util::addParameter($url, array('onb' => $onb)); } - $bar .= '/ '. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . ' '; + $bar .= '/ ' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($dir, 'space2html', array('encode' => true, 'encode_all' => true)) . ' '; } } @@ -467,7 +467,7 @@ class Chora */ static public function formatLogMessage($log) { - $log = Horde_Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => '')); + $log = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); return (empty($GLOBALS['conf']['tickets']['regexp']) || empty($GLOBALS['conf']['tickets']['replacement'])) ? $log diff --git a/chora/stats.php b/chora/stats.php index ba53919d4..a1cd819c5 100644 --- a/chora/stats.php +++ b/chora/stats.php @@ -29,7 +29,7 @@ foreach ($fl->queryLogs() as $lg) { } arsort($stats); -$title = sprintf(_("Statistics for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); +$title = sprintf(_("Statistics for %s"), $injector->getInstance('Horde_Text_Filter')->filter($where, 'space2html', array('encode' => true, 'encode_all' => true))); Horde::addScriptFile('tables.js', 'horde'); require CHORA_TEMPLATES . '/common-header.inc'; require CHORA_TEMPLATES . '/menu.inc'; diff --git a/chora/templates/checkout/checkout.inc b/chora/templates/checkout/checkout.inc index 2aabd0e3a..9ac7a5db5 100644 --- a/chora/templates/checkout/checkout.inc +++ b/chora/templates/checkout/checkout.inc @@ -21,7 +21,7 @@ if (strpos($mime_type, 'text/plain') !== false) { $data = $pretty->render('inline'); $data = reset($data); - echo '
' . Horde_Text_Filter::filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '
'; + echo '
' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '
'; } elseif (strpos($mime_type, 'image/') !== false) { echo Horde::img(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1), '', '', ''); } elseif ($pretty->canRender('inline')) { diff --git a/folks/lib/Driver.php b/folks/lib/Driver.php index d9ffa30f8..38647f91b 100644 --- a/folks/lib/Driver.php +++ b/folks/lib/Driver.php @@ -319,7 +319,6 @@ class Folks_Driver { $profile = unserialize($profile); } else { - // Load profile $profile = $this->_getProfile($user); if ($profile instanceof PEAR_Error) { @@ -338,7 +337,7 @@ class Folks_Driver { $filters_params[0]['parselevel'] = Horde_Text_Filter_Text2html::NOHTML; } - $profile['user_description'] = Horde_Text_Filter::filter(trim($profile['user_description']), $filters, $filters_params); + $profile['user_description'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(trim($profile['user_description']), $filters, $filters_params); // Get user last external data foreach ($profile as $key => $value) { diff --git a/folks/lib/Forms/Activity.php b/folks/lib/Forms/Activity.php index 90f98af1d..60e7f1b4c 100644 --- a/folks/lib/Forms/Activity.php +++ b/folks/lib/Forms/Activity.php @@ -48,7 +48,7 @@ class Folks_Activity_Form extends Horde_Form { $filters_params[0]['parselevel'] = Horde_Text_Filter_Text2html::NOHTML; } - $message = Horde_Text_Filter::filter(trim($message), $filters, $filters_params); + $message = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(trim($message), $filters, $filters_params); $result = $GLOBALS['folks_driver']->logActivity($message, 'folks:custom'); if ($result instanceof PEAR_Error) { diff --git a/folks/lib/Notification/facebook.php b/folks/lib/Notification/facebook.php index fbc82bc69..1784488ec 100644 --- a/folks/lib/Notification/facebook.php +++ b/folks/lib/Notification/facebook.php @@ -158,6 +158,6 @@ class Folks_Notification_facebook extends Folks_Notification { private function _formatBody($subject, $body) { return '' . $subject . ': ' - . Horde_Text_Filter::filter($body, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)); + . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)); } } diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 6cfe9f418..075f05bb7 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -319,7 +319,7 @@ HTML; /* Separate JS files with a newline since some * compressors may strip trailing terminators. */ try { - $out .= Horde_Text_Filter::filter($js_text, 'JavascriptMinify', $jsmin_params) . "\n"; + $out .= $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($js_text, 'JavascriptMinify', $jsmin_params) . "\n"; } catch (Horde_Exception $e) { $out .= $js_text . "\n"; } diff --git a/framework/Core/lib/Horde/Config.php b/framework/Core/lib/Horde/Config.php index 172e14c47..6c93060ba 100644 --- a/framework/Core/lib/Horde/Config.php +++ b/framework/Core/lib/Horde/Config.php @@ -415,7 +415,7 @@ class Horde_Config continue; } $name = $node->getAttribute('name'); - $desc = Horde_Text_Filter::filter($node->getAttribute('desc'), 'linkurls', array('callback' => 'Horde::externalUrl')); + $desc = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($node->getAttribute('desc'), 'linkurls'); $required = !($node->getAttribute('required') == 'false'); $quote = !($node->getAttribute('quote') == 'false'); @@ -431,7 +431,7 @@ class Horde_Config $conf[$name] = array( '_type' => 'description', - 'desc' => Horde_Text_Filter::filter($this->_default($curctx, $this->_getNodeOnlyText($node)), 'linkurls', array('callback' => 'Horde::externalUrl')) + 'desc' => $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->_default($curctx, $this->_getNodeOnlyText($node)), 'linkurls') ); break; diff --git a/framework/Core/lib/Horde/Core/Binder/TextFilter.php b/framework/Core/lib/Horde/Core/Binder/TextFilter.php new file mode 100644 index 000000000..e3bcc3c02 --- /dev/null +++ b/framework/Core/lib/Horde/Core/Binder/TextFilter.php @@ -0,0 +1,17 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Core + */ + +/** + * A Horde_Injector:: based Horde_Text_Filter_Base:: factory. + * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Core + * @author Michael Slusarz + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Core + */ +class Horde_Core_Factory_TextFilter +{ + /** + * The injector. + * + * @var Horde_Injector + */ + private $_injector; + + /** + * Constructor. + * + * @param Horde_Injector $injector The injector to use. + */ + public function __construct(Horde_Injector $injector) + { + $this->_injector = $injector; + } + + /** + * Return the Horde_Text_Filter_Base:: instance. + * + * @param string $driver Either a driver name, or the full class name to + * use. + * @param array $params A hash containing any additional configuration + * parameters a subclass might need. + * + * @return Horde_Text_Filter_Base The singleton instance. + * @throws Horde_Text_Filter_Exception + */ + public function getFilter($driver, array $params = array()) + { + list($driver, $params) = $this->_getDriver($driver, $params); + return Horde_Text_Filter::factory($driver, $params); + } + + /** + * Applies a set of patterns to a block of text. + * + * @param string $text The text to filter. + * @param mixed $filters The list of filters (or a single filter). + * @param mixed $params The list of params to use with each filter. + * + * @return string The transformed text. + */ + public function filter($text, $filters = array(), array $params = array()) + { + if (!is_array($filters)) { + $filters = array($filters); + $params = array($params); + } + + $filter_list = array(); + $params = array_values($params); + + foreach (array_values($filters) as $num => $filter) { + list($driver, $driv_param) = $this->_getDriver($filter, isset($params[$num]) ? $params[$num] : array()); + $filter_list[$driver] = $driv_param; + } + + return Horde_Text_Filter::filter($text, array_keys($filter_list), array_values($filter_list)); + } + + /** + * Gets the driver/params for a given base Horde_Text_Filter driver. + * + * @param string $driver Either a driver name, or the full class name to + * use. + * @param array $params A hash containing any additional configuration + * parameters a subclass might need. + * + * @return array Driver as the first value, params list as the second. + */ + protected function _getDriver($driver, $params) + { + $lc_driver = Horde_String::lower($driver); + + switch ($lc_driver) { + case 'emails': + $driver = 'Horde_Core_Text_Filter_Emails'; + break; + + case 'emoticons': + $driver = 'Horde_Core_Text_Filter_Emoticons'; + break; + + case 'linkurls': + if (!isset($params['callback'])) { + $params['callback'] = 'Horde::externalUrl'; + } + break; + + case 'text2html': + $param_copy = $params; + foreach (array('emails', 'linkurls', 'space2html') as $val) { + if (!isset($params[$val])) { + $tmp = $this->_getDriver($val, $param_copy); + $params[$val] = array( + $tmp[0] => $tmp[1] + ); + } + } + break; + } + + /* Add charset information, if needed. */ + if (!isset($params['charset'])) { + switch ($lc_driver) { + case 'cleanhtml': + case 'html2text': + case 'space2html': + case 'text2html': + $params['charset'] = $GLOBALS['registry']->getCharset(); + break; + } + } + + return array($driver, $params); + } + +} diff --git a/framework/Core/lib/Horde/Core/Text/Filter/Emails.php b/framework/Core/lib/Horde/Core/Text/Filter/Emails.php index 2e0d978db..30ff3c95a 100644 --- a/framework/Core/lib/Horde/Core/Text/Filter/Emails.php +++ b/framework/Core/lib/Horde/Core/Text/Filter/Emails.php @@ -50,14 +50,14 @@ class Horde_Core_Text_Filter_Emails extends Horde_Text_Filter_Emails return parent::_regexCallback($matches); } - if (empty($email2)) { + if ($matches[10] === '') { $args = $matches[7]; $email = $matches[3]; $args_long = $matches[5]; } else { - $args = $matches[13]; + $args = isset($matches[13]) ? $matches[13] : ''; $email = $matches[10]; - $args_long = $matches[11]; + $args_long = isset($matches[11]) ? $matches[11] : ''; } parse_str($args, $extra); @@ -71,7 +71,7 @@ class Horde_Core_Text_Filter_Emails extends Horde_Text_Filter_Emails $href = '#'; $onclick = ' onclick="' . substr($url, 11) . ';return false;"'; } else { - $href = $url; + $href = htmlspecialchars($url); $onclick = ''; } @@ -79,10 +79,9 @@ class Horde_Core_Text_Filter_Emails extends Horde_Text_Filter_Emails ? '' : ' class="' . $this->_params['class'] . '"'; - return $matches[1] . $matches[2] . $matches[9] . '' . - htmlspecialchars($email) . $args_long - . '' . $matches[8] . $matches[4] . ($matches[14] ? '>' : ''); + return '' . + htmlspecialchars($email) . htmlspecialchars($args_long) . + ''; } } diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index b1fd52499..387805e2e 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -290,6 +290,7 @@ class Horde_Registry 'Horde_SessionHandler' => new Horde_Core_Binder_SessionHandler(), 'Horde_Share' => new Horde_Core_Binder_Share(), 'Horde_Template' => new Horde_Core_Binder_Template(), + 'Horde_Text_Filter' => new Horde_Core_Binder_TextFilter(), 'Horde_Tree' => new Horde_Core_Binder_Tree(), 'Horde_Token' => new Horde_Core_Binder_Token(), 'Horde_Vfs' => new Horde_Core_Binder_Vfs(), diff --git a/framework/Core/lib/Horde/Themes.php b/framework/Core/lib/Horde/Themes.php index 910d968c1..8a87d7660 100644 --- a/framework/Core/lib/Horde/Themes.php +++ b/framework/Core/lib/Horde/Themes.php @@ -82,7 +82,7 @@ class Horde_Themes /* Use CSS tidy to clean up file. */ if ($conf['cachecssparams']['compress'] == 'php') { try { - $out = Horde_Text_Filter::filter($out, 'csstidy'); + $out = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($out, 'csstidy'); } catch (Horde_Exception $e) {} } diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 8c0ff3a6d..b92c753b7 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -120,6 +120,7 @@ Application Framework. + @@ -149,6 +150,7 @@ Application Framework. + @@ -382,6 +384,7 @@ Application Framework. + @@ -407,6 +410,7 @@ Application Framework. + diff --git a/framework/Mime/lib/Horde/Mime/Mail.php b/framework/Mime/lib/Horde/Mime/Mail.php index ba5a1e6f7..6733af300 100644 --- a/framework/Mime/lib/Horde/Mime/Mail.php +++ b/framework/Mime/lib/Horde/Mime/Mail.php @@ -234,7 +234,7 @@ class Horde_Mime_Mail $this->_htmlBody->setCharset($charset); $this->_htmlBody->setContents($body); if ($alternative) { - $this->setBody(Horde_Text_Filter::filter($body, 'Html2text', array('wrap' => false)), $charset); + $this->setBody(Horde_Text_Filter::filter($body, 'Html2text', array('charset' => $charset, 'wrap' => false)), $charset); } } diff --git a/framework/Rampage/scripts/Horde/Rampage/rampage.php b/framework/Rampage/scripts/Horde/Rampage/rampage.php index 01060de07..f323c0e4e 100644 --- a/framework/Rampage/scripts/Horde/Rampage/rampage.php +++ b/framework/Rampage/scripts/Horde/Rampage/rampage.php @@ -850,7 +850,7 @@ function render_field($field) case 'mediumtext': case 'longblob': case 'longtext': - return "nl2br(Horde_Text::linkUrls(Horde_Text_Filter::filter(\$zitem['$n'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), false, 'text'))"; + return "nl2br(Horde_Text::linkUrls(\$GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(\$zitem['$n'], 'space2html', array('encode' => true)), false, 'text'))"; case 'bool': case 'boolean': diff --git a/framework/Text_Filter/lib/Horde/Text/Filter.php b/framework/Text_Filter/lib/Horde/Text/Filter.php index e0f7cba70..44741e02a 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter.php @@ -46,8 +46,9 @@ class Horde_Text_Filter /** * Applies a set of patterns to a block of text. * - * @param string $text The text to filter. - * @param array $patterns The array of patterns to filter with. + * @param string $text The text to filter. + * @param mixed $filters The list of filters (or a single filter). + * @param mixed $params The list of params to use with each filter. * * @return string The transformed text. */ @@ -58,7 +59,9 @@ class Horde_Text_Filter $params = array($params); } - foreach ($filters as $num => $filter) { + $params = array_values($params); + + foreach (array_values($filters) as $num => $filter) { try { $filterOb = self::factory($filter, isset($params[$num]) ? $params[$num] : array()); } catch (Horde_Text_Filter_Exception $e) { diff --git a/framework/Text_Filter/lib/Horde/Text/Filter/Emails.php b/framework/Text_Filter/lib/Horde/Text/Filter/Emails.php index 18cb5aa5f..bb986738b 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter/Emails.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter/Emails.php @@ -91,9 +91,13 @@ EOR; { $data = $this->_regexCallback($matches); - return $this->_params['encode'] - ? "\01\01\01" . base64_encode($data) . "\01\01\01" - : $data; + if ($this->_params['encode']) { + $data = "\01\01\01" . base64_encode($data) . "\01\01\01"; + } + + return $matches[1] . $matches[2] . $matches[9] . + $data . + $matches[4] . $matches[8] . (isset($matches[14]) ? $matches[14] : ''); } /** @@ -109,10 +113,11 @@ EOR; $class = empty($this->_params['class']) ? '' : ' class="' . $this->_params['class'] . '"'; + $email = ($matches[10] === '') + ? $matches[3] . $matches[5] + : $matches[10] . $matches[11]; - return ($matches[10] === '') - ? $matches[1] . $matches[2] . '' . $matches[3] . $matches[5] . '' . $matches[4] . $matches[8] - : (($matches[9] == '<') ? '<' : $matches[9]) . '' . $matches[10] . $matches[11] . '' . ($matches[14] ? '>' : ''); + return '' . htmlspecialchars($email) . ''; } /** diff --git a/framework/Text_Filter/lib/Horde/Text/Filter/Text2html.php b/framework/Text_Filter/lib/Horde/Text/Filter/Text2html.php index 63acd5f9e..b4376a182 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter/Text2html.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter/Text2html.php @@ -5,12 +5,12 @@ * * Parameters: *
- * callback - (string) See Horde_Text_Filter_Linkurls::.
  * charset - (string) The charset to use for htmlspecialchars() calls.
  * class - (string) See Horde_Text_Filter_Linkurls::.
- * nofollow - (boolean) See Horde_Text_Filter_Linkurls::.
- * noprefetch - (boolean) See Horde_Text_Filter_Linkurls::.
+ * emails - (array)
+ * linkurls - (array)
  * parselevel - (integer) The parselevel of the output (see below).
+ * space2html - (array)
  * 
* *
@@ -53,12 +53,12 @@ class Horde_Text_Filter_Text2html extends Horde_Text_Filter_Base
      * @var array
      */
     protected $_params = array(
-        'callback' => 'Horde::externalUrl',
         'charset' => 'ISO-8859-1',
         'class' => 'fixed',
-        'nofollow' => false,
-        'noprefetch' => false,
-        'parselevel' => 0
+        'linkurls' => false,
+        'text2html' => false,
+        'parselevel' => 0,
+        'space2html' => false
     );
 
     /**
@@ -95,15 +95,29 @@ class Horde_Text_Filter_Text2html extends Horde_Text_Filter_Base
         }
 
         if ($this->_params['parselevel'] < self::NOHTML) {
-            $filters = array('linkurls' => array(
-                'callback' => $this->_params['callback'],
-                'nofollow' => $this->_params['nofollow'],
-                'noprefetch' => $this->_params['noprefetch'],
-                'encode' => true
-            ));
+            $filters = array();
+            if ($this->_params['linkurls']) {
+                reset($this->_params['linkurls']);
+                $this->_params['linkurls'][key($this->_params['linkurls'])]['encode'] = true;
+                $filters = $this->_params['linkurls'];
+            } else {
+                $filters['linkurls'] = array(
+                    'encode' => true
+                );
+            }
+
             if ($this->_params['parselevel'] < self::MICRO_LINKURL) {
-                $filters['emails'] = array('encode' => true);
+                if ($this->_params['emails']) {
+                    reset($this->_params['emails']);
+                    $this->_params['emails'][key($this->_params['emails'])]['encode'] = true;
+                    $filters += $this->_params['emails'];
+                } else {
+                    $filters['emails'] = array(
+                        'encode' => true
+                    );
+                }
             }
+
             $text = Horde_Text_Filter::filter($text, array_keys($filters), array_values($filters));
         }
 
@@ -126,7 +140,15 @@ class Horde_Text_Filter_Text2html extends Horde_Text_Filter_Base
                 $text = Horde_Text_Filter_Emails::decode($text);
             }
 
-            $text = Horde_Text_Filter::filter($text, 'space2html');
+            if ($this->_params['space2html']) {
+                $params = reset($this->_params['space2html']);
+                $driver = key($this->_params['space2html']);
+            } else {
+                $driver = 'space2html';
+                $params = array();
+            }
+
+            $text = Horde_Text_Filter::filter($text, $driver, $params);
         }
 
         /* Do the newline ---> 
substitution. Everybody gets this; if diff --git a/framework/Text_Filter/test/Horde/Text/Filter/emails.phpt b/framework/Text_Filter/test/Horde/Text/Filter/emails.phpt index fafbb5e00..9f3992048 100644 --- a/framework/Text_Filter/test/Horde/Text/Filter/emails.phpt +++ b/framework/Text_Filter/test/Horde/Text/Filter/emails.phpt @@ -22,7 +22,7 @@ Don't link http://test@www.horde.org/ test. Real world example: mailto:pmx-auto-approve%2b27f0e770e2d85bf9bd8fea61f9dedbff@example.com?subject=Release%20message%20from%20quarantine&body=%5b%23ptn6Pw-1%5d EOT; -echo Horde_Text_Filter::filter($emails, 'emails', array('always_mailto' => true, 'class' => 'pagelink')); +echo Horde_Text_Filter::filter($emails, 'emails', array('class' => 'pagelink')); ?> --EXPECT-- diff --git a/horde/lib/Block/fortune.php b/horde/lib/Block/fortune.php index ec8a40e94..2b80efa1d 100644 --- a/horde/lib/Block/fortune.php +++ b/horde/lib/Block/fortune.php @@ -123,9 +123,7 @@ class Horde_Block_Horde_fortune extends Horde_Block . $this->_params['offend'] . ' ' . implode(' ', $this->_params['fortune']); return '' - . nl2br(Horde_Text_Filter::filter(shell_exec($cmdLine), - array('space2html'), - array(array('encode' => true)))) + . nl2br($GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(shell_exec($cmdLine), array('space2html'), array(array('encode' => true)))) . ''; } else { return ''; diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index d4512c60a..7524d1dce 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -164,7 +164,7 @@ EOT; . Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;')); $html .= '
' . _("Latest") . ' ' . $latestStatus . ' - ' . Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")) . '
'; $html .= '
'; - $filter = Horde_Text_Filter::factory('Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); + $filter = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->getFilter('Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); $html .= '
'; $html .= ''; $html .= ''; diff --git a/horde/services/twitter.php b/horde/services/twitter.php index e81fece0c..49cba8180 100644 --- a/horde/services/twitter.php +++ b/horde/services/twitter.php @@ -53,7 +53,7 @@ case 'getPage': } elseif ($since = Horde_Util::getPost('since_id')) { $params['since_id'] = $since; } - + $stream = Horde_Serialize::unserialize($twitter->statuses->homeTimeline($params), Horde_Serialize::JSON); } catch (Horde_Service_Twitter_Exception $e) { echo sprintf(_("Unable to contact Twitter. Please try again later. Error returned: %s"), $e->getMessage()); @@ -65,8 +65,10 @@ case 'getPage': $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/block')); $view->addHelper('Tag'); + $filter = $injector->getInstance('Horde_Text_Filter'); + /* links */ - $body = Horde_Text_Filter::filter($tweet->text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)); + $body = $filter->filter($tweet->text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)); $view->body = preg_replace("/[@]+([A-Za-z0-9-_]+)/", "\\0", $body); /* If this is a retweet, use the original author's profile info */ @@ -82,7 +84,7 @@ case 'getPage': $view->authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, $GLOBALS['registry']->getCharset()); $view->authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, $GLOBALS['registry']->getCharset()); $view->createdAt = $tweetObj->created_at; - $view->clientText = Horde_Text_Filter::filter($tweet->source, 'xss', array()); + $view->clientText = $filter->filter($tweet->source, 'xss'); $view->tweet = $tweet; $oldest = $tweet->id; $html .= $view->render('twitter_tweet'); diff --git a/horde/templates/javascript/open_html_helper.js b/horde/templates/javascript/open_html_helper.js index e0eaf4d9a..eb3d5d185 100644 --- a/horde/templates/javascript/open_html_helper.js +++ b/horde/templates/javascript/open_html_helper.js @@ -41,7 +41,7 @@ function openHtmlHelper(type, target) if (type == 'emoticons') { row = document.createElement('TR'); cell = document.createElement('TD'); - getIcons()); foreach ($icons as $icon => $string): ?> + getInstance('Horde_Text_Filter')->getFilter('emoticons'); $icons = array_flip($filter->getIcons()); foreach ($icons as $icon => $string): ?> link = document.createElement('A'); link.href = '#'; link.onclick = function() { diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index a3edc5d00..31e7231be 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1023,7 +1023,7 @@ class IMP_Compose if (!empty($options['html'])) { $body_html = $body; - $body = Horde_Text_Filter::filter($body, 'Html2text', array('wrap' => false, 'charset' => $charset)); + $body = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body, 'Html2text', array('wrap' => false, 'charset' => $charset)); } /* Get trailer message (if any). */ @@ -1039,7 +1039,7 @@ class IMP_Compose } if (!empty($trailer_file)) { - $trailer = Horde_Text_Filter::filter("\n" . file_get_contents($trailer_file), 'environment'); + $trailer = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter("\n" . file_get_contents($trailer_file), 'environment'); try { $trailer = Horde::callHook('trailer', array($trailer), 'imp'); } catch (Horde_Exception_HookNotSet $e) {} @@ -1072,7 +1072,7 @@ class IMP_Compose $htmlBody->setCharset($charset); $htmlBody->setDisposition('inline'); $htmlBody->setDescription(Horde_String::convertCharset(_("HTML Version"), $nls_charset, $charset)); - $htmlBody->setContents(Horde_Text_Filter::filter($body_html, 'cleanhtml', array('charset' => $charset))); + $htmlBody->setContents($GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body_html, 'cleanhtml', array('charset' => $charset))); $textBody->setDescription(Horde_String::convertCharset(_("Plaintext Version"), $nls_charset, $charset)); @@ -2462,9 +2462,9 @@ class IMP_Compose } if ($mode == 'html') { - $msg = Horde_Text_Filter::filter($msg, array('cleanhtml', 'xss'), array(array('body_only' => true, 'charset' => $charset), array('body_only' => true, 'strip_styles' => true, 'strip_style_attributes' => false))); + $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, array('cleanhtml', 'xss'), array(array('body_only' => true), array('body_only' => true, 'strip_styles' => true, 'strip_style_attributes' => false))); } elseif ($type == 'text/html') { - $msg = Horde_Text_Filter::filter($msg, 'html2text', array('charset' => $charset)); + $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, 'html2text'); $type = 'text/plain'; } @@ -2622,7 +2622,7 @@ class IMP_Compose */ static public function text2html($msg) { - return Horde_Text_Filter::filter($msg, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'class' => null, 'callback' => null)); + return $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'callback' => null)); } /** diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index b7ded3d0a..0cb010c78 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -527,7 +527,7 @@ class IMP_Contents $ptext = $pmime->getContents(); $ptext = Horde_String::convertCharset($ptext, $pmime->getCharset()); if ($pmime->getType() == 'text/html') { - $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset())); + $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'Html2text'); } $this->_build = $oldbuild; diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index ee7b9e3b6..7e1577563 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -228,7 +228,7 @@ class IMP : $mbox['abbrev']; $mbox_list[] = array( - 'l' => Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), + 'l' => $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($label, 'space2html', array('encode' => true)), 'sel' => (!empty($options['selected']) && ($mbox['val'] === $options['selected'])), 'v' => htmlspecialchars($mbox['val']) ); @@ -245,7 +245,7 @@ class IMP $vfolder_sel = $imp_search->searchMboxID(); foreach ($vfolders as $id => $val) { $vfolder_list[] = array( - 'l' => Horde_Text_Filter::filter($val, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), + 'l' => $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($val, 'space2html', array('encode' => true)), 'sel' => ($vfolder_sel == $id), 'v' => htmlspecialchars($imp_search->createSearchID($id)) ); @@ -264,7 +264,7 @@ class IMP $tasklist_list = array(); foreach ($tasklists as $id => $tasklist) { $tasklist_list[] = array( - 'l' => Horde_Text_Filter::filter($tasklist->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), + 'l' => $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($tasklist->get('name'), 'space2html', array('encode' => true)), 'v' => '\0tasklist_' . $id ); } @@ -283,7 +283,7 @@ class IMP $notepad_list[] = array(); foreach ($notepads as $id => $notepad) { $notepad_list[] = array( - 'l' => Horde_Text_Filter::filter($notepad->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), + 'l' => $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($notepad->get('name'), 'space2html', array('encode' => true)), 'v' => '\0notepad_' . $id ); } @@ -522,7 +522,10 @@ class IMP static public function filterText($text) { if ($GLOBALS['prefs']->getValue('filtering') && strlen($text)) { - return Horde_Text_Filter::filter($text, 'words', array('words_file' => $GLOBALS['conf']['msgsettings']['filtering']['words'], 'replacement' => $GLOBALS['conf']['msgsettings']['filtering']['replacement'])); + return $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($text, 'words', array( + 'replacement' => $GLOBALS['conf']['msgsettings']['filtering']['replacement'], + 'words_file' => $GLOBALS['conf']['msgsettings']['filtering']['words'] + )); } return $text; diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 3aae5d3e8..ee0cae7a8 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -193,7 +193,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html * text. */ if (($_SESSION['imp']['view'] == 'mimp') || (!$inline && Horde_Util::getFormData('convert_text'))) { - $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false)); + $data = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($data, 'Html2text', array('wrap' => false)); // Filter bad language. return array( @@ -257,7 +257,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html } if ($GLOBALS['prefs']->getValue('emoticons')) { - $data = Horde_Text_Filter::filter($data, array('Horde_Core_Text_Filter_Emoticons'), array(array('entities' => true))); + $data = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($data, array('emoticons'), array(array('entities' => true))); } return array( diff --git a/imp/lib/Mime/Viewer/Pgp.php b/imp/lib/Mime/Viewer/Pgp.php index 20c47b551..74e3d652a 100644 --- a/imp/lib/Mime/Viewer/Pgp.php +++ b/imp/lib/Mime/Viewer/Pgp.php @@ -384,7 +384,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver 'icon' => $icon, 'success' => $success, 'text' => array( - Horde_Text_Filter::filter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML)) + $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML)) ) ); diff --git a/imp/lib/Mime/Viewer/Plain.php b/imp/lib/Mime/Viewer/Plain.php index 994c3cfc4..b8d1d05e9 100644 --- a/imp/lib/Mime/Viewer/Plain.php +++ b/imp/lib/Mime/Viewer/Plain.php @@ -143,11 +143,11 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain } if ($prefs->getValue('emoticons')) { - $filters['Horde_Core_Text_Filter_Emoticons'] = array('entities' => true); + $filters['emoticons'] = array('entities' => true); } // Run filters. - $text = Horde_Text_Filter::filter($text, array_keys($filters), array_values($filters)); + $text = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($text, array_keys($filters), array_values($filters)); // Wordwrap. $text = str_replace(array(' ', "\n "), array('  ', "\n "), $text); @@ -347,14 +347,13 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain // Escape text $filters = array( 'text2html' => array( - 'charset' => $GLOBALS['registry']->getCharset(), 'parselevel' => Horde_Text_Filter_Text2html::MICRO ), 'tabs2spaces' => array(), ); return '
' . - Horde_Text_Filter::filter(Horde_String::convertCharset(fread($stream, 1024), $this->_mimepart->getCharset()), array_keys($filters), array_values($filters)) . + $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(Horde_String::convertCharset(fread($stream, 1024), $this->_mimepart->getCharset()), array_keys($filters), array_values($filters)) . ' [...]
'; } diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index a3f11a7cd..982f6ad70 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -1606,7 +1606,7 @@ class IMP_Prefs_Ui if ($ui->vars->last_type != $type) { $content = ($type == 'plain') - ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset())) + ? $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($content, 'Html2text') : nl2br(htmlspecialchars(htmlspecialchars($content))); } diff --git a/imp/lib/Ui/Compose.php b/imp/lib/Ui/Compose.php index 4088840e7..26f8e8416 100644 --- a/imp/lib/Ui/Compose.php +++ b/imp/lib/Ui/Compose.php @@ -358,7 +358,7 @@ class IMP_Ui_Compose } } - $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false)); + $data = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($data, 'Html2text', array('wrap' => false)); $sig = $txt_sig; break; } diff --git a/imp/lib/Ui/Mailbox.php b/imp/lib/Ui/Mailbox.php index 5e9df72a7..2401e8fea 100644 --- a/imp/lib/Ui/Mailbox.php +++ b/imp/lib/Ui/Mailbox.php @@ -252,7 +252,7 @@ class IMP_Ui_Mailbox $new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject)); if ($htmlspaces) { - $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)); + $new_subject = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($subject, 'space2html', array('encode' => true)); if (empty($new_subject)) { $new_subject = htmlspecialchars($subject); } diff --git a/imp/lib/Ui/Message.php b/imp/lib/Ui/Message.php index a77f7132f..1f882b023 100644 --- a/imp/lib/Ui/Message.php +++ b/imp/lib/Ui/Message.php @@ -246,9 +246,7 @@ class IMP_Ui_Message } break; } elseif (empty($data['email'])) { - if ($url = Horde_Text_Filter::filter($match, 'linkurls', array( - 'callback' => 'Horde::externalUrl' - ))) { + if ($url = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($match, 'linkurls')) { if (!empty($opts['raw'])) { return $match; } @@ -634,7 +632,7 @@ class IMP_Ui_Message */ public function getDisplaySubject($subject) { - return Horde_Text_Filter::filter(preg_replace("/\b\s+\b/", ' ', IMP::filterText($subject)), 'text2html', array( + return $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter(preg_replace("/\b\s+\b/", ' ', IMP::filterText($subject)), 'text2html', array( 'parselevel' => Horde_Text_Filter_Text2html::MICRO )); } diff --git a/imp/mailbox.php b/imp/mailbox.php index e40f564d5..7cb954dc9 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -751,7 +751,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { } if (!$preview_tooltip) { - $ptext = Horde_Text_Filter::filter($ptext, 'text2html', array( + $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'text2html', array( 'parselevel' => Horde_Text_Filter_Text2html::NOHTML )); } diff --git a/imp/message-mimp.php b/imp/message-mimp.php index fe2fc8f9b..cf9b79bb2 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -258,7 +258,7 @@ if ($prefs->getValue('mimp_preview_msg') && $t->set('fullmsg_link', $self_link->copy()->add('fullmsg', 1)); } -$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => $registry->getCharset(), 'encode' => true)))); +$t->set('msg', nl2br($GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg_text, 'space2html', array('encode' => true)))); $compose_params = array( 'identity' => $identity, diff --git a/imp/view.php b/imp/view.php index bf5b7b467..4b7700f1d 100644 --- a/imp/view.php +++ b/imp/view.php @@ -265,7 +265,7 @@ case 'print_attach': } } - if ($style = Horde_Text_Filter::filter(Horde_Themes::loadCssFiles(Horde_Themes::getStylesheets()), 'csstidy', array('ob' => true, 'preserve_css' => false))->filterBySelector($selectors)) { + if ($style = $injector->getInstance('Horde_Text_Filter')->filter(Horde_Themes::loadCssFiles(Horde_Themes::getStylesheets()), 'csstidy', array('ob' => true, 'preserve_css' => false))->filterBySelector($selectors)) { $elt->setAttribute('style', ($elt->hasAttribute('style') ? rtrim($elt->getAttribute('style'), ' ;') . ';' : '') . $style); } } diff --git a/ingo/lib/Ingo.php b/ingo/lib/Ingo.php index cf7258b57..3a7758284 100644 --- a/ingo/lib/Ingo.php +++ b/ingo/lib/Ingo.php @@ -139,7 +139,7 @@ class Ingo $label = $mbox['abbrev']; $text .= sprintf('%s%s', $disabled, $val, $sel, - Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), "\n"); + $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($label, 'space2html', array('encode' => true)), "\n"); } return $text . ''; diff --git a/jonah/delivery/rss.php b/jonah/delivery/rss.php index 68da83abb..5f8cb8e5d 100644 --- a/jonah/delivery/rss.php +++ b/jonah/delivery/rss.php @@ -82,7 +82,7 @@ foreach ($stories as &$story) { $story['story_permalink'] = (isset($story['story_permalink']) ? htmlspecialchars($story['story_permalink']) : ''); $story['story_published'] = htmlspecialchars(date('r', $story['story_published'])); if (!empty($story['story_body_type']) && $story['story_body_type'] == 'text') { - $story['story_body'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } } $template->set('stories', $stories); diff --git a/jonah/lib/Api.php b/jonah/lib/Api.php index 3c17421ca..a61f2c6c9 100644 --- a/jonah/lib/Api.php +++ b/jonah/lib/Api.php @@ -47,7 +47,7 @@ class Jonah_Api extends Horde_Registry_Api foreach (array_keys($stories) as $s) { if (empty($stories[$s]['story_body_type']) || $stories[$s]['story_body_type'] == 'text') { - $stories[$s]['story_body_html'] = Horde_Text_Filter::filter($stories[$s]['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $stories[$s]['story_body_html'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($stories[$s]['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } else { $stories[$s]['story_body_html'] = $stories[$s]['story_body']; } @@ -74,7 +74,7 @@ class Jonah_Api extends Horde_Registry_Api return false; } if (empty($story['story_body_type']) || $story['story_body_type'] == 'text') { - $story['story_body_html'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body_html'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } else { $story['story_body_html'] = $story['story_body']; } @@ -184,7 +184,7 @@ class Jonah_Api extends Horde_Registry_Api $comments = $GLOBALS['conf']['comments']['allow'] && $registry->hasMethod('forums/numMessages'); foreach ($results as $story) { if (empty($story['story_body_type']) || $story['story_body_type'] == 'text') { - $story['story_body_html'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body_html'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } else { $story['story_body_html'] = $story['story_body']; } diff --git a/jonah/lib/Block/latest.php b/jonah/lib/Block/latest.php index 4781c5b39..24257105e 100644 --- a/jonah/lib/Block/latest.php +++ b/jonah/lib/Block/latest.php @@ -78,7 +78,7 @@ class Horde_Block_Jonah_latest extends Horde_Block { } if (empty($story['story_body_type']) || $story['story_body_type'] == 'text') { - $story['story_body'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } return '

' . htmlspecialchars($story['story_desc']) . diff --git a/jonah/lib/Block/story.php b/jonah/lib/Block/story.php index a3ea14af3..9c3d66fad 100644 --- a/jonah/lib/Block/story.php +++ b/jonah/lib/Block/story.php @@ -78,7 +78,7 @@ class Horde_Block_Jonah_story extends Horde_Block { } if (empty($story['story_body_type']) || $story['story_body_type'] == 'text') { - $story['story_body'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } $tag_html = array(); diff --git a/jonah/lib/Driver.php b/jonah/lib/Driver.php index 4a5004c98..c50986e03 100644 --- a/jonah/lib/Driver.php +++ b/jonah/lib/Driver.php @@ -474,10 +474,10 @@ class Jonah_Driver case 'richtext': /* Get a plain text version of a richtext story. */ $body_html = $story['story_body']; - $body_text = Horde_Text_Filter::filter($body_html, 'html2text'); + $body_text = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body_html, 'html2text'); /* Add description. */ - $body_html = '

' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "

\n" . $body_html; + $body_html = '

' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) . "

\n" . $body_html; $body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text; /* Add the text version of the story to the base message. */ diff --git a/jonah/lib/News.php b/jonah/lib/News.php index 12bf8fbbc..c18fb8192 100644 --- a/jonah/lib/News.php +++ b/jonah/lib/News.php @@ -627,10 +627,10 @@ class Jonah_News case 'richtext': /* Get a plain text version of a richtext story. */ $body_html = $story['story_body']; - $body_text = Horde_Text_Filter::filter($body_html, 'html2text'); + $body_text = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body_html, 'html2text'); /* Add description. */ - $body_html = '

' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "

\n" . $body_html; + $body_html = '

' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) . "

\n" . $body_html; $body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text; /* Add the text version of the story to the base message. */ @@ -763,7 +763,7 @@ class Jonah_News $items[$key]['story_body'] = isset($story['body']) ? Horde_String::convertCharset($story['body'], 'utf-8') : null; $items[$key]['story_body_type'] = isset($story['body_type']) ? Horde_String::convertCharset($story['body_type'], 'utf-8') : 'text'; if ($items[$key]['story_body_type'] == 'html') { - $items[$key]['story_body'] = Horde_Text_Filter::filter($items[$key]['story_body'], 'xss'); + $items[$key]['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($items[$key]['story_body'], 'xss'); } if (isset($story['pubdate']) && $pubdate_dt = strtotime($story['pubdate'])) { diff --git a/jonah/stories/pdf.php b/jonah/stories/pdf.php index d29a80d09..62baf087a 100644 --- a/jonah/stories/pdf.php +++ b/jonah/stories/pdf.php @@ -43,7 +43,7 @@ if (is_a($story, 'PEAR_Error')) { // Convert the body from HTML to text if necessary. if (!empty($story['story_body_type']) && $story['story_body_type'] == 'richtext') { - $story['story_body'] = Horde_Text_Filter::filter($story['story_body'], 'html2text'); + $story['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'html2text'); } // Set up the PDF object. diff --git a/jonah/stories/view.php b/jonah/stories/view.php index 176926b79..62e20618e 100644 --- a/jonah/stories/view.php +++ b/jonah/stories/view.php @@ -59,7 +59,7 @@ foreach ($story['story_tags'] as $id => $tag) { $story['story_title'] = htmlspecialchars($story['story_title']); $story['story_desc'] = htmlspecialchars($story['story_desc']); if (!empty($story['story_body_type']) && $story['story_body_type'] == 'text') { - $story['story_body'] = Horde_Text_Filter::filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $story['story_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); } if (!empty($story['story_url'])) { $story['story_body'] .= "\n

" . Horde::link(Horde::externalUrl($story['story_url'])) . htmlspecialchars($story['story_url']) . '

'; diff --git a/kronolith/templates/itip/notification.html.php b/kronolith/templates/itip/notification.html.php index 12fea806d..9f0c951c3 100644 --- a/kronolith/templates/itip/notification.html.php +++ b/kronolith/templates/itip/notification.html.php @@ -22,7 +22,7 @@ event->description)): ?>
- + attendees): ?> diff --git a/kronolith/templates/view/view.inc b/kronolith/templates/view/view.inc index 0ed31b618..97d4ffb5d 100644 --- a/kronolith/templates/view/view.inc +++ b/kronolith/templates/view/view.inc @@ -4,7 +4,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -153,7 +153,7 @@ if ($this->event->initialized && $this->event->alarm > 0): - + diff --git a/luxor/lib/Lang/Generic.php b/luxor/lib/Lang/Generic.php index 1aee6cfbf..bc39e2e7f 100644 --- a/luxor/lib/Lang/Generic.php +++ b/luxor/lib/Lang/Generic.php @@ -170,7 +170,7 @@ class Luxor_Lang_Generic extends Luxor_Lang global $index, $sourceid; // Make sure spacing is correct. - $code = Horde_Text_Filter::filter($code, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); + $code = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($code, 'space2html', array('encode' => true, 'encode_all' => true)); // Split all the symbols. preg_match_all('/(^|[^\w\#&])([\w~][\w]*)\b/', $code, $match); diff --git a/luxor/lib/Luxor.php b/luxor/lib/Luxor.php index b8667b047..75520572a 100644 --- a/luxor/lib/Luxor.php +++ b/luxor/lib/Luxor.php @@ -193,7 +193,7 @@ class Luxor file_exists($filename = $files->toReal($path . '/README.txt'))) { $contents = file_get_contents($filename); - return $table_head . Horde_Text_Filter::filter($contents, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . $table_foot; + return $table_head . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($contents, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . $table_foot; } elseif ($filename = file_exists($files->toReal($path . '/README.html'))) { global $mime_drivers, $mime_drivers_map; $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'horde'); @@ -360,7 +360,7 @@ class Luxor $res = ''; foreach ($lines as $line) { $res .= !empty($res) ? "\n" : ''; - $res .= $pre . Horde_Text_Filter::filter($line, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . $post; + $res .= $pre . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($line, 'space2html', array('encode' => true, 'encode_all' => true)) . $post; } return $res; } diff --git a/mnemo/lib/Block/note.php b/mnemo/lib/Block/note.php index 1ccee2027..1a7d69340 100644 --- a/mnemo/lib/Block/note.php +++ b/mnemo/lib/Block/note.php @@ -11,7 +11,7 @@ class Horde_Block_Mnemo_note extends Horde_Block { protected $_app = 'mnemo'; private $_notename = ''; - + protected function _params() { global $prefs; @@ -40,7 +40,7 @@ class Horde_Block_Mnemo_note extends Horde_Block { $memo = $this->_getNote(); $html = '
'; - $body = Horde_Text_Filter::filter($memo['body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); + $body = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($memo['body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); try { $body = Horde::callHook('format_description', array($body), 'mnemo', $body); } catch (Horde_Exception_HookNotSet $e) {} diff --git a/mnemo/templates/view/memo.inc b/mnemo/templates/view/memo.inc index bac661f39..3bb3ffea4 100644 --- a/mnemo/templates/view/memo.inc +++ b/mnemo/templates/view/memo.inc @@ -56,7 +56,7 @@ if (!$print_view) {
- Horde_Text_Filter_Text2html::MICRO, 'class' => null)); try { $body = Horde::callHook('format_description', array($body), 'mnemo', $body); } catch (Horde_Exception_HookNotSet $e) {} echo $body; ?> + getInstance('Horde_Text_Filter')->filter($memo['body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); try { $body = Horde::callHook('format_description', array($body), 'mnemo', $body); } catch (Horde_Exception_HookNotSet $e) {} echo $body; ?>
diff --git a/nag/lib/Task.php b/nag/lib/Task.php index 598d3b706..b87f31619 100644 --- a/nag/lib/Task.php +++ b/nag/lib/Task.php @@ -423,7 +423,7 @@ class Nag_Task { */ function getFormattedDescription() { - $desc = Horde_Text_Filter::filter($this->desc, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); + $desc = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->desc, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); try { return Horde::callHook('format_description', array($desc), 'nag'); } catch (Horde_Exception_HookNotSet $e) { diff --git a/whups/lib/Renderer/Comment.php b/whups/lib/Renderer/Comment.php index d60f5b60c..d764a0d62 100755 --- a/whups/lib/Renderer/Comment.php +++ b/whups/lib/Renderer/Comment.php @@ -140,9 +140,9 @@ class Horde_Form_Renderer_Comment extends Horde_Form_Renderer { $flowed = new Horde_Text_Flowed($comment); $flowed->setDelSp(true); $comment = $flowed->toFlowed(false); - $comment = Horde_Text_Filter::filter( + $comment = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter( $comment, array('text2html', 'simplemarkup', 'highlightquotes'), - array(array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null), + array(array('parselevel' => Horde_Text_Filter_Text2html::MICRO), array(), array())); if ($prefs->getValue('autolink_tickets') && $conf['prefs']['autolink_terms']) { -- 2.11.0
event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => $GLOBALS['registry']->getCharset())) ?>getInstance('Horde_Text_Filter')->filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) ?>
   Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?> getInstance('Horde_Text_Filter')->filter($location, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?>
  getInstance('Horde_Text_Filter')->filter($eventurl, 'linkurls') ?>
Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?>getInstance('Horde_Text_Filter')->filter($description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?>