assign(array(
'GVIDEO_PATH' => GVIDEO_PATH,
'U_GVIDEO_EDIT' => GVIDEO_ADMIN.'-photo&image_id='.$picture['current']['id'],
));
$template->set_prefilter('ato_public_controller', 'gvideo_admintools');
}
}
return $picture;
}
function gvideo_admintools($content)
{
$search = '{if isset($ato.U_DELETE)}';
$replace = '
{if isset($U_GVIDEO_EDIT)}
{combine_css path=$GVIDEO_PATH|cat:\'template/fontello/css/gvideo.css\'}
{\'Video properties\'|translate}
{/if}
{if isset($ato.U_DELETE)}';
return str_replace($search, $replace, $content);
}
/**
* replace content on picture page
*/
function gvideo_element_content($content, $element_info)
{
if (!$element_info['is_gvideo'])
{
return $content;
}
global $page, $picture, $template, $conf;
// remove some actions
$template->assign('U_SLIDESHOW_START', null);
$template->assign('U_METADATA', null);
$template->append('current', array('U_DOWNLOAD' => null), true);
$query = '
SELECT *
FROM '.GVIDEO_TABLE.'
WHERE picture_id = '.$element_info['id'].'
;';
$video = pwg_db_fetch_assoc(pwg_query($query));
if (empty($video['width']))
{
$video['width'] = $conf['gvideo']['width'];
$video['height'] = $conf['gvideo']['height'];
}
if (empty($video['autoplay']))
{
$video['autoplay'] = $conf['gvideo']['autoplay'];
}
$video['config'] = $conf['gvideo'];
if ($video['type'] == 'dailymotion')
{
$colors = array(
'F7FFFD' => 'foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B',
'E02C72' => 'foreground=%23E02C72&highlight=%23BF4B78&background=%23260F18',
'92ADE0' => 'foreground=%2392ADE0&highlight=%23A2ACBF&background=%23202226',
'E8D9AC' => 'foreground=%23E8D9AC&highlight=%23FFF6D9&background=%23493D27',
'C2E165' => 'foreground=%23C2E165&highlight=%23809443&background=%23232912',
'052880' => 'foreground=%23FF0099&highlight=%23C9A1FF&background=%23052880',
'FF0000' => 'foreground=%23FF0000&highlight=%23FFFFFF&background=%23000000',
'834596' => 'foreground=%23834596&highlight=%23CFCFCF&background=%23000000',
);
$video['config']['dailymotion']['color'] = $colors[ $video['config']['dailymotion']['color'] ];
}
$template->assign('GVIDEO', $video);
global $user;
// hide stripped overlay preventing to click on video object
if (strpos('stripped', $user['theme']) !== false)
{
$template->block_html_style(null, '.hideTabs{ display:none !important; }');
}
$template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'template/video_'.$video['type'].'.tpl'));
return $template->parse('gvideo_content', true);
}
/**
* clean table at element deletion
*/
function gvideo_delete_elements($ids)
{
$query = '
DELETE FROM '.GVIDEO_TABLE.'
WHERE picture_id IN ('.implode(',', $ids).')
;';
pwg_query($query);
}