Handling of new components
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-installsingleplugin.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\PluginInstaller\Controllers;
|
||||
|
||||
use Plugin_Upgrader;
|
||||
use WP_Ajax_Upgrader_Skin;
|
||||
|
||||
class InstallSingleplugin
|
||||
{
|
||||
public static function install_calendar ()
|
||||
{
|
||||
if ( isset( $_REQUEST[ 'install' ] ) ) {
|
||||
if ( !file_exists( dirname( BDP_LV_STARTUP_FILE ) . '/../kronos/kronos.php' ) ) {
|
||||
$pageName = 'Kalender';
|
||||
$page_exists = get_page_by_path( $pageName, OBJECT, 'page' );
|
||||
if ( is_object( $page_exists ) ) {
|
||||
wp_delete_post( $page_exists->ID, false );
|
||||
}
|
||||
$calendar_connection = get_option( 'bdp_calendar_source_url',
|
||||
'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics' );
|
||||
if ( 'https://wiki.sachsen.pfadfinden.de/rest/calendar-services/1.0/calendar/export/subcalendar/private/ff69f5a689391ac0d7f78a70189cfde7c48cb923.ics' !== $calendar_connection ) {
|
||||
update_option( 'kronos_calendar_url', $calendar_connection );
|
||||
}
|
||||
delete_option( 'bdp_calendar_source_url' );
|
||||
|
||||
|
||||
kompass_install_plugin( 'https://repos.contelli.de/plugins/kronos/download', 'kronos' );
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
$install_link = admin_url( 'admin.php?page=kompass-calendar&install=true' );
|
||||
require dirname( __FILE__ ) . '/../views/install-item.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function install_events ()
|
||||
{
|
||||
if ( isset( $_REQUEST[ 'install' ] ) ) {
|
||||
if ( !file_exists( dirname( BDP_LV_STARTUP_FILE ) . '/../solea/solea.php' ) ) {
|
||||
kompass_install_plugin( 'https://repos.contelli.de/plugins/solea/download', 'solea' );
|
||||
}
|
||||
} else {
|
||||
$install_link = admin_url( 'admin.php?page=kompass-events&install=true' );
|
||||
require dirname( __FILE__ ) . '/../views/install-item.php';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* File: class-outdatedmodule.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
namespace Bdp\Modules\PluginInstaller\Controllers;
|
||||
|
||||
class OutdatedModule
|
||||
{
|
||||
public static function calender() {
|
||||
$module = 'Kalender';
|
||||
$install_url = admin_url('admin.php?page=kompass-calendar');
|
||||
require dirname(__FILE__) . '/../views/outdated-component.php';
|
||||
}
|
||||
}
|
20
modules/plugin-installer/views/install-item.php
Normal file
20
modules/plugin-installer/views/install-item.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* File: install-item.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div style="width: 80%; margin: 50px auto; border-style: solid; border-width: 2px; border-color: #1d4899; padding: 10px;">
|
||||
Um die gewünschte Komponente zu aktivieren, klicke bitte hier auf aktivieren.<br />
|
||||
kompass führt dabei die Installation im Hintergrund durch.
|
||||
<div style="text-align: center">
|
||||
<a href="<?php echo $install_link; ?>" class="button bdp-newplugin-button">Jetzt installieren</a>
|
||||
</div>
|
||||
</div>
|
18
modules/plugin-installer/views/outdated-component.php
Normal file
18
modules/plugin-installer/views/outdated-component.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* File: outdated-component.php
|
||||
*
|
||||
*
|
||||
* @since 2024-08-12
|
||||
* @license GPL-3.0-or-later
|
||||
*
|
||||
* @package
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div style="padding: 10px 10px; font-size: 15pt; margin-top: 20px; line-height: 30px; background-color: #fafafa; border-left: #f10905 10px solid;">
|
||||
kompass hat festgestellt, dass du die Komponente <?php echo esc_html($module); ?> nutzt, die nicht weiterentwickelt wird.<br />
|
||||
Es steht eine neue Version bereit, bitte klicke <a href="<?php echo esc_url($install_url); ?>">hier</a>, um die Aktualisierung durchzuführen.
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user