PbootCMS自定義授權(quán)提示語(yǔ)句
PbootCms上傳到服務(wù)器后用域名訪問(wèn),如果沒(méi)有到官網(wǎng)獲取域名授權(quán)碼會(huì)提示未授權(quán)的相關(guān)提示信息,但是有時(shí)候我們是給客戶使用,并不想客戶看到此信息,那么怎么辦呢?
PbootCMS默認(rèn)授權(quán)提示語(yǔ)句為:
未匹配到本域名(www.xxx.com)有效授權(quán)碼,請(qǐng)到PbootCMS官網(wǎng)獲取,并填寫(xiě)到網(wǎng)站后臺(tái)"全局配置>>配置參數(shù)"中。
通過(guò)本插件可任意自定義文字,例如修改成:
sn修改辦法
其實(shí)官方已經(jīng)預(yù)制了免費(fèi)的解決方案,只需要在網(wǎng)站根目錄下新建一個(gè)sn.html的文件,里面編寫(xiě)自己的提示信息,比如請(qǐng)聯(lián)系某某,這時(shí)候再訪問(wèn)未授權(quán)的域名,系統(tǒng)會(huì)自動(dòng)調(diào)用sn.html并顯示其中的內(nèi)容。
程序修改辦法
文件位置:/core/function/handle.php
搜索:parse_info_tpl()函數(shù)
將函數(shù)內(nèi)
$tpl_content = str_replace('{info}', $string, $tpl_content);
替換為:
if (strpos($string, '未匹配到本域名') !== false) { $tpl_content = str_replace('{info}', '您當(dāng)前域名未授權(quán),請(qǐng)聯(lián)系開(kāi)發(fā)者獲取授權(quán)!', $tpl_content); } else { $tpl_content = str_replace('{info}', $string, $tpl_content); }
大功告成!
修改范例可直接復(fù)制替換
/** * 系統(tǒng)信息彈出解析函數(shù) * * @param string $info_tpl模板 * @param string $string內(nèi)容 * @param string $jump_url跳轉(zhuǎn)地址 * @param number $time時(shí)間 */ function parse_info_tpl($info_tpl, $string, $jump_url = null, $time = 0) { if (file_exists($info_tpl)) { $tpl_content = file_get_contents($info_tpl); if ($jump_url) { $timeout_js = "<script>var timeout = {time};var showbox = document.getElementById('time');show();function show(){showbox.innerHTML = timeout+ ' 秒后自動(dòng)跳轉(zhuǎn)';timeout--;if (timeout == 0) {window.location.href = '{url}';}else {setTimeout(function(){show();}, 1000);}}</script>"; } else { $timeout_js = ''; } $tpl_content = str_replace('{js}', $timeout_js, $tpl_content); if (strpos($string, '未匹配到本域名') !== false) { $tpl_content = str_replace('{info}', '您當(dāng)前域名未授權(quán),請(qǐng)聯(lián)系開(kāi)發(fā)者獲取授權(quán)!', $tpl_content); } else { $tpl_content = str_replace('{info}', $string, $tpl_content); } $tpl_content = str_replace('{url}', $jump_url, $tpl_content); $tpl_content = str_replace('{time}', $time, $tpl_content); $tpl_content = str_replace('{sitedir}', SITE_DIR, $tpl_content); $tpl_content = str_replace('{coredir}', CORE_DIR, $tpl_content); $tpl_content = str_replace('{appversion}', APP_VERSION . '-' . RELEASE_TIME, $tpl_content); $tpl_content = str_replace('{serveros}', PHP_OS, $tpl_content); $tpl_content = str_replace('{serversoft}', $_SERVER['SERVER_SOFTWARE'], $tpl_content); return $tpl_content; } else { exit('<div style="font-size:50px;">:(</div>提示信息的模板文件不存在!'); } }
版權(quán)聲明:
本站所有文章和圖片均來(lái)自用戶分享和網(wǎng)絡(luò)收集,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請(qǐng)勿用于商業(yè)用途,如果損害了您的權(quán)利,請(qǐng)聯(lián)系網(wǎng)站客服處理。