[wolfcms] r355 committed - Fixing preview problems for textile and markdown plugins.

4 views
Skip to first unread message

wol...@googlecode.com

unread,
Dec 24, 2010, 7:32:25 PM12/24/10
to wolfcms...@googlegroups.com
Revision: 355
Author: martij...@gmail.com
Date: Fri Dec 24 16:31:38 2010
Log: Fixing preview problems for textile and markdown plugins.
http://code.google.com/p/wolfcms/source/detail?r=355

Modified:
/trunk/wolf/plugins/markdown/MarkdownController.php
/trunk/wolf/plugins/markdown/markdown.php
/trunk/wolf/plugins/textile/TextileController.php
/trunk/wolf/plugins/textile/textile.php

=======================================
--- /trunk/wolf/plugins/markdown/MarkdownController.php Mon Nov 22 11:30:25
2010
+++ /trunk/wolf/plugins/markdown/MarkdownController.php Fri Dec 24 16:31:38
2010
@@ -16,7 +16,6 @@
public function preview() {
require_once('classMarkdown.php');
$markdown = new Markdown_Parser();
- $in = $_POST['data'];
- echo $markdown->transform($in);
+ echo $markdown->transform($_POST['data']);
}
}
=======================================
--- /trunk/wolf/plugins/markdown/markdown.php Mon Nov 22 11:30:25 2010
+++ /trunk/wolf/plugins/markdown/markdown.php Fri Dec 24 16:31:38 2010
@@ -1,4 +1,17 @@
-<?php include_once("../../../config.php"); ?>
+<?php
+
+include_once("../../../config.php");
+
+$changedurl = str_replace('//','|',URL_PUBLIC);
+$lastslash = strpos($changedurl, '/');
+if (false === $lastslash) {
+ define('URI_PUBLIC', '/');
+}
+else {
+ define('URI_PUBLIC', substr($changedurl, $lastslash));
+}
+
+?>
// -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
@@ -13,7 +26,7 @@
// -------------------------------------------------------------------
markdownSettings = {
nameSpace: 'markdown',
- previewParserPath: '<?php echo (USE_MOD_REWRITE ===
true) ? '' : '?'; ?>/<?php echo ADMIN_DIR; ?>/plugin/markdown/preview', //
path to your markdown parser
+ previewParserPath: '<?php echo URI_PUBLIC; ?><?php echo (USE_MOD_REWRITE
=== true) ? '' : '?/'; ?><?php echo ADMIN_DIR; ?>/plugin/markdown/preview',
// path to your markdown parser
onShiftEnter: {keepDefault:false, openWith:'\n\n'},
markupSet: [
{name:'First Level Heading', key:'1', placeHolder:'Your title here...',
closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
=======================================
--- /trunk/wolf/plugins/textile/TextileController.php Mon Nov 22 11:30:25
2010
+++ /trunk/wolf/plugins/textile/TextileController.php Fri Dec 24 16:31:38
2010
@@ -11,14 +11,12 @@

class TextileController extends PluginController {

- public function __construct() {
- }
+ public function __construct() { }

public function preview() {
require_once('classTextile.php');
$textile = new TextileFilter();
- $in = $_POST['data'];
- echo $textile->TextileThis($in);
+ echo $textile->TextileThis($_POST['data']);

// For untrusted user input, use TextileRestricted instead:
// echo $textile->TextileRestricted($in);
=======================================
--- /trunk/wolf/plugins/textile/textile.php Mon Nov 22 11:30:25 2010
+++ /trunk/wolf/plugins/textile/textile.php Fri Dec 24 16:31:38 2010
@@ -1,4 +1,17 @@
-<?php include_once("../../../config.php"); ?>
+<?php
+
+include_once("../../../config.php");
+
+$changedurl = str_replace('//','|',URL_PUBLIC);
+$lastslash = strpos($changedurl, '/');
+if (false === $lastslash) {
+ define('URI_PUBLIC', '/');
+}
+else {
+ define('URI_PUBLIC', substr($changedurl, $lastslash));
+}
+
+?>

// -------------------------------------------------------------------
// markItUp!
@@ -14,7 +27,7 @@
// -------------------------------------------------------------------
textileSettings = {
nameSpace: 'textile',
- previewParserPath: '<?php echo (USE_MOD_REWRITE ===
true) ? '' : '?'; ?>/<?php echo ADMIN_DIR; ?>/plugin/textile/preview', //
path to your Textile parser
+ previewParserPath: '<?php echo URI_PUBLIC;?><?php echo (USE_MOD_REWRITE
=== true) ? '' : '?/'; ?><?php echo ADMIN_DIR; ?>/plugin/textile/preview',
// path to your Textile parser
onShiftEnter: {keepDefault:false, replaceWith:'\n\n'},
markupSet: [
{name:'Heading 1', key:'1', openWith:'h1(!(([![Class]!]))!). ',
placeHolder:'Your title here...' },

Reply all
Reply to author
Forward
0 new messages