Page MenuHomeDevCentral

No OneTemporary

diff --git a/apps/mediawikimirror/MediaWikiMirrorApplication.php b/apps/mediawikimirror/MediaWikiMirrorApplication.php
index 4073e12..3a3fc69 100644
--- a/apps/mediawikimirror/MediaWikiMirrorApplication.php
+++ b/apps/mediawikimirror/MediaWikiMirrorApplication.php
@@ -1,68 +1,70 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* MediaWiki mirror application class
*
* @package ObsidianWorkspaces
* @subpackage MediaWikiMirror
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
/**
* MediaWiki mirror application class
*/
class MediaWikiMirrorApplication extends Application {
/**
* Gets rendered version URL
*
* @return string the URL
*/
public function getRenderUrl () {
return
$this->context->configuration->url[0] .
$this->context->configuration->url[1] .
"/index.php?action=render&title=". $this->context->configuration->page;
}
- public function fix_links ($content) {
+ /**
+ * Fixes links in the content
+ *
+ * @param string $content The page content
+ * @return string The page content, with updated links
+ */
+ public function fixLinks ($content) {
$fullUrl = $this->context->configuration->url[0] . $this->context->configuration->url[1];
$content = str_replace('<a href="' . $this->context->configuration->url[1], '<a href="' . $fullUrl, $content);
$content = str_replace(' src="' . $this->context->configuration->url[1], ' src="' . $fullUrl, $content);
return $content;
}
/**
* Handles controller request
*/
public function handleRequest () {
$smarty = $this->context->templateEngine;
+ //Gets content
+ $url = $this->getRenderUrl();
+ $title = $this->context->configuration->page;
+ $content = file_get_contents($url);
+ $content = $this->fixLinks($content);
+
//Serves header
$smarty->assign('PAGE_TITLE', $title);
HeaderController::run($this->context);
- //Output Hello world
- $url = $this->getRenderUrl();
- echo "
-<style>
-.mw-editsection {
- display: block;
- float: right;
- font-size: 12pt;
-}
-</style>";
- $content = file_get_contents($url);
- $content = $this->fix_links($content);
- echo $content;
+ //Serves body
+ $smarty->assign('Content', $content);
+ $smarty->display('apps/mediawikimirror/page.tpl');
//Serves footer
FooterController::run($this->context);
}
}
diff --git a/skins/bluegray/apps/mediawikimirror/page.tpl b/skins/bluegray/apps/mediawikimirror/page.tpl
new file mode 100644
index 0000000..62ffa2b
--- /dev/null
+++ b/skins/bluegray/apps/mediawikimirror/page.tpl
@@ -0,0 +1,14 @@
+<!-- Content -->
+<div class="row">
+<h1 class="page-header">{$PAGE_TITLE}</H1>
+{$Content}
+</div>
+
+<!-- CSS tweaks to display content from MediaWiki -->
+<style>
+.mw-editsection {
+ display: block;
+ float: right;
+ font-size: 12pt;
+}
+</style>

File Metadata

Mime Type
text/x-diff
Expires
Sun, May 3, 05:49 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3677696
Default Alt Text
(3 KB)

Event Timeline