source: extensions/gvideo/include/gvideo.inc.php @ 18008

Last change on this file since 18008 was 17678, checked in by mistic100, 12 years ago

remove Autosize on video pages, fix overlap problem with Stripped

File size: 3.4 KB
Line 
1<?php
2if (!defined('GVIDEO_PATH')) die('Hacking attempt!');
3
4/**
5 * some stuff at the begining of picture.php
6 */
7function gvideo_prepare_picture($picture)
8{
9  if ($picture['current']['is_gvideo'])
10  {
11    // remove default parser
12    remove_event_handler('render_element_content', 'default_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL);
13 
14    // remove autosize
15    global $pwg_loaded_plugins, $autosize_controler;
16   
17    if ( isset($pwg_loaded_plugins['Autosize']) and isset($autosize_controler) )
18    {
19      remove_event_handler('render_element_content', array(&$autosize_controler, 'init'), EVENT_HANDLER_PRIORITY_NEUTRAL);
20      remove_event_handler('render_element_content', array(&$autosize_controler, 'autosize_calcContent'), 40); 
21      remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_1'), EVENT_HANDLER_PRIORITY_NEUTRAL);
22      remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_2'), EVENT_HANDLER_PRIORITY_NEUTRAL);
23      remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_3'), EVENT_HANDLER_PRIORITY_NEUTRAL);
24      remove_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21);
25    }
26  }
27 
28  return $picture;
29}
30
31/**
32 * replace content on picture page
33 */
34function gvideo_element_content($content, $element_info)
35{
36  if (!$element_info['is_gvideo'])
37  {
38    return $content;
39  }
40 
41  global $page, $picture, $template, $conf;
42 
43  $conf['gvideo'] = unserialize($conf['gvideo']);
44 
45 
46  $query = '
47SELECT *
48  FROM '.GVIDEO_TABLE.'
49  WHERE picture_id = '.$element_info['id'].'
50;';
51  $video = pwg_db_fetch_assoc(pwg_query($query));
52 
53  if (empty($video['width']))
54  {
55    $video['width'] = $conf['gvideo']['width'];
56    $video['height'] = $conf['gvideo']['height'];
57  }
58  if (empty($video['autoplay']))
59  {
60    $video['autoplay'] = $conf['gvideo']['autoplay'];
61  }
62 
63  $video['config'] = $conf['gvideo'];
64  if ($video['type'] == 'dailymotion')
65  {
66    $colors = array(
67      'F7FFFD' => 'foreground=%23F7FFFD&amp;highlight=%23FFC300&amp;background=%23171D1B',
68      'E02C72' => 'foreground=%23E02C72&amp;highlight=%23BF4B78&amp;background=%23260F18',
69      '92ADE0' => 'foreground=%2392ADE0&amp;highlight=%23A2ACBF&amp;background=%23202226',
70      'E8D9AC' => 'foreground=%23E8D9AC&amp;highlight=%23FFF6D9&amp;background=%23493D27',
71      'C2E165' => 'foreground=%23C2E165&amp;highlight=%23809443&amp;background=%23232912',
72      '052880' => 'foreground=%23FF0099&amp;highlight=%23C9A1FF&amp;background=%23052880',
73      'FF0000' => 'foreground=%23FF0000&amp;highlight=%23FFFFFF&amp;background=%23000000',
74      '834596' => 'foreground=%23834596&amp;highlight=%23CFCFCF&amp;background=%23000000',
75      );
76    $video['config']['dailymotion']['color'] = $colors[ $video['config']['dailymotion']['color'] ];
77  }
78 
79  $template->assign('GVIDEO', $video);
80 
81  global $user;
82  if (strpos('stripped', $user['theme']) !== false)
83  {
84    $template->append('head_elements', '<style type="text/css">.hideTabs{display:none;}</style>');
85  }
86
87  $template->set_filename('gvideo_content', dirname(__FILE__).'/../template/video_'.$video['type'].'.tpl');
88  return $template->parse('gvideo_content', true);
89}
90
91/**
92 * clean table at element deletion
93 */
94function gvideo_delete_elements($ids)
95{
96  $query = '
97DELETE FROM '.GVIDEO_TABLE.'
98  WHERE picture_id IN ('.implode(',', $ids).')
99;';
100  pwg_query($query);
101}
102
103?>
Note: See TracBrowser for help on using the repository browser.