← All changes
|
includes/class-wp-optimize-install-or-update-notice.php
+13
-10
3.2.21
→
4.7.0
View file →
| @@ -40,14 +40,14 @@ | ||
| 40 | 40 | * @return boolean |
| 41 | 41 | */ |
| 42 | 42 | public function show_current_notice() { |
| 43 | 43 | // Check the option |
| 44 | - $latest_saved_notice = $this->options->get_option('install-or-update-notice-version', false); | |
| 44 | + $latest_saved_notice = $this->options->get_option('install-or-update-notice-version'); | |
| 45 | 45 | if ($latest_saved_notice && version_compare($latest_saved_notice, $this->version, '>=')) { |
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $notice_show_time = $this->options->get_option('install-or-update-notice-show-time', false); | |
| 49 | + $notice_show_time = $this->options->get_option('install-or-update-notice-show-time'); | |
| 50 | 50 | |
| 51 | 51 | // If notice has been showing for more than 14days, automatically dismiss it. |
| 52 | 52 | if ($notice_show_time && (time() - $notice_show_time) > (14 * 86400)) { |
| 53 | 53 | $this->dismiss(); |
| @@ -69,9 +69,12 @@ | ||
| 69 | 69 | public function output_notice() { |
| 70 | 70 | WP_Optimize()->include_template('notices/install-or-update-notice.php', false, array( |
| 71 | 71 | 'is_new_install' => $this->is_new_install(), |
| 72 | 72 | 'is_premium' => WP_Optimize::is_premium(), |
| 73 | - 'is_updraftplus_installed' => $this->is_updraftplus_installed() | |
| 73 | + 'is_updraftplus_installed' => $this->is_plugin_installed("updraftplus"), | |
| 74 | + 'is_ilj_installed' => $this->is_plugin_installed("internal-links"), | |
| 75 | + 'is_aios_installed' => $this->is_plugin_installed("all-in-one-wp-security-and-firewall"), | |
| 76 | + 'is_aios_prem_installed' => $this->is_plugin_installed("all-in-one-wp-security-and-firewall-premium"), | |
| 74 | 77 | )); |
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | /** |
| @@ -79,9 +82,9 @@ | ||
| 79 | 82 | * |
| 80 | 83 | * @return boolean |
| 81 | 84 | */ |
| 82 | 85 | private function is_new_install() { |
| 83 | - if ($this->options->get_option('newly-activated', false)) { | |
| 86 | + if ($this->options->get_option('newly-activated')) { | |
| 84 | 87 | return true; |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | return false; |
| @@ -106,16 +109,16 @@ | ||
| 106 | 109 | $this->options->delete_option('install-or-update-notice-show-time'); |
| 107 | 110 | |
| 108 | 111 | return true; |
| 109 | 112 | } |
| 110 | - | |
| 113 | + | |
| 111 | 114 | /** |
| 112 | - * Check if updraftplus is installed. | |
| 115 | + * Checks if a specific plugin is installed. | |
| 113 | 116 | * |
| 114 | - * @return bool | |
| 117 | + * @param string $plugin_name The name of the plugin to check for installation status. | |
| 118 | + * @return bool True if the plugin is installed, false otherwise. | |
| 115 | 119 | */ |
| 116 | - private function is_updraftplus_installed() { | |
| 117 | - $status = WP_Optimize()->get_db_info()->get_plugin_status('updraftplus'); | |
| 118 | - | |
| 120 | + private function is_plugin_installed($plugin_name) { | |
| 121 | + $status = WP_Optimize()->get_db_info()->get_plugin_status($plugin_name); | |
| 119 | 122 | return $status['installed']; |
| 120 | 123 | } |
| 121 | 124 | } |