Subversion Repositories php-qbpwcf

Rev

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

Rev 200 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) 2015~2024 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 43... Line 43...
43
	#$arguments,陣列,為呼叫方法時所用的參數.
43
	#$arguments,陣列,為呼叫方法時所用的參數.
44
	#參考資料:
44
	#參考資料:
45
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
45
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
46
	*/
46
	*/
47
	public function __call($method,$arguments){
47
	public function __call($method,$arguments){
48
		
48
 
49
		#取得當前執行的函式
49
		#取得當前執行的函式
50
		$result["function"]=__FUNCTION__;
50
		$result["function"]=__FUNCTION__;
51
		
51
 
52
		#設置執行不正常
52
		#設置執行不正常
53
		$result["status"]="false";
53
		$result["status"]="false";
54
		
54
 
55
		#設置執行錯誤
55
		#設置執行錯誤
56
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
56
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
57
		
57
 
58
		#設置所丟入的參數
58
		#設置所丟入的參數
59
		$result["error"][]=$arguments;
59
		$result["error"][]=$arguments;
60
		
60
 
61
		#回傳結果
61
		#回傳結果
62
		return $result;
62
		return $result;
63
		
63
 
64
		}#function __call end
64
		}#function __call end
65
		
65
 
66
	/*
66
	/*
67
	#函式說明:
67
	#函式說明:
68
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
68
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
69
	#回傳結果:
69
	#回傳結果:
70
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
70
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 75... Line 75...
75
	#$arguments,陣列,為呼叫方法時所用的參數.
75
	#$arguments,陣列,為呼叫方法時所用的參數.
76
	#參考資料:
76
	#參考資料:
77
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
77
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
78
	*/
78
	*/
79
	public static function __callStatic($method,$arguments){
79
	public static function __callStatic($method,$arguments){
80
		
80
 
81
		#取得當前執行的函式
81
		#取得當前執行的函式
82
		$result["function"]=__FUNCTION__;
82
		$result["function"]=__FUNCTION__;
83
		
83
 
84
		#設置執行不正常
84
		#設置執行不正常
85
		$result["status"]="false";
85
		$result["status"]="false";
86
		
86
 
87
		#設置執行錯誤
87
		#設置執行錯誤
88
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
88
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
89
		
89
 
90
		#設置所丟入的參數
90
		#設置所丟入的參數
91
		$result["error"][]=$arguments;
91
		$result["error"][]=$arguments;
92
		
92
 
93
		#回傳結果
93
		#回傳結果
94
		return $result;
94
		return $result;
95
		
95
 
96
		}#function __callStatic end
96
		}#function __callStatic end
97
 
97
 
98
	/*
98
	/*
99
	#函式說明:
99
	#函式說明:
100
	#放置可以套用css樣式的圖片
100
	#放置可以套用css樣式的圖片
101
	#回傳結果:
101
	#回傳結果:
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
103
	#$result["error"],錯誤訊息陣列
103
	#$result["error"],錯誤訊息陣列
104
	#$result["function"],當前函數執行的名稱
104
	#$result["function"],當前函數執行的名稱
105
	#$result["content"],印出圖片的語法。		
105
	#$result["content"],印出圖片的語法。
106
	#必填參數:
106
	#必填參數:
107
	$conf["position"]="";#圖片位置
107
	$conf["position"]="";#圖片位置
108
	#可省略參數:
108
	#可省略參數:
109
	#$conf["id"]="";#圖片的id,沒有就不設定.
109
	#$conf["id"]="";#圖片的id,沒有就不設定.
110
	#$conf["alt"]="";#若沒有圖片要用什麼文字顯示。
110
	#$conf["alt"]="";#若沒有圖片要用什麼文字顯示。
111
	#$conf["class"]="";#要套用的css樣式類別名稱。
111
	#$conf["class"]="";#要套用的css樣式類別名稱。
112
	#參考資料:
112
	#參考資料:
113
	#無.
113
	#無.
114
	#備註:
114
	#備註:
115
	#無.
115
	#無.
116
	*/	
116
	*/
117
	public static function show(&$conf){
117
	public static function show(&$conf){
118
 
118
 
119
		#初始化要回傳的變數
119
		#初始化要回傳的變數
120
		$result=array();
120
		$result=array();
121
		
121
 
122
		#記錄當前執行的函數名稱
122
		#記錄當前執行的函數名稱
123
		$result["function"]=__FUNCTION__;
123
		$result["function"]=__FUNCTION__;
124
		
124
 
125
		#如果 $conf 不為陣列
125
		#如果 $conf 不為陣列
126
		if(gettype($conf)!="array"){
126
		if(gettype($conf)!="array"){
127
			
127
 
128
			#設置執行失敗
128
			#設置執行失敗
129
			$result["status"]="false";
129
			$result["status"]="false";
130
			
130
 
131
			#設置執行錯誤訊息
131
			#設置執行錯誤訊息
132
			$result["error"][]="\$conf變數須為陣列形態";
132
			$result["error"][]="\$conf變數須為陣列形態";
133
 
133
 
134
			#如果傳入的參數為 null
134
			#如果傳入的參數為 null
135
			if($conf==null){
135
			if($conf==null){
136
				
136
 
137
				#設置執行錯誤訊息
137
				#設置執行錯誤訊息
138
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
138
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
139
				
139
 
140
				}#if end
140
				}#if end
141
 
141
 
142
			#回傳結果
142
			#回傳結果
143
			return $result;
143
			return $result;
144
			
144
 
145
			}#if end
145
			}#if end
146
			
146
 
147
		#檢查參數
147
		#檢查參數
148
		#函式說明:
148
		#函式說明:
149
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
149
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
150
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
150
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
151
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
151
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 160... Line 160...
160
		#必填寫的參數:
160
		#必填寫的參數:
161
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
161
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
162
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
162
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
163
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
163
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
164
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("position");
164
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("position");
165
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
165
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
166
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
166
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
167
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
167
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
168
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
168
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
169
		#可以省略的參數:
169
		#可以省略的參數:
170
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
170
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
171
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
171
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
172
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
172
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
173
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("id","alt","class");
173
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("id","alt","class");
174
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
174
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
175
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
175
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
176
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
176
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
177
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,"","");
177
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,"","");
178
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
178
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
179
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
179
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
Line 182... Line 182...
182
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
182
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
183
		unset($conf["variableCheck::checkArguments"]);
183
		unset($conf["variableCheck::checkArguments"]);
184
 
184
 
185
		#如果檢查失敗
185
		#如果檢查失敗
186
		if($checkResult["status"]=="false"){
186
		if($checkResult["status"]=="false"){
187
			
187
 
188
			#設置錯誤狀態
188
			#設置錯誤狀態
189
			$result["status"]="false";
189
			$result["status"]="false";
190
			
190
 
191
			#設置錯誤提示
191
			#設置錯誤提示
192
			$result["error"]=$checkResult;
192
			$result["error"]=$checkResult;
193
			
193
 
194
			#回傳結果
194
			#回傳結果
195
			return $result;
195
			return $result;
196
			
196
 
197
			}#if end
197
			}#if end
198
 
198
 
199
		#如果檢查不通過
199
		#如果檢查不通過
