| 3 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
| 226 |
liveuser |
6 |
Copyright (C) 2014~2025 MIN ZHI, CHEN
|
| 3 |
liveuser |
7 |
|
|
|
8 |
This file is part of QBPWCF.
|
|
|
9 |
|
|
|
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
|
|
|
12 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
13 |
(at your option) any later version.
|
|
|
14 |
|
|
|
15 |
QBPWCF is distributed in the hope that it will be useful,
|
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
18 |
GNU General Public License for more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU General Public License
|
|
|
21 |
along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22 |
|
|
|
23 |
*/
|
|
|
24 |
namespace qbpwcf;
|
|
|
25 |
|
|
|
26 |
/*
|
|
|
27 |
類別說明:
|
|
|
28 |
jQuery應用的類別.
|
|
|
29 |
備註:
|
|
|
30 |
無.
|
|
|
31 |
*/
|
|
|
32 |
class jquery{
|
|
|
33 |
|
|
|
34 |
/*
|
|
|
35 |
#函式說明:
|
|
|
36 |
#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
|
|
|
37 |
#回傳結果:
|
|
|
38 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
39 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
40 |
#$result["function"],當前執行的函式名稱.
|
|
|
41 |
#必填參數:
|
|
|
42 |
#$method,物件,為物件實體或類別名稱,會自動置入該參數.
|
|
|
43 |
#$arguments,陣列,為呼叫方法時所用的參數.
|
|
|
44 |
#參考資料:
|
|
|
45 |
#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
|
|
|
46 |
*/
|
|
|
47 |
public function __call($method,$arguments){
|
| 226 |
liveuser |
48 |
|
| 3 |
liveuser |
49 |
#取得當前執行的函式
|
|
|
50 |
$result["function"]=__FUNCTION__;
|
| 226 |
liveuser |
51 |
|
| 3 |
liveuser |
52 |
#設置執行不正常
|
|
|
53 |
$result["status"]="false";
|
| 226 |
liveuser |
54 |
|
| 3 |
liveuser |
55 |
#設置執行錯誤
|
|
|
56 |
$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
|
| 226 |
liveuser |
57 |
|
| 3 |
liveuser |
58 |
#設置所丟入的參數
|
|
|
59 |
$result["error"][]=$arguments;
|
| 226 |
liveuser |
60 |
|
| 3 |
liveuser |
61 |
#回傳結果
|
|
|
62 |
return $result;
|
| 226 |
liveuser |
63 |
|
| 3 |
liveuser |
64 |
}#function __call end
|
| 226 |
liveuser |
65 |
|
| 3 |
liveuser |
66 |
/*
|
|
|
67 |
#函式說明:
|
|
|
68 |
#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
|
|
|
69 |
#回傳結果:
|
|
|
70 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
71 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
72 |
#$result["function"],當前執行的函式名稱.
|
|
|
73 |
#必填參數:
|
|
|
74 |
#$method,物件,為物件實體或類別名稱,會自動置入該參數.
|
|
|
75 |
#$arguments,陣列,為呼叫方法時所用的參數.
|
|
|
76 |
#參考資料:
|
|
|
77 |
#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
|
|
|
78 |
*/
|
|
|
79 |
public static function __callStatic($method,$arguments){
|
| 226 |
liveuser |
80 |
|
| 3 |
liveuser |
81 |
#取得當前執行的函式
|
|
|
82 |
$result["function"]=__FUNCTION__;
|
| 226 |
liveuser |
83 |
|
| 3 |
liveuser |
84 |
#設置執行不正常
|
|
|
85 |
$result["status"]="false";
|
| 226 |
liveuser |
86 |
|
| 3 |
liveuser |
87 |
#設置執行錯誤
|
|
|
88 |
$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
|
| 226 |
liveuser |
89 |
|
| 3 |
liveuser |
90 |
#設置所丟入的參數
|
|
|
91 |
$result["error"][]=$arguments;
|
| 226 |
liveuser |
92 |
|
| 3 |
liveuser |
93 |
#回傳結果
|
|
|
94 |
return $result;
|
| 226 |
liveuser |
95 |
|
| 3 |
liveuser |
96 |
}#function __callStatic end
|
|
|
97 |
|
|
|
98 |
/*
|
|
|
99 |
#涵式說明:
|
|
|
100 |
#透過id讓元素點一下就出現或消失的jquery涵式
|
|
|
101 |
#回傳的內容:
|
|
|
102 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
103 |
#$result["error"],錯誤訊息
|
|
|
104 |
#$result["content"],jquery語法
|
| 226 |
liveuser |
105 |
#$result["function"],當前執行的函數名稱
|
| 3 |
liveuser |
106 |
#必填的參數:
|
|
|
107 |
$conf["jqueryLocation"],字串,jquery套件的位置,可以為網址.
|
|
|
108 |
$conf["jqueryLocation"]="";
|
|
|
109 |
$conf["elementId"],字串,js的觸發對象要套用在哪個id的元素。
|
|
|
110 |
$conf["elementId"]="";
|
|
|
111 |
$conf["triggerElementId"],字串,效果的呈現要在哪個id的元素,若爲"this"則代表效果的呈現是在當前要套用的元素。
|
|
|
112 |
$conf["triggerElementId"]="this";
|
|
|
113 |
$conf['triggerCondition'],字串,觸發的條件,"click"代表按一下滑鼠;"mouseenter"代表滑鼠移到該元素時;"mouseout"代表滑鼠移開目標元素時
|
|
|
114 |
$conf['triggerCondition']="mouseenter";
|
|
|
115 |
$conf["hideOrShow"],字串,要執行的動作,"hide()"代表要隱藏;"show()"代表要顯示。
|
|
|
116 |
$conf["hideOrShow"]="hide";#
|
|
|
117 |
#參考資料:
|
|
|
118 |
#點擊觸發=>http://www.w3school.com.cn/jquery/event_click.asp
|
|
|
119 |
*/
|
|
|
120 |
function showOrHide($conf){
|
|
|
121 |
|
|
|
122 |
#初始化要回傳的內容
|
|
|
123 |
$result=array();
|
| 226 |
liveuser |
124 |
|
| 3 |
liveuser |
125 |
#取得當前執行的函數名稱
|
|
|
126 |
$result["function"]=__FUNCTION__;
|
| 226 |
liveuser |
127 |
|
| 3 |
liveuser |
128 |
#初始化要回傳的語法
|
|
|
129 |
$result["content"]="";
|
| 226 |
liveuser |
130 |
|
| 3 |
liveuser |
131 |
#如果 $conf 不為陣列
|
|
|
132 |
if(gettype($conf)!="array"){
|
| 226 |
liveuser |
133 |
|
| 3 |
liveuser |
134 |
#設置執行失敗
|
|
|
135 |
$result["status"]="false";
|
| 226 |
liveuser |
136 |
|
| 3 |
liveuser |
137 |
#設置執行錯誤訊息
|
|
|
138 |
$result["error"][]="\$conf變數須為陣列形態";
|
|
|
139 |
|
|
|
140 |
#如果傳入的參數為 null
|
|
|
141 |
if($conf==null){
|
| 226 |
liveuser |
142 |
|
| 3 |
liveuser |
143 |
#設置執行錯誤訊息
|
|
|
144 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
| 226 |
liveuser |
145 |
|
| 3 |
liveuser |
146 |
}#if end
|
|
|
147 |
|
|
|
148 |
#回傳結果
|
|
|
149 |
return $result;
|
| 226 |
liveuser |
150 |
|
| 3 |
liveuser |
151 |
}#if end
|
| 226 |
liveuser |
152 |
|
| 3 |
liveuser |
153 |
#檢查參數
|
|
|
154 |
#函式說明:
|
|
|
155 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
156 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
157 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
158 |
#$result["function"],當前執行的函式名稱.
|
|
|
159 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
160 |
#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
161 |
#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
162 |
#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
163 |
#必填寫的參數:
|
|
|
164 |
#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
165 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
166 |
#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
167 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("jqueryLocation","elementId","triggerElementId","triggerCondition","hideOrShow");
|
| 226 |
liveuser |
168 |
#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
|
| 3 |
liveuser |
169 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string","string","string");
|
|
|
170 |
#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
171 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
172 |
#可以省略的參數:
|
|
|
173 |
#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
|
|
|
174 |
$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
175 |
#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
176 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("mimeType","compressType","delFile");
|
| 226 |
liveuser |
177 |
#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
| 3 |
liveuser |
178 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
|
|
|
179 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
180 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("null","base64","false");
|
|
|
181 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
182 |
#$conf["arrayCountEqualCheck"][]=array();
|
|
|
183 |
$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
184 |
unset($conf["variableCheck::checkArguments"]);
|
| 226 |
liveuser |
185 |
|
| 3 |
liveuser |
186 |
#如果檢查參數失敗
|
|
|
187 |
if($checkResult["status"]=="false"){
|
| 226 |
liveuser |
188 |
|
| 3 |
liveuser |
189 |
#設置執行失敗
|
|
|
190 |
$result["status"]="false";
|
| 226 |
liveuser |
191 |
|
| 3 |
liveuser |
192 |
#設置錯誤訊息
|
|
|
193 |
$result["error"]=$checkResult;
|
| 226 |
liveuser |
194 |
|
| 3 |
liveuser |
195 |
#回傳結果
|
|
|
196 |
return $result;
|
| 226 |
liveuser |
197 |
|
| 3 |
liveuser |
198 |
}#if end
|
| 226 |
liveuser |
199 |
|
| 3 |
liveuser |
200 |
#如果檢查參數不通過
|
|
|
201 |
if($checkResult["passed"]=="false"){
|
| 226 |
liveuser |
202 |
|
| 3 |
liveuser |
203 |
#設置執行失敗
|
|
|
204 |
$result["status"]="false";
|
| 226 |
liveuser |
205 |
|
| 3 |
liveuser |
206 |
#設置錯誤訊息
|
|
|
207 |
$result["error"]=$checkResult;
|
| 226 |
liveuser |
208 |
|
| 3 |
liveuser |
209 |
#回傳結果
|
|
|
210 |
return $result;
|
| 226 |
liveuser |
211 |
|
| 3 |
liveuser |
212 |
}#if end
|
|
|
213 |
|
|
|
214 |
#涵式說明:
|
|
|
215 |
#script 語法開始
|
|
|
216 |
#回傳的結果:
|
|
|
217 |
#javaScript語法
|
|
|
218 |
#必填的參數:
|
|
|
219 |
$conf["javaScript"]["start"]["include"]="true";#是否要匯入外部js庫。"true"爲要匯入;"false"爲沒有要匯入。
|
|
|
220 |
#可省略的參數:
|
|
|
221 |
$conf["javaScript"]["start"]["jsPosition"]=$conf["jqueryLocation"];#要匯入的js檔案位置。
|
|
|
222 |
$javaScriptStart=javaScript::start($conf["javaScript"]["start"]);
|
| 226 |
liveuser |
223 |
unset($conf["javaScript"]["start"]);
|
|
|
224 |
|
| 3 |
liveuser |
225 |
#如果js語法開始失敗
|
|
|
226 |
if($javaScriptStart["status"]=="false"){
|
| 226 |
liveuser |
227 |
|
| 3 |
liveuser |
228 |
#設置執行不正常
|
|
|
229 |
$result["status"]="false";
|
| 226 |
liveuser |
230 |
|
| 3 |
liveuser |
231 |
#設置執行失敗訊息
|
|
|
232 |
$result["error"]=$javaScriptStart;
|
| 226 |
liveuser |
233 |
|
| 3 |
liveuser |
234 |
#回傳結果
|
| 226 |
liveuser |
235 |
return $result;
|
|
|
236 |
|
| 3 |
liveuser |
237 |
}#if end
|
|
|
238 |
|
|
|
239 |
#串接js開始的語法
|
|
|
240 |
$result["content"]=$result["content"].$javaScriptStart["content"];
|
| 226 |
liveuser |
241 |
|
| 3 |
liveuser |
242 |
#串接js結束的語法,因為JQuery要單獨匯入才能使用.
|
|
|
243 |
#涵式說明:
|
|
|
244 |
#script 語法結束
|
|
|
245 |
#script 語法開始
|
|
|
246 |
#回傳的結果:
|
|
|
247 |
#javaScript語法
|
|
|
248 |
$result["content"]=$result["content"].javaScript::end();
|
|
|
249 |
|
|
|
250 |
#涵式說明:
|
|
|
251 |
#script 語法開始
|
|
|
252 |
#回傳的結果:
|
|
|
253 |
#javaScript語法
|
|
|
254 |
#必填的參數:
|
|
|
255 |
$conf["javaScript"]["start"]["include"]="false";#是否要匯入外部js庫。"true"爲要匯入;"false"爲沒有要匯入。
|
|
|
256 |
#可省略的參數:
|
|
|
257 |
#$conf["javaScript"]["start"]["jsPosition"]=$conf["jqueryLocation"];#要匯入的js檔案位置。
|
|
|
258 |
$javaScriptStart=javaScript::start($conf["javaScript"]["start"]);
|
| 226 |
liveuser |
259 |
unset($conf["javaScript"]["start"]);
|
|
|
260 |
|
| 3 |
liveuser |
261 |
#如果js語法開始失敗
|
|
|
262 |
if($javaScriptStart["status"]=="false"){
|
| 226 |
liveuser |
263 |
|
| 3 |
liveuser |
264 |
#設置執行不正常
|
|
|
265 |
$result["status"]="false";
|
| 226 |
liveuser |
266 |
|
| 3 |
liveuser |
267 |
#設置執行失敗訊息
|
|
|
268 |
$result["error"]=$javaScriptStart;
|
| 226 |
liveuser |
269 |
|
| 3 |
liveuser |
270 |
#回傳結果
|
| 226 |
liveuser |
271 |
return $result;
|
|
|
272 |
|
| 3 |
liveuser |
273 |
}#if end
|
|
|
274 |
|
|
|
275 |
#串接js開始的語法
|
| 226 |
liveuser |
276 |
$result["content"]=$result["content"].$javaScriptStart["content"];
|
| 3 |
liveuser |
277 |
|
|
|
278 |
#如果效果的呈現不是在要套用到的元素
|
|
|
279 |
if($conf["triggerElementId"]!="this"){
|
|
|
280 |
|
|
|
281 |
$conf["triggerElementId"]="\"#".$conf["triggerElementId"]."\"";
|
|
|
282 |
|
|
|
283 |
}#if end
|
|
|
284 |
|
|
|
285 |
#點選該元素,會使該元素消失的消失的jquery涵式。
|
|
|
286 |
$result["content"]=$result["content"]."
|
| 226 |
liveuser |
287 |
|
| 3 |
liveuser |
288 |
$(document).ready(function(){
|
| 226 |
liveuser |
289 |
|
| 3 |
liveuser |
290 |
$(\"#".$conf["elementId"]."\").".$conf['triggerCondition']."(function(){
|
|
|
291 |
|
|
|
292 |
$(".$conf["triggerElementId"].").".$conf["hideOrShow"].";
|
|
|
293 |
|
|
|
294 |
});
|
| 226 |
liveuser |
295 |
|
| 3 |
liveuser |
296 |
});
|
|
|
297 |
|
|
|
298 |
";
|
|
|
299 |
|
|
|
300 |
#涵式說明:
|
|
|
301 |
#script 語法結束
|
|
|
302 |
#回傳的結果:
|
|
|
303 |
#javaScript語法
|
|
|
304 |
$result["content"]=$result["content"].javaScript::end();
|
|
|
305 |
|
|
|
306 |
#設置執行正常
|
|
|
307 |
$result["status"]="true";
|
|
|
308 |
|
|
|
309 |
#回傳語法
|
|
|
310 |
return $result;
|
|
|
311 |
|
| 226 |
liveuser |
312 |
}#function showOrHide end
|
| 3 |
liveuser |
313 |
|
|
|
314 |
/*
|
|
|
315 |
#函數說明:
|
|
|
316 |
#確認是否真的要執行點擊的動作,進而觸發表單,超連結.
|
|
|
317 |
#回傳結果:
|
|
|
318 |
#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
|
|
|
319 |
#$result["error"],錯誤訊息陣列.
|
|
|
320 |
#$result["content"],JavaScript的語法.
|
|
|
321 |
#$result["function"],當前執行的函數名稱.
|
|
|
322 |
#必填參數:
|
|
|
323 |
#$conf["jqueryPosition"],字串,jquery的位置.
|
|
|
324 |
$conf["jqueryPosition"]="";
|
|
|
325 |
#$conf["triggerId"],字串,表單送出按鈕的id.
|
|
|
326 |
$conf["triggerId"]="";
|
|
|
327 |
#可省略參數:
|
|
|
328 |
#$conf["comment"],字串陣列,確認視窗的提示文字,每個元素代表一列內容.
|
|
|
329 |
#$conf["comment"]=array("");
|
|
|
330 |
*/
|
|
|
331 |
function confirmClick(&$conf){
|
| 226 |
liveuser |
332 |
|
| 3 |
liveuser |
333 |
#初始化要回傳的內容
|
|
|
334 |
$result=array();
|
| 226 |
liveuser |
335 |
|
| 3 |
liveuser |
336 |
#當前執行的函數名稱
|
|
|
337 |
$result["function"]=__FUNCTION__;
|
| 226 |
liveuser |
338 |
|
| 3 |
liveuser |
339 |
#初始化要回傳的語法
|
|
|
340 |
$result["content"]="";
|
| 226 |
liveuser |
341 |
|
| 3 |
liveuser |
342 |
#如果 $conf 不為陣列
|
|
|
343 |
if(gettype($conf)!="array"){
|
| 226 |
liveuser |
344 |
|
| 3 |
liveuser |
345 |
#設置執行失敗
|
|
|
346 |
$result["status"]="false";
|
| 226 |
liveuser |
347 |
|
| 3 |
liveuser |
348 |
#設置執行錯誤訊息
|
|
|
349 |
$result["error"][]="\$conf變數須為陣列形態";
|
|
|
350 |
|
|
|
351 |
#如果傳入的參數為 null
|
|
|
352 |
if($conf==null){
|
| 226 |
liveuser |
353 |
|
| 3 |
liveuser |
354 |
#設置執行錯誤訊息
|
|
|
355 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
| 226 |
liveuser |
356 |
|
| 3 |
liveuser |
357 |
}#if end
|
|
|
358 |
|
|
|
359 |
#回傳結果
|
|
|
360 |
return $result;
|
| 226 |
liveuser |
361 |
|
| 3 |
liveuser |
362 |
}#if end
|
| 226 |
liveuser |
363 |
|
| 3 |
liveuser |
364 |
#檢查參數
|
|
|
365 |
#函式說明:
|
|
|
366 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
367 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
368 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
369 |
#$result["function"],當前執行的函式名稱.
|
|
|
370 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
371 |
#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
372 |
#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
373 |
#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
374 |
#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
|
|
|
375 |
#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
|
|
|
376 |
#$result["notNeedVar"],字串陣列,多餘的參數名稱.
|
|
|
377 |
#必填寫的參數:
|
|
|
378 |
#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
379 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
380 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
381 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("jqueryPosition","triggerId");
|
| 226 |
liveuser |
382 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
|
| 3 |
liveuser |
383 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
|
|
|
384 |
#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
385 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
386 |
#可以省略的參數:
|
|
|
387 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
|
|
|
388 |
$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
389 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
390 |
$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("comment");
|
| 226 |
liveuser |
391 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
| 3 |
liveuser |
392 |
$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("array");
|
|
|
393 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
394 |
$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(array("確定執行?"));
|
|
|
395 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
396 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
|
|
|
397 |
#參考資料來源:
|
|
|
398 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
|
|
399 |
$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
400 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
401 |
|
|
|
402 |
#如果檢查失敗
|
|
|
403 |
if($checkResult["status"]=="false"){
|
| 226 |
liveuser |
404 |
|
| 3 |
liveuser |
405 |
#設置錯誤狀態
|
|
|
406 |
$result["status"]="false";
|
| 226 |
liveuser |
407 |
|
| 3 |
liveuser |
408 |
#設置錯誤提示
|
|
|
409 |
$result["error"]=$checkResult;
|
| 226 |
liveuser |
410 |
|
| 3 |
liveuser |
411 |
#回傳結果
|
|
|
412 |
return $result;
|
| 226 |
liveuser |
413 |
|
| 3 |
liveuser |
414 |
}#if end
|
|
|
415 |
|
|
|
416 |
#如果檢查不通過
|
|
|
417 |
if($checkResult["passed"]=="false"){
|
| 226 |
liveuser |
418 |
|
| 3 |
liveuser |
419 |
#設置錯誤狀態
|
|
|
420 |
$result["status"]="false";
|
| 226 |
liveuser |
421 |
|
| 3 |
liveuser |
422 |
#設置錯誤提示
|
|
|
423 |
$result["error"]=$checkResult;
|
| 226 |
liveuser |
424 |
|
| 3 |
liveuser |
425 |
#回傳結果
|
|
|
426 |
return $result;
|
| 226 |
liveuser |
427 |
|
| 3 |
liveuser |
428 |
}#if end
|
| 226 |
liveuser |
429 |
|
|
|
430 |
#確認視窗的js語法
|
| 3 |
liveuser |
431 |
#函式說明:
|
|
|
432 |
#確認視窗,回傳的javaScript結果可在要觸發的元素裡面搭配「onclink=本函數回傳的內容」,來使連結或按鈕確定觸發或不觸發.
|
|
|
433 |
#回傳結果:
|
|
|
434 |
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
|
|
|
435 |
#$result["error"],錯誤訊息陣列
|
|
|
436 |
#$result["function"],當前執行的函數名稱
|
|
|
437 |
#$result["content"],javaScript語法
|
| 226 |
liveuser |
438 |
#必填的參數:
|
| 3 |
liveuser |
439 |
#$conf["alertSentenceArray"],字串陣列彈出式視窗的內容,每個元素代表每一列的內容.
|
|
|
440 |
$conf["javaScript::confirmWindow"]["alertSentenceArray"]=$conf["comment"];
|
|
|
441 |
$confirmWindow=javaScript::confirmWindow($conf["javaScript::confirmWindow"]);
|
| 226 |
liveuser |
442 |
unset($conf["javaScript::confirmWindow"]);
|
|
|
443 |
|
| 3 |
liveuser |
444 |
#如果建立確認視窗失敗
|
|
|
445 |
if($confirmWindow["status"]=="false"){
|
| 226 |
liveuser |
446 |
|
| 3 |
liveuser |
447 |
#設置錯誤狀態
|
|
|
448 |
$result["status"]="false";
|
| 226 |
liveuser |
449 |
|
| 3 |
liveuser |
450 |
#設置錯誤提示
|
|
|
451 |
$result["error"]=$confirmWindow;
|
| 226 |
liveuser |
452 |
|
| 3 |
liveuser |
453 |
#回傳結果
|
|
|
454 |
return $result;
|
| 226 |
liveuser |
455 |
|
|
|
456 |
}#if end
|
|
|
457 |
|
| 3 |
liveuser |
458 |
#JQuery 按下特定元素觸發確認視窗的語法
|
|
|
459 |
$jQuery="
|
|
|
460 |
|
|
|
461 |
//當文件讀取完成
|
|
|
462 |
$(document).ready(function(){
|
| 226 |
liveuser |
463 |
|
| 3 |
liveuser |
464 |
//當id為add的元素點擊時
|
|
|
465 |
$('#".$conf["triggerId"]."').click(function(){
|
| 226 |
liveuser |
466 |
|
| 3 |
liveuser |
467 |
//回傳確認視窗是按下 true(確認) 或 false(取消)
|
|
|
468 |
".$confirmWindow["content"]."
|
| 226 |
liveuser |
469 |
|
| 3 |
liveuser |
470 |
});//function end
|
| 226 |
liveuser |
471 |
|
| 3 |
liveuser |
472 |
});//funtion end
|
| 226 |
liveuser |
473 |
|
| 3 |
liveuser |
474 |
";
|
| 226 |
liveuser |
475 |
|
| 3 |
liveuser |
476 |
#函式說明:
|
|
|
477 |
#加上<script></script>標籤,並且可以指定要匯入的js檔案.
|
|
|
478 |
#回傳結果:
|
|
|
479 |
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
|
|
|
480 |
#$result["error"],錯誤訊息陣列
|
|
|
481 |
#$result["function"],當前執行的函數名稱
|
|
|
482 |
#$result["content"],javaScript語法
|
|
|
483 |
#必填參數:
|
|
|
484 |
#$conf["jsProgramSection"],陣列字串,不含<script></script>標籤的javsScript程式碼,可以放多個script程式.
|
|
|
485 |
$conf["javaScript::addScriptTag"]["jsProgramSection"]=array($jQuery);
|
|
|
486 |
#可省略參數:
|
|
|
487 |
#$conf["jsPosition"],字串,要匯入的js檔案位置.
|
|
|
488 |
$conf["javaScript::addScriptTag"]["jsPosition"]=$conf["jqueryPosition"];
|
|
|
489 |
$addScriptTag=javaScript::addScriptTag($conf["javaScript::addScriptTag"]);
|
|
|
490 |
unset($conf["javaScript::addScriptTag"]);
|
| 226 |
liveuser |
491 |
|
| 3 |
liveuser |
492 |
#如果加上<script></script>標籤失敗
|
|
|
493 |
if($addScriptTag["status"]=="false"){
|
| 226 |
liveuser |
494 |
|
| 3 |
liveuser |
495 |
#設置錯誤狀態
|
|
|
496 |
$result["status"]="false";
|
| 226 |
liveuser |
497 |
|
| 3 |
liveuser |
498 |
#設置錯誤提示
|
|
|
499 |
$result["error"]=$addScriptTag;
|
| 226 |
liveuser |
500 |
|
| 3 |
liveuser |
501 |
#回傳結果
|
|
|
502 |
return $result;
|
| 226 |
liveuser |
503 |
|
| 3 |
liveuser |
504 |
}#if end
|
| 226 |
liveuser |
505 |
|
| 3 |
liveuser |
506 |
#取得確認點擊視窗的語法
|
|
|
507 |
$result["content"]=$result["content"].$addScriptTag["content"];
|
| 226 |
liveuser |
508 |
|
| 3 |
liveuser |
509 |
#設置執行正常
|
|
|
510 |
$result["status"]="true";
|
| 226 |
liveuser |
511 |
|
| 3 |
liveuser |
512 |
#回傳結果
|
|
|
513 |
return $result;
|
| 226 |
liveuser |
514 |
|
| 3 |
liveuser |
515 |
}#function confirmClick end
|
|
|
516 |
|
|
|
517 |
/*
|
|
|
518 |
#涵式說明:
|
|
|
519 |
#建立特定元素的jquery on click事件
|
|
|
520 |
#回傳結果:
|
|
|
521 |
#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
|
|
|
522 |
#$result["error"],錯誤訊息陣列.
|
|
|
523 |
#$result["content"],JavaScript的語法.
|
|
|
524 |
#$result["function"],當前執行的函數名稱.
|
|
|
525 |
#$result["importJS"],匯入js的語法,必定含有<script></script>標籤.
|
|
|
526 |
#必填參數:
|
|
|
527 |
#$conf["trigger"],字串,要設定click事件的目標(selector),可以為ID("#element_id"),class(".trigger"),tag("div"),tag&attr("div[data-action=nextPage]"),combine tag&class("div.flip").
|
|
|
528 |
$conf["trigger"]="";
|
|
|
529 |
#$conf["content"],字串,click事件觸發後,要做的事情.
|
| 226 |
liveuser |
530 |
$conf["content"]="";
|
| 3 |
liveuser |
531 |
#可省略參數:
|
|
|
532 |
#$conf["jqueryPath"],字串,jquery的位置,預設不指定.
|
|
|
533 |
#$conf["jqueryPath"]="";
|
|
|
534 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jqueryPath"一起設置,預設為當前檔案的位置.
|
|
|
535 |
#$conf["fileArgu"]=__FILE__;
|
|
|
536 |
#$conf["noScriptTag"],字串,是否不要<script></script>,"true"代表不要,"false"代表不用,預設為"false".
|
|
|
537 |
#$conf["noScriptTag"]="false";
|
|
|
538 |
#參考資料:
|
|
|
539 |
#selector=>https://api.jquery.com/category/selectors/
|
|
|
540 |
*/
|
|
|
541 |
function onClick(&$conf){
|
| 226 |
liveuser |
542 |
|
| 3 |
liveuser |
543 |
#初始化要回傳的結果
|
|
|
544 |
$result=array();
|
|
|
545 |
|
|
|
546 |
#取得當前執行的函數名稱
|
|
|
547 |
$result["function"]=__FUNCTION__;
|
|
|
548 |
|
|
|
549 |
#如果沒有參數
|
|
|
550 |
if(func_num_args()==0){
|
| 226 |
liveuser |
551 |
|
| 3 |
liveuser |
552 |
#設置執行失敗
|
|
|
553 |
$result["status"]="false";
|
| 226 |
liveuser |
554 |
|
| 3 |
liveuser |
555 |
#設置執行錯誤訊息
|
|
|
556 |
$result["error"]="函數".$result["function"]."需要參數";
|
| 226 |
liveuser |
557 |
|
| 3 |
liveuser |
558 |
#回傳結果
|
|
|
559 |
return $result;
|
|
|
560 |
|
| 226 |
liveuser |
561 |
}#if end
|
|
|
562 |
|
| 3 |
liveuser |
563 |
#取得參數
|
|
|
564 |
$result["argu"]=$conf;
|
|
|
565 |
|
|
|
566 |
#如果 $conf 不為陣列
|
|
|
567 |
if(gettype($conf)!="array"){
|
| 226 |
liveuser |
568 |
|
| 3 |
liveuser |
569 |
#設置執行失敗
|
|
|
570 |
$result["status"]="false";
|
| 226 |
liveuser |
571 |
|
| 3 |
liveuser |
572 |
#設置執行錯誤訊息
|
|
|
573 |
$result["error"][]="\$conf變數須為陣列形態";
|
| 226 |
liveuser |
574 |
|
| 3 |
liveuser |
575 |
#如果傳入的參數為 null
|
|
|
576 |
if($conf==null){
|
| 226 |
liveuser |
577 |
|
| 3 |
liveuser |
578 |
#設置執行錯誤訊息
|
|
|
579 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
| 226 |
liveuser |
580 |
|
| 3 |
liveuser |
581 |
}#if end
|
|
|
582 |
|
|
|
583 |
#回傳結果
|
|
|
584 |
return $result;
|
| 226 |
liveuser |
585 |
|
| 3 |
liveuser |
586 |
}#if end
|
|
|
587 |
|
|
|
588 |
#檢查參數
|
|
|
589 |
#函式說明:
|
|
|
590 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
591 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
592 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
593 |
#$result["function"],當前執行的函式名稱.
|
|
|
594 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
595 |
#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
596 |
#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
597 |
#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
598 |
#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
|
|
|
599 |
#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
|
|
|
600 |
#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
|
|
|
601 |
#$result["notNeedVar"],字串陣列,多餘的參數名稱.
|
|
|
602 |
#必填寫的參數:
|
|
|
603 |
#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
604 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
605 |
#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
606 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("trigger","content");
|
|
|
607 |
#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
|
|
|
608 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
|
|
|
609 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
610 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
611 |
#可以省略的參數:
|
|
|
612 |
#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
|
|
|
613 |
#$conf["canBeEmptyString"]="false";
|
|
|
614 |
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
|
|
|
615 |
#$conf["canNotBeEmpty"]=array();
|
|
|
616 |
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
|
|
|
617 |
#$conf["canBeEmpty"]=array();
|
|
|
618 |
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
|
|
|
619 |
#$conf["skipableVariableCanNotBeEmpty"]=array();
|
|
|
620 |
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
621 |
$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("jqueryPath","fileArgu","noScriptTag");
|
| 226 |
liveuser |
622 |
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
| 3 |
liveuser |
623 |
$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
|
|
|
624 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
625 |
$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,__FILE__,"false");
|
|
|
626 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
627 |
#$conf["arrayCountEqualCheck"][]=array();
|
|
|
628 |
#參考資料來源:
|
|
|
629 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
|
|
630 |
$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
631 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
632 |
|
|
|
633 |
#如果檢查參數失敗
|
|
|
634 |
if($checkArguments["status"]==="false"){
|
| 226 |
liveuser |
635 |
|
| 3 |
liveuser |
636 |
#設置執行錯誤
|
|
|
637 |
$result["status"]="false";
|
| 226 |
liveuser |
638 |
|
| 3 |
liveuser |
639 |
#設置錯誤訊息
|
|
|
640 |
$result["error"]=$checkArguments;
|
| 226 |
liveuser |
641 |
|
| 3 |
liveuser |
642 |
#回傳結果
|
|
|
643 |
return $result;
|
| 226 |
liveuser |
644 |
|
| 3 |
liveuser |
645 |
}#if end
|
| 226 |
liveuser |
646 |
|
| 3 |
liveuser |
647 |
#如果檢查參數不通過
|
|
|
648 |
if($checkArguments["passed"]==="false"){
|
| 226 |
liveuser |
649 |
|
| 3 |
liveuser |
650 |
#設置執行錯誤
|
|
|
651 |
$result["status"]="false";
|
| 226 |
liveuser |
652 |
|
| 3 |
liveuser |
653 |
#設置錯誤訊息
|
|
|
654 |
$result["error"]=$checkArguments;
|
| 226 |
liveuser |
655 |
|
| 3 |
liveuser |
656 |
#回傳結果
|
|
|
657 |
return $result;
|
| 226 |
liveuser |
658 |
|
| 3 |
liveuser |
659 |
}#if end
|
|
|
660 |
|
|
|
661 |
#建立 on click 事件
|
|
|
662 |
$onClickScript="
|
|
|
663 |
$('".$conf["trigger"]."').on('click',function()
|
|
|
664 |
{
|
|
|
665 |
".$conf["content"]."
|
|
|
666 |
});
|
|
|
667 |
";
|
| 226 |
liveuser |
668 |
|
| 3 |
liveuser |
669 |
#建立script
|
|
|
670 |
#函式說明:
|
|
|
671 |
#加上<script></script>標籤,並且可以指定要匯入的js檔案.
|
|
|
672 |
#回傳結果:
|
|
|
673 |
#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
|
|
|
674 |
#$result["error"],錯誤訊息陣列
|
|
|
675 |
#$result["function"],當前執行的函數名稱
|
|
|
676 |
#$result["content"],javaScript語法
|
|
|
677 |
#$result["importJS"],匯入js的語法,必定含有<script></script>標籤.
|
|
|
678 |
#必填參數:
|
|
|
679 |
#$conf["jsProgramSection"],陣列字串,不含<script></script>標籤的javsScript程式碼,可以放多個script程式.
|
|
|
680 |
$conf["javaScript::addScriptTag"]["jsProgramSection"]=array($onClickScript);
|
|
|
681 |
#可省略參數:
|
|
|
682 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jsPosition"一起設置,預設為當前檔案的位置.
|
|
|
683 |
$conf["javaScript::addScriptTag"]["fileArgu"]=$conf["fileArgu"];
|
| 226 |
liveuser |
684 |
|
| 3 |
liveuser |
685 |
#如果有設置 $conf["jsPosition"]
|
|
|
686 |
if(isset($conf["jqueryPath"])){
|
| 226 |
liveuser |
687 |
|
| 3 |
liveuser |
688 |
#$conf["jsPosition"],字串,要匯入的js檔案位置.
|
|
|
689 |
$conf["javaScript::addScriptTag"]["jsPosition"]=$conf["jqueryPath"];
|
| 226 |
liveuser |
690 |
|
| 3 |
liveuser |
691 |
}#if end
|
| 226 |
liveuser |
692 |
|
| 3 |
liveuser |
693 |
#$conf["noScriptTag"],字串,是否不要用script tag包住回傳的內容($result["content"]),"true"代表不要用,"false"代表要用,預設為"false".
|
|
|
694 |
$conf["javaScript::addScriptTag"]["noScriptTag"]=$conf["noScriptTag"];
|
|
|
695 |
$addScriptTag=javaScript::addScriptTag($conf["javaScript::addScriptTag"]);
|
|
|
696 |
unset($conf["javaScript::addScriptTag"]);
|
| 226 |
liveuser |
697 |
|
| 3 |
liveuser |
698 |
#如果建立 script tag 失敗
|
|
|
699 |
if($addScriptTag["status"]==="false"){
|
| 226 |
liveuser |
700 |
|
| 3 |
liveuser |
701 |
#設置執行錯誤
|
|
|
702 |
$result["status"]="false";
|
| 226 |
liveuser |
703 |
|
| 3 |
liveuser |
704 |
#設置錯誤訊息
|
|
|
705 |
$result["error"]=$addScriptTag;
|
| 226 |
liveuser |
706 |
|
| 3 |
liveuser |
707 |
#回傳結果
|
|
|
708 |
return $result;
|
| 226 |
liveuser |
709 |
|
|
|
710 |
}#if end
|
|
|
711 |
|
| 3 |
liveuser |
712 |
#取得語法
|
|
|
713 |
$result["content"]=$addScriptTag["content"];
|
| 226 |
liveuser |
714 |
|
| 3 |
liveuser |
715 |
#如果存在要匯入js的語法
|
|
|
716 |
if(isset($addScriptTag["importJS"])){
|
| 226 |
liveuser |
717 |
|
| 3 |
liveuser |
718 |
#設置匯入js的語法
|
|
|
719 |
$result["importJS"]=$addScriptTag["importJS"];
|
| 226 |
liveuser |
720 |
|
| 3 |
liveuser |
721 |
}#if end
|
| 226 |
liveuser |
722 |
|
| 3 |
liveuser |
723 |
#設置執行正常
|
|
|
724 |
$result["status"]="true";
|
| 226 |
liveuser |
725 |
|
| 3 |
liveuser |
726 |
#回傳結果
|
|
|
727 |
return $result;
|
| 226 |
liveuser |
728 |
|
| 3 |
liveuser |
729 |
}#function onClick end
|
|
|
730 |
|
|
|
731 |
}#class jquery end
|
|
|
732 |
|
|
|
733 |
?>
|