Subversion Repositories php-qbpwcf

Rev

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~2025 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;

/*
類別說明:
類別 app 開始.
備註:
無.
*/
class app{

        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$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

        /*
        #函式說明:
        #使用網頁預設的app化設置.包含不使用cache.
        #回傳的結果:
        #回傳結果:
        #$result,app化的語法.
        #必填參數:
        #無.
        #可省略參數:
        #無.
        #參考資料:
        #無.
        #備註:
        #無.
        */
        public static function defaultMode(){

                #初始化要回傳的內容
                $result="";

                #讓行動裝置用起來更順暢
                #參考資料來源:
                #http://cfyeric.blogspot.tw/2010/10/blog-post.html
                $result=$result."<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=yes\"/>";

                #變成像是在瀏覽APP
                #參考資料來源:
                #http://cfyeric.blogspot.tw/2010/10/blog-post.html
                $result=$result."<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />";

                #變成不使用網頁的快取功能
                #參考資料來源:
                #https://tw.coderbridge.com/questions/9d7974b61bb34ac88855ce21e89380e7
                $result=$result."<meta http-equiv=\"Cache-Control\" content=\"no-store\" />";

                #回傳結果
                return $result;

                }#function defaultMode end

        }#class app end

?>