Skip to content

Commit

Permalink
Merge branch 'develop' into release/7.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sta1r committed Jun 7, 2024
2 parents 92364ce + 61ddbdf commit 567ddc9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
35 changes: 18 additions & 17 deletions admin/class-dotdigital-wordpress-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,9 @@ public function render_tab_links() {
* @return void
*/
public function add_plugin_page_tabs() {
if ( ! $this->is_dd_wp_settings_page() ) {
return;
}
foreach ( $this->available_page_tabs as $page_tab ) {
try {
$tab = new $page_tab();
if ( $this->is_current_tab( $tab ) ) {
$tab->initialise();
}
$this->page_tabs[ $tab->get_slug() ] = $tab;
} catch ( \Exception $e ) {
error_log( $e );
Expand All @@ -139,13 +133,30 @@ public function add_plugin_page_tabs() {
}

/**
* Render the active tab for the settings page.
* Ensure the form has been properly registered on submission.
*
* @return void
*/
public function add_plugin_page_submission_initialisation() {
global $pagenow;

if ( 'options.php' === $pagenow && isset( $_POST['option_page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
$option_page = sanitize_text_field( wp_unslash( $_POST['option_page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( isset( $this->page_tabs[ $option_page ] ) ) {
$this->page_tabs[ $option_page ]->initialise();
}
}
}

/**
* Render and initialise the active tab for the settings page.
*
* @return void
*/
public function render_active_tab() {
foreach ( $this->page_tabs as $page_tab ) {
if ( $this->is_current_tab( $page_tab ) ) {
$page_tab->initialise();
$page_tab->render();
}
}
Expand Down Expand Up @@ -246,16 +257,6 @@ private static function dotdigital_item_sort_desc( object $a, object $b ) {
return $a_name > $b_name ? -1 : 1;
}

/**
* Check if current page is ?page=dotdigital-for-wordpress-settings
*
* @return bool
*/
private function is_dd_wp_settings_page() {
return isset( $_GET['page'] ) &&
strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), Dotdigital_WordPress_Settings_Admin::URL_SLUG ) !== false;
}

/**
* Check if current tab is in query string
*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dotdigital/dotdigital-for-wordpress",
"version": "7.2.1",
"version": "7.2.2",
"authors": [
{
"name": "Dotdigital",
Expand Down
4 changes: 2 additions & 2 deletions dm_signup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Plugin Name: Dotdigital for WordPress
* Plugin URI: https://integrations.dotdigital.com/technology-partners/wordpress
* Description: Add a "Subscribe to Newsletter" widget to your website that will insert your contact in one of your Dotdigital lists.
* Version: 7.2.1
* Version: 7.2.2
* Author: dotdigital
* Author URI: https://www.dotdigital.com/
* License: MIT
Expand All @@ -24,7 +24,7 @@

require_once __DIR__ . '/vendor/autoload.php';

define( 'DOTDIGITAL_WORDPRESS_VERSION', '7.2.1' );
define( 'DOTDIGITAL_WORDPRESS_VERSION', '7.2.2' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_NAME', 'dotdigital-for-wordpress' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_SLUG', 'dotdigital_for_wordpress' );
define( 'DOTDIGITAL_WORDPRESS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
Expand Down
5 changes: 3 additions & 2 deletions includes/class-dotdigital-wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ private function define_admin_hooks() {
$plugin_admin = new Dotdigital_WordPress_Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_plugin_page_submission_initialisation', 1 );
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_plugin_admin_page_actions' );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_page_tabs' );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menus' );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_page_actions', 5 );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_page_tabs', 5 );
}

/**
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: email marketing, newsletter signup
Requires at least: 5.3
Tested up to: 6.5.3
Requires PHP: 7.4
Stable tag: 7.2.1
Stable tag: 7.2.2
License: MIT
License URI: https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -69,6 +69,11 @@ The form will behave as follows:

== Changelog ==

= 7.2.2 =

**Bug fixes**
- We fixed a regression in 7.2.1 that broke the save action for the plugin's admin tabs.

= 7.2.1 =

**Bug fixes**
Expand Down

0 comments on commit 567ddc9

Please sign in to comment.