From: <var...@us...> - 2022-03-24 13:43:04
|
Revision: 11011 http://sourceforge.net/p/phpwiki/code/11011 Author: vargenau Date: 2022-03-24 13:43:02 +0000 (Thu, 24 Mar 2022) Log Message: ----------- run php-cs-fixer Modified Paths: -------------- trunk/lib/WysiwygEdit/CKeditor.php trunk/lib/WysiwygEdit/Wikiwyg.php trunk/lib/WysiwygEdit/htmlarea2.php trunk/lib/WysiwygEdit/htmlarea3.php trunk/lib/WysiwygEdit/spaw.php trunk/lib/WysiwygEdit/tinymce.php Modified: trunk/lib/WysiwygEdit/CKeditor.php =================================================================== --- trunk/lib/WysiwygEdit/CKeditor.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/CKeditor.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -37,8 +37,7 @@ class WysiwygEdit_CKeditor extends WysiwygEdit { - - function __construct() + public function __construct() { global $LANG; $this->_transformer_tags = false; @@ -53,15 +52,15 @@ oCKeditor.Config.LinkBrowserURL = oCKeditor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php'; oCKeditor.Config.ImageBrowserURL = oCKeditor.BasePath + 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php'; "; - if (!empty($_REQUEST['start_debug'])) + if (!empty($_REQUEST['start_debug'])) { $this->_jsdefault = "\noCKeditor.Config.Debug = true;"; + } } - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { global $WikiTheme; - $WikiTheme->addMoreHeaders - (JavaScript('', array('src' => $this->BasePath . 'ckeditor.js', + $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . 'ckeditor.js', 'language' => 'JavaScript'))); return JavaScript(" window.onload = function() @@ -74,13 +73,13 @@ }"); } - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { return $this->Textarea_Replace($textarea, $wikitext, $name); } /* either iframe or textarea */ - function Textarea_Create($textarea, $wikitext, $name = 'edit[content]') + public function Textarea_Create($textarea, $wikitext, $name = 'edit[content]') { $htmltextid = $name; $out = HTML( @@ -89,28 +88,35 @@ oCKeditor.Value = '" . $textarea->_content[0]->asXML() . "';" . $this->_jsdefault . " oCKeditor.Create();"), - HTML::div(array("id" => $this->_wikitextid, + HTML::div( + array("id" => $this->_wikitextid, 'style' => 'display:none'), - $wikitext), - "\n"); + $wikitext + ), + "\n" + ); return $out; } /* textarea only */ - function Textarea_Replace($textarea, $wikitext, $name = 'edit[content]') + public function Textarea_Replace($textarea, $wikitext, $name = 'edit[content]') { $htmltextid = $this->_htmltextid; $textarea->SetAttr('id', $htmltextid); - $out = HTML($textarea, - HTML::div(array("id" => $this->_wikitextid, + $out = HTML( + $textarea, + HTML::div( + array("id" => $this->_wikitextid, 'style' => 'display:none'), - $wikitext), - "\n"); + $wikitext + ), + "\n" + ); return $out; } /* via the PHP object */ - function Textarea_PHP($textarea, $wikitext, $name = 'edit[content]') + public function Textarea_PHP($textarea, $wikitext, $name = 'edit[content]') { global $LANG; $this->FilePath = realpath(PHPWIKI_DIR . '/themes/default/CKeditor') . "/"; @@ -126,9 +132,10 @@ $this->oCKeditor->Config['DefaultLanguage'] = $LANG; $this->oCKeditor->Create(); - return HTML::div(array("id" => $this->_wikitextid, + return HTML::div( + array("id" => $this->_wikitextid, 'style' => 'display:none'), - $wikitext); + $wikitext + ); } - } Modified: trunk/lib/WysiwygEdit/Wikiwyg.php =================================================================== --- trunk/lib/WysiwygEdit/Wikiwyg.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/Wikiwyg.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -40,8 +40,7 @@ class WysiwygEdit_Wikiwyg extends WysiwygEdit { - - function __construct() + public function __construct() { $this->_transformer_tags = false; $this->BasePath = DATA_PATH . '/themes/default/Wikiwyg'; @@ -48,12 +47,13 @@ $this->_htmltextid = "edit-content"; $this->_wikitextid = "editareawiki"; $script_url = deduce_script_name(); - if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug'])) + if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug'])) { $script_url .= ("?start_debug=" . $_GET['start_debug']); + } $this->_jsdefault = ""; } - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { global $WikiTheme; /** @@ -64,14 +64,14 @@ foreach (array("Wikiwyg.js", "Wikiwyg/Toolbar.js", "Wikiwyg/Preview.js", "Wikiwyg/Wikitext.js", "Wikiwyg/Wysiwyg.js", "Wikiwyg/Phpwiki.js", "Wikiwyg/HTML.js", "Wikiwyg/Toolbar.js") as $js) { - $WikiTheme->addMoreHeaders - (JavaScript('', array('src' => $this->BasePath . '/' . $js, + $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . '/' . $js, 'language' => 'JavaScript'))); } $doubleClickToEdit = ($request->getPref('doubleClickEdit') or ENABLE_DOUBLECLICKEDIT) ? 'true' : 'false'; if ($request->getArg('mode') && $request->getArg('mode') == 'wysiwyg') { - return JavaScript($this->_jsdefault . " + return JavaScript( + $this->_jsdefault . " window.onload = function() { var wikiwyg = new Wikiwyg.Phpwiki(); var config = { @@ -126,7 +126,7 @@ return ''; } - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { global $request; @@ -134,11 +134,15 @@ $textarea->SetAttr('id', $htmltextid); $iframe0 = new RawXml('<iframe id="iframe0" src="blank.htm" height="0" width="0" frameborder="0"></iframe>'); if ($request->getArg('mode') and $request->getArg('mode') == 'wysiwyg') { - $out = HTML(HTML::div(array('class' => 'hint'), - _("Warning")._(": ")._("This Wikiwyg editor has only Beta quality!")), + $out = HTML( + HTML::div( + array('class' => 'hint'), + _("Warning")._(": ")._("This Wikiwyg editor has only Beta quality!") + ), $textarea, $iframe0, - "\n"); + "\n" + ); } else { $out = HTML($textarea, $iframe0, "\n"); } @@ -153,7 +157,7 @@ * @param string $text * @return string */ - function ConvertBefore($text) + public function ConvertBefore($text) { return $text; } @@ -165,7 +169,7 @@ * @param string $text * @return string */ - function ConvertAfter($text) + public function ConvertAfter($text) { return TransformInline($text); } @@ -173,7 +177,7 @@ class WikiToHtml { - function __construct($wikitext, &$request) + public function __construct($wikitext, &$request) { $this->_wikitext = $wikitext; $this->_request =& $request; @@ -181,13 +185,13 @@ $this->html_content = ""; } - function send() + public function send() { $this->convert(); echo $this->html_content; } - function convert() + public function convert() { require_once 'lib/BlockParser.php'; $xmlcontent = TransformText($this->_wikitext, $this->_request->getArg('pagename')); @@ -196,7 +200,7 @@ $this->replace_inside_html(); } - function replace_inside_html() + public function replace_inside_html() { $this->clean_links(); $this->clean_plugin_name(); @@ -210,18 +214,20 @@ // Draft function to replace RichTable // by a html table // Works only on one plugin for the moment - function replace_known_plugins() + public function replace_known_plugins() { // If match a plugin $pattern = '/\<\;\?plugin\s+RichTable(.*)\?\>\;/Umsi'; $replace_string = "replace_rich_table"; - $this->_html = preg_replace_callback($pattern, + $this->_html = preg_replace_callback( + $pattern, $replace_string, - $this->_html); + $this->_html + ); } // Replace unknown plugins by keyword Wikitext { tag } - function replace_unknown_plugins() + public function replace_unknown_plugins() { $pattern = '/(\<\;\?plugin[^?]*\?\>\;)/Usi'; $replace_string = @@ -228,28 +234,34 @@ '<p><div style="background-color:#D3D3D3;font-size:smaller;">Wikitext { <br> \1 <br>}</div><br></p>'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); } // Clean links to keep only <a href="link">name</a> - function clean_links() + public function clean_links() { // Existing links // FIXME: use VIRTUAL_PATH $pattern = '/\<a href\=\"index.php\?pagename\=(\w+)\"([^>])*\>/Umsi'; $replace_string = '<a href="\1">'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); // Non existing links $pattern = '/\<a href\=\"index.php\?pagename\=([^"]*)(&action){1}([^>])*\>/Umsi'; $replace_string = '<a href="\1">'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); // Clean underline $pattern = '/\<u\>(.*)\<\/u\>(\<a href="(.*))[?"]{1}.*\>.*\<\/a\>/Umsi'; @@ -256,13 +268,15 @@ $replace_string = '<span>\2" style="color:blue;">\1</a></span>'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); } // Put unknown tags in Wikitext {} - function replace_tags() + public function replace_tags() { // Replace old table format ( non plugin ) $pattern = '/(\ {0,4}(?:\S.*)?\|\S+\s*$.*?\<\/p\>)/ms'; @@ -270,32 +284,37 @@ '<p><div style="background-color:#D3D3D3;font-size:smaller;">Wikitext { <br> \1 <br>}</div><br></p>'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); } // Replace \n by <br> only in // <?plugin ? > tag to keep formatting - function clean_plugin() + public function clean_plugin() { $pattern = '/(\<\;\?plugin.*\?\>\;)/Umsei'; $replace_string = 'preg_replace("/\n/Ums","<br>","\1")'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); - + $this->_html + ); } - function clean_plugin_name() + public function clean_plugin_name() { // Remove plugin name converted in a link $pattern = '/(\<\;\?plugin\s)\<span.*\>\<span\>\<a href=.*\>(\w+)\<\/a\><\/span\><\/span>([^?]*\?\>\;)/Umsi'; $replace_string = '\1 \2 \3'; - $this->_html = preg_replace($pattern, + $this->_html = preg_replace( + $pattern, $replace_string, - $this->_html); + $this->_html + ); } } @@ -315,24 +334,28 @@ // if the plugin contains one of the options bellow // it won't be converted - if (preg_match($unknown_options, $plugin)) + if (preg_match($unknown_options, $plugin)) { return $matched[0] . "\n"; - else { + } else { //Replace unused <p...> $pattern = '/\<p.*\>/Umsi'; $replace_string = ""; - $plugin = preg_replace($pattern, + $plugin = preg_replace( + $pattern, $replace_string, - $plugin); + $plugin + ); //replace unused </p> by \n $pattern = '/\<\/p\>/Umsi'; $replace_string = "\n"; - $plugin = preg_replace($pattern, + $plugin = preg_replace( + $pattern, $replace_string, - $plugin); + $plugin + ); $plugin = "<?plugin RichTable " . $plugin . " ?>"; Modified: trunk/lib/WysiwygEdit/htmlarea2.php =================================================================== --- trunk/lib/WysiwygEdit/htmlarea2.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/htmlarea2.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -37,10 +37,10 @@ class WysiwygEdit_htmlarea2 extends WysiwygEdit { - - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { - return JavaScript(" + return JavaScript( + " _editor_url = \"" . DATA_PATH . "/themes/default/htmlarea2/\"; var win_ie_ver = parseFloat(navigator.appVersion.split(\"MSIE\")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } @@ -54,17 +54,20 @@ } ", array('version' => 'JavaScript1.2', - 'type' => 'text/javascript')); + 'type' => 'text/javascript') + ); } // to be called after </textarea> // version 2 - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { $out = HTML($textarea); - $out->pushContent(JavaScript("editor_generate('" . $name . "');", + $out->pushContent(JavaScript( + "editor_generate('" . $name . "');", array('version' => 'JavaScript1.2', - 'defer' => 1))); + 'defer' => 1) + )); return $out; } } Modified: trunk/lib/WysiwygEdit/htmlarea3.php =================================================================== --- trunk/lib/WysiwygEdit/htmlarea3.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/htmlarea3.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -34,8 +34,7 @@ class WysiwygEdit_htmlarea3 extends WysiwygEdit { - - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { global $WikiTheme; $WikiTheme->addMoreAttr('body', " onload='initEditor()'"); @@ -124,7 +123,7 @@ '); } - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { $out = HTML($textarea, HTML::div(array("id" => "editareawiki", 'style' => 'display:none'), $wikitext), "\n"); //TODO: maybe some more custom links Modified: trunk/lib/WysiwygEdit/spaw.php =================================================================== --- trunk/lib/WysiwygEdit/spaw.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/spaw.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -35,8 +35,7 @@ class WysiwygEdit_spaw extends WysiwygEdit { - - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { $basepath = DATA_PATH . '/lib/spaw/'; $spaw_root = PHPWIKI_DIR . "/lib/spaw/"; @@ -46,7 +45,7 @@ include_once($spaw_root . "spaw_control.class.php"); } - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { // global $LANG, $WikiTheme; $id = "spaw_editor"; @@ -63,8 +62,10 @@ $this->SPAW = new SPAW_Wysiwyg($id, $textarea->_content); $textarea->SetAttr('id', $name); $this->SPAW->show(); - $out = HTML::div(array("id" => $id, 'style' => 'display:none'), - $wikitext); + $out = HTML::div( + array("id" => $id, 'style' => 'display:none'), + $wikitext + ); return $out; } } Modified: trunk/lib/WysiwygEdit/tinymce.php =================================================================== --- trunk/lib/WysiwygEdit/tinymce.php 2022-03-24 13:40:18 UTC (rev 11010) +++ trunk/lib/WysiwygEdit/tinymce.php 2022-03-24 13:43:02 UTC (rev 11011) @@ -38,8 +38,7 @@ class WysiwygEdit_tinymce extends WysiwygEdit { - - function __construct() + public function __construct() { $this->_transformer_tags = false; $this->BasePath = DATA_PATH . '/themes/default/tiny_mce/'; @@ -47,11 +46,10 @@ $this->_wikitextid = "editareawiki"; } - function Head($name = 'edit[content]') + public function Head($name = 'edit[content]') { global $LANG, $WikiTheme; - $WikiTheme->addMoreHeaders - (JavaScript('', array('src' => $this->BasePath . 'tiny_mce.js', + $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $this->BasePath . 'tiny_mce.js', 'language' => 'JavaScript'))); return JavaScript(" tinyMCE.init({ @@ -76,12 +74,17 @@ // to be called after </textarea> // name ignored - function Textarea($textarea, $wikitext, $name = 'edit[content]') + public function Textarea($textarea, $wikitext, $name = 'edit[content]') { - $out = HTML($textarea, - HTML::div(array("id" => $this->_wikitextid, + $out = HTML( + $textarea, + HTML::div( + array("id" => $this->_wikitextid, 'style' => 'display:none'), - $wikitext), "\n"); + $wikitext + ), + "\n" + ); //TODO: maybe some more custom links return $out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |