zidify wiki content
This commit is contained in:
parent
61d2bed019
commit
7763643f2e
@ -177,7 +177,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"');
|
$content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"');
|
||||||
// Render the Markdown-formatted page content in HTML
|
// Render the Markdown-formatted page content in HTML
|
||||||
require_once('library/markdown.php');
|
require_once('library/markdown.php');
|
||||||
$html = wiki_generate_toc(purify_html(Markdown(wiki_bbcode(json_decode($content)))));
|
$html = wiki_generate_toc(zidify_text(purify_html(Markdown(wiki_bbcode(json_decode($content))))));
|
||||||
$renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
$renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
||||||
$hide_editor = false;
|
$hide_editor = false;
|
||||||
$showPageControls = $wiki_editor;
|
$showPageControls = $wiki_editor;
|
||||||
@ -262,7 +262,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$resource_id = $_POST['resource_id'];
|
$resource_id = $_POST['resource_id'];
|
||||||
require_once('library/markdown.php');
|
require_once('library/markdown.php');
|
||||||
$content = wiki_bbcode($content);
|
$content = wiki_bbcode($content);
|
||||||
$html = wiki_generate_toc(purify_html(Markdown($content)));
|
$html = wiki_generate_toc(zidify_text(purify_html(Markdown($content))));
|
||||||
$w = wiki_get_wiki($resource_id);
|
$w = wiki_get_wiki($resource_id);
|
||||||
$wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName'];
|
$wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName'];
|
||||||
$html = wiki_convert_links($html,$wikiURL);
|
$html = wiki_convert_links($html,$wikiURL);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("include/bbcode.php");
|
require_once("include/bbcode.php");
|
||||||
|
require_once('include/hubloc.php');
|
||||||
|
|
||||||
// random string, there are 86 characters max in text mode, 128 for hex
|
// random string, there are 86 characters max in text mode, 128 for hex
|
||||||
// output is urlsafe
|
// output is urlsafe
|
||||||
@ -1736,6 +1737,36 @@ function zidify_links($s) {
|
|||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function zidify_text_callback($match) {
|
||||||
|
$is_zid = is_matrix_url($match[2]);
|
||||||
|
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||||
|
$x = str_replace($match[0],$replace,$match[0]);
|
||||||
|
|
||||||
|
return $x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function zidify_text_img_callback($match) {
|
||||||
|
$is_zid = is_matrix_url($match[2]);
|
||||||
|
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
|
||||||
|
|
||||||
|
$x = str_replace($match[0],$replace,$match[0]);
|
||||||
|
|
||||||
|
return $x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function zidify_text($s) {
|
||||||
|
|
||||||
|
$s = preg_replace_callback('/\<a(.*?)href\=\"(.*?)\"/ism','zidify_text_callback',$s);
|
||||||
|
$s = preg_replace_callback('/\<img(.*?)src\=\"(.*?)\"/ism','zidify_text_img_callback',$s);
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return atom link elements for all of our hubs.
|
* @brief Return atom link elements for all of our hubs.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user