first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
/**
* Upgrade Popups class for batch
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Implements a batch processor for migrating existing popups to new data structure.
*
* @since 1.7.0
*
* @see PUM_Abstract_Upgrade_Popups
*/
class PUM_Upgrade_v1_7_Popups extends PUM_Abstract_Upgrade_Popups {
/**
* Batch process ID.
*
* @var string
*/
public $batch_id = 'core-v1_7-popups';
/**
* Process needed upgrades on each popup.
*
* @param int $popup_id
*/
public function process_popup( $popup_id = 0 ) {
$popup = pum_get_popup( $popup_id );
/**
* If the popup is already updated, return early.
*/
if ( $popup->data_version < 3 ) {
/**
* Processes the popups data through a migration routine.
*
* $popup is passed by reference.
*/
pum_popup_migration_2( $popup );
/**
* Update the popups data version.
*/
$popup->update_meta( 'data_version', 3 );
}
}
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Upgrade Settings class for batch
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Implements a batch processor for migrating existing popups to new data structure.
*
* @since 1.7.0
*
* @see PUM_Abstract_Upgrade_Popups
*/
class PUM_Upgrade_v1_7_Settings extends PUM_Abstract_Upgrade_Settings {
/**
* Batch process ID.
*
* @var string
*/
public $batch_id = 'core-v1_7-settings';
/**
* Process needed upgrades on each popup.
*
* @param array $settings Current global popup maker settings.
*/
public function process_settings( $settings = [] ) {
$changed = false;
// popmake_settings['newsletter_default_provider'] == '' should be changed to 'none'
if ( isset( $settings['newsletter_default_provider'] ) && '' === $settings['newsletter_default_provider'] ) {
$settings['newsletter_default_provider'] = 'none';
$changed = true;
}
/**
* Save only if something changed.
*/
if ( $changed ) {
PUM_Utils_Options::update_all( $settings );
}
}
}

View File

@@ -0,0 +1,77 @@
<?php
/**
* Upgrade Themes class for batch
*
* @package PUM
* @copyright Copyright (c) 2023, Code Atlantic LLC
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Implements a batch processor for migrating existing themes to new data structure.
*
* @since 1.8.0
*
* @see PUM_Abstract_Upgrade_Themes
*/
class PUM_Upgrade_v1_8_Themes extends PUM_Abstract_Upgrade_Themes {
/**
* Batch process ID.
*
* @var string
*/
public $batch_id = 'core-v1_8-themes';
/**
* Only load popups with specific meta keys.r
*
* @return array
*/
public function custom_query_args() {
return [
'meta_query' => [
'relation' => 'OR',
[
'key' => 'popup_theme_data_version',
'compare' => 'NOT EXISTS',
'value' => 'deprecated', // Here for WP 3.9 or less.
],
[
'key' => 'popup_theme_data_version',
'compare' => '<',
'value' => 3,
],
],
];
}
/**
* Process needed upgrades on each theme.
*
* @param int $theme_id
*/
public function process_theme( $theme_id = 0 ) {
$theme = pum_get_theme( $theme_id );
/**
* If the theme is using an out of date data version, process upgrades.
*/
if ( $theme->data_version < $theme->model_version ) {
$theme->passive_migration();
}
}
public function finish() {
// Clean up transient used to determine when updates are needed.
delete_transient( 'pum_needs_1_8_theme_upgrades' );
parent::finish(); // TODO: Change the autogenerated stub
}
}