function webvideo_render_object($args)
{
    $obj = $args['obj'];
    if (!isset($obj['type']) || $obj['type'] != 'webvideo') {
        return false;
    }
    $e = elem('div');
    elem_attr($e, 'id', $obj['name']);
    elem_add_class($e, 'webvideo');
    elem_add_class($e, 'resizable');
    elem_add_class($e, 'object');
    // hooks
    invoke_hook_first('alter_render_early', 'webvideo', array('obj' => $obj, 'elem' => &$e, 'edit' => $args['edit']));
    $html = elem_finalize($e);
    invoke_hook_last('alter_render_late', 'webvideo', array('obj' => $obj, 'html' => &$html, 'elem' => $e, 'edit' => $args['edit']));
    return $html;
}
예제 #2
0
/**
 *	implements render_object
 */
function image_render_object($args)
{
    $obj = $args['obj'];
    if (!isset($obj['type']) || $obj['type'] != 'image') {
        return false;
    }
    // the outer element must be a div or something else that can contain
    // other elements
    // we only set up the most basic element here - all the other work is
    // done inside the alter_render_early hook
    // this way also object that "derive" from this (which don't have their
    // $obj['type'] set to image) can use this code
    $e = elem('div');
    elem_attr($e, 'id', $obj['name']);
    elem_add_class($e, 'image');
    elem_add_class($e, 'resizable');
    elem_add_class($e, 'object');
    // hook
    // elem is passed as reference here
    // it is suggested that we first call our own function before any others
    // that might want to modify the element that is being set up
    invoke_hook_first('alter_render_early', 'image', array('obj' => $obj, 'elem' => &$e, 'edit' => $args['edit']));
    $html = elem_finalize($e);
    // html is passed as reference here
    // it is suggested that we call our own function after all others
    invoke_hook_last('alter_render_late', 'image', array('obj' => $obj, 'html' => &$html, 'elem' => $e, 'edit' => $args['edit']));
    return $html;
}
예제 #3
0
function download_render_object($args)
{
    $obj = $args['obj'];
    if (!isset($obj['type']) || $obj['type'] != 'download') {
        return false;
    }
    $e = elem('div');
    elem_attr($e, 'id', $obj['name']);
    elem_add_class($e, 'download');
    elem_add_class($e, 'object');
    // hooks
    invoke_hook_first('alter_render_early', 'download', array('obj' => $obj, 'elem' => &$e, 'edit' => $args['edit']));
    $html = elem_finalize($e);
    invoke_hook_last('alter_render_late', 'download', array('obj' => $obj, 'html' => &$html, 'elem' => $e, 'edit' => $args['edit']));
    if (!$args['edit']) {
        // put link to file around the element
        if (SHORT_URLS) {
            $link = base_url() . urlencode($obj['name']) . '&download=1';
        } else {
            $link = base_url() . '?' . urlencode($obj['name']) . '&download=1';
        }
        $html = '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '">' . "\n\t" . str_replace("\n", "\n\t", $html) . "\n" . '</a>' . "\n";
    }
    return $html;
}