Created
June 6, 2020 03:05
-
-
Save RyujiAMANO/c706cdb9d24d784aeee03300ed9fa631 to your computer and use it in GitHub Desktop.
本番URLを開発環境のURLに置換して表示するためのXOOPS Cube用preloadファイル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('XOOPS_ROOT_PATH')) exit(); | |
class ProductionUrlToDevUrl extends XCube_ActionFilter | |
{ | |
// ここに本番環境のXOOPS_URLの値を書く | |
const PRODUCTION_URL = 'https://ryus.co.jp'; | |
public function preFilter() | |
{ | |
$this->mRoot->mDelegateManager->add('XoopsTpl.New', array( &$this , 'xoopsTplHook' ) ) ; | |
} | |
public function xoopsTplHook( &$xoopsTpl ) | |
{ | |
$xoopsTpl->register_outputfilter(array($this, "doReplace")); | |
} | |
public function doReplace($tplOutput, &$smarty) | |
{ | |
$tplOutput = str_replace(self::PRODUCTION_URL, XOOPS_URL, $tplOutput); | |
return $tplOutput; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment