示例#1
0
/**
 * Return text of a markdown_wiki from guid
 * @param  GUID $markdown_wiki_guid   The guid of the markdown_wiki page
 * @return string                     Text of the markdown_wiki page
 */
function get_markdown_wiki_text_from_guid($markdown_wiki_guid)
{
    // get page
    $markdown_wiki_entity = get_entity($markdown_wiki_guid);
    if (!$markdown_wiki_entity) {
        return false;
    } else {
        return get_markdown_wiki_text_from_entity($markdown_wiki_entity);
    }
}
示例#2
0
 *	@author Emmanuel Salomon @ManUtopiK
 *	@license GNU Affero General Public License, version 3 or late
 *	@link https://github.com/ManUtopiK/elgg-markdown_wiki
 *
 *	Elgg-markdown_wiki view markdown_wiki page
 **/
$markdown_wiki_guid = (int) get_input('guid');
$markdown_wiki = get_entity($markdown_wiki_guid);
$redirect_from = (int) get_input('redirect_from', null);
$redirect = get_input('redirect', true);
$container = elgg_get_page_owner_entity();
if (!$markdown_wiki || !$container) {
    forward(REFERER);
}
// REDIRECT(link)
if ($redirect !== 'no' && preg_match('#^REDIRECT\\((.*)\\)#', get_markdown_wiki_text_from_entity($markdown_wiki), $matches)) {
    forward($matches[1] . "?redirect_from={$markdown_wiki_guid}");
}
elgg_load_js('markdown_wiki:view');
elgg_load_css('markdown_wiki:css');
elgg_set_page_owner_guid($markdown_wiki->getContainerGUID());
$title = $markdown_wiki->title;
if (elgg_instanceof($container, 'group')) {
    elgg_push_breadcrumb($container->name, "wiki/group/{$container->guid}/all");
} else {
    elgg_push_breadcrumb($container->name, "wiki/owner/{$container->username}");
}
elgg_push_breadcrumb($title);
$content = elgg_trigger_plugin_hook('markdown_wiki_view', 'header', $markdown_wiki, '');
$content .= elgg_view_entity($markdown_wiki, array('full_view' => true, 'redirect_from' => $redirect_from));
$content .= elgg_trigger_plugin_hook('markdown_wiki_view', 'footer', $markdown_wiki, '');