Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Usage: [[!regClient? &input=`markup or script here` &function=`htmlToBottom`]]
<?php
$options = isset($options) ? $options : 'htmlToBottom';
$function = $modx->getOption('function', $scriptProperties, $options);
$plaintext = (strstr($input, PHP_EOL)) ? true : false;
switch ($function) {
case 'cssToHead':
$modx->regClientCSS($input);
break;
case 'htmlToHead':
$modx->regClientStartupHTMLBlock($input);
break;
case 'htmlToBottom':
$modx->regClientHTMLBlock($input);
break;
case 'jsToHead':
$modx->regClientStartupScript($input,$plaintext);
break;
case 'jsToBottom':
$modx->regClientScript($input,$plaintext);
break;
}
return '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment