[ postfixadmin-Feature Requests-3006020 ] Advanced Config and Lang
Brought to you by:
christian_boltz,
gingerdog
From: SourceForge.net <no...@so...> - 2011-10-26 23:55:48
|
Feature Requests item #3006020, was opened at 2010-05-23 16:53 Message generated for change (Comment added) made by valkum You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937967&aid=3006020&group_id=191583 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Valkum (valkum) Assigned to: Nobody/Anonymous (nobody) Summary: Advanced Config and Lang Initial Comment: I think about use an extended version of Config and Lang variables. In my CLI I use a simple class, cloned from Joomla!. I think this should be implemented in functions.inc.php. With this class you can read even lang and conf option in classes. This is not working with globals. ---------------------------------------------------------------------- >Comment By: Valkum (valkum) Date: 2011-10-27 01:55 Message: What about changing the whole Lang object to use a helper function t("string") t("string") looks in Conf for language and include_once the matching language file when it is not already included. then t() returns the matching string ---------------------------------------------------------------------- Comment By: GingerDog (gingerdog) Date: 2011-10-26 01:14 Message: (I'm also not sure how the Lang class will actually behave, especially under PHP5.2 where there isn't late static binding. I have a feeling calling Lang::getInstance() may actually return a Config object. If Lang has no functionality over/above a Config object, is it worth having having - why not just store the stuff in Config? ---------------------------------------------------------------------- Comment By: GingerDog (gingerdog) Date: 2011-10-26 01:12 Message: <2p> To be argumentative - Changing the configuration to be in an object which is a singleton and silently used everywhere isn't really any different to using a global array - it's still "a magic thing" which the callee/user has no direct control over. The code has a high coupling to Config (the class) just in the same way as it had a high coupling to the $CONF array. Really the model classes should support injection of the Config/Lang objects so they can be (if necessary) swapped for something else to aid testing and reuse. </2p> ---------------------------------------------------------------------- Comment By: Christian Boltz (christian_boltz) Date: 2011-10-26 01:02 Message: In the meantime I moved your classes to model/ and removed duplicate code - the "Lang" class shrunk to class Lang extends Config { # exactly the same code, just another name ;-) } ;-) Some functions already use Lang::read and Config::read, the others will follow sooner or later. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937967&aid=3006020&group_id=191583 |