diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2019-10-10 09:55:14 +0200 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2019-10-10 09:55:14 +0200 |
commit | 31a58aba4c24b34c34ad5764d1a35b7c398c3a2c (patch) | |
tree | 7f4d1546fbb69863a7d366fc1ff647f784853b68 /lib/plugins/styling/action.php | |
parent | af7ba5aa0bd10fc0ad9ef983006305b4c5a8ed42 (diff) | |
parent | c0c77cd20b23921c9e893bb70b99f38be153875a (diff) | |
download | dokuwiki-31a58aba4c24b34c34ad5764d1a35b7c398c3a2c.tar.gz dokuwiki-31a58aba4c24b34c34ad5764d1a35b7c398c3a2c.zip |
Merge branch 'psr2'
* psr2: (160 commits)
fixed merge error
Moved parts of the Asian word handling to its own class
ignore snake_case error of substr_replace
fixed some line length errors
ignore PSR2 in the old form class
fix PSR2 error in switch statement
replaced deprecated utf8 functions
formatting cleanup
mark old utf8 functions deprecated
some more PSR2 cleanup
Some cleanup for the UTF-8 stuff
Moved all utf8 methods to their own namespaced classes
Create separate table files for UTF-8 handling
Ignore mixed concerns in loader
Use type safe comparisons in loader
Remove obsolete include
adjust phpcs exclude patterns for new plugin classes
🚚 Move Subscription class to deprecated.php
♻️ Split up ChangesSubscriptionSender into multiple classes
Minor optimizations in PluginController
...
Diffstat (limited to 'lib/plugins/styling/action.php')
-rw-r--r-- | lib/plugins/styling/action.php | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/lib/plugins/styling/action.php b/lib/plugins/styling/action.php index 2190fd61d..46245ca75 100644 --- a/lib/plugins/styling/action.php +++ b/lib/plugins/styling/action.php @@ -5,19 +5,8 @@ * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html * @author Andreas Gohr <andi@splitbrain.org> */ - -// must be run within Dokuwiki -if(!defined('DOKU_INC')) die(); - -/** - * Class action_plugin_styling - * - * This handles all the save actions and loading the interface - * - * All this usually would be done within an admin plugin, but we want to have this available outside - * the admin interface using our floating dialog. - */ -class action_plugin_styling extends DokuWiki_Action_Plugin { +class action_plugin_styling extends DokuWiki_Action_Plugin +{ /** * Registers a callback functions @@ -25,8 +14,9 @@ class action_plugin_styling extends DokuWiki_Action_Plugin { * @param Doku_Event_Handler $controller DokuWiki's event controller object * @return void */ - public function register(Doku_Event_Handler $controller) { - $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_header'); + public function register(Doku_Event_Handler $controller) + { + $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleHeader'); } /** @@ -37,26 +27,25 @@ class action_plugin_styling extends DokuWiki_Action_Plugin { * handler was registered] * @return void */ - public function handle_header(Doku_Event &$event, $param) { + public function handleHeader(Doku_Event &$event, $param) + { global $ACT; global $INPUT; - if($ACT != 'admin' || $INPUT->str('page') != 'styling') return; + if ($ACT != 'admin' || $INPUT->str('page') != 'styling') return; /** @var admin_plugin_styling $admin */ $admin = plugin_load('admin', 'styling'); - if(!$admin->isAccessibleByCurrentUser()) return; + if (!$admin->isAccessibleByCurrentUser()) return; // set preview $len = count($event->data['link']); - for($i = 0; $i < $len; $i++) { - if( - $event->data['link'][$i]['rel'] == 'stylesheet' && + for ($i = 0; $i < $len; $i++) { + if ($event->data['link'][$i]['rel'] == 'stylesheet' && strpos($event->data['link'][$i]['href'], 'lib/exe/css.php') !== false ) { $event->data['link'][$i]['href'] .= '&preview=1&tseed='.time(); } } } - } // vim:ts=4:sw=4:et: |