Changing PmWiki user profiles links?

时间:2015-06-26 09:41:42

标签: php pmwiki

I have an existing website with its own user-management which I am incorporating PmWiki into.

I am therefore using the ExternAuth recipe in PmWiki to handle my authentication. This works fine, allowing me to authenticate users based on session variables set by my existing user authentication system.

However, there is a single shortcoming: PmWiki will on several pages make links to user profile pages. E.g. when showing who edited pages. I would like these links to instead of pointing to non-existing Wiki-pages of the form Profiles/UserName to point back to my existing user profile pages.

Is there a way to change the way the PmWiki [[~UserName]] links are rendered on the page to an "external" link like http://example.com/profiles/UserName instead of the normal PmWiki behavior?

2 个答案:

答案 0 :(得分:1)

我想我自己想出来......诀窍是使用Markup命令来定义一个标记,该标记可以与其他" inline"同时更改用户配置文件链接。标记到外部链接。此链接稍后将在标记链中转换为指向外部的真实HTML链接。

// Set author information:
$AuthId = $_SESSION['userid'];
$Author = $_SESSION['name'] . ' (userid=' . $_SESSION['userid'] . ')';

// Change the way links to user profiles are shown:
$EnableAuthorSignature = 1; // Allow for ~~~ and ~~~~ markup
$AuthorLink = "[[http://{$_SERVER['SERVER_NAME']}/profiles/{$_SESSION['userid']} | {$_SESSION['name']}]]";
Markup("profilelinks", "inline", "/\[\[~(.*?)\s\(userid=(\d+)\)\]\]/", "[[http://{$_SERVER['SERVER_NAME']}/profiles/$2 | $1]]");

我不确定这是最优雅的解决方案,但似乎有效......

答案 1 :(得分:0)

原始作者链接1)fabric var canvas = new fabric.StaticCanvas( undefined, { width: 500, height: 500, } ); var svgEl = document.body.getElementsByTagName('svg')[0]; var serializer = new XMLSerializer(); var svgStr = serializer.serializeToString(svgEl); var path = fabric.loadSVGFromString(svgStr,function(objects, options) { var obj = fabric.util.groupSVGElements(objects, options); canvas.add(obj).renderAll(); var data = canvas.toDataURL(); var docDefinition = { content: [{ image: data, width: 500, }] }; pdfMake.createPdf(docDefinition).download("Score_Details.pdf"); }); 2)canvg var svgImage = document.body.getElementsByTagName('svg')[0]; var serializer = new XMLSerializer(); var str = serializer.serializeToString(svgImage); var $canvas = $('<canvas/>'); $canvas.attr('width', '150px;') $canvas.attr('height', '150px;') $canvas.appendTo('body'); canvg($canvas.get(0), str); html2canvas($canvas, { onrendered: function (canvas) { var a = document.createElement('a'); a= canvas.toDataURL(); var docDefinition = { content: [{ image: a, width: 500, }] }; pdfMake.createPdf(docDefinition).download("Score_Details.pdf"); $canvas.remove(); //removes canvas from body } }); [[~user]]中定义为:

script/author.php

默认情况下,Markup('[[~','<links','/\\[\\[~(.*?)\\]\\]/',"[[$AuthorGroup/$1]]"); 设置为“个人资料”组名称。

您可以通过以下方式将其更改为:

$AuthorGroup