ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
common.php
Go to the documentation of this file.
1 <?php
2 
3 function assertCli()
4 {
5  if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
6  echo 'Script cannot be called from web-browser (if you are indeed calling via cli,
7 set environment variable PHP_IS_CLI to work around this).';
8  exit(1);
9  }
10 }
11 
12 function prefix_is($comp, $subject)
13 {
14  return strncmp($comp, $subject, strlen($comp)) === 0;
15 }
16 
17 function postfix_is($comp, $subject)
18 {
19  return strlen($subject) < $comp ? false : substr($subject, -strlen($comp)) === $comp;
20 }
21 
22 // Load useful stuff like FSTools
23 require_once dirname(__FILE__) . '/../extras/HTMLPurifierExtras.auto.php';
24 
25 // vim: et sw=4 sts=4
postfix_is($comp, $subject)
Definition: common.php:17
prefix_is($comp, $subject)
Definition: common.php:12
assertCli()
Definition: common.php:3