feat: Add license management and tabbed settings (v0.3.0)

- Implement license management using magdev/wc-licensed-product-client
- Reorganize settings page into License, Default Settings, Integrations tabs
- Add license validation and activation via AJAX
- Frontend features require valid license (admin works always)
- Update translations with German (de_CH) for license strings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 12:03:05 +01:00
parent d62f01cf41
commit f3cd19efe0
15 changed files with 6539 additions and 99 deletions

View File

@@ -27,13 +27,35 @@ class Shortcodes {
private Plugin $plugin;
/**
* Constructor.
* Whether running in unlicensed mode.
*
* @var bool
*/
public function __construct() {
$this->plugin = Plugin::get_instance();
private bool $unlicensed_mode = false;
/**
* Constructor.
*
* @param bool $unlicensed_mode Whether to run in unlicensed mode.
*/
public function __construct( bool $unlicensed_mode = false ) {
$this->plugin = Plugin::get_instance();
$this->unlicensed_mode = $unlicensed_mode;
$this->register_shortcodes();
}
/**
* Get the unlicensed message HTML.
*
* @return string
*/
private function get_unlicensed_message(): string {
return '<div class="fedistream-unlicensed-notice" style="padding: 20px; background: #f0f0f1; border-left: 4px solid #dba617; margin: 10px 0;">'
. '<p style="margin: 0; color: #50575e;">'
. esc_html__( 'This content requires a valid FediStream license.', 'wp-fedistream' )
. '</p></div>';
}
/**
* Register all shortcodes.
*
@@ -501,6 +523,11 @@ class Shortcodes {
* @return string
*/
private function render_template( string $template, array $context ): string {
// Check for unlicensed mode.
if ( $this->unlicensed_mode ) {
return $this->get_unlicensed_message();
}
try {
return $this->plugin->render( $template, $context );
} catch ( \Exception $e ) {