| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/rocket-lazy-load/src/Subscriber/ThirdParty/ |
Upload File : |
<?php
/**
* AMP plugin compatibility subscrber
*
* @package RocketLazyload
*/
namespace RocketLazyLoadPlugin\Subscriber\ThirdParty;
use RocketLazyLoadPlugin\EventManagement\EventManager;
use RocketLazyLoadPlugin\EventManagement\EventManagerAwareSubscriberInterface;
defined('ABSPATH') || die('Cheatin\' uh?');
/**
* Manages compatibility with the AMP plugin
*
* @since 2.0
* @author Remy Perona
*/
class AMPSubscriber implements EventManagerAwareSubscriberInterface
{
/**
* @inheritDoc
*/
public function getSubscribedEvents()
{
return [
'wp' => 'disableIfAMP',
];
}
/**
* {@inheritdoc}
*/
public function setEventManager(EventManager $event_manager)
{
$this->event_manager = $event_manager;
}
/**
* Disable if on AMP page
*
* @since 2.0.2
* @author Remy Perona
*
* @return void
*/
public function disableIfAMP()
{
if ($this->isAmpEndpoint()) {
$this->event_manager->addCallback('do_rocket_lazyload', '__return_false');
$this->event_manager->addCallback('do_rocket_lazyload_iframes', '__return_false');
}
}
/**
* Checks if current page uses AMP
*
* @since 2.0
* @author Remy Perona
*
* @return boolean
*/
private function isAmpEndpoint()
{
if (function_exists('is_amp_endpoint') && \is_amp_endpoint()) {
return true;
}
return false;
}
}