--- /dev/null
+<?php
+
+namespace App\Fluidbook\Compiler;
+
+use App\Fluidbook\SEO\Document;
+use App\Fluidbook\SocialImage;
+use Cubist\Util\Text;
+use Cubist\Util\WebVideo;
+use SimpleXMLElement;
+
+trait Articles
+{
+ public $seoArticles = [];
+
+ public function writeXMLArticles()
+ {
+ $f = $this->fluidbookSettings->articlesFile;
+
+ $this->lessVariables['articles-title-color'] = '#000000';
+ $this->lessVariables['articles-font'] = 'Open Sans';
+
+ if (!$f || !file_exists($this->wdir . '/' . $f) || !is_file($this->wdir . '/' . $f)) {
+ return;
+ }
+ $f = $this->wdir . '/' . $f;
+ $mapFonts = ['OpenSans' => 'Open Sans'];
+ $this->addLess('articles');
+ if ($this->fluidbookSettings->articlesStyle !== 'default') {
+ $this->lessVariables['articles-styles'] = $this->fluidbookSettings->articlesStyle;
+ }
+ $this->lessVariables['articles-font'] = $mapFonts[$this->fluidbookSettings->articlesFont] ?? $this->fluidbookSettings->articlesFont;
+ $fontPath = $this->addFontKit($this->fluidbookSettings->articlesFont);
+
+ $list = $this->config->articlesList ?? [];
+
+ $this->lessVariables['articles-title-color'] = '#565657';
+
+ $svg = '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="nav-print" viewBox="0 0 512 512">
+ <path d="m424 186l-39 0 0-114c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 114-39 0c-22 0-41 19-41 41l0 121c0 23 19 41 41 41l39 0 0 49c0 8 6 15 14 15l230 0c8 0 14-7 14-15l0-49 39 0c22 0 41-18 41-41l0-121c0-22-19-41-41-41z m-268-100l200 0 0 100-200 0z m200 340l-200 0 0-88 200 0z m80-76c0 6-6 12-12 12l-39 0 0-38c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 38-39 0c-6 0-12-6-12-12l0-121c0-6 6-12 12-12l336 0c6 0 12 6 12 12z m-278-96l-33 0c-8 0-14 6-14 14 0 8 6 15 14 15l35 0c8 0 14-7 14-15 0-8-8-14-16-14z m32 139l132 0c8 0 14-6 14-14 0-8-6-14-14-14l-132 0c-8 0-14 6-14 14 0 8 6 14 14 14z"/>
+ </symbol></svg>';
+
+ $x = simplexml_load_string(file_get_contents($f));
+ foreach ($x->xpath('/articles/article') as $k => $a) {
+ $dir = isset($a['dir']) ? (string)$a['dir'] : null;
+ $url = (string)$a['url'];
+ $id = (string)$a['id'];
+ $color = (string)$a['color'];
+ if (!$color) {
+ $color = '#000';
+ }
+
+ $specificStyles = '## h3, ## figure figcaption{background-color:' . $color . '}';
+ $specificStyles .= '## .chapo, ## blockquote, ## a{color:' . $color . ';}';
+
+ $inner = '<article data-id="$id" class="menu-article" id="article_$id"';
+ if (null !== $dir) {
+ $inner .= ' dir="' . $dir . '"';
+ }
+ $inner .= '>';
+ $inner .= '<style type="text/css">' . str_replace('##', '#article_$id', $specificStyles) . '</style>';
+ $inner .= '<div class="actions">';
+ if ($this->fluidbookSettings->articlesShare && $this->fluidbookSettings->share) {
+ $inner .= '<a data-id="$id" data-url="$url" href="#" class="articlesShare"><svg viewBox="0 0 512 512" class="nav-share nav-icon svg-icon"><use xlink:href="#nav-share"></use></svg></a>';
+ }
+ $inner .= '<a href="#" class="articlesPrint"><svg viewBox="0 0 512 512" class="nav-print nav-icon svg-icon"><use xlink:href="#nav-print"></use></svg></a>';
+ $inner .= '</div>';
+
+ $inner .= '<div class="articleBody">';
+
+ $title = '';
+ $lead = '';
+ $image = '';
+
+ $first = true;
+
+ foreach ($a->children() as $child) {
+ if ($first) {
+ $first = false;
+ if ($child->getName() !== 'category') {
+ $inner .= '<h3> </h3>';
+ }
+ }
+ $inner .= $this->_articleToHTML($child, $title, $lead, $image, $dir);
+ }
+ $inner .= '</div></article>';
+
+ if (!$title) {
+ $title = 'Article sans titre ' . $k;
+ }
+
+ if (!$id) {
+ $id = Text::str2URL($title);
+ }
+
+ if (!$url) {
+ $url = $id . '.html';
+ }
+
+ $inner = str_replace(array('$id', '$url'), array($id, $url), $inner);
+
+ $article = ['id' => $id,
+ 'url' => $url,
+ 'color' => $color,
+ 'contents' => '',
+ 'type' => 'xml'];
+
+ $article['contents'] = $inner;
+ $content = '<html><head>';
+ $content .= '<link rel="stylesheet" type="text/css" href="' . $fontPath . '">';
+ $content .= '<link rel="stylesheet" type="text/css" href="style/articles.css">';
+ $content .= '<style type="text/css">';
+ $content .= str_replace('## ', '', $specificStyles);
+ $content .= '</style>';
+ $content .= '<style type="text/css" media="screen">*{visibility:hidden}</style>';
+ $content .= '</head><body>';
+ $content .= $svg;
+ $content .= $inner;
+ $content .= '</body></html>';
+ $article['print'] = $content;
+ $list[] = $article;
+
+ $this->addSEOArticle('#/article/' . $article['url'], $title, $lead, $image, $article['id'], $article['url'], $inner);
+ }
+
+ if (isset($list)) {
+ $this->config->articlesList = $list;
+ }
+ }
+
+ public function findArticleById($id)
+ {
+ foreach ($this->config->articlesList as $item) {
+ if ($item['id'] === $id) {
+ return $item;
+ }
+ }
+ return null;
+ }
+
+ public function updateArticleById($id, $article)
+ {
+ foreach ($this->config->articlesList as $k => $item) {
+ if ($item['id'] === $id) {
+ $this->config->articlesList[$k] = $article;
+ break;
+ }
+ }
+ }
+
+ public function writeArticles()
+ {
+ $list = $this->config->articlesList ?? [];
+
+ $nb = count($list);
+
+ usort($list, function ($a, $b) {
+ if ($a['page'] == $b['page']) {
+ $ea = explode('-', $a['id']);
+ $eb = explode('-', $b['id']);
+ if (is_numeric($ea[0]) && is_numeric($eb[0])) {
+ return $ea[0] - $eb[0];
+ }
+ return strcmp($a['id'], $b['id']);
+ }
+ return $a['page'] - $b['page'];
+ });
+
+ foreach ($list as $k => $item) {
+ $nextIndex = ($k + 1) % $nb;
+ $prevIndex = ($k - 1 + $nb) % $nb;
+ $list[$k]['prev'] = $list[$prevIndex]['url'];
+ $list[$k]['next'] = $list[$nextIndex]['url'];
+ }
+
+
+ $idlist = [];
+ foreach ($list as $item) {
+ $idlist[$item['id']] = $item;
+ }
+
+ $this->config->articlesList = $idlist;
+ }
+
+ /**
+ * @param $child SimpleXMLElement
+ * @param $title
+ * @param $lead
+ * @param $image
+ * @return string|void
+ */
+ protected function _articleToHTML($child, &$title, &$lead, &$image, $dir = null)
+ {
+ $markupMap = ['category' => 'h3',
+ 'subtitle' => 'h2',
+ 'legend' => 'figcaption',
+ 'title' => 'h1',
+ 'lead' => 'div.chapo',
+ 'paragraph' => 'p',
+ 'note' => 'div.note',
+ 'quote' => 'blockquote',
+ 'signature' => 'div.author',
+ 'intertitle' => 'h2.inter',
+ 'bigfont' => 'h2.bigfont',
+ 'separator' => 'hr',
+ 'link' => 'a'];
+
+ $attrsmap = ['a' => ['link' => 'href']];
+
+ $dirattr = '';
+ if (isset($child['dir'])) {
+ $d = (string)$child['dir'];
+ if ($d !== $dir) {
+ $dirattr = ' dir="' . $d . '"';
+ $dir = $d;
+ }
+ }
+
+ $res = '';
+ $tag = $child->getName();
+ if ($tag === 'encadre') {
+ $res .= '<aside' . $dirattr . '>';
+ foreach ($child->children() as $sub) {
+ $res .= $this->_articleToHTML($sub, $a1, $a2, $a3, $dir);
+ }
+ $res .= '</aside>';
+ } else if ($tag === 'youtube') {
+ $res .= '<div class="youtube"><iframe width="800" height="450" src="' . WebVideo::getIframeUrl((string)$child['link']) . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>';
+ } else if ($tag === 'image') {
+ $srcattrs = ['href', 'src', 'file'];
+ $file = '';
+ foreach ($srcattrs as $srcattr) {
+ if (isset($child[$srcattr])) {
+ $file = (string)$child[$srcattr];
+ break;
+ }
+ }
+ if ($image === '') {
+ $image = 'articles/' . $file;
+ }
+ $filepath = $this->wdir . '/articles/' . $file;
+ $this->vdir->copy($filepath, 'data/articles/' . $file);
+ $legend = (string)$child;
+ $caption = $legend ? '<figcaption>' . $legend . '</figcaption>' : '';
+ if (file_exists($filepath)) {
+ $dim = getimagesize($filepath);
+ } else {
+ $dim = [0 => 1024, 1 => 10];
+ }
+ $res .= '<figure' . $dirattr . '><img src="data/articles/' . $file . '" alt="' . $legend . '" width="' . $dim[0] . '" height="' . $dim[1] . '">' . $caption . '</figure>';
+ } else {
+ $c = trim($this->SimpleXMLElement_innerXML($child));
+ if (!$c) {
+ return;
+ }
+ if ($title === '' && $tag === 'title') {
+ $title = $c;
+ }
+ if ($lead === '' && $tag === 'lead') {
+ $lead = $c;
+ }
+ $m = $markupMap[$tag] ?? $tag;
+ $e = explode('.', $m);
+ $markup = $e[0];
+ $attrs = $dirattr;
+ if (count($e) === 2) {
+ $attrs .= ' class="' . $e[1] . '"';
+ }
+ if ($m === 'a') {
+ $attrs .= ' target="_blank"';
+ }
+ foreach ($child->attributes() as $name => $v) {
+ $n = $attrsmap[$m][$name] ?? $name;
+ $attrs .= ' ' . $n . '="' . htmlspecialchars($v) . '"';
+ }
+ $res .= '<' . $markup . $attrs . '>' . $c . '</' . $markup . '>';
+ }
+ return $res;
+ }
+
+ function writeSEO()
+ {
+ foreach ($this->seoArticles as $seoArticle) {
+ if ($this->hybrid) {
+ $html = file_get_contents($this->assets . '/_seohybrid.html');
+ } else {
+ $html = file_get_contents($this->assets . '/_seo.html');
+ }
+ $a = $seoArticle;
+ unset($a['image']);
+ $a['imageurl'] = SocialImage::socialImageURL($this->getFluidbook()->cid, $seoArticle['image']);
+ $dim = SocialImage::getSocialImageSize($this->getFluidbook(), $seoArticle['image']);
+ if (null !== $dim) {
+ $a['imagewidth'] = $dim[0];
+ $a['imageheight'] = $dim[1];
+ }
+ foreach ($a as $k => $v) {
+ $html = str_replace('$' . $k, $v, $html);
+ }
+ $this->vdir->file_put_contents('p/' . $seoArticle['url'], $html);
+ }
+ $this->seo = new Document($this);
+ }
+
+ public function addSEOArticle($page, $title, $intro, $image, $id = null, $url = null, $content = '')
+ {
+ if (null === $url) {
+ $url = Text::str2URL($title) . '.html';
+ }
+ if (null === $id) {
+ $id = $title;
+ }
+
+ $this->seoArticles[$id] = ['title' => $title, 'description' => $intro, 'image' => $image, 'content' => $content, 'page' => $page, 'url' => $url, 'id' => $id];
+ }
+
+ public function SimpleXMLElement_innerXML($xml)
+ {
+ $innerXML = '';
+ foreach (dom_import_simplexml($xml)->childNodes as $child) {
+ $innerXML .= $child->ownerDocument->saveXML($child);
+ }
+ return $innerXML;
+ }
+}
use Secure;
use Images;
use Sound;
+ use Articles;
protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
public $logfp = null;
public $logtime = null;
public $beginBody = array();
- public $seoArticles = [];
+
public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com', '*.googletagmanager.com'];
public $writeLinksData = false;
public $content_lock = [];
public function pushSetting($key, $value)
{
- $v = $this->fluidbookSettings->get($key, []);
+ $v = $this->config->$key ?? [];
$v[] = $value;
- $this->fluidbookSettings->set($key, $v);
+ $this->config->$key = $v;
}
}
}
- function writeSEO()
- {
- foreach ($this->seoArticles as $seoArticle) {
- if ($this->hybrid) {
- $html = file_get_contents($this->assets . '/_seohybrid.html');
- } else {
- $html = file_get_contents($this->assets . '/_seo.html');
- }
- $a = $seoArticle;
- unset($a['image']);
- $a['imageurl'] = SocialImage::socialImageURL($this->getFluidbook()->cid, $seoArticle['image']);
- $dim = SocialImage::getSocialImageSize($this->getFluidbook(), $seoArticle['image']);
- if (null !== $dim) {
- $a['imagewidth'] = $dim[0];
- $a['imageheight'] = $dim[1];
- }
- foreach ($a as $k => $v) {
- $html = str_replace('$' . $k, $v, $html);
- }
- $this->vdir->file_put_contents('p/' . $seoArticle['url'], $html);
- }
- $this->seo = new Document($this);
- }
public function addContentLock($page, $unlockConditions = '')
{
$this->addLess('slideshow/' . $l);
}
- public function addSEOArticle($page, $title, $intro, $image, $id = null, $url = null, $content = '')
- {
- if (null === $url) {
- $url = Text::str2URL($title) . '.html';
- }
- if (null === $id) {
- $id = $title;
- }
-
- $this->seoArticles[$id] = ['title' => $title, 'description' => $intro, 'image' => $image, 'content' => $content, 'page' => $page, 'url' => $url, 'id' => $id];
- }
public function _sortLinks($a, $b)
{
return $path . '/font.css';
}
-
- public function SimpleXMLElement_innerXML($xml)
- {
- $innerXML = '';
- foreach (dom_import_simplexml($xml)->childNodes as $child) {
- $innerXML .= $child->ownerDocument->saveXML($child);
- }
- return $innerXML;
- }
-
- public function writeXMLArticles()
- {
- $f = $this->fluidbookSettings->articlesFile;
-
- $this->lessVariables['articles-title-color'] = '#000000';
- $this->lessVariables['articles-font'] = 'Open Sans';
-
- if (!$f || !file_exists($this->wdir . '/' . $f) || !is_file($this->wdir . '/' . $f)) {
- return;
- }
- $f = $this->wdir . '/' . $f;
- $mapFonts = ['OpenSans' => 'Open Sans'];
- $this->addLess('articles');
- if ($this->fluidbookSettings->articlesStyle !== 'default') {
- $this->lessVariables['articles-styles'] = $this->fluidbookSettings->articlesStyle;
- }
- $this->lessVariables['articles-font'] = $mapFonts[$this->fluidbookSettings->articlesFont] ?? $this->fluidbookSettings->articlesFont;
- $fontPath = $this->addFontKit($this->fluidbookSettings->articlesFont);
-
- $list = $this->config->articlesList ?? [];
-
-
- $this->lessVariables['articles-title-color'] = '#565657';
-
-
- $svg = '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="nav-print" viewBox="0 0 512 512">
- <path d="m424 186l-39 0 0-114c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 114-39 0c-22 0-41 19-41 41l0 121c0 23 19 41 41 41l39 0 0 49c0 8 6 15 14 15l230 0c8 0 14-7 14-15l0-49 39 0c22 0 41-18 41-41l0-121c0-22-19-41-41-41z m-268-100l200 0 0 100-200 0z m200 340l-200 0 0-88 200 0z m80-76c0 6-6 12-12 12l-39 0 0-38c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 38-39 0c-6 0-12-6-12-12l0-121c0-6 6-12 12-12l336 0c6 0 12 6 12 12z m-278-96l-33 0c-8 0-14 6-14 14 0 8 6 15 14 15l35 0c8 0 14-7 14-15 0-8-8-14-16-14z m32 139l132 0c8 0 14-6 14-14 0-8-6-14-14-14l-132 0c-8 0-14 6-14 14 0 8 6 14 14 14z"/>
- </symbol></svg>';
-
-
- $x = simplexml_load_string(file_get_contents($f));
- foreach ($x->xpath('/articles/article') as $k => $a) {
- $dir = isset($a['dir']) ? (string)$a['dir'] : null;
- $url = (string)$a['url'];
- $id = (string)$a['id'];
- $color = (string)$a['color'];
- if (!$color) {
- $color = '#000';
- }
-
- $specificStyles = '## h3, ## figure figcaption{background-color:' . $color . '}';
- $specificStyles .= '## .chapo, ## blockquote, ## a{color:' . $color . ';}';
-
- $inner = '<article data-id="$id" class="menu-article" id="article_$id"';
- if (null !== $dir) {
- $inner .= ' dir="' . $dir . '"';
- }
- $inner .= '>';
- $inner .= '<style type="text/css">' . str_replace('##', '#article_$id', $specificStyles) . '</style>';
- $inner .= '<div class="actions">';
- if ($this->fluidbookSettings->articlesShare && $this->fluidbookSettings->share) {
- $inner .= '<a data-id="$id" data-url="$url" href="#" class="articlesShare"><svg viewBox="0 0 512 512" class="nav-share nav-icon svg-icon"><use xlink:href="#nav-share"></use></svg></a>';
- }
- $inner .= '<a href="#" class="articlesPrint"><svg viewBox="0 0 512 512" class="nav-print nav-icon svg-icon"><use xlink:href="#nav-print"></use></svg></a>';
- $inner .= '</div>';
-
- $inner .= '<div class="articleBody">';
-
- $title = '';
- $lead = '';
- $image = '';
-
- $first = true;
-
- foreach ($a->children() as $child) {
- if ($first) {
- $first = false;
- if ($child->getName() !== 'category') {
- $inner .= '<h3> </h3>';
- }
- }
- $inner .= $this->_articleToHTML($child, $title, $lead, $image, $dir);
- }
- $inner .= '</div></article>';
-
- if (!$title) {
- $title = 'Article sans titre ' . $k;
- }
-
- if (!$id) {
- $id = Text::str2URL($title);
- }
-
- if (!$url) {
- $url = $id . '.html';
- }
-
- $inner = str_replace(array('$id', '$url'), array($id, $url), $inner);
-
- $article = ['id' => $id,
- 'url' => $url,
- 'color' => $color,
- 'contents' => '',
- 'type' => 'xml'];
-
- $article['contents'] = $inner;
- $content = '<html><head>';
- $content .= '<link rel="stylesheet" type="text/css" href="' . $fontPath . '">';
- $content .= '<link rel="stylesheet" type="text/css" href="style/articles.css">';
- $content .= '<style type="text/css">';
- $content .= str_replace('## ', '', $specificStyles);
- $content .= '</style>';
- $content .= '<style type="text/css" media="screen">*{visibility:hidden}</style>';
- $content .= '</head><body>';
- $content .= $svg;
- $content .= $inner;
- $content .= '</body></html>';
- $article['print'] = $content;
- $list[] = $article;
-
- $this->addSEOArticle('#/article/' . $article['url'], $title, $lead, $image, $article['id'], $article['url'], $inner);
- }
-
- if (isset($list)) {
- $this->config->articlesList = $list;
- }
- }
-
- public function findArticleById($id)
- {
- foreach ($this->config->articlesList as $item) {
- if ($item['id'] === $id) {
- return $item;
- }
- }
- return null;
- }
-
- public function updateArticleById($id, $article)
- {
- foreach ($this->config->articlesList as $k => $item) {
- if ($item['id'] === $id) {
- $this->config->articlesList[$k] = $article;
- break;
- }
- }
- }
-
- public function writeArticles()
- {
- $list = $this->config->articlesList ?? [];
-
- $nb = count($list);
-
- usort($list, function ($a, $b) {
- if ($a['page'] == $b['page']) {
- $ea = explode('-', $a['id']);
- $eb = explode('-', $b['id']);
- if (is_numeric($ea[0]) && is_numeric($eb[0])) {
- return $ea[0] - $eb[0];
- }
- return strcmp($a['id'], $b['id']);
- }
- return $a['page'] - $b['page'];
- });
-
- foreach ($list as $k => $item) {
- $nextIndex = ($k + 1) % $nb;
- $prevIndex = ($k - 1 + $nb) % $nb;
- $list[$k]['prev'] = $list[$prevIndex]['url'];
- $list[$k]['next'] = $list[$nextIndex]['url'];
- }
-
-
- $idlist = [];
- foreach ($list as $item) {
- $idlist[$item['id']] = $item;
- }
-
- $this->config->articlesList = $idlist;
- }
-
- /**
- * @param $child SimpleXMLElement
- * @param $title
- * @param $lead
- * @param $image
- * @return string|void
- */
- protected function _articleToHTML($child, &$title, &$lead, &$image, $dir = null)
- {
- $markupMap = ['category' => 'h3',
- 'subtitle' => 'h2',
- 'legend' => 'figcaption',
- 'title' => 'h1',
- 'lead' => 'div.chapo',
- 'paragraph' => 'p',
- 'note' => 'div.note',
- 'quote' => 'blockquote',
- 'signature' => 'div.author',
- 'intertitle' => 'h2.inter',
- 'bigfont' => 'h2.bigfont',
- 'separator' => 'hr',
- 'link' => 'a'];
-
- $attrsmap = ['a' => ['link' => 'href']];
-
- $dirattr = '';
- if (isset($child['dir'])) {
- $d = (string)$child['dir'];
- if ($d !== $dir) {
- $dirattr = ' dir="' . $d . '"';
- $dir = $d;
- }
- }
-
- $res = '';
- $tag = $child->getName();
- if ($tag === 'encadre') {
- $res .= '<aside' . $dirattr . '>';
- foreach ($child->children() as $sub) {
- $res .= $this->_articleToHTML($sub, $a1, $a2, $a3, $dir);
- }
- $res .= '</aside>';
- } else if ($tag === 'youtube') {
- $res .= '<div class="youtube"><iframe width="800" height="450" src="' . WebVideo::getIframeUrl((string)$child['link']) . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>';
- } else if ($tag === 'image') {
- $srcattrs = ['href', 'src', 'file'];
- $file = '';
- foreach ($srcattrs as $srcattr) {
- if (isset($child[$srcattr])) {
- $file = (string)$child[$srcattr];
- break;
- }
- }
- if ($image === '') {
- $image = 'articles/' . $file;
- }
- $filepath = $this->wdir . '/articles/' . $file;
- $this->vdir->copy($filepath, 'data/articles/' . $file);
- $legend = (string)$child;
- $caption = $legend ? '<figcaption>' . $legend . '</figcaption>' : '';
- if (file_exists($filepath)) {
- $dim = getimagesize($filepath);
- } else {
- $dim = [0 => 1024, 1 => 10];
- }
- $res .= '<figure' . $dirattr . '><img src="data/articles/' . $file . '" alt="' . $legend . '" width="' . $dim[0] . '" height="' . $dim[1] . '">' . $caption . '</figure>';
- } else {
- $c = trim($this->SimpleXMLElement_innerXML($child));
- if (!$c) {
- return;
- }
- if ($title === '' && $tag === 'title') {
- $title = $c;
- }
- if ($lead === '' && $tag === 'lead') {
- $lead = $c;
- }
- $m = $markupMap[$tag] ?? $tag;
- $e = explode('.', $m);
- $markup = $e[0];
- $attrs = $dirattr;
- if (count($e) === 2) {
- $attrs .= ' class="' . $e[1] . '"';
- }
- if ($m === 'a') {
- $attrs .= ' target="_blank"';
- }
- foreach ($child->attributes() as $name => $v) {
- $n = $attrsmap[$m][$name] ?? $name;
- $attrs .= ' ' . $n . '="' . htmlspecialchars($v) . '"';
- }
- $res .= '<' . $markup . $attrs . '>' . $c . '</' . $markup . '>';
- }
- return $res;
- }
-
public static function getPhonegapVersion($v = 'latest')
{
if ($v != 'latest') {