$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);
}
/**
$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);
}
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;
}
}
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);
? 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));
$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']) {
<?php if ($gallery->get('desc')): ?>
<p class="box">
- <?php echo Horde_Text_Filter::filter($gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</p>
<?php endif; ?>
<?php echo '<img src="' . $image_src . '" id="edit_image" alt="[image]" />' ?>
</div>
<br />
- <?php $caption = $image->caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php $caption = $image->caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<div style="text-align:center;width:25%;float:left;position:relative;">
<form method="post" action="<?php echo $imageurl->copy()->add('actionID', 'previewcrop');?>">
<div style="text-align: center;">
<?php echo '<img src="' . $image_src . '" id="edit_image" alt="[image]" />' ?>
<br />
- <?php $caption = $image->caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php $caption = $image->caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<div align="center">
<?php echo '<img src="' . $image_url . '" alt="[preview]" />'?>
<br />
-<?php $caption = $image->caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+<?php $caption = $image->caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<div align="center">
<?php echo '<img src="' . $image_url . '" alt="[preview]" />' ?>
<br />
-<?php $caption = $image->caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+<?php $caption = $image->caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<div style="width: 100%;float:left;text-align: center;padding-top:10px;">
<?php echo '<img src="' . $image_src . '" id="edit_image" alt="[image]" />' ?>
<br />
- <?php $caption = $image->caption ? $image->caption : $image->filename; echo Horde_Text_Filter::filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php $caption = $image->caption ? $image->caption : $image->filename; echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
</div>
<?php if ($this->view->gallery->get('desc')): ?>
<div id="galleryDescription" class="gallery-desc">
- <?php echo Horde_Text_Filter::filter($this->view->gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->view->gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<?php endif; ?>
<table cellspacing="0" width="100%">
</div>
<?php if ($this->view->gallery->get('desc')): ?>
<div class="gallery-desc" id="galleryDescription">
-<?php echo Horde_Text_Filter::filter($this->view->gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+<?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->view->gallery->get('desc'), 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</div>
<?php endif;?>
<table width="100%" cellspacing="0">
<?php echo Horde::img('blank.gif', '', array('id' => 'photodiv', 'width' => $this->_geometry['width'], 'height' => $this->_geometry['height'])) ?>
<div id="CaptionContainer" style="width:<?php echo $this->_geometry['width']?>px;">
<p id="Caption" style="display:none;">
- <?php echo Horde_Text_Filter::filter($this->resource->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
+ <?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->resource->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) ?>
</p>
</div>
</div>
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('<a href="%s">%s</a> | <a href="%s">%s</a>',
Chora::url('co', $where, array('r' => $rev)), _("View"),
Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download"));
}
$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';
}
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 '</tbody>';
$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) {
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';
$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();
$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';
if (!empty($onb)) {
$url = Horde_Util::addParameter($url, array('onb' => $onb));
}
- $bar .= '/ <a href="' . $url . '">'. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . '</a> ';
+ $bar .= '/ <a href="' . $url . '">' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($dir, 'space2html', array('encode' => true, 'encode_all' => true)) . '</a> ';
}
}
*/
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
}
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';
if (strpos($mime_type, 'text/plain') !== false) {
$data = $pretty->render('inline');
$data = reset($data);
- echo '<div class="fixed">' . Horde_Text_Filter::filter($data['data'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . '</div>';
+ echo '<div class="fixed">' . $GLOBALS['injector']->getInstance('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')) {
$profile = unserialize($profile);
} else {
-
// Load profile
$profile = $this->_getProfile($user);
if ($profile instanceof PEAR_Error) {
$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) {
$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) {
private function _formatBody($subject, $body)
{
return '<b>' . $subject . ':</b> '
- . 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));
}
}
/* 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";
}
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');
$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;
--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Core
+ */
+class Horde_Core_Binder_TextFilter implements Horde_Injector_Binder
+{
+ public function create(Horde_Injector $injector)
+ {
+ return new Horde_Core_Factory_TextFilter($injector);
+ }
+
+ public function equals(Horde_Injector_Binder $binder)
+ {
+ return false;
+ }
+}
--- /dev/null
+<?php
+/**
+ * A Horde_Injector:: based Horde_Text_Filter_Base:: factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @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 <slusarz@horde.org>
+ * @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);
+ }
+
+}
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);
$href = '#';
$onclick = ' onclick="' . substr($url, 11) . ';return false;"';
} else {
- $href = $url;
+ $href = htmlspecialchars($url);
$onclick = '';
}
? ''
: ' class="' . $this->_params['class'] . '"';
- return $matches[1] . $matches[2] . $matches[9] . '<a' . $class .
- ' href="' . $href . '"' . $onclick . '>' .
- htmlspecialchars($email) . $args_long
- . '</a>' . $matches[8] . $matches[4] . ($matches[14] ? '>' : '');
+ return '<a' . $class .' href="' . $href . '"' . $onclick . '>' .
+ htmlspecialchars($email) . htmlspecialchars($args_long) .
+ '</a>';
}
}
'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(),
/* 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) {}
}
<file name="SessionHandler.php" role="php" />
<file name="Share.php" role="php" />
<file name="Template.php" role="php" />
+ <file name="TextFilter.php" role="php" />
<file name="Token.php" role="php" />
<file name="Tree.php" role="php" />
<file name="Twitter.php" role="php" />
<file name="LoginTasks.php" role="php" />
<file name="Request.php" role="php" />
<file name="Share.php" role="php" />
+ <file name="TextFilter.php" role="php" />
<file name="Tree.php" role="php" />
<file name="Vfs.php" role="php" />
</dir> <!-- /lib/Horde/Core/Factory -->
<install as="Horde/Core/Binder/SessionHandler.php" name="lib/Horde/Core/Binder/SessionHandler.php" />
<install as="Horde/Core/Binder/Share.php" name="lib/Horde/Core/Binder/Share.php" />
<install as="Horde/Core/Binder/Template.php" name="lib/Horde/Core/Binder/Template.php" />
+ <install as="Horde/Core/Binder/TextFilter.php" name="lib/Horde/Core/Binder/TextFilter.php" />
<install as="Horde/Core/Binder/Tree.php" name="lib/Horde/Core/Binder/Tree.php" />
<install as="Horde/Core/Binder/Token.php" name="lib/Horde/Core/Binder/Token.php" />
<install as="Horde/Core/Binder/Twitter.php" name="lib/Horde/Core/Binder/Twitter.php" />
<install as="Horde/Core/Factory/LoginTasks.php" name="lib/Horde/Core/Factory/LoginTasks.php" />
<install as="Horde/Core/Factory/Request.php" name="lib/Horde/Core/Factory/Request.php" />
<install as="Horde/Core/Factory/Share.php" name="lib/Horde/Core/Factory/Share.php" />
+ <install as="Horde/Core/Factory/TextFilter.php" name="lib/Horde/Core/Factory/TextFilter.php" />
<install as="Horde/Core/Factory/Tree.php" name="lib/Horde/Core/Factory/Tree.php" />
<install as="Horde/Core/Factory/Vfs.php" name="lib/Horde/Core/Factory/Vfs.php" />
<install as="Horde/Core/Log/Logger.php" name="lib/Horde/Core/Log/Logger.php" />
$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);
}
}
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':
/**
* 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.
*/
$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) {
{
$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] : '');
}
/**
$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] . '<a' . $class . ' href="mailto:' . $matches[3] . $matches[5] . '">' . $matches[3] . $matches[5] . '</a>' . $matches[4] . $matches[8]
- : (($matches[9] == '<') ? '<' : $matches[9]) . '<a' . $class . ' href="mailto:' . $matches[10] . $matches[11] . '">' . $matches[10] . $matches[11] . '</a>' . ($matches[14] ? '>' : '');
+ return '<a' . $class . ' href="mailto:' . htmlspecialchars($email) . '">' . htmlspecialchars($email) . '</a>';
}
/**
*
* Parameters:
* <pre>
- * 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)
* </pre>
*
* <pre>
* @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
);
/**
}
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));
}
$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 ---> <br /> substitution. Everybody gets this; if
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--
. $this->_params['offend']
. ' ' . implode(' ', $this->_params['fortune']);
return '<span class="fixed"><small>'
- . 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))))
. '</small></span>';
} else {
return '';
. Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;'));
$html .= '<div id="currentStatus" class="" style="margin: 10px;"><strong>' . _("Latest") . '</strong> ' . $latestStatus . ' - <span class="fbstreaminfo">' . Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")) . '</span></div></div>';
$html .= '<div style="height:' . (empty($this->_params['height']) ? 350 : $this->_params['height']) . 'px;overflow-y:auto;" id="twitter_body' . $instance . '">';
- $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 .= '</div>';
$html .= '<div class="control fbgetmore"><a href="#" onclick="Horde.twitter.getOlderEntries();return false;">' . _("Get More") . '</a></div>';
$html .= '</div>';
} 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());
$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-_]+)/", "<a href=\"http://twitter.com/\\1\" target=\"_blank\">\\0</a>", $body);
/* If this is a retweet, use the original author's profile info */
$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');
if (type == 'emoticons') {
row = document.createElement('TR');
cell = document.createElement('TD');
- <?php $filter = Horde_Text_Filter::factory('emoticons'); $icons = array_flip($filter->getIcons()); foreach ($icons as $icon => $string): ?>
+ <?php $filter = $GLOBALS['injector']->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() {
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). */
}
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) {}
$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));
}
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';
}
*/
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));
}
/**
$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;
: $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'])
);
$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))
);
$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
);
}
$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
);
}
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;
* 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(
}
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(
'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))
)
);
}
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);
// Escape text
$filters = array(
'text2html' => array(
- 'charset' => $GLOBALS['registry']->getCharset(),
'parselevel' => Horde_Text_Filter_Text2html::MICRO
),
'tabs2spaces' => array(),
);
return '<div class="fixed">' .
- 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)) .
' [...]</div>';
}
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)));
}
}
}
- $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;
}
$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);
}
}
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;
}
*/
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
));
}
}
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
));
}
$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,
}
}
- 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);
}
}
$label = $mbox['abbrev'];
$text .= sprintf('<option%s value="%s"%s>%s</option>%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 . '</select>';
$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);
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'];
}
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'];
}
$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'];
}
}
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 '<p class="storySubtitle">' . 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));
}
$tag_html = array();
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 = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
+ $body_html = '<p>' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) . "</p>\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. */
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 = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
+ $body_html = '<p>' . $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) . "</p>\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. */
$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'])) {
// 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.
$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<p>" . Horde::link(Horde::externalUrl($story['story_url'])) . htmlspecialchars($story['story_url']) . '</a></p>';
<?php if (strlen($this->event->description)): ?>
<tr>
<td style="font-weight:bold;vertical-align:top"><?php echo _("Description:") ?></td>
- <td><?php echo Horde_Text_Filter::filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => $GLOBALS['registry']->getCharset())) ?></td>
+ <td><?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null)) ?></td>
</tr>
<?php endif; ?>
<?php if ($this->attendees): ?>
<!-- location -->
<tr>
<td class="rightAlign"><strong><?php echo _("Location") ?> </strong></td>
- <td><?php echo empty($location) ? ' ' : Horde_Text_Filter::filter($location, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?> </td>
+ <td><?php echo empty($location) ? ' ' : $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($location, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?> </td>
</tr>
<?php endif; ?>
<!-- url -->
<tr>
<td class="rightAlign"><strong><?php echo _("URL") ?> </strong></td>
- <td><?php echo Horde_Text_Filter::filter($eventurl, 'linkurls') ?></td>
+ <td><?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($eventurl, 'linkurls') ?></td>
</tr>
<?php endif; ?>
<td colspan="2" class="control"><strong><?php echo _("Description") ?></strong></td>
</tr>
<tr>
- <td colspan="2" class="description"><?php echo Horde_Text_Filter::filter($description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?></td>
+ <td colspan="2" class="description"><?php echo $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => 'text')) ?></td>
</tr>
<?php endif; ?>
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);
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');
$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;
}
{
protected $_app = 'mnemo';
private $_notename = '';
-
+
protected function _params()
{
global $prefs;
{
$memo = $this->_getNote();
$html = '<div class="noteBody">';
- $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) {}
</div>
<?php else: ?>
<div class="noteBody">
- <?php $body = Horde_Text_Filter::filter($memo['body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); try { $body = Horde::callHook('format_description', array($body), 'mnemo', $body); } catch (Horde_Exception_HookNotSet $e) {} echo $body; ?>
+ <?php $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) {} echo $body; ?>
</div>
<?php endif; ?>
</td>
*/
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) {
$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']) {