当前位置: 首页>>代码示例>>PHP>>正文


PHP JFilterOutput::cleanText方法代码示例

本文整理汇总了PHP中JFilterOutput::cleanText方法的典型用法代码示例。如果您正苦于以下问题:PHP JFilterOutput::cleanText方法的具体用法?PHP JFilterOutput::cleanText怎么用?PHP JFilterOutput::cleanText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFilterOutput的用法示例。


在下文中一共展示了JFilterOutput::cleanText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cText

 public static function cText($text, $limit, $type = 0)
 {
     //function to cut text
     $text = preg_replace('/<img[^>]+\\>/i', "", $text);
     if ($limit == 0) {
         //no limit
         $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>';
         $text = strip_tags($text, $allowed_tags);
         $text = $text;
     } else {
         if ($type == 1) {
             //character lmit
             $text = JFilterOutput::cleanText($text);
             $sep = strlen($text) > $limit ? '...' : '';
             $text = utf8_substr($text, 0, $limit) . $sep;
         } else {
             //word limit
             $text = JFilterOutput::cleanText($text);
             $text = explode(' ', $text);
             $sep = count($text) > $limit ? '...' : '';
             $text = implode(' ', array_slice($text, 0, $limit)) . $sep;
         }
     }
     return $text;
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:25,代码来源:common.php

示例2: stripText

 function stripText($text)
 {
     $text = str_replace(array("\r\n", "\n", "\r", "\t"), "", $text);
     $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
     $text = JFilterOutput::cleanText($text);
     $text = trim($text);
     return $text;
 }
开发者ID:kwizera05,项目名称:police,代码行数:8,代码来源:yoosearch.php

示例3: display

 /**
  * Display the view
  * 
  * 
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     // What Access Permissions does this user have? What can (s)he do?
     $this->canDo = jdownloadsHelper::getActions();
     // get filename when selected in files list
     $session = JFactory::getSession();
     $filename = $session->get('jd_filename');
     if ($filename) {
         $this->selected_filename = JFilterOutput::cleanText($filename);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     parent::display($tpl);
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:26,代码来源:view.html.php

示例4: __construct

 /**
  * Constructor
  *
  */
 function __construct()
 {
     parent::__construct();
     // Register Extra task
     $this->registerTask('apply', 'save');
     $this->registerTask('add', 'edit');
     $this->registerTask('download', 'download');
     $this->registerTask('delete', 'delete');
     $this->registerTask('deletepreview', 'deletepreview');
     $this->registerTask('create', 'add');
     // store filename in session when is selected in files list
     $jinput = JFactory::getApplication()->input;
     $filename = $jinput->get('file', '', 'string');
     $filename = JFilterOutput::cleanText($filename);
     $session = JFactory::getSession();
     if ($filename != '') {
         $session->set('jd_filename', $filename);
     } else {
         $session->set('jd_filename', '');
     }
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:25,代码来源:download.php

示例5: date

 if ($relDay > 0) {
     $eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " +{$relDay} days");
 } else {
     $eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " {$relDay} days");
 }
 $targetid = $this->modparams->get("target_itemid", 0);
 $link = $row->viewDetailLink(date("Y", $eventDate), date("m", $eventDate), date("d", $eventDate), false, $targetid);
 $link = str_replace("&tmpl=component", "", $link);
 $item_link = JRoute::_($link . $this->jeventCalObject->datamodel->getCatidsOutLink());
 // removes all formating from the intro text for the description text
 $item_description = $row->content();
 // remove dodgy border e.g. "diamond/question mark"
 $item_description = preg_replace('#border=[\\"\'][^0-9]*[\\"\']#i', '', $item_description);
 if ($this->info['limit_text']) {
     if ($this->info['text_length']) {
         $item_description = JFilterOutput::cleanText($item_description);
         // limits description text to x words
         $item_description_array = explode(' ', $item_description);
         $count = count($item_description_array);
         if ($count > $this->info['text_length']) {
             $item_description = '';
             for ($a = 0; $a < $this->info['text_length']; $a++) {
                 $item_description .= $item_description_array[$a] . ' ';
             }
             $item_description = trim($item_description);
             $item_description .= '...';
         }
     } else {
         // do not include description when text_length = 0
         $item_description = NULL;
     }
开发者ID:poorgeek,项目名称:JEvents,代码行数:31,代码来源:rss.php

示例6:

								<?php 
        echo $row->title;
        ?>
</a>
						<?php 
    }
    ?>
					</td>
					
					<td align="center"><?php 
    echo $row->username;
    ?>
