DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:releases:refactor2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:releases:refactor2 [2020-09-03 15:11] – [Only new events with dokuwiki\Form\Form from DokuWiki] s-saharadevel:releases:refactor2 [2021-12-19 16:09] (current) – moved to [[devel:releases:refactor2021]] Klap-in
Line 1: Line 1:
-====== Refactoring ====== 
-Suggestions for development version (August 2020 and later) of Dokuwiki.  
  
-[[devel:develonly]] 
- 
-===== Refactored UI elements using Form\Form class ===== 
- 
-Implemented by [[pr>3198|PR 3198]]  
- 
-==== Only new events with dokuwiki\Form\Form from DokuWiki ==== 
- 
-DokuWiki used before this release ''Doku_Form'' at a lot of places. The old ''Doku_Form'' triggered a [[codesearch>HTML_*FORM_OUTPUT]] event, when it was outputted by ''html_form()''. DokuWiki core code is updated to use the [[devel:form|new forms]], therefore the old events are **not triggered** anymore. The new style ''Form'' triggers [[codesearch>FORM_*_OUTPUT]] event when its HTML-Representation is generated by ''toHTML()'' method.  
- 
-:!: To enable your actions again, the new event handlers have to be implemented as well. The new events should pass the new ''dokuwiki\Form\Form'' object as the event data. The old event handlers can be kept temporary for backward compatibility. 
- 
- 
-Changes to the ''dokuwiki\Form\Form''. An optional argument is added to ''toHTML()'' to make code simple without a separate event trigger. 
-<code diff> 
-- Event::createAndTrigger('FORM_SEARCH_OUTPUT', $searchForm); 
-- return $searchForm->toHTML(); 
-+ return $searchForm->toHTML('Search'); 
-</code> 
- 
-See for the description of the events: 
-| New  |[[devel:event:FORM_EDIT_OUTPUT]], [[devel:event:FORM_LOGIN_OUTPUT]], [[devel:event:FORM_CONFLICT_OUTPUT]], [[devel:event:FORM_DRAFT_OUTPUT]], [[devel:event:FORM_RECENT_OUTPUT]], [[devel:event:FORM_REVISIONS_OUTPUT]], [[devel:event:FORM_SEARCH_OUTPUT]], [[devel:event:FORM_SUBSCRIBE_OUTPUT]], [[devel:event:FORM_UPDATEPROFILE_OUTPUT]], [[devel:event:FORM_PROFILEDELETE_OUTPUT]], [[devel:event:FORM_REGISTER_OUTPUT]], [[devel:event:FORM_RESENDPWD_OUTPUT]], [[devel:event:FORM_UPLOAD_OUTPUT]], [[devel:event:FORM_SEARCHMEDIA_OUTPUT]], [[devel:event:FORM_QUICKSEARCH_OUTPUT]] | 
-| Old  |[[devel:event:HTML_EDITFORM_OUTPUT]], [[devel:event:HTML_LOGINFORM_OUTPUT]], [[devel:event:HTML_CONFLICTFORM_OUTPUT]], [[devel:event:HTML_DRAFTFORM_OUTPUT]], [[devel:event:HTML_RECENTFORM_OUTPUT]], [[devel:event:HTML_REVISIONSFORM_OUTPUT]], [[devel:event:HTML_SUBSCRIBEFORM_OUTPUT]], [[devel:event:HTML_UPDATEPROFILEFORM_OUTPUT]], [[devel:event:HTML_PROFILEDELETEFORM_OUTPUT]], [[devel:event:HTML_REGISTERFORM_OUTPUT]], [[devel:event:HTML_RESENDPWDFORM_OUTPUT]], [[devel:event:HTML_UPLOADFORM_OUTPUT]] |  
- 
-==== Removed, deprecated and changed functions ==== 
- 
- 
-**Removed** functions: [[codesearch>html_hilight_callback]], [[codesearch>html_li_default]], [[codesearch>html_insert_softbreaks]], [[codesearch>html_minoredit]] 
-<code diff> 
-- $html = @preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html); 
-+ $html = @preg_replace_callback("/((<[^>]*)|$regex)/ui", function ($match) { 
-+     $hlight = unslash($match[0]); 
-+     if (!isset($match[2])) { 
-+         $hlight = '<span class="search_hit">'.$hlight.'</span>'; 
-+     } 
-+     return $hlight; 
-+ }, $html); 
-</code> 
- 
-<code diff> 
-// if you use only the callback 'html_li_default' 
-- $html = html_buildlist($data, $class, $func, $lifunc = 'html_li_default',$forcewrapper = false){ 
-+ $html = html_buildlist($data, $class, $func, $lifunc = null, $forcewrapper = false){ 
- 
-// if you wrote your own buildlist function: 
-- function html_your_buildlist($data, $class, $func, $lifunc = 'html_li_default',$forcewrapper = false){ 
-+ function html_your_buildlist($data, $class, $func, $lifunc = null, $forcewrapper = false) { 
-    ... 
-+   // set callback function to build the <li> tag, formerly defined as html_li_default() 
-+   if (!is_callable($lifunc)) { 
-+      $lifunc = function ($item) { 
-+          return '<li class="level'.$item['level'].'">'; 
-+      }; 
-+   } 
-</code> 
- 
-Not visible anymore: 
-<code diff> 
-- $html = html_insert_softbreaks($diffhtml) 
-// See the protected function dokuwiki\Ui\Diff::insertSoftbreaks() 
-</code> 
- 
-Moved functions: 
-<code diff> 
-- html_edit_form($data) 
-+ (new dokuwiki\Ui\Editor)->addTextarea($data) 
- 
-- $elem = html_minoredit() 
-// See dokuwiki\UI\Editor::show() 
-// its code is now inlined: 
-    // adds a checkbox for minor edits for logged in users 
-    if ($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) { 
-        $form->addHTML(' '); 
-        $form->addCheckbox('minor', $lang['minoredit'])->id('edit__minoredit')->addClass('nowrap')->val('1'); 
-    } 
-</code> 
- 
- 
- 
-Deprecated functions: [[codesearch>html_login]], [[codesearch>html_show]], [[codesearch>html_locked]], [[codesearch>html_index]], [[codesearch>html_list_index]], [[codesearch>html_li_index]], Some usages of [[codesearch>html_buildlist]], [[codesearch>html_backlinks]], [[codesearch>html_diff_head]], [[codesearch>html_diff]], [[codesearch>html_conflict]], [[codesearch>html_register]], [[codesearch>html_edit]], [[codesearch>tpl_subscribe]] 
- 
-Deprecated and only used in DokuWiki: [[codesearch>html_denied]], [[codesearch>html_showrev]], [[codesearch>html_draft]], [[codesearch>html_revisions]], [[codesearch>html_recent]], [[codesearch>html_updateprofile]], [[codesearch>html_resendpwd]] 
- 
- 
-<code diff> 
-- html_login($svg) 
-+ (new dokuwiki\Ui\Login($svg))->show() 
- 
-- html_denied()  
-+ // see \dokuwiki\Action\Denied::tplContent() 
- 
-- html_showrev() 
-+ (new dokuwiki\Ui\PageView)->showrev() 
- 
-- html_show($txt) 
-+ (new dokuwiki\Ui\PageView($txt))->show() 
- 
-- html_draft() 
-+ (new Ui\PageDraft)->show() 
- 
-- html_locked() 
-+ // see inc/Action/Locked::tplContent() 
- 
-- html_revisions($first, $media_id) 
-+ (new dokuwiki\Ui\Revisions($first, $media_id))->show() 
- 
-- html_recent($first, $show_changes) 
-+ (new dokuwiki\Ui\Recent($first, $show_changes))->show() 
- 
-- html_index($ns) 
-+ (new dokuwiki\Ui\Index($ns))->show() 
- 
-- $html = html_list_index($item) 
-+ $html = (new dokuwiki\Ui\Index)->formatListItem($item) 
- 
-- $html = html_li_index($item) { 
-+ $html = (new dokuwiki\Ui\Index)->tagListItem($item); 
- 
-- $html = html_buildlist($data, 'idx', 'html_list_index', 'html_li_index') 
-+ $html = (new Ui\Index)->buildIndexList($data) 
-// Note: html_list_index() and html_li_index() are replaced by  
-// [$this,'formatListItem'] and [$this,'tagListItem'] or 
-// [(new dokuwiki\Ui\Index),'formatListItem'] and [(new dokuwiki\Ui\Index),'tagListItem'] 
-CHECK: IS THIS LAST LINE CORRECT?? 
- 
-// The general function is still available 
-$html = html_buildlist($data, $class, $func, $lifunc = null, $forcewrapper = false) 
- 
-- html_backlinks() { 
-+ (new dokuwiki\Ui\Backlinks)->show(); 
- 
-- $html = html_diff_head($l_rev, $r_rev, $id, $media, $inline) 
-+ $html = (new dokuwiki\Ui\Diff)->diffHead($l_rev, $r_rev, $id, $media, $inline) 
- 
-- html_diff($text, $intro, $type) 
-+ (new dokuwiki\Ui\Diff($text, $intro, $type))->show() 
- 
-- html_conflict($text, $summary) 
-+ (new dokuwiki\Ui\Conflict($text, $summary))->show() 
- 
-$text = con($PRE, $TEXT, $SUF); 
-- html_conflict($text, $summary); 
-- html_diff($text, false); 
-+ (new Ui\PageConflict($text, $summary))->show(); 
- 
-- html_register() 
-+ (new dokuwiki\Ui\UserRegister)->show() 
- 
-- html_updateprofile() 
-+ (new dokuwiki\Ui\UserProfile)->show() 
- 
-- html_edit() 
-+ (new dokuwiki\Ui\Editor)->show() 
- 
-- html_resendpwd() 
-+ (new dokuwiki\Ui\UserResendPwd)->show() 
-</code> 
- 
-<code diff> 
-- tpl_subscribe() 
-+ (new \dokuwiki\Ui\Subscribe)->show(); 
-</code> 
- 
-Changed function: [[codesearch>html_sizechange]] 
-<code diff> 
-- html_sizechange($sizechange, $form) // where $form is the old Doku_Form 
-+ $html = html_sizechange($sizechange) 
-</code> 
-===== Sort with collator ===== 
- 
-[[pr>3115]] 
- 
-Improved sort in different languages. Not backward compatible. Maybe include library with exist check? 
- 
- 
-===== Refactor fulltext search functions and class Doku_Indexer ===== 
-  
- 
-[[pr>2943]] 
devel/releases/refactor2.1599138672.txt.gz · Last modified: 2020-09-03 15:11 by s-sahara

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki