PluginProbe
Faust.js / 1.0.2
Faust.js v1.0.2
1.8.12 1.8.11 1.4.1 1.8.0 1.8.8 1.8.9 trunk 0.7.0 0.7.1 0.7.10 0.7.11 0.7.3 0.7.4 0.7.5 0.7.6 0.7.7 0.7.8 0.7.9 0.8.0 0.8.1 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 All 40 releases
faustwp / includes / telemetry / functions.php

functions.php in Faust.js 1.0.2, at includes/telemetry/functions.php

106 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Telemetry functions.
4 *
5 * @package FaustWP
6 */
7
8 namespace WPE\FaustWP\Telemetry;
9
10 use function WPE\FaustWP\Settings\{
11 is_redirects_enabled,
12 is_rewrites_enabled,
13 is_themes_disabled,
14 is_image_source_replacement_enabled,
15 faustwp_get_setting,
16 };
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 /**
23 * Returns the current WordPress version.
24 *
25 * @return string
26 */
27 function get_wp_version() {
28 return get_bloginfo( 'version' );
29 }
30
31 /**
32 * Checks if the current hosting environment is WP Engine.
33 *
34 * @return boolean
35 */
36 function is_wpe() {
37 return defined( 'WPE_APIKEY' );
38 }
39
40 /**
41 * Returns the current FaustWP settings while keeping identifiable information private.
42 *
43 * @return array
44 */
45 function get_anonymous_faustwp_data() {
46 $anonymous_data = array(
47 'version' => get_plugin_version(),
48 'has_frontend_uri' => has_frontend_uri(),
49 'redirects_enabled' => is_redirects_enabled(),
50 'rewrites_enabled' => is_rewrites_enabled(),
51 'themes_disabled' => is_themes_disabled(),
52 'image_source_replacement_enabled' => is_image_source_replacement_enabled(),
53 );
54
55 return $anonymous_data;
56 }
57
58 /**
59 * Returns the current WPGraphQL Content Blocks settings while keeping identifiable information private.
60 *
61 * @return array
62 */
63 function get_anonymous_wpgraphql_content_blocks_data() {
64 $anonymous_data = array(
65 'version' => get_wpgraphql_content_blocks_plugin_version(),
66 );
67
68 return $anonymous_data;
69 }
70
71 /**
72 * Checks if the frontend_uri FaustWP setting has been set.
73 *
74 * @return boolean
75 */
76 function has_frontend_uri() {
77 $frontend_uri = faustwp_get_setting( 'frontend_uri' );
78
79 if ( empty( $frontend_uri ) ) {
80 return false;
81 }
82
83 return true;
84 }
85
86 /**
87 * Returns the FaustWP plugin version.
88 *
89 * @return string
90 */
91 function get_plugin_version() {
92 $file_data = get_file_data( FAUSTWP_FILE, array( 'Version' ) );
93 $version = $file_data[0];
94
95 return $version;
96 }
97
98 /**
99 * Returns the WPGraphql Content Blocks plugin version.
100 *
101 * @return null|string
102 */
103 function get_wpgraphql_content_blocks_plugin_version() {
104 return defined( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION' ) ? WPGRAPHQL_CONTENT_BLOCKS_VERSION : null;
105 }
106