-
-
Save Burick/495b5142f470b4107be3cda6e7445d08 to your computer and use it in GitHub Desktop.
MODX Client Preview Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($modx->context->get('key') === 'mgr') return; | |
$key = $modx->getOption('key', $scriptProperties, 'my-secret-key'); | |
$val = $modx->getOption('val', $scriptProperties, 'my-secret-value'); | |
switch ($modx->event->name) { | |
case 'OnHandleRequest': | |
if (!$modx->getOption('site_status')) { | |
if ($_GET[$key] === $val) { | |
$modx->config['site_status'] = 1; | |
} else { | |
$modx->config['site_status'] = 0; | |
} | |
} | |
break; | |
case 'OnLoadWebDocument': | |
case 'OnLoadWebPageCache': | |
if (!$modx->getOption('site_status')) { | |
if ($_GET[$key] === $val) { | |
if ($modx->resource instanceof modResource) $modx->resource->set('cacheable', false); | |
} | |
} | |
break; | |
default: | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment