Skip to content

Commit

Permalink
Updated s9e\TextFormatter
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
JoshyPHP committed Jul 9, 2016
1 parent 7a94e1f commit 02cfb7a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bundle.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "phpbb-extension",
"description": "Embed third-party content in your phpBB forum",
"homepage": "https://github.com/s9e/phpbb-ext-mediaembed/",
"version": "20160605",
"version": "20160709",
"keywords": ["phpbb","embed","forum","media"],
"license": "MIT",
"require": {
Expand All @@ -13,7 +13,7 @@
"extra": {
"display-name": "s9e/mediaembed",
"soft-require": {
"phpbb/phpbb": "3.1.*"
"phpbb/phpbb": ">=3.1.4"
},
"version-check": {
"host": "cdn.rawgit.com",
Expand Down
15 changes: 14 additions & 1 deletion parsing.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ protected function outputTag(Tag $tag)
$attributes = $tag->getAttributes();
\ksort($attributes);
foreach ($attributes as $attrName => $attrValue)
$this->output .= ' ' . $attrName . '="' . \htmlspecialchars($attrValue, \ENT_COMPAT, 'UTF-8') . '"';
$this->output .= ' ' . $attrName . '="' . \str_replace("\n", '
', \htmlspecialchars($attrValue, \ENT_COMPAT, 'UTF-8')) . '"';
if ($tag->isSelfClosingTag())
if ($tagLen)
$this->output .= '>' . $tagText . '</' . $tagName . '>';
Expand Down Expand Up @@ -606,6 +606,17 @@ protected function closeParent(Tag $tag)
}
return \false;
}
protected function createChild(Tag $tag)
{
$tagConfig = $this->tagsConfig[$tag->getName()];
if (isset($tagConfig['rules']['createChild']))
{
$priority = -1000;
$tagPos = $this->pos + \strspn($this->text, " \n\r\t", $this->pos);
foreach ($tagConfig['rules']['createChild'] as $tagName)
$this->addStartTag($tagName, $tagPos, 0)->setSortPriority(++$priority);
}
}
protected function fosterParent(Tag $tag)
{
if (!empty($this->openTags))
Expand Down Expand Up @@ -810,6 +821,7 @@ protected function processStartTag(Tag $tag)
$this->addIgnoreTag($tag->getPos() + $tag->getLen(), 1);
$this->outputTag($tag);
$this->pushContext($tag);
$this->createChild($tag);
}
protected function processEndTag(Tag $tag)
{
Expand Down Expand Up @@ -1678,6 +1690,7 @@ protected static function tagIsMissingAnyAttribute(Tag $tag, array $attrNames)
protected static function wget($url, $cacheDir = \null)
{
$prefix = '';
$url = \preg_replace('(#.*)s', '', $url);
if (isset($cacheDir) && \file_exists($cacheDir))
{
$cacheFile = $cacheDir . '/http.' . \crc32($url);
Expand Down
12 changes: 6 additions & 6 deletions rendering.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"stable":{"20160605":{"current":"20160605","announcement":"https:\/\/www.phpbb.com\/community\/viewtopic.php?f=456&t=2272431","download":"https:\/\/github.com\/s9e\/phpbb-ext-mediaembed\/releases\/download\/20160605\/s9e-mediaembed-20160605.zip","eol":null,"security":false}}}
{"stable":{"20160709":{"current":"20160709","announcement":"https:\/\/www.phpbb.com\/community\/viewtopic.php?f=456&t=2272431","download":"https:\/\/github.com\/s9e\/phpbb-ext-mediaembed\/releases\/download\/20160709\/s9e-mediaembed-20160709.zip","eol":null,"security":false}}}

0 comments on commit 02cfb7a

Please sign in to comment.