Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
zigazaga

Функция удаления html ноды

Recommended Posts

Здравствуйте. Хукаю Text/Parser

	 /**
	 * Remove specific elements, useful for cleaning up content for display or truncating
	 *
	 * @param	string				$value			The value to parse
	 * @param	array|string		$elements		Element to remove, or array of elements to remove. Can be in format "element[attribute=value]"
	 * @return	string
	 */
	public static function removeElements( $value, $elements=array( 'blockquote', 'img', 'a' ) )
	{
		array_push($elements, 'div[class=my_spoiler]');
		return parent::removeElements( $value, $elements );
	}

функция почему то удаляет my_spoiler только в приложении страниц. Текст остается в профиле в "последняя активность", на страницах результата поиска и т.д. Как удалить там?
Тоже самое и с 

	/**
	 * Removes HTML and optionally truncates content
	 *
	 * @param	bool		$oneLine	If TRUE, will use spaces instead of line breaks. Useful if using a single line display.
	 * @param	int|null	$length		If supplied, and $oneLine is set to TRUE, the returned content will be truncated to this length
	 * @return	string
	 * @note	For now we are removing all HTML. If we decide to change this to remove specific tags in future, we can use \IPS\Text\Parser::removeElements( $this->content() )
	 */
	static public function truncate( $content, $oneLine=false, $length=500 )
	{
		$content = static::removeElements( $content, array( 'div[class=my_spoiler]' ) );
		return parent::truncate( $content, $oneLine, $length );
	}

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...