xref: /plugin/popupviewer/helper.php (revision ce99d4f5c57ad9ca65f09e475da30b6e733a7cab)
1*ce99d4f5SGerry Weißbach<?php
2*ce99d4f5SGerry Weißbach/**
3*ce99d4f5SGerry Weißbach * PopUpViewer
4*ce99d4f5SGerry Weißbach *
5*ce99d4f5SGerry Weißbach * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6*ce99d4f5SGerry Weißbach * @author     i-net software <tools@inetsoftware.de>
7*ce99d4f5SGerry Weißbach * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
8*ce99d4f5SGerry Weißbach */
9*ce99d4f5SGerry Weißbach
10*ce99d4f5SGerry Weißbach// must be run within Dokuwiki
11*ce99d4f5SGerry Weißbachif(!defined('DOKU_INC')) die();
12*ce99d4f5SGerry Weißbach
13*ce99d4f5SGerry Weißbachclass helper_plugin_popupviewer extends DokuWiki_Plugin {
14*ce99d4f5SGerry Weißbach
15*ce99d4f5SGerry Weißbach    function _getWidthHeightParams($w, $h) {
16*ce99d4f5SGerry Weißbach        $params = ''; $params2 = '';
17*ce99d4f5SGerry Weißbach        if ( !empty($w) && intval($w) == $w ) $params2 .= ',\'' . intval($w) . '\'';
18*ce99d4f5SGerry Weißbach        else {
19*ce99d4f5SGerry Weißbach            if ( !empty($w) && doubleVal($w) == $w )
20*ce99d4f5SGerry Weißbach            $params .= 'viewer.maxWidthFactor=' . doubleVal($w) . ';';
21*ce99d4f5SGerry Weißbach            $params2 .= ',null';
22*ce99d4f5SGerry Weißbach        }
23*ce99d4f5SGerry Weißbach
24*ce99d4f5SGerry Weißbach        if ( !empty($h) && intval($h) == $h ) $params2 .= ',\'' . intval($h) . '\'';
25*ce99d4f5SGerry Weißbach        else {
26*ce99d4f5SGerry Weißbach            if ( !empty($h) && doubleVal($h) == $h )
27*ce99d4f5SGerry Weißbach            $params .= 'viewer.maxHeightFactor=' . doubleVal($h) . ';';
28*ce99d4f5SGerry Weißbach            $params2 .= ',null';
29*ce99d4f5SGerry Weißbach        }
30*ce99d4f5SGerry Weißbach
31*ce99d4f5SGerry Weißbach        return array($params, $params2);
32*ce99d4f5SGerry Weißbach    }
33*ce99d4f5SGerry Weißbach
34*ce99d4f5SGerry Weißbach}
35