Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 626 | Rev 910 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2015~2024 Min-Jhin,Chen

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/
namespace qbpwcf;

/*
類別說明:
跟超連結應用有關的類別.
備註:
無.
*/
class link{

        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #可省略參數:
        #無.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        #備註:
        #無.
        */
        public function __call($method,$arguments){
                
                #取得當前執行的函式
                $result["function"]=__FUNCTION__;
                
                #設置執行不正常
                $result["status"]="false";
                
                #設置執行錯誤
                $result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
                
                #設置所丟入的參數
                $result["error"][]=$arguments;
                
                #回傳結果
                return $result;
                
                }#function __call end
                
        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #可省略參數:
        #無.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        #備註:
        #無.
        */
        public static function __callStatic($method,$arguments){
                
                #取得當前執行的函式
                $result["function"]=__FUNCTION__;
                
                #設置執行不正常
                $result["status"]="false";
                
                #設置執行錯誤
                $result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
                
                #設置所丟入的參數
                $result["error"][]=$arguments;
                
                #回傳結果
                return $result;
                
                }#function __callStatic end
        
        /*
        #函式說明:
        #放置超鏈結
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息
        #$result["content"],語法
        #$result["function"],當前執行的函數名稱
        #必填參數:
        #$conf["position"],字串,爲要連結到的位置,若留空,將會自動變成"#(目標不存在)","#"則可以搭配ajax傳值.       
        $conf["position"]="";
        #$conf["linkName",字串,爲連結的顯示名稱
        $conf["linkName"]="";
        #可省略參數:
        #$conf["method"],字串,爲點選連結後,新畫面要如何呈現,可省略預設爲"_self",可用的選項有 _top(覆蓋目前的視窗來顯現新內容) _parent _self _blank(跳新視窗)
        #$conf["method"]=""; 
        #$conf["class"],字串,爲要套用的css超連節樣式,可省略.
        #$conf["class"]="";
        #$conf["id"],字串,超連結的id.
        #$conf["id"]="";
        #$conf["no_outline"],字串,是否要取消連結的框線,"false為不取消,"true"代表要取消,預設為"false".
        #$conf["no_outline"]="";
        #$conf["callBackFunctions"],字串陣列,點選選項取得回應後要callback的js函數名稱,參數id要記得設定.
        #$conf["callBackFunctions"]=array();
        #參考資料
        #無.
        #備註:
        #無.
        */      
        public static function show_link(&$conf){

                #初始化要回傳的內容
                $result=array();
                
                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;
                
                #初始化要回傳的語法
                $result["content"]="";
                
                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){
                                
                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
                                
                                }#if end

