Avoid doing stupidly clever reflection tricks that make old PHP versions sad.
[htmlpurifier.git] / maintenance / common.php
blob888c7daf946a0c49da0c3c966ca820c557527c19
1 <?php
3 function assertCli() {
4 if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
5 echo 'Script cannot be called from web-browser (if you are indeed calling via cli,
6 set environment variable PHP_IS_CLI to work around this).';
7 exit(1);
11 function prefix_is($comp, $subject) {
12 return strncmp($comp, $subject, strlen($comp)) === 0;
15 function postfix_is($comp, $subject) {
16 return strlen($subject) < $comp ? false : substr($subject, -strlen($comp)) === $comp;
19 // Load useful stuff like FSTools
20 require_once dirname(__FILE__) . '/../extras/HTMLPurifierExtras.auto.php';
22 // vim: et sw=4 sts=4