<?php namespace CoffeeScript; Init::init(); /** * @package CoffeeScript * @author Alex Little * @license MIT * @homepage http://github.com/alxlit/coffeescript-php */ class Compiler { /** * Compile some CoffeeScript. * * Available options: * * 'filename' => The source file, for debugging (formatted into error messages) * 'header' => Add a header to the generated source (default: TRUE) * 'rewrite' => Enable rewriting token stream (debugging) * 'tokens' => Reference to token stream (debugging) * 'trace' => File to write parser trace to (debugging) * * @param string The source CoffeeScript code * @param array Options (see above) * * @return string The resulting JavaScript (if there were no errors) */ static function compile($code, $options = array()) {
/** * This function includes the IDS vendor parts and runs the * detection routines on the request array. * * @param object cake controller object * @return boolean */ public function detect(&$controller) { $this->controller =& $controller; $this->name = Inflector::singularize($this->controller->name); #set include path for IDS and store old one $path = get_include_path(); set_include_path(VENDORS . 'phpids/'); #require the needed files vendor('phpids/IDS/Init'); #add request url and user agent $_REQUEST['IDS_request_uri'] = $_SERVER['REQUEST_URI']; if (isset($_SERVER['HTTP_USER_AGENT'])) { $_REQUEST['IDS_user_agent'] = $_SERVER['HTTP_USER_AGENT']; } #init the PHPIDS and pass the REQUEST array $this->init = Init::init(); $ids = new Monitor($_REQUEST, $this->init); $result = $ids->run(); // Re-set include path set_include_path($path); if (!$result->isEmpty()) { $this->react($result); } return true; }