aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-13 22:37:18 -0700
committerzotlabs <mike@macgirvin.com>2017-09-13 22:37:18 -0700
commit55aaabc2f13a36f73af944e17558b59f265322ea (patch)
tree298019d07ebd66be2e38b43a67ff034cc27002dd /Zotlabs/Module
parent5be132f877f792e7b122a2b6ca18934b31b2f10c (diff)
downloadvolse-hubzilla-55aaabc2f13a36f73af944e17558b59f265322ea.tar.gz
volse-hubzilla-55aaabc2f13a36f73af944e17558b59f265322ea.tar.bz2
volse-hubzilla-55aaabc2f13a36f73af944e17558b59f265322ea.zip
add text/plain type to wiki
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Wiki.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index df747a07a..1eb600f51 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -170,7 +170,7 @@ class Wiki extends \Zotlabs\Web\Controller {
'$create' => t('Create New'),
'$submit' => t('Submit'),
'$wikiName' => array('wikiName', t('Wiki name')),
- '$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => 'Markdown', 'text/bbcode' => 'BB Code']),
+ '$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
'$name' => t('Name'),
'$type' => t('Type'),
'$lockstate' => $x['lockstate'],
@@ -262,6 +262,8 @@ class Wiki extends \Zotlabs\Web\Controller {
$mimeType = $p['pageMimeType'];
$sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
+ if($mimeType === 'text/plain')
+ $sampleContent = t('New page');
$content = (($p['content'] == '') ? $sampleContent : $p['content']);
@@ -269,7 +271,10 @@ class Wiki extends \Zotlabs\Web\Controller {
if($mimeType == 'text/bbcode') {
$renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
}
- else {
+ elseif($mimeType === 'text/plain') {
+ $renderedContent = str_replace(["\n",' ',"\t"],[EOL,'&nbsp;','&nbsp;&nbsp;&nbsp;&nbsp;'],htmlentities($content,ENT_COMPAT,'UTF-8',false));
+ }
+ elseif($mimeType === 'text/markdown') {
$content = Zlib\MarkdownSoap::unescape($content);
$html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
$renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
@@ -323,7 +328,7 @@ class Wiki extends \Zotlabs\Web\Controller {
'$modalerroralbum' => t('Error getting album'),
));
- if($p['pageMimeType'] != 'text/bbcode')
+ if($p['pageMimeType'] === 'text/markdown')
head_add_js('/library/ace/ace.js'); // Ace Code Editor
return $o;
@@ -354,11 +359,10 @@ class Wiki extends \Zotlabs\Web\Controller {
$mimeType = $_POST['mimetype'];
- if($mimeType == 'text/bbcode') {
+ if($mimeType === 'text/bbcode') {
$html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL);
}
- else {
-
+ elseif($mimeType === 'text/markdown') {
$bb = Zlib\NativeWikiPage::bbcode($content);
$x = new ZLib\MarkdownSoap($bb);
$md = $x->clean();
@@ -367,6 +371,9 @@ class Wiki extends \Zotlabs\Web\Controller {
$html = Zlib\NativeWikiPage::generate_toc(zidify_text($html));
$html = Zlib\NativeWikiPage::convert_links($html,$wikiURL);
}
+ elseif($mimeType === 'text/plain') {
+ $html = str_replace(["\n",' ',"\t"],[EOL,'&nbsp;','&nbsp;&nbsp;&nbsp;&nbsp;'],htmlentities($content,ENT_COMPAT,'UTF-8',false));
+ }
json_return_and_die(array('html' => $html, 'success' => true));
}