PluginProbe
Packeta / 1.4
Packeta v1.4
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / Helper.php

Helper.php in Packeta 1.4, at src/Packetery/Module/Helper.php

65 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Helper
4 *
5 * @package Packetery\Module
6 */
7
8 declare( strict_types=1 );
9
10
11 namespace Packetery\Module;
12
13 /**
14 * Class Helper
15 *
16 * @package Packetery\Module
17 */
18 class Helper {
19
20 /**
21 * Tells if plugin is active.
22 *
23 * @param string $pluginRelativePath Relative path of plugin bootstrap file.
24 *
25 * @return bool
26 */
27 public static function isPluginActive( string $pluginRelativePath ): bool {
28 if ( is_multisite() ) {
29 $plugins = get_site_option( 'active_sitewide_plugins' );
30 if ( isset( $plugins[ $pluginRelativePath ] ) ) {
31 return true;
32 }
33 }
34
35 if ( ! function_exists( 'get_mu_plugins' ) ) {
36 require_once ABSPATH . 'wp-admin/includes/plugin.php';
37 }
38
39 $muPlugins = get_mu_plugins();
40 if ( isset( $muPlugins[ $pluginRelativePath ] ) ) {
41 return true;
42 }
43
44 return in_array( $pluginRelativePath, (array) get_option( 'active_plugins', [] ), true );
45 }
46
47 /**
48 * Introduced as ManageWP Worker plugin hack fix.
49 *
50 * @return void
51 */
52 public static function transformGlobalCookies(): void {
53 if ( empty( $_COOKIE ) ) {
54 return;
55 }
56 foreach ( $_COOKIE as $key => $value ) {
57 // @codingStandardsIgnoreStart
58 if ( is_int( $value ) ) {
59 $_COOKIE[ $key ] = (string) $value;
60 }
61 // @codingStandardsIgnoreEnd
62 }
63 }
64 }
65