200
		if($checkResult["passed"]=="false"){
200
		if($checkResult["passed"]=="false"){
201
			
201
 
202
			#設置錯誤狀態
202
			#設置錯誤狀態
203
			$result["status"]="false";
203
			$result["status"]="false";
204
			
204
 
205
			#設置錯誤提示
205
			#設置錯誤提示
206
			$result["error"]=$checkResult;
206
			$result["error"]=$checkResult;
207
			
207
 
208
			#回傳結果
208
			#回傳結果
209
			return $result;
209
			return $result;
210
			
210
 
211
			}#if end
211
			}#if end
212
		
212
 
213
		#如果$conf["class"]不為""
213
		#如果$conf["class"]不為""
214
		if($conf["class"]!=""){
214
		if($conf["class"]!=""){
215
 
215
 
216
			#則套用css樣式。
216
			#則套用css樣式。
217
			$conf["class"] = "class = \"".$conf["class"]."\"";
217
			$conf["class"] = "class = \"".$conf["class"]."\"";
Line 236... Line 236...
236
 
236
 
237
			}#if end
237
			}#if end
238
 
238
 
239
		#回傳放置圖片的語法
239
		#回傳放置圖片的語法
240
		$result["content"]="<img src = \"".$conf["position"]."\" ".$conf["alt"]." ".$conf["class"]." ".$id.">";
240
		$result["content"]="<img src = \"".$conf["position"]."\" ".$conf["alt"]." ".$conf["class"]." ".$id.">";
241
		
241
 
242
		#設置執行正常
242
		#設置執行正常
243
		$result["status"]="true";
243
		$result["status"]="true";
244
		
244
 
245
		#回傳結果
245
		#回傳結果
246
		return $result;
246
		return $result;
247
		
247
 
248
		}#function showClassImg end
248
		}#function showClassImg end
249
 
249
 
250
	/*
250
	/*
251
	#函式說明:
251
	#函式說明:
252
	#使用在用戶端的圖片插入到網頁裡面,用戶端要有提供類似apache的功能,這樣才能存取用戶端的圖片。
252
	#使用在用戶端的圖片插入到網頁裡面,用戶端要有提供類似apache的功能,這樣才能存取用戶端的圖片。
253
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
253
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
254
	#$result["error"],錯誤訊息陣列
254
	#$result["error"],錯誤訊息陣列
255
	#$result["function"],當前函數執行的名稱
255
	#$result["function"],當前函數執行的名稱
256
	#$result["content"],印出圖片的語法。		
256
	#$result["content"],印出圖片的語法。
257
	#必填參數:
257
	#必填參數:
258
	$conf["AbsoluteFilePosition"]="";#去掉開頭(127.0.0.1或localhost)的檔案在本機的絕對位置。
258
	$conf["AbsoluteFilePosition"]="";#去掉開頭(127.0.0.1或localhost)的檔案在本機的絕對位置。
259
	#可省略參數:
259
	#可省略參數:
260
	#$conf["method"]="";#通訊協定名稱,預設爲"http"
260
	#$conf["method"]="";#通訊協定名稱,預設爲"http"
261
	#$conf["port"]="";#存取用戶端檔案時的port
261
	#$conf["port"]="";#存取用戶端檔案時的port
Line 269... Line 269...
269
	*/
269
	*/
