WeakWiki


modules\ppfm\ppfm.module.php

WeakWiki (WeakWiki Preparse Control (ppfm) module: ppfm.module.php) Copyright (C) 2010 Alexander Lang This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . Project Home: http://weakwiki.robnet.wmweb.at/ Contact: robbiblubber@robnet.wmweb.at



/********************************************************************************
WeakWiki (WeakWiki Preparse Control (ppfm) module: ppfm.module.php)
Copyright (C) 2010 Alexander Lang

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this
program; if not, see .

Project Home: http://weakwiki.robnet.wmweb.at/
Contact:      robbiblubber@robnet.wmweb.at
********************************************************************************/



require_once(_lang('ppfm.module'));



/** This is class implements the preparse control (ppfm) module.				*/
class PreparsedControlModule extends __Module
{
	/** Returns the module name.
		@return		Module name.												*/
	public function getName()
	{
		return "ppfm";
	}
	
	/** Returns the module version.
		@return		Module name.												*/
	public function getVersion()
	{
		return _VERSION;
	}
	
	/** Returns a description of the module.
		@return		Module description.											*/
	public function getDescription()
	{
		return "Preparse Control Module";
	}
	
	/** Returns the module's parse mode.
		@return		Parse mode.													*/
	public function getParseMode()
	{
		return MOD_MODE_PARSE_LINKS;
	}
	
	/** Returns a detail page for the module.
		@return		Module detail page.											*/
	public function getDetails()
	{
		return "ppfm
WeakWiki Preparse Control Module Version " . $this->getVersion() . "
by Alexander Lang
Copyright (C) 2010 Alexander Lang

"; } /** Returns links to add to page menu. @return Main menu links. */ public function addToPageMenu() { if(isset($_GET['action'])) { if($_GET['action'] == "admin") { return "" . _L_PPFM_0000 . "  "; } } return ""; } /** Method is called when parsing links. @param $input Unparsed text. @return Parsed text. */ public function parseLink($input) { switch($input) { case "@m:ppfm": return _WIKI_COMMAND . "?action=admin&page=ppfm"; } return $input; } /** Adequately reacts to a module query. @return TRUE when module processes the query, otherwise FALSE. */ public function run() { if(isset($_GET['action']) && isset($_GET['page'])) { if(($_GET['action'] == "admin") && ($_GET['page'] == "ppfm")) { include('./modules/ppfm/ppfm.include.php'); return true; } } return false; } /** Reads files from preparsed directory. @returns Array of file names. */ private function getFiles() { $rval = Array(); $d = opendir(trim(_PATH_PREPARSED, '/')); while(true) { $i = readdir($d); if($i === false) break; if(strlen($i) > 5) { if(substr($i, strlen($i) - 5) == '.html') { array_push($rval, $i); } } } sort($rval); return $rval; } } ?>

WeakWiki