PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.3.2
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.3.2
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / functions / app.php

app.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.3.2, at src/functions/app.php

48 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Application/Plugin specific functions.
4 */
5
6 declare( strict_types=1 );
7
8 use SolidWP\Performance\Container;
9 use SolidWP\Performance\Core;
10 use SolidWP\Performance\lucatume\DI52\Container as DI52Container;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 /**
17 * Initialize the plugin singleton and ensure we only have a single
18 * instance of our container.
19 *
20 * @return Core
21 */
22 function swpsp_plugin(): Core {
23 // In the event we don't have a container in our core class yet.
24 $container = new Container( new DI52Container() );
25
26 // This singleton will not use a new container if one is already set.
27 return Core::instance( realpath( __DIR__ . '/../../solid-performance.php' ), $container );
28 }
29
30 /**
31 * Log to the error log if WP_DEBUG is set to true.
32 *
33 * @param string|mixed[] $data The data to log.
34 *
35 * @return void
36 */
37 function swpsp_log( $data ): void {
38 if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG || ! function_exists( 'error_log' ) ) {
39 return;
40 }
41
42 if ( is_array( $data ) ) {
43 $data = print_r( $data, true );
44 }
45
46 error_log( $data );
47 }
48