PluginProbe ʕ •ᴥ•ʔ
Rank Math SEO – AI SEO Tools to Dominate SEO Rankings / 1.0.255
Rank Math SEO – AI SEO Tools to Dominate SEO Rankings v1.0.255
1.0.273 1.0.272 1.0.271 1.0.271.1 1.0.270 1.0.269 trunk 1.0.216 1.0.217 1.0.218 1.0.219 1.0.220 1.0.221 1.0.222 1.0.223 1.0.224 1.0.225 1.0.226 1.0.227 1.0.227.1 1.0.228 1.0.229 1.0.230 1.0.231 1.0.232 1.0.233 1.0.234 1.0.234.1 1.0.235 1.0.236 1.0.237 1.0.238 1.0.239 1.0.240 1.0.241 1.0.242 1.0.243 1.0.244 1.0.245 1.0.246 1.0.247 1.0.248 1.0.249 1.0.250 1.0.251 1.0.251.1 1.0.252 1.0.252.1 1.0.253 1.0.254 1.0.255 1.0.256 1.0.257 1.0.258 1.0.259 1.0.259.1 1.0.260 1.0.261 1.0.262 1.0.263 1.0.264 1.0.264.1 1.0.265 1.0.266 1.0.266.1 1.0.267 1.0.268
seo-by-rank-math / vendor / mythemeshop / wordpress-helpers / src / helpers / class-conditional.php
seo-by-rank-math / vendor / mythemeshop / wordpress-helpers / src / helpers Last commit date
class-arr.php 2 years ago class-attachment.php 2 years ago class-conditional.php 2 years ago class-db.php 2 years ago class-html.php 2 years ago class-param.php 2 years ago class-str.php 2 years ago class-url.php 2 years ago class-wordpress.php 2 years ago index.php 2 years ago
class-conditional.php
131 lines
1 <?php
2 /**
3 * The Conditional helpers.
4 *
5 * @since 1.0.0
6 * @package MyThemeShop
7 * @subpackage MyThemeShop\Helpers
8 * @author MyThemeShop <admin@mythemeshop.com>
9 */
10
11 namespace MyThemeShop\Helpers;
12
13 use MyThemeShop\Helpers\Param;
14
15 /**
16 * Conditional class.
17 */
18 class Conditional {
19
20 /**
21 * Is AJAX request
22 *
23 * @return bool Returns true when the page is loaded via ajax.
24 */
25 public static function is_ajax() {
26 return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : defined( 'DOING_AJAX' ) && DOING_AJAX;
27 }
28
29 /**
30 * Is CRON request
31 *
32 * @return bool Returns true when the page is loaded via cron.
33 */
34 public static function is_cron() {
35 return function_exists( 'wp_doing_cron' ) ? wp_doing_cron() : defined( 'DOING_CRON' ) && DOING_CRON;
36 }
37
38 /**
39 * Is auto-saving
40 *
41 * @return bool Returns true when the page is loaded for auto-saving.
42 */
43 public static function is_autosave() {
44 return defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
45 }
46
47 /**
48 * Is REST request
49 *
50 * @link https://wordpress.stackexchange.com/questions/221202/does-something-like-is-rest-exist/221289
51 *
52 * Case #1: After WP_REST_Request initialisation
53 * Case #2: Support "plain" permalink settings
54 * Case #3: It can happen that WP_Rewrite is not yet initialized,
55 * so do this (wp-settings.php)
56 * Case #4: URL Path begins with wp-json/ (your REST prefix)
57 * Also supports WP installations in subfolders
58 *
59 * @return bool
60 */
61 public static function is_rest() {
62 global $wp_rewrite;
63
64 $prefix = rest_get_url_prefix();
65 if (
66 defined( 'REST_REQUEST' ) && REST_REQUEST || // (#1)
67 isset( $_GET['rest_route'] ) && // (#2)
68 0 === strpos( trim( $_GET['rest_route'], '\\/' ), $prefix, 0 )
69 ) {
70 return true;
71 }
72
73 // (#3)
74 if ( null === $wp_rewrite ) {
75 $wp_rewrite = new \WP_Rewrite;
76 }
77
78 // (#4)
79 $rest_url = wp_parse_url( trailingslashit( rest_url() ) );
80 $current_url = wp_parse_url( add_query_arg( [] ) );
81
82 if ( ! isset( $current_url['path'] ) || ! isset( $rest_url['path'] ) ) {
83 return false;
84 }
85
86 return 0 === strpos( $current_url['path'], $rest_url['path'], 0 );
87 }
88
89 /**
90 * Check if the request is heartbeat.
91 *
92 * @return bool
93 */
94 public static function is_heartbeat() {
95 return 'heartbeat' === Param::post( 'action' );
96 }
97
98 /**
99 * Check if the request is from frontend.
100 *
101 * @codeCoverageIgnore
102 *
103 * @return bool
104 */
105 public function is_frontend() {
106 return ! is_admin();
107 }
108
109 /**
110 * Is WooCommerce Installed
111 *
112 * @return bool
113 */
114 public static function is_woocommerce_active() {
115 // @codeCoverageIgnoreStart
116 if ( ! function_exists( 'is_plugin_active' ) ) {
117 include_once ABSPATH . 'wp-admin/includes/plugin.php';
118 }
119 // @codeCoverageIgnoreEnd
120 return is_plugin_active( 'woocommerce/woocommerce.php' ) && function_exists( 'is_woocommerce' );
121 }
122
123 /**
124 * Is EDD Installed
125 *
126 * @return bool
127 */
128 public static function is_edd_active() {
129 return class_exists( 'Easy_Digital_Downloads' );
130 }
131 }