                        #回傳結果
                        return $result;
                        
                        }#if end
                
                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("position","linkName");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
                #$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
                $conf["variableCheck::checkArguments"]["canBeEmptyString"]="true";
                #$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("class","method","imgFilePosition","id","no_outline","callBackFunctions");
                #$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string","string","string","array");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,"_self",null,null,"false",null);
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                $checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);
                
                #如果檢查參數失敗
                if($checkResult["status"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #如果檢查參數不通過
                if($checkResult["passed"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                
                #存放 js callback 的字串
                $callBackStrTemp="";
                
                #初始化js內容為空
                $js="";
                
                #如果是一般的 method
                if($conf["method"]==="_self" || $conf["method"]==="_top" || $conf["method"]==="_parent" || $conf["method"]==="_blank"){
                
                        #設定連結顯示的方式 $conf["method"] 存在,則套用結果
                        $conf["method"]=" target = ".$conf["method"];

                        }#if end
                        
                #反之有設定 $conf["id"]
                else if(isset($conf["id"])){
                        
                        #如果沒有設置 callback function
                        if(!isset($conf["callBackFunctions"])){
                        
                                #初始化為空字串
                                $conf["callBackFunctions"]="";
                        
                                }#if end
                        
                        #反之
                        else{
                                #針對每個 $conf["callBackFunctions"]
                                foreach($conf["callBackFunctions"] as $callback){
                                
                                        #串接 callback 的語法,res為網頁的內容,params.url為目標檔案的相對位置
                                        $callBackStrTemp=$callBackStrTemp.$callback.".call(this,res,params.url);";
                                
                                        }#foreach end
                                
                                }#else end
                        
                        #函式說明:
                        #將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"為正常,"false"為不正常.
                        #$result["error"],錯誤訊息陣列
                        #$result["function"],當前執行的函數名稱
                        #$result["content"],要執行的javaScript語法
                        #必填參數:
                        #$conf["script"],字串,要執行的javaScript語法.
                        $conf["javaScript::toScript"]["script"]=
                        "
                        //將 link 綁定 click 事件
                        document.getElementById('".$conf["id"]."').addEventListener('click',function(e){

                                //取消預設事件效果與擴散
                                e.preventDefault();
                                e.stopPropagation();
                                
                                /*
                                設置 window.qbpwcf.ajax 函數
                                說明:
                                傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
                                參數:
                                params={};
                                params.method='POST' or 'GET';
                                params.headers={name:value};
                                params.url='url to request';
                                params.resType='json';
                                params.preAc='function name to call before send request';
                                params.aftAc='function name to call after send request';
                                params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use '';
                                */
                                params={};
                                params.data={};
                                params.method='GET';
                                params.url='".$conf["position"]."';
                                params.resType='document';
                                params.preAc=function(){
                                
                                        //建立讀取的div
                                        var loadingDiv=document.createElement('div');
                                        loadingDiv.id='widow.qbpwcf.link.show_link.loadingDiv';
                                        
                                        //建立讀取的提示文字
                                        loadingDiv.innerText='Loading...';
                                        
                                        //設定讀取的div樣式
                                        loadingDiv.style.position='fixed';
                                        loadingDiv.style.textAlign='center';
                                        loadingDiv.style.color='#FF0000';
                                        loadingDiv.style.backgroundColor='#AAAAAA';
                                        loadingDiv.style.opacity='0.9';
                                        loadingDiv.style.width='100vw';
                                        loadingDiv.style.height='100vh';
                                        loadingDiv.style.top='0px';
                                        loadingDiv.style.left='0px';
                                        loadingDiv.style.zIndex='1';
                                        loadingDiv.style.lineHeight='100vh';

                                        //append div to body
                                        document.body.appendChild(loadingDiv);
                                
                                        };
                                params.aftAc=function(res){
                                
                                        //移除讀取的div
                                        document.getElementById('widow.qbpwcf.link.show_link.loadingDiv').remove();
                                        
                                        //debug
                                        if(window.debug){
                                        
                                                //debug msg             
                                                console.log(res);
                                                
                                                }//if end
                                        
                                        //如果有回應
                                        if(res!==null){
                                        
                                                //輸出回應
                                                document.getElementById('".$conf["method"]."').innerHTML=res.body.innerHTML;
                                        
                                                }//if end
                                        
                                        //反之        
                                        else{
                                        
                                                //輸出回應
                                                document.getElementById('".$conf["method"]."').innerHTML='';
                                        
                                                }//else end
                                        
                                        ".$callBackStrTemp."
                                        
                                        };
                                window.qbpwcf.ajax.call(this,params);
                                
                                });
                        ";
                        #可省略參數:
                        #$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
                        #$conf["onReady"]="true";
                        #$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
                        #$conf["globalJs"]=array();
                        #$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
                        #$conf["jsFunciton"]=array();
                        #參考資料:
                        #http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
                        $toScript=javaScript::toScript($conf["javaScript::toScript"]);
                        unset($conf["javaScript::toScript"]);
                
                        #如果檢查參數不通過
                        if($toScript["status"]=="false"){
                                
                                #設置執行失敗
                                $result["status"]="false";
                                
                                #設置錯誤訊息
                                $result["error"]=$toScript;
                                
                                #回傳結果
                                return $result;
                                
                                }#if end
                                
                        #設置js內容 
                        $js=$toScript["content"];
                
                        }#if end

                #如果 $conf["class"] 不存在,則不設定樣式
                if(!isset($conf["class"])){
                        
                        $conf["class"]="";

                        }#if end

                #如果 $conf["class"] 存在,則設定樣式
                else{

                        $conf["class"]=" class = ".$conf["class"];

                        }#else end

                #如果連結位置為空字串
                if($conf["position"]==""){
                        
                        #設為無效的連結
                        $conf["position"]="#";
                        
                        #連結名稱加上"目標不存在的提示"
                        $conf["linkName"]=$conf["linkName"]."(目標不存在)";
                        
                        }#if end

                #如果 $conf["id"] 有設置
                if(isset($conf["id"])){
                        
                        #設置id
                        $conf["id"]=" id=".$conf["id"]." ";
                        
                        }#if end
                        
                #反之
                else{
                        
                        #設為空字串
                        $conf["id"]="";
                        
                        }#else end

                #初始化 style 字串
                $style="";

                #如果 $conf["no_outline"] 為 "true"
                if($conf["no_outline"]=="true"){
                        
                        #函式說明: 
                        #建立給與html標籤使用的style屬性字串.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.                
                        #$result["function"],當前執行的函數
                        #$result["error"],錯誤訊息陣列
                        #$result["content"],css設定內容
                        #必填參數:
                        $conf["css::styleStr"]["styleName"]=array("outline","behavior","text-decoration");#為屬性名稱,須為陣列值
                        $conf["css::styleStr"]["styleValue"]=array("none","expression(this.onFocus=this.blur()); /* for IE */","none");#為屬性值,須為陣列值
                        $styleStr=css::styleStr($conf["css::styleStr"]);
                        unset($conf["css::styleStr"]);
                        
                        #如果建立 style 字串失敗
                        if($styleStr["status"]=="false"){
                                
                                #設置執行失敗
                                $result["status"]="false";
                                
                                #設置錯誤訊息
                                $result["error"]=$styleStr;
                                
                                #回傳結果
                                return $result;
                                
                                }#if end                        
                
                        #取得 style 字串
                        $style=$styleStr["content"];
                        
                        }#if end                                                        

                #放置超連結的語法
                $result["content"]="<a href= ".$conf["position"]." ".$conf["method"]." ".$conf["class"]." ".$conf["id"]."  ".$style." > ".$conf["linkName"]." </a>".$js;
                
                #設置執行正常
                $result["status"]="true";  
                
                #回傳結果
                return $result;
                
                }#function show_link end

        /*
        #函式說明:
        #放置圖片超鏈接
        #回傳的內容:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息
        #$result["content"],語法
        #$result["function"],當前執行的函數名稱
        #必填參數:
        $conf["linkLocation"]="";#爲連結的網路位置。
        $conf["imgFilePosition"]="";#爲圖片檔案的位置。
        #可省略參數:
        #$conf["class"]="";#爲圖片的css類別名稱
        #$conf["method"]="";#爲點選該連結之後,新畫面要如何呈現,可留空,可用的選項有 _top(覆蓋目前的視窗來顯現新內容) _parent(在目前的父頁面顯示新畫面) _blank(跳新視窗) _self(在自己的頁面呈現),預設爲 _self。
        #$conf["imgHeight"]="";#爲圖片的高度,可省略,省略則按照圖片原始高度。
        #$conf["imgWidth"]="";#爲圖片的寬度,可省略,省略則按照圖片原始寬度。
        #$conf["imgLinkName"]="";#若圖片無法顯示,則會出現以下替代文字。
        #$conf["no_outline"],字串,是否要取消連結的框線,"false為不取消,"true"代表要取消,預設為"true".
        #$conf["no_outline"]="";
        #參考資料
        #無.
        #備註:
        #無.
        */
        public static function showImgLink(&$conf){

                #初始化要回傳的內容
                $result=array();
                
                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;
                
                #初始化要回傳的語法
                $result["content"]="";
                
                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){
                                
                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
                                
                                }#if end

                        #回傳結果
                        return $result;
                        
                        }#if end
                
                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("linkLocation","imgFilePosition");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
                #$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
                #$conf["variableCheck::checkArguments"]["canBeEmptyString"]="true";
                #$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("method","class","imgHeight","imgWidth","imgLinkName","no_outline");
                #$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string","string","string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("_self","","","","","true");
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                $checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);
                
                #如果檢查參數失敗
                if($checkResult["status"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #如果檢查參數不通過
                if($checkResult["passed"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end

                #如果 $conf["imgHeight"] 不爲"",則設定圖片高度
                if($conf["imgHeight"]!=""){
                
                        $conf["imgHeight"]="height = ".$conf["imgHeight"];

                        }#if end

                #如果 $conf["imgWidth"] 不爲"",則設定圖片寬度
                if($conf["imgWidth"]!=""){
                        
                        $conf["imgWidth"]="width = ".$conf["imgWidth"];

                        }#if end

                #$conf["imgLinkName"] 不爲"",則設定圖片無法顯示時的替代文字。
                if($conf["imgLinkName"]!=""){
                        
                        $conf["imgLinkName"]="alt = ".$conf["imgLinkName"];

                        }#if end

                #如果 $conf["class"] 不爲"",則設定css樣式。
                if($conf["class"]!=""){
                
                        $conf["class"]="class = ".$conf["class"];

                        }#if end

                #初始化 style 字串
                $style="";

                #如果 $conf["no_outline"] 為 "true"
                if($conf["no_outline"]=="true"){
                        
                        #函式說明: 
                        #建立給與html標籤使用的style屬性字串.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.                
                        #$result["function"],當前執行的函數
                        #$result["error"],錯誤訊息陣列
                        #$result["content"],css設定內容
                        #必填參數:
                        $conf["css::styleStr"]["styleName"]=array("outline","behavior");#為屬性名稱,須為陣列值
                        $conf["css::styleStr"]["styleValue"]=array("none","expression(this.onFocus=this.blur()); /* for IE */");#為屬性值,須為陣列值
                        $styleStr=css::styleStr($conf["css::styleStr"]);
                        unset($conf["css::styleStr"]);
                        
                        #如果建立 style 字串失敗
                        if($styleStr["status"]=="false"){
                                
                                #設置執行失敗
                                $result["status"]="false";
                                
                                #設置錯誤訊息
                                $result["error"]=$styleStr;
                                
                                #回傳結果
                                return $result;
                                
                                }#if end                        
                
                        #取得 style 字串
                        $style=$styleStr["content"];
                        
                        }#if end

                #放置圖片超連結
                $result["content"]=$result["content"]."<a href = ".$conf["linkLocation"]." target = ".$conf["method"]." ".$style." >";
                $result["content"]=$result["content"]."<img src = ".$conf["imgFilePosition"]." ".$conf["imgWidth"]." ".$conf["imgHeight"]." ".$conf["imgLinkName"]." ".$conf["class"]." >";
                $result["content"]=$result["content"]."</a>";

                #設置執行正常
                $result["status"]="true";

                #回傳語法
                return $result;

                }#function showImgLink end

        /*
        #函式說明:
        #放置超鏈接,裏面可以放各種內容.
        #回傳內容:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息
        #$result["content"],語法
        #$result["function"],當前執行的函數名稱
        #必填參數:
        #$conf["linkLocation"],字串,爲連結的網路位置.
        $conf["linkLocation"]="";
        #$conf["content"],字串陣列,要放置的內容.
        $conf["content"]=array(""); 
        #可省略參數:
        #$conf["class"],陣列,爲link的css類別名稱.
        #$conf["class"]=array();
        #$conf["method"],爲點選該連結之後,新畫面要如何呈現,可留空,可用的選項有 _top(覆蓋目前的視窗來顯現新內容) _parent(在目前的父頁面顯示新畫面) _blank(跳新視窗) _self(在自己的頁面呈現),預設爲 _self。
        #$conf["method"]="";            
        #$conf["no_outline"],字串,是否要取消連結的框線,"false為不取消,"true"代表要取消,預設為"true".
        #$conf["no_outline"]="";
        #$conf["jsTrigger"],字串,要觸發的js函式,參數為事件自己.
        #$conf["jsTrigger"]="";
        #參考資料
        #無.
        #備註:
        #無.
        */
        public static function aTagSection(&$conf){

                #初始化要回傳的內容
                $result=array();
                
                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;
                
                #初始化要回傳的語法
                $result["content"]="";
                
                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){
                                
                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
                                
                                }#if end

                        #回傳結果
                        return $result;
                        
                        }#if end
                
                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("linkLocation","content");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","array");
                #$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
                #$conf["variableCheck::checkArguments"]["canBeEmptyString"]="true";
                #$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("method","class","no_outline","jsTrigger");
                #$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","array","string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("_self",null,"true",null);
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                $checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);
                
                #如果檢查參數失敗
                if($checkResult["status"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #如果檢查參數不通過
                if($checkResult["passed"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
        
                #初始化 style 字串
                $style="";

                #如果 $conf["no_outline"] 為 "true"
                if($conf["no_outline"]==="true"){
                        
                        #函式說明: 
                        #建立給與html標籤使用的style屬性字串.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.                
                        #$result["function"],當前執行的函數
                        #$result["error"],錯誤訊息陣列
                        #$result["content"],css設定內容
                        #必填參數:
                        $conf["css::styleStr"]["styleName"]=array("text-decoration","outline","behavior");#為屬性名稱,須為陣列值
                        $conf["css::styleStr"]["styleValue"]=array("none","none","expression(this.onFocus=this.blur()); /* for IE */");#為屬性值,須為陣列值
                        $styleStr=css::styleStr($conf["css::styleStr"]);
                        unset($conf["css::styleStr"]);
                        
                        #如果建立 style 字串失敗
                        if($styleStr["status"]=="false"){
                                
                                #設置執行失敗
                                $result["status"]="false";
                                
                                #設置錯誤訊息
                                $result["error"]=$styleStr;
                                
                                #回傳結果
                                return $result;
                                
                                }#if end                        
                
                        #取得 style 字串
                        $style=$styleStr["content"];
                        
                        }#if end

                #初始化 class 字串
                $class="";
        
                #如果有設定 class
                if(isset($conf["class"])){
        
                        #涵式說明:
                        #建立class屬性字串,亦即套用多個class樣式的設定字串.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$result["function"],當前執行的函數
                        #$result["error"],錯誤訊息陣列
                        #$result["content"],class屬性字串的內容
                        #必填參數:
                        #$conf["class"],字串陣列,要套用的類別樣式名稱.
                        $conf["css::classStr"]["class"]=$conf["class"];
                        $classStr=css::classStr($conf["css::classStr"]);
                        unset($conf["css::classStr"]);
                
                        #如果建立 style 字串失敗
                        if($classStr["status"]=="false"){
                                
                                #設置執行失敗
                                $result["status"]="false";
                                
                                #設置錯誤訊息
                                $result["error"]=$classStr;
                                
                                #回傳結果
                                return $result;
                                
                                }#if end        

                        #取得 class 設定字串
                        $class=$classStr["content"];
                
                        }#if end

                #初始化點擊後要觸發的js語法
                $jsTrigger="";
                        
                #如果有設置 $conf["jsTrigger"]
                if(isset($conf["jsTrigger"])){
                
                        #設置點擊觸發的事件
                        $jsTrigger="onclick=".$conf["jsTrigger"]."(this)";
                
                        }#if end

                #放置圖片超連結 - start
                $result["content"]=$result["content"]."<a ".$class." href=\"".$conf["linkLocation"]."\" target =\"".$conf["method"]."\" ".$style." ".$jsTrigger." >";
                
                #針對每個要放置的內容
                foreach($conf["content"] as $content){

                        #串接內容
                        $result["content"]=$result["content"].$content;

                        }#foreach end

                #放置圖片超連結 - end
                $result["content"]=$result["content"]."</a>";

                #設置執行正常
                $result["status"]="true";

                #回傳語法
                return $result;

                }#function aTagSection end

        /*
        #函式說明:
        #放置超鏈接,裏面可以放各種內容.
        #回傳內容:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["error"],錯誤訊息
        #$result["content"],語法
        #$result["function"],當前執行的函數名稱
        #必填參數:
        #$conf["phone"],字串,爲要撥打的號碼.
        $conf["phone"]="";
        #$conf["content"],字串,要顯示的內容.
        $conf["content"]=""; 
        #可省略參數:
        #$conf["class"],陣列,爲link的css類別名稱.
        #$conf["class"]=array();                
        #參考資料
        #無.
        #備註:
        #無.
        */
        public static function call(&$conf){
        
                #初始化要回傳的內容
                $result=array();
                
                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;
                
                #初始化要回傳的語法
                $result["content"]="";
                
                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){
                                
                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
                                
                                }#if end

                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #取得使用的參數
                $result["argu"]=$conf;
                
                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("phone","content");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
                #$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
                #$conf["variableCheck::checkArguments"]["canBeEmptyString"]="true";
                #$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("class");
                #$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("array");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null);
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                $checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);
                
                #如果檢查參數失敗
                if($checkResult["status"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #如果檢查參數不通過
                if($checkResult["passed"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$checkResult;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
        
                #函式說明:
                #放置超鏈接,裏面可以放各種內容.
                #回傳內容:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息
                #$result["content"],語法
                #$result["function"],當前執行的函數名稱
                #必填參數:
                #$conf["linkLocation"],字串,爲連結的網路位置.
                $conf["link::aTagSection"]["linkLocation"]="tel:".$conf["phone"];
                #$conf["content"],字串陣列,要放置的內容.
                $conf["link::aTagSection"]["content"]=array($conf["content"]); 
                #可省略參數:
                
                #如果有設定 class
                if(isset($conf["class"])){
                
                        #$conf["class"],陣列,爲link的css類別名稱.
                        $conf["link::aTagSection"]["class"]=$conf["class"];
                
                        }#if end
                
                #$conf["method"],爲點選該連結之後,新畫面要如何呈現,可留空,可用的選項有 _top(覆蓋目前的視窗來顯現新內容) _parent(在目前的父頁面顯示新畫面) _blank(跳新視窗) _self(在自己的頁面呈現),預設爲 _self。
                #$conf["method"]="";            
                #$conf["no_outline"],字串,是否要取消連結的框線,"false為不取消,"true"代表要取消,預設為"true".
                #$conf["no_outline"]="";
                $aTagSection=link::aTagSection($conf["link::aTagSection"]);
                unset($conf["link::aTagSection"]);
        
                #如果檢查參數失敗
                if($aTagSection["status"]=="false"){
                        
                        #設置執行失敗
                        $result["status"]="false";
                        
                        #設置錯誤訊息
                        $result["error"]=$aTagSection;
                        
                        #回傳結果
                        return $result;
                        
                        }#if end
                        
                #取得內容
                $result["content"]=$aTagSection["content"];
                
                #設置執行結果
                $result["status"]="true";
        
                #回傳結果
                return $result;
        
                }#function call end 

        }#class link end

?>