PluginProbe
PhastPress / trunk
PhastPress vtrunk
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 / classes / Compat / Log.php

Log.php in PhastPress trunk, at classes/Compat/Log.php

31 lines 825 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Kibo\PhastPlugins\PhastPress\Compat;
3
4 class Log {
5 private static $messages;
6
7 public static function setup() {
8 add_action('wp_head', __CLASS__ . '::output');
9 }
10
11 public static function add($plugin, $message) {
12 self::$messages[$plugin][] = $message;
13 }
14
15 public static function output() {
16 if (empty(self::$messages)) {
17 return;
18 }
19
20 $o = 'console.group("[PhastPress] Plugin compatibility");';
21 foreach (self::$messages as $plugin => $messages) {
22 foreach ($messages as $message) {
23 $o .= 'console.log(' . json_encode($plugin ? "{$plugin}: {$message}" : $message) . ');';
24 }
25 }
26 $o .= 'console.groupEnd();';
27
28 echo phastpress_script($o, ['data-phast-no-defer' => '']);
29 }
30 }
31