refactor: remove Hungarian notation and MCI
prefixes
I had to use some RegEx-fu for this. Specifically: ```bash find ./{footnotes.php,includes.php,class/} -type f -name "*.php" -exec sed -i 's/\(p\|l\|a\)_\(str\|bool\|int\|obj\|flo\|arr\)_//g' {} \; find ./{footnotes.php,includes.php,class/} -type f -name "*.php" -exec sed -i 's/MCI_Footnotes/Footnotes/g' {} \; find ./{footnotes.php,includes.php,class/} -type f -name "*.php" -exec sed -i 's/C_\(INT\|STR\|FLO\)_//g' {} \; ``` This should have covered all the bases. In my testing I encountered one error caused by these changes. In the `add_select_box` function in `/class/dashboard/layout.php`, there was a function parameter called `$p_arr_options` and a variable called `$l_str_options`. Removing the Hungarian notation caused an error as these two variables were both now called `$options`. This has been fixed, and I like to think that that will have been the only naming conflict, but I think it is more likely that there maybe others. Further testing is required before I am happy calling this release-ready. Close #34, progress #36
This commit is contained in:
parent
df7160fad8
commit
1284544556
15 changed files with 1710 additions and 1710 deletions
16
includes.php
16
includes.php
|
@ -12,24 +12,24 @@
|
|||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_directory Absolute Directory path to lookup for `*.php` files.
|
||||
* @param string $directory Absolute Directory path to lookup for `*.php` files.
|
||||
*/
|
||||
function mci_footnotes_require_php_files( $p_str_directory ) {
|
||||
function mci_footnotes_require_php_files( $directory ) {
|
||||
// Append slash at the end of the Directory if not exist.
|
||||
if ( '/' !== substr( $p_str_directory, -1 ) ) {
|
||||
$p_str_directory .= '/';
|
||||
if ( '/' !== substr( $directory, -1 ) ) {
|
||||
$directory .= '/';
|
||||
}
|
||||
// Get all PHP files inside Directory.
|
||||
$l_arr_files = scandir( $p_str_directory );
|
||||
$files = scandir( $directory );
|
||||
// Iterate through each class.
|
||||
foreach ( $l_arr_files as $l_str_file_name ) {
|
||||
foreach ( $files as $file_name ) {
|
||||
// Skip all non-PHP files.
|
||||
if ( '.php' !== strtolower( substr( $l_str_file_name, -4 ) ) ) {
|
||||
if ( '.php' !== strtolower( substr( $file_name, -4 ) ) ) {
|
||||
continue;
|
||||
}
|
||||
// phpcs:disable Generic.Commenting.DocComment.MissingShort
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
require_once $p_str_directory . $l_str_file_name;
|
||||
require_once $directory . $file_name;
|
||||
// phpcs:enable
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue