11 require_once __DIR__ .
'/Helpers/Core.php';
40 if ( ! is_admin() && strpos( $_SERVER[
'PHP_SELF'],
'wp-login.php' ) ===
false ) {
46 $cookie =
'gk_disable_loading';
47 $cookie_expiry_time = MINUTE_IN_SECONDS;
49 $_is_disabled =
function ( $plugin_text_domains ) use ( $plugin_data ) {
50 if (
'all' === $plugin_text_domains ) {
54 foreach ( explode(
',', $plugin_text_domains ) as $text_domain ) {
55 if ( $plugin_data[
'TextDomain'] === $text_domain ) {
63 if ( isset( $_COOKIE[ $cookie ] ) ) {
64 if ( isset( $_GET[
'gk_enable_loading'] ) ) {
65 setcookie( $cookie,
false, time() - $cookie_expiry_time );
70 return $_is_disabled( $_COOKIE[ $cookie ] );
73 $disable_loading = isset( $_GET[
'gk_disable_loading'] ) ? $_GET[
'gk_disable_loading'] : null;
75 if ( is_null( $disable_loading ) ) {
79 setcookie( $cookie, $disable_loading ?:
'all', time() + $cookie_expiry_time );
81 return $_is_disabled( $disable_loading );
96 $meets_requirement = (bool) version_compare( phpversion(), $min_php_version,
'>=' );
98 if ( ! $show_notice ) {
99 return $meets_requirement;
102 if ( ! $meets_requirement ) {
104 esc_html_x(
'[plugin] requires PHP [version] or newer.',
'Placeholders inside [] are not to be translated.',
'gk-gravityview' ),
106 '[plugin]' => $plugin_data[
'Name'],
107 '[version]' => $min_php_version
111 if (
'cli' === php_sapi_name() ) {
114 add_action(
'admin_notices',
function () use ( $notice ) {
115 echo
"<div class='error' style='padding: 1.25em 0 1.25em 1em;'>$notice</div>";
120 return $meets_requirement;
is_disabled_via_url( $plugin_file)
Checks if loading is disabled via a URL parameter.
static get_plugin_data( $plugin_file, $markup=true, $translate=true)
Wrapper for WP's get_plugin_data() function.
meets_min_php_version_requirement( $plugin_file, $min_php_version='5.6.4', $show_notice=true)
Checks if the minimum PHP version requirement is met.
should_load( $plugin_file)
Determines if a plugin should load.