The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Class Bloat - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: Class Bloat (/showthread.php?tid=608) |
Class Bloat - faguss - 06-22-2017 Why is there a class for accessing one global variable? It's faster and simpler to just use: Code: $GLOBALS['config']['mysql']['username'] Similar case with Cookie, Hash, Input, Redirect, Session and Token. They could just be functions instead of static methods. Class Bloat - mudmin - 06-23-2017 There is actually a little bit of a method to the madness. While everyone here downloads userspice as one products, on the backend it is actually 3 products. 1. The open-source classes that were the standard classes constructed and taught by codeAcademy. People who took those courses, learned the classes this way so we learned them. 2. helpers.php are my functions that go in all of my projects, closed or open source. 3. us_helpers.php is mostly functions I only use on userspice or projects built on userspice. So, because the classes came as a set, I left them as a set so the large number of people who learned coding from Alex had them as they were used to. I also keep all these things in sync, so if we do update the db class, it gets updated across all my projects. Same for helpers.php. Not the best answer, but there is a reason. Class Bloat - faguss - 06-30-2017 Function Code: sanitize() Code: helpers.php Code: class Input |