This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from superdav42/development
Remove font tags from some namespaces on save
- Loading branch information
Showing
5 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
code cleanup Plugin for DokuWiki | ||
|
||
Removes font tags from pages that shouldn't use them | ||
|
||
If you install this plugin manually, make sure it is installed in | ||
lib/plugins/codecleanup/ - if the folder is called different it | ||
will not work! | ||
|
||
Please refer to http://www.dokuwiki.org/plugins for additional info | ||
on how to install plugins in DokuWiki. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Clean up code | ||
* | ||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||
* @author David Stone <david@nnucomputerwhiz.com> | ||
*/ | ||
|
||
/** | ||
* Class action_plugin_codecleanup | ||
*/ | ||
class action_plugin_codecleanup extends DokuWiki_Action_Plugin { | ||
|
||
/** | ||
* Registers a callback function for a given event | ||
* | ||
* @param Doku_Event_Handler $controller DokuWiki's event controller object | ||
* @return void | ||
*/ | ||
public function register(Doku_Event_Handler $controller) { | ||
|
||
$controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'cleanupCode'); | ||
} | ||
|
||
/** | ||
* [Custom event handler which performs action] | ||
* | ||
* @param Doku_Event $event event object by reference | ||
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this | ||
* handler was registered] | ||
* @return void | ||
*/ | ||
public function cleanupCode(Doku_Event &$event, $param) { | ||
|
||
$event->data[0][1] = preg_replace('/<\/?font[^>]*>/', '', $event->data[0][1]); | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @param string $haystack | ||
* @param string $needle | ||
* @return string | ||
*/ | ||
private function startsWith($haystack, $needle) { | ||
return (substr($haystack, 0, strlen($needle)) === $needle); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
base codecleanup | ||
author David Stone | ||
email david@nnucomputerwhiz.com | ||
date 2015-09-21 | ||
name Code Cleanup Plugin | ||
desc Remove font tags and other junk that can occur on copy and paste | ||
url http://www.distantshores.org |
Submodule tag
updated
6 files
+56 −10 | helper.php | |
+9 −0 | lang/cs/lang.php | |
+12 −1 | lang/cs/settings.php | |
+1 −1 | lang/ru/settings.php | |
+2 −2 | plugin.info.txt | |
+0 −1 | syntax/topic.php |