| @@ -1,13 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Kibo\PhastPlugins\PhastPress\CDN; | |
| 4 | -use Kibo\PhastPlugins\PhastPress\Compat; | |
| 5 | - | |
| 6 | -if (!defined('PHASTPRESS_VERSION')) { | |
| 7 | - exit; | |
| 8 | -} | |
| 9 | - | |
| 10 | 3 | require_once __DIR__ . '/autoload.php'; |
| 11 | 4 | |
| 12 | 5 | add_action('plugins_loaded', function () { |
| 13 | 6 | if (!get_option('phastpress_1.43')) { |
| @@ -42,29 +35,10 @@ | ||
| 42 | 35 | return $links; |
| 43 | 36 | }); |
| 44 | 37 | |
| 45 | 38 | add_action('plugins_loaded', function () { |
| 46 | - CDN::installHook(); | |
| 47 | - Compat\Log::setup(); | |
| 48 | - | |
| 49 | - if (($priority = has_filter('init', 'wp_cache_late_loader')) !== false) { | |
| 50 | - add_action('init', 'phastpress_deploy', $priority + 1); | |
| 51 | - Compat\Log::add( | |
| 52 | - 'wp-super-cache', | |
| 53 | - 'deploying PhastPress via init hook to support WP Super Cache late init' | |
| 54 | - ); | |
| 55 | - (new Compat\NextGenGallery())->setup($priority + 1); | |
| 56 | - } elseif (class_exists(\LiteSpeed\Core::class) | |
| 57 | - && ($priority = (new Compat\LiteSpeedCache())->getHookPriority()) !== null | |
| 58 | - ) { | |
| 59 | - add_action('after_setup_theme', 'phastpress_deploy', $priority + 1); | |
| 60 | - Compat\Log::add( | |
| 61 | - 'litespeed-cache', | |
| 62 | - 'deploying PhastPress via after_setup_theme hook to support LiteSpeed Cache' | |
| 63 | - ); | |
| 64 | - } else { | |
| 65 | - phastpress_deploy(); | |
| 66 | - } | |
| 39 | + \Kibo\PhastPlugins\PhastPress\CDN::installHook(); | |
| 40 | + phastpress_deploy(); | |
| 67 | 41 | }); |
| 68 | 42 | |
| 69 | 43 | add_action('admin_print_scripts', function () { |
| 70 | 44 | echo phastpress_get_plugin_sdk()->getAutoConfiguration()->renderScript(); |
| @@ -81,22 +55,19 @@ | ||
| 81 | 55 | }); |
| 82 | 56 | |
| 83 | 57 | add_action('wp_head', function () { |
| 84 | 58 | $style = 'font-family:helvetica,sans-serif'; |
| 85 | - phastpress_console_log( | |
| 59 | + $args = [ | |
| 86 | 60 | "%cOptimized with %cPhastPress%c %s\nhttps://wordpress.org/plugins/phastpress/", |
| 87 | 61 | $style, |
| 88 | 62 | $style . ';font-weight:bold', |
| 89 | 63 | $style, |
| 90 | - PHASTPRESS_VERSION | |
| 91 | - ); | |
| 92 | -}); | |
| 93 | - | |
| 94 | -function phastpress_console_log(...$args) { | |
| 64 | + PHASTPRESS_VERSION, | |
| 65 | + ]; | |
| 95 | 66 | echo '<script data-phast-no-defer>console.log(' . |
| 96 | 67 | implode(',', array_map('json_encode', $args)) . |
| 97 | 68 | ')</script>'; |
| 98 | -} | |
| 69 | +}); | |
| 99 | 70 | |
| 100 | 71 | function phastpress_render_settings() { |
| 101 | 72 | echo sprintf( |
| 102 | 73 | '<div class="wrap"> |