Перейти к содержимому
Русский язык для Invision Community 5

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

Здравствуйте. Хукаю 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 );
	}

 

Рекомендованные сообщения

Нет сообщений для отображения

Создайте аккаунт или войдите в него для комментирования

Аккаунт

Навигация

Поиск

Поиск

Настроить push-уведомления браузера

Chrome (Android)
  1. Нажмите на иконку замка рядом с адресной строкой.
  2. Нажмите Права доступа -> Уведомления.
  3. Измените свои настройки.
Chrome (компьютер)
  1. Нажмите на иконку замка в адресной строке.
  2. Выберите Настройки сайта.
  3. Найдите Уведомления и измените свои настройки.