2011-01-22, 15:33:30
(This post was last modified: 2011-01-22, 15:34:35 by wanwan1426.)
I've been going through all the CMS options on opensourcecms and I must say GetSimple is very nice and clean, and the code is well written for the most part. I was looking through some of the code for my own site customization and noticed some minor code bits that might be written better from a functional standpoint.
Typically, and this is maybe stemming from my DOS batch file scripting, when you declare a constant or variable that is the base path of the following variables, you simply reuse it after setting it.
In the admin/inc/common.php file there is a block of code:
Seems that calling the get_root_path() function over and over is extremely unnecessary and while it's probably not a noticeable performance hit.. maybe a few nanoseconds... from a development standpoint, it means changing a lot more code. Something like this would seem more appropriate, where you reuse the initially defined constants:
This cuts down on the back and forth between the function file and the common file and makes it more developer friendly.
It's no showstopper of course. Thank you for a great product
Typically, and this is maybe stemming from my DOS batch file scripting, when you declare a constant or variable that is the base path of the following variables, you simply reuse it after setting it.
In the admin/inc/common.php file there is a block of code:
Code:
// Define some constants
define('GSROOTPATH', get_root_path());
define('GSADMINPATH', get_admin_path());
define('GSADMININCPATH', get_admin_path(). 'inc/');
define('GSPLUGINPATH', get_root_path(). 'plugins/');
define('GSLANGPATH', get_admin_path(). 'lang/');
define('GSDATAPATH', get_root_path(). 'data/');
define('GSDATAOTHERPATH', get_root_path(). 'data/other/');
define('GSDATAPAGESPATH', get_root_path(). 'data/pages/');
define('GSDATAUPLOADPATH', get_root_path(). 'data/uploads/');
define('GSTHUMBNAILPATH', get_root_path(). 'data/thumbs/');
define('GSBACKUPSPATH', get_root_path(). 'backups/');
define('GSTHEMESPATH', get_root_path(). 'theme/');
Seems that calling the get_root_path() function over and over is extremely unnecessary and while it's probably not a noticeable performance hit.. maybe a few nanoseconds... from a development standpoint, it means changing a lot more code. Something like this would seem more appropriate, where you reuse the initially defined constants:
Code:
// Define some constants
define('GSROOTPATH', get_root_path());
define('GSADMINPATH', get_admin_path());
define('GSADMININCPATH', GSADMINPATH. 'inc/');
define('GSPLUGINPATH', GSROOTPATH. 'plugins/');
define('GSLANGPATH', GSADMINPATH. 'lang/');
define('GSDATAPATH', GSROOTPATH. 'data/');
define('GSDATAOTHERPATH', GSROOTPATH. 'data/other/');
define('GSDATAPAGESPATH', GSROOTPATH. 'data/pages/');
define('GSDATAUPLOADPATH', GSROOTPATH. 'data/uploads/');
define('GSTHUMBNAILPATH', GSROOTPATH. 'data/thumbs/');
define('GSBACKUPSPATH', GSROOTPATH. 'backups/');
define('GSTHEMESPATH', GSROOTPATH. 'theme/');
This cuts down on the back and forth between the function file and the common file and makes it more developer friendly.
It's no showstopper of course. Thank you for a great product