Text_Filter:: -> Horde_Text_Filter::
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Jun 2009 07:37:36 +0000 (01:37 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Jun 2009 17:18:45 +0000 (11:18 -0600)
19 files changed:
chora/lib/Chora.php
chora/templates/checkout/checkout.inc
folks/lib/Driver.php
folks/lib/Forms/Activity.php
folks/lib/Notification/facebook.php
imp/ajax.php
imp/compose.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/IMP.php
imp/lib/Mime/Viewer/Html.php
imp/lib/Mime/Viewer/Pgp.php
imp/lib/Mime/Viewer/Plain.php
imp/lib/UI/Message.php
imp/lib/Views/Compose.php
imp/mailbox.php
imp/stationery.php
kronolith/lib/Views/Event.php
kronolith/templates/view/view.inc

index fcecc83..fb0e1c9 100644 (file)
@@ -610,9 +610,7 @@ class Chora
      */
     static public function formatLogMessage($log)
     {
-        require_once 'Horde/Text/Filter.php';
-
-        $log = Text_Filter::filter($log, 'text2html', array('parselevel' => TEXT_HTML_MICRO, 'charset' => NLS::getCharset(), 'class' => ''));
+        $log = Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => NLS::getCharset(), 'class' => ''));
 
         return (empty($GLOBALS['conf']['tickets']['regexp']) || empty($GLOBALS['conf']['tickets']['replacement']))
             ? $log
index 948a129..5055aeb 100644 (file)
@@ -21,7 +21,7 @@
 if (strpos($mime_type, 'text/plain') !== false) {
     $data = $pretty->render('inline');
     $data = reset($data);
-    echo '<div class="fixed">' . Text_Filter::filter($data['data'], 'text2html', array('parselevel' => TEXT_HTML_MICRO)) . '</div>';
+    echo '<div class="fixed">' . Horde_Text_Filter::filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '</div>';
 } elseif (strpos($mime_type, 'image/') !== false) {
     echo Horde::img(Horde_Util::addParameter(Horde::selfUrl(true), 'p', 1), '', '', '');
 } elseif ($pretty->canRender('inline')) {
index c76fda3..ee2800c 100644 (file)
@@ -350,19 +350,18 @@ class Folks_Driver {
             }
 
             // Filter description
-            require_once 'Horde/Text/Filter.php';
             $filters = array('text2html', 'bbcode', 'highlightquotes', 'emoticons');
-            $filters_params = array(array('parselevel' => TEXT_HTML_MICRO),
+            $filters_params = array(array('parselevel' => Horde_Text_Filter_Text2html::MICRO),
                                     array(),
                                     array(),
                                     array());
 
             if (($hasBBcode = strpos($profile['user_description'], '[')) !== false &&
                     strpos($profile['user_description'], '[/', $hasBBcode) !== false) {
-                $filters_params[0]['parselevel'] = TEXT_HTML_NOHTML;
+                $filters_params[0]['parselevel'] = Horde_Text_Filter_Text2html::NOHTML;
             }
 
-            $profile['user_description'] = Text_Filter::filter(trim($profile['user_description']), $filters, $filters_params);
+            $profile['user_description'] = Horde_Text_Filter::filter(trim($profile['user_description']), $filters, $filters_params);
 
             // Get user last external data
             foreach ($profile as $key => $value) {
index 85113c0..e031a71 100644 (file)
@@ -37,19 +37,18 @@ class Folks_Activity_Form extends Horde_Form {
             return PEAR::raiseError(_("You cannot post an empty activity message."));
         }
 
-        require_once 'Horde/Text/Filter.php';
         $filters = array('text2html', 'bbcode', 'highlightquotes', 'emoticons');
-        $filters_params = array(array('parselevel' => TEXT_HTML_MICRO),
+        $filters_params = array(array('parselevel' => Horde_Text_Filter_Text2html::MICRO),
                                 array(),
                                 array(),
                                 array());
 
         if (($hasBBcode = strpos($message, '[')) !== false &&
                 strpos($message, '[/', $hasBBcode) !== false) {
-            $filters_params[0]['parselevel'] = TEXT_HTML_NOHTML;
+            $filters_params[0]['parselevel'] = Horde_Text_Filter_Text2html::NOHTML;
         }
 
-        $message = Text_Filter::filter(trim($message), $filters, $filters_params);
+        $message = Horde_Text_Filter::filter(trim($message), $filters, $filters_params);
 
         $result = $GLOBALS['folks_driver']->logActivity($message, 'folks:custom');
         if ($result instanceof PEAR_Error) {
index 2a9a4bd..fbc82bc 100644 (file)
@@ -157,9 +157,7 @@ class Folks_Notification_facebook extends Folks_Notification {
      */
     private function _formatBody($subject, $body)
     {
-        require_once 'Horde/Text/Filter.php';
-
         return '<b>' . $subject . ':</b> '
-                . Text_Filter::filter($body, 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL));
+                . Horde_Text_Filter::filter($body, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL));
     }
 }
index a9b900a..7ddc147 100644 (file)
@@ -471,17 +471,15 @@ case 'ShowPreview':
     break;
 
 case 'Html2Text':
-    require_once 'Horde/Text/Filter.php';
     $result = new stdClass;
     // Need to replace line endings or else IE won't display line endings
     // properly.
-    $result->text = str_replace("\n", "\r\n", Text_Filter::filter(Horde_Util::getPost('text'), 'html2text'));
+    $result->text = str_replace("\n", "\r\n", Horde_Text_Filter::filter(Horde_Util::getPost('text'), 'html2text'));
     break;
 
 case 'Text2Html':
-    require_once 'Horde/Text/Filter.php';
     $result = new stdClass;
-    $result->text = Text_Filter::filter(Horde_Util::getPost('text'), 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL, 'class' => null, 'callback' => null));
+    $result->text = Horde_Text_Filter::filter(Horde_Util::getPost('text'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'class' => null, 'callback' => null));
     break;
 
 case 'GetForwardData':
index b4e82bf..10d6ce1 100644 (file)
@@ -60,7 +60,6 @@ $compose_page = true;
 $session_control = 'netscape';
 require_once dirname(__FILE__) . '/lib/base.php';
 require_once 'Horde/Identity.php';
-require_once 'Horde/Text/Filter.php';
 
 /* The message text. */
 $msg = '';
@@ -683,7 +682,7 @@ if (!is_null($oldrtemode) && ($oldrtemode != $rtemode)) {
                            array('<p>&nbsp;</p>', '<p class="imp-signature"><!--begin_signature-->' . $imp_compose->text2html($sig) . '<!--end_signature--></p>'),
                            $msg);
     } else {
-        $msg = Text_Filter::filter($msg, 'html2text');
+        $msg = Horde_Text_Filter::filter($msg, 'html2text');
     }
 }
 
