impresscms icon indicating copy to clipboard operation
impresscms copied to clipboard

transform the functions.php file into icms_* class functionalities

Open fiammybe opened this issue 7 years ago • 5 comments

The include/functions.php contains a huge number of functions that should be transformed into class functions. Some of them are still using the xoops_* name, so they should be deprecated and removed.

fiammybe avatar Feb 17 '18 20:02 fiammybe

I agree but I don't think so if it will be possible for us to remove complete it before 2.1, because:

  • xoops_header - deprecated was in 2.0
  • xoops_footer - same
  • xoops_getUserTimestamp - need to reimplement
  • userTimeToServerTime - same
  • formatURL - probably we need to use any HTTP PSR lib?
  • redirect_header - made changed to response and deprecate (all popular frameworks gives same functionality with response object)
  • xoops_getenv - idk if we need it, I think php has env function for that
  • xoops_getcss - move to theme generation
  • xoops_gethandler - get rid of it. creating instances not function but directly is a better way for most code editors (f.e. $handler = new \ICMS\Module\Handler(); )
  • xoops_notification_deletebymodule - need to implement todo
  • xoops_notification_deletebyuser - same
  • xoops_notification_deletebyitem - same
  • xoops_comment_count - move to comments class
  • xoops_comment_delete - same
  • xoops_groupperm_deletebymoditem - same
  • xoops_utf8_encode - do we really need it?
  • xoops_convert_encoding - same
  • xoops_getLinkedUnameFromId - move to user class
  • icms_getModuleInfo - move to module class
  • icms_getModuleConfig - same
  • icms_getConfig - move to config class
  • icms_getCurrentModuleName - static module class function
  • icms_userIsAdmin - move to user class
  • icms_loadLanguageFile - maybe icms class would be good enough if we still use language files made with constants
  • icms_getfloat - maybe is useful but not for icms class
  • icms_currency - move to properies functionality to automatically extract currency if that wasn't implemented there already
  • icms_float - we should deprecate it?
  • icms_purifyText - HTMlPurifier functionality is here. Deprecate!
  • icms_html2text - why use this if php has htmlentities?
  • icms_cleanTags - HTMLPurifier functionality
  • icms_setCookieVar - to cookies class
  • icms_getCookieVar - same
  • icms_get_page_before_form - move to request class
  • icms_sanitizeCustomtags_callback - move to custom tags handler?
  • icms_sanitizeAdsenses_callback - move to adsenses handler?
  • icms_getTablesArray - move to module class
  • showNav - icms class?
  • StopXSS - HTMLPurifier
  • icms_sanitizeContentCss - same
  • icms_get_base_domain - see todo
  • icms_get_url_domain - same
  • icms_wordwrap - see another todo
  • getDbValue - deprecate
  • icms_escapeValue - same
  • icms_conv_nr2local - see todo
  • icms_conv_local2nr - same
  • Icms_getMonthNameById - another todo
  • ext_date - same
  • formatTimestamp - same
  • icms_getModuleHandler - deprecate and use class names instead for creating handler
  • icms_getPreviousPage - to response class
  • icms_getModuleAdminLink - to module class
  • icms_getImageSize - see todo
  • icms_getCurrentUrls - maybe we can remove?
  • icms_imageResize - see todo
  • icms_getModuleName - move to module class
  • icms_convert_size - see todo
  • icms_random_str - see todo
  • icms_adminMenu - see another todo
  • icms_loadCommonLanguageFile - maybe icms class?
  • icms_getCurrentPage - remove
  • icms_getModuleNameForSEO - move to module class
  • icms_getModuleModeSEO - same
  • icms_getModuleIncludeIdSEO - same
  • icms_getenv - deprecate
  • icms_get_module_status - see todo
  • one_wordwrap - see another todo
  • icms_PasswordMeter - see todo
  • icms_buildCriteria - deprecate?
  • icms_getBreadcrumb - deprecate and move as static icms_view_Breadcrumb method
  • icms_makeSmarty - deprecated was in 2.0
  • icms_moduleAction - move to module class
  • mod_constant - ???
  • icms_collapsableBar - ???
  • icms_ajaxCollapsableBar - ???
  • icms_openclose_collapsable - ???
  • icms_close_collapsable - ???
  • icms_getUnameFromUserEmail - move to user class
  • icms_need_do_br - ???

MekDrop avatar Feb 17 '18 23:02 MekDrop

This issue was automatically marked as stale

github-actions[bot] avatar May 28 '21 07:05 github-actions[bot]

I'll try to look into this.

MekDrop avatar Oct 11 '22 08:10 MekDrop

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or assign sombody or this will be closed in 5 days.

github-actions[bot] avatar Dec 11 '22 02:12 github-actions[bot]

We can take this on in a similar way like we handled the migration from the old 1.2.x to 1.3. Basically, we replace the code and put it in the correct class, while calling the new class from the old function, triggering a deprecation notice every time. That means this will be a task that might span several releases, which is fine as far as I'm concerned.

fiammybe avatar Feb 15 '23 13:02 fiammybe