File: iframe.php

package info (click to toggle)
horde3 3.1.3-4etch7
  • links: PTS
  • area: main
  • in suites: etch
  • size: 22,876 kB
  • ctags: 18,071
  • sloc: php: 75,151; xml: 2,979; sql: 1,069; makefile: 79; sh: 64
file content (72 lines) | stat: -rw-r--r-- 2,120 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php

$block_name = _("View an external web page");

/**
 * $Horde: horde/lib/Block/iframe.php,v 1.18.8.4 2006/02/21 10:53:45 jan Exp $
 *
 * @package Horde_Block
 */
class Horde_Block_Horde_iframe extends Horde_Block {

    var $_app = 'horde';

    function _params()
    {
        return array('iframe' => array('type' => 'text',
                                       'name' => _("URL"),
                                       'default' => ''),
                     'title'  => array('type' => 'text',
                                       'name' => _("Title")),
                     'height' => array('type' => 'int',
                                       'name' => _("Height")));
    }

    /**
     * The title to go in this block.
     *
     * @return string   The title text.
     */
    function _title()
    {
        global $registry;

        $title = isset($this->_params['title'])
            ? $this->_params['title']
            : $this->_params['iframe'];

        $html = Horde::link($this->_params['iframe']) . $title .
            '</a> :: <small>' .
            Horde::link($this->_params['iframe'], '', '', '_blank') .
            Horde::img('website.png', _("Open in a new window")) . ' ' .
            _("Open in a new window") . '</a></small>';

        return $html;
    }

    /**
     * The content to go in this block.
     *
     * @return string   The content
     */
    function _content()
    {
        global $browser;

        if (!$browser->hasFeature('iframes')) {
            return _("Your browser does not support this feature.");
        }

        if (empty($this->_params['height'])) {
            if ($browser->isBrowser('msie') || $browser->isBrowser('konqueror')) {
                $height = '';
            } else {
                $height = ' height="100%"';
            }
        } else {
            $height = ' height="' . htmlspecialchars($this->_params['height']) . '"';
        }
        return '<iframe src="' . htmlspecialchars($this->_params['iframe']) . '" width="100%"' . $height . ' marginheight="0" scrolling="auto" frameborder="0"></iframe>';
    }

}