Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ec08c79aab | |||
| 4a789363c5 | |||
|
|
c279ea7247 |
@@ -1,85 +1,49 @@
|
||||
# Nieuwe License Validator en Updater
|
||||
# SitiWebUpdater2 - Globale Plugin Updater
|
||||
|
||||
Deze plugin gebruikt nu een eigen licentie- en updatesysteem via plugins.robert.ooo in plaats van GitHub.
|
||||
Deze class gebruikt een globale registry zodat alle plugins die deze updater gebruiken hun licenties op één centrale pagina beheren.
|
||||
|
||||
## Gebruik
|
||||
|
||||
### License Validator
|
||||
### Basis setup (per plugin)
|
||||
|
||||
```php
|
||||
require_once __DIR__ . '/includes/SitiLicenseValidator.php';
|
||||
require_once 'path/to/SitiWebUpdater2.php';
|
||||
|
||||
// Initialiseer validator
|
||||
$validator = new SitiLicenseValidator();
|
||||
|
||||
// Stel licentie in (van settings)
|
||||
$validator->set_license_key( get_option( 'siti_license_key' ) );
|
||||
|
||||
// Verificeer
|
||||
$result = $validator->verify();
|
||||
if ( is_wp_error( $result ) ) {
|
||||
// Toon fout
|
||||
echo $result->get_error_message();
|
||||
} else {
|
||||
// Licentie geldig
|
||||
$version = $result['license']['pluginVersion'];
|
||||
}
|
||||
```
|
||||
|
||||
### SitiWebUpdater2
|
||||
|
||||
```php
|
||||
require_once __DIR__ . '/includes/SitiWebUpdater2.php';
|
||||
|
||||
// Initialiseer updater
|
||||
$updater = new SitiWebUpdater2( __FILE__ );
|
||||
|
||||
// Stel owner/repo in (bijv. van manifest.json)
|
||||
$updater->set_owner( 'siti-ai-product-content-generator' );
|
||||
$updater->set_repository( 'siti-ai-product-content-generator' );
|
||||
|
||||
// Stel licentie in voor downloads
|
||||
$updater->set_license_key( get_option( 'siti_license_key' ) );
|
||||
|
||||
// API URL (optioneel, default is plugins.robert.ooo)
|
||||
$updater->set_api_base_url( 'https://plugins.robert.ooo' );
|
||||
$updater->set_owner( 'jouw-github-username' );
|
||||
$updater->set_repository( 'jouw-plugin-repo' );
|
||||
$updater->initialize();
|
||||
```
|
||||
|
||||
## Instellingen
|
||||
### Automatische features
|
||||
|
||||
Voeg in je admin settings pagina velden toe voor:
|
||||
De updater doet alles automatisch:
|
||||
|
||||
- Licentiecode
|
||||
- API URL (optioneel)
|
||||
1. **Globale license pagina**: Voegt één instellingen pagina toe onder Instellingen > Plugin Licenties
|
||||
2. **Admin notices**: Toont rood bericht per plugin als licentie ongeldig is
|
||||
3. **Dagelijkse checks**: Controleert dagelijks alle licenties
|
||||
4. **Auto-updates**: Controleert op updates voor alle plugins
|
||||
|
||||
Sla op in wp_options:
|
||||
### Centrale licentie pagina
|
||||
|
||||
```php
|
||||
update_option( 'siti_license_key', sanitize_text_field( $_POST['license_key'] ) );
|
||||
update_option( 'siti_api_url', esc_url_raw( $_POST['api_url'] ) ?: 'https://plugins.robert.ooo' );
|
||||
```
|
||||
Alle plugins die SitiWebUpdater2 gebruiken verschijnen automatisch op de centrale pagina `Instellingen > Plugin Licenties`, waar je alle licentiecodes in één keer kunt beheren.
|
||||
|
||||
## Cron Job voor Licentie Checks
|
||||
## Configuratie
|
||||
|
||||
```php
|
||||
add_action( 'siti_daily_license_check', function() {
|
||||
$validator = new SitiLicenseValidator();
|
||||
$result = $validator->verify();
|
||||
// Log of handel af
|
||||
} );
|
||||
- **Owner/Repo**: Stel in via `set_owner()` en `set_repository()`
|
||||
- **API URL**: Standaard `https://plugins.robert.ooo`, aanpasbaar met `set_api_base_url()`
|
||||
- **License key**: Wordt opgeslagen in eigen option key per plugin
|
||||
|
||||
if ( ! wp_next_scheduled( 'siti_daily_license_check' ) ) {
|
||||
wp_schedule_event( time(), 'daily', 'siti_daily_license_check' );
|
||||
}
|
||||
```
|
||||
## Option Keys (per plugin)
|
||||
|
||||
## Admin Notices
|
||||
- `siti_updater_{plugin_slug}_license_key`: De licentiecode
|
||||
- `siti_updater_{plugin_slug}_license_data`: Gecachte licentie data
|
||||
- `siti_updater_{plugin_slug}_last_check`: Timestamp laatste check
|
||||
|
||||
```php
|
||||
add_action( 'admin_notices', function() {
|
||||
$validator = new SitiLicenseValidator();
|
||||
if ( ! $validator->is_valid() ) {
|
||||
echo '<div class="notice notice-error"><p>Licentie ongeldig. Controleer je instellingen.</p></div>';
|
||||
}
|
||||
} );
|
||||
```
|
||||
## Cron Jobs (per plugin)
|
||||
|
||||
- `siti_updater_daily_check_siti_updater_{plugin_slug}_`: Dagelijkse licentie verificatie
|
||||
|
||||
## Herbruikbaarheid
|
||||
|
||||
Deze class is volledig herbruikbaar in meerdere plugins. Elke plugin registreert zichzelf automatisch in de globale registry en verschijnt op de centrale licentie pagina.
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: SitiAI Product Teksten
|
||||
* Description: Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce.
|
||||
* Version: 1.9.3
|
||||
* Version: 1.9.4
|
||||
* Author: Roberto Guagliardo | SitiWeb
|
||||
* Author URI: https://sitiweb.nl/
|
||||
* Text Domain: siti-ai-product-content-generator
|
||||
|
||||
@@ -10,10 +10,12 @@ class SitiLicenseValidator {
|
||||
private $api_base_url = 'https://plugins.robert.ooo';
|
||||
private $license_key;
|
||||
private $hostname;
|
||||
private $plugin_version;
|
||||
|
||||
public function __construct( $license_key = null, $hostname = null ) {
|
||||
public function __construct( $license_key = null, $hostname = null, $plugin_version = null ) {
|
||||
$this->license_key = $license_key ?: get_option( 'siti_license_key' );
|
||||
$this->hostname = $hostname ?: parse_url( home_url(), PHP_URL_HOST );
|
||||
$this->plugin_version = $plugin_version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,6 +39,13 @@ class SitiLicenseValidator {
|
||||
$this->hostname = $hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plugin version for reporting purposes
|
||||
*/
|
||||
public function set_plugin_version( $version ) {
|
||||
$this->plugin_version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the license
|
||||
*
|
||||
@@ -56,8 +65,9 @@ class SitiLicenseValidator {
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'body' => wp_json_encode( array(
|
||||
'key' => $this->license_key,
|
||||
'hostname' => $this->hostname,
|
||||
'key' => $this->license_key,
|
||||
'hostname' => $this->hostname,
|
||||
'currentVersion' => $this->plugin_version,
|
||||
) ),
|
||||
'timeout' => 15,
|
||||
) );
|
||||
@@ -69,22 +79,30 @@ class SitiLicenseValidator {
|
||||
$code = wp_remote_retrieve_response_code( $response );
|
||||
$body = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
if ( ! is_array( $body ) ) {
|
||||
return new WP_Error( 'verification_failed', 'Onverwacht antwoord van licentieserver.' );
|
||||
}
|
||||
|
||||
$has_payload = isset( $body['license'] ) || isset( $body['pluginVersion'] ) || isset( $body['version'] );
|
||||
|
||||
if ( 200 !== $code ) {
|
||||
if ( $has_payload ) {
|
||||
$this->store_license_payload( $body );
|
||||
}
|
||||
|
||||
$error_message = isset( $body['error'] ) ? $body['error'] : 'Licentie verificatie mislukt.';
|
||||
return new WP_Error( 'verification_failed', $error_message );
|
||||
}
|
||||
|
||||
if ( empty( $body['valid'] ) ) {
|
||||
if ( $has_payload ) {
|
||||
$this->store_license_payload( $body );
|
||||
}
|
||||
|
||||
return new WP_Error( 'invalid_license', 'Licentie is ongeldig.' );
|
||||
}
|
||||
|
||||
// Update last check time
|
||||
update_option( 'siti_license_last_check', current_time( 'mysql' ) );
|
||||
|
||||
// Store license data
|
||||
if ( isset( $body['license'] ) ) {
|
||||
update_option( 'siti_license_data', $body['license'] );
|
||||
}
|
||||
$this->store_license_payload( $body );
|
||||
|
||||
return $body;
|
||||
}
|
||||
@@ -127,4 +145,37 @@ class SitiLicenseValidator {
|
||||
// In practice, you might want to proxy this through WordPress
|
||||
return $this->api_base_url . '/api/licenses/download?key=' . urlencode( $this->license_key ) . '&hostname=' . urlencode( $this->hostname ) . '&version=' . urlencode( $version );
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist payload data locally for UI purposes
|
||||
*/
|
||||
private function store_license_payload( $body ) {
|
||||
$license_data = array();
|
||||
|
||||
if ( isset( $body['license'] ) && is_array( $body['license'] ) ) {
|
||||
$license_data = $body['license'];
|
||||
}
|
||||
|
||||
if ( empty( $license_data['key'] ) ) {
|
||||
$license_data['key'] = $this->license_key;
|
||||
}
|
||||
|
||||
$version = null;
|
||||
if ( ! empty( $body['pluginVersion'] ) ) {
|
||||
$version = $body['pluginVersion'];
|
||||
} elseif ( ! empty( $body['version'] ) ) {
|
||||
$version = $body['version'];
|
||||
}
|
||||
|
||||
if ( $version ) {
|
||||
$license_data['pluginVersion'] = $version;
|
||||
}
|
||||
|
||||
if ( empty( $license_data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_option( 'siti_license_data', $license_data );
|
||||
update_option( 'siti_license_last_check', current_time( 'mysql' ) );
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
class SitiWebUpdater2 {
|
||||
|
||||
private static $instances = array();
|
||||
private static $global_settings_registered = false;
|
||||
|
||||
private $file;
|
||||
private $plugin;
|
||||
private $basename;
|
||||
@@ -24,6 +27,9 @@ class SitiWebUpdater2 {
|
||||
$this->option_prefix = 'siti_updater_' . sanitize_key( dirname( plugin_basename( $this->file ) ) ) . '_';
|
||||
$this->set_plugin_properties();
|
||||
|
||||
// Register this instance globally
|
||||
self::$instances[ $this->option_prefix ] = $this;
|
||||
|
||||
add_action( 'admin_init', array( $this, 'set_plugin_properties' ) );
|
||||
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
||||
add_action( 'siti_updater_daily_check_' . $this->option_prefix, array( $this, 'daily_license_check' ) );
|
||||
@@ -38,7 +44,12 @@ class SitiWebUpdater2 {
|
||||
public function initialize() {
|
||||
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_for_updates' ) );
|
||||
add_filter( 'plugins_api', array( $this, 'plugin_info' ), 10, 3 );
|
||||
add_action( 'admin_menu', array( $this, 'add_settings_page' ) );
|
||||
|
||||
// Register global settings page only once
|
||||
if ( ! self::$global_settings_registered ) {
|
||||
add_action( 'admin_menu', array( $this, 'add_global_settings_page' ) );
|
||||
self::$global_settings_registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function set_plugin_properties() {
|
||||
@@ -51,6 +62,14 @@ class SitiWebUpdater2 {
|
||||
$this->active = is_plugin_active( $this->basename );
|
||||
}
|
||||
|
||||
public static function get_instances() {
|
||||
return self::$instances;
|
||||
}
|
||||
|
||||
public function get_plugin_data() {
|
||||
return $this->plugin;
|
||||
}
|
||||
|
||||
public function set_owner( $owner ) {
|
||||
$this->owner = $owner;
|
||||
}
|
||||
@@ -60,8 +79,15 @@ class SitiWebUpdater2 {
|
||||
}
|
||||
|
||||
public function set_license_key( $key ) {
|
||||
$this->license_key = $key;
|
||||
update_option( $this->option_prefix . 'license_key', $key );
|
||||
$sanitized_key = sanitize_text_field( (string) $key );
|
||||
$stored_key = get_option( $this->option_prefix . 'license_key', '' );
|
||||
|
||||
if ( $stored_key !== $sanitized_key ) {
|
||||
$this->clear_cached_license_data();
|
||||
}
|
||||
|
||||
$this->license_key = $sanitized_key;
|
||||
update_option( $this->option_prefix . 'license_key', $sanitized_key );
|
||||
}
|
||||
|
||||
public function get_license_key() {
|
||||
@@ -71,10 +97,57 @@ class SitiWebUpdater2 {
|
||||
return $this->license_key;
|
||||
}
|
||||
|
||||
public function get_license_data() {
|
||||
return $this->get_stored_license_data();
|
||||
}
|
||||
|
||||
public function set_api_base_url( $api_base_url ) {
|
||||
$this->api_base_url = rtrim( (string) $api_base_url, '/' );
|
||||
}
|
||||
|
||||
private function get_stored_license_data() {
|
||||
$data = get_option( $this->option_prefix . 'license_data', array() );
|
||||
|
||||
return is_array( $data ) ? $data : array();
|
||||
}
|
||||
|
||||
private function clear_cached_license_data() {
|
||||
delete_option( $this->option_prefix . 'license_data' );
|
||||
delete_option( $this->option_prefix . 'last_check' );
|
||||
}
|
||||
|
||||
private function store_license_data( $body ) {
|
||||
if ( ! is_array( $body ) ) {
|
||||
$body = array();
|
||||
}
|
||||
|
||||
$license_data = array();
|
||||
|
||||
if ( isset( $body['license'] ) && is_array( $body['license'] ) ) {
|
||||
$license_data = $body['license'];
|
||||
}
|
||||
|
||||
if ( empty( $license_data['key'] ) ) {
|
||||
$license_data['key'] = $this->get_license_key();
|
||||
}
|
||||
|
||||
$version = null;
|
||||
if ( isset( $body['pluginVersion'] ) && $body['pluginVersion'] ) {
|
||||
$version = $body['pluginVersion'];
|
||||
} elseif ( isset( $body['version'] ) && $body['version'] ) {
|
||||
$version = $body['version'];
|
||||
} elseif ( isset( $license_data['pluginVersion'] ) && $license_data['pluginVersion'] ) {
|
||||
$version = $license_data['pluginVersion'];
|
||||
}
|
||||
|
||||
if ( $version ) {
|
||||
$license_data['pluginVersion'] = $version;
|
||||
}
|
||||
|
||||
update_option( $this->option_prefix . 'license_data', $license_data );
|
||||
update_option( $this->option_prefix . 'last_check', current_time( 'mysql' ) );
|
||||
}
|
||||
|
||||
private function get_plugin_info() {
|
||||
if ( is_null( $this->plugin_response ) ) {
|
||||
$request_uri = sprintf( '%s/api/plugins/%s/%s', $this->api_base_url, $this->owner, $this->repository );
|
||||
@@ -175,13 +248,15 @@ class SitiWebUpdater2 {
|
||||
}
|
||||
|
||||
$hostname = parse_url( home_url(), PHP_URL_HOST );
|
||||
$current_version = isset( $this->plugin['Version'] ) ? $this->plugin['Version'] : null;
|
||||
$response = wp_remote_post( $this->api_base_url . '/api/licenses/verify', array(
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'body' => wp_json_encode( array(
|
||||
'key' => $license_key,
|
||||
'hostname' => $hostname,
|
||||
'key' => $license_key,
|
||||
'hostname' => $hostname,
|
||||
'currentVersion' => $current_version,
|
||||
) ),
|
||||
'timeout' => 15,
|
||||
) );
|
||||
@@ -193,25 +268,57 @@ class SitiWebUpdater2 {
|
||||
$code = wp_remote_retrieve_response_code( $response );
|
||||
$body = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
if ( ! is_array( $body ) ) {
|
||||
$this->clear_cached_license_data();
|
||||
return new WP_Error( 'verification_failed', 'Onverwacht antwoord van licentieserver.' );
|
||||
}
|
||||
|
||||
$has_license_payload = isset( $body['license'] ) || isset( $body['pluginVersion'] ) || isset( $body['version'] );
|
||||
|
||||
if ( 200 !== $code ) {
|
||||
if ( $has_license_payload ) {
|
||||
$this->store_license_data( $body );
|
||||
} else {
|
||||
$this->clear_cached_license_data();
|
||||
}
|
||||
|
||||
$error_message = isset( $body['error'] ) ? $body['error'] : 'Licentie verificatie mislukt.';
|
||||
return new WP_Error( 'verification_failed', $error_message );
|
||||
}
|
||||
|
||||
if ( empty( $body['valid'] ) ) {
|
||||
if ( $has_license_payload ) {
|
||||
$this->store_license_data( $body );
|
||||
} else {
|
||||
$this->clear_cached_license_data();
|
||||
}
|
||||
|
||||
return new WP_Error( 'invalid_license', 'Licentie is ongeldig.' );
|
||||
}
|
||||
|
||||
// Store license data
|
||||
update_option( $this->option_prefix . 'license_data', $body['license'] );
|
||||
update_option( $this->option_prefix . 'last_check', current_time( 'mysql' ) );
|
||||
$this->store_license_data( $body );
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function is_license_valid() {
|
||||
$data = get_option( $this->option_prefix . 'license_data', array() );
|
||||
return ! empty( $data ) && isset( $data['key'] );
|
||||
$data = $this->get_license_data();
|
||||
return ! empty( $data ) && ! empty( $data['key'] );
|
||||
}
|
||||
|
||||
public function get_latest_known_version() {
|
||||
$this->get_plugin_info();
|
||||
|
||||
if ( ! empty( $this->plugin_response['version'] ) ) {
|
||||
return $this->plugin_response['version'];
|
||||
}
|
||||
|
||||
$license_data = $this->get_license_data();
|
||||
if ( isset( $license_data['pluginVersion'] ) && $license_data['pluginVersion'] ) {
|
||||
return $license_data['pluginVersion'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function admin_notices() {
|
||||
@@ -220,12 +327,12 @@ class SitiWebUpdater2 {
|
||||
}
|
||||
|
||||
if ( ! $this->is_license_valid() ) {
|
||||
$settings_url = admin_url( 'options-general.php?page=siti-updater-' . sanitize_title( $this->plugin['Name'] ) );
|
||||
$settings_url = admin_url( 'options-general.php?page=siti-plugin-licenses' );
|
||||
echo '<div class="notice notice-error"><p>';
|
||||
printf(
|
||||
esc_html__( '%s: Licentie ongeldig of niet ingesteld. Ga naar %s om je licentie in te voeren.', 'siti-updater' ),
|
||||
esc_html( $this->plugin['Name'] ),
|
||||
'<a href="' . esc_url( $settings_url ) . '">' . esc_html__( 'instellingen', 'siti-updater' ) . '</a>'
|
||||
'<a href="' . esc_url( $settings_url ) . '">' . esc_html__( 'plugin licenties', 'siti-updater' ) . '</a>'
|
||||
);
|
||||
echo '</p></div>';
|
||||
}
|
||||
@@ -238,53 +345,104 @@ class SitiWebUpdater2 {
|
||||
}
|
||||
}
|
||||
|
||||
public function add_settings_page() {
|
||||
public function add_global_settings_page() {
|
||||
add_options_page(
|
||||
sprintf( __( '%s Licentie', 'siti-updater' ), $this->plugin['Name'] ),
|
||||
sprintf( __( '%s Licentie', 'siti-updater' ), $this->plugin['Name'] ),
|
||||
__( 'Plugin Licenties', 'siti-updater' ),
|
||||
__( 'Plugin Licenties', 'siti-updater' ),
|
||||
'manage_options',
|
||||
'siti-updater-' . sanitize_title( $this->plugin['Name'] ),
|
||||
array( $this, 'render_settings_page' )
|
||||
'siti-plugin-licenses',
|
||||
array( $this, 'render_global_settings_page' )
|
||||
);
|
||||
}
|
||||
|
||||
public function render_settings_page() {
|
||||
public function render_global_settings_page() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_POST['siti_updater_license_key'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'siti_updater_save' ) ) {
|
||||
$this->set_license_key( sanitize_text_field( $_POST['siti_updater_license_key'] ) );
|
||||
$result = $this->verify_license();
|
||||
if ( is_wp_error( $result ) ) {
|
||||
add_settings_error( 'siti_updater', 'license_error', $result->get_error_message() );
|
||||
} else {
|
||||
add_settings_error( 'siti_updater', 'license_success', __( 'Licentie succesvol opgeslagen en geverifieerd.', 'siti-updater' ), 'updated' );
|
||||
if ( isset( $_POST['siti_updater_save'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'siti_updater_save' ) ) {
|
||||
foreach ( self::$instances as $prefix => $instance ) {
|
||||
$key = $prefix . 'license_key';
|
||||
if ( isset( $_POST[ $key ] ) ) {
|
||||
$instance->set_license_key( sanitize_text_field( $_POST[ $key ] ) );
|
||||
$result = $instance->verify_license();
|
||||
if ( is_wp_error( $result ) ) {
|
||||
$plugin_data = $instance->get_plugin_data();
|
||||
add_settings_error( 'siti_updater', 'license_error_' . $prefix, $plugin_data['Name'] . ': ' . $result->get_error_message() );
|
||||
} else {
|
||||
$plugin_data = $instance->get_plugin_data();
|
||||
add_settings_error( 'siti_updater', 'license_success_' . $prefix, $plugin_data['Name'] . ': ' . __( 'Licentie succesvol opgeslagen en geverifieerd.', 'siti-updater' ), 'updated' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php printf( esc_html__( '%s Licentie Instellingen', 'siti-updater' ), $this->plugin['Name'] ); ?></h1>
|
||||
<h1><?php esc_html_e( 'Plugin Licenties', 'siti-updater' ); ?></h1>
|
||||
<p class="description">
|
||||
<?php printf( esc_html__( 'Voer je licentiecode in voor %s om updates te ontvangen.', 'siti-updater' ), $this->plugin['Name'] ); ?>
|
||||
<?php esc_html_e( 'Beheer licentiecodes voor al je plugins die het Siti update systeem gebruiken.', 'siti-updater' ); ?>
|
||||
</p>
|
||||
|
||||
<?php settings_errors( 'siti_updater' ); ?>
|
||||
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field( 'siti_updater_save' ); ?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e( 'Licentiecode', 'siti-updater' ); ?></th>
|
||||
<td>
|
||||
<input type="text" name="siti_updater_license_key" value="<?php echo esc_attr( $this->get_license_key() ); ?>" class="regular-text" />
|
||||
<p class="description"><?php esc_html_e( 'Verkrijg je licentiecode van plugins.robert.ooo', 'siti-updater' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Plugin', 'siti-updater' ); ?></th>
|
||||
<th><?php esc_html_e( 'Licentiecode', 'siti-updater' ); ?></th>
|
||||
<th><?php esc_html_e( 'Geldig', 'siti-updater' ); ?></th>
|
||||
<th><?php esc_html_e( 'Huidige versie', 'siti-updater' ); ?></th>
|
||||
<th><?php esc_html_e( 'Nieuwste versie', 'siti-updater' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( self::$instances as $prefix => $instance ) :
|
||||
$license_data = $instance->get_license_data();
|
||||
$is_valid = $instance->is_license_valid();
|
||||
$plugin_data = $instance->get_plugin_data();
|
||||
$current_version = $plugin_data['Version'];
|
||||
$latest_known = $instance->get_latest_known_version();
|
||||
$latest_version = $latest_known ? $latest_known : ( isset( $license_data['pluginVersion'] ) ? $license_data['pluginVersion'] : '-' );
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?php echo esc_html( $plugin_data['Name'] ); ?></strong>
|
||||
<br>
|
||||
<small><?php echo esc_html( $plugin_data['Description'] ); ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text"
|
||||
name="<?php echo esc_attr( $prefix . 'license_key' ); ?>"
|
||||
value="<?php echo esc_attr( $instance->get_license_key() ); ?>"
|
||||
class="regular-text"
|
||||
placeholder="<?php esc_attr_e( 'Voer licentiecode in...', 'siti-updater' ); ?>" />
|
||||
<p class="description">
|
||||
<?php printf( esc_html__( 'Licentie voor %s. Verkrijg je code van plugins.robert.ooo', 'siti-updater' ), $plugin_data['Name'] ); ?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<span class="license-status <?php echo $is_valid ? 'valid' : 'invalid'; ?>">
|
||||
<?php echo $is_valid ? '<span style="color: green;">✓ ' . esc_html__( 'Ja', 'siti-updater' ) . '</span>' : '<span style="color: red;">✗ ' . esc_html__( 'Nee', 'siti-updater' ) . '</span>'; ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo esc_html( $current_version ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo esc_html( $latest_version ); ?>
|
||||
<?php if ( $latest_version && '-' !== $latest_version && version_compare( $latest_version, $current_version, '>' ) ) : ?>
|
||||
<br><small style="color: orange;"><?php esc_html_e( 'Update beschikbaar!', 'siti-updater' ); ?></small>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" class="button button-primary" value="<?php esc_attr_e( 'Licentie opslaan', 'siti-updater' ); ?>" />
|
||||
<input type="submit" name="siti_updater_save" class="button button-primary" value="<?php esc_attr_e( 'Licenties opslaan', 'siti-updater' ); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"plugin_name": "SitiAI Product Teksten",
|
||||
"description": "Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce.",
|
||||
"version": "1.9.2",
|
||||
"version": "1.9.3",
|
||||
"author": "Roberto Guagliardo | SitiWeb",
|
||||
"author_url": "https://sitiweb.nl/"
|
||||
}
|
||||
Reference in New Issue
Block a user