Exemplo n.º 1
0
 /**
  * @internal
  * @todo map virtual roots incase differs on target
  * @todo implement chdir fix
  * @todo implement plug_virtual wrapper method
  */
 private function compile_virtual($vpath)
 {
     // path should be virtual (or relative to current script?)
     if ($vpath[0] === '/') {
         $path = PLUG_VIRTUAL_DIR . $vpath;
     } else {
         $path = $this->cwd . '/' . $vpath;
     }
     if (!PLUGTool::check_file($path)) {
         trigger_error("Failed to map virtual path {$vpath}", E_USER_WARNING);
         return null;
     }
     // compile directly into source if option set
     if (in_array('virtual', $this->incfuncs, true)) {
         // do not evaluate php,this is a static include method
         $src = '';
         $this->close_php($src);
         $src .= file_get_contents($path);
     } else {
         $this->register_dependency($path);
         $src = 'virtual( ' . var_export($vpath, 1) . ' );';
     }
     return $src;
 }
Exemplo n.º 2
0
/**
 * Global function for importing PLUG PHP entities.
 * @usage <code>import('PLUG.example.*');</code>
 * @param string dot-delimited package description
 * @return Void
 */
function import($package)
{
    return PLUGTool::import_php($package);
}