Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow to override instance implementations #100

Open
leoloso opened this issue Mar 19, 2017 · 0 comments
Open

Feature request: allow to override instance implementations #100

leoloso opened this issue Mar 19, 2017 · 0 comments

Comments

@leoloso
Copy link

leoloso commented Mar 19, 2017

Hi,

I use your plugin for a framework I've built, however I needed a couple of minor changes to make it work. Please check if you agree with these changes, then I can do the pull request and implement them myself.

*1. I need to change some functionality in classes AAL_API and AAL_Notifications, for which I've inherited from these classes. So, I need to be able to set the my own instances of these classes instead of the default ones.

In function AAL_Main::__construct(), I'd like to change:

$this->ui = new AAL_Admin_Ui();
$this->hooks = new AAL_Hooks();
$this->settings = new AAL_Settings();
$this->api = new AAL_API();
$this->notifications = new AAL_Notifications();
$this->help = new AAL_Help();

With add_action ('plugins_loaded', array($this, 'init_instances'), 1000);, and then:

function init_instances() {

	$ui_class = apply_filters('AAL_Main:ui:classname', 'AAL_Admin_Ui');
	$hooks_class = apply_filters('AAL_Main:hooks:classname', 'AAL_Hooks');
	$settings_class = apply_filters('AAL_Main:settings:classname', 'AAL_Settings');
	$api_class = apply_filters('AAL_Main:api:classname', 'AAL_API');
	$notifications_class = apply_filters('AAL_Main:notifications:classname', 'AAL_Notifications');
	$help_class = apply_filters('AAL_Main:help:classname', 'AAL_Help');

	$this->ui = new $ui_class();
	$this->hooks = new $hooks_class();
	$this->settings = new $settings_class();
	$this->api = new $api_class();
	$this->notifications = new $notifications_class();
	$this->help = new $help_class();
}

*2. I'd like to keep the notifications table, even if uninstalling the plug-in. Could there be an option, or even a hook, for this? I refer to this line, on file classes/class-aal-maintenance.php:

register_uninstall_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'uninstall' ) );

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant