Subversion Repositories fastphp

Rev

Rev 49 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49 Rev 61
Line 1... Line 1...
1
unit FastPHPUtils;
1
unit FastPHPUtils;
2
 
2
 
3
interface
3
interface
4
 
4
 
5
uses
5
uses
6
  Windows, SysUtils, StrUtils, Dialogs, IniFiles, Classes, Forms, ShellAPI;
6
  Windows, SysUtils, StrUtils, Dialogs, IniFiles, Classes, Forms, ShellAPI, Functions;
7
 
7
 
8
const
8
const
9
  FASTPHP_GOTO_URI_PREFIX = 'fastphp://editor/gotoline/';
9
  FASTPHP_GOTO_URI_PREFIX = 'fastphp://editor/gotoline/';
10
 
10
 
11
function GetPHPExe: string;
11
function GetPHPExe: string;
12
function RunPHPScript(APHPFileName: string; lint: boolean=false; inConsole: boolean=False): string;
12
function RunPHPScript(APHPFileName: string; lint: boolean=false; inConsole: boolean=False; ContentCallBack: TContentCallBack=nil): string;
13
function ParseCHM(const chmFile: TFileName): boolean;
13
function ParseCHM(const chmFile: TFileName): boolean;
14
function IsValidPHPExe(const exeFile: TFileName): boolean;
14
function IsValidPHPExe(const exeFile: TFileName): boolean;
15
 
15
 
16
implementation
16
implementation
17
 
17
 
18
uses
18
uses
19
  Functions, FastPHPConfig;
19
  FastPHPConfig;
20
 
20
 
21
function GetPHPExe: string;
21
function GetPHPExe: string;
22
var
22
var
23
  od: TOpenDialog;
23
  od: TOpenDialog;
24
begin
24
begin
Line 48... Line 48...
48
 
48
 
49
    TFastPHPConfig.PhpInterpreter := result;
49
    TFastPHPConfig.PhpInterpreter := result;
50
  end;
50
  end;
51
end;
51
end;
52
 
52
 
53
function RunPHPScript(APHPFileName: string; lint: boolean=false; inConsole: boolean=False): string;
53
function RunPHPScript(APHPFileName: string; lint: boolean=false; inConsole: boolean=False; ContentCallBack: TContentCallBack=nil): string;
54
var
54
var
55
  phpExe, args, batFile, workdir: string;
55
  phpExe, args, batFile, workdir: string;
56
  slBat: TStringList;
56
  slBat: TStringList;
57
begin
57
begin
58
  phpExe := GetPHPExe;
58
  phpExe := GetPHPExe;
Line 86... Line 86...
86
 
86
 
87
    result := '';
87
    result := '';
88
  end
88
  end
89
  else
89
  else
90
  begin
90
  begin
91
    result := GetDosOutput('"'+phpExe+'" ' + args, workdir);
91
    result := GetDosOutput('"'+phpExe+'" ' + args, workdir, ContentCallBack);
92
  end;
92
  end;
93
end;
93
end;
94
 
94
 
95
function ParseCHM(const chmFile: TFileName): boolean;
95
function ParseCHM(const chmFile: TFileName): boolean;
96
var
96
var