Guest User

Untitled

a guest
Jun 22nd, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2. if (!defined('XOOPS_ROOT_PATH')) exit();
  3.  
  4. class htmlReplace extends XCube_ActionFilter
  5. {
  6. function preFilter()
  7. {
  8. $this->mRoot->mDelegateManager->add('XoopsTpl.New', array( &$this , 'xoopsTplHook' ) ) ;
  9. }
  10.  
  11. function xoopsTplHook( &$xoopsTpl )
  12. {
  13. $xoopsTpl->register_outputfilter("htmlReplaceFilter");
  14. }
  15. }
  16.  
  17. function htmlReplaceFilter($tpl_output, &$smarty)
  18. {
  19. $replaced = $tpl_output;
  20. if ($GLOBALS['xoopsConfig']['theme_set'] == 'smartphone'){
  21. // 4PCを削除
  22. $replaced = preg_replace('/<!--4PC-->.*?<!--\/4PC-->/s', '', $replaced);
  23. }else{
  24. // 4SMARTPHONEを削除
  25. $replaced = preg_replace('/<!--4SMARTPHONE-->.*?<!--\/4SMARTPHONE-->/s', '', $replaced);
  26. }
  27. return $replaced;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment