PluginProbe
PhastPress / 1.88
PhastPress v1.88
3.12 3.11 1.75 1.76 1.77 1.78 1.79 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.90 1.91 1.92 1.93 1.94 1.95 1.96 1.97 All 119 releases
phastpress / bootstrap.php

bootstrap.php in PhastPress 1.88, at bootstrap.php

96 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('PHASTPRESS_VERSION')) {
4 exit;
5 }
6
7 require_once __DIR__ . '/autoload.php';
8
9 add_action('plugins_loaded', function () {
10 if (!get_option('phastpress_1.43')) {
11 phastpress_get_plugin_sdk()
12 ->getPluginConfiguration()
13 ->update([
14 'img-optimization-tags' => false,
15 'img-optimization-css' => false,
16 ]);
17 update_option('phastpress_1.43', gmdate('Y-m-d\TH:i:s\Z'));
18 }
19 });
20
21 register_activation_hook(PHASTPRESS_PLUGIN_FILE, function () {
22 update_option('phastpress_1.43', gmdate('Y-m-d\TH:i:s\Z'));
23 });
24
25 add_action('wp_ajax_phastpress_ajax_dispatch', function () {
26 wp_send_json(
27 phastpress_get_plugin_sdk()->getAJAXRequestsDispatcher()->dispatch($_POST)
28 );
29 });
30
31 add_action('admin_notices', function () {
32 echo phastpress_get_plugin_sdk()->getInstallNotice()->render();
33 });
34
35 add_filter('plugin_action_links_' . plugin_basename(PHASTPRESS_PLUGIN_FILE), function ($links) {
36 $link = '<a href="' . admin_url('options-general.php?page=phast-press') . '">'
37 . __('Settings', 'phastpress') . '</a>';
38 array_unshift($links, $link);
39 return $links;
40 });
41
42 add_action('plugins_loaded', function () {
43 \Kibo\PhastPlugins\PhastPress\CDN::installHook();
44 phastpress_deploy();
45 });
46
47 add_action('admin_print_scripts', function () {
48 echo phastpress_get_plugin_sdk()->getAutoConfiguration()->renderScript();
49 });
50
51 add_action('admin_menu', function () {
52 add_options_page(
53 __('PhastPress', 'phastpress'),
54 __('PhastPress', 'phastpress'),
55 'manage_options',
56 'phast-press',
57 'phastpress_render_settings'
58 );
59 });
60
61 add_action('wp_head', function () {
62 $style = 'font-family:helvetica,sans-serif';
63 $args = [
64 "%cOptimized with %cPhastPress%c %s\nhttps://wordpress.org/plugins/phastpress/",
65 $style,
66 $style . ';font-weight:bold',
67 $style,
68 PHASTPRESS_VERSION,
69 ];
70 echo '<script data-phast-no-defer>console.log(' .
71 implode(',', array_map('json_encode', $args)) .
72 ')</script>';
73 });
74
75 function phastpress_render_settings() {
76 echo sprintf(
77 '<div class="wrap">
78 <h1 class="wp-heading-inline">%s</h1>
79 %s
80 </div>
81 ',
82 __('PhastPress', 'phastpress'),
83 phastpress_get_plugin_sdk()->getAdminPanel()->render()
84 );
85 }
86
87 add_action('ai1wm_exclude_content_from_export', function ($filters) {
88 if (!is_array($filters)) {
89 return $filters;
90 }
91 foreach (phastpress_get_plugin_sdk()->getCacheRootManager()->getAllCacheRoots() as $dir) {
92 $filters[] = $dir;
93 }
94 return $filters;
95 });
96