tips:safely_include_php_code
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tips:safely_include_php_code [2016-09-24 10:05] – Match <php> case-insentible to cover <PHP> as well 92.75.129.61 | tips:safely_include_php_code [2019-10-06 09:21] (current) – New php function clso | ||
---|---|---|---|
Line 143: | Line 143: | ||
--- // | --- // | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== The New function php ==== | ||
+ | I fixed some wrong and stale code,\\ | ||
+ | It's works great on DokuWiki " | ||
+ | |||
+ | [[https:// | ||
+ | --- [[user> | ||
+ | |||
+ | <code php> | ||
+ | function php($text) { | ||
+ | global $conf; | ||
+ | global $INFO; | ||
+ | |||
+ | $editor = $INFO[' | ||
+ | |||
+ | /* @var Doku_Plugin_Controller $plugin_controller */ | ||
+ | global $plugin_controller; | ||
+ | /* @var DokuWiki_Auth_Plugin $users */ | ||
+ | $users = null; | ||
+ | foreach ($plugin_controller-> | ||
+ | if ($conf[' | ||
+ | $users = $plugin_controller-> | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | $is_admin = false; | ||
+ | if(!empty($users)){ | ||
+ | $user = $users-> | ||
+ | $is_admin = auth_isMember($conf[' | ||
+ | } | ||
+ | |||
+ | // disable revisions is not good idea | ||
+ | // if ($conf[' | ||
+ | if ($conf[' | ||
+ | ob_start(); | ||
+ | eval($text); | ||
+ | $this-> | ||
+ | ob_end_clean(); | ||
+ | }else{ | ||
+ | $this-> | ||
+ | } | ||
+ | } | ||
+ | </ |
tips/safely_include_php_code.txt · Last modified: 2019-10-06 09:21 by clso