@@ -799,7 +798,7 @@ if (!$redirect) {
     foreach ($identity->getAllSignatures() as $ident => $sig) {
         $smf = $identity->getValue('sent_mail_folder', $ident);
         $js_ident[] = array(
-            ($rtemode) ? str_replace(' target="_blank"', '', Text_Filter::filter($sig, 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL, 'class' => null, 'callback' => null))) : $sig,
+            ($rtemode) ? str_replace(' target="_blank"', '', Horde_Text_Filter::filter($sig, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'class' => null, 'callback' => null))) : $sig,
             $identity->getValue('sig_first', $ident),
             ($smf_check) ? $smf : IMP::displayFolder($smf),
             $identity->saveSentmail($ident),
index 0edc508..a68974d 100644 (file)
@@ -917,8 +917,7 @@ class IMP_Compose
 
         if (!empty($options['html'])) {
             $body_html = $body;
-            require_once 'Horde/Text/Filter.php';
-            $body = Text_Filter::filter($body, 'html2text', array('wrap' => false, 'charset' => $charset));
+            $body = Horde_Text_Filter::filter($body, 'html2text', array('wrap' => false, 'charset' => $charset));
         }
 
         /* Get trailer message (if any). */
@@ -934,8 +933,7 @@ class IMP_Compose
             }
 
             if (!empty($trailer_file)) {
-                require_once 'Horde/Text/Filter.php';
-                $trailer = Text_Filter::filter("\n" . file_get_contents($trailer_file), 'environment');
+                $trailer = Horde_Text_Filter::filter("\n" . file_get_contents($trailer_file), 'environment');
                 /* If there is a user defined function, call it with the
                  * current trailer as an argument. */
                 if (!empty($GLOBALS['conf']['hooks']['trailer'])) {
@@ -2213,11 +2211,9 @@ class IMP_Compose
         }
 
         if ($mode == 'html') {
-            require_once 'Horde/Text/Filter.php';
-            $msg = Text_Filter::filter($msg, 'xss', array('body_only' => true, 'strip_styles' => true, 'strip_style_attributes' => false));
+            $msg = Horde_Text_Filter::filter($msg, 'xss', array('body_only' => true, 'strip_styles' => true, 'strip_style_attributes' => false));
         } elseif ($type == 'text/html') {
-            require_once 'Horde/Text/Filter.php';
-            $msg = Text_Filter::filter($msg, 'html2text', array('charset' => $charset));
+            $msg = Horde_Text_Filter::filter($msg, 'html2text', array('charset' => $charset));
             $type = 'text/plain';
         }
 
@@ -2375,8 +2371,7 @@ class IMP_Compose
      */
     public function text2html($msg)
     {
-        require_once 'Horde/Text/Filter.php';
-        return Text_Filter::filter($msg, 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL, 'class' => null, 'callback' => null));
+        return Horde_Text_Filter::filter($msg, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'class' => null, 'callback' => null));
     }
 
     /**
index bbc4cfa..0f341fa 100644 (file)
@@ -469,9 +469,7 @@ class IMP_Contents
         $ptext = $pmime->getContents();
         $ptext = Horde_String::convertCharset($ptext, $pmime->getCharset());
         if ($pmime->getType() == 'text/html') {
-            require_once 'Horde/Text/Filter.php';
-            $ptext = Text_Filter::filter($ptext, 'html2text',
-                                         array('charset' => NLS::getCharset()));
+            $ptext = Horde_Text_Filter::filter($ptext, 'html2text', array('charset' => NLS::getCharset()));
         }
 
         $this->_build = $oldbuild;
index 45b8303..aa4e389 100644 (file)
@@ -508,8 +508,7 @@ class IMP
         global $conf, $prefs;
 
         if ($prefs->getValue('filtering') && strlen($text)) {
-            require_once 'Horde/Text/Filter.php';
-            $text = Text_Filter::filter($text, 'words', array('words_file' => $conf['msgsettings']['filtering']['words'], 'replacement' => $conf['msgsettings']['filtering']['replacement']));
+            $text = Horde_Text_Filter::filter($text, 'words', array('words_file' => $conf['msgsettings']['filtering']['words'], 'replacement' => $conf['msgsettings']['filtering']['replacement']));
         }
 
         return $text;
index f0e70ce..10dc519 100644 (file)
@@ -136,8 +136,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
 
         /* We are done processing if in mimp mode. */
         if ($_SESSION['imp']['view'] == 'mimp') {
-            require_once 'Horde/Text/Filter.php';
-            $data = Text_Filter::filter($data, 'html2text');
+            $data = Horde_Text_Filter::filter($data, 'html2text');
 
             // Filter bad language.
             return array('html' => IMP::filterText($data), 'status' => array());
@@ -231,9 +230,8 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
             }
         }
 
-        require_once 'Horde/Text/Filter.php';
         if ($GLOBALS['prefs']->getValue('emoticons')) {
-            $data = Text_Filter::filter($data, array('emoticons'), array(array('emoticons' => true)));
+            $data = Horde_Text_Filter::filter($data, array('emoticons'), array(array('emoticons' => true)));
         }
 
         return array(
index 4d05525..0656ce4 100644 (file)
@@ -360,11 +360,10 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver
                 $sig_text = $e->getMessage();
             }
 
-            require_once 'Horde/Text/Filter.php';
             $ret[$base_id]['status'][] = array(
                 'icon' => $icon,
                 'text' => array(
-                    Text_Filter::filter($sig_text, 'text2html', array('parselevel' => TEXT_HTML_NOHTML))
+                    Horde_Text_Filter::filter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter::Text2html::NOHTML))
                 )
             );
         } else {
index c1af81d..25f9757 100644 (file)
@@ -67,10 +67,9 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
         }
 
         // Build filter stack. Starts with HTML markup and tab expansion.
-        require_once 'Horde/Text/Filter.php';
         $filters = array(
             'text2html' => array(
-                'parselevel' => TEXT_HTML_MICRO,
+                'parselevel' => Horde_Text_Filter_Text2html::MICRO,
                 'charset' => NLS::getCharset()
             ),
             'tabs2spaces' => array(),
@@ -105,7 +104,7 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
         }
 
         // Run filters.
-        $text = Text_Filter::filter($text, array_keys($filters), array_values($filters));
+        $text = Horde_Text_Filter::filter($text, array_keys($filters), array_values($filters));
 
         // Wordwrap.
         $text = str_replace(array('  ', "\n "), array(' &nbsp;', "\n&nbsp;"), $text);