270
	public static function showLocal($conf){
270
	public static function showLocal($conf){
271
 
271
 
272
		#初始化要回傳的變數
272
		#初始化要回傳的變數
273
		$result=array();
273
		$result=array();
274
		
274
 
275
		#記錄當前執行的函數名稱
275
		#記錄當前執行的函數名稱
276
		$result["function"]=__FUNCTION__;
276
		$result["function"]=__FUNCTION__;
277
		
277
 
278
		#如果 $conf 不為陣列
278
		#如果 $conf 不為陣列
279
		if(gettype($conf)!="array"){
279
		if(gettype($conf)!="array"){
280
			
280
 
281
			#設置執行失敗
281
			#設置執行失敗
282
			$result["status"]="false";
282
			$result["status"]="false";
283
			
283
 
284
			#設置執行錯誤訊息
284
			#設置執行錯誤訊息
285
			$result["error"][]="\$conf變數須為陣列形態";
285
			$result["error"][]="\$conf變數須為陣列形態";
286
 
286
 
287
			#如果傳入的參數為 null
287
			#如果傳入的參數為 null
288
			if($conf==null){
288
			if($conf==null){
289
				
289
 
290
				#設置執行錯誤訊息
290
				#設置執行錯誤訊息
291
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
291
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
292
				
292
 
293
				}#if end
293
				}#if end
294
 
294
 
295
			#回傳結果
295
			#回傳結果
296
			return $result;
296
			return $result;
297
			
297
 
298
			}#if end
298
			}#if end
299
 
299
 
300
		#如果 $conf["AbsoluteFilePosition"] 沒有設定
300
		#如果 $conf["AbsoluteFilePosition"] 沒有設定
301
		if(!isset($conf["AbsoluteFilePosition"])){
301
		if(!isset($conf["AbsoluteFilePosition"])){
302
 
302
 
303
			#設置執行失敗
303
			#設置執行失敗
304
			$result["status"]="false";
304
			$result["status"]="false";
305
			
305
 
306
			#設置執行錯誤訊息
306
			#設置執行錯誤訊息
307
			$result["error"][]="\$conf[\"AbsoluteFilePosition\"]參數沒有設定!";
307
			$result["error"][]="\$conf[\"AbsoluteFilePosition\"]參數沒有設定!";
308
 
308
 
309
			#回傳結果
309
			#回傳結果
310
			return $result;
310
			return $result;
Line 321... Line 321...
321
		#如果$conf["port"]沒設定
321
		#如果$conf["port"]沒設定
322
		if(!isset($conf["port"])){
322
		if(!isset($conf["port"])){
323
 
323
 
324
			#則設爲"80"
324
			#則設爲"80"
325
			$conf["port"]="";
325
			$conf["port"]="";
326
			
326
 
327
			}#if end
327
			}#if end
328
 
328
 
329
		#反之有設定
329
		#反之有設定
330
		else{
330
		else{
331
 
331
 
332
			#加上指定連接口的符號
332
			#加上指定連接口的符號
333
			$conf["port"]=":".$conf["port"];
333
			$conf["port"]=":".$conf["port"];
334
 
334
 
335
			}#if end
335
			}#if end
336
	
336
 
337
		#如果$conf["width"]沒設定
337
		#如果$conf["width"]沒設定
338
		if(!isset($conf["width"])){
338
		if(!isset($conf["width"])){
339
 
339
 
340
			#則$conf["width"]爲空
340
			#則$conf["width"]爲空
341
			$conf["width"]="";
341
			$conf["width"]="";
342
			
342
 
343
			}#if end
343
			}#if end
344
 
344
 
345
		#如果$conf["width"]有設定
345
		#如果$conf["width"]有設定
346
		else{
346
		else{
347
 
347
 
348
			#則按照設定值
348
			#則按照設定值
349
			$conf["width"]=" width=".$conf["width"];
349
			$conf["width"]=" width=".$conf["width"];
350
			
350
 
351
			}#else end
351
			}#else end
352
 
352
 
353
		#如果$conf["height"]沒設定
353
		#如果$conf["height"]沒設定
354
		if(!isset($conf["height"])){
354
		if(!isset($conf["height"])){
355
 
355
 
356
			#則$conf["height"]爲空
356
			#則$conf["height"]爲空
357
			$conf["height"]="";
357
			$conf["height"]="";
358
			
358
 
359
			}#if end
359
			}#if end
360
 
360
 
361
		#如果$conf["height"]有設定
361
		#如果$conf["height"]有設定
362
		else{
362
		else{
363
			
363
 
364
			#則按照設定值
364
			#則按照設定值
365
			$conf["height"]=" height=".$conf["height"];
365
			$conf["height"]=" height=".$conf["height"];
366
			
366
 
367
			}#else end
367
			}#else end
368
 
368
 
369
		#如果$conf["alt"]沒設定
369
		#如果$conf["alt"]沒設定
370
		if(!isset($conf["alt"])){
370
		if(!isset($conf["alt"])){
371
 
371
 
372
			#則$conf["alt"]爲空
372
			#則$conf["alt"]爲空
373
			$conf["alt"]="";
373
			$conf["alt"]="";
374
			
374
 
375
			}#if end
375
			}#if end
376
 
376
 
377
		#如果$conf["alt"]有設定
377
		#如果$conf["alt"]有設定
378
		else{
378
		else{
379
 
379
 
Line 382... Line 382...
382
 
382
 
383
			}#else end
383
			}#else end
384
 
384
 
385
		#將客戶端IP放到 $LocalIP 變數裡面
385
		#將客戶端IP放到 $LocalIP 變數裡面
386
		$LocalIP = $_SERVER['REMOTE_ADDR'];
386
		$LocalIP = $_SERVER['REMOTE_ADDR'];
387
	
387
 
388
		#放置圖片的語法
388
		#放置圖片的語法
389
		$result["content"]="<img src =".$conf["method"]."://".$LocalIP.$conf["port"]."/".$conf["AbsoluteFilePosition"]." ".$conf["width"]." ".$conf["height"]." ".$conf["alt"].">";
389
		$result["content"]="<img src =".$conf["method"]."://".$LocalIP.$conf["port"]."/".$conf["AbsoluteFilePosition"]." ".$conf["width"]." ".$conf["height"]." ".$conf["alt"].">";
390
	
390
 
391
		#設置執行正常
391
		#設置執行正常
392
		$result["status"]="true";
392
		$result["status"]="true";
393
	
393
 
394
		#印出圖片
394
		#印出圖片
395
		return $result;
395
		return $result;
396
 
396
 
397
		}#function showLocalImgWithPort end
397
		}#function showLocalImgWithPort end
398
 
398
 
Line 435... Line 435...
435
	*/
435
	*/
436
	public static function create(&$conf){
436
	public static function create(&$conf){
437
 
437
 
438
		#初始化要回傳的變數
438
		#初始化要回傳的變數
439
		$result=array();
439
		$result=array();
440
		
440
 
441
		#記錄當前執行的函數名稱
441
		#記錄當前執行的函數名稱
442
		$result["function"]=__FUNCTION__;
442
		$result["function"]=__FUNCTION__;
443
		
443
 
444
		#如果 $conf 不為陣列
444
		#如果 $conf 不為陣列
445
		if(gettype($conf)!="array"){
445
		if(gettype($conf)!="array"){
446
			
446
 
447
			#設置執行失敗
447
			#設置執行失敗
448
			$result["status"]="false";
448
			$result["status"]="false";
449
			
449
 
450
			#設置執行錯誤訊息
450
			#設置執行錯誤訊息
451
			$result["error"][]="\$conf變數須為陣列形態";
451
			$result["error"][]="\$conf變數須為陣列形態";
452
 
452
 
453
			#如果傳入的參數為 null
453
			#如果傳入的參數為 null
454
			if($conf==null){
454
			if($conf==null){
455
				
455
 
456
				#設置執行錯誤訊息
456
				#設置執行錯誤訊息
457
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
457
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
458
				
458
 
459
				}#if end
459
				}#if end
460
 
460
 
461
			#回傳結果
461
			#回傳結果
462
			return $result;
462
			return $result;
463
			
463
 
464
			}#if end
464
			}#if end
465
 
465
 
466
		#檢查參數
466
		#檢查參數
467
		#函式說明:
467
		#函式說明:
468
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
468
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
Line 479... Line 479...
479
		#必填寫的參數:
479
		#必填寫的參數:
480
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
480
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
481
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
481
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
482
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
482
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
483
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgWidth","imgHeight","imgStoreAddAndName");
483
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgWidth","imgHeight","imgStoreAddAndName");
484
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
484
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
485
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","integer","integer","string");
485
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","integer","integer","string");
486
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
486
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
487
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
487
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
488
		#可以省略的參數:
488
		#可以省略的參數:
489
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
489
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
490
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
490
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
491
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
491
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
492
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("bgRedNum","bgGreenNum","bgBlueNum","strOnImg","textRedNum","textGreenNum","textBlueNum","drawLine","replaceOriImg");
492
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("bgRedNum","bgGreenNum","bgBlueNum","strOnImg","textRedNum","textGreenNum","textBlueNum","drawLine","replaceOriImg");
493
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
493
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
494
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("integer","integer","integer","string","integer","integer","integer","array","string");
494
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("integer","integer","integer","string","integer","integer","integer","array","string");
495
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
495
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
496
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(0,0,0,"",255,255,255,null,"false");
496
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(0,0,0,"",255,255,255,null,"false");
497
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
497
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
498
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
498
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
Line 501... Line 501...
501
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
501
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
502
		unset($conf["variableCheck::checkArguments"]);
502
		unset($conf["variableCheck::checkArguments"]);
503
 
503
 
504
		#如果檢查失敗
504
		#如果檢查失敗
505
		if($checkResult["status"]=="false"){
505
		if($checkResult["status"]=="false"){
506
			
506
 
507
			#設置錯誤狀態
507
			#設置錯誤狀態
508
			$result["status"]="false";
508
			$result["status"]="false";
509
			
509
 
510
			#設置錯誤提示
510
			#設置錯誤提示
511
			$result["error"]=$checkResult;
511
			$result["error"]=$checkResult;
512
			
512
 
513
			#回傳結果
513
			#回傳結果
514
			return $result;
514
			return $result;
515
			
515
 
516
			}#if end
516
			}#if end
517
 
517
 
518
		#如果檢查不通過
518
		#如果檢查不通過
519
		if($checkResult["passed"]=="false"){
519
		if($checkResult["passed"]=="false"){
520
			
520
 
521
			#設置錯誤狀態
521
			#設置錯誤狀態
522
			$result["status"]="false";
522
			$result["status"]="false";
523
			
523
 
524
			#設置錯誤提示
524
			#設置錯誤提示
525
			$result["error"]=$checkResult;
525
			$result["error"]=$checkResult;
526
			
526
 
527
			#回傳結果
527
			#回傳結果
528
			return $result;
528
			return $result;
529
			
529
 
530
			}#if end
530
			}#if end
531
 
531
 
532
		#如果有設置 $conf["replaceOriImg"] 變數
532
		#如果有設置 $conf["replaceOriImg"] 變數
533
		if(isset($conf["replaceOriImg"])){
533
		if(isset($conf["replaceOriImg"])){
534
 
534
 
Line 553... Line 553...
553
				#參考資料來源:
553
				#參考資料來源:
554
				#http:#php.net/manual/en/function.file-exists.php
554
				#http:#php.net/manual/en/function.file-exists.php
555
				#http:#php.net/manual/en/control-structures.foreach.php
555
				#http:#php.net/manual/en/control-structures.foreach.php
556
				$fileExist=fileAccess::checkMultiFileExist($conf["fileAccess"]["checkMutiFileExist"]);
556
				$fileExist=fileAccess::checkMultiFileExist($conf["fileAccess"]["checkMutiFileExist"]);
557
				unset($conf["fileAccess"]["checkMutiFileExist"]);
557
				unset($conf["fileAccess"]["checkMutiFileExist"]);
558
				
558
 
559
				#如果檢查圖片檔案存在失敗
559
				#如果檢查圖片檔案存在失敗
560
				if($fileExist["status"]=="false"){
560
				if($fileExist["status"]=="false"){
561
					
561
 
562
					#設置錯誤狀態
562
					#設置錯誤狀態
563
					$result["status"]="false";
563
					$result["status"]="false";
564
					
564
 
565
					#設置錯誤提示
565
					#設置錯誤提示
566
					$result["error"]=$fileExist;
566
					$result["error"]=$fileExist;
567
					
567
 
568
					#回傳結果
568
					#回傳結果
569
					return $result;
569
					return $result;
570
					
570
 
571
					}#if end
571
					}#if end
572
 
572
 
573
				#如果目標檔案存在
573
				#如果目標檔案存在
574
				if($fileExist["varExist"][0]=="true"){
574
				if($fileExist["varExist"][0]=="true"){
575
 
575
 
Line 585... Line 585...
585
					$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgStoreAddAndName"].".png";#要移除檔案的位置
585
					$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgStoreAddAndName"].".png";#要移除檔案的位置
586
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
586
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
587
					$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
587
					$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
588
					$delFile=fileAccess::delFile($conf["fileAccess::delFile"]);
588
					$delFile=fileAccess::delFile($conf["fileAccess::delFile"]);
589
					unset($conf["fileAccess::delFile"]);
589
					unset($conf["fileAccess::delFile"]);
590
	
590
 
591
					#如果移除檔案失敗
591
					#如果移除檔案失敗
592
					if($delFile["status"]=="false"){
592
					if($delFile["status"]=="false"){
593
						
593
 
594
						#設置錯誤狀態
594
						#設置錯誤狀態
595
						$result["status"]="false";
595
						$result["status"]="false";
596
						
596
 
597
						#設置錯誤提示
597
						#設置錯誤提示
598
						$result["error"]=$delFile;
598
						$result["error"]=$delFile;
599
						
599
 
600
						#回傳結果
600
						#回傳結果
601
						return $result;
601
						return $result;
602
						
602
 
603
						}#if end
603
						}#if end
604
 
604
 
605
					}#if end
605
					}#if end
606
 
606
 
607
				}#if end
607
				}#if end
Line 619... Line 619...
619
		#參考資料來源:http://php.net/manual/en/function.imagecreate.php
619
		#參考資料來源:http://php.net/manual/en/function.imagecreate.php
620
		$im = \imagecreate($conf["imgWidth"],$conf["imgHeight"]);
620
		$im = \imagecreate($conf["imgWidth"],$conf["imgHeight"]);
621
 
621
 
622
		#如果 $im 為 FALSE
622
		#如果 $im 為 FALSE
623
		if($im==FALSE){
623
		if($im==FALSE){
624
			
624
 
625
			#設置執行失敗
625
			#設置執行失敗
626
			$result["status"]="false";
626
			$result["status"]="false";
627
			
627
 
628
			#設置執行錯誤訊息
628
			#設置執行錯誤訊息
629
			$result["error"][]="建立底層為空白的圖片失敗";
629
			$result["error"][]="建立底層為空白的圖片失敗";
630
			
630
 
631
			#回傳結果
631
			#回傳結果
632
			return $result;
632
			return $result;
633
			
633
 
634
			}#if end
634
			}#if end
635
 
635
 
636
		#設定接下來給$im那張圖用的顏色,必須爲函式 imagecreate 製造的圖片才行
636
		#設定接下來給$im那張圖用的顏色,必須爲函式 imagecreate 製造的圖片才行
637
		#參數1爲設定好的圖片要給那張圖使用
637
		#參數1爲設定好的圖片要給那張圖使用
638
		#參數2爲紅色的用量0~255
638
		#參數2爲紅色的用量0~255
Line 640... Line 640...
640
		#參數4爲藍色的用量0~255
640
		#參數4爲藍色的用量0~255
641
		$bgColor = imagecolorallocate($im,$conf["bgRedNum"],$conf["bgGreenNum"], $conf["bgBlueNum"]);
641
		$bgColor = imagecolorallocate($im,$conf["bgRedNum"],$conf["bgGreenNum"], $conf["bgBlueNum"]);
642
 
642
 
643
		#如果設定背景顏色失敗
643
		#如果設定背景顏色失敗
644
		if($bgColor===FALSE){
644
		if($bgColor===FALSE){
645
			
645
 
646
			#設置執行失敗
646
			#設置執行失敗
647
			$result["status"]="false";
647
			$result["status"]="false";
648
			
648
 
649
			#設置執行錯誤訊息
649
			#設置執行錯誤訊息
650
			$result["error"][]="設定背景顏色失敗";
650
			$result["error"][]="設定背景顏色失敗";
651
			
651
 
652
			#回傳結果
652
			#回傳結果
653
			return $result;
653
			return $result;
654
			
654
 
655
			}#if end
655
			}#if end
656
 
656
 
657
		#設定接下來給文字使用的顏色,必須爲函式 imagecreate 製造的圖片才行
657
		#設定接下來給文字使用的顏色,必須爲函式 imagecreate 製造的圖片才行
658
		#參數1爲設定好的圖片要給那張圖使用
658
		#參數1爲設定好的圖片要給那張圖使用
659
		#參數2爲紅色的用量0~255
659
		#參數2爲紅色的用量0~255
Line 661... Line 661...
661
		#參數4爲藍色的用量0~255
661
		#參數4爲藍色的用量0~255
662
		$textColor = imagecolorallocate($im,$conf["textRedNum"],$conf["textGreenNum"], $conf["textBlueNum"]);
662
		$textColor = imagecolorallocate($im,$conf["textRedNum"],$conf["textGreenNum"], $conf["textBlueNum"]);
663
 
663
 
664
		#如果設定給文字使用的顏色失敗
664
		#如果設定給文字使用的顏色失敗
665
		if($textColor===FALSE){
665
		if($textColor===FALSE){
666
			
666
 
667
			#設置執行失敗
667
			#設置執行失敗
668
			$result["status"]="false";
668
			$result["status"]="false";
669
			
669
 
670
			#設置執行錯誤訊息
670
			#設置執行錯誤訊息
671
			$result["error"][]="設定給文字使用的顏色失敗";
671
			$result["error"][]="設定給文字使用的顏色失敗";
672
			
672
 
673
			#回傳結果
673
			#回傳結果
674
			return $result;
674
			return $result;
675
			
675
 
676
			}#if end
676
			}#if end
677
 
677
 
678
		#建立文字放在圖片上面
678
		#建立文字放在圖片上面
679
		#參數1爲要給哪張圖片使用,必須爲函式 imagecreate 製造的圖片才行
679
		#參數1爲要給哪張圖片使用,必須爲函式 imagecreate 製造的圖片才行
680
		#參數2爲字型的大小,可用的值爲1~5
680
		#參數2爲字型的大小,可用的值爲1~5
Line 685... Line 685...
685
		#參考資料來源:http://php.net/manual/en/function.imagestring.php
685
		#參考資料來源:http://php.net/manual/en/function.imagestring.php
686
		$imagestring=imagestring($im, 5 , 5 , 5 ,$conf["strOnImg"],$textColor);
686
		$imagestring=imagestring($im, 5 , 5 , 5 ,$conf["strOnImg"],$textColor);
687
 
687
 
688
		#如果在圖片上放置文字失敗
688
		#如果在圖片上放置文字失敗
689
		if($imagestring==FALSE){
689
		if($imagestring==FALSE){
690
			
690
 
691
			#設置執行失敗
691
			#設置執行失敗
692
			$result["status"]="false";
692
			$result["status"]="false";
693
			
693
 
694
			#設置執行錯誤訊息
694
			#設置執行錯誤訊息
695
			$result["error"][]="在圖片上放置文字失敗";
695
			$result["error"][]="在圖片上放置文字失敗";
696
			
696
 
697
			#回傳結果
697
			#回傳結果
698
			return $result;
698
			return $result;
699
			
699
 
700
			}#if end
700
			}#if end
701
 
701
 
702
		#如果有設定畫線
702
		#如果有設定畫線
703
		if(isset($conf["drawLine"])){
703
		if(isset($conf["drawLine"])){
704
 
704
 
705
			#有幾條線就執行幾次
705
			#有幾條線就執行幾次
706
			foreach($conf["drawLine"] as $lineInfo){
706
			foreach($conf["drawLine"] as $lineInfo){
707
 
707
 
708
				#解析線的資訊
708
				#解析線的資訊
709
				#範例格式: 
709
				#範例格式:
710
				#0,0,200,100,50,100,150;
710
				#0,0,200,100,50,100,150;
711
 
711
 
712
				#分割字串(以,分開)
712
				#分割字串(以,分開)
713
				#函式說明:
713
				#函式說明:
714
				#將固定格式的字串分開,並回傳分開的結果。
714
				#將固定格式的字串分開,並回傳分開的結果。
Line 721... Line 721...
721
				$spiltedStr1=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
721
				$spiltedStr1=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
722
				unset($conf["stringProcess"]["spiltString"]);
722
				unset($conf["stringProcess"]["spiltString"]);
723
 
723
 
724
				#如果分割字串失敗
724
				#如果分割字串失敗
725
				if($spiltedStr1["status"]=="false"){
725
				if($spiltedStr1["status"]=="false"){
726
					
726
 
727
					#設置執行失敗
727
					#設置執行失敗
728
					$result["status"]="false";
728
					$result["status"]="false";
729
					
729
 
730
					#設置執行錯誤訊息
730
					#設置執行錯誤訊息
731
					$result["error"]=$spiltedStr1;
731
					$result["error"]=$spiltedStr1;
732
					
732
 
733
					#回傳結果
733
					#回傳結果
734
					return $result;
734
					return $result;
735
					
735
 
736
					}#if end
736
					}#if end
737
 
737
 
738
				#建立線條的顏色
738
				#建立線條的顏色
739
				#設定接下來給$im那張圖上線條用的顏色,必須爲函式 imagecreate 製造的圖片才行
739
				#設定接下來給$im那張圖上線條用的顏色,必須爲函式 imagecreate 製造的圖片才行
740
				#參數1爲設定好的圖片要給那張圖使用
740
				#參數1爲設定好的圖片要給那張圖使用
Line 743... Line 743...
743
				#參數4爲藍色的用量0~255
743
				#參數4爲藍色的用量0~255
744
				$lineColor=imagecolorallocate($im,(int)$spiltedStr1["dataArray"][4],(int)$spiltedStr1["dataArray"][5],(int)$spiltedStr1["dataArray"][6]);
744
				$lineColor=imagecolorallocate($im,(int)$spiltedStr1["dataArray"][4],(int)$spiltedStr1["dataArray"][5],(int)$spiltedStr1["dataArray"][6]);
745
 
745
 
746
				#如果設定給線條使用的顏色失敗
746
				#如果設定給線條使用的顏色失敗
747
				if($lineColor===FALSE){
747
				if($lineColor===FALSE){
748
			
748
 
749
					#設置執行失敗
749
					#設置執行失敗
750
					$result["status"]="false";
750
					$result["status"]="false";
751
					
751
 
752
					#設置執行錯誤訊息
752
					#設置執行錯誤訊息
753
					$result["error"][]="設定給線條使用的顏色失敗";
753
					$result["error"][]="設定給線條使用的顏色失敗";
754
					
754
 
755
					#回傳結果
755
					#回傳結果
756
					return $result;
756
					return $result;
757
					
757
 
758
					}#if end
758
					}#if end
759
 
759
 
760
				#劃綫
760
				#劃綫
761
				#參數1爲要畫在那張圖片上面,必須爲函式 imagecreate 製造的圖片才行
761
				#參數1爲要畫在那張圖片上面,必須爲函式 imagecreate 製造的圖片才行
762
				#參數2爲綫的x軸起點
762
				#參數2爲綫的x軸起點
Line 766... Line 766...
766
				#參數6爲線的顏色樣式,必須使用函式 imagecolorallocate 產生的顏色才行
766
				#參數6爲線的顏色樣式,必須使用函式 imagecolorallocate 產生的顏色才行
767
				$imageline=imageline($im,(int)$spiltedStr1["dataArray"][0],(int)$spiltedStr1["dataArray"][1],(int)$spiltedStr1["dataArray"][2],$spiltedStr1["dataArray"][3],$lineColor);
767
				$imageline=imageline($im,(int)$spiltedStr1["dataArray"][0],(int)$spiltedStr1["dataArray"][1],(int)$spiltedStr1["dataArray"][2],$spiltedStr1["dataArray"][3],$lineColor);
768
 
768
 
769
				#如果劃線失敗
769
				#如果劃線失敗
770
				if($imageline==FALSE){
770
				if($imageline==FALSE){
771
					
771
 
772
					#設置執行失敗
772
					#設置執行失敗
773
					$result["status"]="false";
773
					$result["status"]="false";
774
					
774
 
775
					#設置執行錯誤訊息
775
					#設置執行錯誤訊息
776
					$result["error"][]="劃線失敗";
776
					$result["error"][]="劃線失敗";
777
					
777
 
778
					#回傳結果
778
					#回傳結果
779
					return $result;
779
					return $result;
780
					
780
 
781
					}#if end
781
					}#if end
782
 
782
 
783
				}#foreach end
783
				}#foreach end
784
 
784
 
785
			}#if end
785
			}#if end
786
 
786
 
787
		#建立圖片並存到伺服端上
787
		#建立圖片並存到伺服端上
788
		#參數1爲圖片的內容變數,必須爲函式 imagecreate 製造的圖片才行 
788
		#參數1爲圖片的內容變數,必須爲函式 imagecreate 製造的圖片才行
789
		#參數2爲圖片要存在伺服端的位置與名稱
789
		#參數2爲圖片要存在伺服端的位置與名稱
790
		#參考資料來源:http://php.net/manual/en/function.imagepng.php
790
		#參考資料來源:http://php.net/manual/en/function.imagepng.php
791
		$imagepng=imagepng($im,$conf["imgStoreAddAndName"].".png");
791
		$imagepng=imagepng($im,$conf["imgStoreAddAndName"].".png");
792
 
792
 
793
		#如果將圖片輸出成檔案失敗
793
		#如果將圖片輸出成檔案失敗
794
		if($imagepng==FALSE){
794
		if($imagepng==FALSE){
795
			
795
 
796
			#設置執行失敗
796
			#設置執行失敗
797
			$result["status"]="false";
797
			$result["status"]="false";
798
			
798
 
799
			#設置執行錯誤訊息
799
			#設置執行錯誤訊息
800
			$result["error"][]="將圖片輸出到「".$conf["imgStoreAddAndName"].".png」"."失敗";
800
			$result["error"][]="將圖片輸出到「".$conf["imgStoreAddAndName"].".png」"."失敗";
801
			
801
 
802
			#回傳結果
802
			#回傳結果
803
			return $result;
803
			return $result;
804
			
804
 
805
			}#if end
805
			}#if end
806
 
806
 
807
		#將圖片從記憶體裏面釋放,必須爲函式 imagecreate 製造的圖片才行
807
		#將圖片從記憶體裏面釋放,必須爲函式 imagecreate 製造的圖片才行
808
		$imagedestroy=imagedestroy($im);
808
		$imagedestroy=imagedestroy($im);
809
 
809
 
810
		#如果卸除編輯圖片的記憶體失敗
810
		#如果卸除編輯圖片的記憶體失敗
811
		if($imagedestroy==FALSE){
811
		if($imagedestroy==FALSE){
812
			
812
 
813
			#設置執行失敗
813
			#設置執行失敗
814
			$result["status"]="false";
814
			$result["status"]="false";
815
			
815
 
816
			#設置執行錯誤訊息
816
			#設置執行錯誤訊息
817
			$result["error"][]="卸除編輯圖片的記憶體失敗";
817
			$result["error"][]="卸除編輯圖片的記憶體失敗";
818
			
818
 
819
			#回傳結果
819
			#回傳結果
820
			return $result;
820
			return $result;
821
			
821
 
822
			}#if end
822
			}#if end
823
 
823
 
824
		#取得完整的圖片位置與名稱
824
		#取得完整的圖片位置與名稱
825
		$result["content"]=$conf["imgStoreAddAndName"].".png";
825
		$result["content"]=$conf["imgStoreAddAndName"].".png";
826
 
826
 
Line 838... Line 838...
838
	#回傳結果:
838
	#回傳結果:
839
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
839
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
840
	#$result["error"],錯誤訊息
840
	#$result["error"],錯誤訊息
841
	#$result["content"]["imgWithoutImgTag"],img的src數值內容.
841
	#$result["content"]["imgWithoutImgTag"],img的src數值內容.
842
	#$result["content"]["img"],圖片的連結資訊
842
	#$result["content"]["img"],圖片的連結資訊
843
	#$result["function"],當前執行的函數名稱 
843
	#$result["function"],當前執行的函數名稱
844
	#必填參數:
844
	#必填參數:
845
	#$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
845
	#$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
846
	$conf["imgPosition"]="";
846
	$conf["imgPosition"]="";
847
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
847
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
848
	$conf["fileArgu"]=__FILE__;
848
	$conf["fileArgu"]=__FILE__;
Line 864... Line 864...
864
	#壓縮2元碼=>http://php.net/manual/en/function.base64-encode.php
864
	#壓縮2元碼=>http://php.net/manual/en/function.base64-encode.php
865
	#備註:
865
	#備註:
866
	#參數mimeType可改用fileAccess::getFileContent來取得.
866
	#參數mimeType可改用fileAccess::getFileContent來取得.
867
	*/
867
	*/
868
	public static function data(&$conf){
868
	public static function data(&$conf){
869
		
869
 
870
		#初始化要回傳的變數
870
		#初始化要回傳的變數
871
		$result=array();
871
		$result=array();
872
		
872
 
873
		#記錄當前執行的函數名稱
873
		#記錄當前執行的函數名稱
874
		$result["function"]=__FUNCTION__;
874
		$result["function"]=__FUNCTION__;
875
		
875
 
876
		#如果 $conf 不為陣列
876
		#如果 $conf 不為陣列
877
		if(gettype($conf)!="array"){
877
		if(gettype($conf)!="array"){
878
			
878
 
879
			#設置執行失敗
879
			#設置執行失敗
880
			$result["status"]="false";
880
			$result["status"]="false";
881
			
881
 
882
			#設置執行錯誤訊息
882
			#設置執行錯誤訊息
883
			$result["error"][]="\$conf變數須為陣列形態";
883
			$result["error"][]="\$conf變數須為陣列形態";
884
 
884
 
885
			#如果傳入的參數為 null
885
			#如果傳入的參數為 null
886
			if($conf==null){
886
			if($conf==null){
887
				
887
 
888
				#設置執行錯誤訊息
888
				#設置執行錯誤訊息
889
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
889
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
890
				
890
 
891
				}#if end
891
				}#if end
892
 
892
 
893
			#回傳結果
893
			#回傳結果
894
			return $result;
894
			return $result;
895
			
895
 
896
			}#if end
896
			}#if end
897
		
897
 
898
		#檢查參數
898
		#檢查參數
899
		#函式說明:
899
		#函式說明:
900
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
900
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
901
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
901
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
902
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
902
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 908... Line 908...
908
		#必填寫的參數:
908
		#必填寫的參數:
909
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
909
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
910
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
910
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
911
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
911
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
912
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgPosition");
912
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgPosition");
913
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
913
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
914
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
914
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
915
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
915
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
916
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
916
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
917
		#可以省略的參數:
917
		#可以省略的參數:
918
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
918
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
919
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
919
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
920
		#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
920
		#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
921
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("alt","style","class","mimeType","compressType","delImg");
921
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("alt","style","class","mimeType","compressType","delImg");
922
		#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
922
		#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
923
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","array","string","string","string","string");
923
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","array","string","string","string","string");
924
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
924
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
925
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,null,null,null,"base64","false");
925
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,null,null,null,"base64","false");
926
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
926
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
927
		#$conf["arrayCountEqualCheck"][]=array();
927
		#$conf["arrayCountEqualCheck"][]=array();
928
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
928
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
929
		unset($conf["variableCheck::checkArguments"]);
929
		unset($conf["variableCheck::checkArguments"]);
930
		
930
 
931
		#如果檢查參數失敗
931
		#如果檢查參數失敗
932
		if($checkResult["status"]=="false"){
932
		if($checkResult["status"]=="false"){
933
			
933
 
934
			#設置執行失敗
934
			#設置執行失敗
935
			$result["status"]="false";
935
			$result["status"]="false";
936
			
936
 
937
			#設置錯誤訊息
937
			#設置錯誤訊息
938
			$result["error"]=$checkResult;
938
			$result["error"]=$checkResult;
939
			
939
 
940
			#回傳結果
940
			#回傳結果
941
			return $result;
941
			return $result;
942
			
942
 
943
			}#if end
943
			}#if end
944
			
944
 
945
		#如果檢查參數不通過
945
		#如果檢查參數不通過
946
		if($checkResult["passed"]=="false"){
946
		if($checkResult["passed"]=="false"){
947
			
947
 
948
			#設置執行失敗
948
			#設置執行失敗
949
			$result["status"]="false";
949
			$result["status"]="false";
950
			
950
 
951
			#設置錯誤訊息
951
			#設置錯誤訊息
952
			$result["error"]=$checkResult;
952
			$result["error"]=$checkResult;
953
			
953
 
954
			#回傳結果
954
			#回傳結果
955
			return $result;
955
			return $result;
956
			
956
 
957
			}#if end
957
			}#if end
958
		
958
 
959
		#函式說明:
959
		#函式說明:
960
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
960
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
961
		#回傳的變數說明:
961
		#回傳的變數說明:
962
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
962
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
963
		#$result["error"],錯誤訊息提示.
963
		#$result["error"],錯誤訊息提示.
Line 990... Line 990...
990
		#無.
990
		#無.
991
		#備註:
991
		#備註:
992
		#無.
992
		#無.
993
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
993
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
994
		unset($conf["fileAccess::getFileContent"]);
994
		unset($conf["fileAccess::getFileContent"]);
995
		
995
 
996
		#如果執行異常
996
		#如果執行異常
997
		if($getFileContent["status"]=="false"){
997
		if($getFileContent["status"]=="false"){
998
			
998
 
999
			#設置執行失敗
999
			#設置執行失敗
1000
			$result["status"]="false";
1000
			$result["status"]="false";
1001
			
1001
 
1002
			#設置錯誤訊息
1002
			#設置錯誤訊息
1003
			$result["error"]=$getFileContent;
1003
			$result["error"]=$getFileContent;
1004
			
1004
 
1005
			#回傳結果
1005
			#回傳結果
1006
			return $result;
1006
			return $result;
1007
			
1007
 
1008
			}#if end
1008
			}#if end
1009
		
1009
 
1010
		#如果 $conf["alt"] 有設定
1010
		#如果 $conf["alt"] 有設定
1011
		if(isset($conf["alt"])){
1011
		if(isset($conf["alt"])){
1012
			
1012
 
1013
			#設置 alt 屬性
1013
			#設置 alt 屬性
1014
			$conf["alt"]=" alt=\"".$conf["alt"]."\" ";
1014
			$conf["alt"]=" alt=\"".$conf["alt"]."\" ";
1015
			
1015
 
1016
			}#if end
1016
			}#if end
1017
			
1017
 
1018
		#反之設為 ""
1018
		#反之設為 ""
1019
		else{
1019
		else{
1020
			
1020
 
1021
			$conf["alt"]="";
1021
			$conf["alt"]="";
1022
			
1022
 
1023
			}#else end
1023
			}#else end
1024
			
1024
 
1025
		#如果 $conf["class"] 有設定
1025
		#如果 $conf["class"] 有設定
1026
		if(isset($conf["class"])){
1026
		if(isset($conf["class"])){
1027
			
1027
 
1028
			#設置 class 屬性
1028
			#設置 class 屬性
1029
			$conf["class"]=" class=\"".$conf["class"]."\" ";
1029
			$conf["class"]=" class=\"".$conf["class"]."\" ";
1030
			
1030
 
1031
			}#if end
1031
			}#if end
1032
			
1032
 
1033
		#反之設為 ""
1033
		#反之設為 ""
1034
		else{
1034
		else{
1035
			
1035
 
1036
			$conf["class"]="";
1036
			$conf["class"]="";
1037
			
1037
 
1038
			}#else end
1038
			}#else end
1039
		
1039
 
1040
		#如果 $conf["delImg"] 等於 "true"
1040
		#如果 $conf["delImg"] 等於 "true"
1041
		if($conf["delImg"]=="true"){
1041
		if($conf["delImg"]=="true"){
1042
			
1042
 
1043
			#移除圖片檔案
1043
			#移除圖片檔案
1044
			#函式說明:
1044
			#函式說明:
1045
			#移除檔案
1045
			#移除檔案
1046
			#回傳結果:
1046
			#回傳結果:
1047
			#$result["status"],"true"代表移除成功,"false"代表移除失敗.
1047
			#$result["status"],"true"代表移除成功,"false"代表移除失敗.
Line 1052... Line 1052...
1052
			$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgPosition"];#要移除檔案的位置
1052
			$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgPosition"];#要移除檔案的位置
1053
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
1053
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
1054
			$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
1054
			$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
1055
			$del=fileAccess::delFile($conf["fileAccess::delFile"]);
1055
			$del=fileAccess::delFile($conf["fileAccess::delFile"]);
1056
			unset($conf["fileAccess::delFile"]);
1056
			unset($conf["fileAccess::delFile"]);
1057
			
1057
 
1058
			#如果移除圖片失敗
1058
			#如果移除圖片失敗
1059
			if($del["status"]=="false"){
1059
			if($del["status"]=="false"){
1060
				
1060
 
1061
				#設置執行失敗
1061
				#設置執行失敗
1062
				$result["status"]="false";
1062
				$result["status"]="false";
1063
				
1063
 
1064
				#設置錯誤訊息
1064
				#設置錯誤訊息
1065
				$result["error"]=$del;
1065
				$result["error"]=$del;
1066
				
1066
 
1067
				#回傳結果
1067
				#回傳結果
1068
				return $result;
1068
				return $result;
1069
				
1069
 
1070
				}#if end
1070
				}#if end
1071
			
1071
 
1072
			}#if end
1072
			}#if end
1073
		
1073
 
1074
		#初始化樣式字串
1074
		#初始化樣式字串
1075
		$style="";
1075
		$style="";
1076
		
1076
 
1077
		#如果有設置 $conf["style"]
1077
		#如果有設置 $conf["style"]
1078
		if(isset($conf["style"])){
1078
		if(isset($conf["style"])){
1079
			
1079
 
1080
			#初始化樣式名稱陣列
1080
			#初始化樣式名稱陣列
1081
			$styleN=array();
1081
			$styleN=array();
1082
			
1082
 
1083
			#初始化樣式值陣列
1083
			#初始化樣式值陣列
1084
			$styleV=array();
1084
			$styleV=array();
1085
			
1085
 
1086
			#以據每個樣式
1086
			#以據每個樣式
1087
			foreach($conf["style"] as $styleName => $styleVal){
1087
			foreach($conf["style"] as $styleName => $styleVal){
1088
				
1088
 
1089
				#取得樣式名稱
1089
				#取得樣式名稱
1090
				$styleN[]=$styleName;
1090
				$styleN[]=$styleName;
1091
				
1091
 
1092
				#取得樣式值
1092
				#取得樣式值
1093
				$styleV[]=$styleVal;
1093
				$styleV[]=$styleVal;
1094
				
1094
 
1095
				}#foreach end
1095
				}#foreach end
1096
			
1096
 
1097
			#函式說明: 
1097
			#函式說明:
1098
			#建立給與html標籤使用的style屬性字串.
1098
			#建立給與html標籤使用的style屬性字串.
1099
			#回傳結果:
1099
			#回傳結果:
1100
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1100
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1101
			#$result["function"],當前執行的函數
1101
			#$result["function"],當前執行的函數
1102
			#$result["error"],錯誤訊息陣列
1102
			#$result["error"],錯誤訊息陣列
Line 1104... Line 1104...
1104
			#必填參數:
1104
			#必填參數:
1105
			$conf["css::styleStr"]["styleName"]=$styleN;#為屬性名稱,須為陣列值
1105
			$conf["css::styleStr"]["styleName"]=$styleN;#為屬性名稱,須為陣列值
1106
			$conf["css::styleStr"]["styleValue"]=$styleV;#為屬性值,須為陣列值
1106
			$conf["css::styleStr"]["styleValue"]=$styleV;#為屬性值,須為陣列值
1107
			$styleStr=css::styleStr($conf["css::styleStr"]);
1107
			$styleStr=css::styleStr($conf["css::styleStr"]);
1108
			unset($conf["css::styleStr"]);
1108
			unset($conf["css::styleStr"]);
1109
			
1109
 
1110
			#如果建立 style 字串失敗
1110
			#如果建立 style 字串失敗
1111
			if($styleStr["status"]==="false"){
1111
			if($styleStr["status"]==="false"){
1112
				
1112
 
1113
				#設置執行失敗
1113
				#設置執行失敗
1114
				$result["status"]="false";
1114
				$result["status"]="false";
1115
				
1115
 
1116
				#設置錯誤訊息
1116
				#設置錯誤訊息
1117
				$result["error"]=$styleStr;
1117
				$result["error"]=$styleStr;
1118
				
1118
 
1119
				#回傳結果
1119
				#回傳結果
1120
				return $result;
1120
				return $result;
1121
				
1121
 
1122
				}#if end
1122
				}#if end
1123
				
1123
 
1124
			#取得樣式字串
1124
			#取得樣式字串
1125
			$style=$styleStr["content"];
1125
			$style=$styleStr["content"];
1126
			
1126
 
1127
			}#if end
1127
			}#if end
1128
		
1128
 
1129
		#如果有設置 mime type
1129
		#如果有設置 mime type
1130
		if(isset($conf["mimeType"])){
1130
		if(isset($conf["mimeType"])){
1131
		
1131
 
1132
			#設置 img 的 src 數值
1132
			#設置 img 的 src 數值
1133
			$result["content"]["imgWithoutImgTag"]="data:".$conf["mimeType"].";".$conf["compressType"].",".$getFileContent["base64data"];
1133
			$result["content"]["imgWithoutImgTag"]="data:".$conf["mimeType"].";".$conf["compressType"].",".$getFileContent["base64data"];
1134
				
1134
 
1135
			}#if end
1135
			}#if end
1136
		
1136
 
1137
		#反之
1137
		#反之
1138
		else{
1138
		else{
1139
		
1139
 
1140
			#設置 img 的 src 數值
1140
			#設置 img 的 src 數值
1141
			$result["content"]["imgWithoutImgTag"]=$getFileContent["base64data"];
1141
			$result["content"]["imgWithoutImgTag"]=$getFileContent["base64data"];
1142
		
1142
 
1143
			}#else end
1143
			}#else end
1144
		
1144
 
1145
		#放置圖片的語法
1145
		#放置圖片的語法
1146
		$result["content"]["img"]="<img ".$style." ".$conf["alt"]." ".$conf["class"]." src=\"".$result["content"]["imgWithoutImgTag"]."\" >";
1146
		$result["content"]["img"]="<img ".$style." ".$conf["alt"]." ".$conf["class"]." src=\"".$result["content"]["imgWithoutImgTag"]."\" >";
1147
		
1147
 
1148
		#執行到這邊代表執行正常
1148
		#執行到這邊代表執行正常
1149
		$result["status"]="true";
1149
		$result["status"]="true";
1150
		
1150
 
1151
		#回傳結果
1151
		#回傳結果
1152
		return $result;
1152
		return $result;
1153
		
1153
 
1154
		}#function data end
1154
		}#function data end
1155
 
1155
 
1156
	/*
1156
	/*
1157
	#函式說明:
1157
	#函式說明:
1158
	#建立用css樣式產生的圖片div或span區塊 
1158
	#建立用css樣式產生的圖片div或span區塊
1159
	#回傳結果:
1159
	#回傳結果:
1160
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1160
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1161
	#$result["error"],錯誤訊息
1161
	#$result["error"],錯誤訊息
1162
	#$result["content"],圖片的連結資訊
1162
	#$result["content"],圖片的連結資訊
1163
	#$result["function"],當前執行的函數名稱 
1163
	#$result["function"],當前執行的函數名稱
1164
	#必填參數:
1164
	#必填參數:
1165
	#$conf["imgAddr"],字串,圖片的位址.
1165
	#$conf["imgAddr"],字串,圖片的位址.
1166
	$conf["imgAddr"]="";
1166
	$conf["imgAddr"]="";
1167
	#可省略參數:
1167
	#可省略參數:
1168
	#$conf["imgClass"],字串,用來放置圖片的css類別樣式名稱.
1168
	#$conf["imgClass"],字串,用來放置圖片的css類別樣式名稱.
Line 1171... Line 1171...
1171
	#無.
1171
	#無.
1172
	#備註:
1172
	#備註:
1173
	#建構中...
1173
	#建構中...
1174
	*/
1174
	*/
1175
	public static function cssContent(&$conf){
1175
	public static function cssContent(&$conf){
1176
	
1176
 
1177
		#檢查參數
1177
		#檢查參數
1178
		
1178
 
1179
		
1179
 
1180
		#設置圖片的 css class
1180
		#設置圖片的 css class
1181
		
1181
 
1182
		
1182
 
1183
		#設置圖片區塊的 div
1183
		#設置圖片區塊的 div
1184
		
1184
 
1185
	
1185
 
1186
		$result["content"]="<div class=\"cssContnetImg\" style=\"content:url(https://start.fedoraproject.org/static/images/fedora-logo.png);width:200px;height:50px;\"></div>";
1186
		$result["content"]="<div class=\"cssContnetImg\" style=\"content:url(https://start.fedoraproject.org/static/images/fedora-logo.png);width:200px;height:50px;\"></div>";
1187
		
1187
 
1188
		$result["status"]="true";
1188
		$result["status"]="true";
1189
		
1189
 
1190
		return $result;
1190
		return $result;
1191
		
1191
 
1192
		}#functin cssContent end
1192
		}#functin cssContent end
1193
 
1193
 
1194
	}#class img end
1194
	}#class img end
1195
 
1195
 
1196
#內建的繪圖函式
1196
#內建的繪圖函式