Skip to content

Commit

Permalink
feat: enable onboarding
Browse files Browse the repository at this point in the history
setting a custom constant is now not required any more
  • Loading branch information
eteubert committed Oct 11, 2024
1 parent a47ad4c commit 1ee55db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
16 changes: 9 additions & 7 deletions includes/feature.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php

function podlove_is_onboarding_active()
{
return (bool) defined('PODLOVE_ONBOARDING') && PODLOVE_ONBOARDING;
// default service URL
// If you want to host and use your own service, set the constant in your wp-config.php
// define('PODLOVE_ONBOARDING', 'https://self-hosted-services.example.com/onboarding');
if (!defined('PODLOVE_ONBOARDING')) {
define('PODLOVE_ONBOARDING', 'https://services.podlove.org/onboarding');
}

function podlove_get_onboarding_include()
{
if (podlove_is_onboarding_active() && is_string(PODLOVE_ONBOARDING)) {
return PODLOVE_ONBOARDING;
} else {
if (is_string(PODLOVE_ONBOARDING)) {
return PODLOVE_ONBOARDING;
}

return null;
}
}
4 changes: 1 addition & 3 deletions lib/ajax/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,9 +922,7 @@ public function banner_hide()
exit;
}

if (\podlove_is_onboarding_active()) {
Onboarding::set_banner_hide('true');
}
Onboarding::set_banner_hide('true');
}

public function get_license_url()
Expand Down
12 changes: 5 additions & 7 deletions lib/modules/onboarding/onboarding.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ class Onboarding extends \Podlove\Modules\Base

public function load()
{
if (\podlove_is_onboarding_active()) {
add_action('admin_enqueue_scripts', [$this, 'add_scripts_and_styles']);
add_action('admin_notices', [$this, 'onboarding_banner']);
add_action('admin_menu', [$this, 'add_onboarding_menu'], 20);
add_action('rest_api_init', [$this, 'api_init']);
}
add_action('admin_enqueue_scripts', [$this, 'add_scripts_and_styles']);
add_action('admin_notices', [$this, 'onboarding_banner']);
add_action('admin_menu', [$this, 'add_onboarding_menu'], 20);
add_action('rest_api_init', [$this, 'api_init']);
}

public static function is_visible()
{
return \podlove_is_onboarding_active();
return true;
}

public function onboarding_banner()
Expand Down

0 comments on commit 1ee55db

Please sign in to comment.