Strict Standards: Declaration of action_plugin_jquery::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/jquery/action.php on line 14

Strict Standards: Declaration of action_plugin_captcha::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/captcha/action.php on line 137

Strict Standards: Declaration of action_plugin_wikistatistics::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/wikistatistics/action.php on line 51

Strict Standards: Declaration of action_plugin_codehighlight::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/codehighlight/action.php on line 225

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/only4mods/lib/plugins/ipban/action.php on line 60
dokuwiki:codehighlight:devel:action.php - Ema's plugins (WP, DW)

Unfortunately, some of the pages are now read-only, this because in the last few months some spammers decided to “contribute” to the wiki…
I'm trying to lock only the interested pages.


Strict Standards: Declaration of Doku_Renderer_metadata::table_open() should be compatible with Doku_Renderer::table_open($maxcols = NULL, $numrows = NULL, $pos = NULL) in /membri/only4mods/inc/parser/metadata.php on line 24

Strict Standards: Declaration of Doku_Renderer_metadata::table_close() should be compatible with Doku_Renderer::table_close($pos = NULL) in /membri/only4mods/inc/parser/metadata.php on line 24
<?php
/**
 * Syntax editor highlight plugin
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Emanuele <emanuele45@interfree.it>
 */
 
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
 
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
 
class action_plugin_codehighlight extends DokuWiki_Action_Plugin {
 
    /**
     * return some info
     */
    function getInfo(){
      return array(
        'author' => 'Emanuele',
        'email'  => 'emanuele45@interfree.it',
        'date'   => '2009-02-21',
        'name'   => 'CodeHighlight',
        'desc'   => 'Highlight code (php, javascript, and so on) syntax in DokuWiki editor',
        'url'    => 'http://lacroa.altervista.org/dokucount/',
      );
    }
 
    /**
     * register the eventhandlers
     */
    function register(&$controller){
 
		$controller->register_hook('TPL_METAHEADER_OUTPUT',
                                   'BEFORE',
                                   $this,
                                   'codepress_script_file');
 
        // old hook
        $controller->register_hook('HTML_EDITFORM_INJECTION',
                                   'AFTER',
                                   $this,
                                   'handle_editform_output',
                                   array('editform' => true, 'oldhook' => true));
 
        // new hook
        $controller->register_hook('HTML_EDITFORM_OUTPUT',
                                   'AFTER',
                                   $this,
                                   'handle_editform_output',
                                   array('editform' => true, 'oldhook' => false));
    }
 
    /**
     * Javascript to handle the editor
     */
	function codepress_script_file(&$event, $param) {
		global $lang;
		$event->data["script"][] = array (
		  "type" => "text/javascript",
		  "src" => "lib/plugins/codehighlight/cp/codepress.js",
		  "charset" => "utf-8",
		  "_data" => "<!-- -->",
		);
		$event->data["script"][] = array (
		  "type" => "text/javascript",
		  "charset" => "utf-8",
		  "_data" => "
		  function startEditor(){
 
		  $('edbtn__save').style.display=\"none\";
		  $('edbtn__preview').style.display=\"none\";
		  $('hlc_languages').style.display = \"\";
		  if($('repl_edbtn__preview') != null){
			  $('repl_edbtn__save').style.display = \"\"
			  $('repl_edbtn__preview').style.display = \"\"
			  wiki__text.toggleEditor();
		  } else {
			  $('wiki__text').className += ' codepress php linenumbers-off';
			  CodePress.run();
			  $('edbtn__save').parentNode.innerHTML = '<button name=\"do[preview]\" value=\"".$lang['btn_preview']."\" class=\"button\" id=\"repl_edbtn__preview\" accesskey=\"p\" tabindex=\"5\" title=\"".$lang['btn_preview']." [ALT+P]\">".$lang['btn_preview']."</button>' + $('edbtn__save').parentNode.innerHTML;
			  $('edbtn__save').parentNode.innerHTML = '<button name=\"do[save]\" value=\"".$lang['btn_save']."\" class=\"button\" id=\"repl_edbtn__save\" accesskey=\"s\" tabindex=\"4\" title=\"".$lang['btn_save']." [ALT+S]\">".$lang['btn_save']."</button> ' + $('edbtn__save').parentNode.innerHTML;
			  $('repl_edbtn__preview').onclick = function () {
			  wiki__text.toggleEditor();
			  $('dw__editform').submit();
			  };
			  $('repl_edbtn__save').onclick = function () {
			  wiki__text.toggleEditor();
			  $('dw__editform').submit();
			  };
		  }
		  $('hlc_toggle').innerHTML = '".$this->getLang('chl_off_highl')."'
		  $('hlc_toggle').onclick = function(){stopEditor();};
		  }
		  function stopEditor(){
		  wiki__text.toggleEditor();
		  $('hlc_languages').style.display = \"none\";
		  $('edbtn__save').style.display=\"\";
		  $('edbtn__preview').style.display=\"\";
		  $('repl_edbtn__save').style.display = \"none\"
		  $('repl_edbtn__preview').style.display = \"none\"
		  $('hlc_toggle').innerHTML = 'Highlight code'
		  $('hlc_toggle').onclick = function(){startEditor();};
		  }
		  ",
		);
		$event->data["style"][] = array (
			"type" => "text/css",
			"_data" => ".hidden-code {display:none;}",
		);
	}
 
 
    /**
     * HTML code inserted after the editor (toggle editor and codepress controls)
     */
    function handle_editform_output(&$event, $param){
		$out = '
		<div id="cpeditor">
		<button id="hlc_toggle" onclick="startEditor()">'.$this->getLang('chl_highl_code').'</button>
<div style="display:none" id="hlc_languages">
	<em>'.$this->getLang('chl_choose_lang').':</em> 
	<button onclick="wiki__text.edit(\'\',\'php\')">PHP</button>
	<button onclick="wiki__text.edit(\'\',\'javascript\')">JavaScript</button> 
	<button onclick="wiki__text.edit(\'\',\'java\')">Java</button>
	<button onclick="wiki__text.edit(\'\',\'perl\')">Perl</button>
	<button onclick="wiki__text.edit(\'\',\'sql\')">SQL</button>	
	<button onclick="wiki__text.edit(\'\',\'html\')">HTML</button> 
	<button onclick="wiki__text.edit(\'\',\'css\')">CSS</button> 	
	<button onclick="wiki__text.toggleLineNumbers()">'.$this->getLang('chl_toggle_ln').'</button> 	
	<button onclick="wiki__text.toggleAutoComplete()">'.$this->getLang('chl_toggle_ac').'</button> 	
</div></div>';
		echo $out;
 
    }
}

Tools personali