ks if the current page is an AMP page. * * @since 4.2.4 * * @return bool Whether the current page is an AMP page. */ private function isAmpPageHelper() { // First check for the existence of any AMP plugin functions. Bail early if none are found, and prevent false positives. if ( ! function_exists( 'amp_is_request' ) && ! function_exists( 'is_amp_endpoint' ) && ! function_exists( 'ampforwp_is_amp_endpoint' ) && ! function_exists( 'is_amp_wp' ) ) { // If none of the AMP plugin functions are found, return false and allow compatibility with custom implementations. return apply_filters( 'aioseo_is_amp_page', false ); } // AMP plugin requires the `wp` action to be called to function properly, otherwise, it will throw warnings. // https://github.com/awesomemotive/aioseo/issues/6056 if ( did_action( 'wp' ) ) { // Check for the "AMP" plugin. if ( function_exists( 'amp_is_request' ) ) { return (bool) amp_is_request(); } // Check for the "AMP" plugin (`is_amp_endpoint()` is deprecated). if ( function_exists( 'is_amp_endpoint' ) ) { return (bool) is_amp_endpoint(); } // Check for the "AMP for WP – Accelerated Mobile Pages" plugin. if ( function_exists( 'ampforwp_is_amp_endpoint' ) ) { return (bool) ampforwp_is_amp_endpoint(); } // Check for the "AMP WP" plugin. if ( function_exists( 'is_amp_wp' ) ) { return (bool) is_amp_wp(); } } return false; } /** * If we're in a LearnPress lesson page, return the lesson ID. * * @since 4.3.1 * * @return int|false */ public function getLearnPressLesson() { global $lp_course_item; if ( $lp_course_item && method_exists( $lp_course_item, 'get_id' ) ) { return $lp_course_item->get_id(); } return false; } /** * Set a flag to indicate Divi whether it is processing internal content or not. * * @since 4.4.3 * * @param null|bool $flag The flag value. * @return null|bool The previous flag value to reset it later. */ public function setDiviInternalRendering( $flag ) { if ( ! defined( 'ET_BUILDER_VERSION' ) ) { return null; } global $et_pb_rendering_column_content; $originalValue = $et_pb_rendering_column_content; $et_pb_rendering_column_content = $flag; return $originalValue; } /** * Checks whether the current request is being done by a crawler from Yandex. * * @since 4.4.0 * * @return bool Whether the current request is being done by a crawler from Yandex. */ public function isYandexUserAgent() { if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } return preg_match( '#.*Yandex.*#', $_SERVER['HTTP_USER_AGENT'] ); } }