HTML置換プリロード
<?php | |
if (!defined('XOOPS_ROOT_PATH')) exit(); | |
class htmlReplace extends XCube_ActionFilter | |
{ | |
function preFilter() | |
{ | |
$this->mRoot->mDelegateManager->add('XoopsTpl.New', array( &$this , 'xoopsTplHook' ) ) ; | |
} | |
function xoopsTplHook( &$xoopsTpl ) | |
{ | |
$xoopsTpl->register_outputfilter("htmlReplaceFilter"); | |
} | |
} | |
function htmlReplaceFilter($tpl_output, &$smarty) | |
{ | |
$replaced = $tpl_output; | |
if ($GLOBALS['xoopsConfig']['theme_set'] == 'smartphone'){ | |
// 4PCを削除 | |
$replaced = preg_replace('/<!--4PC-->.*?<!--\/4PC-->/s', '', $replaced); | |
}else{ | |
// 4SMARTPHONEを削除 | |
$replaced = preg_replace('/<!--4SMARTPHONE-->.*?<!--\/4SMARTPHONE-->/s', '', $replaced); | |
} | |
return $replaced; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
RyujiAMANO commentedJun 22, 2016
普通はこんなん使うよりテーマごとのcss側でdisplay:noneしちゃったほうがいいです。picoとかコンテンツ中にかかれてるjavascriptとかstyleタグとかを無視させたくなったんでつくりました