Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Quercus

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2010, 06:30 PM
lotstyl lotstyl is offline
Junior Member
 
Join Date: Feb 2010
Posts: 10
Default Includes

Hi to all,
My java project uses Quercus to run some php applications, and actually i need to find a way to autoresolve includes in the php sources, by handling the "require" "require_once" and "include" keywords.
I have coded the following function to do so, but i wonder if there is an easy way already implemented in Quercus.

Code:
public static List<String> resoveIncludes(QuercusProgram phpProgram)
			throws IOException {
		List<String> list = new LinkedList<String>();
		if (phpProgram.getStatement() instanceof BlockStatement) {
			BlockStatement blockStatement = (BlockStatement) phpProgram
					.getStatement();
			Statement[] statements = blockStatement.getStatements();
			for (Statement s : statements) {
				if (s instanceof ExprStatement) {
					Expr expr = ((ExprStatement) s).getExpr();
					if (expr instanceof IncludeOnceExpr
							|| (expr instanceof IncludeExpr)) {
						list.add(StringUtils.substringBetween(expr.toString(), "\""));
					}
				}
			}
		}
		return list;
	}
Thanks in advance
Reply With Quote
  #2  
Old 02-21-2010, 03:10 AM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

I'm not sure what u mean by "autoresolve". If you want the list of included files, I believe there is a function to get it in com.caucho.quercus.env.Env.java
Reply With Quote
Reply

Tags
include, java, php, require, require_once

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:07 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.