Skip to content

Commit

Permalink
fix: allow unloading certain module features
Browse files Browse the repository at this point in the history
  • Loading branch information
selul committed Sep 11, 2019
1 parent 2f5cbae commit 2a2559a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Modules/Dashboard_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public function can_load( $product ) {
* @return Dashboard_Widget Module instance.
*/
public function load( $product ) {

if ( apply_filters( 'themeisle_sdk_hide_dashboard_widget', false ) ) {
return;
}
$this->product = $product;
$this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' );
$this->feeds = apply_filters(
Expand Down
7 changes: 7 additions & 0 deletions src/Modules/Licenser.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public function register_settings() {
if ( ! is_admin() ) {
return false;
}
if ( apply_filters( $this->product->get_key() . '_hide_license_field', false ) ) {
return;
}
add_settings_field(
$this->product->get_key() . '_license',
$this->product->get_name() . ' license',
Expand Down Expand Up @@ -226,6 +229,10 @@ function show_notice() {
if ( ! is_admin() ) {
return false;
}

if ( apply_filters( $this->product->get_key() . '_hide_license_notices', false ) ) {
return;
}
$status = $this->get_license_status();
$no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to upgrade your plan in order to use %s on more websites. Please ask the %s Staff for more details.' );
$no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
Expand Down
3 changes: 3 additions & 0 deletions src/Modules/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ function ( $value ) {
* @return Notification Module instance.
*/
public function load( $product ) {
if ( apply_filters( 'themeisle_sdk_hide_notifications', false ) ) {
return;
}
$this->product = $product;

$notifications = apply_filters( 'themeisle_sdk_registered_notifications', [] );
Expand Down
5 changes: 5 additions & 0 deletions src/Modules/Uninstall_feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,11 @@ public function can_load( $product ) {
* @return Uninstall_Feedback Current module instance.
*/
public function load( $product ) {

if ( apply_filters( $product->get_key() . '_hide_uninstall_feedback', false ) ) {
return;
}

$this->product = $product;
add_action( 'admin_head', array( $this, 'load_resources' ) );
add_action( 'wp_ajax_' . $this->product->get_key() . '_uninstall_feedback', array( $this, 'post_deactivate' ) );
Expand Down

0 comments on commit 2a2559a

Please sign in to comment.