add('name', PLUGIN_EVENT_YOUTUBE_TITLE);
$propbag->add('description', PLUGIN_EVENT_YOUTUBE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '1.3');
$propbag->add('event_hooks', array(
'backend_entry_toolbar_extended' => true,
'backend_entry_toolbar_body' => true,
));
$propbag->add('groups', array('BACKEND_EDITOR'));
$propbag->add('configuration', array('youtube_server', 'youtube_width', 'youtube_height', 'youtube_rel', 'youtube_border', 'youtube_color1', 'youtube_color2'));
}
function generate_content(&$title) {
$title = PLUGIN_EVENT_YOUTUBE_TITLE;
}
function introspect_config_item($name, &$propbag)
{
switch($name) {
case 'youtube_server':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_SERVER);
$propbag->add('default', 'http://www.youtube.com/v/');
return true;
break;
case 'youtube_width':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_WIDTH);
$propbag->add('default', '425');
return true;
break;
case 'youtube_height':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_HEIGHT);
$propbag->add('default', '344');
return true;
break;
case 'youtube_rel':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_REL);
$propbag->add('default', 'true');
return true;
break;
case 'youtube_border':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_BORDER);
$propbag->add('default', 'false');
return true;
break;
case 'youtube_color1':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_COLOR1);
$propbag->add('default', '0x3a3a3a');
return true;
break;
case 'youtube_color2':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_YOUTUBE_COLOR2);
$propbag->add('default', '0x999999');
return true;
break;
}
}
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'backend_entry_toolbar_extended':
if (!isset($txtarea)) {
$txtarea = 'serendipity[extended]';
$func = 'extended';
}
case 'backend_entry_toolbar_body':
if (!isset($txtarea)) {
if (isset($eventData['backend_entry_toolbar_body:textarea'])) {
// event caller has given us the name of the textarea converted
// into a wysiwg editor(for example, the staticpages plugin)
$txtarea = $eventData['backend_entry_toolbar_body:textarea'];
} else {
// default value
$txtarea = 'serendipity[body]';
}
if (isset($eventData['backend_entry_toolbar_body:nugget'])) {
$func = $eventData['backend_entry_toolbar_body:nugget'];
} else{
$func = 'body';
}
}
// CKEDITOR needs this little switch
if (preg_match('@^nugget@i', $func)) {
$cke_txtarea = $func;
} else {
$cke_txtarea = $txtarea;
}
?>
';
echo ' ' . PLUGIN_EVENT_YOUTUBE_BUTTON . ' ';
#echo '';
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}
}
/* vim: set sts=4 ts=4 expandtab : */