Skip to content

Commit

Permalink
Update version to 1.5.1 and improve plugin dependency handling
Browse files Browse the repository at this point in the history
The version of modal-form-brochure.php has been updated to 1.5.1 in several files including README.md, README.txt, and package.json. Also, enhanced the checking of the 'Forms everywhere by Influactive' plugin's availability. 'admin_init' action hook is now used to check if the plugin is active before running further code, preventing fatal errors previously encountered when the plugin was inactive. This improves the robustness and user-experience of the software.
  • Loading branch information
antoinegreuzard committed Aug 4, 2023
1 parent b4cf982 commit 51d6464
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Influactive ([https://influactive.com](https://influactive.com))

## Version

1.5.0
1.5.1

## Installation

Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://influactive.com
Tags: modal, form, brochure
Requires at least: 5.2
Tested up to: 6.2
Stable tag: 1.5.0
Stable tag: 1.5.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 8.0
Expand Down
32 changes: 17 additions & 15 deletions modal-form-brochure.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Modal Forms Brochure by Influactive
* Description: A plugin to display a modal with a form on a link click (#brochure and a parameter ?file=ID).
* Version: 1.5.0
* Version: 1.5.1
* Author: Influactive
* Author URI: https://influactive.com
* Text Domain: influactive-modal-form-brochure
Expand All @@ -18,15 +18,24 @@
throw new RuntimeException( 'WordPress environment not loaded. Exiting...' );
}

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
add_action( 'admin_init', function () {

Check failure on line 21 in modal-form-brochure.php

View workflow job for this annotation

GitHub Actions / WPCS

Opening parenthesis of a multi-line function call must be the last content on the line

Check failure on line 21 in modal-form-brochure.php

View workflow job for this annotation

GitHub Actions / WPCS

Only one argument is allowed per line in a multi-line function call
if ( ! influactive_is_active() ) {
add_action( 'admin_notices', 'show_influactive_forms_error_notice' );
if ( function_exists( 'deactivate_plugins' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
}
}
} );

Check failure on line 28 in modal-form-brochure.php

View workflow job for this annotation

GitHub Actions / WPCS

Closing parenthesis of a multi-line function call must be on a line by itself

/**
* Checks if the plugin Forms everywhere by Influactive is active.
*
* @return bool True if the plugin is active, false otherwise.
*/
function is_influactive_active(): bool {
return is_plugin_active( 'influactive-forms/functions.php' );
function influactive_is_active(): bool {
$active_plugins = get_option( 'active_plugins' );

return in_array( 'influactive-forms/functions.php', $active_plugins, true );
}

/**
Expand All @@ -44,13 +53,6 @@ function show_influactive_forms_error_notice(): void {
<?php
}

if ( ! is_influactive_active() ) {
add_action( 'admin_notices', 'show_influactive_forms_error_notice' );
deactivate_plugins( plugin_basename( __FILE__ ) );

return;
}

/**
* Enqueues the necessary scripts and styles for the Modal Form Brochure plugin.
*
Expand All @@ -60,8 +62,8 @@ function influactive_load_modal_form_scripts(): void {
if ( is_admin() ) {
return;
}
wp_enqueue_script( 'influactive-modal-form-brochure', plugin_dir_url( __FILE__ ) . 'dist/frontEnd.bundled.js', array(), '1.5.0', true );
wp_enqueue_style( 'influactive-modal-form-brochure', plugin_dir_url( __FILE__ ) . 'dist/modal-form-script.bundled.css', array(), '1.5.0' );
wp_enqueue_script( 'influactive-modal-form-brochure', plugin_dir_url( __FILE__ ) . 'dist/frontEnd.bundled.js', array(), '1.5.1', true );
wp_enqueue_style( 'influactive-modal-form-brochure', plugin_dir_url( __FILE__ ) . 'dist/modal-form-script.bundled.css', array(), '1.5.1' );
}

add_action( 'wp_enqueue_scripts', 'influactive_load_modal_form_scripts' );
Expand All @@ -78,8 +80,8 @@ function influactive_load_admin_scripts( string $hook ): void {
return;
}
wp_enqueue_media();
wp_enqueue_script( 'influactive-modal-form-brochure-admin', plugin_dir_url( __FILE__ ) . 'dist/backEnd.bundled.js', array(), '1.5.0', true );
wp_enqueue_style( 'influactive-modal-form-brochure-admin', plugin_dir_url( __FILE__ ) . 'dist/admin.bundled.css', array(), '1.5.0' );
wp_enqueue_script( 'influactive-modal-form-brochure-admin', plugin_dir_url( __FILE__ ) . 'dist/backEnd.bundled.js', array(), '1.5.1', true );
wp_enqueue_style( 'influactive-modal-form-brochure-admin', plugin_dir_url( __FILE__ ) . 'dist/admin.bundled.css', array(), '1.5.1' );
}

add_action( 'admin_enqueue_scripts', 'influactive_load_admin_scripts' );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "influactive-forms",
"version": "1.5.0",
"version": "1.5.1",
"description": "A plugin to create custom forms and display them anywhere on your website.",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 51d6464

Please sign in to comment.