Skip to content

Commit

Permalink
Bug Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sersart committed Jan 4, 2024
1 parent 9de6924 commit 603cba8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public function admin_notices()
return;
}

foreach ($this->plugins as $plugin) {
foreach ($this->plugins as $plugin_data) {

if (!isset($plugin['slug'], $plugin['name'])) {
if (!isset($plugin_data['slug'], $plugin_data['name'])) {
continue;
}

$plugin = Plugin::get_instance($plugin['slug'], $plugin['name']);
$plugin = Plugin::get_instance($plugin_data['slug'], $plugin_data['name']);

$notice = $this->add_notice($plugin);
$notice = $this->add_notice($plugin, $plugin_data);

/**
* If notice is added then return.
Expand All @@ -104,7 +104,7 @@ public function admin_notices()
*
* @return bool
*/
private function add_notice(Plugin $plugin)
private function add_notice(Plugin $plugin, $plugin_data)
{

if ($plugin->is_plugin_activated()) {
Expand All @@ -119,7 +119,7 @@ private function add_notice(Plugin $plugin)
?>
<div class="error">
<p>
<?php if (!array_key_exists('server_url', $this->plugins)) { ?>
<?php if (!array_key_exists('server_url', $plugin_data)) { ?>
<a href="<?php echo esc_url($plugin->get_plugin_activate_link()); ?>" class='button button-secondary'><?php printf(esc_html__('Activate % s', 'twz-wp-notice-plugin-required'), esc_html($plugin->get_plugin_name())); ?></a>
<?php } else { ?>
<a href="#" class='button button-secondary activate'><?php printf(esc_html__('Activate % s', 'twz-wp-notice-plugin-required'), esc_html($plugin->get_plugin_name())); ?></a>
Expand All @@ -138,7 +138,7 @@ private function add_notice(Plugin $plugin)
?>
<div class="error">
<p>
<?php if (!array_key_exists('server_url', $this->plugins)) { ?>
<?php if (!array_key_exists('server_url', $plugin_data)) { ?>
<a href="<?php echo esc_url($plugin->get_plugin_install_link()); ?>" class='button button-secondary'><?php printf(esc_html__('Install % s', 'twz-wp-notice-plugin-required'), esc_html($plugin->get_plugin_name())); ?></a>
<?php } else { ?>
<a href="#" class='button button-secondary install'><?php printf(esc_html__('Install % s', 'twz-wp-notice-plugin-required'), esc_html($plugin->get_plugin_name())); ?></a>
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Plugin {
* @param string $plugin_slug Required Plugin slug.
* @param string $plugin_name Required Plugin name.
*/
private function __construct( $plugin_slug, $plugin_name ) {
private function __construct( $plugin_slug, $plugin_name) {
if ( ! function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
Expand Down

0 comments on commit 603cba8

Please sign in to comment.