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
|
@ -18,7 +18,7 @@
|
|||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
*/
|
||||
abstract class MCI_Footnotes_Widget_Base extends WP_Widget {
|
||||
abstract class Footnotes_Widget_Base extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Returns an unique ID as string used for the Widget Base ID.
|
||||
|
@ -64,14 +64,14 @@ abstract class MCI_Footnotes_Widget_Base extends WP_Widget {
|
|||
* @since 1.6.4
|
||||
* @contributor @dartiss
|
||||
* @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720
|
||||
* “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.”
|
||||
* “The called constructor method for WP_Widget in Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.”
|
||||
*/
|
||||
public function __construct() {
|
||||
$l_arr_widget_options = array(
|
||||
$widget_options = array(
|
||||
'classname' => __CLASS__,
|
||||
'description' => $this->get_description(),
|
||||
);
|
||||
$l_arr_control_options = array(
|
||||
$control_options = array(
|
||||
'id_base' => strtolower( $this->get_id() ),
|
||||
'width' => $this->get_widget_width(),
|
||||
);
|
||||
|
@ -79,8 +79,8 @@ abstract class MCI_Footnotes_Widget_Base extends WP_Widget {
|
|||
parent::__construct(
|
||||
strtolower( $this->get_id() ), // Unique ID for the widget, has to be lowercase.
|
||||
$this->get_name(), // Plugin name to be displayed.
|
||||
$l_arr_widget_options, // Optional Widget Options.
|
||||
$l_arr_control_options // Optional Widget Control Options.
|
||||
$widget_options, // Optional Widget Options.
|
||||
$control_options // Optional Widget Control Options.
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base {
|
||||
class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
|
||||
|
||||
/**
|
||||
* Returns an unique ID as string used for the Widget Base ID.
|
||||
|
@ -31,7 +31,7 @@ class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base
|
|||
* @return string
|
||||
*/
|
||||
protected function get_name() {
|
||||
return MCI_Footnotes_Config::C_STR_PLUGIN_NAME;
|
||||
return Footnotes_Config::PLUGIN_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,9 +69,9 @@ class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base
|
|||
public function widget( $args, $instance ) {
|
||||
global $g_obj_mci_footnotes;
|
||||
// Reference container positioning is set to "widget area".
|
||||
if ( 'widget' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) {
|
||||
if ( 'widget' === Footnotes_Settings::instance()->get( Footnotes_Settings::REFERENCE_CONTAINER_POSITION ) ) {
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo $g_obj_mci_footnotes->a_obj_task->reference_container();
|
||||
echo $g_obj_mci_footnotes->task->reference_container();
|
||||
// phpcs:enable
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue