File: iframe.php

package info (click to toggle)
horde3 3.0.4-4sarge7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,980 kB
  • ctags: 16,295
  • sloc: php: 68,726; xml: 2,382; sql: 498; makefile: 74; sh: 63; pascal: 6
file content (62 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download
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
<?php

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

/**
 * $Horde: horde/lib/Block/iframe.php,v 1.18 2004/11/12 18:58:19 chuck 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' => 'http://slashdot.org/'),
                     'title'  => array('type' => 'text',
                                       'name' => _("Title")));
    }

    /**
     * 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, 'header') . $title . '</a>';
        $html .= Horde::link($this->_params['iframe'], _("Open in a new window"), 'smallheader', '_new') . Horde::img('website.png', _("Open in a new window"), 'hspace="5"', Horde::url($registry->getImageDir(), true, -1)) . _("Open in a new window") . '</a>';

        return $html;
    }

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

        if (!$browser->hasFeature('iframes')) {
            $html = _("Your browser does not support this feature.");
        } else {
            if ($browser->isBrowser('msie') || $browser->isBrowser('konqueror')) {
                $height = '';
            } else {
                $height = ' height="100%"';
            }
            $html = '<iframe src="' . htmlspecialchars($this->_params['iframe']) . '" width="100%"' . $height . ' marginheight="0" scrolling="yes" frameborder="0"></iframe>';
        }
        return $html;
    }

}