Subversion Repositories php-qbpwcf

Rev

Rev 221 | Rev 230 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 221 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2014~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 25... Line 25...
25
 
25
 
26
/*
26
/*
27
類別說明:
27
類別說明:
28
管理QBPWCFW套件的類別.
28
管理QBPWCFW套件的類別.
29
備註:
29
備註:
30
待所有函數類別與函數都標準化後,再來修改該函數會比較恰當. 
30
待所有函數類別與函數都標準化後,再來修改該函數會比較恰當.
31
*/
31
*/
32
class phpLib{
32
class phpLib{
33
 
33
 
34
	/*
34
	/*
35
	#函式說明:
35
	#函式說明:
Line 47... Line 47...
47
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
47
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
48
	#備註:
48
	#備註:
49
	#無.
49
	#無.
50
	*/
50
	*/
51
	public function __call($method,$arguments){
51
	public function __call($method,$arguments){
52
		
52
 
53
		#取得當前執行的函式
53
		#取得當前執行的函式
54
		$result["function"]=__FUNCTION__;
54
		$result["function"]=__FUNCTION__;
55
		
55
 
56
		#設置執行不正常
56
		#設置執行不正常
57
		$result["status"]="false";
57
		$result["status"]="false";
58
		
58
 
59
		#設置執行錯誤
59
		#設置執行錯誤
60
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
60
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
61
		
61
 
62
		#設置所丟入的參數
62
		#設置所丟入的參數
63
		$result["error"][]=$arguments;
63
		$result["error"][]=$arguments;
64
		
64
 
65
		#回傳結果
65
		#回傳結果
66
		return $result;
66
		return $result;
67
		
67
 
68
		}#function __call end
68
		}#function __call end
69
		
69
 
70
	/*
70
	/*
71
	#函式說明:
71
	#函式說明:
72
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
72
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
73
	#回傳結果:
73
	#回傳結果:
74
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
74
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 83... Line 83...
83
	#__callStatic=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
83
	#__callStatic=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
84
	#備註:
84
	#備註:
85
	#無.
85
	#無.
86
	*/
86
	*/
87
	public static function __callStatic($method,$arguments){
87
	public static function __callStatic($method,$arguments){
88
		
88
 
89
		#取得當前執行的函式
89
		#取得當前執行的函式
90
		$result["function"]=__FUNCTION__;
90
		$result["function"]=__FUNCTION__;
91
		
91
 
92
		#設置執行不正常
92
		#設置執行不正常
93
		$result["status"]="false";
93
		$result["status"]="false";
94
		
94
 
95
		#設置執行錯誤
95
		#設置執行錯誤
96
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
96
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
97
		
97
 
98
		#設置所丟入的參數
98
		#設置所丟入的參數
99
		$result["error"][]=$arguments;
99
		$result["error"][]=$arguments;
100
		
100
 
101
		#回傳結果
101
		#回傳結果
102
		return $result;
102
		return $result;
103
		
103
 
104
		}#function __callStatic end
104
		}#function __callStatic end
105
 
105
 
106
	/*
106
	/*
107
	#函式說明:
107
	#函式說明:
108
	#取得目錄底下函式庫檔案清單
108
	#取得目錄底下函式庫檔案清單
109
	#回傳結果:
109
	#回傳結果:
110
	#$result["status"],"true"表示執行成功;"false"表示執行失敗
110
	#$result["status"],"true"表示執行成功;"false"表示執行失敗
111
	#$result["error"],錯誤訊息.
111
	#$result["error"],錯誤訊息.
112
	#$result["function"],當前執行的函數名稱.
112
	#$result["function"],當前執行的函數名稱.
113
	#$result["dataCount"],有幾筆符合的資料
113
	#$result["dataCount"],有幾筆符合的資料
114
	#$result["neededList"],符合條件的檔案清單		
114
	#$result["neededList"],符合條件的檔案清單
115
	#必填參數:
115
	#必填參數:
116
	#$conf["folderAddress"],字串,要讀取的函式庫目錄
116
	#$conf["folderAddress"],字串,要讀取的函式庫目錄
117
	$conf["folderAddress"]="phpLib";
117
	$conf["folderAddress"]="phpLib";
118
	#$conf["fileArgu"],字串,__FILE__的內容.
118
	#$conf["fileArgu"],字串,__FILE__的內容.
119
	$conf["fileArgu"]=__FILE__;
119
	$conf["fileArgu"]=__FILE__;
Line 135... Line 135...
135
		#取得當前函數的名稱
135
		#取得當前函數的名稱
136
		$result["function"]=__FUNCTION__;
136
		$result["function"]=__FUNCTION__;
137
 
137
 
138
		#如果 $conf 不為陣列
138
		#如果 $conf 不為陣列
139
		if(gettype($conf)!="array"){
139
		if(gettype($conf)!="array"){
140
			
140
 
141
			#設置執行失敗
141
			#設置執行失敗
142
			$result["status"]="false";
142
			$result["status"]="false";
143
			
143
 
144
			#設置執行錯誤訊息
144
			#設置執行錯誤訊息
145
			$result["error"][]="\$conf變數須為陣列形態";
145
			$result["error"][]="\$conf變數須為陣列形態";
146
 
146
 
147
			#如果傳入的參數為 null
147
			#如果傳入的參數為 null
148
			if($conf==null){
148
			if($conf==null){
149
				
149
 
150
				#設置執行錯誤訊息
150
				#設置執行錯誤訊息
151
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
151
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
152
				
152
 
153
				}#if end
153
				}#if end
154
 
154
 
155
			#回傳結果
155
			#回傳結果
156
			return $result;
156
			return $result;
157
			
157
 
158
			}#if end
158
			}#if end
159
 
159
 
160
		#函式說明:
160
		#函式說明:
161
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
161
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
162
		#回傳結果:
162
		#回傳結果:
Line 165... Line 165...
165
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
165
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
166
		#必填寫的參數:
166
		#必填寫的參數:
167
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
167
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
168
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("folderAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
168
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("folderAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
169
		#可以省略的參數:
169
		#可以省略的參數:
170
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double"); 
170
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double");
171
		#$conf["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
171
		#$conf["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
172
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
172
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
173
		unset($conf["variableCheck"]["isexistMuti"]);
173
		unset($conf["variableCheck"]["isexistMuti"]);
174
 
174
 
175
		#如果參數檢查有問題 
175
		#如果參數檢查有問題
176
		if($checkResult["passed"]=="false"){
176
		if($checkResult["passed"]=="false"){
177
 
177
 
178
			#回傳檢查的結果
178
			#回傳檢查的結果
179
			return $checkResult;
179
			return $checkResult;
180
 
180
 
Line 231... Line 231...
231
		$ls=fileAccess::ls($conf["fileAccess::ls"]);
231
		$ls=fileAccess::ls($conf["fileAccess::ls"]);
232
		unset($conf["fileAccess::ls"]);
232
		unset($conf["fileAccess::ls"]);
233
 
233
 
234
		#如果執行失敗
234
		#如果執行失敗
235
		if($ls["status"]==="false"){
235
		if($ls["status"]==="false"){
236
		
236
 
237
			#設置執行失敗識別
237
			#設置執行失敗識別
238
			$result["status"]="false";
238
			$result["status"]="false";
239
			
239
 
240
			#設置執行失敗提示
240
			#設置執行失敗提示
241
			$result["error"]=$ls;
241
			$result["error"]=$ls;
242
			
242
 
243
			#回傳結果
243
			#回傳結果
244
			return $result;
244
			return $result;
245
			
245
 
246
			}#if end
246
			}#if end
247
 
247
 
248
		#debug
248
		#debug
249
		#var_dump(__FILE__,__LINE__,$ls);
249
		#var_dump(__FILE__,__LINE__,$ls);
250
 
250
 
Line 287... Line 287...
287
			#debug
287
			#debug
288
			#var_dump(__FILE__,__LINE__,$spiltString);
288
			#var_dump(__FILE__,__LINE__,$spiltString);
289
 
289
 
290
			#如果執行失敗
290
			#如果執行失敗
291
			if($spiltString["status"]=="false"){
291
			if($spiltString["status"]=="false"){
292
				
292
 
293
				#設置執行失敗識別
293
				#設置執行失敗識別
294
				$result["status"]="false";
294
				$result["status"]="false";
295
				
295
 
296
				#設置執行失敗提示
296
				#設置執行失敗提示
297
				$result["error"]=$spiltString["error"];
297
				$result["error"]=$spiltString["error"];
298
				
298
 
299
				#回傳結果
299
				#回傳結果
300
				return $result;
300
				return $result;
301
				
301
 
302
				}#if end
302
				}#if end
303
 
303
 
304
			#如果「.」後面有內容 
304
			#如果「.」後面有內容
305
			if($spiltString["dataCounts"]>1){
305
			if($spiltString["dataCounts"]>1){
306
 
306
 
307
				#debug
307
				#debug
308
				#var_dump($spiltStr);
308
				#var_dump($spiltStr);
309
 
309
 
Line 312... Line 312...
312
				#回傳的結果:
312
				#回傳的結果:
313
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
313
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
314
				#$result["function"],當前執行的函數.
314
				#$result["function"],當前執行的函數.
315
				#$result["content"],爲處理好的字串.
315
				#$result["content"],爲處理好的字串.
316
				#$result["error"],錯誤訊息陣列.
316
				#$result["error"],錯誤訊息陣列.
317
				#$result["argu"],使用的參數. 
317
				#$result["argu"],使用的參數.
318
				#必填參數:
318
				#必填參數:
319
				$conf["stringProcess"]["correctCharacter"]["stringIn"]=$spiltString["dataArray"][$spiltString["dataCounts"]-1];#爲要處理的字串
319
				$conf["stringProcess"]["correctCharacter"]["stringIn"]=$spiltString["dataArray"][$spiltString["dataCounts"]-1];#爲要處理的字串
320
				#可省略的參數:
320
				#可省略的參數:
321
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\r","\n","\r\n","\n\r");#爲被選擇要處理的字串/字元,須爲陣列值。
321
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\r","\n","\r\n","\n\r");#爲被選擇要處理的字串/字元,須爲陣列值。
322
					#若不設定則預設爲要將這些字串作替換("<" ">" ";" "=" "//" "'" "$" "%" "&" "|" "#" "/*" "*\/")。
322
					#若不設定則預設爲要將這些字串作替換("<" ">" ";" "=" "//" "'" "$" "%" "&" "|" "#" "/*" "*\/")。
323
				#$conf["changeTo"]=array("","","","");#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
323
				#$conf["changeTo"]=array("","","","");#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
324
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
324
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
325
				unset($conf["stringProcess"]["correctCharacter"]);
325
				unset($conf["stringProcess"]["correctCharacter"]);
326
				
326
 
327
				#如果處理失敗
327
				#如果處理失敗
328
				if($correctCharacter["status"]==="false"){
328
				if($correctCharacter["status"]==="false"){
329
				
329
 
330
					#設置執行失敗識別
330
					#設置執行失敗識別
331
					$result["status"]="false";
331
					$result["status"]="false";
332
					
332
 
333
					#設置執行失敗提示
333
					#設置執行失敗提示
334
					$result["error"]=$correctCharacter;
334
					$result["error"]=$correctCharacter;
335
					
335
 
336
					#回傳結果
336
					#回傳結果
337
					return $result;
337
					return $result;
338
				
338
 
339
					}#if end
339
					}#if end
340
				
340
 
341
				#var_dump($spiltStr["dataArray"][$spiltStr["dataCounts"]-1]);
341
				#var_dump($spiltStr["dataArray"][$spiltStr["dataCounts"]-1]);
342
				#var_dump($correctCharacter["content"]);
342
				#var_dump($correctCharacter["content"]);
343
				
343
 
344
				#更新處理好的字串內容
344
				#更新處理好的字串內容
345
				$spiltString["dataArray"][$spiltString["dataCounts"]-1]=$correctCharacter["content"];
345
				$spiltString["dataArray"][$spiltString["dataCounts"]-1]=$correctCharacter["content"];
346
 
346
 
347
				#對照其最後一個「.」後面的內容(副檔名)是否爲我們所需要的。
347
				#對照其最後一個「.」後面的內容(副檔名)是否爲我們所需要的。
348
				#函式說明:
348
				#函式說明:
Line 361... Line 361...
361
				$compareResult=search::getEqualVar($conf["search"]["getEqualVar"]);
361
				$compareResult=search::getEqualVar($conf["search"]["getEqualVar"]);
362
				unset($conf["search"]["getEqualVar"]);
362
				unset($conf["search"]["getEqualVar"]);
363
 
363
 
364
				#如果執行失敗
364
				#如果執行失敗
365
				if($compareResult["status"]==="false"){
365
				if($compareResult["status"]==="false"){
366
				
366
 
367
					#設置執行失敗識別
367
					#設置執行失敗識別
368
					$result["status"]="false";
368
					$result["status"]="false";
369
					
369
 
370
					#設置執行失敗提示
370
					#設置執行失敗提示
371
					$result["error"]=$compareResult;
371
					$result["error"]=$compareResult;
372
					
372
 
373
					#回傳結果
373
					#回傳結果
374
					return $result;
374
					return $result;
375
					
375
 
376
					}#if end
376
					}#if end
377
 
377
 
378
				#如果有符合
378
				#如果有符合
379
				if($compareResult["founded"]==="true"){
379
				if($compareResult["founded"]==="true"){
380
 
380
 
Line 383... Line 383...
383
					#回傳結果:
383
					#回傳結果:
384
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
384
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
385
					#$result["function"],當前執行的函數.
385
					#$result["function"],當前執行的函數.
386
					#$result["content"],爲處理好的字串.
386
					#$result["content"],爲處理好的字串.
387
					#$result["error"],錯誤訊息陣列.
387
					#$result["error"],錯誤訊息陣列.
388
					#$result["argu"],使用的參數. 
388
					#$result["argu"],使用的參數.
389
					#必填參數:
389
					#必填參數:
390
					$conf["stringProcess"]["correctCharacter"]["stringIn"]=$spiltString["dataArray"][$spiltString["dataCounts"]-1];#爲要處理的字串
390
					$conf["stringProcess"]["correctCharacter"]["stringIn"]=$spiltString["dataArray"][$spiltString["dataCounts"]-1];#爲要處理的字串
391
					#可省略的參數:
391
					#可省略的參數:
392
					$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\r","\n","\r\n","\n\r");#爲被選擇要處理的字串/字元,須爲陣列值。
392
					$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\r","\n","\r\n","\n\r");#爲被選擇要處理的字串/字元,須爲陣列值。
393
						#若不設定則預設爲要將這些字串作替換("<" ">" ";" "=" "//" "'" "$" "%" "&" "|" "#" "/*" "*\/")。
393
						#若不設定則預設爲要將這些字串作替換("<" ">" ";" "=" "//" "'" "$" "%" "&" "|" "#" "/*" "*\/")。
Line 398... Line 398...
398
					#debug
398
					#debug
399
					#var_dump(__FILE__,__LINE__,$correctCharacter);
399
					#var_dump(__FILE__,__LINE__,$correctCharacter);
400
 
400
 
401
					#如果檔案是要排除的
401
					#如果檔案是要排除的
402
					if(in_array($correctCharacter["content"],$conf["excludeFile"])){
402
					if(in_array($correctCharacter["content"],$conf["excludeFile"])){
403
					
403
 
404
						#debug
404
						#debug
405
						#var_dump(__FILE__,__LINE__,$correctCharacter["content"],$conf["excludeFile"]);
405
						#var_dump(__FILE__,__LINE__,$correctCharacter["content"],$conf["excludeFile"]);
406
					
406
 
407
						#忽略之
407
						#忽略之
408
						continue;
408
						continue;
409
					
409
 
410
						}#if end
410
						}#if end
411
					
411
 
412
					#針對每個要排除的項目	
412
					#針對每個要排除的項目
413
					foreach($conf["excludeFile"] as $excludeFile){
413
					foreach($conf["excludeFile"] as $excludeFile){
414
					
414
 
415
						#如果檔案名稱包含"*",且為第一個字
415
						#如果檔案名稱包含"*",且為第一個字
416
						if(strpos($excludeFile,"*")===0){
416
						if(strpos($excludeFile,"*")===0){
417
						
417
 
418
							#取得要排除的關鍵字
418
							#取得要排除的關鍵字
419
							$excludeFileKeyWord=substr($excludeFile,1);
419
							$excludeFileKeyWord=substr($excludeFile,1);
420
							
420
 
421
							#檢查有無結尾一樣
421
							#檢查有無結尾一樣
422
							#涵式說明:
422
							#涵式說明:
423
							#取得符合特定字首與字尾的字串
423
							#取得符合特定字首與字尾的字串
424
							#回傳的結果:
424
							#回傳的結果:
425
							#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
425
							#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
Line 438... Line 438...
438
							$conf["search::getMeetConditionsString"]["tailWord"]=$excludeFileKeyWord;
438
							$conf["search::getMeetConditionsString"]["tailWord"]=$excludeFileKeyWord;
439
							#參考資料:
439
							#參考資料:
440
							#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
440
							#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
441
							$getMeetConditionsString=search::getMeetConditionsString($conf["search::getMeetConditionsString"]);
441
							$getMeetConditionsString=search::getMeetConditionsString($conf["search::getMeetConditionsString"]);
442
							unset($conf["search::getMeetConditionsString"]);
442
							unset($conf["search::getMeetConditionsString"]);
443
						
443
 
444
							#如果執行失敗
444
							#如果執行失敗
445
							if($getMeetConditionsString["status"]==="false"){
445
							if($getMeetConditionsString["status"]==="false"){
446
							
446
 
447
								#如果不是檔案名稱過短的錯誤
447
								#如果不是檔案名稱過短的錯誤
448
								if($getMeetConditionsString["error"][0]!=="要尋找的字尾長度大於要檢查的字串長度"){
448
								if($getMeetConditionsString["error"][0]!=="要尋找的字尾長度大於要檢查的字串長度"){
449
							
449
 
450
									#設置執行失敗識別
450
									#設置執行失敗識別
451
									$result["status"]="false";
451
									$result["status"]="false";
452
									
452
 
453
									#設置執行失敗提示
453
									#設置執行失敗提示
454
									$result["error"]=$getMeetConditionsString["error"];
454
									$result["error"]=$getMeetConditionsString["error"];
455
									
455
 
456
									#回傳結果
456
									#回傳結果
457
									return $result;
457
									return $result;
458
									
458
 
459
									}#if end
459
									}#if end
460
									
460
 
461
								#設置沒有找到結尾相同的
461
								#設置沒有找到結尾相同的
462
								$getMeetConditionsString["founded"]="false";
462
								$getMeetConditionsString["founded"]="false";
463
							
463
 
464
								}#if end
464
								}#if end
465
																							
-
 
-
 
465
 
466
							#如果結尾相同
466
							#如果結尾相同
467
							if($getMeetConditionsString["founded"]==="true"){
467
							if($getMeetConditionsString["founded"]==="true"){
468
														
468
 
469
								#跳過該檔案
469
								#跳過該檔案
470
								continue 2;
470
								continue 2;
471
							
471
 
472
								}#if end
472
								}#if end
473
						
473
 
474
							}#if end
474
							}#if end
475
					
475
 
476
						}#foreach end
476
						}#foreach end
477
 
477
 
478
					#debug
478
					#debug
479
					#var_dump(__FILE__,__LINE__,$node["name"]);
479
					#var_dump(__FILE__,__LINE__,$node["name"]);
480
 
480
 
481
					#只接受檔案(排除軟連結、資料夾)
481
					#只接受檔案(排除軟連結、資料夾)
482
					if($node["nType"]==='-'){
482
					if($node["nType"]==='-'){
483
					
483
 
484
						#將該檔案項目取出
484
						#將該檔案項目取出
485
						$result["neededList"][]=$node["name"];
485
						$result["neededList"][]=$node["name"];
486
					
486
 
487
						#將是否有符合條件的檔案的識別設爲 "true"
487
						#將是否有符合條件的檔案的識別設爲 "true"
488
						$result["status"]="true";
488
						$result["status"]="true";
489
					
489
 
490
						}#if end
490
						}#if end
491
						
491
 
492
					}#if end
492
					}#if end
493
		
493
 
494
				}#if end
494
				}#if end
495
 
495
 
496
			}#foreach end
496
			}#foreach end
497
 
497
 
498
		#取得總共有幾個檔案是我們要的
498
		#取得總共有幾個檔案是我們要的
Line 539... Line 539...
539
		#取得當前函數的名稱
539
		#取得當前函數的名稱
540
		$result["function"]=__FUNCTION__;
540
		$result["function"]=__FUNCTION__;
541
 
541
 
542
		#如果 $conf 不為陣列
542
		#如果 $conf 不為陣列
543
		if(gettype($conf)!="array"){
543
		if(gettype($conf)!="array"){
544
			
544
 
545
			#設置執行失敗
545
			#設置執行失敗
546
			$result["status"]="false";
546
			$result["status"]="false";
547
			
547
 
548
			#設置執行錯誤訊息
548
			#設置執行錯誤訊息
549
			$result["error"][]="\$conf變數須為陣列形態";
549
			$result["error"][]="\$conf變數須為陣列形態";
550
 
550
 
551
			#如果傳入的參數為 null
551
			#如果傳入的參數為 null
552
			if($conf==null){
552
			if($conf==null){
553
				
553
 
554
				#設置執行錯誤訊息
554
				#設置執行錯誤訊息
555
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
555
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
556
				
556
 
557
				}#if end
557
				}#if end
558
 
558
 
559
			#回傳結果
559
			#回傳結果
560
			return $result;
560
			return $result;
561
			
561
 
562
			}#if end
562
			}#if end
563
 
563
 
564
		#函式說明:
564
		#函式說明:
565
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
565
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
566
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
566
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 610... Line 610...
610
		$checkArguments=variableCheck::checkArguments($conf["variable::checkArguments"]);
610
		$checkArguments=variableCheck::checkArguments($conf["variable::checkArguments"]);
611
		unset($conf["variable::checkArguments"]);
611
		unset($conf["variable::checkArguments"]);
612
 
612
 
613
		# 如果檢查出錯
613
		# 如果檢查出錯
614
		if($checkArguments["status"]=="false"){
614
		if($checkArguments["status"]=="false"){
615
			
615
 
616
			#設置執行錯誤的識別
616
			#設置執行錯誤的識別
617
			$result["status"]="fasle";
617
			$result["status"]="fasle";
618
 
618
 
619
			#設置執行錯誤的訊息
619
			#設置執行錯誤的訊息
620
			$result["error"]=$checkArguments;
620
			$result["error"]=$checkArguments;
621
			
621
 
622
			#回傳結果
622
			#回傳結果
623
			return $result;
623
			return $result;
624
			
624
 
625
			}#if end
625
			}#if end
626
 
626
 
627
		# 如果檢查不通過
627
		# 如果檢查不通過
628
		if($checkArguments["passed"]=="false"){
628
		if($checkArguments["passed"]=="false"){
629
			
629
 
630
			#設置執行錯誤的識別
630
			#設置執行錯誤的識別
631
			$result["status"]="fasle";
631
			$result["status"]="fasle";
632
 
632
 
633
			#設置執行錯誤的訊息
633
			#設置執行錯誤的訊息
634
			$result["error"]=$checkArguments;
634
			$result["error"]=$checkArguments;
635
			
635
 
636
			#回傳結果
636
			#回傳結果
637
			return $result;
637
			return $result;
638
			
638
 
639
			}#if end
639
			}#if end
640
 
640
 
641
		#函數說明:
641
		#函數說明:
642
		#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
642
		#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
643
		#回傳結果:
643
		#回傳結果:
644
		#$result["status"],"true"爲建立成功,"false"爲建立失敗.
644
		#$result["status"],"true"爲建立成功,"false"爲建立失敗.
645
		#$result["error"],錯誤訊息陣列.
645
		#$result["error"],錯誤訊息陣列.
646
		#$result["function"],函數名稱. 
646
		#$result["function"],函數名稱.
647
		#$result["argu"],使用的參數.
647
		#$result["argu"],使用的參數.
648
		#$result["content"],網址,若是在命令列執行,則為"null".
648
		#$result["content"],網址,若是在命令列執行,則為"null".
649
		#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
649
		#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
650
		#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
650
		#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
651
		#必填參數:
651
		#必填參數:
Line 661... Line 661...
661
		$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
661
		$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
662
		unset($conf["fileAccess::getInternetAddressV2"]);
662
		unset($conf["fileAccess::getInternetAddressV2"]);
663
 
663
 
664
		#如果取得網路位置出錯
664
		#如果取得網路位置出錯
665
		if($getInternetAddressV2["status"]=="false"){
665
		if($getInternetAddressV2["status"]=="false"){
666
			
666
 
667
			#設置執行錯誤的識別
667
			#設置執行錯誤的識別
668
			$result["status"]="fasle";
668
			$result["status"]="fasle";
669
 
669
 
670
			#設置執行錯誤的訊息
670
			#設置執行錯誤的訊息
671
			$result["error"]=$checkArguments;
671
			$result["error"]=$checkArguments;
672
			
672
 
673
			#回傳結果
673
			#回傳結果
674
			return $result;
674
			return $result;
675
			
675
 
676
			}#if end
676
			}#if end
677
 
677
 
678
		#取得檔案系統位置
678
		#取得檔案系統位置
679
		$conf["libFileAddress"]=$getInternetAddressV2["fileSystemAbsoulutePosition"];
679
		$conf["libFileAddress"]=$getInternetAddressV2["fileSystemAbsoulutePosition"];
680
 
680
 
Line 697... Line 697...
697
		$fileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
697
		$fileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
698
		unset($conf["fileAccess::getFileContent"]);
698
		unset($conf["fileAccess::getFileContent"]);
699
 
699
 
700
		#如果 檔案取得失敗
700
		#如果 檔案取得失敗
701
		if($fileContent["status"]=="false"){
701
		if($fileContent["status"]=="false"){
702
			
702
 
703
			#設置執行失敗的識別
703
			#設置執行失敗的識別
704
			$result["status"]="false";
704
			$result["status"]="false";
705
			
705
 
706
			#設置錯誤訊息
706
			#設置錯誤訊息
707
			$result["error"]=$fileContent["error"];
707
			$result["error"]=$fileContent["error"];
708
			
708
 
709
			return $result;
709
			return $result;
710
			
710
 
711
			}#if end
711
			}#if end
712
 
712
 
713
		#根據 $fileContent 來尋找總共有幾個命名空間
713
		#根據 $fileContent 來尋找總共有幾個命名空間
714
		#函式說明:
714
		#函式說明:
715
		#檢查一個字串裡面是否有多個關鍵字
715
		#檢查一個字串裡面是否有多個關鍵字
Line 720... Line 720...
720
		#$result[$i]["founded"],第$i個字串搜尋,是否找到所有的關鍵字,"true"代表有找到關鍵字;"false"代表沒有找到關鍵字。
720
		#$result[$i]["founded"],第$i個字串搜尋,是否找到所有的關鍵字,"true"代表有找到關鍵字;"false"代表沒有找到關鍵字。
721
		#$result["foundedTrueKey"],["founded"]結果為"true"的元素key陣列。
721
		#$result["foundedTrueKey"],["founded"]結果為"true"的元素key陣列。
722
		#$result["foundedFalseKey"],["founded"]結果為"false"的元素key陣列。
722
		#$result["foundedFalseKey"],["founded"]結果為"false"的元素key陣列。
723
		#必填參數:
723
		#必填參數:
724
		$conf["search"]["findManyKeyWordsFromManyString"]["keyWords"]=array("namespace");#想要搜尋的關鍵字
724
		$conf["search"]["findManyKeyWordsFromManyString"]["keyWords"]=array("namespace");#想要搜尋的關鍵字
725
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列		
725
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
726
		#可省略的參數:
726
		#可省略的參數:
727
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
727
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
728
		$foundedNamespaceStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
728
		$foundedNamespaceStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
729
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
729
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
730
 
730
 
731
		#針對每個找到"namespace"的行編號
731
		#針對每個找到"namespace"的行編號
732
		foreach($foundedNamespaceStrArray["foundedTrueKey"] as $lineNo => $value){
732
		foreach($foundedNamespaceStrArray["foundedTrueKey"] as $lineNo => $value){
733
			
733
 
734
			#確認該行是否為命名空間的宣告行
734
			#確認該行是否為命名空間的宣告行
735
			#函式說明:
735
			#函式說明:
736
			#檢查一個字串裡面是否沒有多個任何篩選字存在
736
			#檢查一個字串裡面是否沒有多個任何篩選字存在
737
			#回傳的結果:
737
			#回傳的結果:
738
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
738
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
739
			#$result["error"],錯誤訊息陣列			
739
			#$result["error"],錯誤訊息陣列
740
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
740
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
741
			#必填參數:
741
			#必填參數:
742
			$conf["search"]["filterString"]["inputStr"]=$value;#要過濾的字串
742
			$conf["search"]["filterString"]["inputStr"]=$value;#要過濾的字串
743
			$conf["search"]["filterString"]["filterWord"]=array("#","=","}","unset(","foreach(","var_dump(");#要過濾的字串不能含有該陣列元素之一
743
			$conf["search"]["filterString"]["filterWord"]=array("#","=","}","unset(","foreach(","var_dump(");#要過濾的字串不能含有該陣列元素之一
744
			$searchResult=search::filterString($conf["search"]["filterString"]);
744
			$searchResult=search::filterString($conf["search"]["filterString"]);
745
			unset($conf["search"]["filterString"]);
745
			unset($conf["search"]["filterString"]);
746
			
746
 
747
			#如果 $searchResult["filtered"] 等於 "fasle"
747
			#如果 $searchResult["filtered"] 等於 "fasle"
748
			if($searchResult["filtered"]=="false"){
748
			if($searchResult["filtered"]=="false"){
749
				
749
 
750
				#代表是命名空間宣告的行
750
				#代表是命名空間宣告的行
751
				
751
 
752
				#取得命名空間宣告的行
752
				#取得命名空間宣告的行
753
				$namespaceStr=$value;
753
				$namespaceStr=$value;
754
				
754
 
755
				#函式說明:
755
				#函式說明:
756
				#處理字串避免網頁出錯
756
				#處理字串避免網頁出錯
757
				#回傳的結果:
757
				#回傳的結果:
758
				#回傳結果:
758
				#回傳結果:
759
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
759
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
760
				#$result["function"],當前執行的函數.
760
				#$result["function"],當前執行的函數.
761
				#$result["content"],爲處理好的字串.
761
				#$result["content"],爲處理好的字串.
762
				#$result["error"],錯誤訊息陣列.
762
				#$result["error"],錯誤訊息陣列.
763
				#$result["argu"],使用的參數. 
763
				#$result["argu"],使用的參數.
764
				#必填參數:
764
				#必填參數:
765
				$conf["stringProcess"]["correctCharacter"]["stringIn"]=$namespaceStr;#爲要處理的字串
765
				$conf["stringProcess"]["correctCharacter"]["stringIn"]=$namespaceStr;#爲要處理的字串
766
				#可省略的參數:
766
				#可省略的參數:
767
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","{","namespace","\n","\t",";");#爲被選擇要處理的字串/字元,須爲陣列值。
767
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","{","namespace","\n","\t",";");#爲被選擇要處理的字串/字元,須爲陣列值。
768
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
768
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
769
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
769
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
770
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
770
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
771
				unset($conf["stringProcess"]["correctCharacter"]);
771
				unset($conf["stringProcess"]["correctCharacter"]);
772
				
772
 
773
				#如果執行失敗
773
				#如果執行失敗
774
				if($correctCharacter["status"]==="false"){
774
				if($correctCharacter["status"]==="false"){
775
				
775
 
776
					#設置執行失敗的識別
776
					#設置執行失敗的識別
777
					$result["status"]="false";
777
					$result["status"]="false";
778
					
778
 
779
					#設置錯誤訊息
779
					#設置錯誤訊息
780
					$result["error"]=$correctCharacter["error"];
780
					$result["error"]=$correctCharacter["error"];
781
					
781
 
782
					return $result;
782
					return $result;
783
				
783
 
784
					}#if end
784
					}#if end
785
				
785
 
786
				#記錄取得的命名空間所在行數與名稱
786
				#記錄取得的命名空間所在行數與名稱
787
				$result["namespace"][]=array("lineNo"=>$lineNo,"content"=>$correctCharacter["content"]);
787
				$result["namespace"][]=array("lineNo"=>$lineNo,"content"=>$correctCharacter["content"]);
788
				
788
 
789
				# 從 namespace 往前讀取對應的註解
789
				# 從 namespace 往前讀取對應的註解
790
				for($i=$lineNo-1;$i>0;$i--){
790
				for($i=$lineNo-1;$i>0;$i--){
791
				
791
 
792
					#初始化 $temp
792
					#初始化 $temp
793
					$temp=$fileContent["fileContent"][$i];
793
					$temp=$fileContent["fileContent"][$i];
794
				
794
 
795
					#如果該行內容不為空
795
					#如果該行內容不為空
796
					if(!empty($fileContent["fileContent"][$i])){
796
					if(!empty($fileContent["fileContent"][$i])){
797
					
797
 
798
						#函式說明:
798
						#函式說明:
799
						#處理字串避免網頁出錯
799
						#處理字串避免網頁出錯
800
						#回傳的結果:
800
						#回傳的結果:
801
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
801
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
802
						#$result["function"],當前執行的函數.
802
						#$result["function"],當前執行的函數.
803
						#$result["content"],爲處理好的字串.
803
						#$result["content"],爲處理好的字串.
804
						#$result["error"],錯誤訊息陣列.
804
						#$result["error"],錯誤訊息陣列.
805
						#$result["argu"],使用的參數. 
805
						#$result["argu"],使用的參數.
806
						#必填參數:
806
						#必填參數:
807
						$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
807
						$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
808
						#可省略的參數:
808
						#可省略的參數:
809
						$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\n");#爲被選擇要處理的字串/字元,須爲陣列值。
809
						$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array("\n");#爲被選擇要處理的字串/字元,須爲陣列值。
810
							#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
810
							#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
811
						#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
811
						#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
812
						$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
812
						$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
813
						unset($conf["stringProcess"]["correctCharacter"]);
813
						unset($conf["stringProcess"]["correctCharacter"]);
814
						
814
 
815
						#如果處理失敗
815
						#如果處理失敗
816
						if($correctCharacter["status"]==="false"){
816
						if($correctCharacter["status"]==="false"){
817
 
817
 
818
							#設置執行錯誤的識別
818
							#設置執行錯誤的識別
819
							$result["status"]="false";
819
							$result["status"]="false";
820
 
820
 
821
							#設置執行錯誤的訊息
821
							#設置執行錯誤的訊息
822
							$result["error"]=$correctCharacter;
822
							$result["error"]=$correctCharacter;
823
							
823
 
824
							#回傳結果
824
							#回傳結果
825
							return $result;
825
							return $result;
826
						
826
 
827
							}#if end
827
							}#if end
828
						
828
 
829
						#取得處理好的內容列
829
						#取得處理好的內容列
830
						$temp=$correctCharacter["content"];
830
						$temp=$correctCharacter["content"];
831
					
831
 
832
						}#if end
832
						}#if end
833
				
833
 
834
					#如果 $temp 為 「/*」
834
					#如果 $temp 為 「/*」
835
					if($temp==="/*"){
835
					if($temp==="/*"){
836
									
836
 
837
						#跳出for迴圈
837
						#跳出for迴圈
838
						break;
838
						break;
839
					
839
 
840
						}#if end
840
						}#if end
841
						
841
 
842
					#如果 $temp 為 「*/」 
842
					#如果 $temp 為 「*/」
843
					if($temp==="*/"){
843
					if($temp==="*/"){
844
									
844
 
845
						#跳到下一輪
845
						#跳到下一輪
846
						continue;
846
						continue;
847
										
847
 
848
						}#if end
848
						}#if end
849
						
849
 
850
					#記錄namesapce的註解內容
850
					#記錄namesapce的註解內容
851
					$result["commentForNamespace"][count($result["namespace"])-1][]=$temp;
851
					$result["commentForNamespace"][count($result["namespace"])-1][]=$temp;
852
				
852
 
853
					}#for end
853
					}#for end
854
					
854
 
855
				#函式說明:
855
				#函式說明:
856
				#將陣列倒置
856
				#將陣列倒置
857
				#回傳的結果:
857
				#回傳的結果:
858
				#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
858
				#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
859
				#$result["error"],錯誤訊息陣列
859
				#$result["error"],錯誤訊息陣列
Line 862... Line 862...
862
				$conf["arrays"]["convertArray"]["inputArray"]=$result["commentForNamespace"][count($result["namespace"])-1];#要倒置的陣列
862
				$conf["arrays"]["convertArray"]["inputArray"]=$result["commentForNamespace"][count($result["namespace"])-1];#要倒置的陣列
863
				#參考資料來源:
863
				#參考資料來源:
864
				#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
864
				#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
865
				$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
865
				$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
866
				unset($conf["arrays"]["convertArray"]);
866
				unset($conf["arrays"]["convertArray"]);
867
					
867
 
868
				#如果轉置失敗
868
				#如果轉置失敗
869
				if($convertResult["status"]=="false"){
869
				if($convertResult["status"]=="false"){
870
					
870
 
871
					#設置執行失敗的識別
871
					#設置執行失敗的識別
872
					$result["status"]="false";
872
					$result["status"]="false";
873
					
873
 
874
					#設置執行失敗的提示
874
					#設置執行失敗的提示
875
					$result["error"]=$convertResult;
875
					$result["error"]=$convertResult;
876
					
876
 
877
					#回傳結果
877
					#回傳結果
878
					return $result;
878
					return $result;
879
					
879
 
880
					}#if end	
880
					}#if end
881
					
881
 
882
				#反之代表執行成功
882
				#反之代表執行成功
883
				else{
883
				else{
884
					
884
 
885
					#將倒置後的元素存起來
885
					#將倒置後的元素存起來
886
					$result["commentForNamespace"][count($result["namespace"])-1]=$convertResult["convertArray"];
886
					$result["commentForNamespace"][count($result["namespace"])-1]=$convertResult["convertArray"];
887
					
887
 
888
					}#else 	
888
					}#else
889
				
889
 
890
				}#if end
890
				}#if end
891
				
891
 
892
			}#foreach end
892
			}#foreach end
893
		
893
 
894
		#根據 $fileContent 來尋找總共有幾個類別
894
		#根據 $fileContent 來尋找總共有幾個類別
895
		#函式說明:
895
		#函式說明:
896
		#檢查一個字串裡面是否有多個關鍵字
896
		#檢查一個字串裡面是否有多個關鍵字
897
		#回傳的結果:
897
		#回傳的結果:
898
		#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
898
		#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
Line 906... Line 906...
906
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
906
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
907
		#可省略的參數:
907
		#可省略的參數:
908
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
908
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
909
		$foundedClassStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
909
		$foundedClassStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
910
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
910
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
911
		
911
 
912
		#debug
912
		#debug
913
		#var_dump($foundedClassStrArray["foundedTrueKey"]);
913
		#var_dump($foundedClassStrArray["foundedTrueKey"]);
914
		#exit;
914
		#exit;
915
		
915
 
916
		#針對每個找到"class"的行編號
916
		#針對每個找到"class"的行編號
917
		foreach($foundedClassStrArray["foundedTrueKey"] as $lineNo => $value){
917
		foreach($foundedClassStrArray["foundedTrueKey"] as $lineNo => $value){
918
			
918
 
919
			#確認該行是否真的為類別宣告行。
919
			#確認該行是否真的為類別宣告行。
920
			#函式說明:
920
			#函式說明:
921
			#檢查一個字串裡面是否沒有多個任何篩選字存在
921
			#檢查一個字串裡面是否沒有多個任何篩選字存在
922
			#回傳的結果:
922
			#回傳的結果:
923
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
923
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
924
			#$result["error"],錯誤訊息陣列			
924
			#$result["error"],錯誤訊息陣列
925
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
925
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
926
			#必填參數:
926
			#必填參數:
927
			$conf["search"]["filterString"]["inputStr"]=$value;#要過濾的字串
927
			$conf["search"]["filterString"]["inputStr"]=$value;#要過濾的字串
928
			$conf["search"]["filterString"]["filterWord"]=array("#","=","}","unset(","foreach(","var_dump(",";","(",")"," implements ");#要過濾的字串不能含有該陣列元素之一
928
			$conf["search"]["filterString"]["filterWord"]=array("#","=","}","unset(","foreach(","var_dump(",";","(",")"," implements ");#要過濾的字串不能含有該陣列元素之一
929
			$searchResult=search::filterString($conf["search"]["filterString"]);
929
			$searchResult=search::filterString($conf["search"]["filterString"]);
930
			unset($conf["search"]["filterString"]);
930
			unset($conf["search"]["filterString"]);
931
						
931
 
932
			#如果 $searchResult["filtered"] 等於 "fasle"
932
			#如果 $searchResult["filtered"] 等於 "fasle"
933
			if($searchResult["filtered"]=="false"){
933
			if($searchResult["filtered"]=="false"){
934
			
934
 
935
				#代表是類別宣告的行
935
				#代表是類別宣告的行
936
				
936
 
937
				#取得類別宣告的行
937
				#取得類別宣告的行
938
				$classStr=$value;
938
				$classStr=$value;
939
				
939
 
940
				#函式說明:
940
				#函式說明:
941
				#處理字串避免網頁出錯
941
				#處理字串避免網頁出錯
942
				#回傳的結果:
942
				#回傳的結果:
943
				#$result,爲處理好的字串。
943
				#$result,爲處理好的字串。
944
				#必填參數:
944
				#必填參數:
Line 947... Line 947...
947
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","{","class","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
947
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","{","class","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
948
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
948
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
949
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
949
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
950
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
950
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
951
				unset($conf["stringProcess"]["correctCharacter"]);
951
				unset($conf["stringProcess"]["correctCharacter"]);
952
				
952
 
953
				#如果執行失敗
953
				#如果執行失敗
954
				if($correctCharacter["status"]==="false"){
954
				if($correctCharacter["status"]==="false"){
955
				
955
 
956
					#設置執行失敗的識別
956
					#設置執行失敗的識別
957
					$result["status"]="false";
957
					$result["status"]="false";
958
					
958
 
959
					#設置錯誤訊息
959
					#設置錯誤訊息
960
					$result["error"]=$correctCharacter["error"];
960
					$result["error"]=$correctCharacter["error"];
961
					
961
 
962
					return $result;
962
					return $result;
963
				
963
 
964
					}#if end
964
					}#if end
965
				
965
 
966
				#針對每個命名空間
966
				#針對每個命名空間
967
				foreach($result["namespace"] as $nsArray){
967
				foreach($result["namespace"] as $nsArray){
968
				
968
 
969
					#如果該類別的行數是在該namespace之後
969
					#如果該類別的行數是在該namespace之後
970
					if($lineNo>$nsArray["lineNo"]){
970
					if($lineNo>$nsArray["lineNo"]){
971
					
971
 
972
						#設定該類別所屬的命名空間
972
						#設定該類別所屬的命名空間
973
						$namespace=$nsArray["content"];
973
						$namespace=$nsArray["content"];
974
					
974
 
975
						}#if end
975
						}#if end
976
						
976
 
977
					#反之
977
					#反之
978
					else{
978
					else{
979
					
979
 
980
						#跳出foreach
980
						#跳出foreach
981
						break;
981
						break;
982
					
982
 
983
						}#else end
983
						}#else end
984
				
984
 
985
					}#foreach end
985
					}#foreach end
986
				
986
 
987
				#記錄取得的類別所在行數與名稱
987
				#記錄取得的類別所在行數與名稱
988
				$result["class"][]=array("lineNo"=>$lineNo,"content"=>$correctCharacter["content"],"namespace"=>$namespace);
988
				$result["class"][]=array("lineNo"=>$lineNo,"content"=>$correctCharacter["content"],"namespace"=>$namespace);
989
								
989
 
990
				# 從 class 往前讀取對應的註解
990
				# 從 class 往前讀取對應的註解
991
				for($i=$lineNo-1;$i>0;$i--){
991
				for($i=$lineNo-1;$i>0;$i--){
992
				
992
 
993
					#初始化 $temp
993
					#初始化 $temp
994
					$temp=$fileContent["fileContent"][$i];
994
					$temp=$fileContent["fileContent"][$i];
995
				
995
 
996
					#如果該行內容不為空
996
					#如果該行內容不為空
997
					if(!empty($fileContent["fileContent"][$i])){
997
					if(!empty($fileContent["fileContent"][$i])){
998
					
998
 
999
						#函式說明:
999
						#函式說明:
1000
						#處理字串避免網頁出錯
1000
						#處理字串避免網頁出錯
1001
						#回傳的結果:
1001
						#回傳的結果:
1002
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1002
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1003
						#$result["function"],當前執行的函數.
1003
						#$result["function"],當前執行的函數.
1004
						#$result["content"],爲處理好的字串.
1004
						#$result["content"],爲處理好的字串.
1005
						#$result["error"],錯誤訊息陣列.
1005
						#$result["error"],錯誤訊息陣列.
1006
						#$result["argu"],使用的參數. 
1006
						#$result["argu"],使用的參數.
1007
						#必填參數:
1007
						#必填參數:
1008
						$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
1008
						$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
1009
						#可省略的參數:
1009
						#可省略的參數:
1010
						$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1010
						$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1011
							#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1011
							#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1012
						#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1012
						#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1013
						$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1013
						$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1014
						unset($conf["stringProcess"]["correctCharacter"]);
1014
						unset($conf["stringProcess"]["correctCharacter"]);
1015
						
1015
 
1016
						#如果處理失敗
1016
						#如果處理失敗
1017
						if($correctCharacter["status"]==="false"){
1017
						if($correctCharacter["status"]==="false"){
1018
 
1018
 
1019
							#設置執行錯誤的識別
1019
							#設置執行錯誤的識別
1020
							$result["status"]="false";
1020
							$result["status"]="false";
1021
 
1021
 
1022
							#設置執行錯誤的訊息
1022
							#設置執行錯誤的訊息
1023
							$result["error"]=$correctCharacter;
1023
							$result["error"]=$correctCharacter;
1024
							
1024
 
1025
							#回傳結果
1025
							#回傳結果
1026
							return $result;
1026
							return $result;
1027
						
1027
 
1028
							}#if end
1028
							}#if end
1029
						
1029
 
1030
						#取得處理好的內容列
1030
						#取得處理好的內容列
1031
						$temp=$correctCharacter["content"];
1031
						$temp=$correctCharacter["content"];
1032
					
1032
 
1033
						}#if end
1033
						}#if end
1034
 
1034
 
1035
					#如果 $temp 為 「/*」
1035
					#如果 $temp 為 「/*」
1036
					if($temp==="/*"){
1036
					if($temp==="/*"){
1037
									
1037
 
1038
						#跳出for迴圈
1038
						#跳出for迴圈
1039
						break;
1039
						break;
1040
					
1040
 
1041
						}#if end
1041
						}#if end
1042
						
1042
 
1043
					#如果 $temp 為 「*/」 
1043
					#如果 $temp 為 「*/」
1044
					if($temp==="*/"){
1044
					if($temp==="*/"){
1045
									
1045
 
1046
						#跳到下一輪
1046
						#跳到下一輪
1047
						continue;
1047
						continue;
1048
										
1048
 
1049
						}#if end
1049
						}#if end
1050
						
1050
 
1051
					#記錄namesapce的註解內容
1051
					#記錄namesapce的註解內容
1052
					$result["commentForClass"][count($result["class"])-1][]=$temp;
1052
					$result["commentForClass"][count($result["class"])-1][]=$temp;
1053
				
1053
 
1054
					}#for end
1054
					}#for end
1055
				
1055
 
1056
				#函式說明:
1056
				#函式說明:
1057
				#將陣列倒置
1057
				#將陣列倒置
1058
				#回傳的結果:
1058
				#回傳的結果:
1059
				#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
1059
				#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
1060
				#$result["error"],錯誤訊息陣列
1060
				#$result["error"],錯誤訊息陣列
Line 1063... Line 1063...
1063
				$conf["arrays"]["convertArray"]["inputArray"]=$result["commentForClass"][count($result["class"])-1];#要倒置的陣列
1063
				$conf["arrays"]["convertArray"]["inputArray"]=$result["commentForClass"][count($result["class"])-1];#要倒置的陣列
1064
				#參考資料來源:
1064
				#參考資料來源:
1065
				#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
1065
				#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
1066
				$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
1066
				$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
1067
				unset($conf["arrays"]["convertArray"]);
1067
				unset($conf["arrays"]["convertArray"]);
1068
					
1068
 
1069
				#如果轉置失敗
1069
				#如果轉置失敗
1070
				if($convertResult["status"]=="false"){
1070
				if($convertResult["status"]=="false"){
1071
					
1071
 
1072
					#設置執行失敗的識別
1072
					#設置執行失敗的識別
1073
					$result["status"]="false";
1073
					$result["status"]="false";
1074
					
1074
 
1075
					#設置執行失敗的提示
1075
					#設置執行失敗的提示
1076
					$result["error"]=$convertResult;
1076
					$result["error"]=$convertResult;
1077
					
1077
 
1078
					#回傳結果
1078
					#回傳結果
1079
					return $result;
1079
					return $result;
1080
					
1080
 
1081
					}#if end	
1081
					}#if end
1082
					
1082
 
1083
				#反之代表執行成功
1083
				#反之代表執行成功
1084
				else{
1084
				else{
1085
					
1085
 
1086
					#將倒置後的元素存起來
1086
					#將倒置後的元素存起來
1087
					$result["commentForClass"][count($result["class"])-1]=$convertResult["convertArray"];
1087
					$result["commentForClass"][count($result["class"])-1]=$convertResult["convertArray"];
1088
					
1088
 
1089
					}#else 	
1089
					}#else
1090
				
1090
 
1091
				}#if end
1091
				}#if end
1092
				
1092
 
1093
			}#foreach end
1093
			}#foreach end
1094
		
1094
 
1095
		#針對每個要處理的命名空間註解陣列
1095
		#針對每個要處理的命名空間註解陣列
1096
		foreach($result["commentForNamespace"] as $index => $cfn){
1096
		foreach($result["commentForNamespace"] as $index => $cfn){
1097
		
1097
 
1098
			#函式說明:
1098
			#函式說明:
1099
			#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
1099
			#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
1100
			#回傳的結果:
1100
			#回傳的結果:
1101
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1101
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1102
			#$result["function"],當前執行的function名稱
1102
			#$result["function"],當前執行的function名稱
Line 1115... Line 1115...
1115
			#無.
1115
			#無.
1116
			#備註:
1116
			#備註:
1117
			#無.
1117
			#無.
1118
			$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
1118
			$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
1119
			unset($conf["arrays::arrayToString"]);
1119
			unset($conf["arrays::arrayToString"]);
1120
			
1120
 
1121
			#如果執行失敗
1121
			#如果執行失敗
1122
			if($arrayToString["status"]==="false"){
1122
			if($arrayToString["status"]==="false"){
1123
				
1123
 
1124
				#設定執行錯誤識別
1124
				#設定執行錯誤識別
1125
				$result["status"]="false";
1125
				$result["status"]="false";
1126
				
1126
 
1127
				#設定執行錯誤提示
1127
				#設定執行錯誤提示
1128
				$result["error"]=$arrayToString;
1128
				$result["error"]=$arrayToString;
1129
				
1129
 
1130
				#回傳結果 
1130
				#回傳結果
1131
				return $result;
1131
				return $result;
1132
				
1132
 
1133
				}#if end
1133
				}#if end
1134
 
1134
 
1135
			#轉存為字串
1135
			#轉存為字串
1136
			$result["commentForNamespace"][$index]=$arrayToString["content"];
1136
			$result["commentForNamespace"][$index]=$arrayToString["content"];
1137
		
1137
 
1138
			}#foreach end
1138
			}#foreach end
1139
		
1139
 
1140
		#針對每個要處理的類別註解陣列
1140
		#針對每個要處理的類別註解陣列
1141
		foreach($result["commentForClass"] as $index => $cfc){
1141
		foreach($result["commentForClass"] as $index => $cfc){
1142
 
1142
 
1143
			#函式說明:
1143
			#函式說明:
1144
			#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
1144
			#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
Line 1163... Line 1163...
1163
			$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
1163
			$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
1164
			unset($conf["arrays::arrayToString"]);
1164
			unset($conf["arrays::arrayToString"]);
1165
 
1165
 
1166
			#如果執行失敗
1166
			#如果執行失敗
1167
			if($arrayToString["status"]==="false"){
1167
			if($arrayToString["status"]==="false"){
1168
				
1168
 
1169
				#設定執行錯誤識別
1169
				#設定執行錯誤識別
1170
				$result["status"]="false";
1170
				$result["status"]="false";
1171
				
1171
 
1172
				#設定執行錯誤提示
1172
				#設定執行錯誤提示
1173
				$result["error"]=$arrayToString;
1173
				$result["error"]=$arrayToString;
1174
				
1174
 
1175
				#回傳結果 
1175
				#回傳結果
1176
				return $result;
1176
				return $result;
1177
				
1177
 
1178
				}#if end
1178
				}#if end
1179
 
1179
 
1180
			#轉存為字串
1180
			#轉存為字串
1181
			$result["commentForClass"][$index]=$arrayToString["content"];	
1181
			$result["commentForClass"][$index]=$arrayToString["content"];
1182
		
1182
 
1183
			}#foreach end
1183
			}#foreach end
1184
 
1184
 
1185
		#根據 $fileContent 來尋找總共有幾個 function
1185
		#根據 $fileContent 來尋找總共有幾個 function
1186
		#函式說明:
1186
		#函式說明:
1187
		#檢查一個字串裡面是否有多個關鍵字
1187
		#檢查一個字串裡面是否有多個關鍵字
Line 1197... Line 1197...
1197
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
1197
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
1198
		#可省略的參數:
1198
		#可省略的參數:
1199
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1199
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1200
		$foundedFunctionStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
1200
		$foundedFunctionStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
1201
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
1201
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
1202
		
1202
 
1203
		#針對每個找到"function"的行編號
1203
		#針對每個找到"function"的行編號
1204
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $keyNo=>$keyContent){
1204
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $keyNo=>$keyContent){
1205
			
1205
 
1206
			#確認該行是否真的為函式宣告行。
1206
			#確認該行是否真的為函式宣告行。
1207
			#函式說明:
1207
			#函式說明:
1208
			#檢查一個字串裡面是否沒有多個任何篩選字存在
1208
			#檢查一個字串裡面是否沒有多個任何篩選字存在
1209
			#回傳的結果:
1209
			#回傳的結果:
1210
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
1210
			#$result["status"],執行是否成功的識別,"true"為執行成功;"false"為執行失敗
1211
			#$result["error"],錯誤訊息陣列			
1211
			#$result["error"],錯誤訊息陣列
1212
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
1212
			#$result["filtered"],該字串是否為要過濾掉的,"true"為要過濾掉的;"false"為不用過濾掉的
1213
			#必填參數:
1213
			#必填參數:
1214
			$conf["search"]["filterString"]["inputStr"]=$keyContent;#要過濾的字串
1214
			$conf["search"]["filterString"]["inputStr"]=$keyContent;#要過濾的字串
1215
			$conf["search"]["filterString"]["filterWord"]=array("__call","__callStatic","#","=","}","unset(","foreach(","var_dump(",";","(function","ckeditor.on","-",".","/","!",":",",","onResponseresponse(");#要過濾的字串不能含有該陣列元素之一
1215
			$conf["search"]["filterString"]["filterWord"]=array("__call","__callStatic","#","=","}","unset(","foreach(","var_dump(",";","(function","ckeditor.on","-",".","/","!",":",",","onResponseresponse(");#要過濾的字串不能含有該陣列元素之一
1216
			$searchResult=search::filterString($conf["search"]["filterString"]);
1216
			$searchResult=search::filterString($conf["search"]["filterString"]);
1217
			unset($conf["search"]["filterString"]);
1217
			unset($conf["search"]["filterString"]);
1218
						
1218
 
1219
			#如果 $searchResult["filtered"] 等於 "fasle"
1219
			#如果 $searchResult["filtered"] 等於 "fasle"
1220
			if($searchResult["filtered"]==="false"){
1220
			if($searchResult["filtered"]==="false"){
1221
				
1221
 
1222
				#代表是宣告函式的行
1222
				#代表是宣告函式的行
1223
				
1223
 
1224
				#取得類宣告函式的行
1224
				#取得類宣告函式的行
1225
				$functionStr=$keyContent;
1225
				$functionStr=$keyContent;
1226
				
1226
 
1227
				#函式說明:
1227
				#函式說明:
1228
				#處理字串避免網頁出錯
1228
				#處理字串避免網頁出錯
1229
				#回傳的結果:
1229
				#回傳的結果:
1230
				#$result,爲處理好的字串。
1230
				#$result,爲處理好的字串。
1231
				#必填參數:
1231
				#必填參數:
Line 1234... Line 1234...
1234
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(",&\$argu","public static"," ","{","function","\$conf","(",")","&","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1234
				$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(",&\$argu","public static"," ","{","function","\$conf","(",")","&","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1235
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1235
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1236
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1236
				#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1237
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1237
				$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1238
				unset($conf["stringProcess"]["correctCharacter"]);
1238
				unset($conf["stringProcess"]["correctCharacter"]);
1239
				
1239
 
1240
				#如果執行失敗
1240
				#如果執行失敗
1241
				if($correctCharacter["status"]==="false"){
1241
				if($correctCharacter["status"]==="false"){
1242
					
1242
 
1243
					#設定執行錯誤識別
1243
					#設定執行錯誤識別
1244
					$result["status"]="false";
1244
					$result["status"]="false";
1245
					
1245
 
1246
					#設定執行錯誤提示
1246
					#設定執行錯誤提示
1247
					$result["error"]=$correctCharacter;
1247
					$result["error"]=$correctCharacter;
1248
					
1248
 
1249
					#回傳結果 
1249
					#回傳結果
1250
					return $result;
1250
					return $result;
1251
					
1251
 
1252
					}#if end
1252
					}#if end
1253
				
1253
 
1254
				#針對每個命名空間
1254
				#針對每個命名空間
1255
				foreach($result["namespace"] as $ni){
1255
				foreach($result["namespace"] as $ni){
1256
				
1256
 
1257
					#如果所在行數則在該命名空間之後
1257
					#如果所在行數則在該命名空間之後
1258
					if($keyNo > $ni["lineNo"]){
1258
					if($keyNo > $ni["lineNo"]){
1259
					
1259
 
1260
						#設置該函式所屬的命名空間名稱
1260
						#設置該函式所屬的命名空間名稱
1261
						$namespaceOfFunc=$ni["content"];
1261
						$namespaceOfFunc=$ni["content"];
1262
					
1262
 
1263
						}#if end
1263
						}#if end
1264
					
1264
 
1265
					#反之
1265
					#反之
1266
					else{
1266
					else{
1267
					
1267
 
1268
						#結束 foreach end
1268
						#結束 foreach end
1269
						break;
1269
						break;
1270
					
1270
 
1271
						}#else end
1271
						}#else end
1272
				
1272
 
1273
					}#foreach end
1273
					}#foreach end
1274
				
1274
 
1275
				#針對每個類別名稱
1275
				#針對每個類別名稱
1276
				foreach($result["class"] as $ci){
1276
				foreach($result["class"] as $ci){
1277
				
1277
 
1278
					#如果所在行數則在該類別名稱之後
1278
					#如果所在行數則在該類別名稱之後
1279
					if($keyNo > $ci["lineNo"]){
1279
					if($keyNo > $ci["lineNo"]){
1280
					
1280
 
1281
						#設置該函式所屬的類別名稱
1281
						#設置該函式所屬的類別名稱
1282
						$classOfFunc=$ci["content"];
1282
						$classOfFunc=$ci["content"];
1283
					
1283
 
1284
						}#if end
1284
						}#if end
1285
					
1285
 
1286
					#反之
1286
					#反之
1287
					else{
1287
					else{
1288
					
1288
 
1289
						#結束 foreach end
1289
						#結束 foreach end
1290
						break;
1290
						break;
1291
					
1291
 
1292
						}#else end
1292
						}#else end
1293
				
1293
 
1294
					}#foreach end
1294
					}#foreach end
1295
				
1295
 
1296
				#儲存函式的資訊
1296
				#儲存函式的資訊
1297
				$result["functions"][]=array("content"=>$correctCharacter["content"],"namespace"=>$namespaceOfFunc,"class"=>$classOfFunc);
1297
				$result["functions"][]=array("content"=>$correctCharacter["content"],"namespace"=>$namespaceOfFunc,"class"=>$classOfFunc);
1298
				
1298
 
1299
				}#if end
1299
				}#if end
1300
				
1300
 
1301
			}#foreach end
1301
			}#foreach end
1302
			
1302
 
1303
		#取得命名空間的數量
1303
		#取得命名空間的數量
1304
		$result["namesapceCount"]=count($result["namespace"]);
1304
		$result["namesapceCount"]=count($result["namespace"]);
1305
		
1305
 
1306
		#如果 $result["class"] 不存在
1306
		#如果 $result["class"] 不存在
1307
		if(!isset($result["class"])){
1307
		if(!isset($result["class"])){
1308
		
1308
 
1309
			#設置為空陣列
1309
			#設置為空陣列
1310
			$result["class"]=array();
1310
			$result["class"]=array();
1311
		
1311
 
1312
			}#if end
1312
			}#if end
1313
		
1313
 
1314
		#取得類別的數量
1314
		#取得類別的數量
1315
		$result["classCount"]=count($result["class"]);
1315
		$result["classCount"]=count($result["class"]);
1316
 
1316
 
1317
		#如果 $result["class"] 不存在
1317
		#如果 $result["class"] 不存在
1318
		if(!isset($result["functions"])){
1318
		if(!isset($result["functions"])){
1319
		
1319
 
1320
			#設置為空陣列
1320
			#設置為空陣列
1321
			$result["functions"]=array();
1321
			$result["functions"]=array();
1322
		
1322
 
1323
			}#if end
1323
			}#if end
1324
 
1324
 
1325
		#取得函式的數量
1325
		#取得函式的數量
1326
		$result["functionCount"]=count($result["functions"]);
1326
		$result["functionCount"]=count($result["functions"]);
1327
 
1327
 
Line 1330... Line 1330...
1330
 
1330
 
1331
		#回傳節果
1331
		#回傳節果
1332
		return $result;
1332
		return $result;
1333
 
1333
 
1334
		}#function getPhpLibContent end
1334
		}#function getPhpLibContent end
1335
		
1335
 
1336
	/*
1336
	/*
1337
	#函式說明:
1337
	#函式說明:
1338
	#取得函式的結構
1338
	#取得函式的結構
1339
	#回傳結果:
1339
	#回傳結果:
1340
	#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
1340
	#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
Line 1345... Line 1345...
1345
	#$result["comment"],函式說明
1345
	#$result["comment"],函式說明
1346
	#$result["argvType"],傳入參數的型態,""表示不用參數
1346
	#$result["argvType"],傳入參數的型態,""表示不用參數
1347
	#$result["returnVarType"],回傳的變數型態,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
1347
	#$result["returnVarType"],回傳的變數型態,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
1348
	#$result["return"]["name"],回傳的變數名稱
1348
	#$result["return"]["name"],回傳的變數名稱
1349
	#$result["return"]["comment"],回傳的變數註解
1349
	#$result["return"]["comment"],回傳的變數註解
1350
	#$result["mustBeFilled"]["dataCount"],不可省略的參數陣列元素數量 
1350
	#$result["mustBeFilled"]["dataCount"],不可省略的參數陣列元素數量
1351
	#$result["optionalFilled"]["dataCount"],可省略的參數陣列元素數量
1351
	#$result["optionalFilled"]["dataCount"],可省略的參數陣列元素數量
1352
	#$result["mustBeFilled"]["name"],不可省略的參數陣列
1352
	#$result["mustBeFilled"]["name"],不可省略的參數陣列
1353
	#$result["mustBeFilled"]["comment"],不可省略的參數註解陣列
1353
	#$result["mustBeFilled"]["comment"],不可省略的參數註解陣列
1354
	#$result["optionalFilled"]["name"],可省略的參數陣列
1354
	#$result["optionalFilled"]["name"],可省略的參數陣列
1355
	#$result["optionalFilled"]["comment"],可省略的參數註解陣列
1355
	#$result["optionalFilled"]["comment"],可省略的參數註解陣列
Line 1369... Line 1369...
1369
	#無.
1369
	#無.
1370
	#備註:
1370
	#備註:
1371
	#無.
1371
	#無.
1372
	*/
1372
	*/
1373
	public static function getFunctionConstruction(&$conf){
1373
	public static function getFunctionConstruction(&$conf){
1374
		
1374
 
1375
		#初始化要回傳的內容
1375
		#初始化要回傳的內容
1376
		$result=array();
1376
		$result=array();
1377
 
1377
 
1378
		#取得當前函數的名稱
1378
		#取得當前函數的名稱
1379
		$result["function"]=__FUNCTION__;
1379
		$result["function"]=__FUNCTION__;
1380
 
1380
 
1381
		#如果 $conf 不為陣列
1381
		#如果 $conf 不為陣列
1382
		if(gettype($conf)!="array"){
1382
		if(gettype($conf)!="array"){
1383
			
1383
 
1384
			#設置執行失敗
1384
			#設置執行失敗
1385
			$result["status"]="false";
1385
			$result["status"]="false";
1386
			
1386
 
1387
			#設置執行錯誤訊息
1387
			#設置執行錯誤訊息
1388
			$result["error"][]="\$conf變數須為陣列形態";
1388
			$result["error"][]="\$conf變數須為陣列形態";
1389
 
1389
 
1390
			#如果傳入的參數為 null
1390
			#如果傳入的參數為 null
1391
			if($conf==null){
1391
			if($conf==null){
1392
				
1392
 
1393
				#設置執行錯誤訊息
1393
				#設置執行錯誤訊息
1394
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
1394
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
1395
				
1395
 
1396
				}#if end
1396
				}#if end
1397
 
1397
 
1398
			#回傳結果
1398
			#回傳結果
1399
			return $result;
1399
			return $result;
1400
			
1400
 
1401
			}#if end
1401
			}#if end
1402
		
1402
 
1403
		#函式說明:
1403
		#函式說明:
1404
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
1404
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
1405
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1405
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1406
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
1406
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
1407
		#$result["function"],當前執行的函式名稱.
1407
		#$result["function"],當前執行的函式名稱.
Line 1446... Line 1446...
1446
		#$conf["arrayCountEqualCheck"][]=array();
1446
		#$conf["arrayCountEqualCheck"][]=array();
1447
		#參考資料來源:
1447
		#參考資料來源:
1448
		#array_keys=>http://php.net/manual/en/function.array-keys.php
1448
		#array_keys=>http://php.net/manual/en/function.array-keys.php
1449
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
1449
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
1450
		unset($conf["variableCheck::checkArguments"]);
1450
		unset($conf["variableCheck::checkArguments"]);
1451
		
1451
 
1452
		# 如果檢查出錯
1452
		# 如果檢查出錯
1453
		if($checkArguments["status"]==="false"){
1453
		if($checkArguments["status"]==="false"){
1454
			
1454
 
1455
			#設置執行錯誤的識別
1455
			#設置執行錯誤的識別
1456
			$result["status"]="false";
1456
			$result["status"]="false";
1457
 
1457
 
1458
			#設置執行錯誤的訊息
1458
			#設置執行錯誤的訊息
1459
			$result["error"]=$checkArguments;
1459
			$result["error"]=$checkArguments;
1460
			
1460
 
1461
			#回傳結果
1461
			#回傳結果
1462
			return $result;
1462
			return $result;
1463
			
1463
 
1464
			}#if end
1464
			}#if end
1465
	
1465
 
1466
		# 如果檢查不通過
1466
		# 如果檢查不通過
1467
		if($checkArguments["passed"]==="false"){
1467
		if($checkArguments["passed"]==="false"){
1468
			
1468
 
1469
			#設置執行錯誤的識別
1469
			#設置執行錯誤的識別
1470
			$result["status"]="false";
1470
			$result["status"]="false";
1471
 
1471
 
1472
			#設置執行錯誤的訊息
1472
			#設置執行錯誤的訊息
1473
			$result["error"]=$checkArguments;
1473
			$result["error"]=$checkArguments;
1474
			
1474
 
1475
			#回傳結果
1475
			#回傳結果
1476
			return $result;
1476
			return $result;
1477
			
1477
 
1478
			}#if end
1478
			}#if end
1479
		
1479
 
1480
		#函數說明:
1480
		#函數說明:
1481
		#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
1481
		#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
1482
		#回傳結果:
1482
		#回傳結果:
1483
		#$result["status"],"true"爲建立成功,"false"爲建立失敗.
1483
		#$result["status"],"true"爲建立成功,"false"爲建立失敗.
1484
		#$result["error"],錯誤訊息陣列.
1484
		#$result["error"],錯誤訊息陣列.
1485
		#$result["function"],函數名稱. 
1485
		#$result["function"],函數名稱.
1486
		#$result["argu"],使用的參數.
1486
		#$result["argu"],使用的參數.
1487
		#$result["content"],網址,若是在命令列執行,則為"null".
1487
		#$result["content"],網址,若是在命令列執行,則為"null".
1488
		#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
1488
		#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
1489
		#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
1489
		#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
1490
		#必填參數:
1490
		#必填參數:
Line 1497... Line 1497...
1497
		$conf["fileAccess::getInternetAddressV2"]["web"]=$conf["web"];
1497
		$conf["fileAccess::getInternetAddressV2"]["web"]=$conf["web"];
1498
		#備註:
1498
		#備註:
1499
		#建構中,fileSystemRelativePosition尚未實作
1499
		#建構中,fileSystemRelativePosition尚未實作
1500
		$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
1500
		$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
1501
		unset($conf["fileAccess::getInternetAddressV2"]);
1501
		unset($conf["fileAccess::getInternetAddressV2"]);
1502
			
1502
 
1503
		#如果執行出錯
1503
		#如果執行出錯
1504
		if($getInternetAddressV2["status"]==="false"){
1504
		if($getInternetAddressV2["status"]==="false"){
1505
		
1505
 
1506
			#設置執行錯誤的識別
1506
			#設置執行錯誤的識別
1507
			$result["status"]="false";
1507
			$result["status"]="false";
1508
 
1508
 
1509
			#設置執行錯誤的訊息
1509
			#設置執行錯誤的訊息
1510
			$result["error"]=$getInternetAddressV2;
1510
			$result["error"]=$getInternetAddressV2;
1511
			
1511
 
1512
			#回傳結果
1512
			#回傳結果
1513
			return $result;
1513
			return $result;
1514
		
1514
 
1515
			}#if end	
1515
			}#if end
1516
			
1516
 
1517
		#取得檔案的絕對位置
1517
		#取得檔案的絕對位置
1518
		$conf["phpFileAddress"]=$getInternetAddressV2["fileSystemAbsoulutePosition"];
1518
		$conf["phpFileAddress"]=$getInternetAddressV2["fileSystemAbsoulutePosition"];
1519
			
1519
 
1520
		#取得php檔案的內容
1520
		#取得php檔案的內容
1521
		#函式說明:
1521
		#函式說明:
1522
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
1522
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
1523
		#回傳的變數說明:
1523
		#回傳的變數說明:
1524
		#$result["fileContent"],爲檔案的內容陣列
1524
		#$result["fileContent"],爲檔案的內容陣列
Line 1534... Line 1534...
1534
		$fileContent=fileAccess::getFileContent($conf["fileAccess"]["getFileContent"]);
1534
		$fileContent=fileAccess::getFileContent($conf["fileAccess"]["getFileContent"]);
1535
		unset($conf["fileAccess"]["getFileContent"]);
1535
		unset($conf["fileAccess"]["getFileContent"]);
1536
 
1536
 
1537
		#如果執行出錯
1537
		#如果執行出錯
1538
		if($fileContent["status"]==="false"){
1538
		if($fileContent["status"]==="false"){
1539
		
1539
 
1540
			#設置執行錯誤的識別
1540
			#設置執行錯誤的識別
1541
			$result["status"]="false";
1541
			$result["status"]="false";
1542
 
1542
 
1543
			#設置執行錯誤的訊息
1543
			#設置執行錯誤的訊息
1544
			$result["error"]=$fileContent;
1544
			$result["error"]=$fileContent;
1545
			
1545
 
1546
			#回傳結果
1546
			#回傳結果
1547
			return $result;
1547
			return $result;
1548
		
1548
 
1549
			}#if end
1549
			}#if end
1550
 
1550
 
1551
		#尋找函式定義的位置.
1551
		#尋找函式定義的位置.
1552
		#函式說明:
1552
		#函式說明:
1553
		#檢查一個字串裡面是否有多個關鍵字
1553
		#檢查一個字串裡面是否有多個關鍵字
Line 1563... Line 1563...
1563
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
1563
		$conf["search"]["findManyKeyWordsFromManyString"]["stringArray"]=$fileContent["fileContent"];#要被搜尋的字串內容陣列
1564
		#可省略的參數:
1564
		#可省略的參數:
1565
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1565
		#$conf["search"]["findManyKeyWordsFromManyString"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1566
		$foundedFunctionStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
1566
		$foundedFunctionStrArray=search::findManyKeyWordsFromManyString($conf["search"]["findManyKeyWordsFromManyString"]);
1567
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
1567
		unset($conf["search"]["findManyKeyWordsFromManyString"]);
1568
		
1568
 
1569
		#取得可能為函式宣告的陣列元素key
1569
		#取得可能為函式宣告的陣列元素key
1570
		$maybeAfunctionDefineLine=$foundedFunctionStrArray["foundedTrueKey"];		
1570
		$maybeAfunctionDefineLine=$foundedFunctionStrArray["foundedTrueKey"];
1571
		
1571
 
1572
		#有抓到錯誤的函式名稱,需要剔除
1572
		#有抓到錯誤的函式名稱,需要剔除
1573
		#針對每個抓到的function行
1573
		#針對每個抓到的function行
1574
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $maybeAfunctinKeyNo){
1574
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $maybeAfunctinKeyNo){
1575
			
1575
 
1576
			#如果該行內容含有「=」則代表為錯誤的函式行
1576
			#如果該行內容含有「=」則代表為錯誤的函式行
1577
			#函式說明:
1577
			#函式說明:
1578
			#檢查字串裡面有無指定的關鍵字
1578
			#檢查字串裡面有無指定的關鍵字
1579
			#回傳的結果:
1579
			#回傳的結果:
1580
			#$result["status"],"true"代表執行成功,"false"代表執行失敗。
1580
			#$result["status"],"true"代表執行成功,"false"代表執行失敗。
Line 1585... Line 1585...
1585
			$conf["search"]["findKeyWord"]["string"]=$maybeAfunctinKeyNo;#要被搜尋的字串內容
1585
			$conf["search"]["findKeyWord"]["string"]=$maybeAfunctinKeyNo;#要被搜尋的字串內容
1586
			#可省略的參數:
1586
			#可省略的參數:
1587
			#$conf["search"]["findKeyWord"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1587
			#$conf["search"]["findKeyWord"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1588
			$searchResult=search::findKeyWord($conf["search"]["findKeyWord"]);
1588
			$searchResult=search::findKeyWord($conf["search"]["findKeyWord"]);
1589
			unset($conf["search"]["findKeyWord"]);
1589
			unset($conf["search"]["findKeyWord"]);
1590
			
1590
 
1591
			#如果 $searchResult["founded"] 等於 "true" 則代表該行不是真的函式宣告
1591
			#如果 $searchResult["founded"] 等於 "true" 則代表該行不是真的函式宣告
1592
			if($searchResult["founded"]=="true"){
1592
			if($searchResult["founded"]=="true"){
1593
				
1593
 
1594
				#涵式說明:
1594
				#涵式說明:
1595
				#將陣列中特定元素剔除
1595
				#將陣列中特定元素剔除
1596
				#回傳的結果:
1596
				#回傳的結果:
1597
				#剔除掉特地元素的陣列
1597
				#剔除掉特地元素的陣列
1598
				#必填參數:
1598
				#必填參數:
1599
				$conf["arrays"]["eraseElement"]["rawInputArray"]=$maybeAfunctionDefineLine;#要處理的原始數字陣列
1599
				$conf["arrays"]["eraseElement"]["rawInputArray"]=$maybeAfunctionDefineLine;#要處理的原始數字陣列
1600
				$conf["arrays"]["eraseElement"]["eraseElementKey"]=$maybeAfunctinKeyNo;#要移除的元素key值  
1600
				$conf["arrays"]["eraseElement"]["eraseElementKey"]=$maybeAfunctinKeyNo;#要移除的元素key值
1601
				$maybeAfunctionDefineLine=arrays::eraseElement($conf["arrays"]["eraseElement"]);
1601
				$maybeAfunctionDefineLine=arrays::eraseElement($conf["arrays"]["eraseElement"]);
1602
				unset($conf["arrays"]["eraseElement"]);
1602
				unset($conf["arrays"]["eraseElement"]);
1603
				
1603
 
1604
				}#if end
1604
				}#if end
1605
								
1605
 
1606
			}#foreach end
1606
			}#foreach end
1607
								
1607
 
1608
		#更新可能為函式宣告的行key
1608
		#更新可能為函式宣告的行key
1609
		$foundedFunctionStrArray["foundedTrueKey"]=$maybeAfunctionDefineLine;
1609
		$foundedFunctionStrArray["foundedTrueKey"]=$maybeAfunctionDefineLine;
1610
		
1610
 
1611
		#針對每個找到"function"的行編號
1611
		#針對每個找到"function"的行編號
1612
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $index=>$keyNum){
1612
		foreach($foundedFunctionStrArray["foundedTrueKey"] as $index=>$keyNum){
1613
			
1613
 
1614
			#判斷該行是否為註解
1614
			#判斷該行是否為註解
1615
			#函式說明:
1615
			#函式說明:
1616
			#檢查一個字串裡面是否有多個關鍵字
1616
			#檢查一個字串裡面是否有多個關鍵字
1617
			#回傳的結果:
1617
			#回傳的結果:
1618
			#$result["status"],"true"代表執行成功,"false"代表執行失敗。
1618
			#$result["status"],"true"代表執行成功,"false"代表執行失敗。
Line 1622... Line 1622...
1622
			$conf["search"]["findManyKeyWords"]["keyWords"]=array("#");#想要搜尋的關鍵字
1622
			$conf["search"]["findManyKeyWords"]["keyWords"]=array("#");#想要搜尋的關鍵字
1623
			$conf["search"]["findManyKeyWords"]["string"]=$keyNum;#要被搜尋的字串內容
1623
			$conf["search"]["findManyKeyWords"]["string"]=$keyNum;#要被搜尋的字串內容
1624
			#可省略的參數:
1624
			#可省略的參數:
1625
			#$conf["search"]["findManyKeyWords"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1625
			#$conf["search"]["findManyKeyWords"]["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1626
			$searchResult=search::findManyKeyWords($conf["search"]["findManyKeyWords"]);
1626
			$searchResult=search::findManyKeyWords($conf["search"]["findManyKeyWords"]);
1627
			unset($conf["search"]["findManyKeyWords"]);	
1627
			unset($conf["search"]["findManyKeyWords"]);
1628
						
1628
 
1629
			#如果沒有「#」關鍵字
1629
			#如果沒有「#」關鍵字
1630
			if($searchResult["founded"]==="false"){
1630
			if($searchResult["founded"]==="false"){
1631
				
1631
 
1632
				#代表是宣告函式的行
1632
				#代表是宣告函式的行
1633
				
1633
 
1634
				#取得函式結構結束的key(檔案內容每行的key)
1634
				#取得函式結構結束的key(檔案內容每行的key)
1635
				$result["functionStructionEndPoint"]=$index;
1635
				$result["functionStructionEndPoint"]=$index;
1636
				
1636
 
1637
				}#if end
1637
				}#if end
1638
				
1638
 
1639
			}#foreach end
1639
			}#foreach end
1640
		
1640
 
1641
		#如果找不到函數宣告的行數
1641
		#如果找不到函數宣告的行數
1642
		if(!isset($result["functionStructionEndPoint"])){
1642
		if(!isset($result["functionStructionEndPoint"])){
1643
		
1643
 
1644
			#設置執行錯誤的識別
1644
			#設置執行錯誤的識別
1645
			$result["status"]="false";
1645
			$result["status"]="false";
1646
 
1646
 
1647
			#設置執行錯誤的訊息
1647
			#設置執行錯誤的訊息
1648
			$result["error"]=$foundedFunctionStrArray;
1648
			$result["error"]=$foundedFunctionStrArray;
1649
			
1649
 
1650
			#回傳結果
1650
			#回傳結果
1651
			return $result;
1651
			return $result;
1652
		
1652
 
1653
			}#if end
1653
			}#if end
1654
				
1654
 
1655
		#從 $result["functionStructionEndPoint"] 元素往前讀,直到讀到「/*」為止。
1655
		#從 $result["functionStructionEndPoint"] 元素往前讀,直到讀到「/*」為止。
1656
		for($i=$result["functionStructionEndPoint"]-1;$i>=0;$i--){
1656
		for($i=$result["functionStructionEndPoint"]-1;$i>=0;$i--){
1657
				
1657
 
1658
			#函式說明:
1658
			#函式說明:
1659
			#處理字串避免網頁出錯
1659
			#處理字串避免網頁出錯
1660
			#回傳的結果:
1660
			#回傳的結果:
1661
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1661
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1662
			#$result["function"],當前執行的函數.
1662
			#$result["function"],當前執行的函數.
1663
			#$result["content"],爲處理好的字串.
1663
			#$result["content"],爲處理好的字串.
1664
			#$result["error"],錯誤訊息陣列.
1664
			#$result["error"],錯誤訊息陣列.
1665
			#$result["argu"],使用的參數. 
1665
			#$result["argu"],使用的參數.
1666
			#必填參數:
1666
			#必填參數:
1667
			$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
1667
			$conf["stringProcess"]["correctCharacter"]["stringIn"]=$fileContent["fileContent"][$i];#爲要處理的字串
1668
			#可省略的參數:
1668
			#可省略的參數:
1669
			$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1669
			$conf["stringProcess"]["correctCharacter"]["selectedCharacter"]=array(" ","\n","\t");#爲被選擇要處理的字串/字元,須爲陣列值。
1670
				#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1670
				#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1671
			#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1671
			#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1672
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1672
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess"]["correctCharacter"]);
1673
			unset($conf["stringProcess"]["correctCharacter"]);
1673
			unset($conf["stringProcess"]["correctCharacter"]);
1674
			
1674
 
1675
			#如果處理失敗
1675
			#如果處理失敗
1676
			if($correctCharacter["status"]==="false"){
1676
			if($correctCharacter["status"]==="false"){
1677
 
1677
 
1678
				#設置執行錯誤的識別
1678
				#設置執行錯誤的識別
1679
				$result["status"]="false";
1679
				$result["status"]="false";
1680
 
1680
 
1681
				#設置執行錯誤的訊息
1681
				#設置執行錯誤的訊息
1682
				$result["error"]=$correctCharacter;
1682
				$result["error"]=$correctCharacter;
1683
				
1683
 
1684
				#回傳結果
1684
				#回傳結果
1685
				return $result;
1685
				return $result;
1686
			
1686
 
1687
				}#if end
1687
				}#if end
1688
			
1688
 
1689
			#取得處理號的內容列
1689
			#取得處理號的內容列
1690
			$temp=$correctCharacter["content"];
1690
			$temp=$correctCharacter["content"];
1691
 
1691
 
1692
			#如果 $temp 為 「/*」
1692
			#如果 $temp 為 「/*」
1693
			if($temp==="/*"){
1693
			if($temp==="/*"){
1694
							
1694
 
1695
				#跳出for迴圈
1695
				#跳出for迴圈
1696
				break;
1696
				break;
1697
			
1697
 
1698
				}#if end
1698
				}#if end
1699
				
1699
 
1700
			#如果 $temp 為 「*/」 
1700
			#如果 $temp 為 「*/」
1701
			if($temp==="*/"){
1701
			if($temp==="*/"){
1702
							
1702
 
1703
				#跳到下一輪
1703
				#跳到下一輪
1704
				continue;
1704
				continue;
1705
								
1705
 
1706
				}#if end
1706
				}#if end
1707
				
1707
 
1708
			#取得涵式宣告的內容
1708
			#取得涵式宣告的內容
1709
			$result["functionComment"][]=$fileContent["fileContent"][$i];	
1709
			$result["functionComment"][]=$fileContent["fileContent"][$i];
1710
			
1710
 
1711
			}#for end
1711
			}#for end
1712
			
1712
 
1713
		#函式說明:
1713
		#函式說明:
1714
		#將陣列倒置
1714
		#將陣列倒置
1715
		#回傳的結果:
1715
		#回傳的結果:
1716
		#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
1716
		#$result["status"],執行是否成功,"true"為執行成功;"false"為執行失敗
1717
		#$result["error"],錯誤訊息陣列
1717
		#$result["error"],錯誤訊息陣列
Line 1720... Line 1720...
1720
		$conf["arrays"]["convertArray"]["inputArray"]=$result["functionComment"];#要倒置的陣列
1720
		$conf["arrays"]["convertArray"]["inputArray"]=$result["functionComment"];#要倒置的陣列
1721
		#參考資料來源:
1721
		#參考資料來源:
1722
		#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
1722
		#http://tw2.php.net/array_reverse => 陣列倒置的內建函式
1723
		$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
1723
		$convertResult=arrays::convertArray($conf["arrays"]["convertArray"]);
1724
		unset($conf["arrays"]["convertArray"]);
1724
		unset($conf["arrays"]["convertArray"]);
1725
			
1725
 
1726
		#如果轉置失敗
1726
		#如果轉置失敗
1727
		if($convertResult["status"]=="false"){
1727
		if($convertResult["status"]=="false"){
1728
			
1728
 
1729
			#設置執行失敗的識別
1729
			#設置執行失敗的識別
1730
			$result["status"]="false";
1730
			$result["status"]="false";
1731
			
1731
 
1732
			#設置執行失敗的提示
1732
			#設置執行失敗的提示
1733
			$result["error"]=$convertResult;
1733
			$result["error"]=$convertResult;
1734
			
1734
 
1735
			#回傳結果
1735
			#回傳結果
1736
			return $result;
1736
			return $result;
1737
			
1737
 
1738
			}#if end	
1738
			}#if end
1739
			
1739
 
1740
		#反之代表執行成功
1740
		#反之代表執行成功
1741
		else{
1741
		else{
1742
			
1742
 
1743
			#將倒置後的元素存起來
1743
			#將倒置後的元素存起來
1744
			$result["functionComment"]=$convertResult["convertArray"];
1744
			$result["functionComment"]=$convertResult["convertArray"];
1745
			
1745
 
1746
			}#else 
1746
			}#else
1747
			
1747
 
1748
		#將多餘的字元剔除
1748
		#將多餘的字元剔除
1749
		#函式說明:
1749
		#函式說明:
1750
		#處理多個字串避免網頁出錯
1750
		#處理多個字串避免網頁出錯
1751
		#回傳的結果:
1751
		#回傳的結果:
1752
		#$result["status"],"true"代表執行成功,"false"代表執行失敗。
1752
		#$result["status"],"true"代表執行成功,"false"代表執行失敗。
Line 1759... Line 1759...
1759
			#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1759
			#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
1760
			#特殊字元,「\n」代表換行,「\t」代表tab鍵的間隔
1760
			#特殊字元,「\n」代表換行,「\t」代表tab鍵的間隔
1761
		#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1761
		#$conf["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
1762
		$strProcessedResult=stringProcess::correctMutiStrCharacter($conf["stringProcess"]["correctMutiStrCharacter"]);
1762
		$strProcessedResult=stringProcess::correctMutiStrCharacter($conf["stringProcess"]["correctMutiStrCharacter"]);
1763
		unset($conf["stringProcess"]["correctMutiStrCharacter"]);
1763
		unset($conf["stringProcess"]["correctMutiStrCharacter"]);
1764
			
1764
 
1765
		#如果 $strProcessedResult["status"]為"false"
1765
		#如果 $strProcessedResult["status"]為"false"
1766
		if($strProcessedResult["status"]=="false"){
1766
		if($strProcessedResult["status"]=="false"){
1767
			
1767
 
1768
			#設定執行錯誤識別
1768
			#設定執行錯誤識別
1769
			$result["status"]="false";
1769
			$result["status"]="false";
1770
			
1770
 
1771
			#設定執行錯誤提示
1771
			#設定執行錯誤提示
1772
			$result["error"]=$strProcessedResult;
1772
			$result["error"]=$strProcessedResult;
1773
			
1773
 
1774
			#回傳結果 
1774
			#回傳結果
1775
			return $result;
1775
			return $result;
1776
			
1776
 
1777
			}#if end
1777
			}#if end
1778
			
1778
 
1779
		#反之代表執行成功
1779
		#反之代表執行成功
1780
		else{
1780
		else{
1781
			
1781
 
1782
			$result["functionComment"]=$strProcessedResult["processedStrArray"];
1782
			$result["functionComment"]=$strProcessedResult["processedStrArray"];
1783
			
1783
 
1784
			}#else end
1784
			}#else end
1785
					
1785
 
1786
		#取得涵式宣告的那一行	
1786
		#取得涵式宣告的那一行
1787
		$functionDefineLine=$fileContent["fileContent"][$result["functionStructionEndPoint"]];	
1787
		$functionDefineLine=$fileContent["fileContent"][$result["functionStructionEndPoint"]];
1788
			
1788
 
1789
		#如果 $functionDefineLine 中有「()」則代表沒有要傳入的參數
1789
		#如果 $functionDefineLine 中有「()」則代表沒有要傳入的參數
1790
		#函式說明:
1790
		#函式說明:
1791
		#檢查字串裡面有無指定的關鍵字
1791
		#檢查字串裡面有無指定的關鍵字
1792
		#回傳的結果:
1792
		#回傳的結果:
1793
		#$result["status"],"true"代表執行成功,"false"代表執行失敗。
1793
		#$result["status"],"true"代表執行成功,"false"代表執行失敗。
Line 1798... Line 1798...
1798
		$conf["search"]["findKeyWord"]["string"]=$functionDefineLine;#要被搜尋的字串內容
1798
		$conf["search"]["findKeyWord"]["string"]=$functionDefineLine;#要被搜尋的字串內容
1799
		#可省略的參數:
1799
		#可省略的參數:
1800
		#$conf["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1800
		#$conf["completeEqual"]="true";#是否內容要完全符合,不能多出任何不符合的內容,預設為不需要完全符合。
1801
		$searchResult=search::findKeyWord($conf["search"]["findKeyWord"]);
1801
		$searchResult=search::findKeyWord($conf["search"]["findKeyWord"]);
1802
		unset($conf["search"]["findKeyWord"]);
1802
		unset($conf["search"]["findKeyWord"]);
1803
				
1803
 
1804
		#如果 $searchResult["founded"]為"true"
1804
		#如果 $searchResult["founded"]為"true"
1805
		if($searchResult["founded"]=="true"){
1805
		if($searchResult["founded"]=="true"){
1806
			
1806
 
1807
			#代表不須要傳入參數
1807
			#代表不須要傳入參數
1808
			$result["argvType"]="";
1808
			$result["argvType"]="";
1809
			
1809
 
1810
			}#if end
1810
			}#if end
1811
			
1811
 
1812
		#反之代表有傳入參數
1812
		#反之代表有傳入參數
1813
		else{
1813
		else{
1814
				
1814
 
1815
			#用「(」來分割
1815
			#用「(」來分割
1816
			#涵式說明:
1816
			#涵式說明:
1817
			#將固定格式的字串分開,並回傳分開的結果。
1817
			#將固定格式的字串分開,並回傳分開的結果。
1818
			#回傳的參數:
1818
			#回傳的參數:
1819
			#$result["oriStr"],要分割的原始字串內容
1819
			#$result["oriStr"],要分割的原始字串內容
Line 1822... Line 1822...
1822
			#必填參數:
1822
			#必填參數:
1823
			$conf["stringProcess"]["spiltString"]["stringIn"]=$functionDefineLine;#要處理的字串。
1823
			$conf["stringProcess"]["spiltString"]["stringIn"]=$functionDefineLine;#要處理的字串。
1824
			$conf["stringProcess"]["spiltString"]["spiltSymbol"]="(";#爲以哪個符號作爲分割
1824
			$conf["stringProcess"]["spiltString"]["spiltSymbol"]="(";#爲以哪個符號作爲分割
1825
			$spiltedStr=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
1825
			$spiltedStr=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
1826
			unset($conf["stringProcess"]["spiltString"]);
1826
			unset($conf["stringProcess"]["spiltString"]);
1827
				
1827
 
1828
			#如果執行失敗
1828
			#如果執行失敗
1829
			if($spiltedStr["status"]==="false"){
1829
			if($spiltedStr["status"]==="false"){
1830
				
1830
 
1831
				#設定執行錯誤識別
1831
				#設定執行錯誤識別
1832
				$result["status"]="false";
1832
				$result["status"]="false";
1833
				
1833
 
1834
				#設定執行錯誤提示
1834
				#設定執行錯誤提示
1835
				$result["error"]=$spiltedStr;
1835
				$result["error"]=$spiltedStr;
1836
				
1836
 
1837
				#回傳結果 
1837
				#回傳結果
1838
				return $result;
1838
				return $result;
1839
				
1839
 
1840
				}#if end	
1840
				}#if end
1841
				
1841
 
1842
			#如果切割出來小於2段
1842
			#如果切割出來小於2段
1843
			if($spiltedStr["dataCounts"]<2){
1843
			if($spiltedStr["dataCounts"]<2){
1844
				
1844
 
1845
				#設定執行錯誤識別
1845
				#設定執行錯誤識別
1846
				$result["status"]="false";
1846
				$result["status"]="false";
1847
				
1847
 
1848
				#設定執行錯誤提示
1848
				#設定執行錯誤提示
1849
				$result["error"][]=$spiltedStr;
1849
				$result["error"][]=$spiltedStr;
1850
				
1850
 
1851
				#設定執行錯誤提示
1851
				#設定執行錯誤提示
1852
				$result["error"][]="dataCounts 應該要大於等於 2";
1852
				$result["error"][]="dataCounts 應該要大於等於 2";
1853
				
1853
 
1854
				#回傳結果 
1854
				#回傳結果
1855
				return $result;
1855
				return $result;
1856
				
1856
 
1857
				}#if end
1857
				}#if end
1858
				
1858
 
1859
			#用「)」來分割
1859
			#用「)」來分割
1860
			#涵式說明:
1860
			#涵式說明:
1861
			#將固定格式的字串分開,並回傳分開的結果。
1861
			#將固定格式的字串分開,並回傳分開的結果。
1862
			#回傳的參數:
1862
			#回傳的參數:
1863
			#$result["oriStr"],要分割的原始字串內容
1863
			#$result["oriStr"],要分割的原始字串內容
Line 1865... Line 1865...
1865
			#$result["dataCounts"],爲總共分成幾段
1865
			#$result["dataCounts"],爲總共分成幾段
1866
			#必填參數:
1866
			#必填參數:
1867
			$conf["stringProcess"]["spiltString"]["stringIn"]=$spiltedStr["dataArray"][1];#要處理的字串。
1867
			$conf["stringProcess"]["spiltString"]["stringIn"]=$spiltedStr["dataArray"][1];#要處理的字串。
1868
			$conf["stringProcess"]["spiltString"]["spiltSymbol"]=")";#爲以哪個符號作爲分割
1868
			$conf["stringProcess"]["spiltString"]["spiltSymbol"]=")";#爲以哪個符號作爲分割
1869
			$spiltedStr=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
1869
			$spiltedStr=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
1870
			unset($conf["stringProcess"]["spiltString"]);				
1870
			unset($conf["stringProcess"]["spiltString"]);
1871
				
1871
 
1872
			#取得參數內容
1872
			#取得參數內容
1873
			$argvName=$spiltedStr["dataArray"][0];
1873
			$argvName=$spiltedStr["dataArray"][0];
1874
			
1874
 
1875
			#如果要傳入的參數為 "$conf"
1875
			#如果要傳入的參數為 "$conf"
1876
			if($argvName=="&\$conf"){
1876
			if($argvName=="&\$conf"){
1877
				
1877
 
1878
				#則為array型態
1878
				#則為array型態
1879
				$result["argvType"]="array";
1879
				$result["argvType"]="array";
1880
				
1880
 
1881
				}#if end
1881
				}#if end
1882
				
1882
 
1883
			#反之
1883
			#反之
1884
			else{
1884
			else{
1885
				
1885
 
1886
				#則未知型態
1886
				#則未知型態
1887
				$result["argvType"]="unknow";
1887
				$result["argvType"]="unknow";
1888
				
1888
 
1889
				}#else end
1889
				}#else end
1890
				
1890
 
1891
			}#else end
1891
			}#else end
1892
			
1892
 
1893
		#取得函式說明的元素key
1893
		#取得函式說明的元素key
1894
		#函式說明:
1894
		#函式說明:
1895
		#檢查一個數值是否與陣列裏面的元素相同
1895
		#檢查一個數值是否與陣列裏面的元素相同
1896
		#回傳的結果:
1896
		#回傳的結果:
1897
		#$result["status"],"true"表示執行正確,"false"表示執行錯誤.
1897
		#$result["status"],"true"表示執行正確,"false"表示執行錯誤.
Line 1904... Line 1904...
1904
		#必填參數:
1904
		#必填參數:
1905
		$conf["search"]["getEqualVar"]["conditionElement"]="#函式說明:";#條件元素,要等於的元素內容。
1905
		$conf["search"]["getEqualVar"]["conditionElement"]="#函式說明:";#條件元素,要等於的元素內容。
1906
		$conf["search"]["getEqualVar"]["compareElements"]=$result["functionComment"];#要比對的陣列變數內容。
1906
		$conf["search"]["getEqualVar"]["compareElements"]=$result["functionComment"];#要比對的陣列變數內容。
1907
		$searchResult=search::getEqualVar($conf["search"]["getEqualVar"]);
1907
		$searchResult=search::getEqualVar($conf["search"]["getEqualVar"]);
1908
		unset($conf["search"]["getEqualVar"]);
1908
		unset($conf["search"]["getEqualVar"]);
1909
		
1909
 
1910
		#debug
1910
		#debug
1911
		#var_dump($searchResult);
1911
		#var_dump($searchResult);
1912
		
1912
 
1913
		#如果執行失敗
1913
		#如果執行失敗
1914
		if($searchResult["status"]==="false"){
1914
		if($searchResult["status"]==="false"){
1915
			
1915
 
1916
			#設定執行錯誤識別
1916
			#設定執行錯誤識別
1917
			$result["status"]="false";
1917
			$result["status"]="false";
1918
			
1918
 
1919
			#設定執行錯誤提示
1919
			#設定執行錯誤提示
1920
			$result["error"]=$searchResult;
1920
			$result["error"]=$searchResult;
1921
			
1921
 
1922
			#回傳結果 
1922
			#回傳結果
1923
			return $result;
1923
			return $result;
1924
			
1924
 
1925
			}#if end
1925
			}#if end
1926
			
1926
 
1927
		#如果沒有找到
1927
		#如果沒有找到
1928
		if($searchResult["founded"]==="false"){
1928
		if($searchResult["founded"]==="false"){
1929
			
1929
 
1930
			#設定執行錯誤識別
1930
			#設定執行錯誤識別
1931
			$result["status"]="false";
1931
			$result["status"]="false";
1932
			
1932
 
1933
			#設定執行錯誤提示
1933
			#設定執行錯誤提示
1934
			$result["error"]=$searchResult;
1934
			$result["error"]=$searchResult;
1935
			
1935
 
1936
			#回傳結果 
1936
			#回傳結果
1937
			return $result;
1937
			return $result;
1938
			
1938
 
1939
			}#if end
1939
			}#if end
1940
		
1940
 
1941
		#函式說明起始點的key
1941
		#函式說明起始點的key
1942
		$functionCommentStartKey=$searchResult["equalVarName"];
1942
		$functionCommentStartKey=$searchResult["equalVarName"];
1943
		
1943
 
1944
		#取得涵式說明內容:
1944
		#取得涵式說明內容:
1945
		$result["comment"]=$result["functionComment"][$functionCommentStartKey+1];
1945
		$result["comment"]=$result["functionComment"][$functionCommentStartKey+1];
1946
		
1946
 
1947
		#卸除暫存變數
1947
		#卸除暫存變數
1948
		unset($functionCommentStartKey);
1948
		unset($functionCommentStartKey);
1949
		
1949
 
1950
		#取得回傳結果的陣列...
1950
		#取得回傳結果的陣列...
1951
		#依據開頭為 $result 來判斷...
1951
		#依據開頭為 $result 來判斷...
1952
		
1952
 
1953
		#涵式說明:
1953
		#涵式說明:
1954
		#取得多個字首一樣的字串,並回傳其字串。
1954
		#取得多個字首一樣的字串,並回傳其字串。
1955
		#回傳的結果:
1955
		#回傳的結果:
1956
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
1956
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
1957
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
1957
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
Line 1964... Line 1964...
1964
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#\$result";#用來檢查字首應該要有什麼字串
1964
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#\$result";#用來檢查字首應該要有什麼字串
1965
		#用到的涵式:
1965
		#用到的涵式:
1966
		#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
1966
		#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
1967
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
1967
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
1968
		unset($conf["search"]["getMeetConditionsStringMuti"]);
1968
		unset($conf["search"]["getMeetConditionsStringMuti"]);
1969
		
1969
 
1970
		#如果執行失敗
1970
		#如果執行失敗
1971
		if($returnVar["status"]==="false"){
1971
		if($returnVar["status"]==="false"){
1972
			
1972
 
1973
			#設定執行錯誤識別
1973
			#設定執行錯誤識別
1974
			$result["status"]="false";
1974
			$result["status"]="false";
1975
			
1975
 
1976
			#設定執行錯誤提示
1976
			#設定執行錯誤提示
1977
			$result["error"]=$returnVar;
1977
			$result["error"]=$returnVar;
1978
			
1978
 
1979
			#回傳結果 
1979
			#回傳結果
1980
			return $result;
1980
			return $result;
1981
			
1981
 
1982
			}#if end
1982
			}#if end
1983
			
1983
 
1984
		#如果有符合的關鍵字
1984
		#如果有符合的關鍵字
1985
		if($returnVar["founded"]==="true"){
1985
		if($returnVar["founded"]==="true"){
1986
		
1986
 
1987
			#用「,」區隔回傳變數名稱與註解
1987
			#用「,」區隔回傳變數名稱與註解
1988
			#涵式說明:
1988
			#涵式說明:
1989
			#將多個固定格式的字串分開,並回傳分開的結果
1989
			#將多個固定格式的字串分開,並回傳分開的結果
1990
			#回傳的參數:
1990
			#回傳的參數:
1991
			#$result[status],執行成功與否,若爲0,代表執行成功,若爲1代表執失敗。
1991
			#$result[status],執行成功與否,若爲0,代表執行成功,若爲1代表執失敗。
Line 1996... Line 1996...
1996
			#必填參數:
1996
			#必填參數:
1997
			$conf["stringProcess"]["spiltMutiString"]["stringIn"]=$returnVar["returnString"];#要處理的字串陣列。
1997
			$conf["stringProcess"]["spiltMutiString"]["stringIn"]=$returnVar["returnString"];#要處理的字串陣列。
1998
			$conf["stringProcess"]["spiltMutiString"]["spiltSymbol"]=",";#爲要以哪個符號作爲分割。
1998
			$conf["stringProcess"]["spiltMutiString"]["spiltSymbol"]=",";#爲要以哪個符號作爲分割。
1999
			$spiltedVarNameAndComment=stringProcess::spiltMutiString($conf["stringProcess"]["spiltMutiString"]);
1999
			$spiltedVarNameAndComment=stringProcess::spiltMutiString($conf["stringProcess"]["spiltMutiString"]);
2000
			unset($conf["stringProcess"]["spiltMutiString"]);
2000
			unset($conf["stringProcess"]["spiltMutiString"]);
2001
			
2001
 
2002
			#如果執行失敗
2002
			#如果執行失敗
2003
			if($spiltedVarNameAndComment["status"]==="false"){
2003
			if($spiltedVarNameAndComment["status"]==="false"){
2004
				
2004
 
2005
				#設定執行錯誤識別
2005
				#設定執行錯誤識別
2006
				$result["status"]="false";
2006
				$result["status"]="false";
2007
				
2007
 
2008
				#設定執行錯誤提示
2008
				#設定執行錯誤提示
2009
				$result["error"]=$spiltedVarNameAndComment;
2009
				$result["error"]=$spiltedVarNameAndComment;
2010
				
2010
 
2011
				#回傳結果 
2011
				#回傳結果
2012
				return $result;
2012
				return $result;
2013
				
2013
 
2014
				}
2014
				}
2015
			
2015
 
2016
			#針對每行分割的回傳變數名稱
2016
			#針對每行分割的回傳變數名稱
2017
			for($i=0;$i<count($spiltedVarNameAndComment["spiltString"]);$i++){
2017
			for($i=0;$i<count($spiltedVarNameAndComment["spiltString"]);$i++){
2018
			
2018
 
2019
				#將「#」符號剔除
2019
				#將「#」符號剔除
2020
				#涵式說明:
2020
				#涵式說明:
2021
				#處理多個字串避免網頁出錯
2021
				#處理多個字串避免網頁出錯
2022
				#回傳的結果:
2022
				#回傳的結果:
2023
				#$result["status"],"true"代表執行成功,"false"代表執行失敗。
2023
				#$result["status"],"true"代表執行成功,"false"代表執行失敗。
Line 2030... Line 2030...
2030
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
2030
					#若不設定則預設爲要將這些字串作替換("<",">",";","=","//","'","$","%","&","|","/*","*\/","#")。
2031
					#特殊字元,「\n」代表換行,「\t」代表tab鍵的間隔
2031
					#特殊字元,「\n」代表換行,「\t」代表tab鍵的間隔
2032
				#$conf["stringProcess"]["correctMutiStrCharacter"]["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
2032
				#$conf["stringProcess"]["correctMutiStrCharacter"]["changeTo"]=array();#爲被選擇的字元要換成什麼字串/字元,須爲陣列值。若不設定,則預設爲更換成""(空字串)。
2033
				$processedStr=stringProcess::correctMutiStrCharacter($conf["stringProcess"]["correctMutiStrCharacter"]);
2033
				$processedStr=stringProcess::correctMutiStrCharacter($conf["stringProcess"]["correctMutiStrCharacter"]);
2034
				unset($conf["stringProcess"]["correctMutiStrCharacter"]);
2034
				unset($conf["stringProcess"]["correctMutiStrCharacter"]);
2035
				
2035
 
2036
				#取得沒有 # 的內容
2036
				#取得沒有 # 的內容
2037
				$spiltedVarNameAndComment["spiltString"][$i]["dataArray"][0]=$processedStr["processedStrArray"][0];	
2037
				$spiltedVarNameAndComment["spiltString"][$i]["dataArray"][0]=$processedStr["processedStrArray"][0];
2038
				
2038
 
2039
				}#for end
2039
				}#for end
2040
				
2040
 
2041
			#將回傳變數名稱與註解紀錄起來
2041
			#將回傳變數名稱與註解紀錄起來
2042
			foreach($spiltedVarNameAndComment["spiltString"] as $returnVar){
2042
			foreach($spiltedVarNameAndComment["spiltString"] as $returnVar){
2043
				
2043
 
2044
				#取得回傳的變數名稱
2044
				#取得回傳的變數名稱
2045
				$result["return"]["name"][]=$returnVar["dataArray"][0];
2045
				$result["return"]["name"][]=$returnVar["dataArray"][0];
2046
				
2046
 
2047
				if(isset($returnVar["dataArray"][1])){
2047
				if(isset($returnVar["dataArray"][1])){
2048
				
2048
 
2049
					#取得回傳的變數註解
2049
					#取得回傳的變數註解
2050
					$result["return"]["comment"][]=$returnVar["dataArray"][1];
2050
					$result["return"]["comment"][]=$returnVar["dataArray"][1];
2051
					
2051
 
2052
					}#if end
2052
					}#if end
2053
				
2053
 
2054
				}#foreach end
2054
				}#foreach end
2055
				
2055
 
2056
			#依據回傳變數說明來判斷回傳的型態
2056
			#依據回傳變數說明來判斷回傳的型態
2057
						
2057
 
2058
			#如果回傳的變數名稱數量大於1
2058
			#如果回傳的變數名稱數量大於1
2059
			if(count($result["return"]["name"])>1){
2059
			if(count($result["return"]["name"])>1){
2060
				
2060
 
2061
				#則代表回傳的結果為array
2061
				#則代表回傳的結果為array
2062
				$result["returnVarType"]="array";
2062
				$result["returnVarType"]="array";
2063
				
2063
 
2064
				}#if end
2064
				}#if end
2065
			
2065
 
2066
			#反之其回傳的結果可能為string、int、float、double、boolean,目前先一律視為"string"
2066
			#反之其回傳的結果可能為string、int、float、double、boolean,目前先一律視為"string"
2067
			else{
2067
			else{
2068
				
2068
 
2069
				$result["returnVarType"]="string";
2069
				$result["returnVarType"]="string";
2070
				
2070
 
2071
				}#else end
2071
				}#else end
2072
				
2072
 
2073
			}#if end
2073
			}#if end
2074
				
2074
 
2075
		#取得必填參數陣列...
2075
		#取得必填參數陣列...
2076
		#依據開頭為 #必填參數 來判斷...
2076
		#依據開頭為 #必填參數 來判斷...
2077
 
2077
 
2078
		#涵式說明:
2078
		#涵式說明:
2079
		#取得多個字首一樣的字串,並回傳其字串。
2079
		#取得多個字首一樣的字串,並回傳其字串。
Line 2090... Line 2090...
2090
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#必填參數";
2090
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#必填參數";
2091
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2091
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2092
		#$conf["tailWord"]="";
2092
		#$conf["tailWord"]="";
2093
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2093
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2094
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2094
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2095
		
2095
 
2096
		#如果執行失敗
2096
		#如果執行失敗
2097
		if($returnVar["status"]==="false"){
2097
		if($returnVar["status"]==="false"){
2098
			
2098
 
2099
			#設定執行錯誤識別
2099
			#設定執行錯誤識別
2100
			$result["status"]="false";
2100
			$result["status"]="false";
2101
			
2101
 
2102
			#設定執行錯誤提示
2102
			#設定執行錯誤提示
2103
			$result["error"]=$returnVar;
2103
			$result["error"]=$returnVar;
2104
			
2104
 
2105
			#回傳結果 
2105
			#回傳結果
2106
			return $result;
2106
			return $result;
2107
			
2107
 
2108
			}#if end
2108
			}#if end
2109
 
2109
 
2110
		#如果有找到必填參數的列
2110
		#如果有找到必填參數的列
2111
		if($returnVar["founded"]==="false")
2111
		if($returnVar["founded"]==="false")
2112
		{
2112
		{
2113
			#設定執行錯誤識別
2113
			#設定執行錯誤識別
2114
			$result["status"]="false";
2114
			$result["status"]="false";
2115
			
2115
 
2116
			#設定執行錯誤提示
2116
			#設定執行錯誤提示
2117
			$result["error"]=$returnVar;
2117
			$result["error"]=$returnVar;
2118
			
2118
 
2119
			#回傳結果 
2119
			#回傳結果
2120
			return $result;
2120
			return $result;
2121
		}
2121
		}
2122
 
2122
 
2123
		#必填變數的開始行
2123
		#必填變數的開始行
2124
		$mustBeFilledVarKeyStartPoint=$returnVar["foundedKey"][0];
2124
		$mustBeFilledVarKeyStartPoint=$returnVar["foundedKey"][0];
2125
 
2125
 
2126
		/*
2126
		/*
2127
		#debug		
2127
		#debug
2128
		var_dump($mustBeFilledVarKeyStartPoint);
2128
		var_dump($mustBeFilledVarKeyStartPoint);
2129
		var_dump($result["functionComment"]);
2129
		var_dump($result["functionComment"]);
2130
		exit;
2130
		exit;
2131
		*/ 
2131
		*/
2132
 
2132
 
2133
		#取得可省略的參數陣列...
2133
		#取得可省略的參數陣列...
2134
		#依據開頭為 #可省略參數 來判斷...
2134
		#依據開頭為 #可省略參數 來判斷...
2135
		
2135
 
2136
		#涵式說明:
2136
		#涵式說明:
2137
		#取得多個字首一樣的字串,並回傳其字串。
2137
		#取得多個字首一樣的字串,並回傳其字串。
2138
		#回傳的結果:
2138
		#回傳的結果:
2139
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
2139
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
2140
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
2140
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
Line 2148... Line 2148...
2148
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#可省略參數";
2148
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#可省略參數";
2149
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2149
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2150
		#$conf["tailWord"]="";
2150
		#$conf["tailWord"]="";
2151
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2151
		$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2152
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2152
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2153
		
2153
 
2154
		#如果執行失敗
2154
		#如果執行失敗
2155
		if($returnVar["status"]==="false"){
2155
		if($returnVar["status"]==="false"){
2156
			
2156
 
2157
			#設定執行錯誤識別
2157
			#設定執行錯誤識別
2158
			$result["status"]="false";
2158
			$result["status"]="false";
2159
			
2159
 
2160
			#設定執行錯誤提示
2160
			#設定執行錯誤提示
2161
			$result["error"]=$returnVar;
2161
			$result["error"]=$returnVar;
2162
			
2162
 
2163
			#回傳結果 
2163
			#回傳結果
2164
			return $result;
2164
			return $result;
2165
			
2165
 
2166
			}#if end
2166
			}#if end
2167
 
2167
 
2168
		#如果有找到必填參數的列
2168
		#如果有找到必填參數的列
2169
		if($returnVar["founded"]==="false"){
2169
		if($returnVar["founded"]==="false"){
2170
 
2170
 
2171
			#設定執行錯誤識別
2171
			#設定執行錯誤識別
2172
			$result["status"]="false";
2172
			$result["status"]="false";
2173
			
2173
 
2174
			#設定執行錯誤提示
2174
			#設定執行錯誤提示
2175
			$result["error"]=$returnVar;
2175
			$result["error"]=$returnVar;
2176
			
2176
 
2177
			#回傳結果 
2177
			#回傳結果
2178
			return $result;
2178
			return $result;
2179
 
2179
 
2180
			}#if end
2180
			}#if end
2181
 
2181
 
2182
		#可省略參數的開始行
2182
		#可省略參數的開始行
2183
		$skipableVarKeyStartPoint=$returnVar["foundedKey"][0];	
2183
		$skipableVarKeyStartPoint=$returnVar["foundedKey"][0];
2184
 
2184
 
2185
		#取得參考資料來源
2185
		#取得參考資料來源
2186
		#依據開頭為 #參考資料: 來判斷...
2186
		#依據開頭為 #參考資料: 來判斷...
2187
 
2187
 
2188
		#涵式說明:
2188
		#涵式說明:
Line 2200... Line 2200...
2200
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#參考資料";
2200
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#參考資料";
2201
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2201
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2202
		#$conf["tailWord"]="";
2202
		#$conf["tailWord"]="";
2203
		$getMeetConditionsStringMulti=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2203
		$getMeetConditionsStringMulti=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2204
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2204
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2205
		
2205
 
2206
		#debug
2206
		#debug
2207
		#var_dump($getMeetConditionsStringMulti);
2207
		#var_dump($getMeetConditionsStringMulti);
2208
		#exit;
2208
		#exit;
2209
 
2209
 
2210
		#如果執行失敗
2210
		#如果執行失敗
2211
		if($getMeetConditionsStringMulti["status"]==="false"){
2211
		if($getMeetConditionsStringMulti["status"]==="false"){
2212
			
2212
 
2213
			#設定執行錯誤識別
2213
			#設定執行錯誤識別
2214
			$result["status"]="false";
2214
			$result["status"]="false";
2215
			
2215
 
2216
			#設定執行錯誤提示
2216
			#設定執行錯誤提示
2217
			$result["error"]=$getMeetConditionsStringMulti;
2217
			$result["error"]=$getMeetConditionsStringMulti;
2218
			
2218
 
2219
			#回傳結果 
2219
			#回傳結果
2220
			return $result;
2220
			return $result;
2221
			
2221
 
2222
			}#if end
2222
			}#if end
2223
 
2223
 
2224
		#如果沒有找到備註的列
2224
		#如果沒有找到備註的列
2225
		if($getMeetConditionsStringMulti["founded"]==="false"){
2225
		if($getMeetConditionsStringMulti["founded"]==="false"){
2226
 
2226
 
2227
			#設定執行錯誤識別
2227
			#設定執行錯誤識別
2228
			$result["status"]="false";
2228
			$result["status"]="false";
2229
			
2229
 
2230
			#設定執行錯誤提示
2230
			#設定執行錯誤提示
2231
			$result["error"]=$getMeetConditionsStringMulti;
2231
			$result["error"]=$getMeetConditionsStringMulti;
2232
			
2232
 
2233
			#回傳結果 
2233
			#回傳結果
2234
			return $result;
2234
			return $result;
2235
 
2235
 
2236
			}#if end
2236
			}#if end
2237
 
2237
 
2238
		#參考資料的開始行
2238
		#參考資料的開始行
2239
		$referenceVarKeyStartPoint=$getMeetConditionsStringMulti["foundedKey"][0];
2239
		$referenceVarKeyStartPoint=$getMeetConditionsStringMulti["foundedKey"][0];
2240
 
2240
 
2241
		#取得備註陣列
2241
		#取得備註陣列
2242
		#依據開頭為 #備註: 來判斷...
2242
		#依據開頭為 #備註: 來判斷...
2243
		
2243
 
2244
		#涵式說明:
2244
		#涵式說明:
2245
		#取得多個字首一樣的字串,並回傳其字串。
2245
		#取得多個字首一樣的字串,並回傳其字串。
2246
		#回傳的結果:
2246
		#回傳的結果:
2247
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
2247
		#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
2248
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
2248
		#$result["founded"],若為"true"則代表有找到符合字首條件的結果;若爲"false"則代表沒有找到。
Line 2256... Line 2256...
2256
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#備註";
2256
		$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#備註";
2257
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2257
		#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2258
		#$conf["tailWord"]="";
2258
		#$conf["tailWord"]="";
2259
		$getMeetConditionsStringMulti=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2259
		$getMeetConditionsStringMulti=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2260
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2260
		unset($conf["search"]["getMeetConditionsStringMuti"]);
2261
		
2261
 
2262
		#debug
2262
		#debug
2263
		#var_dump($getMeetConditionsStringMulti);
2263
		#var_dump($getMeetConditionsStringMulti);
2264
		#exit;
2264
		#exit;
2265
 
2265
 
2266
		#如果執行失敗
2266
		#如果執行失敗
2267
		if($getMeetConditionsStringMulti["status"]==="false"){
2267
		if($getMeetConditionsStringMulti["status"]==="false"){
2268
			
2268
 
2269
			#設定執行錯誤識別
2269
			#設定執行錯誤識別
2270
			$result["status"]="false";
2270
			$result["status"]="false";
2271
			
2271
 
2272
			#設定執行錯誤提示
2272
			#設定執行錯誤提示
2273
			$result["error"]=$getMeetConditionsStringMulti;
2273
			$result["error"]=$getMeetConditionsStringMulti;
2274
			
2274
 
2275
			#回傳結果 
2275
			#回傳結果
2276
			return $result;
2276
			return $result;
2277
			
2277
 
2278
			}#if end
2278
			}#if end
2279
 
2279
 
2280
		#如果沒有找到備註的列
2280
		#如果沒有找到備註的列
2281
		if($getMeetConditionsStringMulti["founded"]==="false"){
2281
		if($getMeetConditionsStringMulti["founded"]==="false"){
2282
 
2282
 
2283
			#設定執行錯誤識別
2283
			#設定執行錯誤識別
2284
			$result["status"]="false";
2284
			$result["status"]="false";
2285
			
2285
 
2286
			#設定執行錯誤提示
2286
			#設定執行錯誤提示
2287
			$result["error"]=$getMeetConditionsStringMulti;
2287
			$result["error"]=$getMeetConditionsStringMulti;
2288
			
2288
 
2289
			#回傳結果 
2289
			#回傳結果
2290
			return $result;
2290
			return $result;
2291
 
2291
 
2292
			}#if end
2292
			}#if end
2293
 
2293
 
2294
		#備註的開始行
2294
		#備註的開始行
2295
		$noteVarKeyStartPoint=$getMeetConditionsStringMulti["foundedKey"][0];
2295
		$noteVarKeyStartPoint=$getMeetConditionsStringMulti["foundedKey"][0];
2296
 
2296
 
2297
		#取得必填參數的內容
2297
		#取得必填參數的內容
2298
	
2298
 
2299
		#初始化必填參數的列
2299
		#初始化必填參數的列
2300
		$mustBeFilledVar=array();	
2300
		$mustBeFilledVar=array();
2301
 
2301
 
2302
		#從 $result["functionStructionEndPoint"] 元素往前讀,只讀取必填參數.
2302
		#從 $result["functionStructionEndPoint"] 元素往前讀,只讀取必填參數.
2303
		for($i=$mustBeFilledVarKeyStartPoint;$i<$skipableVarKeyStartPoint;$i++){
2303
		for($i=$mustBeFilledVarKeyStartPoint;$i<$skipableVarKeyStartPoint;$i++){
2304
 
2304
 
2305
			#針對每個必填參數行,檢查是否為"#"開頭
2305
			#針對每個必填參數行,檢查是否為"#"開頭
Line 2320... Line 2320...
2320
			$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#";
2320
			$conf["search"]["getMeetConditionsStringMuti"]["frontWord"]="#";
2321
			#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2321
			#$conf["tailWord"],字串,用來檢查字尾應該要有什麼字串,預設不指定.
2322
			#$conf["tailWord"]="";
2322
			#$conf["tailWord"]="";
2323
			$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2323
			$returnVar=search::getMeetConditionsStringMulti($conf["search"]["getMeetConditionsStringMuti"]);
2324
			unset($conf["search"]["getMeetConditionsStringMuti"]);
2324
			unset($conf["search"]["getMeetConditionsStringMuti"]);
2325
			
2325
 
2326
			#如果執行失敗
2326
			#如果執行失敗
2327
			if($returnVar["status"]==="false"){
2327
			if($returnVar["status"]==="false"){
2328
				
2328
 
2329
				#設定執行錯誤識別
2329
				#設定執行錯誤識別
2330
				$result["status"]="false";
2330
				$result["status"]="false";
2331
				
2331
 
2332
				#設定執行錯誤提示
2332
				#設定執行錯誤提示
2333
				$result["error"]=$returnVar;
2333
				$result["error"]=$returnVar;
2334
				
2334
 
2335
				#回傳結果 
2335
				#回傳結果
2336
				return $result;
2336
				return $result;
2337
				
2337
 
2338
				}#if end
2338
				}#if end
2339
 
2339
 
2340
			#如果沒有找到必填參數的列
2340
			#如果沒有找到必填參數的列
2341
			if($returnVar["founded"]==="false"){
2341
			if($returnVar["founded"]==="false"){
2342
 
2342
 
2343
				#跳到下一個迴圈
2343
				#跳到下一個迴圈
2344
				continue;
2344
				continue;
2345
	
2345
 
2346
				}#if end
2346
				}#if end
2347
 
2347
 
2348
			#取得必填參數名稱與解說的列
2348
			#取得必填參數名稱與解說的列
2349
			$mustBeFilledVar[]=$returnVar["returnString"][0];
2349
			$mustBeFilledVar[]=$returnVar["returnString"][0];
2350
		
2350
 
2351
			}#for end
2351
			}#for end
2352
 
2352
 
2353
		#針對每一列
2353
		#針對每一列
2354
		foreach($mustBeFilledVar as $key=>$line){
2354
		foreach($mustBeFilledVar as $key=>$line){
2355
 
2355
 
Line 2359... Line 2359...
2359
			#回傳的結果:
2359
			#回傳的結果:
2360
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2360
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2361
			#$result["function"],當前執行的函數.
2361
			#$result["function"],當前執行的函數.
2362
			#$result["content"],爲處理好的字串.
2362
			#$result["content"],爲處理好的字串.
2363
			#$result["error"],錯誤訊息陣列.
2363
			#$result["error"],錯誤訊息陣列.
2364
			#$result["argu"],使用的參數. 
2364
			#$result["argu"],使用的參數.
2365
			#必填參數:
2365
			#必填參數:
2366
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2366
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2367
			#可省略的參數:
2367
			#可省略的參數:
2368
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2368
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2369
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
2369
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
Line 2374... Line 2374...
2374
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2374
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2375
			unset($conf["stringProcess::correctCharacter"]);
2375
			unset($conf["stringProcess::correctCharacter"]);
2376
 
2376
 
2377
			#如果執行失敗
2377
			#如果執行失敗
2378
			if($correctCharacter["status"]==="false"){
2378
			if($correctCharacter["status"]==="false"){
2379
				
2379
 
2380
				#設定執行錯誤識別
2380
				#設定執行錯誤識別
2381
				$result["status"]="false";
2381
				$result["status"]="false";
2382
				
2382
 
2383
				#設定執行錯誤提示
2383
				#設定執行錯誤提示
2384
				$result["error"]=$correctCharacter;
2384
				$result["error"]=$correctCharacter;
2385
				
2385
 
2386
				#回傳結果 
2386
				#回傳結果
2387
				return $result;
2387
				return $result;
2388
				
2388
 
2389
				}#if end
2389
				}#if end
2390
 
2390
 
2391
	
2391
 
2392
			#取得剔除開頭 # 的內容列
2392
			#取得剔除開頭 # 的內容列
2393
			$mustBeFilledVar[$key]=$correctCharacter["content"];
2393
			$mustBeFilledVar[$key]=$correctCharacter["content"];
2394
 
2394
 
2395
			}#foreach end
2395
			}#foreach end
2396
 
2396
 
Line 2417... Line 2417...
2417
			$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
2417
			$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
2418
			unset($conf["stringProcess::spiltString"]);
2418
			unset($conf["stringProcess::spiltString"]);
2419
 
2419
 
2420
			#如果執行失敗
2420
			#如果執行失敗
2421
			if($spiltString["status"]==="false"){
2421
			if($spiltString["status"]==="false"){
2422
				
2422
 
2423
				#設定執行錯誤識別
2423
				#設定執行錯誤識別
2424
				$result["status"]="false";
2424
				$result["status"]="false";
2425
				
2425
 
2426
				#設定執行錯誤提示
2426
				#設定執行錯誤提示
2427
				$result["error"]=$spiltString;
2427
				$result["error"]=$spiltString;
2428
				
2428
 
2429
				#回傳結果 
2429
				#回傳結果
2430
				return $result;
2430
				return $result;
2431
				
2431
 
2432
				}#if end
2432
				}#if end
2433
 
2433
 
2434
			#如果執行失敗
2434
			#如果執行失敗
2435
			if($spiltString["found"]==="false"){
2435
			if($spiltString["found"]==="false"){
2436
				
2436
 
2437
				#移除之
2437
				#移除之
2438
				unset($mustBeFilledVar[$key]);
2438
				unset($mustBeFilledVar[$key]);
2439
 
2439
 
2440
				#換下一列
2440
				#換下一列
2441
				continue;
2441
				continue;
2442
				
2442
 
2443
				}#if end
2443
				}#if end
2444
 
2444
 
2445
			#取得名稱屬性跟備註
2445
			#取得名稱屬性跟備註
2446
			$mustBeFilledVar[$key]=array();
2446
			$mustBeFilledVar[$key]=array();
2447
			$mustBeFilledVar[$key]["name"]=$spiltString["dataArray"][0];
2447
			$mustBeFilledVar[$key]["name"]=$spiltString["dataArray"][0];
2448
			$mustBeFilledVar[$key]["type"]=$spiltString["dataArray"][1];
2448
			$mustBeFilledVar[$key]["type"]=$spiltString["dataArray"][1];
2449
			
2449
 
2450
			#如果沒有備註
2450
			#如果沒有備註
2451
			if(!isset($spiltString["dataArray"][2]))
2451
			if(!isset($spiltString["dataArray"][2]))
2452
			{
2452
			{
2453
				#設置為空字串
2453
				#設置為空字串
2454
				$spiltString["dataArray"][2]="";
2454
				$spiltString["dataArray"][2]="";
2455
			
2455
 
2456
			}#if end
2456
			}#if end
2457
			
2457
 
2458
			$mustBeFilledVar[$key]["note"]=$spiltString["dataArray"][2];
2458
			$mustBeFilledVar[$key]["note"]=$spiltString["dataArray"][2];
2459
			
2459
 
2460
			#debug
2460
			#debug
2461
			if(!isset($spiltString["dataArray"][2])){
2461
			if(!isset($spiltString["dataArray"][2])){
2462
			
2462
 
2463
				#初始化結果
2463
				#初始化結果
2464
				$result=array();
2464
				$result=array();
2465
				
2465
 
2466
				#設置執行錯誤
2466
				#設置執行錯誤
2467
				$result["status"]="false";
2467
				$result["status"]="false";
2468
				
2468
 
2469
				#設置錯誤訊息
2469
				#設置錯誤訊息
2470
				$result["error"]=$line;
2470
				$result["error"]=$line;
2471
				
2471
 
2472
				#設置錯誤訊息
2472
				#設置錯誤訊息
2473
				$result["error"][]="未按照「參數名稱,參數形態,參數說明」的格式撰寫";
2473
				$result["error"][]="未按照「參數名稱,參數形態,參數說明」的格式撰寫";
2474
			
2474
 
2475
				#回傳結果
2475
				#回傳結果
2476
				return $result;
2476
				return $result;
2477
			
2477
 
2478
				}#if end
2478
				}#if end
2479
 
2479
 
2480
			#針對後面的說明
2480
			#針對後面的說明
2481
			for($i=3;$i<$spiltString["dataCounts"];$i++){
2481
			for($i=3;$i<$spiltString["dataCounts"];$i++){
2482
 
2482
 
Line 2500... Line 2500...
2500
		$skipableVar=array();
2500
		$skipableVar=array();
2501
 
2501
 
2502
		/*
2502
		/*
2503
		#debug
2503
		#debug
2504
		var_dump($skipableVarKeyStartPoint);
2504
		var_dump($skipableVarKeyStartPoint);
2505
		var_dump($noteVarKeyStartPoint);		
2505
		var_dump($noteVarKeyStartPoint);
2506
		exit;
2506
		exit;
2507
		*/
2507
		*/
2508
 
2508
 
2509
		#從 $skipableVarKeyStartPoint 元素往後讀,只讀取可省略參數.
2509
		#從 $skipableVarKeyStartPoint 元素往後讀,只讀取可省略參數.
2510
		for($i=$skipableVarKeyStartPoint;$i<$referenceVarKeyStartPoint;$i++){
2510
		for($i=$skipableVarKeyStartPoint;$i<$referenceVarKeyStartPoint;$i++){
Line 2526... Line 2526...
2526
 
2526
 
2527
			#取得真的可省略變數與名稱
2527
			#取得真的可省略變數與名稱
2528
			$newSkipableVar[]=$skipableVar[$i];
2528
			$newSkipableVar[]=$skipableVar[$i];
2529
 
2529
 
2530
			}#for end
2530
			}#for end
2531
		
2531
 
2532
		#置換內容
2532
		#置換內容
2533
		$skipableVar=$newSkipableVar;
2533
		$skipableVar=$newSkipableVar;
2534
		
2534
 
2535
		/*
2535
		/*
2536
		#debug
2536
		#debug
2537
		var_dump($skipableVar);
2537
		var_dump($skipableVar);
2538
		exit;
2538
		exit;
2539
		*/
2539
		*/
2540
	
2540
 
2541
		#針對每一列
2541
		#針對每一列
2542
		foreach($skipableVar as $key=>$line){
2542
		foreach($skipableVar as $key=>$line){
2543
 
2543
 
2544
			#剔除開頭的 "#"
2544
			#剔除開頭的 "#"
2545
			#涵式說明:
2545
			#涵式說明:
Line 2547... Line 2547...
2547
			#回傳的結果:
2547
			#回傳的結果:
2548
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2548
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2549
			#$result["function"],當前執行的函數.
2549
			#$result["function"],當前執行的函數.
2550
			#$result["content"],爲處理好的字串.
2550
			#$result["content"],爲處理好的字串.
2551
			#$result["error"],錯誤訊息陣列.
2551
			#$result["error"],錯誤訊息陣列.
2552
			#$result["argu"],使用的參數. 
2552
			#$result["argu"],使用的參數.
2553
			#必填參數:
2553
			#必填參數:
2554
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2554
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2555
			#可省略的參數:
2555
			#可省略的參數:
2556
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2556
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2557
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
2557
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
Line 2562... Line 2562...
2562
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2562
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2563
			unset($conf["stringProcess::correctCharacter"]);
2563
			unset($conf["stringProcess::correctCharacter"]);
2564
 
2564
 
2565
			#如果執行失敗
2565
			#如果執行失敗
2566
			if($correctCharacter["status"]==="false"){
2566
			if($correctCharacter["status"]==="false"){
2567
				
2567
 
2568
				#設定執行錯誤識別
2568
				#設定執行錯誤識別
2569
				$result["status"]="false";
2569
				$result["status"]="false";
2570
				
2570
 
2571
				#設定執行錯誤提示
2571
				#設定執行錯誤提示
2572
				$result["error"]=$correctCharacter;
2572
				$result["error"]=$correctCharacter;
2573
				
2573
 
2574
				#回傳結果 
2574
				#回傳結果
2575
				return $result;
2575
				return $result;
2576
				
2576
 
2577
				}#if end
2577
				}#if end
2578
 
2578
 
2579
	
2579
 
2580
			#取得剔除開頭 # 的內容列
2580
			#取得剔除開頭 # 的內容列
2581
			$skipableVar[$key]=$correctCharacter["content"];
2581
			$skipableVar[$key]=$correctCharacter["content"];
2582
 
2582
 
2583
			}#foreach end	
2583
			}#foreach end
2584
 
2584
 
2585
		#debug
2585
		#debug
2586
		#var_dump($skipableVar);
2586
		#var_dump($skipableVar);
2587
		#exit;	
2587
		#exit;
2588
 
2588
 
2589
		#針對每一列
2589
		#針對每一列
2590
		foreach($skipableVar as $key=>$line){
2590
		foreach($skipableVar as $key=>$line){
2591
 
2591
 
2592
			#涵式說明:
2592
			#涵式說明:
Line 2609... Line 2609...
2609
			$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
2609
			$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
2610
			unset($conf["stringProcess::spiltString"]);
2610
			unset($conf["stringProcess::spiltString"]);
2611
 
2611
 
2612
			#如果執行失敗
2612
			#如果執行失敗
2613
			if($spiltString["status"]==="false"){
2613
			if($spiltString["status"]==="false"){
2614
				
2614
 
2615
				#設定執行錯誤識別
2615
				#設定執行錯誤識別
2616
				$result["status"]="false";
2616
				$result["status"]="false";
2617
				
2617
 
2618
				#設定執行錯誤提示
2618
				#設定執行錯誤提示
2619
				$result["error"]=$spiltString;
2619
				$result["error"]=$spiltString;
2620
				
2620
 
2621
				#回傳結果 
2621
				#回傳結果
2622
				return $result;
2622
				return $result;
2623
				
2623
 
2624
				}#if end
2624
				}#if end
2625
 
2625
 
2626
			#如果執行失敗
2626
			#如果執行失敗
2627
			if($spiltString["found"]==="false"){
2627
			if($spiltString["found"]==="false"){
2628
				
2628
 
2629
				#移除之
2629
				#移除之
2630
				unset($mustBeFilledVar[$key]);
2630
				unset($mustBeFilledVar[$key]);
2631
 
2631
 
2632
				#換下一列
2632
				#換下一列
2633
				continue;
2633
				continue;
2634
				
2634
 
2635
				}#if end
2635
				}#if end
2636
 
2636
 
2637
			#如果缺乏參數名稱位或屬性
2637
			#如果缺乏參數名稱位或屬性
2638
			if(!isset($spiltString["dataArray"][0]) || !isset($spiltString["dataArray"][1])){
2638
			if(!isset($spiltString["dataArray"][0]) || !isset($spiltString["dataArray"][1])){
2639
			
2639
 
2640
				#設定執行錯誤識別
2640
				#設定執行錯誤識別
2641
				$result["status"]="false";
2641
				$result["status"]="false";
2642
				
2642
 
2643
				#設定執行錯誤提示
2643
				#設定執行錯誤提示
2644
				$result["error"]=$spiltString;
2644
				$result["error"]=$spiltString;
2645
				
2645
 
2646
				#回傳結果 
2646
				#回傳結果
2647
				return $result;
2647
				return $result;
2648
			
2648
 
2649
				}#if end
2649
				}#if end
2650
 
2650
 
2651
			#取得名稱屬性跟備註
2651
			#取得名稱屬性跟備註
2652
			$skipableVar[$key]=array();
2652
			$skipableVar[$key]=array();
2653
			$skipableVar[$key]["name"]=$spiltString["dataArray"][0];
2653
			$skipableVar[$key]["name"]=$spiltString["dataArray"][0];
2654
			$skipableVar[$key]["type"]=$spiltString["dataArray"][1];
2654
			$skipableVar[$key]["type"]=$spiltString["dataArray"][1];
2655
			
2655
 
2656
			#如果沒有備註
2656
			#如果沒有備註
2657
			if(!isset($spiltString["dataArray"][2]))
2657
			if(!isset($spiltString["dataArray"][2]))
2658
			{
2658
			{
2659
				#設置為空字串.
2659
				#設置為空字串.
2660
				$spiltString["dataArray"][2]="";
2660
				$spiltString["dataArray"][2]="";
2661
			}
2661
			}
2662
			
2662
 
2663
			$skipableVar[$key]["note"]=$spiltString["dataArray"][2];
2663
			$skipableVar[$key]["note"]=$spiltString["dataArray"][2];
2664
 
2664
 
2665
			#針對後面的說明
2665
			#針對後面的說明
2666
			for($i=3;$i<$spiltString["dataCounts"];$i++){
2666
			for($i=3;$i<$spiltString["dataCounts"];$i++){
2667
 
2667
 
Line 2672... Line 2672...
2672
 
2672
 
2673
			}#foreach end
2673
			}#foreach end
2674
 
2674
 
2675
		#debug
2675
		#debug
2676
		#var_dump($skipableVar);
2676
		#var_dump($skipableVar);
2677
		#exit;	
2677
		#exit;
2678
 
2678
 
2679
		#取得可省略參數的內容
2679
		#取得可省略參數的內容
2680
		$result["skipableVar"]=$skipableVar;
2680
		$result["skipableVar"]=$skipableVar;
2681
		
2681
 
2682
		#初始化儲存參考資料的陣列
2682
		#初始化儲存參考資料的陣列
2683
		$reference=array();
2683
		$reference=array();
2684
 
2684
 
2685
		#從 $result["referenceVarKeyStartPoint"] 元素往後讀,只讀取備註.
2685
		#從 $result["referenceVarKeyStartPoint"] 元素往後讀,只讀取備註.
2686
		for($i=$referenceVarKeyStartPoint+1;$i<$noteVarKeyStartPoint;$i++){
2686
		for($i=$referenceVarKeyStartPoint+1;$i<$noteVarKeyStartPoint;$i++){
Line 2699... Line 2699...
2699
			#回傳的結果:
2699
			#回傳的結果:
2700
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2700
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2701
			#$result["function"],當前執行的函數.
2701
			#$result["function"],當前執行的函數.
2702
			#$result["content"],爲處理好的字串.
2702
			#$result["content"],爲處理好的字串.
2703
			#$result["error"],錯誤訊息陣列.
2703
			#$result["error"],錯誤訊息陣列.
2704
			#$result["argu"],使用的參數. 
2704
			#$result["argu"],使用的參數.
2705
			#必填參數:
2705
			#必填參數:
2706
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2706
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2707
			#可省略的參數:
2707
			#可省略的參數:
2708
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2708
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2709
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
2709
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
Line 2714... Line 2714...
2714
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2714
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2715
			unset($conf["stringProcess::correctCharacter"]);
2715
			unset($conf["stringProcess::correctCharacter"]);
2716
 
2716
 
2717
			#如果執行失敗
2717
			#如果執行失敗
2718
			if($correctCharacter["status"]==="false"){
2718
			if($correctCharacter["status"]==="false"){
2719
				
2719
 
2720
				#設定執行錯誤識別
2720
				#設定執行錯誤識別
2721
				$result["status"]="false";
2721
				$result["status"]="false";
2722
				
2722
 
2723
				#設定執行錯誤提示
2723
				#設定執行錯誤提示
2724
				$result["error"]=$correctCharacter;
2724
				$result["error"]=$correctCharacter;
2725
				
2725
 
2726
				#回傳結果 
2726
				#回傳結果
2727
				return $result;
2727
				return $result;
2728
				
2728
 
2729
				}#if end
2729
				}#if end
2730
 
2730
 
2731
	
2731
 
2732
			#取得剔除開頭 # 的內容列
2732
			#取得剔除開頭 # 的內容列
2733
			$reference[$key]=$correctCharacter["content"];
2733
			$reference[$key]=$correctCharacter["content"];
2734
 
2734
 
2735
			}#foreach end	
2735
			}#foreach end
2736
 
2736
 
2737
		#取得備註的內容
2737
		#取得備註的內容
2738
		$result["reference"]=$reference;
2738
		$result["reference"]=$reference;
2739
		
2739
 
2740
		#初始化儲存備註的陣列
2740
		#初始化儲存備註的陣列
2741
		$note=array();
2741
		$note=array();
2742
 
2742
 
2743
		#從 $result["noteVarKeyStartPoint"] 元素往後讀,只讀取備註.
2743
		#從 $result["noteVarKeyStartPoint"] 元素往後讀,只讀取備註.
2744
		for($i=$noteVarKeyStartPoint+1;$i<count($result["functionComment"])-1;$i++){
2744
		for($i=$noteVarKeyStartPoint+1;$i<count($result["functionComment"])-1;$i++){
Line 2769... Line 2769...
2769
		#無.
2769
		#無.
2770
		#備註:
2770
		#備註:
2771
		#無.
2771
		#無.
2772
		$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
2772
		$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
2773
		unset($conf["arrays::arrayToString"]);
2773
		unset($conf["arrays::arrayToString"]);
2774
		
2774
 
2775
		#如果執行失敗
2775
		#如果執行失敗
2776
		if($arrayToString["status"]==="false"){
2776
		if($arrayToString["status"]==="false"){
2777
			
2777
 
2778
			#設定執行錯誤識別
2778
			#設定執行錯誤識別
2779
			$result["status"]="false";
2779
			$result["status"]="false";
2780
			
2780
 
2781
			#設定執行錯誤提示
2781
			#設定執行錯誤提示
2782
			$result["error"]=$arrayToString;
2782
			$result["error"]=$arrayToString;
2783
			
2783
 
2784
			#回傳結果 
2784
			#回傳結果
2785
			return $result;
2785
			return $result;
2786
			
2786
 
2787
			}#if end
2787
			}#if end
2788
 
2788
 
2789
		#轉存為字串
2789
		#轉存為字串
2790
		$result["functionComment"]=$arrayToString["content"];
2790
		$result["functionComment"]=$arrayToString["content"];
2791
 
2791
 
Line 2798... Line 2798...
2798
			#回傳的結果:
2798
			#回傳的結果:
2799
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2799
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2800
			#$result["function"],當前執行的函數.
2800
			#$result["function"],當前執行的函數.
2801
			#$result["content"],爲處理好的字串.
2801
			#$result["content"],爲處理好的字串.
2802
			#$result["error"],錯誤訊息陣列.
2802
			#$result["error"],錯誤訊息陣列.
2803
			#$result["argu"],使用的參數. 
2803
			#$result["argu"],使用的參數.
2804
			#必填參數:
2804
			#必填參數:
2805
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2805
			$conf["stringProcess::correctCharacter"]["stringIn"]=$line;#爲要處理的字串
2806
			#可省略的參數:
2806
			#可省略的參數:
2807
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2807
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array("#");#爲被選擇要處理的字串/字元,須爲陣列值。
2808
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
2808
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
Line 2813... Line 2813...
2813
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2813
			$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
2814
			unset($conf["stringProcess::correctCharacter"]);
2814
			unset($conf["stringProcess::correctCharacter"]);
2815
 
2815
 
2816
			#如果執行失敗
2816
			#如果執行失敗
2817
			if($correctCharacter["status"]==="false"){
2817
			if($correctCharacter["status"]==="false"){
2818
				
2818
 
2819
				#設定執行錯誤識別
2819
				#設定執行錯誤識別
2820
				$result["status"]="false";
2820
				$result["status"]="false";
2821
				
2821
 
2822
				#設定執行錯誤提示
2822
				#設定執行錯誤提示
2823
				$result["error"]=$correctCharacter;
2823
				$result["error"]=$correctCharacter;
2824
				
2824
 
2825
				#回傳結果 
2825
				#回傳結果
2826
				return $result;
2826
				return $result;
2827
				
2827
 
2828
				}#if end
2828
				}#if end
2829
 
2829
 
2830
	
2830
 
2831
			#取得剔除開頭 # 的內容列
2831
			#取得剔除開頭 # 的內容列
2832
			$note[$key]=$correctCharacter["content"];
2832
			$note[$key]=$correctCharacter["content"];
2833
 
2833
 
2834
			}#foreach end	
2834
			}#foreach end
2835
 
2835
 
2836
		#取得備註的內容
2836
		#取得備註的內容
2837
		$result["note"]=$note;
2837
		$result["note"]=$note;
2838
 
2838
 
2839
		#初始化函式的程式內容.
2839
		#初始化函式的程式內容.
2840
		$result["content"]="";
2840
		$result["content"]="";
2841
		
2841
 
2842
		#針對函式的定義開始行,往後逐行執行.
2842
		#針對函式的定義開始行,往後逐行執行.
2843
		for($i=$result["functionStructionEndPoint"];$i<$fileContent["lineCount"];$i++){
2843
		for($i=$result["functionStructionEndPoint"];$i<$fileContent["lineCount"];$i++){
2844
		
2844
 
2845
			#暫存該行程式的內容
2845
			#暫存該行程式的內容
2846
			$line=$fileContent["fileContent"][$i];
2846
			$line=$fileContent["fileContent"][$i];
2847
		
2847
 
2848
			#如果無任何內容
2848
			#如果無任何內容
2849
			if(empty($line)){
2849
			if(empty($line)){
2850
			
2850
 
2851
				#串接程式的內容
2851
				#串接程式的內容
2852
				$result["content"]=$result["content"].$line;
2852
				$result["content"]=$result["content"].$line;
2853
				
2853
 
2854
				#換下一行
2854
				#換下一行
2855
				continue;
2855
				continue;
2856
			
2856
 
2857
				}#if end
2857
				}#if end
2858
		
2858
 
2859
			#判斷是否為函式定義的結束.
2859
			#判斷是否為函式定義的結束.
2860
			#函式說明:
2860
			#函式說明:
2861
			#取得符合特定字首與字尾的字串
2861
			#取得符合特定字首與字尾的字串
2862
			#回傳結果:
2862
			#回傳結果:
2863
			#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
2863
			#$result["status"],若爲"true"則代表執行正常;若爲"false"則代表執行失敗。
Line 2878... Line 2878...
2878
			#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
2878
			#str_spilt(),可以將字串依照字母分割成一個個陣列字串。
2879
			#備註:
2879
			#備註:
2880
			#無.
2880
			#無.
2881
			$getMeetConditionsString=search::getMeetConditionsString($conf["search::getMeetConditionsString"]);
2881
			$getMeetConditionsString=search::getMeetConditionsString($conf["search::getMeetConditionsString"]);
2882
			unset($conf["search::getMeetConditionsString"]);
2882
			unset($conf["search::getMeetConditionsString"]);
2883
		
2883
 
2884
			#如果處理失敗
2884
			#如果處理失敗
2885
			if($getMeetConditionsString["status"]==="false"){
2885
			if($getMeetConditionsString["status"]==="false"){
2886
 
2886
 
2887
				#設置執行錯誤的識別
2887
				#設置執行錯誤的識別
2888
				$result["status"]="false";
2888
				$result["status"]="false";
2889
 
2889
 
2890
				#設置執行錯誤的訊息
2890
				#設置執行錯誤的訊息
2891
				$result["error"]=$getMeetConditionsString;
2891
				$result["error"]=$getMeetConditionsString;
2892
				
2892
 
2893
				#回傳結果
2893
				#回傳結果
2894
				return $result;
2894
				return $result;
2895
			
2895
 
2896
				}#if end
2896
				}#if end
2897
			
2897
 
2898
			#串接程式的內容
2898
			#串接程式的內容
2899
			$result["content"]=$result["content"].$line;
2899
			$result["content"]=$result["content"].$line;
2900
			
2900
 
2901
			#如果找到函式的結尾
2901
			#如果找到函式的結尾
2902
			if($getMeetConditionsString["founded"]==="true"){
2902
			if($getMeetConditionsString["founded"]==="true"){
2903
 
2903
 
2904
				#跳出迴圈
2904
				#跳出迴圈
2905
				break;
2905
				break;
2906
			
2906
 
2907
				}#if end
2907
				}#if end
2908
		
2908
 
2909
			}#for end
2909
			}#for end
2910
		
2910
 
2911
		#值行到這邊執行成功
2911
		#值行到這邊執行成功
2912
		$result["status"]="true";
2912
		$result["status"]="true";
2913
 
2913
 
2914
		#回傳節果
2914
		#回傳節果
2915
		return $result;
2915
		return $result;
2916
			
2916
 
2917
		}#function getFunctionConstruction end
2917
		}#function getFunctionConstruction end
2918
	
2918
 
2919
	/*
2919
	/*
2920
	#函式說明:
2920
	#函式說明:
2921
	#取得多個函式的結構
2921
	#取得多個函式的結構
2922
	#回傳結果:
2922
	#回傳結果:
2923
	#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
2923
	#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
Line 2926... Line 2926...
2926
	#$result["comment"],每個函式說明的陣列
2926
	#$result["comment"],每個函式說明的陣列
2927
	#$result["argvType"],每個函式傳入參數型態的陣列,""表示不用參數
2927
	#$result["argvType"],每個函式傳入參數型態的陣列,""表示不用參數
2928
	#$result["returnVarType"],每個函式回傳變數型態的陣列,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
2928
	#$result["returnVarType"],每個函式回傳變數型態的陣列,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
2929
	#$result["return"]["name"][$i],第$i+1個函式回傳變數名稱的陣列
2929
	#$result["return"]["name"][$i],第$i+1個函式回傳變數名稱的陣列
2930
	#$result["return"]["comment"][$i],第$i+1個函式回傳變數註解的陣列
2930
	#$result["return"]["comment"][$i],第$i+1個函式回傳變數註解的陣列
2931
	#$result["mustBeFilled"]["dataCount"][$j],第j+1個函式不可省略參數數量的陣列 
2931
	#$result["mustBeFilled"]["dataCount"][$j],第j+1個函式不可省略參數數量的陣列
2932
	#$result["optionalFilled"]["dataCount"][$k],第$k+1每個函式可省略參數數量的陣列
2932
	#$result["optionalFilled"]["dataCount"][$k],第$k+1每個函式可省略參數數量的陣列
2933
	#$result["mustBeFilled"]["name"][$j],第$j+1個函式不可省略參數的陣列
2933
	#$result["mustBeFilled"]["name"][$j],第$j+1個函式不可省略參數的陣列
2934
	#$result["mustBeFilled"]["comment"][$j],第$j+1個函式不可省略參數註解的陣列
2934
	#$result["mustBeFilled"]["comment"][$j],第$j+1個函式不可省略參數註解的陣列
2935
	#$result["optionalFilled"]["name"][$k],第$k+1個函式可省略參數的陣列
2935
	#$result["optionalFilled"]["name"][$k],第$k+1個函式可省略參數的陣列
2936
	#$result["optionalFilled"]["comment"][$k],第$k+1個函式可省略參數註解的陣列
2936
	#$result["optionalFilled"]["comment"][$k],第$k+1個函式可省略參數註解的陣列
Line 2949... Line 2949...
2949
	#無.
2949
	#無.
2950
	#備註:
2950
	#備註:
2951
	#目前尚未開發完畢.
2951
	#目前尚未開發完畢.
2952
	*/
2952
	*/
2953
	public static function getMutiFunctionConstruction(&$conf){
2953
	public static function getMutiFunctionConstruction(&$conf){
2954
		
2954
 
2955
		#初始化要回傳的內容
2955
		#初始化要回傳的內容
2956
		$result=array();
2956
		$result=array();
2957
 
2957
 
2958
		#取得當前函數的名稱
2958
		#取得當前函數的名稱
2959
		$result["function"]=__FUNCTION__;
2959
		$result["function"]=__FUNCTION__;
2960
 
2960
 
2961
		#如果 $conf 不為陣列
2961
		#如果 $conf 不為陣列
2962
		if(gettype($conf)!="array"){
2962
		if(gettype($conf)!="array"){
2963
			
2963
 
2964
			#設置執行失敗
2964
			#設置執行失敗
2965
			$result["status"]="false";
2965
			$result["status"]="false";
2966
			
2966
 
2967
			#設置執行錯誤訊息
2967
			#設置執行錯誤訊息
2968
			$result["error"][]="\$conf變數須為陣列形態";
2968
			$result["error"][]="\$conf變數須為陣列形態";
2969
 
2969
 
2970
			#如果傳入的參數為 null
2970
			#如果傳入的參數為 null
2971
			if($conf==null){
2971
			if($conf==null){
2972
				
2972
 
2973
				#設置執行錯誤訊息
2973
				#設置執行錯誤訊息
2974
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
2974
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
2975
				
2975
 
2976
				}#if end
2976
				}#if end
2977
 
2977
 
2978
			#回傳結果
2978
			#回傳結果
2979
			return $result;
2979
			return $result;
2980
			
2980
 
2981
			}#if end
2981
			}#if end
2982
		
2982
 
2983
		#檢查參數
2983
		#檢查參數
2984
		#函式說明:
2984
		#函式說明:
2985
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
2985
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
2986
		#回傳結果:
2986
		#回傳結果:
2987
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
2987
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
Line 2989... Line 2989...
2989
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
2989
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
2990
		#必填寫的參數:
2990
		#必填寫的參數:
2991
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
2991
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
2992
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpFileAddress","functionName","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
2992
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpFileAddress","functionName","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
2993
		#可以省略的參數:
2993
		#可以省略的參數:
2994
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","array","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double"); 
2994
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","array","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double");
2995
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="true";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
2995
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="true";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
2996
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
2996
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
2997
		unset($conf["variableCheck"]["isexistMuti"]);
2997
		unset($conf["variableCheck"]["isexistMuti"]);
2998
	
2998
 
2999
		# 如果 $checkResult["status"] 為 "fasle"
2999
		# 如果 $checkResult["status"] 為 "fasle"
3000
		if($checkResult["status"]=="false"){
3000
		if($checkResult["status"]=="false"){
3001
			
3001
 
3002
			#設置執行錯誤的識別
3002
			#設置執行錯誤的識別
3003
			$result["status"]="false";
3003
			$result["status"]="false";
3004
 
3004
 
3005
			#設置執行錯誤的訊息
3005
			#設置執行錯誤的訊息
3006
			$result["error"]=$checkResult;
3006
			$result["error"]=$checkResult;
3007
			
3007
 
3008
			#回傳結果
3008
			#回傳結果
3009
			return $result;
3009
			return $result;
3010
			
3010
 
3011
			}#if end
3011
			}#if end
3012
	
3012
 
3013
		# 如果 $checkResult["passed"] 為 "fasle"
3013
		# 如果 $checkResult["passed"] 為 "fasle"
3014
		if($checkResult["passed"]=="false"){
3014
		if($checkResult["passed"]=="false"){
3015
			
3015
 
3016
			#設置執行錯誤的識別
3016
			#設置執行錯誤的識別
3017
			$result["status"]="false";
3017
			$result["status"]="false";
3018
 
3018
 
3019
			#設置執行錯誤的訊息
3019
			#設置執行錯誤的訊息
3020
			$result["error"]=$checkResult;
3020
			$result["error"]=$checkResult;
3021
			
3021
 
3022
			#回傳結果
3022
			#回傳結果
3023
			return $result;
3023
			return $result;
3024
			
3024
 
3025
			}#if end
3025
			}#if end
3026
			
3026
 
3027
		#針對每個要解析的函式
3027
		#針對每個要解析的函式
3028
		foreach($conf["functionName"] as $functionName){
3028
		foreach($conf["functionName"] as $functionName){
3029
					
3029
 
3030
			#debug
3030
			#debug
3031
			#var_dump($functionName);
3031
			#var_dump($functionName);
3032
			
3032
 
3033
			#如果涵式名稱是 "empty"
3033
			#如果涵式名稱是 "empty"
3034
			if($functionName==="empty"){
3034
			if($functionName==="empty"){
3035
			
3035
 
3036
				#跳過
3036
				#跳過
3037
				continue;
3037
				continue;
3038
			
3038
 
3039
				}#if end
3039
				}#if end
3040
					
3040
 
3041
			#函式說明:
3041
			#函式說明:
3042
			#取得函式的結構
3042
			#取得函式的結構
3043
			#回傳的結果:
3043
			#回傳的結果:
3044
			#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
3044
			#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
3045
			#$result["error"],錯誤訊息陣列
3045
			#$result["error"],錯誤訊息陣列
3046
			#$result["comment"],函式說明
3046
			#$result["comment"],函式說明
3047
			#$result["argvType"],傳入參數的型態,null表示不用參數
3047
			#$result["argvType"],傳入參數的型態,null表示不用參數
3048
			#$result["returnVarType"],回傳的變數型態,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
3048
			#$result["returnVarType"],回傳的變數型態,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
3049
			#$result["return"]["name"],回傳的變數名稱
3049
			#$result["return"]["name"],回傳的變數名稱
3050
			#$result["return"]["comment"],回傳的變數註解
3050
			#$result["return"]["comment"],回傳的變數註解
3051
			#$result["mustBeFilled"]["dataCount"],不可省略的參數陣列元素數量 
3051
			#$result["mustBeFilled"]["dataCount"],不可省略的參數陣列元素數量
3052
			#$result["optionalFilled"]["dataCount"],可省略的參數陣列元素數量
3052
			#$result["optionalFilled"]["dataCount"],可省略的參數陣列元素數量
3053
			#$result["mustBeFilled"]["name"],不可省略的參數陣列
3053
			#$result["mustBeFilled"]["name"],不可省略的參數陣列
3054
			#$result["mustBeFilled"]["comment"],不可省略的參數註解陣列
3054
			#$result["mustBeFilled"]["comment"],不可省略的參數註解陣列
3055
			#$result["optionalFilled"]["name"],可省略的參數陣列
3055
			#$result["optionalFilled"]["name"],可省略的參數陣列
3056
			#$result["optionalFilled"]["comment"],可省略的參數註解陣列
3056
			#$result["optionalFilled"]["comment"],可省略的參數註解陣列
Line 3062... Line 3062...
3062
			$conf["phpLib"]["getFunctionConstruction"]["fileArgu"]=$conf["fileArgu"];#函式的名稱
3062
			$conf["phpLib"]["getFunctionConstruction"]["fileArgu"]=$conf["fileArgu"];#函式的名稱
3063
			#備註:目前尚未開發完畢
3063
			#備註:目前尚未開發完畢
3064
			$functionConstruction=phpLib::getFunctionConstruction($conf["phpLib"]["getFunctionConstruction"]);
3064
			$functionConstruction=phpLib::getFunctionConstruction($conf["phpLib"]["getFunctionConstruction"]);
3065
			#var_dump($conf["phpLib"]["getFunctionConstruction"]);
3065
			#var_dump($conf["phpLib"]["getFunctionConstruction"]);
3066
			unset($conf["phpLib"]["getFunctionConstruction"]);
3066
			unset($conf["phpLib"]["getFunctionConstruction"]);
3067
			
3067
 
3068
			#如果執行失敗
3068
			#如果執行失敗
3069
			if($functionConstruction["status"]==="false"){
3069
			if($functionConstruction["status"]==="false"){
3070
			
3070
 
3071
				#設置執行錯誤的識別
3071
				#設置執行錯誤的識別
3072
				$result["status"]="false";
3072
				$result["status"]="false";
3073
 
3073
 
3074
				#設置執行錯誤的訊息
3074
				#設置執行錯誤的訊息
3075
				$result["error"]=$functionConstruction;
3075
				$result["error"]=$functionConstruction;
3076
				
3076
 
3077
				#回傳結果
3077
				#回傳結果
3078
				return $result;
3078
				return $result;
3079
			
3079
 
3080
				}#if end
3080
				}#if end
3081
			
3081
 
3082
			#debug
3082
			#debug
3083
			#var_dump($functionConstruction);
3083
			#var_dump($functionConstruction);
3084
			#exit;
3084
			#exit;
3085
			
3085
 
3086
			#取得函式說明
3086
			#取得函式說明
3087
			$result["comment"][]=$functionConstruction["comment"];
3087
			$result["comment"][]=$functionConstruction["comment"];
3088
			
3088
 
3089
			#取得函式傳入參數型態
3089
			#取得函式傳入參數型態
3090
			$result["argvType"][]=$functionConstruction["argvType"];
3090
			$result["argvType"][]=$functionConstruction["argvType"];
3091
			
3091
 
3092
			#取得函式回傳變數型態
3092
			#取得函式回傳變數型態
3093
			$result["returnVarType"][]=$functionConstruction["returnVarType"];
3093
			$result["returnVarType"][]=$functionConstruction["returnVarType"];
3094
		
3094
 
3095
			#取得函式回傳變數名稱陣列
3095
			#取得函式回傳變數名稱陣列
3096
			$result["return"]["name"][]=$functionConstruction["return"]["name"];
3096
			$result["return"]["name"][]=$functionConstruction["return"]["name"];
3097
			
3097
 
3098
			#取得函式回傳變數註解陣列
3098
			#取得函式回傳變數註解陣列
3099
			$result["return"]["comment"][]=$functionConstruction["return"]["comment"];
3099
			$result["return"]["comment"][]=$functionConstruction["return"]["comment"];
3100
			
3100
 
3101
			}#foreach end		
3101
			}#foreach end
3102
		
3102
 
3103
		#執行到這邊代表執行成功
3103
		#執行到這邊代表執行成功
3104
		
3104
 
3105
		#設置執行成功的識別
3105
		#設置執行成功的識別
3106
		$result["status"]="true";
3106
		$result["status"]="true";
3107
		
3107
 
3108
		#回傳結果
3108
		#回傳結果
3109
		return $result;
3109
		return $result;
3110
		
3110
 
3111
		}#function getMutiFunctionConstruction end
3111
		}#function getMutiFunctionConstruction end
3112
		
3112
 
3113
	/*
3113
	/*
3114
	#函式說明:
3114
	#函式說明:
3115
	#提供將含有類別宣告的php檔案轉成類別圖的功能
3115
	#提供將含有類別宣告的php檔案轉成類別圖的功能
3116
	#回傳結果:
3116
	#回傳結果:
3117
	#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
3117
	#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
Line 3130... Line 3130...
3130
	#無.
3130
	#無.
3131
	#備註:
3131
	#備註:
3132
	#無.
3132
	#無.
3133
	*/
3133
	*/
3134
	public static function classDiagramMaker(&$conf){
3134
	public static function classDiagramMaker(&$conf){
3135
		
3135
 
3136
		#初始化要回傳的內容
3136
		#初始化要回傳的內容
3137
		$result=array();
3137
		$result=array();
3138
 
3138
 
3139
		#取得當前函數的名稱
3139
		#取得當前函數的名稱
3140
		$result["function"]=__FUNCTION__;
3140
		$result["function"]=__FUNCTION__;
3141
 
3141
 
3142
		#如果 $conf 不為陣列
3142
		#如果 $conf 不為陣列
3143
		if(gettype($conf)!="array"){
3143
		if(gettype($conf)!="array"){
3144
			
3144
 
3145
			#設置執行失敗
3145
			#設置執行失敗
3146
			$result["status"]="false";
3146
			$result["status"]="false";
3147
			
3147
 
3148
			#設置執行錯誤訊息
3148
			#設置執行錯誤訊息
3149
			$result["error"][]="\$conf變數須為陣列形態";
3149
			$result["error"][]="\$conf變數須為陣列形態";
3150
 
3150
 
3151
			#如果傳入的參數為 null
3151
			#如果傳入的參數為 null
3152
			if($conf==null){
3152
			if($conf==null){
3153
				
3153
 
3154
				#設置執行錯誤訊息
3154
				#設置執行錯誤訊息
3155
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3155
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3156
				
3156
 
3157
				}#if end
3157
				}#if end
3158
 
3158
 
3159
			#回傳結果
3159
			#回傳結果
3160
			return $result;
3160
			return $result;
3161
			
3161
 
3162
			}#if end
3162
			}#if end
3163
		
3163
 
3164
		#初始化要暫存的函式結構陣列
3164
		#初始化要暫存的函式結構陣列
3165
		$functionConstruction=array();
3165
		$functionConstruction=array();
3166
		
3166
 
3167
		#參數檢查
3167
		#參數檢查
3168
		#檢查參數
3168
		#檢查參數
3169
		#函式說明:
3169
		#函式說明:
3170
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
3170
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
3171
		#回傳結果:
3171
		#回傳結果:
Line 3174... Line 3174...
3174
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
3174
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
3175
		#必填寫的參數:
3175
		#必填寫的參數:
3176
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
3176
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
3177
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpFileAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
3177
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpFileAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
3178
		#可以省略的參數:
3178
		#可以省略的參數:
3179
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double"); 
3179
		$conf["variableCheck"]["isexistMuti"]["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double");
3180
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
3180
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
3181
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
3181
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
3182
		unset($conf["variableCheck"]["isexistMuti"]);
3182
		unset($conf["variableCheck"]["isexistMuti"]);
3183
	
3183
 
3184
		#如果 $checkResult["status"] 為 "fasle"
3184
		#如果 $checkResult["status"] 為 "fasle"
3185
		if($checkResult["status"]==="false"){
3185
		if($checkResult["status"]==="false"){
3186
			
3186
 
3187
			#設置執行錯誤的識別
3187
			#設置執行錯誤的識別
3188
			$result["status"]="false";
3188
			$result["status"]="false";
3189
 
3189
 
3190
			#設置執行錯誤的訊息
3190
			#設置執行錯誤的訊息
3191
			$result["error"]=$checkResult;
3191
			$result["error"]=$checkResult;
3192
			
3192
 
3193
			#回傳結果
3193
			#回傳結果
3194
			return $result;
3194
			return $result;
3195
			
3195
 
3196
			}#if end
3196
			}#if end
3197
	
3197
 
3198
		#如果 $checkResult["passed"] 為 "fasle"
3198
		#如果 $checkResult["passed"] 為 "fasle"
3199
		if($checkResult["passed"]==="false"){
3199
		if($checkResult["passed"]==="false"){
3200
			
3200
 
3201
			#設置執行錯誤的識別
3201
			#設置執行錯誤的識別
3202
			$result["status"]="false";
3202
			$result["status"]="false";
3203
 
3203
 
3204
			#設置執行錯誤的訊息
3204
			#設置執行錯誤的訊息
3205
			$result["error"]=$checkResult;
3205
			$result["error"]=$checkResult;
3206
			
3206
 
3207
			#回傳結果
3207
			#回傳結果
3208
			return $result;
3208
			return $result;
3209
			
3209
 
3210
			}#if end
3210
			}#if end
3211
				
3211
 
3212
		#函數說明:
3212
		#函數說明:
3213
		#延長php的執行時間,每呼叫一次會初始化執行時間爲0,然後設定下次可以執行多久.
3213
		#延長php的執行時間,每呼叫一次會初始化執行時間爲0,然後設定下次可以執行多久.
3214
		#回傳結果:
3214
		#回傳結果:
3215
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
3215
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
3216
		#$result["error"],錯誤訊息陣列.
3216
		#$result["error"],錯誤訊息陣列.
Line 3220... Line 3220...
3220
		$conf["config::delayRunTimeExectionMax"]["sec"]=300;
3220
		$conf["config::delayRunTimeExectionMax"]["sec"]=300;
3221
		#參考資料:
3221
		#參考資料:
3222
		#http://php.net/manual/en/function.set-time-limit.php
3222
		#http://php.net/manual/en/function.set-time-limit.php
3223
		$delayRunTimeExectionMax=config::delayRunTimeExectionMax($conf["config::delayRunTimeExectionMax"]);
3223
		$delayRunTimeExectionMax=config::delayRunTimeExectionMax($conf["config::delayRunTimeExectionMax"]);
3224
		unset($conf["config::delayRunTimeExectionMax"]);
3224
		unset($conf["config::delayRunTimeExectionMax"]);
3225
		
3225
 
3226
		#如果執行失敗
3226
		#如果執行失敗
3227
		if($delayRunTimeExectionMax["status"]==="false"){
3227
		if($delayRunTimeExectionMax["status"]==="false"){
3228
		
3228
 
3229
			#設定類別圖繪製失敗
3229
			#設定類別圖繪製失敗
3230
			$result["status"]="false";			
3230
			$result["status"]="false";
3231
						
3231
 
3232
			#設定該檔案的類別圖繪製失敗提示
3232
			#設定該檔案的類別圖繪製失敗提示
3233
			$result["error"]=$delayRunTimeExectionMax;
3233
			$result["error"]=$delayRunTimeExectionMax;
3234
			
3234
 
3235
			#回傳結果
3235
			#回傳結果
3236
			return $result;
3236
			return $result;
3237
		
3237
 
3238
			}#if end		
3238
			}#if end
3239
					
3239
 
3240
		#函式說明:
3240
		#函式說明:
3241
		#取得php函式庫檔案裡面的結構
3241
		#取得php函式庫檔案裡面的結構
3242
		#回傳的結果:
3242
		#回傳的結果:
3243
		#$result["status"],0表示取得成功;1表示取得失敗
3243
		#$result["status"],0表示取得成功;1表示取得失敗
3244
		#$result["namesapceCount"],命名空間的筆數
3244
		#$result["namesapceCount"],命名空間的筆數
3245
		#$result["classCount"],類別的筆數
3245
		#$result["classCount"],類別的筆數
3246
		#$result["functionCount"],函式的筆數
3246
		#$result["functionCount"],函式的筆數
3247
		#$result["namespace"],命名空間陣列 
3247
		#$result["namespace"],命名空間陣列
3248
		#$result["class"],類別的陣列
3248
		#$result["class"],類別的陣列
3249
		#$result["function"],函式的陣列
3249
		#$result["function"],函式的陣列
3250
		#必填參數:
3250
		#必填參數:
3251
		$conf["phpLib"]["getPhpLibConstruction"]["libFileAddress"]=$conf["phpFileAddress"];#要讀取的函式庫檔案位置
3251
		$conf["phpLib"]["getPhpLibConstruction"]["libFileAddress"]=$conf["phpFileAddress"];#要讀取的函式庫檔案位置
3252
		$conf["phpLib"]["getPhpLibConstruction"]["fileArgu"]=$conf["fileArgu"];
3252
		$conf["phpLib"]["getPhpLibConstruction"]["fileArgu"]=$conf["fileArgu"];
3253
		$classConstruction=phpLib::getPhpLibConstruction($conf["phpLib"]["getPhpLibConstruction"]);
3253
		$classConstruction=phpLib::getPhpLibConstruction($conf["phpLib"]["getPhpLibConstruction"]);
3254
		unset($conf["phpLib"]["getPhpLibConstruction"]);
3254
		unset($conf["phpLib"]["getPhpLibConstruction"]);
3255
		
3255
 
3256
		#如果 $classConstruction["status"] 為 "fasle"
3256
		#如果 $classConstruction["status"] 為 "fasle"
3257
		if($classConstruction["status"]==="false"){
3257
		if($classConstruction["status"]==="false"){
3258
			
3258
 
3259
			#設置執行錯誤的識別
3259
			#設置執行錯誤的識別
3260
			$result["status"]="false";
3260
			$result["status"]="false";
3261
 
3261
 
3262
			#設置執行錯誤的訊息
3262
			#設置執行錯誤的訊息
3263
			$result["error"]=$classConstruction;
3263
			$result["error"]=$classConstruction;
3264
			
3264
 
3265
			#回傳結果
3265
			#回傳結果
3266
			return $result;
3266
			return $result;
3267
			
3267
 
3268
			}#if end			
3268
			}#if end
3269
		
3269
 
3270
		#如果裡面沒有函式
3270
		#如果裡面沒有函式
3271
		if($classConstruction["functionCount"]===0){
3271
		if($classConstruction["functionCount"]===0){
3272
		
3272
 
3273
			#設置只有一個叫做emtpy的函數
3273
			#設置只有一個叫做emtpy的函數
3274
			$classConstruction["functions"][]["content"]="empty";
3274
			$classConstruction["functions"][]["content"]="empty";
3275
		
3275
 
3276
			}#if end
3276
			}#if end
3277
			
3277
 
3278
		#初始化記錄所有函數名稱
3278
		#初始化記錄所有函數名稱
3279
		$funcs=array();
3279
		$funcs=array();
3280
			
3280
 
3281
		#針對每個既有的函數名稱
3281
		#針對每個既有的函數名稱
3282
		foreach($classConstruction["functions"] as $funcStr){
3282
		foreach($classConstruction["functions"] as $funcStr){
3283
		
3283
 
3284
			#記錄函數名稱
3284
			#記錄函數名稱
3285
			$funcs[]=$funcStr["content"];
3285
			$funcs[]=$funcStr["content"];
3286
		
3286
 
3287
			}#foreach end		
3287
			}#foreach end
3288
		
3288
 
3289
		#取得每個函式的結構
3289
		#取得每個函式的結構
3290
		#函式說明:
3290
		#函式說明:
3291
		#取得多個函式的結構
3291
		#取得多個函式的結構
3292
		#回傳的結果:
3292
		#回傳的結果:
3293
		#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
3293
		#$result["status"],執行是否成功"true"代表執行成功,"false"代表執行失敗
Line 3295... Line 3295...
3295
		#$result["comment"],每個函式說明的陣列
3295
		#$result["comment"],每個函式說明的陣列
3296
		#$result["argvType"],每個函式傳入參數型態的陣列,null表示不用參數
3296
		#$result["argvType"],每個函式傳入參數型態的陣列,null表示不用參數
3297
		#$result["returnVarType"],每個函式回傳變數型態的陣列,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
3297
		#$result["returnVarType"],每個函式回傳變數型態的陣列,目前尚無法判斷其型態為string、int、float、double、boolean的哪一個,所以先一律視為"string"
3298
		#$result["return"]["name"][$i],第$i+1個函式回傳變數名稱的陣列
3298
		#$result["return"]["name"][$i],第$i+1個函式回傳變數名稱的陣列
3299
		#$result["return"]["comment"][$i],第$i+1個函式回傳變數註解的陣列
3299
		#$result["return"]["comment"][$i],第$i+1個函式回傳變數註解的陣列
3300
		#$result["mustBeFilled"]["dataCount"][$j],第j+1個函式不可省略參數數量的陣列 
3300
		#$result["mustBeFilled"]["dataCount"][$j],第j+1個函式不可省略參數數量的陣列
3301
		#$result["optionalFilled"]["dataCount"][$k],第$k+1每個函式可省略參數數量的陣列
3301
		#$result["optionalFilled"]["dataCount"][$k],第$k+1每個函式可省略參數數量的陣列
3302
		#$result["mustBeFilled"]["name"][$j],第$j+1個函式不可省略參數的陣列
3302
		#$result["mustBeFilled"]["name"][$j],第$j+1個函式不可省略參數的陣列
3303
		#$result["mustBeFilled"]["comment"][$j],第$j+1個函式不可省略參數註解的陣列
3303
		#$result["mustBeFilled"]["comment"][$j],第$j+1個函式不可省略參數註解的陣列
3304
		#$result["optionalFilled"]["name"][$k],第$k+1個函式可省略參數的陣列
3304
		#$result["optionalFilled"]["name"][$k],第$k+1個函式可省略參數的陣列
3305
		#$result["optionalFilled"]["comment"][$k],第$k+1個函式可省略參數註解的陣列
3305
		#$result["optionalFilled"]["comment"][$k],第$k+1個函式可省略參數註解的陣列
Line 3309... Line 3309...
3309
		$conf["phpLib"]["getMutiFunctionConstruction"]["phpFileAddress"]=$conf["phpFileAddress"];#含有函式內容的php檔案位置與名稱
3309
		$conf["phpLib"]["getMutiFunctionConstruction"]["phpFileAddress"]=$conf["phpFileAddress"];#含有函式內容的php檔案位置與名稱
3310
		$conf["phpLib"]["getMutiFunctionConstruction"]["functionName"]=$funcs;#函式的名稱
3310
		$conf["phpLib"]["getMutiFunctionConstruction"]["functionName"]=$funcs;#函式的名稱
3311
		$conf["phpLib"]["getMutiFunctionConstruction"]["fileArgu"]=$conf["fileArgu"];
3311
		$conf["phpLib"]["getMutiFunctionConstruction"]["fileArgu"]=$conf["fileArgu"];
3312
		#備註:目前尚未開發完畢
3312
		#備註:目前尚未開發完畢
3313
		$functionConstruction=phpLib::getMutiFunctionConstruction($conf["phpLib"]["getMutiFunctionConstruction"]);
3313
		$functionConstruction=phpLib::getMutiFunctionConstruction($conf["phpLib"]["getMutiFunctionConstruction"]);
3314
		 
3314
 
3315
		#如果 $classConstruction["status"] 為 "fasle"
3315
		#如果 $classConstruction["status"] 為 "fasle"
3316
		if($functionConstruction["status"]==="false"){
3316
		if($functionConstruction["status"]==="false"){
3317
			
3317
 
3318
			#設置執行錯誤的識別
3318
			#設置執行錯誤的識別
3319
			$result["status"]="false";
3319
			$result["status"]="false";
3320
 
3320
 
3321
			#設置執行錯誤的訊息
3321
			#設置執行錯誤的訊息
3322
			$result["error"]=$functionConstruction;
3322
			$result["error"]=$functionConstruction;
3323
			
3323
 
3324
			#回傳結果
3324
			#回傳結果
3325
			return $result;
3325
			return $result;
3326
			
3326
 
3327
			}#if end		
3327
			}#if end
3328
		 
3328
 
3329
		#debug
3329
		#debug
3330
		#var_dump($functionConstruction); 
3330
		#var_dump($functionConstruction);
3331
		 
3331
 
3332
		#由於每個函式都沒有指定屬性,所以都為public的函式
3332
		#由於每個函式都沒有指定屬性,所以都為public的函式
3333
					
3333
 
3334
		#函式說明:
3334
		#函式說明:
3335
		#建立一個陣列,可以指派陣列的內容,然後回傳
3335
		#建立一個陣列,可以指派陣列的內容,然後回傳
3336
		#回傳的結果:
3336
		#回傳的結果:
3337
		#$result,爲陣列變數內容
3337
		#$result,爲陣列變數內容
3338
		#必填參數:
3338
		#必填參數:
Line 3340... Line 3340...
3340
		#可省略的參數:
3340
		#可省略的參數:
3341
		$conf["arrays"]["create"]["arrayCounts"]=count($classConstruction["functions"]);#爲陣列的元素有幾個,若沒設定,則數量爲$conf["arrayContent"]裏的元素數量
3341
		$conf["arrays"]["create"]["arrayCounts"]=count($classConstruction["functions"]);#爲陣列的元素有幾個,若沒設定,則數量爲$conf["arrayContent"]裏的元素數量
3342
		$conf["arrays"]["create"]["theSameAs"]="true";#若設爲"true",則所有元素內容都跟第一個元素內容相同
3342
		$conf["arrays"]["create"]["theSameAs"]="true";#若設爲"true",則所有元素內容都跟第一個元素內容相同
3343
		$functionTypeArray=arrays::create($conf["arrays"]["create"]);
3343
		$functionTypeArray=arrays::create($conf["arrays"]["create"]);
3344
		unset($conf["arrays"]["create"]);
3344
		unset($conf["arrays"]["create"]);
3345
		
3345
 
3346
		#var_dump($functionTypeArray);
3346
		#var_dump($functionTypeArray);
3347
		#var_dump($classConstruction["class"][0]);
3347
		#var_dump($classConstruction["class"][0]);
3348
		#exit;
3348
		#exit;
3349
		
3349
 
3350
		#如果不存在 $classConstruction["class"][0]
3350
		#如果不存在 $classConstruction["class"][0]
3351
		if(!isset($classConstruction["class"][0])){
3351
		if(!isset($classConstruction["class"][0])){
3352
		
3352
 
3353
			#設置為 "empty"
3353
			#設置為 "empty"
3354
			$classConstruction["class"][0]["content"]="empty";
3354
			$classConstruction["class"][0]["content"]="empty";
3355
		
3355
 
3356
			}#if end
3356
			}#if end
3357
			
3357
 
3358
		#如果不存在 $functionConstruction["argvType"]
3358
		#如果不存在 $functionConstruction["argvType"]
3359
		if(!isset($functionConstruction["argvType"])){
3359
		if(!isset($functionConstruction["argvType"])){
3360
		
3360
 
3361
			#設置為 "array"
3361
			#設置為 "array"
3362
			$functionConstruction["argvType"][0]="array";
3362
			$functionConstruction["argvType"][0]="array";
3363
		
3363
 
3364
			}#if end
3364
			}#if end
3365
 
3365
 
3366
		#如果不存在 $functionConstruction["returnVarType"]
3366
		#如果不存在 $functionConstruction["returnVarType"]
3367
		if(!isset($functionConstruction["returnVarType"])){
3367
		if(!isset($functionConstruction["returnVarType"])){
3368
		
3368
 
3369
			#設置為 "array"
3369
			#設置為 "array"
3370
			$functionConstruction["returnVarType"][0]="array";
3370
			$functionConstruction["returnVarType"][0]="array";
3371
		
3371
 
3372
			}#if end
3372
			}#if end
3373
		
3373
 
3374
		#var_dump($classConstruction["functions"]);
3374
		#var_dump($classConstruction["functions"]);
3375
		#exit;
3375
		#exit;
3376
		
3376
 
3377
		#建立類別圖表格
3377
		#建立類別圖表格
3378
		#函式說明:
3378
		#函式說明:
3379
		#依據類別的名稱、裡面的函式存限制、函式名稱、函式參數、函式回傳型態來建立類別圖表格
3379
		#依據類別的名稱、裡面的函式存限制、函式名稱、函式參數、函式回傳型態來建立類別圖表格
3380
		#回傳結果:
3380
		#回傳結果:
3381
		#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
3381
		#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
Line 3387... Line 3387...
3387
		$conf["table"]["classDiagramTable"]["functionName"]=$classConstruction["functions"];#各函式的名稱,每個元素代表一個函式的名稱
3387
		$conf["table"]["classDiagramTable"]["functionName"]=$classConstruction["functions"];#各函式的名稱,每個元素代表一個函式的名稱
3388
		$conf["table"]["classDiagramTable"]["functionArgv"]=$functionConstruction["argvType"];#各函式的傳入參數型態,每個元素代表一個函式的入參數型態,""代表沒有傳入參數;
3388
		$conf["table"]["classDiagramTable"]["functionArgv"]=$functionConstruction["argvType"];#各函式的傳入參數型態,每個元素代表一個函式的入參數型態,""代表沒有傳入參數;
3389
		$conf["table"]["classDiagramTable"]["functionReturnType"]=$functionConstruction["returnVarType"];#各函式回傳的型態,每個元素代表一個函式回傳的型態,"void"代表沒有回傳變數
3389
		$conf["table"]["classDiagramTable"]["functionReturnType"]=$functionConstruction["returnVarType"];#各函式回傳的型態,每個元素代表一個函式回傳的型態,"void"代表沒有回傳變數
3390
		$createClassDiagramTableResult=table::classDiagramTable($conf["table"]["classDiagramTable"]);
3390
		$createClassDiagramTableResult=table::classDiagramTable($conf["table"]["classDiagramTable"]);
3391
		unset($conf["table"]["classDiagramTable"]);
3391
		unset($conf["table"]["classDiagramTable"]);
3392
		 
3392
 
3393
		#如果類別圖表格建立失敗
3393
		#如果類別圖表格建立失敗
3394
		if($createClassDiagramTableResult["status"]==="false"){
3394
		if($createClassDiagramTableResult["status"]==="false"){
3395
 
3395
 
3396
			#設置執行錯誤的識別
3396
			#設置執行錯誤的識別
3397
			$result["status"]="false";
3397
			$result["status"]="false";
3398
			
3398
 
3399
			#設置錯誤訊息提示
3399
			#設置錯誤訊息提示
3400
			$result["error"]=$createClassDiagramTableResult["error"];
3400
			$result["error"]=$createClassDiagramTableResult["error"];
3401
			
3401
 
3402
			#回傳結果
3402
			#回傳結果
3403
			return $result;
3403
			return $result;
3404
			
3404
 
3405
			}#if end
3405
			}#if end
3406
		 
3406
 
3407
		#取得類別圖的html內容	
3407
		#取得類別圖的html內容
3408
		$result["diagramCode"]=$createClassDiagramTableResult["classDiagramTable"];
3408
		$result["diagramCode"]=$createClassDiagramTableResult["classDiagramTable"];
3409
		
3409
 
3410
		#執行到這邊代表執行成功
3410
		#執行到這邊代表執行成功
3411
		$result["status"]="true";
3411
		$result["status"]="true";
3412
		
3412
 
3413
		#回傳結果 
3413
		#回傳結果
3414
		return $result;
3414
		return $result;
3415
					 
3415
 
3416
		}#function classDiagramMaker end
3416
		}#function classDiagramMaker end
3417
		
3417
 
3418
	/*
3418
	/*
3419
	#函式說明:
3419
	#函式說明:
3420
	#提供將目標目錄裡的所有php檔案轉成類別圖的功能
3420
	#提供將目標目錄裡的所有php檔案轉成類別圖的功能
3421
	#回傳結果:
3421
	#回傳結果:
3422
	#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
3422
	#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
Line 3434... Line 3434...
3434
	#無.
3434
	#無.
3435
	#備註:
3435
	#備註:
3436
	#有bug...
3436
	#有bug...
3437
	*/
3437
	*/
3438
	public static function classDiagramsMaker(&$conf){
3438
	public static function classDiagramsMaker(&$conf){
3439
		
3439
 
3440
		#初始化要回傳的內容
3440
		#初始化要回傳的內容
3441
		$result=array();
3441
		$result=array();
3442
 
3442
 
3443
		#取得當前函數的名稱
3443
		#取得當前函數的名稱
3444
		$result["function"]=__FUNCTION__;
3444
		$result["function"]=__FUNCTION__;
3445
 
3445
 
3446
		#如果 $conf 不為陣列
3446
		#如果 $conf 不為陣列
3447
		if(gettype($conf)!="array"){
3447
		if(gettype($conf)!="array"){
3448
			
3448
 
3449
			#設置執行失敗
3449
			#設置執行失敗
3450
			$result["status"]="false";
3450
			$result["status"]="false";
3451
			
3451
 
3452
			#設置執行錯誤訊息
3452
			#設置執行錯誤訊息
3453
			$result["error"][]="\$conf變數須為陣列形態";
3453
			$result["error"][]="\$conf變數須為陣列形態";
3454
 
3454
 
3455
			#如果傳入的參數為 null
3455
			#如果傳入的參數為 null
3456
			if($conf==null){
3456
			if($conf==null){
3457
				
3457
 
3458
				#設置執行錯誤訊息
3458
				#設置執行錯誤訊息
3459
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3459
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3460
				
3460
 
3461
				}#if end
3461
				}#if end
3462
 
3462
 
3463
			#回傳結果
3463
			#回傳結果
3464
			return $result;
3464
			return $result;
3465
			
3465
 
3466
			}#if end
3466
			}#if end
3467
		
3467
 
3468
		#參數檢查
3468
		#參數檢查
3469
		#檢查參數
3469
		#檢查參數
3470
		#函式說明:
3470
		#函式說明:
3471
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
3471
		#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
3472
		#回傳結果:
3472
		#回傳結果:
Line 3475... Line 3475...
3475
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
3475
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
3476
		#必填寫的參數:
3476
		#必填寫的參數:
3477
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
3477
		$conf["variableCheck"]["isexistMuti"]["varInput"]=$conf;#要檢查的陣列變數
3478
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpDirAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
3478
		$conf["variableCheck"]["isexistMuti"]["variableCheck"]=array("phpDirAddress","fileArgu");#要檢查的變數名稱陣列,形態爲陣列變數,例如: $conf["variableCheck"] = array("id","account","password");
3479
		#可以省略的參數:
3479
		#可以省略的參數:
3480
		$conf["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double"); 
3480
		$conf["variableType"]=array("string","string");#要檢查的陣列變數內的元素應該爲何種變數形態,形態爲陣列 例如: $conf[variableType] = array("string","int","double");
3481
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
3481
		$conf["variableCheck"]["isexistMuti"]["canBeEmptyString"]="false";#變數內容如果是空字串就不能算是有設置的話,請設為"false",預設為也算是有設置。
3482
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
3482
		$checkResult=variableCheck::isexistMulti($conf["variableCheck"]["isexistMuti"]);
3483
		unset($conf["variableCheck"]["isexistMuti"]);
3483
		unset($conf["variableCheck"]["isexistMuti"]);
3484
	
3484
 
3485
		#如果 $checkResult["status"] 為 "fasle"
3485
		#如果 $checkResult["status"] 為 "fasle"
3486
		if($checkResult["status"]=="false"){
3486
		if($checkResult["status"]=="false"){
3487
			
3487
 
3488
			#設置執行錯誤的識別
3488
			#設置執行錯誤的識別
3489
			$result["status"]="false";
3489
			$result["status"]="false";
3490
 
3490
 
3491
			#設置執行錯誤的訊息
3491
			#設置執行錯誤的訊息
3492
			$result["error"]=$checkResult;
3492
			$result["error"]=$checkResult;
3493
			
3493
 
3494
			#回傳結果
3494
			#回傳結果
3495
			return $result;
3495
			return $result;
3496
			
3496
 
3497
			}#if end
3497
			}#if end
3498
			
3498
 
3499
		#如果 $checkResult["passed"] 為 "fasle"
3499
		#如果 $checkResult["passed"] 為 "fasle"
3500
		if($checkResult["passed"]=="false"){
3500
		if($checkResult["passed"]=="false"){
3501
			
3501
 
3502
			#設置執行錯誤的識別
3502
			#設置執行錯誤的識別
3503
			$result["status"]="false";
3503
			$result["status"]="false";
3504
 
3504
 
3505
			#設置執行錯誤的訊息
3505
			#設置執行錯誤的訊息
3506
			$result["error"]=$checkResult;
3506
			$result["error"]=$checkResult;
3507
			
3507
 
3508
			#回傳結果
3508
			#回傳結果
3509
			return $result;
3509
			return $result;
3510
			
3510
 
3511
			}#if end
3511
			}#if end
3512
			
3512
 
3513
		#取得目標目錄底下的php檔案
3513
		#取得目標目錄底下的php檔案
3514
		#函式說明:
3514
		#函式說明:
3515
		#取得目錄底下函式庫檔案清單
3515
		#取得目錄底下函式庫檔案清單
3516
		#回傳的結果:
3516
		#回傳的結果:
3517
		#$result["status"],0表示有清單;1表示沒有清單
3517
		#$result["status"],0表示有清單;1表示沒有清單
3518
		#$result["dataCount"],有幾筆符合的資料
3518
		#$result["dataCount"],有幾筆符合的資料
3519
		#$result["neededList"],符合條件的檔案清單		
3519
		#$result["neededList"],符合條件的檔案清單
3520
		#必填參數:
3520
		#必填參數:
3521
		$conf["phpLib"]["getLibFileList"]["folderAddress"]=$conf["phpDirAddress"];#要讀取的函式庫目錄
3521
		$conf["phpLib"]["getLibFileList"]["folderAddress"]=$conf["phpDirAddress"];#要讀取的函式庫目錄
3522
		#$conf["fileArgu"],字串__FILE__的內容.
3522
		#$conf["fileArgu"],字串__FILE__的內容.
3523
		$conf["phpLib"]["getLibFileList"]["fileArgu"]=$conf["fileArgu"];
3523
		$conf["phpLib"]["getLibFileList"]["fileArgu"]=$conf["fileArgu"];
3524
		#可省略的參數:
3524
		#可省略的參數:
3525
		$conf["phpLib"]["getLibFileList"]["readFileType"]=array("php");#要讀取具有該陣列底下副檔名的檔案
3525
		$conf["phpLib"]["getLibFileList"]["readFileType"]=array("php");#要讀取具有該陣列底下副檔名的檔案
3526
		#$conf["excludeFile"],陣列,要忽略的檔案.
3526
		#$conf["excludeFile"],陣列,要忽略的檔案.
3527
		$conf["phpLib"]["getLibFileList"]["excludeFile"]=array("allInOne.php");
3527
		$conf["phpLib"]["getLibFileList"]["excludeFile"]=array("allInOne.php");
3528
		$phpLib_getLibFileList=phpLib::getLibFileList($conf["phpLib"]["getLibFileList"]);
3528
		$phpLib_getLibFileList=phpLib::getLibFileList($conf["phpLib"]["getLibFileList"]);
3529
		unset($conf["phpLib"]["getLibFileList"]);
3529
		unset($conf["phpLib"]["getLibFileList"]);
3530
		
3530
 
3531
		#debug
3531
		#debug
3532
		#var_dump($phpLib_getLibFileList);
3532
		#var_dump($phpLib_getLibFileList);
3533
		#exit;
3533
		#exit;
3534
		
3534
 
3535
		#如果執行失敗
3535
		#如果執行失敗
3536
		if($phpLib_getLibFileList["status"]==="false"){
3536
		if($phpLib_getLibFileList["status"]==="false"){
3537
			
3537
 
3538
			#設定執行失敗
3538
			#設定執行失敗
3539
			$result["status"]="false";
3539
			$result["status"]="false";
3540
			
3540
 
3541
			#設置錯誤訊息
3541
			#設置錯誤訊息
3542
			$result["error"]="目標目錄下沒有任何php檔案";
3542
			$result["error"]="目標目錄下沒有任何php檔案";
3543
			
3543
 
3544
			#回傳結果
3544
			#回傳結果
3545
			return $result;
3545
			return $result;
3546
			
3546
 
3547
			}#if end
3547
			}#if end
3548
		
3548
 
3549
		#如果 $phpLib_getLibFileList["dataCount"] 等於 0,則代表目標目錄底下沒有php檔案。
3549
		#如果 $phpLib_getLibFileList["dataCount"] 等於 0,則代表目標目錄底下沒有php檔案。
3550
		if($phpLib_getLibFileList["dataCount"]===0){
3550
		if($phpLib_getLibFileList["dataCount"]===0){
3551
			
3551
 
3552
			#設定執行失敗
3552
			#設定執行失敗
3553
			$result["status"]="false";
3553
			$result["status"]="false";
3554
			
3554
 
3555
			#設置錯誤訊息
3555
			#設置錯誤訊息
3556
			$result["error"]="目標目錄下沒有任何php檔案";
3556
			$result["error"]="目標目錄下沒有任何php檔案";
3557
			
3557
 
3558
			#回傳結果
3558
			#回傳結果
3559
			return $result;
3559
			return $result;
3560
			
3560
 
3561
			}#if end
3561
			}#if end
3562
			
3562
 
3563
		#var_dump($phpLib_getLibFileList);
3563
		#var_dump($phpLib_getLibFileList);
3564
			
3564
 
3565
		#根據每個php檔案
3565
		#根據每個php檔案
3566
		for($i=0;$i<$phpLib_getLibFileList["dataCount"];$i++){
3566
		for($i=0;$i<$phpLib_getLibFileList["dataCount"];$i++){
3567
			
3567
 
3568
			#取得其類別函式結構
3568
			#取得其類別函式結構
3569
			#函式說明:
3569
			#函式說明:
3570
			#提供將含有類別宣告的php檔案轉成類別圖的功能
3570
			#提供將含有類別宣告的php檔案轉成類別圖的功能
3571
			#回傳結果:
3571
			#回傳結果:
3572
			#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
3572
			#$result["status"],執行是否成功,"true"代表執行成功;"false"代表執行失敗。
Line 3575... Line 3575...
3575
			#必填參數:
3575
			#必填參數:
3576
			$conf["phpLib"]["classDiagramMaker"]["phpFileAddress"]=$conf["phpDirAddress"].$phpLib_getLibFileList["neededList"][$i];#含有宣告類別的php檔案
3576
			$conf["phpLib"]["classDiagramMaker"]["phpFileAddress"]=$conf["phpDirAddress"].$phpLib_getLibFileList["neededList"][$i];#含有宣告類別的php檔案
3577
			$conf["phpLib"]["classDiagramMaker"]["fileArgu"]=$conf["fileArgu"];
3577
			$conf["phpLib"]["classDiagramMaker"]["fileArgu"]=$conf["fileArgu"];
3578
			$classDiagram["diagramCode"][$i]=phpLib::classDiagramMaker($conf["phpLib"]["classDiagramMaker"]);
3578
			$classDiagram["diagramCode"][$i]=phpLib::classDiagramMaker($conf["phpLib"]["classDiagramMaker"]);
3579
			unset($conf["phpLib"]["classDiagramMaker"]);
3579
			unset($conf["phpLib"]["classDiagramMaker"]);
3580
			
3580
 
3581
			#如果該檔案的類別圖取得失敗
3581
			#如果該檔案的類別圖取得失敗
3582
			if($classDiagram["diagramCode"][$i]["status"]=="false"){
3582
			if($classDiagram["diagramCode"][$i]["status"]=="false"){
3583
				
3583
 
3584
				#設定類別圖繪製失敗
3584
				#設定類別圖繪製失敗
3585
				$result["status"]="false";
3585
				$result["status"]="false";
3586
				
3586
 
3587
				#設定錯誤訊息
3587
				#設定錯誤訊息
3588
				$result["error"]=$classDiagram;
3588
				$result["error"]=$classDiagram;
3589
				
3589
 
3590
				#設定該檔案的類別圖繪製失敗提示
3590
				#設定該檔案的類別圖繪製失敗提示
3591
				$result["error"][]="無法正確取得".$phpLib_getLibFileList["neededList"][$i]."檔案裡面的類別結構或該檔案非類別檔案";
3591
				$result["error"][]="無法正確取得".$phpLib_getLibFileList["neededList"][$i]."檔案裡面的類別結構或該檔案非類別檔案";
3592
				
3592
 
3593
				#回傳結果
3593
				#回傳結果
3594
				return $result;
3594
				return $result;
3595
				
3595
 
3596
				}#if end
3596
				}#if end
3597
				
3597
 
3598
			#取得類別圖表格htmlCode
3598
			#取得類別圖表格htmlCode
3599
			$result["diagramCode"][]=$classDiagram["diagramCode"][$i]["diagramCode"];	
3599
			$result["diagramCode"][]=$classDiagram["diagramCode"][$i]["diagramCode"];
3600
			
3600
 
3601
			}#for end
3601
			}#for end
3602
			
3602
 
3603
		#執行到這邊代表執行成功
3603
		#執行到這邊代表執行成功
3604
		$result["status"]="true";
3604
		$result["status"]="true";
3605
		
3605
 
3606
		#回傳結果
3606
		#回傳結果
3607
		return $result;	
3607
		return $result;
3608
		
3608
 
3609
		}#function classDiagramsMaker end
3609
		}#function classDiagramsMaker end
3610
		
3610
 
3611
	/*
3611
	/*
3612
	#函式說明:
3612
	#函式說明:
3613
	#更新程式檔案開頭版權宣告的年份,以及作者清單,取得更新過後的檔案路徑.
3613
	#更新程式檔案開頭版權宣告的年份,以及作者清單,取得更新過後的檔案路徑.
3614
	#回傳結果:
3614
	#回傳結果:
3615
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3615
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 3656... Line 3656...
3656
	#無.
3656
	#無.
3657
	#備註:
3657
	#備註:
3658
	#建構中...
3658
	#建構中...
3659
	*/
3659
	*/
3660
	public static function updateCopyRightYear(&$conf){
3660
	public static function updateCopyRightYear(&$conf){
3661
	
3661
 
3662
		#初始化要回傳的結果
3662
		#初始化要回傳的結果
3663
		$result=array();
3663
		$result=array();
3664
 
3664
 
3665
		#取得當前執行的函數名稱
3665
		#取得當前執行的函數名稱
3666
		$result["function"]=__FUNCTION__;
3666
		$result["function"]=__FUNCTION__;
Line 3679... Line 3679...
3679
 
3679
 
3680
			}#if end
3680
			}#if end
3681
 
3681
 
3682
		#取得參數
3682
		#取得參數
3683
		$result["argu"]=$conf;
3683
		$result["argu"]=$conf;
3684
		
3684
 
3685
		#debug,break point.
3685
		#debug,break point.
3686
		#var_dump(__LINE__,$result);exit(1);
3686
		#var_dump(__LINE__,$result);exit(1);
3687
 
3687
 
3688
		#如果 $conf 不為陣列
3688
		#如果 $conf 不為陣列
3689
		if(gettype($conf)!=="array"){
3689
		if(gettype($conf)!=="array"){
Line 3704... Line 3704...
3704
 
3704
 
3705
			#回傳結果
3705
			#回傳結果
3706
			return $result;
3706
			return $result;
3707
 
3707
 
3708
			}#if end
3708
			}#if end
3709
		
3709
 
3710
		#設置要取代的內容關鍵字陣列 - start
3710
		#設置要取代的內容關鍵字陣列 - start
3711
		
3711
 
3712
		$replaceFromArray=array();
3712
		$replaceFromArray=array();
3713
		
3713
 
3714
		$replaceFromArray[]="        QBPWCF, Quick Build PHP website Component base on Fedora Linux.";
3714
		$replaceFromArray[]="        QBPWCF, Quick Build PHP website Component base on Fedora Linux.";
3715
		
3715
 
3716
		$replaceFromArray[]="    Copyright (C) \${yearFrom}~\${yearTo} \${Authors}";
3716
		$replaceFromArray[]="    Copyright (C) \${yearFrom}~\${yearTo} \${Authors}";
3717
		
3717
 
3718
		$replaceFromArray[]="";
3718
		$replaceFromArray[]="";
3719
		
3719
 
3720
		$replaceFromArray[]="    This file is part of QBPWCF.";
3720
		$replaceFromArray[]="    This file is part of QBPWCF.";
3721
		
3721
 
3722
		$replaceFromArray[]="";
3722
		$replaceFromArray[]="";
3723
		
3723
 
3724
		$replaceFromArray[]="    QBPWCF is free software: you can redistribute it and/or modify";
3724
		$replaceFromArray[]="    QBPWCF is free software: you can redistribute it and/or modify";
3725
		
3725
 
3726
		$replaceFromArray[]="    it under the terms of the GNU General Public License as published by";
3726
		$replaceFromArray[]="    it under the terms of the GNU General Public License as published by";
3727
		
3727
 
3728
		$replaceFromArray[]="    the Free Software Foundation, either version 3 of the License, or";
3728
		$replaceFromArray[]="    the Free Software Foundation, either version 3 of the License, or";
3729
		
3729
 
3730
		$replaceFromArray[]="    (at your option) any later version.";
3730
		$replaceFromArray[]="    (at your option) any later version.";
3731
 
3731
 
3732
		$replaceFromArray[]="";
3732
		$replaceFromArray[]="";
3733
		
3733
 
3734
		$replaceFromArray[]="    QBPWCF is distributed in the hope that it will be useful,";
3734
		$replaceFromArray[]="    QBPWCF is distributed in the hope that it will be useful,";
3735
		
3735
 
3736
		$replaceFromArray[]="    but WITHOUT ANY WARRANTY; without even the implied warranty of";
3736
		$replaceFromArray[]="    but WITHOUT ANY WARRANTY; without even the implied warranty of";
3737
		
3737
 
3738
		$replaceFromArray[]="    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the";
3738
		$replaceFromArray[]="    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the";
3739
 
3739
 
3740
		$replaceFromArray[]="    GNU General Public License for more details.";
3740
		$replaceFromArray[]="    GNU General Public License for more details.";
3741
		
3741
 
3742
		$replaceFromArray[]="";
3742
		$replaceFromArray[]="";
3743
		
3743
 
3744
		$replaceFromArray[]="    You should have received a copy of the GNU General Public License";
3744
		$replaceFromArray[]="    You should have received a copy of the GNU General Public License";
3745
		
3745
 
3746
		$replaceFromArray[]="    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.";
3746
		$replaceFromArray[]="    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.";
3747
		
3747
 
3748
		#設置要取代的內容關鍵字陣列 - end
3748
		#設置要取代的內容關鍵字陣列 - end
3749
		
3749
 
3750
		#函式說明:
3750
		#函式說明:
3751
		#取得檔案路徑字串的路徑與檔案的名稱與檔案副檔名
3751
		#取得檔案路徑字串的路徑與檔案的名稱與檔案副檔名
3752
		#回傳的結果:
3752
		#回傳的結果:
3753
		#$result["status"],執行是否正常,"true"正常,"false"代表不正常.
3753
		#$result["status"],執行是否正常,"true"正常,"false"代表不正常.
3754
		#$result["error"],錯誤訊息.
3754
		#$result["error"],錯誤訊息.
Line 3767... Line 3767...
3767
		#無.
3767
		#無.
3768
		#備註:
3768
		#備註:
3769
		#無.
3769
		#無.
3770
		$getFileAddressAndNameAndFileExtention=fileAccess::getFileAddressAndNameAndFileExtention($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3770
		$getFileAddressAndNameAndFileExtention=fileAccess::getFileAddressAndNameAndFileExtention($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3771
		unset($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3771
		unset($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3772
		
3772
 
3773
		#如果執行失敗
3773
		#如果執行失敗
3774
		if($getFileAddressAndNameAndFileExtention["status"]==="false"){
3774
		if($getFileAddressAndNameAndFileExtention["status"]==="false"){
3775
			
3775
 
3776
			#設置錯誤識別
3776
			#設置錯誤識別
3777
			$result["status"]="false";
3777
			$result["status"]="false";
3778
			
3778
 
3779
			#設置錯誤訊息
3779
			#設置錯誤訊息
3780
			$result["error"]=$getFileAddressAndNameAndFileExtention;
3780
			$result["error"]=$getFileAddressAndNameAndFileExtention;
3781
			
3781
 
3782
			#回傳結果
3782
			#回傳結果
3783
			return $result;
3783
			return $result;
3784
			
3784
 
3785
			}#if end
3785
			}#if end
3786
		
3786
 
3787
		#取得當前使用套件的路徑
3787
		#取得當前使用套件的路徑
3788
		$libPath=$getFileAddressAndNameAndFileExtention["filePath"]."../../../";
3788
		$libPath=$getFileAddressAndNameAndFileExtention["filePath"]."../../../";
3789
		
3789
 
3790
		#debug,break point.
3790
		#debug,break point.
3791
		#var_dump(__LINE__,$libPath);exit(1);
3791
		#var_dump(__LINE__,$libPath);exit(1);
3792
		
3792
 
3793
		#函式說明:
3793
		#函式說明:
3794
		#將檔案目錄的絕對位置中的 "../" 剔除變成直觀的路徑.
3794
		#將檔案目錄的絕對位置中的 "../" 剔除變成直觀的路徑.
3795
		#回傳結果:
3795
		#回傳結果:
3796
		#$result["status"],執行是否成功,"true"代表執行成功,"false"代表執行失敗.
3796
		#$result["status"],執行是否成功,"true"代表執行成功,"false"代表執行失敗.
3797
		#$result["function"],當前執行的函數.
3797
		#$result["function"],當前執行的函數.
Line 3808... Line 3808...
3808
		#無.
3808
		#無.
3809
		#備註:
3809
		#備註:
3810
		#考慮用realpath取代
3810
		#考慮用realpath取代
3811
		$changeDirByDotDotSolidus=stringProcess::changeDirByDotDotSolidus($conf["stringProcess::changeDirByDotDotSolidus"]);
3811
		$changeDirByDotDotSolidus=stringProcess::changeDirByDotDotSolidus($conf["stringProcess::changeDirByDotDotSolidus"]);
3812
		unset($conf["stringProcess::changeDirByDotDotSolidus"]);
3812
		unset($conf["stringProcess::changeDirByDotDotSolidus"]);
3813
		
3813
 
3814
		#如果執行失敗
3814
		#如果執行失敗
3815
		if($changeDirByDotDotSolidus["status"]==="false"){
3815
		if($changeDirByDotDotSolidus["status"]==="false"){
3816
			
3816
 
3817
			#設置錯誤識別
3817
			#設置錯誤識別
3818
			$result["status"]="false";
3818
			$result["status"]="false";
3819
			
3819
 
3820
			#設置錯誤訊息
3820
			#設置錯誤訊息
3821
			$result["error"]=$changeDirByDotDotSolidus;
3821
			$result["error"]=$changeDirByDotDotSolidus;
3822
			
3822
 
3823
			#回傳結果
3823
			#回傳結果
3824
			return $result;
3824
			return $result;
3825
			
3825
 
3826
			}#if end
3826
			}#if end
3827
		
3827
 
3828
		#取得直觀的絕對路徑
3828
		#取得直觀的絕對路徑
3829
		$libRootPath=$changeDirByDotDotSolidus["changedPath"];
3829
		$libRootPath=$changeDirByDotDotSolidus["changedPath"];
3830
		
3830
 
3831
		#取得 lib folder
3831
		#取得 lib folder
3832
		exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../bin/libexec/folderOfUsrLib.php"),$output,$status);
3832
		exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../bin/libexec/folderOfUsrLib.php"),$output,$status);
3833
 
3833
 
3834
		#如果執行失敗
3834
		#如果執行失敗
3835
		if($status!==0){
3835
		if($status!==0){
Line 3842... Line 3842...
3842
 
3842
 
3843
			}#if end
3843
			}#if end
3844
 
3844
 
3845
		#儲存 lib folder
3845
		#儲存 lib folder
3846
		$folderOfUsrLib=$output[0];
3846
		$folderOfUsrLib=$output[0];
3847
		
3847
 
3848
		#儲存 lib path
3848
		#儲存 lib path
3849
		#$libPath=$libRootPath."/usr/".$folderOfUsrLib;
3849
		#$libPath=$libRootPath."/usr/".$folderOfUsrLib;
3850
		
3850
 
3851
		#debug
3851
		#debug
3852
		#var_dump(__LINE__,$libPath);exit(1);
3852
		#var_dump(__LINE__,$libPath);exit(1);
3853
		
3853
 
3854
		#函式說明:
3854
		#函式說明:
3855
		#使用 linux 的 uuid 指令來產生 uuid 字串
3855
		#使用 linux 的 uuid 指令來產生 uuid 字串
3856
		#回傳結果:
3856
		#回傳結果:
3857
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3857
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3858
		#$result["error"],錯誤訊息.
3858
		#$result["error"],錯誤訊息.
Line 3871... Line 3871...
3871
		#如果執行失敗
3871
		#如果執行失敗
3872
		if($uuid["status"]==="false"){
3872
		if($uuid["status"]==="false"){
3873
 
3873
 
3874
			#debug
3874
			#debug
3875
			var_dump($uuid);
3875
			var_dump($uuid);
3876
			
3876
 
3877
			#結束執行回傳代碼1給shell
3877
			#結束執行回傳代碼1給shell
3878
			exit(1);
3878
			exit(1);
3879
 
3879
 
3880
			}#if end
3880
			}#if end
3881
		
3881
 
3882
		#預設的輸出目錄
3882
		#預設的輸出目錄
3883
		$outputPath="/tmp/".$uuid["content"]."-phpLib::updateCopyRightYear/";
3883
		$outputPath="/tmp/".$uuid["content"]."-phpLib::updateCopyRightYear/";
3884
		
3884
 
3885
		#檢查參數
3885
		#檢查參數
3886
		#函式說明:
3886
		#函式說明:
3887
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
3887
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
3888
		#回傳結果:
3888
		#回傳結果:
3889
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3889
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 3935... Line 3935...
3935
		#array_keys=>http://php.net/manual/en/function.array-keys.php
3935
		#array_keys=>http://php.net/manual/en/function.array-keys.php
3936
		#備註:
3936
		#備註:
3937
		#無.
3937
		#無.
3938
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
3938
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
3939
		unset($conf["variableCheck::checkArguments"]);
3939
		unset($conf["variableCheck::checkArguments"]);
3940
		
3940
 
3941
		#如果執行異常
3941
		#如果執行異常
3942
		if($checkArguments["status"]==="false"){
3942
		if($checkArguments["status"]==="false"){
3943
		
3943
 
3944
			#設置錯誤識別
3944
			#設置錯誤識別
3945
			$result["status"]="false";
3945
			$result["status"]="false";
3946
			
3946
 
3947
			#設置錯誤訊息
3947
			#設置錯誤訊息
3948
			$result["error"]=$checkArguments;
3948
			$result["error"]=$checkArguments;
3949
			
3949
 
3950
			#回傳結果
3950
			#回傳結果
3951
			return $result;
3951
			return $result;
3952
		
3952
 
3953
			}#if end
3953
			}#if end
3954
			
3954
 
3955
		#如果參數檢查不通過
3955
		#如果參數檢查不通過
3956
		if($checkArguments["passed"]==="false"){
3956
		if($checkArguments["passed"]==="false"){
3957
		
3957
 
3958
			#設置錯誤識別
3958
			#設置錯誤識別
3959
			$result["status"]="false";
3959
			$result["status"]="false";
3960
			
3960
 
3961
			#設置錯誤訊息
3961
			#設置錯誤訊息
3962
			$result["error"]=$checkArguments;
3962
			$result["error"]=$checkArguments;
3963
			
3963
 
3964
			#回傳結果
3964
			#回傳結果
3965
			return $result;
3965
			return $result;
3966
		
3966
 
3967
			}#if end
3967
			}#if end
3968
		
3968
 
3969
		#函式說明:
3969
		#函式說明:
3970
		#取得檔案路徑字串的路徑與檔案的名稱與檔案副檔名
3970
		#取得檔案路徑字串的路徑與檔案的名稱與檔案副檔名
3971
		#回傳的結果:
3971
		#回傳的結果:
3972
		#$result["status"],執行是否正常,"true"正常,"false"代表不正常.
3972
		#$result["status"],執行是否正常,"true"正常,"false"代表不正常.
3973
		#$result["error"],錯誤訊息.
3973
		#$result["error"],錯誤訊息.
Line 3986... Line 3986...
3986
		#無.
3986
		#無.
3987
		#備註:
3987
		#備註:
3988
		#無.
3988
		#無.
3989
		$getFileAddressAndNameAndFileExtention=fileAccess::getFileAddressAndNameAndFileExtention($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3989
		$getFileAddressAndNameAndFileExtention=fileAccess::getFileAddressAndNameAndFileExtention($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3990
		unset($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3990
		unset($conf["fileAccess::getFileAddressAndNameAndFileExtention"]);
3991
		
3991
 
3992
		#debug,break point.
3992
		#debug,break point.
3993
		#var_dump(__LINE__,$getFileAddressAndNameAndFileExtention);exit;
3993
		#var_dump(__LINE__,$getFileAddressAndNameAndFileExtention);exit;
3994
		
3994
 
3995
		#如果執行失敗
3995
		#如果執行失敗
3996
		if($getFileAddressAndNameAndFileExtention["status"]==="false"){
3996
		if($getFileAddressAndNameAndFileExtention["status"]==="false"){
3997
			
3997
 
3998
			#設置錯誤識別
3998
			#設置錯誤識別
3999
			$result["status"]="false";
3999
			$result["status"]="false";
4000
			
4000
 
4001
			#設置錯誤訊息
4001
			#設置錯誤訊息
4002
			$result["error"]=$getFileAddressAndNameAndFileExtention;
4002
			$result["error"]=$getFileAddressAndNameAndFileExtention;
4003
			
4003
 
4004
			#回傳結果
4004
			#回傳結果
4005
			return $result;
4005
			return $result;
4006
			
4006
 
4007
			}#if end
4007
			}#if end
4008
		
4008
 
4009
		#初始化有異動的檔案清單
4009
		#初始化有異動的檔案清單
4010
		$result["content"]=array();
4010
		$result["content"]=array();
4011
		
4011
 
4012
		#函式說明:
4012
		#函式說明:
4013
		#使用 linux 的 uuid 指令來產生 uuid 字串
4013
		#使用 linux 的 uuid 指令來產生 uuid 字串
4014
		#回傳結果:
4014
		#回傳結果:
4015
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4015
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4016
		#$result["error"],錯誤訊息.
4016
		#$result["error"],錯誤訊息.
Line 4029... Line 4029...
4029
		#如果執行失敗
4029
		#如果執行失敗
4030
		if($uuid["status"]==="false"){
4030
		if($uuid["status"]==="false"){
4031
 
4031
 
4032
			#debug
4032
			#debug
4033
			var_dump($uuid);
4033
			var_dump($uuid);
4034
			
4034
 
4035
			#結束執行回傳代碼1給shell
4035
			#結束執行回傳代碼1給shell
4036
			exit(1);
4036
			exit(1);
4037
 
4037
 
4038
			}#if end
4038
			}#if end
4039
		
4039
 
4040
		#取得 uuid
4040
		#取得 uuid
4041
		$uuid=$uuid["content"];
4041
		$uuid=$uuid["content"];
4042
		
4042
 
4043
		#針對 $conf["searchPath"] 的每個路徑
4043
		#針對 $conf["searchPath"] 的每個路徑
4044
		foreach($conf["searchPath"] as $path){
4044
		foreach($conf["searchPath"] as $path){
4045
		
4045
 
4046
			#debug
4046
			#debug
4047
			#var_dump(__LINE__,"searching path:".$path);
4047
			#var_dump(__LINE__,"searching path:".$path);
4048
		
4048
 
4049
			#取得 $path 底下的所有檔案.
4049
			#取得 $path 底下的所有檔案.
4050
			#函式說明:
4050
			#函式說明:
4051
			#取得目錄底下的詳細資訊.
4051
			#取得目錄底下的詳細資訊.
4052
			#回傳結果:
4052
			#回傳結果:
4053
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4053
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4078... Line 4078...
4078
			#https://www.businessweekly.com.tw/careers/Blog/14307
4078
			#https://www.businessweekly.com.tw/careers/Blog/14307
4079
			#備註:
4079
			#備註:
4080
			#無.
4080
			#無.
4081
			$ls=fileAccess::ls($conf["fileAccess::ls"]);
4081
			$ls=fileAccess::ls($conf["fileAccess::ls"]);
4082
			unset($conf["fileAccess::ls"]);
4082
			unset($conf["fileAccess::ls"]);
4083
			
4083
 
4084
			#如果執行失敗
4084
			#如果執行失敗
4085
			if($ls["status"]==="false"){
4085
			if($ls["status"]==="false"){
4086
				
4086
 
4087
				#設置錯誤識別
4087
				#設置錯誤識別
4088
				$result["status"]="false";
4088
				$result["status"]="false";
4089
				
4089
 
4090
				#設置錯誤訊息
4090
				#設置錯誤訊息
4091
				$result["error"]=$ls;
4091
				$result["error"]=$ls;
4092
				
4092
 
4093
				#回傳結果
4093
				#回傳結果
4094
				return $result;
4094
				return $result;
4095
				
4095
 
4096
				}#if end
4096
				}#if end
4097
			
4097
 
4098
			#如果沒資料
4098
			#如果沒資料
4099
			if($ls["dataCount"]===0){
4099
			if($ls["dataCount"]===0){
4100
			
4100
 
4101
				#跳過
4101
				#跳過
4102
				continue;
4102
				continue;
4103
			
4103
 
4104
				}#if end
4104
				}#if end
4105
			
4105
 
4106
			#針對每個節點
4106
			#針對每個節點
4107
			foreach($ls["content"] as $node){
4107
			foreach($ls["content"] as $node){
4108
			
4108
 
4109
				#取得節點的路徑與名稱
4109
				#取得節點的路徑與名稱
4110
				$NodePathAndName=$ls["path"].$node["name"];
4110
				$NodePathAndName=$ls["path"].$node["name"];
4111
			
4111
 
4112
				#儲存該節點需要取代的行號相關資訊
4112
				#儲存該節點需要取代的行號相關資訊
4113
				$replacedInfo=array();
4113
				$replacedInfo=array();
4114
			
4114
 
4115
				#預設該節點檔案不需要更新
4115
				#預設該節點檔案不需要更新
4116
				$shouldReplace="false";
4116
				$shouldReplace="false";
4117
			
4117
 
4118
				#debug
4118
				#debug
4119
				#var_dump(__LINE__,$node);
4119
				#var_dump(__LINE__,$node);
4120
			
4120
 
4121
				#如果是資料夾
4121
				#如果是資料夾
4122
				if($node["nType"]==="d"){
4122
				if($node["nType"]==="d"){
4123
				
4123
 
4124
					#如果要忽略隱藏資料夾
4124
					#如果要忽略隱藏資料夾
4125
					if($conf["skipHiddenFolder"]==="true"){
4125
					if($conf["skipHiddenFolder"]==="true"){
4126
					
4126
 
4127
						#如果開頭為 "."
4127
						#如果開頭為 "."
4128
						if(strpos($node["name"],".")===0){
4128
						if(strpos($node["name"],".")===0){
4129
						
4129
 
4130
							#如果有設定要包含特定的隱藏目錄
4130
							#如果有設定要包含特定的隱藏目錄
4131
							if(isset($conf["includeHiddenFolder"])){
4131
							if(isset($conf["includeHiddenFolder"])){
4132
							
4132
 
4133
								#如果不是需要的特定隱藏目錄
4133
								#如果不是需要的特定隱藏目錄
4134
								if(!(in_array($node["name"],$conf["includeHiddenFolder"]))){
4134
								if(!(in_array($node["name"],$conf["includeHiddenFolder"]))){
4135
								
4135
 
4136
									#跳過
4136
									#跳過
4137
									continue;
4137
									continue;
4138
								
4138
 
4139
									}#if end
4139
									}#if end
4140
							
4140
 
4141
								}#if end
4141
								}#if end
4142
						
4142
 
4143
							#反之
4143
							#反之
4144
							else{
4144
							else{
4145
							
4145
 
4146
								#跳過
4146
								#跳過
4147
								continue;
4147
								continue;
4148
							
4148
 
4149
								}#else end
4149
								}#else end
4150
						
4150
 
4151
							}#if end
4151
							}#if end
4152
					
4152
 
4153
						}#if end
4153
						}#if end
4154
						
4154
 
4155
					#如果是要跳過的資料夾名稱
4155
					#如果是要跳過的資料夾名稱
4156
					if(in_array($node["name"],$conf["excludeDirName"])){
4156
					if(in_array($node["name"],$conf["excludeDirName"])){
4157
					
4157
 
4158
						#跳過
4158
						#跳過
4159
						continue;
4159
						continue;
4160
					
4160
 
4161
						}#if end
4161
						}#if end
4162
				
4162
 
4163
					#跳過 
4163
					#跳過
4164
					#continue;
4164
					#continue;
4165
				
4165
 
4166
					#如果為單執行序
4166
					#如果為單執行序
4167
					if($conf["multiThread"]==="false"){
4167
					if($conf["multiThread"]==="false"){
4168
					
4168
 
4169
						#繼承本函式參數
4169
						#繼承本函式參數
4170
						$conf["self::updateCopyRightYear"]=$conf;
4170
						$conf["self::updateCopyRightYear"]=$conf;
4171
						
4171
 
4172
						#置換要執行的路徑
4172
						#置換要執行的路徑
4173
						$conf["self::updateCopyRightYear"]["searchPath"]=array($NodePathAndName);
4173
						$conf["self::updateCopyRightYear"]["searchPath"]=array($NodePathAndName);
4174
						
4174
 
4175
						#遞迴呼叫
4175
						#遞迴呼叫
4176
						$updateCopyRightYear=self::updateCopyRightYear($conf["self::updateCopyRightYear"]);
4176
						$updateCopyRightYear=self::updateCopyRightYear($conf["self::updateCopyRightYear"]);
4177
						
4177
 
4178
						#移除參數,避免出錯.
4178
						#移除參數,避免出錯.
4179
						unset($conf["self::updateCopyRightYear"]);
4179
						unset($conf["self::updateCopyRightYear"]);
4180
						
4180
 
4181
						#如果執行失敗
4181
						#如果執行失敗
4182
						if($updateCopyRightYear["status"]==="false"){
4182
						if($updateCopyRightYear["status"]==="false"){
4183
						
4183
 
4184
							#設置錯誤識別
4184
							#設置錯誤識別
4185
							$result["status"]="false";
4185
							$result["status"]="false";
4186
							
4186
 
4187
							#設置錯誤訊息
4187
							#設置錯誤訊息
4188
							$result["error"]=$updateCopyRightYear;
4188
							$result["error"]=$updateCopyRightYear;
4189
							
4189
 
4190
							#回傳結果
4190
							#回傳結果
4191
							return $result;
4191
							return $result;
4192
						
4192
 
4193
							}#if end
4193
							}#if end
4194
						
4194
 
4195
						#記錄有掃描的資料夾路徑與名稱 
4195
						#記錄有掃描的資料夾路徑與名稱
4196
						$result["scannedFile"][]=$NodePathAndName;
4196
						$result["scannedFile"][]=$NodePathAndName;
4197
						
4197
 
4198
						#debug
4198
						#debug
4199
						var_dump(__LINE__,"seartched node(folder):".$NodePathAndName);
4199
						var_dump(__LINE__,"seartched node(folder):".$NodePathAndName);
4200
						
4200
 
4201
						#合併 content - start
4201
						#合併 content - start
4202
						
4202
 
4203
						#函式說明:
4203
						#函式說明:
4204
						#將多個一維陣列串聯起來,key從0開始排序.
4204
						#將多個一維陣列串聯起來,key從0開始排序.
4205
						#回傳的結果:
4205
						#回傳的結果:
4206
						#$result["status"],"true"表執行正常,"false"代表執行不正常.
4206
						#$result["status"],"true"表執行正常,"false"代表執行不正常.
4207
						#$result["error"],錯誤訊息陣列.
4207
						#$result["error"],錯誤訊息陣列.
Line 4217... Line 4217...
4217
						#無.
4217
						#無.
4218
						#備註:
4218
						#備註:
4219
						#無.
4219
						#無.
4220
						$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
4220
						$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
4221
						unset($conf["arrays::mergeArray"]);
4221
						unset($conf["arrays::mergeArray"]);
4222
						
4222
 
4223
						#如果執行失敗
4223
						#如果執行失敗
4224
						if($mergeArray["status"]==="false"){
4224
						if($mergeArray["status"]==="false"){
4225
						
4225
 
4226
							#設置錯誤識別
4226
							#設置錯誤識別
4227
							$result["status"]="false";
4227
							$result["status"]="false";
4228
							
4228
 
4229
							#設置錯誤訊息
4229
							#設置錯誤訊息
4230
							$result["error"]=$mergeArray;
4230
							$result["error"]=$mergeArray;
4231
							
4231
 
4232
							#回傳結果
4232
							#回傳結果
4233
							return $result;
4233
							return $result;
4234
						
4234
 
4235
							}#if end
4235
							}#if end
4236
							
4236
 
4237
						#取得合併好的有異動檔案結果
4237
						#取得合併好的有異動檔案結果
4238
						$result["content"]=$mergeArray["content"];
4238
						$result["content"]=$mergeArray["content"];
4239
						
4239
 
4240
						#合併 content - end
4240
						#合併 content - end
4241
						
4241
 
4242
						#合併 scannedFile - start
4242
						#合併 scannedFile - start
4243
						
4243
 
4244
						if(isset($updateCopyRightYear["scannedFile"])){
4244
						if(isset($updateCopyRightYear["scannedFile"])){
4245
						
4245
 
4246
							#函式說明:
4246
							#函式說明:
4247
							#將多個一維陣列串聯起來,key從0開始排序.
4247
							#將多個一維陣列串聯起來,key從0開始排序.
4248
							#回傳的結果:
4248
							#回傳的結果:
4249
							#$result["status"],"true"表執行正常,"false"代表執行不正常.
4249
							#$result["status"],"true"表執行正常,"false"代表執行不正常.
4250
							#$result["error"],錯誤訊息陣列.
4250
							#$result["error"],錯誤訊息陣列.
Line 4260... Line 4260...
4260
							#無.
4260
							#無.
4261
							#備註:
4261
							#備註:
4262
							#無.
4262
							#無.
4263
							$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
4263
							$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
4264
							unset($conf["arrays::mergeArray"]);
4264
							unset($conf["arrays::mergeArray"]);
4265
							
4265
 
4266
							#如果執行失敗
4266
							#如果執行失敗
4267
							if($mergeArray["status"]==="false"){
4267
							if($mergeArray["status"]==="false"){
4268
							
4268
 
4269
								#設置錯誤識別
4269
								#設置錯誤識別
4270
								$result["status"]="false";
4270
								$result["status"]="false";
4271
								
4271
 
4272
								#設置錯誤訊息
4272
								#設置錯誤訊息
4273
								$result["error"]=$mergeArray;
4273
								$result["error"]=$mergeArray;
4274
								
4274
 
4275
								#回傳結果
4275
								#回傳結果
4276
								return $result;
4276
								return $result;
4277
							
4277
 
4278
								}#if end
4278
								}#if end
4279
								
4279
 
4280
							#取得合併好的有異動檔案結果
4280
							#取得合併好的有異動檔案結果
4281
							$result["scannedFile"]=$mergeArray["content"];
4281
							$result["scannedFile"]=$mergeArray["content"];
4282
							
4282
 
4283
							}#if end
4283
							}#if end
4284
						
4284
 
4285
						#合併 scannedFile - end
4285
						#合併 scannedFile - end
4286
					
4286
 
4287
						}#if end
4287
						}#if end
4288
					
4288
 
4289
					#反之為多執行程
4289
					#反之為多執行程
4290
					else{
4290
					else{
4291
					
4291
 
4292
						/* 
4292
						/*
4293
						
4293
 
4294
						預想的程式 - start
4294
						預想的程式 - start
4295
					
4295
 
4296
						#繼承本函式參數
4296
						#繼承本函式參數
4297
						$conf["self::updateCopyRightYear"]=$conf;
4297
						$conf["self::updateCopyRightYear"]=$conf;
4298
						
4298
 
4299
						#置換要執行的路徑
4299
						#置換要執行的路徑
4300
						$conf["self::updateCopyRightYear"]["searchPath"]=array($NodePathAndName);
4300
						$conf["self::updateCopyRightYear"]["searchPath"]=array($NodePathAndName);
4301
						
4301
 
4302
						#遞迴呼叫
4302
						#遞迴呼叫
4303
						$updateCopyRightYear=self::updateCopyRightYear($conf["self::updateCopyRightYear"]);
4303
						$updateCopyRightYear=self::updateCopyRightYear($conf["self::updateCopyRightYear"]);
4304
						
4304
 
4305
						預想的程式 - end
4305
						預想的程式 - end
4306
						
4306
 
4307
						*/
4307
						*/
4308
						
4308
 
4309
						#要執行的php程式內容
4309
						#要執行的php程式內容
4310
						$cmdString=<<<'PHP'
4310
						$cmdString=<<<'PHP'
4311
/*
4311
/*
4312
 
4312
 
4313
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
4313
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
4314
    Copyright (C) 2014~2025 MIN-ZHI, CHEN
4314
    Copyright (C) 2014~2025 MIN ZHI, CHEN
4315
 
4315
 
4316
    This file is part of QBPWCF.
4316
    This file is part of QBPWCF.
4317
 
4317
 
4318
    QBPWCF is free software: you can redistribute it and/or modify
4318
    QBPWCF is free software: you can redistribute it and/or modify
4319
    it under the terms of the GNU General Public License as published by
4319
    it under the terms of the GNU General Public License as published by
Line 4398... Line 4398...
4398
unset($conf);
4398
unset($conf);
4399
 
4399
 
4400
#輸出json結果
4400
#輸出json結果
4401
echo json_encode($updateCopyRightYear);
4401
echo json_encode($updateCopyRightYear);
4402
PHP;
4402
PHP;
4403
					
4403
 
4404
						#設置多執行序的類型
4404
						#設置多執行序的類型
4405
						$threadType=$conf["threadType"];
4405
						$threadType=$conf["threadType"];
4406
						
4406
 
4407
						#debug,break point
4407
						#debug,break point
4408
						#var_dump(__LINE__,$threadType);exit(1);
4408
						#var_dump(__LINE__,$threadType);exit(1);
4409
						
4409
 
4410
						#判斷多執行序的類型
4410
						#判斷多執行序的類型
4411
						switch($threadType){
4411
						switch($threadType){
4412
						
4412
 
4413
							#若是直接用 proc
4413
							#若是直接用 proc
4414
							case "proc":
4414
							case "proc":
4415
						
4415
 
4416
								#函式說明:
4416
								#函式說明:
4417
								#透過proc來多執行序運作.
4417
								#透過proc來多執行序運作.
4418
								#回傳結果:
4418
								#回傳結果:
4419
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4419
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4420
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
4420
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 4438... Line 4438...
4438
								#https://www.php.net/manual/en/function.proc-get-status.php
4438
								#https://www.php.net/manual/en/function.proc-get-status.php
4439
								#備註:
4439
								#備註:
4440
								#無.
4440
								#無.
4441
								$proc=threads::proc($conf["threads::proc"]);
4441
								$proc=threads::proc($conf["threads::proc"]);
4442
								unset($conf["threads::proc"]);
4442
								unset($conf["threads::proc"]);
4443
								
4443
 
4444
								#如果執行失敗
4444
								#如果執行失敗
4445
								if($proc["status"]==="false"){
4445
								if($proc["status"]==="false"){
4446
								
4446
 
4447
									#設置錯誤識別
4447
									#設置錯誤識別
4448
									$result["status"]="false";
4448
									$result["status"]="false";
4449
									
4449
 
4450
									#設置錯誤訊息
4450
									#設置錯誤訊息
4451
									$result["error"]=$proc;
4451
									$result["error"]=$proc;
4452
									
4452
 
4453
									#回傳結果
4453
									#回傳結果
4454
									return $result;
4454
									return $result;
4455
								
4455
 
4456
									}#if end
4456
									}#if end
4457
								
4457
 
4458
								#如果有開啟 log
4458
								#如果有開啟 log
4459
								if(isset($conf["log"])){
4459
								if(isset($conf["log"])){
4460
								
4460
 
4461
									#函式說明:
4461
									#函式說明:
4462
									#撰寫log
4462
									#撰寫log
4463
									#回傳結果:
4463
									#回傳結果:
4464
									#$result["status"],狀態,"true"或"false".
4464
									#$result["status"],狀態,"true"或"false".
4465
									#$result["error"],錯誤訊息陣列.
4465
									#$result["error"],錯誤訊息陣列.
Line 4479... Line 4479...
4479
									#無.
4479
									#無.
4480
									#備註:
4480
									#備註:
4481
									#無.
4481
									#無.
4482
									$record=logs::record($conf["logs::record"]);
4482
									$record=logs::record($conf["logs::record"]);
4483
									unset($conf["logs::record"]);
4483
									unset($conf["logs::record"]);
4484
									
4484
 
4485
									#如果出錯
4485
									#如果出錯
4486
									if($record["status"]==="false"){
4486
									if($record["status"]==="false"){
4487
								
4487
 
4488
										#設置錯誤識別
4488
										#設置錯誤識別
4489
										$result["status"]="false";
4489
										$result["status"]="false";
4490
										
4490
 
4491
										#設置錯誤訊息
4491
										#設置錯誤訊息
4492
										$result["error"]=$record;
4492
										$result["error"]=$record;
4493
										
4493
 
4494
										#印出json
4494
										#印出json
4495
										echo json_encode($result);
4495
										echo json_encode($result);
4496
										
4496
 
4497
										#結束執行,回傳1給shell,代表異常,
4497
										#結束執行,回傳1給shell,代表異常,
4498
										exit(1);
4498
										exit(1);
4499
								
4499
 
4500
										}#if end
4500
										}#if end
4501
									
4501
 
4502
									}#if end
4502
									}#if end
4503
								
4503
 
4504
								#儲存要執行的程序
4504
								#儲存要執行的程序
4505
								$procs[]=$proc;
4505
								$procs[]=$proc;
4506
						
4506
 
4507
								#結束 switch
4507
								#結束 switch
4508
								break;
4508
								break;
4509
								
4509
 
4510
							#如果是要透過 socket 來執行
4510
							#如果是要透過 socket 來執行
4511
							case "socket":
4511
							case "socket":
4512
							
4512
 
4513
								#函式說明:
4513
								#函式說明:
4514
								#透過 unix socket 來多執行序運作.
4514
								#透過 unix socket 來多執行序運作.
4515
								#回傳結果:
4515
								#回傳結果:
4516
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4516
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4517
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
4517
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 4528... Line 4528...
4528
								#無
4528
								#無
4529
								#備註:
4529
								#備註:
4530
								#需要透過sock::unixDomainSockServer來運行.
4530
								#需要透過sock::unixDomainSockServer來運行.
4531
								$socket=threads::socket($conf["threads::socket"]);
4531
								$socket=threads::socket($conf["threads::socket"]);
4532
								unset($conf["threads::socket"]);
4532
								unset($conf["threads::socket"]);
4533
							
4533
 
4534
								#如果執行失敗
4534
								#如果執行失敗
4535
								if($socket["status"]==="false"){
4535
								if($socket["status"]==="false"){
4536
								
4536
 
4537
									#設置錯誤識別
4537
									#設置錯誤識別
4538
									$result["status"]="false";
4538
									$result["status"]="false";
4539
									
4539
 
4540
									#設置錯誤訊息
4540
									#設置錯誤訊息
4541
									$result["error"]=$socket;
4541
									$result["error"]=$socket;
4542
									
4542
 
4543
									#回傳結果
4543
									#回傳結果
4544
									return $result;
4544
									return $result;
4545
								
4545
 
4546
									}#if end
4546
									}#if end
4547
								
4547
 
4548
								#如果有開啟 log
4548
								#如果有開啟 log
4549
								if(isset($conf["log"])){
4549
								if(isset($conf["log"])){
4550
								
4550
 
4551
									#函式說明:
4551
									#函式說明:
4552
									#撰寫log
4552
									#撰寫log
4553
									#回傳結果:
4553
									#回傳結果:
4554
									#$result["status"],狀態,"true"或"false".
4554
									#$result["status"],狀態,"true"或"false".
4555
									#$result["error"],錯誤訊息陣列.
4555
									#$result["error"],錯誤訊息陣列.
Line 4569... Line 4569...
4569
									#無.
4569
									#無.
4570
									#備註:
4570
									#備註:
4571
									#無.
4571
									#無.
4572
									$record=logs::record($conf["logs::record"]);
4572
									$record=logs::record($conf["logs::record"]);
4573
									unset($conf["logs::record"]);
4573
									unset($conf["logs::record"]);
4574
									
4574
 
4575
									#如果出錯
4575
									#如果出錯
4576
									if($record["status"]==="false"){
4576
									if($record["status"]==="false"){
4577
								
4577
 
4578
										#設置錯誤識別
4578
										#設置錯誤識別
4579
										$result["status"]="false";
4579
										$result["status"]="false";
4580
										
4580
 
4581
										#設置錯誤訊息
4581
										#設置錯誤訊息
4582
										$result["error"]=$record;
4582
										$result["error"]=$record;
4583
										
4583
 
4584
										#印出json
4584
										#印出json
4585
										echo json_encode($result);
4585
										echo json_encode($result);
4586
										
4586
 
4587
										#結束執行,回傳1給shell,代表異常,
4587
										#結束執行,回傳1給shell,代表異常,
4588
										exit(1);
4588
										exit(1);
4589
								
4589
 
4590
										}#if end
4590
										}#if end
4591
									
4591
 
4592
									}#if end
4592
									}#if end
4593
							
4593
 
4594
								#儲存要執行的程序
4594
								#儲存要執行的程序
4595
								$procs[]=$socket;
4595
								$procs[]=$socket;
4596
							
4596
 
4597
								#結束 switch
4597
								#結束 switch
4598
								break;
4598
								break;
4599
							
4599
 
4600
							#其他類型
4600
							#其他類型
4601
							default:
4601
							default:
4602
							
4602
 
4603
								#設置錯誤識別
4603
								#設置錯誤識別
4604
								$result["status"]="false";
4604
								$result["status"]="false";
4605
								
4605
 
4606
								#設置錯誤訊息
4606
								#設置錯誤訊息
4607
								$result["error"][]="not supported multi threads type ".$threadType;
4607
								$result["error"][]="not supported multi threads type ".$threadType;
4608
								
4608
 
4609
								#印出json
4609
								#印出json
4610
								echo json_encode($result);
4610
								echo json_encode($result);
4611
								
4611
 
4612
								#結束執行,回傳1給shell,代表異常,
4612
								#結束執行,回傳1給shell,代表異常,
4613
								exit(1);
4613
								exit(1);
4614
						
4614
 
4615
							}#switch end
4615
							}#switch end
4616
						
4616
 
4617
						}#else end
4617
						}#else end
4618
				
4618
 
4619
					}#if end
4619
					}#if end
4620
					
4620
 
4621
				#反之如果是檔案
4621
				#反之如果是檔案
4622
				else if($node["nType"]==="-"){
4622
				else if($node["nType"]==="-"){
4623
					
4623
 
4624
					#針對每個要忽略的 mime type
4624
					#針對每個要忽略的 mime type
4625
					foreach($conf["excludeMineType"] as $mimeType){
4625
					foreach($conf["excludeMineType"] as $mimeType){
4626
		
4626
 
4627
						#取得 "/*" 的位置
4627
						#取得 "/*" 的位置
4628
						$positionOfSlashStar=strpos($mimeType,"/*");
4628
						$positionOfSlashStar=strpos($mimeType,"/*");
4629
		
4629
 
4630
						#如果是含有 "/*" 的廣義 mime 類型
4630
						#如果是含有 "/*" 的廣義 mime 類型
4631
						if($positionOfSlashStar!==false){
4631
						if($positionOfSlashStar!==false){
4632
						
4632
 
4633
							#取得 廣義類型的內容
4633
							#取得 廣義類型的內容
4634
							$ignoredWileMimeTypeWithSlash=substr($mimeType,0,$positionOfSlashStar+1);
4634
							$ignoredWileMimeTypeWithSlash=substr($mimeType,0,$positionOfSlashStar+1);
4635
						
4635
 
4636
							#debug
4636
							#debug
4637
							#var_dump(__LINE__,$ignoredWileMimeTypeWithSlash);
4637
							#var_dump(__LINE__,$ignoredWileMimeTypeWithSlash);
4638
						
4638
 
4639
							#如果是要忽略的 廣義類型內容
4639
							#如果是要忽略的 廣義類型內容
4640
							if(strpos($node["mimeType"],$ignoredWileMimeTypeWithSlash)===0){
4640
							if(strpos($node["mimeType"],$ignoredWileMimeTypeWithSlash)===0){
4641
							
4641
 
4642
								#跳過之
4642
								#跳過之
4643
								continue 2;
4643
								continue 2;
4644
							
4644
 
4645
								}#if end
4645
								}#if end
4646
						
4646
 
4647
							}#if end
4647
							}#if end
4648
					
4648
 
4649
						#反之
4649
						#反之
4650
						else{
4650
						else{
4651
						
4651
 
4652
							#如果是要忽略的 mime 類型
4652
							#如果是要忽略的 mime 類型
4653
							if($mimeType===$node["mimeType"]){
4653
							if($mimeType===$node["mimeType"]){
4654
							
4654
 
4655
								#跳過之
4655
								#跳過之
4656
								continue 2;
4656
								continue 2;
4657
								
4657
 
4658
								}#if end
4658
								}#if end
4659
						
4659
 
4660
							}#else end
4660
							}#else end
4661
					
4661
 
4662
						}#foreach end
4662
						}#foreach end
4663
						
4663
 
4664
					#如果有副檔案名存在
4664
					#如果有副檔案名存在
4665
					if(isset($node["secondName"])){
4665
					if(isset($node["secondName"])){
4666
					
4666
 
4667
						#如果是要忽略的附檔名
4667
						#如果是要忽略的附檔名
4668
						if(in_array($node["secondName"],$conf["excludeSecondName"])){
4668
						if(in_array($node["secondName"],$conf["excludeSecondName"])){
4669
						
4669
 
4670
							#跳過檔案
4670
							#跳過檔案
4671
							continue;
4671
							continue;
4672
						
4672
 
4673
							}#if end
4673
							}#if end
4674
					
4674
 
4675
						}#if end
4675
						}#if end
4676
					
4676
 
4677
					#記錄有掃描的檔案路徑與名稱 
4677
					#記錄有掃描的檔案路徑與名稱
4678
					$result["scannedFile"][]=$NodePathAndName;
4678
					$result["scannedFile"][]=$NodePathAndName;
4679
					
4679
 
4680
					#debug
4680
					#debug
4681
					#var_dump(__LINE__,"found file:".$NodePathAndName." mimeType:".$node["mimeType"]);
4681
					#var_dump(__LINE__,"found file:".$NodePathAndName." mimeType:".$node["mimeType"]);
4682
				
4682
 
4683
					#如果沒有用多執行序
4683
					#如果沒有用多執行序
4684
					if($conf["multiThread"]==="false"){
4684
					if($conf["multiThread"]==="false"){
4685
					
4685
 
4686
						#設置起始年份
4686
						#設置起始年份
4687
						$replaceTo[1]["yearFrom"]=$conf["yearFrom"];
4687
						$replaceTo[1]["yearFrom"]=$conf["yearFrom"];
4688
						
4688
 
4689
						#設置到的年份
4689
						#設置到的年份
4690
						$replaceTo[1]["yearTo"]=$conf["yearTo"];
4690
						$replaceTo[1]["yearTo"]=$conf["yearTo"];
4691
						
4691
 
4692
						#將作者陣列變成字串.
4692
						#將作者陣列變成字串.
4693
						#函式說明:
4693
						#函式說明:
4694
						#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
4694
						#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
4695
						#回傳的結果:
4695
						#回傳的結果:
4696
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4696
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4712... Line 4712...
4712
						#無.
4712
						#無.
4713
						#備註:
4713
						#備註:
4714
						#無.
4714
						#無.
4715
						$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
4715
						$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
4716
						unset($conf["arrays::arrayToString"]);
4716
						unset($conf["arrays::arrayToString"]);
4717
						
4717
 
4718
						#如果執行異常
4718
						#如果執行異常
4719
						if($arrayToString["status"]==="false"){
4719
						if($arrayToString["status"]==="false"){
4720
						
4720
 
4721
							#設置執行異常的識別
4721
							#設置執行異常的識別
4722
							$result["status"]="false";
4722
							$result["status"]="false";
4723
						
4723
 
4724
							#設置執行錯誤訊息
4724
							#設置執行錯誤訊息
4725
							$result["error"]=$arrayToString;
4725
							$result["error"]=$arrayToString;
4726
							
4726
 
4727
							#回傳結果
4727
							#回傳結果
4728
							return $result;
4728
							return $result;
4729
						
4729
 
4730
							}#if end
4730
							}#if end
4731
						
4731
 
4732
						#設置作者清單字串
4732
						#設置作者清單字串
4733
						$replaceTo[1]["Authors"]=$arrayToString["content"];
4733
						$replaceTo[1]["Authors"]=$arrayToString["content"];
4734
					
4734
 
4735
						#函式說明:
4735
						#函式說明:
4736
						#置換檔案內容中符合的內容.
4736
						#置換檔案內容中符合的內容.
4737
						#回傳結果:
4737
						#回傳結果:
4738
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4738
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4739
						#$reuslt["error"],執行不正常結束的錯訊息陣列.
4739
						#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 4761... Line 4761...
4761
						#備註:
4761
						#備註:
4762
						#參數設定 $conf["replaceTo"][$i]=$replaceStr; 代表符合格式的連續字串中的 $i+1 行內容要置換成 $replaceStr.
4762
						#參數設定 $conf["replaceTo"][$i]=$replaceStr; 代表符合格式的連續字串中的 $i+1 行內容要置換成 $replaceStr.
4763
						#參數設定 $conf["replaceTo"][$i]=array("varName1"=>$replaceStr1,"varName2"=>$replaceStr2); 代表符合格式的連續字串中的 $i+1 行內容中的變數 varName1 要置換成 $replaceStr1;變數 varName2 要置換成 $replaceStr2.
4763
						#參數設定 $conf["replaceTo"][$i]=array("varName1"=>$replaceStr1,"varName2"=>$replaceStr2); 代表符合格式的連續字串中的 $i+1 行內容中的變數 varName1 要置換成 $replaceStr1;變數 varName2 要置換成 $replaceStr2.
4764
						$replaceMatchContent=phpLib::replaceMatchContent($conf["phpLib::replaceMatchContent"]);
4764
						$replaceMatchContent=phpLib::replaceMatchContent($conf["phpLib::replaceMatchContent"]);
4765
						unset($conf["phpLib::replaceMatchContent"]);
4765
						unset($conf["phpLib::replaceMatchContent"]);
4766
					
4766
 
4767
						#如果執行異常
4767
						#如果執行異常
4768
						if($replaceMatchContent["status"]==="false"){
4768
						if($replaceMatchContent["status"]==="false"){
4769
						
4769
 
4770
							#設置執行異常的識別
4770
							#設置執行異常的識別
4771
							$result["status"]="false";
4771
							$result["status"]="false";
4772
						
4772
 
4773
							#設置執行錯誤訊息
4773
							#設置執行錯誤訊息
4774
							$result["error"]=$replaceMatchContent;
4774
							$result["error"]=$replaceMatchContent;
4775
							
4775
 
4776
							#回傳結果
4776
							#回傳結果
4777
							return $result;
4777
							return $result;
4778
						
4778
 
4779
							}#if end
4779
							}#if end
4780
						
4780
 
4781
						#如果有需要更新檔案內容的識別
4781
						#如果有需要更新檔案內容的識別
4782
						if($replaceMatchContent["found"]==="true"){
4782
						if($replaceMatchContent["found"]==="true"){
4783
						
4783
 
4784
							#$replaceMatchContent["relaceInfo"][$i]["new"],第 $i+1 行的新內容.
4784
							#$replaceMatchContent["relaceInfo"][$i]["new"],第 $i+1 行的新內容.
4785
						
4785
 
4786
							#初始化給予 fileAccess::updateFile 的參數
4786
							#初始化給予 fileAccess::updateFile 的參數
4787
							$replaceSpecifyLine=array();
4787
							$replaceSpecifyLine=array();
4788
						
4788
 
4789
							#針對每個要更新的行
4789
							#針對每個要更新的行
4790
							foreach($replaceMatchContent["relaceInfo"] as $lineIndex => $info){
4790
							foreach($replaceMatchContent["relaceInfo"] as $lineIndex => $info){
4791
							
4791
 
4792
								#設置給予 fileAccess::updateFile 的參數
4792
								#設置給予 fileAccess::updateFile 的參數
4793
								$replaceSpecifyLine[$lineIndex]=$info["new"];
4793
								$replaceSpecifyLine[$lineIndex]=$info["new"];
4794
							
4794
 
4795
								}#foreach end
4795
								}#foreach end
4796
						
4796
 
4797
							#更新檔案內容
4797
							#更新檔案內容
4798
							#函式說明:
4798
							#函式說明:
4799
							#更新檔案的內容.
4799
							#更新檔案的內容.
4800
							#回傳結果:
4800
							#回傳結果:
4801
							#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4801
							#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4826... Line 4826...
4826
							#無.
4826
							#無.
4827
							#備註:
4827
							#備註:
4828
							#無.
4828
							#無.
4829
							$updateFile=fileAccess::updateFile($conf["fileAccess::updateFile"]);
4829
							$updateFile=fileAccess::updateFile($conf["fileAccess::updateFile"]);
4830
							unset($conf["fileAccess::updateFile"]);
4830
							unset($conf["fileAccess::updateFile"]);
4831
						
4831
 
4832
							#如果出錯
4832
							#如果出錯
4833
							if($updateFile["status"]==="false"){
4833
							if($updateFile["status"]==="false"){
4834
						
4834
 
4835
								#設置錯誤識別
4835
								#設置錯誤識別
4836
								$result["status"]="false";
4836
								$result["status"]="false";
4837
								
4837
 
4838
								#設置錯誤訊息
4838
								#設置錯誤訊息
4839
								$result["error"]=$updateFile;
4839
								$result["error"]=$updateFile;
4840
								
4840
 
4841
								#回傳結果
4841
								#回傳結果
4842
								return $result;
4842
								return $result;
4843
						
4843
 
4844
								}#if end
4844
								}#if end
4845
								
4845
 
4846
							#如果沒有既有的記錄
4846
							#如果沒有既有的記錄
4847
							if(!isset($result["content"][$NodePathAndName])){
4847
							if(!isset($result["content"][$NodePathAndName])){
4848
							
4848
 
4849
								#記錄有更新的檔案路徑與名稱與其次數為1
4849
								#記錄有更新的檔案路徑與名稱與其次數為1
4850
								$result["content"][$NodePathAndName]["time"]=1;
4850
								$result["content"][$NodePathAndName]["time"]=1;
4851
							
4851
 
4852
								}#if end
4852
								}#if end
4853
							
4853
 
4854
							#反之
4854
							#反之
4855
							else{
4855
							else{
4856
							
4856
 
4857
								#記錄有更新的檔案路徑與名稱與的次數+1
4857
								#記錄有更新的檔案路徑與名稱與的次數+1
4858
								$result["content"][$NodePathAndName]["time"]++;
4858
								$result["content"][$NodePathAndName]["time"]++;
4859
							
4859
 
4860
								}#else end
4860
								}#else end
4861
							
4861
 
4862
							#記錄更新的相關資訊,用太多記憶體.
4862
							#記錄更新的相關資訊,用太多記憶體.
4863
							#$result["content"][$NodePathAndName]["replacedInfo"]=$updateFile["content"];
4863
							#$result["content"][$NodePathAndName]["replacedInfo"]=$updateFile["content"];
4864
						
4864
 
4865
							}#if end
4865
							}#if end
4866
					
4866
 
4867
						}#if end
4867
						}#if end
4868
						
4868
 
4869
					#反之為多執行序
4869
					#反之為多執行序
4870
					else{
4870
					else{
4871
					
4871
 
4872
						#...
4872
						#...
4873
						#待實作
4873
						#待實作
4874
					
4874
 
4875
						}#else end
4875
						}#else end
4876
						
4876
 
4877
					}#if end
4877
					}#if end
4878
					
4878
 
4879
				}#foreach end
4879
				}#foreach end
4880
			
4880
 
4881
			}#foreach end
4881
			}#foreach end
4882
		
4882
 
4883
		#debug
4883
		#debug
4884
		#var_dump(__FUNCTION__,__LINE__,print_r($conf,true));exit;
4884
		#var_dump(__FUNCTION__,__LINE__,print_r($conf,true));exit;
4885
		
4885
 
4886
		#如果有啟用多執行序
4886
		#如果有啟用多執行序
4887
		if($conf["multiThread"]==="true"){
4887
		if($conf["multiThread"]==="true"){
4888
			
4888
 
4889
			#debug
4889
			#debug
4890
			#var_dump($conf);exit;
4890
			#var_dump($conf);exit;
4891
			
4891
 
4892
			#如果有執行的程序要確認回饋
4892
			#如果有執行的程序要確認回饋
4893
			if(isset($procs)){
4893
			if(isset($procs)){
4894
			
4894
 
4895
				#debug
4895
				#debug
4896
				#var_dump($procs);exit;
4896
				#var_dump($procs);exit;
4897
			
4897
 
4898
				#如果有要log
4898
				#如果有要log
4899
				if(isset($conf["log"])){
4899
				if(isset($conf["log"])){
4900
			
4900
 
4901
					#log for run time of start and end info
4901
					#log for run time of start and end info
4902
					$logPathForRunTimeOfStartAndEnd="/tmp/".basename($conf["log"]).":".$uuid."-runTimeOfStartAndEnd.log";
4902
					$logPathForRunTimeOfStartAndEnd="/tmp/".basename($conf["log"]).":".$uuid."-runTimeOfStartAndEnd.log";
4903
					
4903
 
4904
					#函式說明:
4904
					#函式說明:
4905
					#撰寫log
4905
					#撰寫log
4906
					#回傳結果:
4906
					#回傳結果:
4907
					#$result["status"],狀態,"true"或"false".
4907
					#$result["status"],狀態,"true"或"false".
4908
					#$result["error"],錯誤訊息陣列.
4908
					#$result["error"],錯誤訊息陣列.
Line 4922... Line 4922...
4922
					#無.
4922
					#無.
4923
					#備註:
4923
					#備註:
4924
					#無.
4924
					#無.
4925
					$record=logs::record($conf["logs::record"]);
4925
					$record=logs::record($conf["logs::record"]);
4926
					unset($conf["logs::record"]);
4926
					unset($conf["logs::record"]);
4927
				
4927
 
4928
					#如果出錯
4928
					#如果出錯
4929
					if($record["status"]==="false"){
4929
					if($record["status"]==="false"){
4930
				
4930
 
4931
						#設置錯誤識別
4931
						#設置錯誤識別
4932
						$result["status"]="false";
4932
						$result["status"]="false";
4933
						
4933
 
4934
						#設置錯誤訊息
4934
						#設置錯誤訊息
4935
						$result["error"]=$record;
4935
						$result["error"]=$record;
4936
						
4936
 
4937
						#印出json
4937
						#印出json
4938
						echo json_encode($result);
4938
						echo json_encode($result);
4939
						
4939
 
4940
						#結束執行,回傳1給shell,代表異常,
4940
						#結束執行,回傳1給shell,代表異常,
4941
						exit(1);
4941
						exit(1);
4942
				
4942
 
4943
						}#if end
4943
						}#if end
4944
						
4944
 
4945
					}#if end
4945
					}#if end
4946
				
4946
 
4947
				#無窮迴圈
4947
				#無窮迴圈
4948
				while(true){
4948
				while(true){
4949
				
4949
 
4950
					#如果有開啟 log
4950
					#如果有開啟 log
4951
					if(isset($conf["log"])){
4951
					if(isset($conf["log"])){
4952
					
4952
 
4953
						#要記錄的log
4953
						#要記錄的log
4954
						$log="There are ".count($procs)." process under path of ".$conf["searchPath"][0]." unend.".PHP_EOL;
4954
						$log="There are ".count($procs)." process under path of ".$conf["searchPath"][0]." unend.".PHP_EOL;
4955
					
4955
 
4956
						#log的路徑與名稱
4956
						#log的路徑與名稱
4957
						$path="/tmp/".basename($conf["log"]).":".$uuid.".log";
4957
						$path="/tmp/".basename($conf["log"]).":".$uuid.".log";
4958
					
4958
 
4959
						#log for latest running 的路徑與名稱
4959
						#log for latest running 的路徑與名稱
4960
						$logPathForLatestRunning="/tmp/".basename($conf["log"]).":".$uuid."-latest.log";
4960
						$logPathForLatestRunning="/tmp/".basename($conf["log"]).":".$uuid."-latest.log";
4961
						
4961
 
4962
						#函式說明:
4962
						#函式說明:
4963
						#撰寫log
4963
						#撰寫log
4964
						#回傳結果:
4964
						#回傳結果:
4965
						#$result["status"],狀態,"true"或"false".
4965
						#$result["status"],狀態,"true"或"false".
4966
						#$result["error"],錯誤訊息陣列.
4966
						#$result["error"],錯誤訊息陣列.
Line 4980... Line 4980...
4980
						#無.
4980
						#無.
4981
						#備註:
4981
						#備註:
4982
						#無.
4982
						#無.
4983
						$record=logs::record($conf["logs::record"]);
4983
						$record=logs::record($conf["logs::record"]);
4984
						unset($conf["logs::record"]);
4984
						unset($conf["logs::record"]);
4985
					
4985
 
4986
						#如果出錯
4986
						#如果出錯
4987
						if($record["status"]==="false"){
4987
						if($record["status"]==="false"){
4988
					
4988
 
4989
							#設置錯誤識別
4989
							#設置錯誤識別
4990
							$result["status"]="false";
4990
							$result["status"]="false";
4991
							
4991
 
4992
							#設置錯誤訊息
4992
							#設置錯誤訊息
4993
							$result["error"]=$record;
4993
							$result["error"]=$record;
4994
							
4994
 
4995
							#印出json
4995
							#印出json
4996
							echo json_encode($result);
4996
							echo json_encode($result);
4997
							
4997
 
4998
							#結束執行,回傳1給shell,代表異常,
4998
							#結束執行,回傳1給shell,代表異常,
4999
							exit(1);
4999
							exit(1);
5000
					
5000
 
5001
							}#if end
5001
							}#if end
5002
					
5002
 
5003
						}#if end
5003
						}#if end
5004
					
5004
 
5005
					#針對每個要確認的程序
5005
					#針對每個要確認的程序
5006
					foreach($procs as $procIndex => $procValue){
5006
					foreach($procs as $procIndex => $procValue){
5007
						
5007
 
5008
						#判斷多執行序的類型
5008
						#判斷多執行序的類型
5009
						switch($threadType){
5009
						switch($threadType){
5010
						
5010
 
5011
							#如果是直接透過 proc
5011
							#如果是直接透過 proc
5012
							case "proc":
5012
							case "proc":
5013
							
5013
 
5014
								#函式說明:
5014
								#函式說明:
5015
								#更新透過proc執行的多程序資訊.
5015
								#更新透過proc執行的多程序資訊.
5016
								#回傳結果:
5016
								#回傳結果:
5017
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5017
								#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5018
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
5018
								#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 5028... Line 5028...
5028
								#無.
5028
								#無.
5029
								#備註:
5029
								#備註:
5030
								#無.
5030
								#無.
5031
								$proc_update=threads::proc_update($conf["threads::proc_update"]);
5031
								$proc_update=threads::proc_update($conf["threads::proc_update"]);
5032
								unset($conf["threads::proc_update"]);
5032
								unset($conf["threads::proc_update"]);
5033
								
5033
 
5034
								#如果執行失敗
5034
								#如果執行失敗
5035
								if($proc_update["status"]==="false"){
5035
								if($proc_update["status"]==="false"){
5036
								
5036
 
5037
									#關閉程序
5037
									#關閉程序
5038
									proc_close($procs[$procIndex]["content"][0]["process"]);
5038
									proc_close($procs[$procIndex]["content"][0]["process"]);
5039
								
5039
 
5040
									#設置錯誤識別
5040
									#設置錯誤識別
5041
									$result["status"]="false";
5041
									$result["status"]="false";
5042
									
5042
 
5043
									#設置錯誤訊息
5043
									#設置錯誤訊息
5044
									$result["error"]=$procValue;
5044
									$result["error"]=$procValue;
5045
									
5045
 
5046
									#印出json
5046
									#印出json
5047
									echo json_encode($result);
5047
									echo json_encode($result);
5048
									
5048
 
5049
									#卸除異常的程序
5049
									#卸除異常的程序
5050
									unset($procs[$procIndex]);
5050
									unset($procs[$procIndex]);
5051
									
5051
 
5052
									#結束執行,回傳1給shell,代表異常,
5052
									#結束執行,回傳1給shell,代表異常,
5053
									exit(1);
5053
									exit(1);
5054
								
5054
 
5055
									}#if end
5055
									}#if end
5056
								
5056
 
5057
								#debug
5057
								#debug
5058
								#var_dump($procValue["content"][0]["statusCode"]);exit;
5058
								#var_dump($procValue["content"][0]["statusCode"]);exit;
5059
								
5059
 
5060
								#如果執行失敗
5060
								#如果執行失敗
5061
								if($procValue["content"][0]["status"]==="false"){
5061
								if($procValue["content"][0]["status"]==="false"){
5062
								
5062
 
5063
									#關閉程序
5063
									#關閉程序
5064
									proc_close($procs[$procIndex]["content"][0]["process"]);
5064
									proc_close($procs[$procIndex]["content"][0]["process"]);
5065
									
5065
 
5066
									#設置錯誤識別
5066
									#設置錯誤識別
5067
									$result["status"]="false";
5067
									$result["status"]="false";
5068
									
5068
 
5069
									#設置錯誤訊息
5069
									#設置錯誤訊息
5070
									$result["error"]=$procValue;
5070
									$result["error"]=$procValue;
5071
									
5071
 
5072
									#印出json
5072
									#印出json
5073
									echo json_encode($result);
5073
									echo json_encode($result);
5074
									
5074
 
5075
									#卸除異常的程序
5075
									#卸除異常的程序
5076
									unset($procs[$procIndex]);
5076
									unset($procs[$procIndex]);
5077
									
5077
 
5078
									#結束執行,回傳1給shell,代表異常,
5078
									#結束執行,回傳1給shell,代表異常,
5079
									exit(1);
5079
									exit(1);
5080
								
5080
 
5081
									}#if end
5081
									}#if end
5082
								
5082
 
5083
								#如果可能尚在執行中
5083
								#如果可能尚在執行中
5084
								if($procValue["content"][0]["statusCode"]==="?"){
5084
								if($procValue["content"][0]["statusCode"]==="?"){
5085
								
5085
 
5086
									#debug
5086
									#debug
5087
									#var_dump($procValue["content"][0]["statusCode"]);exit(1);
5087
									#var_dump($procValue["content"][0]["statusCode"]);exit(1);
5088
								
5088
 
5089
									#如果有要log
5089
									#如果有要log
5090
									if(isset($conf["log"])){
5090
									if(isset($conf["log"])){
5091
										
5091
 
5092
										#要記錄的log
5092
										#要記錄的log
5093
										$log=$procValue["content"][0];
5093
										$log=$procValue["content"][0];
5094
									
5094
 
5095
										#函式說明:
5095
										#函式說明:
5096
										#撰寫log
5096
										#撰寫log
5097
										#回傳結果:
5097
										#回傳結果:
5098
										#$result["status"],狀態,"true"或"false".
5098
										#$result["status"],狀態,"true"或"false".
5099
										#$result["error"],錯誤訊息陣列.
5099
										#$result["error"],錯誤訊息陣列.
Line 5113... Line 5113...
5113
										#無.
5113
										#無.
5114
										#備註:
5114
										#備註:
5115
										#無.
5115
										#無.
5116
										$record=logs::record($conf["logs::record"]);
5116
										$record=logs::record($conf["logs::record"]);
5117
										unset($conf["logs::record"]);
5117
										unset($conf["logs::record"]);
5118
									
5118
 
5119
										#如果出錯
5119
										#如果出錯
5120
										if($record["status"]==="false"){
5120
										if($record["status"]==="false"){
5121
									
5121
 
5122
											#關閉程序
5122
											#關閉程序
5123
											proc_close($procs[$procIndex]["content"][0]["process"]);
5123
											proc_close($procs[$procIndex]["content"][0]["process"]);
5124
											
5124
 
5125
											#卸除異常的程序
5125
											#卸除異常的程序
5126
											unset($procs[$procIndex]);
5126
											unset($procs[$procIndex]);
5127
									
5127
 
5128
											#設置錯誤識別
5128
											#設置錯誤識別
5129
											$result["status"]="false";
5129
											$result["status"]="false";
5130
											
5130
 
5131
											#設置錯誤訊息
5131
											#設置錯誤訊息
5132
											$result["error"]=$record;
5132
											$result["error"]=$record;
5133
											
5133
 
5134
											#印出json
5134
											#印出json
5135
											echo json_encode($result);
5135
											echo json_encode($result);
5136
											
5136
 
5137
											#結束執行,回傳1給shell,代表異常,
5137
											#結束執行,回傳1給shell,代表異常,
5138
											exit(1);
5138
											exit(1);
5139
									
5139
 
5140
											}#if end
5140
											}#if end
5141
									
5141
 
5142
										}#if end
5142
										}#if end
5143
									
5143
 
5144
									#$result["content"],陣列,每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
5144
									#$result["content"],陣列,每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
5145
									
5145
 
5146
									#如果錯誤訊息目前為resource,亦即pipe
5146
									#如果錯誤訊息目前為resource,亦即pipe
5147
									if(gettype($procValue["content"][0]["error"])==="resource"){
5147
									if(gettype($procValue["content"][0]["error"])==="resource"){
5148
									
5148
 
5149
										#取得錯誤輸出
5149
										#取得錯誤輸出
5150
										$stderr=stream_get_contents($procValue["content"][0]["error"]);
5150
										$stderr=stream_get_contents($procValue["content"][0]["error"]);
5151
									
5151
 
5152
										#如果有錯誤訊息存在
5152
										#如果有錯誤訊息存在
5153
										if(!empty($stderr)){
5153
										if(!empty($stderr)){
5154
										
5154
 
5155
											#如果有要log
5155
											#如果有要log
5156
											if(isset($conf["log"])){
5156
											if(isset($conf["log"])){
5157
											
5157
 
5158
												#要記錄的log
5158
												#要記錄的log
5159
												$log=$stderr;
5159
												$log=$stderr;
5160
											
5160
 
5161
												#函式說明:
5161
												#函式說明:
5162
												#撰寫log
5162
												#撰寫log
5163
												#回傳結果:
5163
												#回傳結果:
5164
												#$result["status"],狀態,"true"或"false".
5164
												#$result["status"],狀態,"true"或"false".
5165
												#$result["error"],錯誤訊息陣列.
5165
												#$result["error"],錯誤訊息陣列.
Line 5179... Line 5179...
5179
												#無.
5179
												#無.
5180
												#備註:
5180
												#備註:
5181
												#無.
5181
												#無.
5182
												$record=logs::record($conf["logs::record"]);
5182
												$record=logs::record($conf["logs::record"]);
5183
												unset($conf["logs::record"]);
5183
												unset($conf["logs::record"]);
5184
											
5184
 
5185
												#如果出錯
5185
												#如果出錯
5186
												if($record["status"]==="false"){
5186
												if($record["status"]==="false"){
5187
											
5187
 
5188
													#關閉程序
5188
													#關閉程序
5189
													proc_close($procs[$procIndex]["content"][0]["process"]);
5189
													proc_close($procs[$procIndex]["content"][0]["process"]);
5190
													
5190
 
5191
													#設置錯誤識別
5191
													#設置錯誤識別
5192
													$result["status"]="false";
5192
													$result["status"]="false";
5193
													
5193
 
5194
													#設置錯誤訊息
5194
													#設置錯誤訊息
5195
													$result["error"]=$record;
5195
													$result["error"]=$record;
5196
													
5196
 
5197
													#印出json
5197
													#印出json
5198
													echo json_encode($result);
5198
													echo json_encode($result);
5199
													
5199
 
5200
													#卸除異常的程序
5200
													#卸除異常的程序
5201
													unset($procs[$procIndex]);
5201
													unset($procs[$procIndex]);
5202
													
5202
 
5203
													#結束執行,回傳1給shell,代表異常,
5203
													#結束執行,回傳1給shell,代表異常,
5204
													exit(1);
5204
													exit(1);
5205
											
5205
 
5206
													}#if end
5206
													}#if end
5207
													
5207
 
5208
												#關閉程序
5208
												#關閉程序
5209
												proc_close($procs[$procIndex]["content"][0]["process"]);
5209
												proc_close($procs[$procIndex]["content"][0]["process"]);
5210
												
5210
 
5211
												#設置錯誤識別
5211
												#設置錯誤識別
5212
												$result["status"]="false";
5212
												$result["status"]="false";
5213
												
5213
 
5214
												#設置錯誤訊息
5214
												#設置錯誤訊息
5215
												$result["error"][]=$record;
5215
												$result["error"][]=$record;
5216
												
5216
 
5217
												#設置錯誤訊息
5217
												#設置錯誤訊息
5218
												$result["error"][]=$stderr;
5218
												$result["error"][]=$stderr;
5219
												
5219
 
5220
												#印出json
5220
												#印出json
5221
												echo json_encode($result);
5221
												echo json_encode($result);
5222
												
5222
 
5223
												#卸除異常的程序
5223
												#卸除異常的程序
5224
												unset($procs[$procIndex]);
5224
												unset($procs[$procIndex]);
5225
												
5225
 
5226
												#結束執行,回傳1給shell,代表異常,
5226
												#結束執行,回傳1給shell,代表異常,
5227
												exit(1);
5227
												exit(1);
5228
											
5228
 
5229
												}#if end
5229
												}#if end
5230
										
5230
 
5231
											}#if ene
5231
											}#if ene
5232
									
5232
 
5233
										}#if end
5233
										}#if end
5234
								
5234
 
5235
									#反之為字串
5235
									#反之為字串
5236
									else{
5236
									else{
5237
										
5237
 
5238
										#取得錯誤輸出
5238
										#取得錯誤輸出
5239
										$stderr=$procValue["content"][0]["error"];
5239
										$stderr=$procValue["content"][0]["error"];
5240
										
5240
 
5241
										#如果有錯誤訊息存在
5241
										#如果有錯誤訊息存在
5242
										if(!empty($stderr)){
5242
										if(!empty($stderr)){
5243
										
5243
 
5244
											#如果有要log
5244
											#如果有要log
5245
											if(isset($conf["log"])){
5245
											if(isset($conf["log"])){
5246
											
5246
 
5247
												#要記錄的log
5247
												#要記錄的log
5248
												$log=$stderr;
5248
												$log=$stderr;
5249
											
5249
 
5250
												#函式說明:
5250
												#函式說明:
5251
												#撰寫log
5251
												#撰寫log
5252
												#回傳結果:
5252
												#回傳結果:
5253
												#$result["status"],狀態,"true"或"false".
5253
												#$result["status"],狀態,"true"或"false".
5254
												#$result["error"],錯誤訊息陣列.
5254
												#$result["error"],錯誤訊息陣列.
Line 5268... Line 5268...
5268
												#無.
5268
												#無.
5269
												#備註:
5269
												#備註:
5270
												#無.
5270
												#無.
5271
												$record=logs::record($conf["logs::record"]);
5271
												$record=logs::record($conf["logs::record"]);
5272
												unset($conf["logs::record"]);
5272
												unset($conf["logs::record"]);
5273
											
5273
 
5274
												#如果出錯
5274
												#如果出錯
5275
												if($record["status"]==="false"){
5275
												if($record["status"]==="false"){
5276
											
5276
 
5277
													#關閉程序
5277
													#關閉程序
5278
													proc_close($procs[$procIndex]["content"][0]["process"]);
5278
													proc_close($procs[$procIndex]["content"][0]["process"]);
5279
													
5279
 
5280
													#設置錯誤識別
5280
													#設置錯誤識別
5281
													$result["status"]="false";
5281
													$result["status"]="false";
5282
													
5282
 
5283
													#設置錯誤訊息
5283
													#設置錯誤訊息
5284
													$result["error"]=$record;
5284
													$result["error"]=$record;
5285
													
5285
 
5286
													#印出json
5286
													#印出json
5287
													echo json_encode($result);
5287
													echo json_encode($result);
5288
													
5288
 
5289
													#卸除異常的程序
5289
													#卸除異常的程序
5290
													unset($procs[$procIndex]);
5290
													unset($procs[$procIndex]);
5291
													
5291
 
5292
													#結束執行,回傳1給shell,代表異常,
5292
													#結束執行,回傳1給shell,代表異常,
5293
													exit(1);
5293
													exit(1);
5294
											
5294
 
5295
													}#if end
5295
													}#if end
5296
													
5296
 
5297
												#關閉程序
5297
												#關閉程序
5298
												proc_close($procs[$procIndex]["content"][0]["process"]);
5298
												proc_close($procs[$procIndex]["content"][0]["process"]);
5299
												
5299
 
5300
												#設置錯誤識別
5300
												#設置錯誤識別
5301
												$result["status"]="false";
5301
												$result["status"]="false";
5302
												
5302
 
5303
												#設置錯誤訊息
5303
												#設置錯誤訊息
5304
												$result["error"][]=$record;
5304
												$result["error"][]=$record;
5305
												
5305
 
5306
												#設置錯誤訊息
5306
												#設置錯誤訊息
5307
												$result["error"][]=$stderr;
5307
												$result["error"][]=$stderr;
5308
												
5308
 
5309
												#印出json
5309
												#印出json
5310
												echo json_encode($result);
5310
												echo json_encode($result);
5311
												
5311
 
5312
												#卸除異常的程序
5312
												#卸除異常的程序
5313
												unset($procs[$procIndex]);
5313
												unset($procs[$procIndex]);
5314
												
5314
 
5315
												#結束執行,回傳1給shell,代表異常,
5315
												#結束執行,回傳1給shell,代表異常,
5316
												exit(1);
5316
												exit(1);
5317
											
5317
 
5318
												}#if end
5318
												}#if end
5319
										
5319
 
5320
											}#if ene
5320
											}#if ene
5321
									
5321
 
5322
										}#else end
5322
										}#else end
5323
								
5323
 
5324
									#跳過該子程序
5324
									#跳過該子程序
5325
									continue 2;
5325
									continue 2;
5326
								
5326
 
5327
									}#if end
5327
									}#if end
5328
								
5328
 
5329
								#反之可能為執行結束了,且執行異常
5329
								#反之可能為執行結束了,且執行異常
5330
								else if($procValue["content"][0]["statusCode"]!==0){
5330
								else if($procValue["content"][0]["statusCode"]!==0){
5331
								
5331
 
5332
									#關閉程序
5332
									#關閉程序
5333
									proc_close($procs[$procIndex]["content"][0]["process"]);
5333
									proc_close($procs[$procIndex]["content"][0]["process"]);
5334
								
5334
 
5335
									#設置錯誤識別
5335
									#設置錯誤識別
5336
									$result["status"]="false";
5336
									$result["status"]="false";
5337
									
5337
 
5338
									#設置錯誤訊息
5338
									#設置錯誤訊息
5339
									$result["error"]=$procValue;
5339
									$result["error"]=$procValue;
5340
									
5340
 
5341
									#印出json
5341
									#印出json
5342
									echo json_encode($result);
5342
									echo json_encode($result);
5343
									
5343
 
5344
									#卸除異常的程序
5344
									#卸除異常的程序
5345
									unset($procs[$procIndex]);
5345
									unset($procs[$procIndex]);
5346
									
5346
 
5347
									#結束執行,回傳1給shell,代表異常,
5347
									#結束執行,回傳1給shell,代表異常,
5348
									exit(1);
5348
									exit(1);
5349
								
5349
 
5350
									}#if end
5350
									}#if end
5351
								
5351
 
5352
								#反之執行正常
5352
								#反之執行正常
5353
								else{
5353
								else{
5354
								
5354
 
5355
									#debug
5355
									#debug
5356
									#var_dump($procValue["content"][0]["statusCode"]);
5356
									#var_dump($procValue["content"][0]["statusCode"]);
5357
								
5357
 
5358
									#儲存程序執行的標準輸出
5358
									#儲存程序執行的標準輸出
5359
									$threadStdOut=$procValue["content"][0]["content"];
5359
									$threadStdOut=$procValue["content"][0]["content"];
5360
								
5360
 
5361
									#如果標準輸出不是json
5361
									#如果標準輸出不是json
5362
									if(json_validate($threadStdOut)===false){
5362
									if(json_validate($threadStdOut)===false){
5363
									
5363
 
5364
										#關閉程序
5364
										#關閉程序
5365
										proc_close($procs[$procIndex]["content"][0]["process"]);
5365
										proc_close($procs[$procIndex]["content"][0]["process"]);
5366
										
5366
 
5367
										#設置錯誤識別
5367
										#設置錯誤識別
5368
										$result["status"]="false";
5368
										$result["status"]="false";
5369
										
5369
 
5370
										#設置錯誤訊息
5370
										#設置錯誤訊息
5371
										$result["error"]=$procValue;
5371
										$result["error"]=$procValue;
5372
										
5372
 
5373
										#印出json
5373
										#印出json
5374
										echo json_encode($result);
5374
										echo json_encode($result);
5375
										
5375
 
5376
										#卸除異常的程序
5376
										#卸除異常的程序
5377
										unset($procs[$procIndex]);
5377
										unset($procs[$procIndex]);
5378
										
5378
 
5379
										#結束執行,回傳1給shell,代表異常,
5379
										#結束執行,回傳1給shell,代表異常,
5380
										exit(1);
5380
										exit(1);
5381
									
5381
 
5382
										}#if end
5382
										}#if end
5383
									
5383
 
5384
									#取得解析的json
5384
									#取得解析的json
5385
									$updateCopyRightYear=(array)(json_decode($threadStdOut));
5385
									$updateCopyRightYear=(array)(json_decode($threadStdOut));
5386
								
5386
 
5387
									#如果執行失敗
5387
									#如果執行失敗
5388
									if($updateCopyRightYear["status"]==="false"){
5388
									if($updateCopyRightYear["status"]==="false"){
5389
									
5389
 
5390
										#關閉程序
5390
										#關閉程序
5391
										proc_close($procs[$procIndex]["content"][0]["process"]);
5391
										proc_close($procs[$procIndex]["content"][0]["process"]);
5392
										
5392
 
5393
										#設置錯誤識別
5393
										#設置錯誤識別
5394
										$result["status"]="false";
5394
										$result["status"]="false";
5395
										
5395
 
5396
										#設置錯誤訊息
5396
										#設置錯誤訊息
5397
										$result["error"]=$updateCopyRightYear;
5397
										$result["error"]=$updateCopyRightYear;
5398
										
5398
 
5399
										#印出json
5399
										#印出json
5400
										echo json_encode($result);
5400
										echo json_encode($result);
5401
										
5401
 
5402
										#卸除異常的程序
5402
										#卸除異常的程序
5403
										unset($procs[$procIndex]);
5403
										unset($procs[$procIndex]);
5404
										
5404
 
5405
										#結束執行,回傳1給shell,代表異常,
5405
										#結束執行,回傳1給shell,代表異常,
5406
										exit(1);
5406
										exit(1);
5407
									
5407
 
5408
										}#if end
5408
										}#if end
5409
										
5409
 
5410
									#記錄有掃描的資料夾路徑與名稱 
5410
									#記錄有掃描的資料夾路徑與名稱
5411
									$result["scannedFile"][]=$NodePathAndName;
5411
									$result["scannedFile"][]=$NodePathAndName;
5412
									
5412
 
5413
									#合併 content - start
5413
									#合併 content - start
5414
									
5414
 
5415
									#函式說明:
5415
									#函式說明:
5416
									#將多個一維陣列串聯起來,key從0開始排序.
5416
									#將多個一維陣列串聯起來,key從0開始排序.
5417
									#回傳的結果:
5417
									#回傳的結果:
5418
									#$result["status"],"true"表執行正常,"false"代表執行不正常.
5418
									#$result["status"],"true"表執行正常,"false"代表執行不正常.
5419
									#$result["error"],錯誤訊息陣列.
5419
									#$result["error"],錯誤訊息陣列.
Line 5429... Line 5429...
5429
									#無.
5429
									#無.
5430
									#備註:
5430
									#備註:
5431
									#無.
5431
									#無.
5432
									$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5432
									$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5433
									unset($conf["arrays::mergeArray"]);
5433
									unset($conf["arrays::mergeArray"]);
5434
									
5434
 
5435
									#如果執行失敗
5435
									#如果執行失敗
5436
									if($mergeArray["status"]==="false"){
5436
									if($mergeArray["status"]==="false"){
5437
									
5437
 
5438
										#關閉程序
5438
										#關閉程序
5439
										proc_close($procs[$procIndex]["content"][0]["process"]);
5439
										proc_close($procs[$procIndex]["content"][0]["process"]);
5440
									
5440
 
5441
										#設置錯誤識別
5441
										#設置錯誤識別
5442
										$result["status"]="false";
5442
										$result["status"]="false";
5443
										
5443
 
5444
										#設置錯誤訊息
5444
										#設置錯誤訊息
5445
										$result["error"]=$mergeArray;
5445
										$result["error"]=$mergeArray;
5446
										
5446
 
5447
										#印出json
5447
										#印出json
5448
										echo json_encode($result);
5448
										echo json_encode($result);
5449
										
5449
 
5450
										#卸除異常的程序
5450
										#卸除異常的程序
5451
										unset($procs[$procIndex]);
5451
										unset($procs[$procIndex]);
5452
										
5452
 
5453
										#結束執行,回傳1給shell,代表異常,
5453
										#結束執行,回傳1給shell,代表異常,
5454
										exit(1);
5454
										exit(1);
5455
									
5455
 
5456
										}#if end
5456
										}#if end
5457
										
5457
 
5458
									#取得合併好的有異動檔案結果
5458
									#取得合併好的有異動檔案結果
5459
									$result["content"]=$mergeArray["content"];
5459
									$result["content"]=$mergeArray["content"];
5460
									
5460
 
5461
									#合併 content - end
5461
									#合併 content - end
5462
									
5462
 
5463
									#合併 scannedFile - start
5463
									#合併 scannedFile - start
5464
									
5464
 
5465
									if(isset($updateCopyRightYear["scannedFile"])){
5465
									if(isset($updateCopyRightYear["scannedFile"])){
5466
									
5466
 
5467
										#函式說明:
5467
										#函式說明:
5468
										#將多個一維陣列串聯起來,key從0開始排序.
5468
										#將多個一維陣列串聯起來,key從0開始排序.
5469
										#回傳的結果:
5469
										#回傳的結果:
5470
										#$result["status"],"true"表執行正常,"false"代表執行不正常.
5470
										#$result["status"],"true"表執行正常,"false"代表執行不正常.
5471
										#$result["error"],錯誤訊息陣列.
5471
										#$result["error"],錯誤訊息陣列.
Line 5481... Line 5481...
5481
										#無.
5481
										#無.
5482
										#備註:
5482
										#備註:
5483
										#無.
5483
										#無.
5484
										$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5484
										$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5485
										unset($conf["arrays::mergeArray"]);
5485
										unset($conf["arrays::mergeArray"]);
5486
										
5486
 
5487
										#如果執行失敗
5487
										#如果執行失敗
5488
										if($mergeArray["status"]==="false"){
5488
										if($mergeArray["status"]==="false"){
5489
										
5489
 
5490
											#關閉程序
5490
											#關閉程序
5491
											proc_close($procs[$procIndex]["content"][0]["process"]);
5491
											proc_close($procs[$procIndex]["content"][0]["process"]);
5492
											
5492
 
5493
											#設置錯誤識別
5493
											#設置錯誤識別
5494
											$result["status"]="false";
5494
											$result["status"]="false";
5495
											
5495
 
5496
											#設置錯誤訊息
5496
											#設置錯誤訊息
5497
											$result["error"]=$mergeArray;
5497
											$result["error"]=$mergeArray;
5498
											
5498
 
5499
											#印出json
5499
											#印出json
5500
											echo json_encode($result);
5500
											echo json_encode($result);
5501
											
5501
 
5502
											#卸除異常的程序
5502
											#卸除異常的程序
5503
											unset($procs[$procIndex]);
5503
											unset($procs[$procIndex]);
5504
											
5504
 
5505
											#結束執行,回傳1給shell,代表異常,
5505
											#結束執行,回傳1給shell,代表異常,
5506
											exit(1);
5506
											exit(1);
5507
										
5507
 
5508
											}#if end
5508
											}#if end
5509
											
5509
 
5510
										#取得合併好的有異動檔案結果
5510
										#取得合併好的有異動檔案結果
5511
										$result["scannedFile"]=$mergeArray["content"];
5511
										$result["scannedFile"]=$mergeArray["content"];
5512
										
5512
 
5513
										}#if end
5513
										}#if end
5514
									
5514
 
5515
									#合併 scannedFile - end
5515
									#合併 scannedFile - end
5516
								
5516
 
5517
									#關閉程序
5517
									#關閉程序
5518
									proc_close($procs[$procIndex]["content"][0]["process"]);
5518
									proc_close($procs[$procIndex]["content"][0]["process"]);
5519
									
5519
 
5520
									#卸除做好的程序
5520
									#卸除做好的程序
5521
									unset($procs[$procIndex]);
5521
									unset($procs[$procIndex]);
5522
								
5522
 
5523
									}#else end
5523
									}#else end
5524
							
5524
 
5525
								#end switch
5525
								#end switch
5526
								break;
5526
								break;
5527
								
5527
 
5528
							#如果是透過socket
5528
							#如果是透過socket
5529
							case "socket":
5529
							case "socket":
5530
							
5530
 
5531
								#取得 proc 的 uuid
5531
								#取得 proc 的 uuid
5532
								$procUuid=$procValue["content"][0]["content"];
5532
								$procUuid=$procValue["content"][0]["content"];
5533
								
5533
 
5534
								#函式說明:
5534
								#函式說明:
5535
								#詢問透過 sock::unixDomainSockServer 執行的程序狀況
5535
								#詢問透過 sock::unixDomainSockServer 執行的程序狀況
5536
								#回傳結果:
5536
								#回傳結果:
5537
								#$result["status"],"true"代表執行正常;"false"代表執行不正常.
5537
								#$result["status"],"true"代表執行正常;"false"代表執行不正常.
5538
								#$result["error"],錯誤訊息陣列.
5538
								#$result["error"],錯誤訊息陣列.
Line 5561... Line 5561...
5561
								#debug
5561
								#debug
5562
								if($getProcInfo["status"]==="false"){
5562
								if($getProcInfo["status"]==="false"){
5563
 
5563
 
5564
									#設置錯誤識別
5564
									#設置錯誤識別
5565
									$result["status"]="false";
5565
									$result["status"]="false";
5566
									
5566
 
5567
									#設置錯誤訊息
5567
									#設置錯誤訊息
5568
									$result["error"][]="get process info by uuid failed";
5568
									$result["error"][]="get process info by uuid failed";
5569
									
5569
 
5570
									#設置錯誤訊息
5570
									#設置錯誤訊息
5571
									$result["error"][]=$getProcInfo;
5571
									$result["error"][]=$getProcInfo;
5572
									
5572
 
5573
									#印出json
5573
									#印出json
5574
									echo json_encode($result);
5574
									echo json_encode($result);
5575
 
5575
 
5576
									}#if end
5576
									}#if end
5577
								
5577
 
5578
								#如果已經停止運行
5578
								#如果已經停止運行
5579
								if($getProcInfo["content"]["running"]==="false"){
5579
								if($getProcInfo["content"]["running"]==="false"){
5580
								
5580
 
5581
									#儲存程序執行的標準輸出
5581
									#儲存程序執行的標準輸出
5582
									$threadStdOut=$getProcInfo["content"]["output"];
5582
									$threadStdOut=$getProcInfo["content"]["output"];
5583
								
5583
 
5584
									#如果標準輸出不是json
5584
									#如果標準輸出不是json
5585
									if(json_validate($threadStdOut)===false){
5585
									if(json_validate($threadStdOut)===false){
5586
									
5586
 
5587
										#設置錯誤識別
5587
										#設置錯誤識別
5588
										$result["status"]="false";
5588
										$result["status"]="false";
5589
										
5589
 
5590
										#設置錯誤訊息
5590
										#設置錯誤訊息
5591
										$result["error"]=$procValue;
5591
										$result["error"]=$procValue;
5592
										
5592
 
5593
										#印出json
5593
										#印出json
5594
										echo json_encode($result);
5594
										echo json_encode($result);
5595
										
5595
 
5596
										#卸除異常的程序
5596
										#卸除異常的程序
5597
										unset($procs[$procIndex]);
5597
										unset($procs[$procIndex]);
5598
										
5598
 
5599
										#結束執行,回傳1給shell,代表異常,
5599
										#結束執行,回傳1給shell,代表異常,
5600
										exit(1);
5600
										exit(1);
5601
									
5601
 
5602
										}#if end
5602
										}#if end
5603
									
5603
 
5604
									#取得解析的json
5604
									#取得解析的json
5605
									$updateCopyRightYear=(array)(json_decode($threadStdOut));
5605
									$updateCopyRightYear=(array)(json_decode($threadStdOut));
5606
								
5606
 
5607
									#如果執行失敗
5607
									#如果執行失敗
5608
									if($updateCopyRightYear["status"]==="false"){
5608
									if($updateCopyRightYear["status"]==="false"){
5609
									
5609
 
5610
										#設置錯誤識別
5610
										#設置錯誤識別
5611
										$result["status"]="false";
5611
										$result["status"]="false";
5612
										
5612
 
5613
										#設置錯誤訊息
5613
										#設置錯誤訊息
5614
										$result["error"]=$updateCopyRightYear;
5614
										$result["error"]=$updateCopyRightYear;
5615
										
5615
 
5616
										#印出json
5616
										#印出json
5617
										echo json_encode($result);
5617
										echo json_encode($result);
5618
										
5618
 
5619
										#卸除異常的程序
5619
										#卸除異常的程序
5620
										unset($procs[$procIndex]);
5620
										unset($procs[$procIndex]);
5621
										
5621
 
5622
										#結束執行,回傳1給shell,代表異常,
5622
										#結束執行,回傳1給shell,代表異常,
5623
										exit(1);
5623
										exit(1);
5624
									
5624
 
5625
										}#if end
5625
										}#if end
5626
										
5626
 
5627
									#記錄有掃描的資料夾路徑與名稱 
5627
									#記錄有掃描的資料夾路徑與名稱
5628
									$result["scannedFile"][]=$NodePathAndName;
5628
									$result["scannedFile"][]=$NodePathAndName;
5629
									
5629
 
5630
									#合併 content - start
5630
									#合併 content - start
5631
									
5631
 
5632
									#函式說明:
5632
									#函式說明:
5633
									#將多個一維陣列串聯起來,key從0開始排序.
5633
									#將多個一維陣列串聯起來,key從0開始排序.
5634
									#回傳的結果:
5634
									#回傳的結果:
5635
									#$result["status"],"true"表執行正常,"false"代表執行不正常.
5635
									#$result["status"],"true"表執行正常,"false"代表執行不正常.
5636
									#$result["error"],錯誤訊息陣列.
5636
									#$result["error"],錯誤訊息陣列.
Line 5646... Line 5646...
5646
									#無.
5646
									#無.
5647
									#備註:
5647
									#備註:
5648
									#無.
5648
									#無.
5649
									$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5649
									$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5650
									unset($conf["arrays::mergeArray"]);
5650
									unset($conf["arrays::mergeArray"]);
5651
									
5651
 
5652
									#如果執行失敗
5652
									#如果執行失敗
5653
									if($mergeArray["status"]==="false"){
5653
									if($mergeArray["status"]==="false"){
5654
									
5654
 
5655
										#設置錯誤識別
5655
										#設置錯誤識別
5656
										$result["status"]="false";
5656
										$result["status"]="false";
5657
										
5657
 
5658
										#設置錯誤訊息
5658
										#設置錯誤訊息
5659
										$result["error"]=$mergeArray;
5659
										$result["error"]=$mergeArray;
5660
										
5660
 
5661
										#印出json
5661
										#印出json
5662
										echo json_encode($result);
5662
										echo json_encode($result);
5663
										
5663
 
5664
										#卸除異常的程序
5664
										#卸除異常的程序
5665
										unset($procs[$procIndex]);
5665
										unset($procs[$procIndex]);
5666
										
5666
 
5667
										#結束執行,回傳1給shell,代表異常.
5667
										#結束執行,回傳1給shell,代表異常.
5668
										exit(1);
5668
										exit(1);
5669
									
5669
 
5670
										}#if end
5670
										}#if end
5671
									
5671
 
5672
									#取得合併好的有異動檔案結果
5672
									#取得合併好的有異動檔案結果
5673
									$result["content"]=$mergeArray["content"];
5673
									$result["content"]=$mergeArray["content"];
5674
									
5674
 
5675
									#合併 content - end
5675
									#合併 content - end
5676
									
5676
 
5677
									#合併 scannedFile - start
5677
									#合併 scannedFile - start
5678
									
5678
 
5679
									if(isset($updateCopyRightYear["scannedFile"])){
5679
									if(isset($updateCopyRightYear["scannedFile"])){
5680
									
5680
 
5681
										#函式說明:
5681
										#函式說明:
5682
										#將多個一維陣列串聯起來,key從0開始排序.
5682
										#將多個一維陣列串聯起來,key從0開始排序.
5683
										#回傳的結果:
5683
										#回傳的結果:
5684
										#$result["status"],"true"表執行正常,"false"代表執行不正常.
5684
										#$result["status"],"true"表執行正常,"false"代表執行不正常.
5685
										#$result["error"],錯誤訊息陣列.
5685
										#$result["error"],錯誤訊息陣列.
Line 5695... Line 5695...
5695
										#無.
5695
										#無.
5696
										#備註:
5696
										#備註:
5697
										#無.
5697
										#無.
5698
										$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5698
										$mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
5699
										unset($conf["arrays::mergeArray"]);
5699
										unset($conf["arrays::mergeArray"]);
5700
										
5700
 
5701
										#如果執行失敗
5701
										#如果執行失敗
5702
										if($mergeArray["status"]==="false"){
5702
										if($mergeArray["status"]==="false"){
5703
										
5703
 
5704
											#設置錯誤識別
5704
											#設置錯誤識別
5705
											$result["status"]="false";
5705
											$result["status"]="false";
5706
											
5706
 
5707
											#設置錯誤訊息
5707
											#設置錯誤訊息
5708
											$result["error"]=$mergeArray;
5708
											$result["error"]=$mergeArray;
5709
											
5709
 
5710
											#印出json
5710
											#印出json
5711
											echo json_encode($result);
5711
											echo json_encode($result);
5712
											
5712
 
5713
											#卸除異常的程序
5713
											#卸除異常的程序
5714
											unset($procs[$procIndex]);
5714
											unset($procs[$procIndex]);
5715
											
5715
 
5716
											#結束執行,回傳1給shell,代表異常,
5716
											#結束執行,回傳1給shell,代表異常,
5717
											exit(1);
5717
											exit(1);
5718
										
5718
 
5719
											}#if end
5719
											}#if end
5720
											
5720
 
5721
										#取得合併好的有異動檔案結果
5721
										#取得合併好的有異動檔案結果
5722
										$result["scannedFile"]=$mergeArray["content"];
5722
										$result["scannedFile"]=$mergeArray["content"];
5723
										
5723
 
5724
										}#if end
5724
										}#if end
5725
									
5725
 
5726
									#合併 scannedFile - end
5726
									#合併 scannedFile - end
5727
									
5727
 
5728
									#卸除做好的程序
5728
									#卸除做好的程序
5729
									unset($procs[$procIndex]);
5729
									unset($procs[$procIndex]);
5730
								
5730
 
5731
									}#if end
5731
									}#if end
5732
							
5732
 
5733
								#end switch
5733
								#end switch
5734
								break;
5734
								break;
5735
								
5735
 
5736
							#其他類型
5736
							#其他類型
5737
							default:
5737
							default:
5738
							
5738
 
5739
								#設置錯誤識別
5739
								#設置錯誤識別
5740
								$result["status"]="false";
5740
								$result["status"]="false";
5741
								
5741
 
5742
								#設置錯誤訊息
5742
								#設置錯誤訊息
5743
								$result["error"][]="not supported multi threads type ".$threadType;
5743
								$result["error"][]="not supported multi threads type ".$threadType;
5744
								
5744
 
5745
								#印出json
5745
								#印出json
5746
								echo json_encode($result);
5746
								echo json_encode($result);
5747
								
5747
 
5748
								#結束執行,回傳1給shell,代表異常,
5748
								#結束執行,回傳1給shell,代表異常,
5749
								exit(1);
5749
								exit(1);
5750
						
5750
 
5751
							}#switch end
5751
							}#switch end
5752
						
5752
 
5753
						}#foreach end
5753
						}#foreach end
5754
						
5754
 
5755
					#如果已經執行完所有子程序
5755
					#如果已經執行完所有子程序
5756
					if(empty($procs)){
5756
					if(empty($procs)){
5757
					
5757
 
5758
						#如果有要log
5758
						#如果有要log
5759
						if(isset($conf["log"])){
5759
						if(isset($conf["log"])){
5760
					
5760
 
5761
							#函式說明:
5761
							#函式說明:
5762
							#撰寫log
5762
							#撰寫log
5763
							#回傳結果:
5763
							#回傳結果:
5764
							#$result["status"],狀態,"true"或"false".
5764
							#$result["status"],狀態,"true"或"false".
5765
							#$result["error"],錯誤訊息陣列.
5765
							#$result["error"],錯誤訊息陣列.
Line 5779... Line 5779...
5779
							#無.
5779
							#無.
5780
							#備註:
5780
							#備註:
5781
							#無.
5781
							#無.
5782
							$record=logs::record($conf["logs::record"]);
5782
							$record=logs::record($conf["logs::record"]);
5783
							unset($conf["logs::record"]);
5783
							unset($conf["logs::record"]);
5784
						
5784
 
5785
							#如果出錯
5785
							#如果出錯
5786
							if($record["status"]==="false"){
5786
							if($record["status"]==="false"){
5787
						
5787
 
5788
								#設置錯誤識別
5788
								#設置錯誤識別
5789
								$result["status"]="false";
5789
								$result["status"]="false";
5790
								
5790
 
5791
								#設置錯誤訊息
5791
								#設置錯誤訊息
5792
								$result["error"]=$record;
5792
								$result["error"]=$record;
5793
								
5793
 
5794
								#印出json
5794
								#印出json
5795
								echo json_encode($result);
5795
								echo json_encode($result);
5796
								
5796
 
5797
								#結束執行,回傳1給shell,代表異常,
5797
								#結束執行,回傳1給shell,代表異常,
5798
								exit(1);
5798
								exit(1);
5799
						
5799
 
5800
								}#if end
5800
								}#if end
5801
								
5801
 
5802
							}#if end
5802
							}#if end
5803
						
5803
 
5804
						#結束子程序的檢查
5804
						#結束子程序的檢查
5805
						break;
5805
						break;
5806
					
5806
 
5807
						}#if end
5807
						}#if end
5808
					
5808
 
5809
					#執行到這邊,代表尚有程序再執行.
5809
					#執行到這邊,代表尚有程序再執行.
5810
					
5810
 
5811
					#如果要log
5811
					#如果要log
5812
					if(isset($conf["log"])){
5812
					if(isset($conf["log"])){
5813
					
5813
 
5814
						
5814
 
5815
					
5815
 
5816
						}#if end
5816
						}#if end
5817
						
5817
 
5818
					#休息1秒鐘
5818
					#休息1秒鐘
5819
					sleep(1);
5819
					sleep(1);
5820
				
5820
 
5821
					}#while end
5821
					}#while end
5822
			
5822
 
5823
				}#if end
5823
				}#if end
5824
		
5824
 
5825
			}#if end
5825
			}#if end
5826
		
5826
 
5827
		#設置執行正常
5827
		#設置執行正常
5828
		$result["status"]="true";
5828
		$result["status"]="true";
5829
		
5829
 
5830
		#如果是透過多執行序執行
5830
		#如果是透過多執行序執行
5831
		if($conf["multiThread"]==="true"){
5831
		if($conf["multiThread"]==="true"){
5832
		
5832
 
5833
			#印出json結果
5833
			#印出json結果
5834
			echo json_encode($result);
5834
			echo json_encode($result);
5835
			
5835
 
5836
			}#if end
5836
			}#if end
5837
		
5837
 
5838
		#反之
5838
		#反之
5839
		else{
5839
		else{
5840
		
5840
 
5841
			#回傳結果
5841
			#回傳結果
5842
			return $result;
5842
			return $result;
5843
		
5843
 
5844
			}#else end
5844
			}#else end
5845
		
5845
 
5846
		}#function updateCopyRightYear end
5846
		}#function updateCopyRightYear end
5847
		
5847
 
5848
	/*
5848
	/*
5849
	#函式說明:
5849
	#函式說明:
5850
	#置換檔案內容中符合的內容.
5850
	#置換檔案內容中符合的內容.
5851
	#回傳結果:
5851
	#回傳結果:
5852
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5852
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 5876... Line 5876...
5876
	#備註:
5876
	#備註:
5877
	#參數設定 $conf["replaceTo"][$i]=$replaceStr; 代表符合格式的連續字串中的 $i+1 行內容要置換成 $replaceStr.
5877
	#參數設定 $conf["replaceTo"][$i]=$replaceStr; 代表符合格式的連續字串中的 $i+1 行內容要置換成 $replaceStr.
5878
	#參數設定 $conf["replaceTo"][$i]=array("varName1"=>$replaceStr1,"varName2"=>$replaceStr2); 代表符合格式的連續字串中的 $i+1 行內容中的變數 varName1 要置換成 $replaceStr1;變數 varName2 要置換成 $replaceStr2.
5878
	#參數設定 $conf["replaceTo"][$i]=array("varName1"=>$replaceStr1,"varName2"=>$replaceStr2); 代表符合格式的連續字串中的 $i+1 行內容中的變數 varName1 要置換成 $replaceStr1;變數 varName2 要置換成 $replaceStr2.
5879
	*/
5879
	*/
5880
	public static function replaceMatchContent(&$conf){
5880
	public static function replaceMatchContent(&$conf){
5881
		
5881
 
5882
		#初始化要回傳的結果
5882
		#初始化要回傳的結果
5883
		$result=array();
5883
		$result=array();
5884
 
5884
 
5885
		#取得當前執行的函數名稱
5885
		#取得當前執行的函數名稱
5886
		$result["function"]=__FUNCTION__;
5886
		$result["function"]=__FUNCTION__;
Line 5899... Line 5899...
5899
 
5899
 
5900
			}#if end
5900
			}#if end
5901
 
5901
 
5902
		#取得參數
5902
		#取得參數
5903
		$result["argu"]=$conf;
5903
		$result["argu"]=$conf;
5904
		
5904
 
5905
		#如果 $conf 不為陣列
5905
		#如果 $conf 不為陣列
5906
		if(gettype($conf)!=="array"){
5906
		if(gettype($conf)!=="array"){
5907
 
5907
 
5908
			#設置執行失敗
5908
			#設置執行失敗
5909
			$result["status"]="false";
5909
			$result["status"]="false";
Line 5921... Line 5921...
5921
 
5921
 
5922
			#回傳結果
5922
			#回傳結果
5923
			return $result;
5923
			return $result;
5924
 
5924
 
5925
			}#if end
5925
			}#if end
5926
		
5926
 
5927
		#參數檢查
5927
		#參數檢查
5928
		#函式說明:
5928
		#函式說明:
5929
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
5929
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
5930
		#回傳結果:
5930
		#回傳結果:
5931
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5931
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 5977... Line 5977...
5977
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5977
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5978
		#備註:
5978
		#備註:
5979
		#無.
5979
		#無.
5980
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5980
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5981
		unset($conf["variableCheck::checkArguments"]);
5981
		unset($conf["variableCheck::checkArguments"]);
5982
		
5982
 
5983
		#如果執行失敗
5983
		#如果執行失敗
5984
		if($checkArguments["status"]==="false"){
5984
		if($checkArguments["status"]==="false"){
5985
		
5985
 
5986
			#設置錯誤識別
5986
			#設置錯誤識別
5987
			$result["status"]="false";
5987
			$result["status"]="false";
5988
			
5988
 
5989
			#設置錯誤訊息
5989
			#設置錯誤訊息
5990
			$result["error"]=$checkArguments;
5990
			$result["error"]=$checkArguments;
5991
			
5991
 
5992
			#回傳結果
5992
			#回傳結果
5993
			return $result;
5993
			return $result;
5994
		
5994
 
5995
			}#if end
5995
			}#if end
5996
			
5996
 
5997
		#如果檢查參數不通過
5997
		#如果檢查參數不通過
5998
		if($checkArguments["passed"]==="false"){
5998
		if($checkArguments["passed"]==="false"){
5999
		
5999
 
6000
			#設置錯誤識別
6000
			#設置錯誤識別
6001
			$result["status"]="false";
6001
			$result["status"]="false";
6002
			
6002
 
6003
			#設置錯誤訊息
6003
			#設置錯誤訊息
6004
			$result["error"]=$checkArguments;
6004
			$result["error"]=$checkArguments;
6005
			
6005
 
6006
			#回傳結果
6006
			#回傳結果
6007
			return $result;
6007
			return $result;
6008
		
6008
 
6009
			}#if end
6009
			}#if end
6010
		
6010
 
6011
		#取得檔案的內容
6011
		#取得檔案的內容
6012
		#函式說明:
6012
		#函式說明:
6013
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
6013
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
6014
		#回傳的變數說明:
6014
		#回傳的變數說明:
6015
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
6015
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
Line 6042... Line 6042...
6042
		#無.
6042
		#無.
6043
		#備註:
6043
		#備註:
6044
		#無.
6044
		#無.
6045
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
6045
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
6046
		unset($conf["fileAccess::getFileContent"]);
6046
		unset($conf["fileAccess::getFileContent"]);
6047
	
6047
 
6048
		#如果執行失敗
6048
		#如果執行失敗
6049
		if($getFileContent["status"]==="false"){
6049
		if($getFileContent["status"]==="false"){
6050
		
6050
 
6051
			#設置錯誤識別
6051
			#設置錯誤識別
6052
			$result["status"]="false";
6052
			$result["status"]="false";
6053
			
6053
 
6054
			#設置錯誤訊息
6054
			#設置錯誤訊息
6055
			$result["error"]=$getFileContent;
6055
			$result["error"]=$getFileContent;
6056
			
6056
 
6057
			#回傳結果
6057
			#回傳結果
6058
			return $result;
6058
			return $result;
6059
		
6059
 
6060
			}#if end
6060
			}#if end
6061
			
6061
 
6062
		#尋找連續的多行字串是否依順含有符合格式的內容,且回傳解析好的變數數值.
6062
		#尋找連續的多行字串是否依順含有符合格式的內容,且回傳解析好的變數數值.
6063
		#回傳結果:
6063
		#回傳結果:
6064
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
6064
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
6065
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
6065
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
6066
		#$result["function"],當前執行的函式名稱.
6066
		#$result["function"],當前執行的函式名稱.
Line 6083... Line 6083...
6083
		#無.
6083
		#無.
6084
		#備註:
6084
		#備註:
6085
		#回傳結果 $result["content"][$i]["ori"][$j]=array("index"=>$oriLineIndex,"value"=>$oriLineContent) 代表第 $i+1 個符合格式的段落中第 $j+1 個原始內容對應的行數($oriLineIndex+1),其原始內容為 $oriLineContent.
6085
		#回傳結果 $result["content"][$i]["ori"][$j]=array("index"=>$oriLineIndex,"value"=>$oriLineContent) 代表第 $i+1 個符合格式的段落中第 $j+1 個原始內容對應的行數($oriLineIndex+1),其原始內容為 $oriLineContent.
6086
		$findConMatchStrs=search::findConMatchStrs($conf["search::findConMatchStrs"]);
6086
		$findConMatchStrs=search::findConMatchStrs($conf["search::findConMatchStrs"]);
6087
		unset($conf["search::findConMatchStrs"]);
6087
		unset($conf["search::findConMatchStrs"]);
6088
	
6088
 
6089
		#如果執行失敗
6089
		#如果執行失敗
6090
		if($findConMatchStrs["status"]==="false"){
6090
		if($findConMatchStrs["status"]==="false"){
6091
		
6091
 
6092
			#設置錯誤識別
6092
			#設置錯誤識別
6093
			$result["status"]="false";
6093
			$result["status"]="false";
6094
			
6094
 
6095
			#設置錯誤訊息
6095
			#設置錯誤訊息
6096
			$result["error"]=$findConMatchStrs;
6096
			$result["error"]=$findConMatchStrs;
6097
			
6097
 
6098
			#回傳結果
6098
			#回傳結果
6099
			return $result;
6099
			return $result;
6100
		
6100
 
6101
			}#if end
6101
			}#if end
6102
		
6102
 
6103
		#如果沒有符合的連續字串格式
6103
		#如果沒有符合的連續字串格式
6104
		if($findConMatchStrs["found"]==="false"){
6104
		if($findConMatchStrs["found"]==="false"){
6105
		
6105
 
6106
			#設置執行正常的識別
6106
			#設置執行正常的識別
6107
			$result["status"]="true";
6107
			$result["status"]="true";
6108
			
6108
 
6109
			#設置沒有找到符合格式內容
6109
			#設置沒有找到符合格式內容
6110
			$result["found"]="false";
6110
			$result["found"]="false";
6111
			
6111
 
6112
			#回傳結果
6112
			#回傳結果
6113
			return $result;
6113
			return $result;
6114
		
6114
 
6115
			}#if end
6115
			}#if end
6116
		
6116
 
6117
		#初始化儲存內容置換資訊的變數
6117
		#初始化儲存內容置換資訊的變數
6118
		$result["relaceInfo"]=array();
6118
		$result["relaceInfo"]=array();
6119
		
6119
 
6120
		#debug
6120
		#debug
6121
		#var_dump(__LINE__,$findConMatchStrs["content"]);exit;
6121
		#var_dump(__LINE__,$findConMatchStrs["content"]);exit;
6122
		
6122
 
6123
		#執行到這邊代表有遇到符合的連續字串格式
6123
		#執行到這邊代表有遇到符合的連續字串格式
6124
		foreach($findConMatchStrs["content"] as $matchSectionIndex => $sInfo){
6124
		foreach($findConMatchStrs["content"] as $matchSectionIndex => $sInfo){
6125
		
6125
 
6126
			#針對符合的每行內容
6126
			#針對符合的每行內容
6127
			foreach($sInfo["ori"] as $index => $lInfo){
6127
			foreach($sInfo["ori"] as $index => $lInfo){
6128
			
6128
 
6129
				#取得對應的原始行索引
6129
				#取得對應的原始行索引
6130
				$oriLineNo=$lInfo["index"];
6130
				$oriLineNo=$lInfo["index"];
6131
				
6131
 
6132
				#取得對應的原始行內容
6132
				#取得對應的原始行內容
6133
				$oriLineContent=$lInfo["value"];
6133
				$oriLineContent=$lInfo["value"];
6134
				
6134
 
6135
				#儲存被剔除的開頭部分
6135
				#儲存被剔除的開頭部分
6136
				$deletedOriHead=$lInfo["deletedHead"];
6136
				$deletedOriHead=$lInfo["deletedHead"];
6137
			
6137
 
6138
				#如果沒有對應的要取代格式
6138
				#如果沒有對應的要取代格式
6139
				if(!isset($conf["replaceTo"][$index])){
6139
				if(!isset($conf["replaceTo"][$index])){
6140
				
6140
 
6141
					#不處理
6141
					#不處理
6142
					continue;
6142
					continue;
6143
				
6143
 
6144
					}#if end
6144
					}#if end
6145
			
6145
 
6146
				#如果解析的結果有變數
6146
				#如果解析的結果有變數
6147
				if(empty($sInfo["vars"][$index])){
6147
				if(empty($sInfo["vars"][$index])){
6148
					
6148
 
6149
					#debug
6149
					#debug
6150
					#var_dump(__LINE__,$index,$sInfo["vars"][$index]);
6150
					#var_dump(__LINE__,$index,$sInfo["vars"][$index]);
6151
					
6151
 
6152
					#執行到這邊代表有對應的要取代格式
6152
					#執行到這邊代表有對應的要取代格式
6153
					
6153
 
6154
					#debug
6154
					#debug
6155
					#var_dump(__LINE__,$index,gettype($conf["replaceTo"][$index]),$conf["replaceTo"]);
6155
					#var_dump(__LINE__,$index,gettype($conf["replaceTo"][$index]),$conf["replaceTo"]);
6156
					
6156
 
6157
					#如果取代格式不為字串
6157
					#如果取代格式不為字串
6158
					if(gettype($conf["replaceTo"][$index])!=="string"){
6158
					if(gettype($conf["replaceTo"][$index])!=="string"){
6159
					
6159
 
6160
						#設置執行不正常的識別
6160
						#設置執行不正常的識別
6161
						$result["status"]="false";
6161
						$result["status"]="false";
6162
						
6162
 
6163
						#設置錯誤訊息
6163
						#設置錯誤訊息
6164
						$result["error"]="參數 formats 跟 replaceTo 的對應有錯誤.";
6164
						$result["error"]="參數 formats 跟 replaceTo 的對應有錯誤.";
6165
						
6165
 
6166
						#回傳結果
6166
						#回傳結果
6167
						return $result;
6167
						return $result;
6168
					
6168
 
6169
						}#if end
6169
						}#if end
6170
					
6170
 
6171
					#執行到這邊代表檢查通過
6171
					#執行到這邊代表檢查通過
6172
					
6172
 
6173
					#記錄取代的資訊
6173
					#記錄取代的資訊
6174
					$result["relaceInfo"][$oriLineNo]=array("deletedOriHead"=>$deletedOriHead,"ori"=>$oriLineContent,"new"=>$conf["replaceTo"][$index]);
6174
					$result["relaceInfo"][$oriLineNo]=array("deletedOriHead"=>$deletedOriHead,"ori"=>$oriLineContent,"new"=>$conf["replaceTo"][$index]);
6175
				
6175
 
6176
					}#if end
6176
					}#if end
6177
					
6177
 
6178
				#反之代表有解析出變數
6178
				#反之代表有解析出變數
6179
				else{
6179
				else{
6180
				
6180
 
6181
					#debug
6181
					#debug
6182
					#var_dump(__LINE__,gettype($conf["replaceTo"][$index]));
6182
					#var_dump(__LINE__,gettype($conf["replaceTo"][$index]));
6183
				
6183
 
6184
					#如果取代格式不為陣列
6184
					#如果取代格式不為陣列
6185
					if(gettype($conf["replaceTo"][$index])!=="array"){
6185
					if(gettype($conf["replaceTo"][$index])!=="array"){
6186
					
6186
 
6187
						#設置執行不正常的識別
6187
						#設置執行不正常的識別
6188
						$result["status"]="false";
6188
						$result["status"]="false";
6189
						
6189
 
6190
						#設置錯誤訊息
6190
						#設置錯誤訊息
6191
						$result["error"]="參數 formats 跟 replaceTo 的對應有錯誤.";
6191
						$result["error"]="參數 formats 跟 replaceTo 的對應有錯誤.";
6192
						
6192
 
6193
						#回傳結果
6193
						#回傳結果
6194
						return $result;
6194
						return $result;
6195
					
6195
 
6196
						}#if end
6196
						}#if end
6197
						
6197
 
6198
					#執行到這邊代表檢查通過
6198
					#執行到這邊代表檢查通過
6199
					
6199
 
6200
					#初始化替換好的內容
6200
					#初始化替換好的內容
6201
					$newLineContent=$oriLineContent;
6201
					$newLineContent=$oriLineContent;
6202
					
6202
 
6203
					#針對每個解析出來的變數
6203
					#針對每個解析出來的變數
6204
					foreach($conf["replaceTo"][$index] as $varName => $newVal){
6204
					foreach($conf["replaceTo"][$index] as $varName => $newVal){
6205
						
6205
 
6206
						#取得原始解析出來的內容
6206
						#取得原始解析出來的內容
6207
						$oriVal=$sInfo["vars"][$index][$varName][0];
6207
						$oriVal=$sInfo["vars"][$index][$varName][0];
6208
						
6208
 
6209
						#將關鍵字取代
6209
						#將關鍵字取代
6210
						#函式說明:
6210
						#函式說明:
6211
						#將字串中的特定內容取代.
6211
						#將字串中的特定內容取代.
6212
						#回傳結果:
6212
						#回傳結果:
6213
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
6213
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
6214
						#$result["function"],當前執行的函數.
6214
						#$result["function"],當前執行的函數.
6215
						#$result["content"],爲處理好的字串.
6215
						#$result["content"],爲處理好的字串.
6216
						#$result["error"],錯誤訊息陣列.
6216
						#$result["error"],錯誤訊息陣列.
6217
						#$result["argu"],使用的參數. 
6217
						#$result["argu"],使用的參數.
6218
						#必填參數:
6218
						#必填參數:
6219
						#$conf["stringIn"],字串,爲要處理的字串
6219
						#$conf["stringIn"],字串,爲要處理的字串
6220
						$conf["stringProcess::replaceOnce"]["stringIn"]=$newLineContent;
6220
						$conf["stringProcess::replaceOnce"]["stringIn"]=$newLineContent;
6221
						#$conf["selectedCharacter"],字串,爲被選擇要處理的字串/字元,\n」代表換行,「\t」代表tab鍵的間隔.
6221
						#$conf["selectedCharacter"],字串,爲被選擇要處理的字串/字元,\n」代表換行,「\t」代表tab鍵的間隔.
6222
						$conf["stringProcess::replaceOnce"]["selectedCharacter"]=$oriVal;
6222
						$conf["stringProcess::replaceOnce"]["selectedCharacter"]=$oriVal;
Line 6226... Line 6226...
6226
						#無.
6226
						#無.
6227
						#備註:
6227
						#備註:
6228
						#無.
6228
						#無.
6229
						$replaceOnce=stringProcess::replaceOnce($conf["stringProcess::replaceOnce"]);
6229
						$replaceOnce=stringProcess::replaceOnce($conf["stringProcess::replaceOnce"]);
6230
						unset($conf["stringProcess::replaceOnce"]);
6230
						unset($conf["stringProcess::replaceOnce"]);
6231
					
6231
 
6232
						#debug
6232
						#debug
6233
						#var_dump(__LINE__,$replaceOnce);
6233
						#var_dump(__LINE__,$replaceOnce);
6234
					
6234
 
6235
						#如果執行失敗
6235
						#如果執行失敗
6236
						if($replaceOnce["status"]==="false"){
6236
						if($replaceOnce["status"]==="false"){
6237
						
6237
 
6238
							#設置錯誤識別
6238
							#設置錯誤識別
6239
							$result["status"]="false";
6239
							$result["status"]="false";
6240
							
6240
 
6241
							#設置錯誤訊息
6241
							#設置錯誤訊息
6242
							$result["error"]=$replaceOnce;
6242
							$result["error"]=$replaceOnce;
6243
							
6243
 
6244
							#回傳結果
6244
							#回傳結果
6245
							return $result;
6245
							return $result;
6246
						
6246
 
6247
							}#if end
6247
							}#if end
6248
						
6248
 
6249
						#儲存該階段替換好的內容
6249
						#儲存該階段替換好的內容
6250
						$newLineContent=$replaceOnce["content"];
6250
						$newLineContent=$replaceOnce["content"];
6251
						
6251
 
6252
						}#foreach end
6252
						}#foreach end
6253
					
6253
 
6254
					#記錄取代的資訊
6254
					#記錄取代的資訊
6255
					$result["relaceInfo"][$oriLineNo]=array("deletedOriHead"=>$deletedOriHead,"ori"=>$oriLineContent,"new"=>$newLineContent);
6255
					$result["relaceInfo"][$oriLineNo]=array("deletedOriHead"=>$deletedOriHead,"ori"=>$oriLineContent,"new"=>$newLineContent);
6256
					
6256
 
6257
					}#else end
6257
					}#else end
6258
				
6258
 
6259
				}#foreach end
6259
				}#foreach end
6260
				
6260
 
6261
			}#foreach end
6261
			}#foreach end
6262
		
6262
 
6263
		#初始化替換好的內容為原始內容
6263
		#初始化替換好的內容為原始內容
6264
		$result["content"]=$getFileContent["fileContent"];
6264
		$result["content"]=$getFileContent["fileContent"];
6265
		
6265
 
6266
		#依照內容替代的資訊
6266
		#依照內容替代的資訊
6267
		foreach($result["relaceInfo"] as $lineIndex =>$info){
6267
		foreach($result["relaceInfo"] as $lineIndex =>$info){
6268
		
6268
 
6269
			#儲存新的行內容
6269
			#儲存新的行內容
6270
			$newLine=$info["new"];
6270
			$newLine=$info["new"];
6271
			
6271
 
6272
			#儲存被剔除的開頭字串
6272
			#儲存被剔除的開頭字串
6273
			$deletedOriHead=$info["deletedOriHead"];
6273
			$deletedOriHead=$info["deletedOriHead"];
6274
		
6274
 
6275
			#debug
6275
			#debug
6276
			#var_dump(__FILE__,__LINE__,$lineIndex,$deletedOriHead,$newLine);
6276
			#var_dump(__FILE__,__LINE__,$lineIndex,$deletedOriHead,$newLine);
6277
		
6277
 
6278
			#儲存置換好的行
6278
			#儲存置換好的行
6279
			$result["content"][$lineIndex]=$deletedOriHead.$newLine;
6279
			$result["content"][$lineIndex]=$deletedOriHead.$newLine;
6280
		
6280
 
6281
			}#foreach end
6281
			}#foreach end
6282
		
6282
 
6283
		#設置有找到要取代的內容
6283
		#設置有找到要取代的內容
6284
		$result["found"]="true";
6284
		$result["found"]="true";
6285
		
6285
 
6286
		#設置執行正常
6286
		#設置執行正常
6287
		$result["status"]="true";
6287
		$result["status"]="true";
6288
		
6288
 
6289
		#回傳結果
6289
		#回傳結果
6290
		return $result;
6290
		return $result;
6291
			
6291
 
6292
		}#function replaceMatchContent end
6292
		}#function replaceMatchContent end
6293
	
6293
 
6294
	}#class phpLib end
6294
	}#class phpLib end
6295
 
6295
 
6296
?>
-
 
6297
6296
?>
-
 
6297