index b73b609..44645af 100644 (file)
@@ -229,8 +229,7 @@ class IMP_UI_Message
                 }
                 break;
             } else {
-                require_once 'Horde/Text/Filter.php';
-                if ($url = Text_Filter::filter($match, 'linkurls', array('callback' => 'Horde::externalUrl'))) {
+                if ($url = Horde_Text_Filter::filter($match, 'linkurls', array('callback' => 'Horde::externalUrl'))) {
                     if ($raw) {
                         return $match;
                     }
@@ -454,9 +453,7 @@ class IMP_UI_Message
      */
     public function getDisplaySubject($subject)
     {
-        require_once 'Horde/Text/Filter.php';
-
-        return Text_Filter::filter(IMP::filterText($subject), 'text2html', array('parselevel' => TEXT_HTML_MICRO, 'class' => null, 'callback' => null));
+        return Horde_Text_Filter::filter(IMP::filterText($subject), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null, 'callback' => null));
     }
 
 }
index e33cb2d..a08dd43 100644 (file)
@@ -46,14 +46,13 @@ class IMP_Views_Compose
         }
 
         /* Get user identities. */
-        require_once 'Horde/Text/Filter.php';
         $all_sigs = $identity->getAllSignatures();
         foreach ($all_sigs as $ident => $sig) {
             $identities[] = array(
                 // 0 = Plain text signature
                 $sig,
                 // 1 = HTML signature
-                str_replace(' target="_blank"', '', Text_Filter::filter($sig, 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL, 'class' => null, 'callback' => null))),
+                str_replace(' target="_blank"', '', Horde_Text_Filter::filter($sig, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL, 'class' => null, 'callback' => null))),
                 // 2 = Signature location
                 (bool)$identity->getValue('sig_first', $ident),
                 // 3 = Sent mail folder name
index bcb402d..a4025fb 100644 (file)
@@ -799,8 +799,7 @@ while (list(,$ob) = each($mbox_info['overview'])) {
             }
 
             if (!$preview_tooltip) {
-                require_once 'Horde/Text/Filter.php';
-                $ptext = Text_Filter::filter($ptext, 'text2html', array('parselevel' => TEXT_HTML_NOHTML, 'charset' => '', 'class' => ''));
+                $ptext = Horde_Text_Filter::filter($ptext, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML, 'charset' => '', 'class' => ''));
             }
 
             $maxlen = $prefs->getValue('preview_maxlen');
index 6c3f01d..f5e3b8d 100644 (file)
@@ -40,8 +40,7 @@ $name = Horde_Util::getFormData('name', '');
 $type = Horde_Util::getFormData('type', 'plain');
 if (!empty($last_type) && $last_type != $type) {
     if ($type == 'plain') {
-        require_once 'Horde/Text/Filter.php';
-        $content = Text_Filter::filter($content, 'html2text');
+        $content = Horde_Text_Filter::filter($content, 'html2text');
     } else {
         $content = nl2br(htmlspecialchars(htmlspecialchars($content)));
     }
index d493ea7..eaad30f 100644 (file)
@@ -39,8 +39,6 @@ class Kronolith_View_Event {
             return;
         }
 
-        require_once 'Horde/Text/Filter.php';
-
         $createdby = '';
         $modifiedby = '';
         $userId = Auth::getAuth();
index e96a7b4..e97680f 100644 (file)
@@ -4,7 +4,7 @@
 <!-- location -->
 <tr>
  <td class="rightAlign"><strong><?php echo _("Location") ?>&nbsp;&nbsp;</strong></td>
- <td><?php echo empty($location) ? '&nbsp;' : Text_Filter::filter($location, 'text2html', array('parselevel' => TEXT_HTML_MICRO, 'class' => 'text')) ?> </td>
+ <td><?php echo empty($location) ? '&nbsp;' : Horde_Text_Filter::filter($location, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?> </td>
 </tr>
 <?php endif; ?>
 
@@ -141,7 +141,7 @@ if ($this->event->isInitialized() && $this->event->alarm > 0):
  <td colspan="2" class="control"><strong><?php echo _("Description") ?></strong></td>
 </tr>
 <tr>
- <td colspan="2" class="description"><?php require_once 'Horde/Text/Filter.php'; echo Text_Filter::filter($description, 'text2html', array('parselevel' => TEXT_HTML_MICRO, 'class' => 'text')) ?></td>
+ <td colspan="2" class="description"><?php echo Horde_Text_Filter::filter($description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?></td>
 </tr>
 <?php endif; ?>