Skip to content

Instantly share code, notes, and snippets.

@RyujiAMANO
Created June 6, 2020 03:05
Show Gist options
  • Save RyujiAMANO/c706cdb9d24d784aeee03300ed9fa631 to your computer and use it in GitHub Desktop.
Save RyujiAMANO/c706cdb9d24d784aeee03300ed9fa631 to your computer and use it in GitHub Desktop.
本番URLを開発環境のURLに置換して表示するためのXOOPS Cube用preloadファイル
<?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