</td>
					
					<td align="left"><?php 
    $row->content = JFilterOutput::cleanText(strip_tags($row->content));
    echo PhocaguestbookHelper::wordDelete($row->content, 60, '...');
    ?>
</td>
					
					<td align="center"><?php 
    echo $row->ip;
    ?>
</td>
					
					<td align="center"><?php 
    echo $published;
    ?>
</td>
					<td class="order">
						<span><?php 
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:31,代码来源:default.php

示例7: prepareData

	private function prepareData( $type = 'new', $options )
	{
		Komento::import( 'helper', 'date' );

		$data							= array();

		if( $type === 'confirm' )
		{
			$subscribeTable = Komento::getTable( 'subscription' );
			$subscribeTable->load( $options['subscribeId'] );

			$profile = Komento::getProfile( $subscribeTable->userid );
		}
		else
		{
			$profile	= Komento::getProfile( $options['comment']->created_by );

			$data['contentTitle']			= $options['comment']->contenttitle;
			$data['contentPermalink']		= $options['comment']->pagelink;
			$data['commentAuthorName']		= $options['comment']->name;
			$data['commentAuthorAvatar']	= $profile->getAvatar();
		}

		$config 					= Komento::getConfig();

		switch( $type )
		{
			case 'confirm':
				$data['confirmLink']	= rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=confirmSubscription&id=' . $options['subscribeId'];
				break;
			case 'pending':
			case 'moderate':
				$hashkeys = Komento::getTable( 'hashkeys' );
				$hashkeys->uid = $options['comment']->id;
				$hashkeys->type = 'comment';
				$hashkeys->store();
				$key = $hashkeys->key;

				$data['approveLink']	= rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=approveComment&token=' . $key;
				$data['commentContent']	= JFilterOutput::cleanText($options['comment']->comment);
				$date					= KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
				$date					= KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
				$data['commentDate']	= $date;
				break;
			case 'report':
				$action = Komento::getTable( 'actions' );
				$action->load( $options['actionId'] );
				$actionUser = $action->action_by;

				$data['actionUser']			= Komento::getProfile( $actionUser );
				$data['commentPermalink']	= $data['contentPermalink'] . '#kmt-' . $options['comment']->id;
				$data['commentContent']		= JFilterOutput::cleanText($options['comment']->comment);
				$date						= KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
				$date						= KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
				$data['commentDate']		= $date;
				break;
			case 'reply':
			case 'comment':
			case 'new':
			default:
				$data['commentPermalink']	= $data['contentPermalink'] . '#kmt-' . $options['comment']->id;
				$data['commentContent']		= JFilterOutput::cleanText($options['comment']->comment);
				$date						= KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate );
				$date						= KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) );
				$data['commentDate']		= $date;
				$data['unsubscribe'] 		= rtrim( JURI::root(), '/' ) . '/index.php?option=com_komento&task=unsubscribe&id=';
				break;
		}

		return $data;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:71,代码来源:notification.php

示例8: testCleanText

 /**
  * Execute a cleanText test case.
  *
  * @param string $data   The original output
  * @param string $expect The expected result for this test.
  *
  * @return void
  *
  * @dataProvider casesCleanText
  */
 function testCleanText($data, $expect)
 {
     $this->markTestSkipped('Why are we calling JFilterOutput in JFilterInputTest?');
     $this->assertThat($expect, $this->equalTo(JFilterOutput::cleanText($data)));
 }
开发者ID:Radek-Suski,项目名称:joomla-platform,代码行数:15,代码来源:JFilterInputTest.php

示例9: getLayoutOutput

 function getLayoutOutput(&$items)
 {
     $layout = '';
     $layout_path = dirname(__FILE__) . DS . 'layouts' . DS;
     $layout_file = @fopen($layout_path . $this->_params->layout . '.ini', 'r');
     if ($layout_file) {
         while (!feof($layout_file)) {
             $layout .= fread($layout_file, 1024);
         }
     }
     if (!$layout) {
         $layout_file = @fopen($layout_path . 'default.ini', 'r');
         if ($layout_file) {
             while (!feof($layout_file)) {
                 $layout .= fread($layout_file, 1024);
             }
         }
     }
     if (!$layout) {
         return '<!-- CustoMenu: No layout file found: /modules/mod_customenu/customenu/layouts/' . $this->_params->layout . '.ini' . '--->';
     }
     $html = $layout;
     // remove comments
     $html = preg_replace('#\\s*/\\*.*?\\*/\\s*#s', '', $html);
     // remove redundant whitespace (space between html tags and dynamic tags)
     $html = preg_replace('#>\\s+<#s', '><', $html);
     $html = preg_replace('#>\\s+{#s', '>{', $html);
     $html = preg_replace('#}\\s+<#s', '}<', $html);
     // remove leading / trailing whitespace
     $html = trim($html);
     // match the menu items part
     preg_match('#{items}(.*?){/items}#s', $html, $layout_item);
     $html_items = '';
     foreach ($items as $item_nr => $item) {
         $html_item = $layout_item['1'];
         $html_item = str_replace('{item_nr}', $item_nr, $html_item);
         $link = JFilterOutput::ampReplace($item->link);
         $link_href = 'href="' . $link . '"';
         if ($item->target) {
             $target = '_blank';
             $link_href .= ' target="_blank"';
             $link_onclick = 'onclick="window.open(\'' . $link . '\');"';
         } else {
             $target = '';
             $link_onclick = 'onclick="location.href=\'' . $link . '\';"';
         }
         $html_item = str_replace('{item_link}', $link, $html_item);
         $html_item = str_replace('{item_link_href}', $link_href, $html_item);
         $html_item = str_replace('{item_link_onclick}', $link_onclick, $html_item);
         $html_item = str_replace('{item_target}', $target, $html_item);
         $html_item = str_replace('{item_target_bool}', $item->target, $html_item);
         $text = $item->text;
         if ($item->hide_text) {
             $text = '<p style="text-indent: -9000px;">' . $text . '</p>';
         }
         $html_item = str_replace('{item_text}', $text, $html_item);
         $html_item = str_replace('{item_title}', JFilterOutput::cleanText($item->text), $html_item);
         $html_item = str_replace('{item_class}', $item->class, $html_item);
         $html_item = str_replace('{item_active}', $item->active ? 'active' : 'inactive', $html_item);
         $html_item = str_replace('{item_active_bool}', $item->active, $html_item);
         $html_items .= $html_item;
     }
     $html = str_replace($layout_item['0'], $html_items, $html);
     // replace the overal dynamic tags
     $suffix = $this->_params->suffix;
     $html = str_replace('{suffix}', $suffix, $html);
     $html = str_replace('{style}', $suffix, $html);
     // for backward compatibility
     $hover = 'onmouseover="changeClassName(this,\'link_normal\',\'link_hover\');" onmouseout="changeClassName(this,\'link_hover\',\'link_normal\');"';
     $html = str_replace('{hover}', $hover, $html);
     return $html;
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:72,代码来源:helper.php

示例10: __construct

 public function __construct($objectid, $parent = NULL, $fileName = NULL, $title = NULL, $description = NULL, $type = NULL, $ordering = NULL)
 {
     $this->objectid = $objectid;
     if ($parent) {
         $this->parent = $parent;
     }
     if ($fileName) {
         $this->fileName = $fileName;
     }
     if ($title) {
         $this->title = JFilterOutput::cleanText($title);
     }
     if ($description) {
         $this->description = JFilterOutput::cleanText($description);
     }
     if ($type) {
         $this->type = $type;
     }
     if ($ordering) {
         $this->ordering = $ordering;
     }
 }
开发者ID:kameli-2,项目名称:helkakg,代码行数:22,代码来源:classes.php

示例11: edit

	public function edit() {
		$this->id = JRequest::getInt('mesid', 0);

		$message = KunenaForumMessageHelper::get($this->id);
		$topic = $message->getTopic();
		$fields = array (
			'name' => JRequest::getString ( 'authorname', $message->name ),
			'email' => JRequest::getString ( 'email', $message->email ),
			'subject' => JRequest::getVar('subject', $message->subject, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input
			'message' => JRequest::getVar('message', $message->message, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input
			'modified_reason' => JRequest::getString ( 'modified_reason', $message->modified_reason ),
			'icon_id' => JRequest::getInt ( 'topic_emoticon', $topic->icon_id ),
			'anonymous' => JRequest::getInt ( 'anonymous', 0 ),
			'poll_title' => JRequest::getString ( 'poll_title', null ),
			'poll_options' => JRequest::getVar('polloptionsID', array (), 'post', 'array'), // Array of key => string
			'poll_time_to_live' => JRequest::getString ( 'poll_time_to_live', 0 ),
			'tags' => JRequest::getString ( 'tags', null ),
			'mytags' => JRequest::getString ( 'mytags', null )
		);

		if (! JSession::checkToken('post')) {
			$this->app->setUserState('com_kunena.postfields', $fields);
			$this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->redirectBack ();
		}

		if (!$message->authorise('edit')) {
			$this->app->setUserState('com_kunena.postfields', $fields);
			$this->app->enqueueMessage ( $message->getError(), 'notice' );
			$this->redirectBack ();
		}

		// Update message contents
		$message->edit ( $fields );
		// If requested: Make message to be anonymous
		if ($fields['anonymous'] && $message->getCategory()->allow_anonymous) {
			$message->makeAnonymous();
		}

		// Mark attachments to be deleted
		$attachments = JRequest::getVar('attachments', array(), 'post', 'array'); // Array of integer keys
		$attachkeeplist = JRequest::getVar('attachment', array(), 'post', 'array'); // Array of integer keys
		$removeList = array_keys(array_diff_key($attachments, $attachkeeplist));
		JArrayHelper::toInteger($removeList);

		$message->removeAttachment($removeList);

		// Upload new attachments
		foreach ($_FILES as $key=>$file) {
			$intkey = 0;
			if (preg_match('/\D*(\d+)/', $key, $matches))
				$intkey = (int)$matches[1];
			if ($file['error'] != UPLOAD_ERR_NO_FILE) $message->uploadAttachment($intkey, $key, $this->catid);
		}

		// Set topic icon if permitted
		if ($this->config->topicicons && isset($fields['icon_id']) && $topic->authorise('edit', null, false)) {
			$topic->icon_id = $fields['icon_id'];
		}

		// Check if we are editing first post and update topic if we are!
		if ($topic->first_post_id == $message->id) {
			$topic->subject = $fields['subject'];
		}

		// If user removed all the text and message doesn't contain images or objects, delete the message instead.
		$text = KunenaHtmlParser::parseBBCode($message->message);
		if (!preg_match('!(<img |<object )!', $text)) {
			$text = trim(JFilterOutput::cleanText($text));
		}
		if (!$text) {
			// Reload message (we don't want to change it).
			$message->load();
			if ($message->publish(KunenaForum::DELETED)) {
				$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_DELETE'));
			} else {
				$this->app->enqueueMessage($message->getError(), 'notice');
			}
			$this->app->redirect($message->getUrl($this->return, false));
		}

		// Activity integration
		$activity = KunenaFactory::getActivityIntegration();
		$activity->onBeforeEdit($message);

		// Save message
		$success = $message->save ();
		if (! $success) {
			$this->app->setUserState('com_kunena.postfields', $fields);
			$this->app->enqueueMessage ( $message->getError (), 'error' );
			$this->redirectBack ();
		}
		// Display possible warnings (upload failed etc)
		foreach ( $message->getErrors () as $warning ) {
			$this->app->enqueueMessage ( $warning, 'notice' );
		}

		$poll_title = $fields['poll_title'];
		if ($poll_title !== null && $message->id == $topic->first_post_id) {
			// Save changes into poll
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:topic.php

示例12: getText

 public static function getText($text, $limit, $type)
 {
     $text = JFilterOutput::cleanText($text);
     switch ($type) {
         case 0:
             $text = explode(' ', $text);
             $text = implode(' ', array_slice($text, 0, $limit));
             break;
         case 1:
             $text = utf8_substr($text, 0, $limit);
             break;
         case 2:
             $text = $text;
             break;
         default:
             $text = explode(' ', $text);
             $text = implode(' ', array_slice($text, 0, $limit));
             break;
     }
     return $text;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:21,代码来源:helper.php

示例13: textLimit

 /**
  * String show limitation
  * 
  * @param string $text
  * @param int $limit
  * @param string $type,  default: no   others: no, char, word
  * @return string
  */
 public function textLimit($text, $limit, $type = 'no')
 {
     //function to cut text
     $text = preg_replace('/<img[^>]+\\>/i', "", $text);
     if ($limit == 'no') {
         //no limit
         $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>';
         //$text     = strip_tags( $text, $allowed_tags );
         $text = $text;
     } else {
         if ($type == 'char') {
             // character lmit
             $text = JFilterOutput::cleanText($text);
             $sep = utf8_strlen($text) > $limit ? '' : '';
             //   core function of joomla. link: http://api.joomla.org/elementindex_utf8.html
             $text = utf8_substr($text, 0, $limit) . $sep;
         } else {
             // word limit
             $text = JFilterOutput::cleanText($text);
             $text = explode(' ', $text);
             $sep = count($text) > $limit ? '' : '';
             $text = implode(' ', array_slice($text, 0, $limit)) . $sep;
         }
     }
     return $text;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:34,代码来源:helper.php

示例14: defined

defined('_JEXEC') or die;
// Output filter
jimport('joomla.filter.filteroutput');
// Feed title
echo '<a href="http://feeds.feedburner.com/JoomlaLinkr" target="_blank">Linkr RSS</a>';
// Feed items
echo '<div style="padding:4px;">';
$items = $this->feed->get_items();
$total = count($items);
for ($n = 0; $n < $total, $n < 3; $n++) {
    echo '<div>';
    $i =& $items[$n];
    // Item link
    $link = $i->get_link();
    $link = $link ? $link : 'http://j.l33p.com/linkr';
    $link = JHTML::link($link, $i->get_title(), array('target' => '_blank'));
    // Title
    echo '<strong>' . $link . '</strong>';
    // Description
    $desc = preg_replace('/<a\\s+.*?href="[^"]+"[^>]*>([^<]+)<\\/a>/is', '\\1', $i->get_description());
    $desc = JFilterOutput::cleanText($desc);
    //$desc	= html_entity_decode($desc, ENT_COMPAT, 'UTF-8');
    $desc = html_entity_decode($desc, ENT_COMPAT);
    // PHP4 compatibility
    if (strlen($desc) > 140) {
        $desc = substr($desc, 0, 140) . '...';
    }
    echo ': ' . htmlspecialchars($desc, ENT_COMPAT, 'UTF-8');
    echo '</div>';
}
echo '</div>';
开发者ID:jtresca,项目名称:nysurveyor,代码行数:31,代码来源:default_feed.php

示例15:

">

			<?php 
        if ($commenter->userImage) {
            ?>
			<a class="k2Avatar tcAvatar" rel="author" href="<?php 
            echo $commenter->link;
            ?>
">
				
                <?php 
            if (isset($commenter->userImage)) {
                $src = $commenter->userImage;
            }
            if (!empty($src)) {
                $thumb_img = '<img style="width:' . $tcAvatarWidth . 'px;height:auto;" src="' . $src . '" alt="' . JFilterOutput::cleanText($commenter->userName) . '" />';
            } else {
                if ($is_placehold) {
                    $thumb_img = yt_placehold($placehold_size['k2_content_avatar'], $commenter->userName, $commenter->userName);
                }
            }
            echo $thumb_img;
            ?>
			</a>
			<?php 
        }
        ?>

			<?php 
        if ($params->get('commenterLink')) {
            ?>
开发者ID:rodhoff,项目名称:MNW,代码行数:31,代码来源:commenters.php


注:本文中的JFilterOutput::cleanText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。