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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
<?php
/**
* @version $Revision: 1.8 $
* @package liberty
* @subpackage plugins_data
*/
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Authors: drewslater <andrew@andrewslater.com>
// +----------------------------------------------------------------------+
// $Id: data.flashvideo.php,v 1.8 2007/05/20 10:09:14 squareing Exp $
/**
* definitions
*/
global $gBitSystem;
define( 'PLUGIN_GUID_DATAFLASHVIDEO', 'dataflashvideo' );
global $gLibertySystem;
$pluginParams = array (
'tag' => 'flashvideo',
'auto_activate' => TRUE,
'requires_pair' => FALSE,
'load_function' => 'data_flashvideo',
'title' => 'Flash Video',
'help_page' => 'DataPluginAttachment',
'description' => tra( "Display flashvideo in content. This requires videos" ),
'help_function' => 'data_flashvideo_help',
'syntax' => '{flashvideo id= size= align= }',
'path' => LIBERTY_PKG_PATH.'plugins/data.flashvideo.php',
'security' => 'registered',
'plugin_type' => DATA_PLUGIN,
'biticon' => '{biticon iclass= "quicktag icon" ipackage=quicktags iname=flashvideo iexplain="Image"}',
'taginsert' => '{flashvideo id= align= description=}',
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAFLASHVIDEO, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAFLASHVIDEO );
function data_flashvideo_help() {
$help =
'<table class="data help">'
.'<tr>'
.'<th>' . tra( "Key" ) . '</th>'
.'<th>' . tra( "Type" ) . '</th>'
.'<th>' . tra( "Comments" ) . '</th>'
.'</tr>'
.'<tr class="odd">'
.'<td>id</td>'
.'<td>' . tra( "numeric") . '<br />' . tra("(required)") . '</td>'
.'<td>' . tra( "Id number of Flashvideo to display inline.") . '</td>'
.'</tr>'
.'<tr class="even">'
.'<td>size</td>'
.'<td>' . tra( "key-words") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "You can change the display size of the video here. This will not influence the download size of the video itself. Possible values are:") . ' <strong>small, medium, large, huge</strong></td>'
.'</tr>'
.'<tr class="odd">'
.'<td>view</td>'
.'<td>' . tra( "key-words") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "If you are including a small version of the video, you can easily link to the large version of this film. Possible values are:") . ' <strong>small, medium, large, huge, original</strong></td>'
.'</tr>'
.'<tr class="even">'
.'<td>width</td>'
.'<td>' . tra( "numeric") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "Manually set the width of the video in pixels.").'</td>'
.'</tr>'
.'<tr class="odd">'
.'<td>height</td>'
.'<td>' . tra( "numeric") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "Manually set the height of the video in pixels. The hight will be calculated automatically if not set.").'</td>'
.'</tr>'
.'<tr class="even">'
.'<td>'.tra( "styling" ).'</td>'
.'<td>'.tra( "string").'<br />'.tra("(optional)").'</td>'
.'<td>'.tra( "Multiple styling options available: padding, margin, background, border, text-align, color, font, font-size, font-weight, font-family, align. Please view CSS guidelines on what values these settings take.").'</td>'
.'</tr>'
.'</table>'
. tra("Example: ") . "{flashvideo id='13' text-align='center'}";
return $help;
}
function data_flashvideo( $pData, $pParams ) { // NOTE: The original plugin had several parameters that have been dropped
global $gContent, $gBitSmarty;
// at a minimum, return blank string (not empty) so we still replace the tag
$ret = ' ';
if( empty( $pParams['id'] )) {
return $ret;
}
$liba = new LibertyAttachable();
if( !$att = $liba->getAttachment( $pParams['id'] )) {
$ret = tra( "The flashvideo id given is not valid" ).": ".$pParams['id'];
return $ret;
}
if( !empty( $att['flv_url'] )) {
$wrapper = liberty_plugins_wrapper_style( $pParams );
// mPrefs has been passed to us in $att['prefs']
treasury_flv_calculate_videosize( $pParams, $att['prefs'] );
$sizes = array( 'small', 'medium', 'large', 'huge', 'original' );
if( !empty( $pParams['view'] ) && in_array( $pParams['view'], $sizes )) {
$wrapper['description'] .= ( !empty( $wrapper['description'] ) ? '<br />' : '' );
$wrapper['description'] .= '<a href="'.$att['display_url'].'&size='.$pParams['view'].'">'.tra( "View larger version" ).'</a>';
}
$gBitSmarty->assign( 'flvPrefs', $att['prefs'] );
$gBitSmarty->assign( 'flv', $att );
$ret = $gBitSmarty->fetch( 'bitpackage:treasury/flv_player_inc.tpl' );
// finally, wrap the output with a span
$ret = '<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "flashvideo-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.( !empty( $wrapper['description'] ) ? '<br />'.$wrapper['description'] : '' ).'</span>';
} else {
$ret = tra( "There doesn't seem to be a valid video stream for the id you used" ).": ".$pParams['id'];
}
return $ret;
}
?>
|