| 787 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
6 |
Copyright (C) 2015~2024 Min-Jhin,Chen
|
|
|
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 |
|
|
|
25 |
#使用命名空間qbpwcf
|
|
|
26 |
namespace qbpwcf;
|
|
|
27 |
|
|
|
28 |
#匯入套件
|
|
|
29 |
require_once("qbpwcf/allInOne.php");
|
|
|
30 |
|
|
|
31 |
#建議的log位置
|
|
|
32 |
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
|
|
|
33 |
|
|
|
34 |
#要使用的範例name
|
|
|
35 |
$nameOfSample="window.qbpwcf.clientFile";
|
|
|
36 |
$nameOfSample="window.qbpwcf.clientFile user candeled";
|
|
|
37 |
$nameOfSample="window.qbpwcf.openWindow";
|
|
|
38 |
|
|
|
39 |
#存放範例的資料夾
|
|
|
40 |
$sampleFolder="javaScript::qbpwcfJavaScript";
|
|
|
41 |
|
|
|
42 |
#設置測試案例的檔案名稱與路徑
|
|
|
43 |
$fileNameOfSample=$sampleFolder."/".$nameOfSample.".php";
|
|
|
44 |
|
|
|
45 |
#初始化儲存範例代碼
|
|
|
46 |
$samples=array();
|
|
|
47 |
|
|
|
48 |
#增加 javaScript::qbpwcfJavaScript 的範例資訊
|
|
|
49 |
$samples[]=array("name"=>"window.qbpwcf.clientFile","comnent"=>"test window.qbpwcf.clientFile");
|
|
|
50 |
$samples[]=array("name"=>"window.qbpwcf.clientFile user candeled","comment"=>"test user canceled");
|
|
|
51 |
$samples[]=array("name"=>"window.qbpwcf.openWindow","comment"=>"test write content feature of window.qbpwcf.openWindow");
|
|
|
52 |
|
|
|
53 |
#針對每個範例資訊
|
|
|
54 |
foreach($samples as $sample){
|
|
|
55 |
|
|
|
56 |
#如果找到對應的範例
|
|
|
57 |
if($sample["name"]===$nameOfSample){
|
|
|
58 |
|
|
|
59 |
#如果存放範例的資料夾不存在
|
|
|
60 |
if(!file_exists($sampleFolder)){
|
|
|
61 |
|
|
|
62 |
#提示訊息
|
|
|
63 |
echo "存放範例的資料夾(".$sampleFolder.")不存在".PHP_EOL;
|
|
|
64 |
|
|
|
65 |
#結束執行,並回傳1給shell
|
|
|
66 |
exit(1);
|
|
|
67 |
|
|
|
68 |
}#if end
|
|
|
69 |
|
|
|
70 |
#如果對應的範例檔案不存在
|
|
|
71 |
if(!file_exists($fileNameOfSample)){
|
|
|
72 |
|
|
|
73 |
#提示訊息
|
|
|
74 |
echo "範例檔案(".$fileNameOfSample.")不存在".PHP_EOL;
|
|
|
75 |
|
|
|
76 |
#結束執行,並回傳1給shell
|
|
|
77 |
exit(1);
|
|
|
78 |
|
|
|
79 |
}#if end
|
|
|
80 |
|
|
|
81 |
#匯入範例
|
|
|
82 |
require_once($fileNameOfSample);
|
|
|
83 |
|
|
|
84 |
#結束執行
|
|
|
85 |
exit;
|
|
|
86 |
|
|
|
87 |
}#if end
|
|
|
88 |
|
|
|
89 |
}#foreach end
|
|
|
90 |
|
|
|
91 |
#執行到這邊代表沒有對應的範例
|
|
|
92 |
|
|
|
93 |
#提示範例不存在
|
|
|
94 |
echo "範例(".$nameOfSample.")不存在".PHP_EOL;
|
|
|
95 |
|
|
|
96 |
#結束執行,並回傳1給shell
|
|
|
97 |
exit(1);
|
|
|
98 |
|
|
|
99 |
?>
|