From bea2938a727ae272d15ace9d7df8c27e0e29b317 Mon Sep 17 00:00:00 2001 From: Tim <162806658+timotei-litespeed@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:27:47 +0300 Subject: [PATCH] Replace deprecated function (#746) Co-authored-by: Timotei --- src/activation.cls.php | 2 +- src/admin-settings.cls.php | 4 ++-- src/cdn-setup.cls.php | 10 +++++----- src/cdn/cloudflare.cls.php | 6 +++--- src/conf.cls.php | 2 +- src/crawler-map.cls.php | 4 ++-- src/db-optm.cls.php | 4 ++-- src/img-optm.cls.php | 26 +++++++++++++------------- src/import.cls.php | 4 ++-- src/purge.cls.php | 32 ++++++++++++++++---------------- src/root.cls.php | 2 +- src/router.cls.php | 2 +- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/activation.cls.php b/src/activation.cls.php index 02266c094..e6f73e16a 100644 --- a/src/activation.cls.php +++ b/src/activation.cls.php @@ -515,7 +515,7 @@ public function upgrade() return; } - Admin_Display::succeed(__('Upgraded successfully.', 'litespeed-cache')); + Admin_Display::success(__('Upgraded successfully.', 'litespeed-cache')); } /** diff --git a/src/admin-settings.cls.php b/src/admin-settings.cls.php index b3b727ef5..5e9bf4f82 100644 --- a/src/admin-settings.cls.php +++ b/src/admin-settings.cls.php @@ -261,7 +261,7 @@ public function save($raw_data) $this->cls('Conf')->update_confs($the_matrix); $msg = __('Options saved.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -296,7 +296,7 @@ public function network_save($raw_data) Activation::cls()->update_files(); $msg = __('Options saved.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** diff --git a/src/cdn-setup.cls.php b/src/cdn-setup.cls.php index 004e6ecb0..f29de82f1 100644 --- a/src/cdn-setup.cls.php +++ b/src/cdn-setup.cls.php @@ -126,7 +126,7 @@ private function _process_cdn_status($result) $this->cls('Cloud')->set_linked(); $nameservers = esc_html($result['nameservers']); $this->cls('Conf')->update_confs(array(self::O_QC_NAMESERVERS => $nameservers, self::O_CDN_QUIC => true)); - Admin_Display::succeed( + Admin_Display::success( '🎊 ' . __('Congratulations, QUIC.cloud successfully set this domain up for the CDN. Please update your nameservers to:', 'litespeed-cache') . $nameservers ); } elseif (isset($result['cname'])) { @@ -139,7 +139,7 @@ private function _process_cdn_status($result) $this->cls('Cloud')->set_linked(); $cname = esc_html($result['cname']); $this->cls('Conf')->update_confs(array(self::O_QC_CNAME => $cname, self::O_CDN_QUIC => true)); - Admin_Display::succeed('🎊 ' . __('Congratulations, QUIC.cloud successfully set this domain up for the CDN. Please update your cname to:', 'litespeed-cache') . $cname); + Admin_Display::success('🎊 ' . __('Congratulations, QUIC.cloud successfully set this domain up for the CDN. Please update your cname to:', 'litespeed-cache') . $cname); } elseif (isset($result['done'])) { if (isset($this->_summary['cdn_setup_err'])) { unset($this->_summary['cdn_setup_err']); @@ -157,9 +157,9 @@ private function _process_cdn_status($result) $this->_summary['cdn_verify_msg'] = $notice; $notice = array('cdn_verify_msg' => $notice); } - Admin_Display::succeed($notice); + Admin_Display::success($notice); } else { - Admin_Display::succeed(__('CDN Setup is running.', 'litespeed-cache')); + Admin_Display::success(__('CDN Setup is running.', 'litespeed-cache')); } self::save_summary(); } @@ -235,7 +235,7 @@ private function _qc_reset($delete) 'litespeed-cache' ); } - Admin_Display::succeed($msg); + Admin_Display::success($msg); return self::ok(); } diff --git a/src/cdn/cloudflare.cls.php b/src/cdn/cloudflare.cls.php index 5645ff1a2..88da28e30 100644 --- a/src/cdn/cloudflare.cls.php +++ b/src/cdn/cloudflare.cls.php @@ -112,7 +112,7 @@ private function _set_devmode($type) if ($res) { $msg = sprintf(__('Notified Cloudflare to set development mode to %s successfully.', 'litespeed-cache'), strtoupper($new_val)); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } } @@ -145,7 +145,7 @@ private function _purge_all() if ($res) { $msg = __('Notified Cloudflare to purge all successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } } @@ -265,7 +265,7 @@ private function _cloudflare_call($url, $method = 'GET', $data = false, $show_ms Debug2::debug('[Cloudflare] _cloudflare_call called successfully'); if ($show_msg) { $msg = __('Communicated with Cloudflare successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } return $json['result']; diff --git a/src/conf.cls.php b/src/conf.cls.php index bb26c1d28..001283269 100644 --- a/src/conf.cls.php +++ b/src/conf.cls.php @@ -723,7 +723,7 @@ private function _set_conf() $this->update_confs($the_matrix); $msg = __('Changed setting successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); // Redirect if changed frontend URL if (!empty($_GET['redirect'])) { diff --git a/src/crawler-map.cls.php b/src/crawler-map.cls.php index 3cb88c73c..d6c33f41e 100644 --- a/src/crawler-map.cls.php +++ b/src/crawler-map.cls.php @@ -276,7 +276,7 @@ public function empty_map() Data::cls()->tb_del('crawler'); $msg = __('Sitemap cleaned successfully', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -376,7 +376,7 @@ public function gen($manual = false) if (!defined('DOING_CRON') && $manual) { $msg = sprintf(__('Sitemap created successfully: %d items', 'litespeed-cache'), $count); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } } diff --git a/src/db-optm.cls.php b/src/db-optm.cls.php index d62337e44..3fef85001 100644 --- a/src/db-optm.cls.php +++ b/src/db-optm.cls.php @@ -296,7 +296,7 @@ private function _conv_innodb() Debug2::debug("[DB] Converted $tb to InnoDB"); $msg = __('Converted to InnoDB successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -341,7 +341,7 @@ public function handler() } else { $msg = $this->_db_clean($type); } - Admin_Display::succeed($msg); + Admin_Display::success($msg); break; case self::TYPE_CONV_TB: diff --git a/src/img-optm.cls.php b/src/img-optm.cls.php index 0f67f256c..95bf1b6db 100644 --- a/src/img-optm.cls.php +++ b/src/img-optm.cls.php @@ -338,7 +338,7 @@ public function new_req() $placeholder1 = Admin_Display::print_plural($accepted_imgs[0], 'image'); $placeholder2 = Admin_Display::print_plural($accepted_imgs[1], 'image'); $msg = sprintf(__('Pushed %1$s to Cloud server, accepted %2$s.', 'litespeed-cache'), $placeholder1, $placeholder2); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -586,7 +586,7 @@ private function _filter_invalid_src() $count = count($img_in_queue_invalid); $msg = sprintf(__('Cleared %1$s invalid images.', 'litespeed-cache'), $count); - Admin_Display::succeed($msg); + Admin_Display::success($msg); self::debug('Found invalid src [total] ' . $count); } @@ -1194,7 +1194,7 @@ public function pull($manual = false) } // $msg = sprintf(__('Pulled %d image(s)', 'litespeed-cache'), $total_pulled_ori + $total_pulled_webp); - // Admin_Display::succeed($msg); + // Admin_Display::success($msg); // Check if there is still task in queue $q = "SELECT * FROM `$this->_table_img_optming` WHERE optm_status = %d LIMIT 1"; @@ -1284,7 +1284,7 @@ public function clean() } $msg = __('Cleaned up unfinished data successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1368,7 +1368,7 @@ private function _destroy() self::delete_option(self::DB_NEED_PULL); $msg = __('Destroy all optimization data successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1431,7 +1431,7 @@ private function _rescan() if (!$list) { $msg = __('Rescanned successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); self::debug('rescan bypass: no gathered image found'); return; @@ -1493,7 +1493,7 @@ private function _rescan() } $msg = $count ? sprintf(__('Rescanned %d images successfully.', 'litespeed-cache'), $count) : __('Rescanned successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1560,7 +1560,7 @@ private function _calc_bkup() } $msg = __('Calculated backups successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1654,7 +1654,7 @@ public function rm_bkup() } $msg = __('Removed backups successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1806,7 +1806,7 @@ public function batch_switch($type) } $msg = __('Switched images successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -1905,7 +1905,7 @@ private function _switch_bk_file($meta_value, $is_ori_file = false) */ private function _switch_optm_file($type) { - Admin_Display::succeed(__('Switched to optimized file successfully.', 'litespeed-cache')); + Admin_Display::success(__('Switched to optimized file successfully.', 'litespeed-cache')); return; global $wpdb; @@ -1956,7 +1956,7 @@ private function _switch_optm_file($type) } } - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** @@ -2003,7 +2003,7 @@ public function reset_row($post_id) delete_post_meta($post_id, self::DB_SET); $msg = __('Reset the optimized data successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** diff --git a/src/import.cls.php b/src/import.cls.php index 614a62fe5..77e50f373 100644 --- a/src/import.cls.php +++ b/src/import.cls.php @@ -132,7 +132,7 @@ public function import($file = false) Debug2::debug('Import: Imported ' . $_FILES['ls_file']['name']); $msg = sprintf(__('Imported setting file %s successfully.', 'litespeed-cache'), $_FILES['ls_file']['name']); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } else { Debug2::debug('Import: Imported ' . $file); } @@ -155,7 +155,7 @@ public function reset() Debug2::debug('[Import] Reset successfully.'); $msg = __('Reset successfully.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } /** diff --git a/src/purge.cls.php b/src/purge.cls.php index 786d46c06..59ab9983d 100644 --- a/src/purge.cls.php +++ b/src/purge.cls.php @@ -212,7 +212,7 @@ private function _purge_all($reason = false) self::debug('Purge all ' . $reason, 3); $msg = __('Purged all caches successfully.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); do_action('litespeed_purged_all'); } @@ -232,7 +232,7 @@ private function _purge_all_lscache($silence = false) if (!$silence) { $msg = __('Notified LiteSpeed Web Server to purge all LSCache entries.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -252,7 +252,7 @@ private function _purge_all_ccss($silence = false) if (!$silence) { $msg = __('Cleaned all Critical CSS files.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -272,7 +272,7 @@ private function _purge_all_ucss($silence = false) if (!$silence) { $msg = __('Cleaned all Unique CSS files.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -312,7 +312,7 @@ private function _purge_all_lqip($silence = false) if (!$silence) { $msg = __('Cleaned all LQIP files.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -330,7 +330,7 @@ private function _purge_all_avatar($silence = false) if (!$silence) { $msg = __('Cleaned all Gravatar files.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -348,7 +348,7 @@ private function _purge_all_localres($silence = false) if (!$silence) { $msg = __('Cleaned all localized resource entries.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -383,7 +383,7 @@ private function _purge_all_cssjs($silence = false) if (!$silence) { $msg = __('Notified LiteSpeed Web Server to purge CSS/JS entries.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } } @@ -412,7 +412,7 @@ public function purge_all_opcache($silence = false) if (!$silence) { $msg = __('Reset the entire opcode cache successfully.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } return true; @@ -455,7 +455,7 @@ private function _purge_all_object($silence = false) if (!$silence) { $msg = __('Purge all object caches successfully.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } return true; @@ -676,7 +676,7 @@ private function _purge_frontpage() } $msg = __('Notified LiteSpeed Web Server to purge the front page.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } /** @@ -690,7 +690,7 @@ private function _purge_pages() $this->_add(Tag::TYPE_PAGES); $msg = __('Notified LiteSpeed Web Server to purge all pages.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } /** @@ -710,7 +710,7 @@ private function _purge_error($type = false) $this->_add(Tag::TYPE_HTTP . $type); $msg = __('Notified LiteSpeed Web Server to purge error pages.', 'litespeed-cache'); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed($msg); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); } /** @@ -737,7 +737,7 @@ public function purge_cat($value) self::add(Tag::TYPE_ARCHIVE_TERM . $cat->term_id); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed(sprintf(__('Purge category %s', 'litespeed-cache'), $val)); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success(sprintf(__('Purge category %s', 'litespeed-cache'), $val)); } /** @@ -764,7 +764,7 @@ public function purge_tag($val) self::add(Tag::TYPE_ARCHIVE_TERM . $term->term_id); - !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed(sprintf(__('Purge tag %s', 'litespeed-cache'), $val)); + !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success(sprintf(__('Purge tag %s', 'litespeed-cache'), $val)); } /** @@ -796,7 +796,7 @@ public function purge_url($url, $purge2 = false, $quite = false) self::add($hash, $purge2); - !$quite && !defined('LITESPEED_PURGE_SILENT') && Admin_Display::succeed(sprintf(__('Purge url %s', 'litespeed-cache'), $val)); + !$quite && !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success(sprintf(__('Purge url %s', 'litespeed-cache'), $val)); } /** diff --git a/src/root.cls.php b/src/root.cls.php index 87ad379ba..a6cdfddaa 100644 --- a/src/root.cls.php +++ b/src/root.cls.php @@ -206,7 +206,7 @@ public function clear_q($type, $silent = false) if (!$silent) { $msg = __('All QUIC.cloud service queues have been cleared.', 'litespeed-cache'); - Admin_Display::succeed($msg); + Admin_Display::success($msg); } } diff --git a/src/router.cls.php b/src/router.cls.php index a05013d3b..73a85ac00 100644 --- a/src/router.cls.php +++ b/src/router.cls.php @@ -89,7 +89,7 @@ class Router extends Base public static function self_redirect($action, $type) { if (defined('LITESPEED_CLI') || defined('DOING_CRON')) { - Admin_Display::succeed('To be continued'); // Show for CLI + Admin_Display::success('To be continued'); // Show for CLI return; }