コード例 #1
0
 /**
  * Method that gets invoked when the parser runs over CDATA.
  *
  * This method is called by PHP's internal parser functions and registered
  * in the actual parser implementation.
  *
  * It gives control to the current active handler object by calling the
  * <code>characters()</code> method. That processes the given CDATA.
  *
  * BECAUSE OF PROBLEMS WITH EXCEPTIONS BUBBLING UP THROUGH xml_parse() THIS
  * METHOD WILL CALL Phing::halt(-1) ON EXCEPTION.
  * 
  * @param resource $parser php's internal parser handle.
  * @param string $data the CDATA
  */
 function characters($parser, $data)
 {
     try {
         $this->handler->characters($data);
     } catch (Exception $e) {
         print "[Exception in XML parsing]\n";
         print $e;
         Phing::halt(-1);
     }
 }
コード例 #2
0
// ---------------------------
ini_set('track_errors', 1);
/* set classpath */
if (getenv('PHP_CLASSPATH')) {
    define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path());
    ini_set('include_path', PHP_CLASSPATH);
} else {
    define('PHP_CLASSPATH', get_include_path());
}
require_once 'phing/Phing.php';
/* Setup Phing environment */
Phing::startup();
/* 
  find phing home directory 
   -- if Phing is installed from PEAR this will probably be null,
   which is fine (I think).  Nothing uses phing.home right now.
*/
Phing::setProperty('phing.home', getenv('PHING_HOME'));
/* polish CLI arguments */
$args = isset($argv) ? $argv : $_SERVER['argv'];
// $_SERVER['argv'] seems not to work when argv is registered (PHP5b4)
array_shift($args);
// 1st arg is script name, so drop it
/* fire main application */
Phing::fire($args);
/*
 exit OO system if not already called by Phing
  -- basically we should not need this due to register_shutdown_function in Phing
*/
Phing::halt(0);