source: extensions/charlies_content/main.inc.php @ 3974

Last change on this file since 3974 was 3974, checked in by vdigital, 11 years ago

[Charlies_content] 2.0.e (Called ngoc version)
buffermessage correction for flv (One in upper left corner)
The lumenation bypass is maintain (but no longer needed with recent Piwigo versions)
Even getID3 v2.0.0-b5 is available because not tested (getID3 v2.0.0-b4 is maintain)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1<?php /*
2Plugin Name: Charlies content
3Version: 2.0.e
4Description: Charlies content is a global solution for none picture files.
5Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=119
6Author: VDigital, rvelices (PhpWebGallery team)
7Author URI: http://www.phpwebgallery.net
8*/
9/* Synopsis
101 - Based on file extension...
112 - A template is used in state of the default content
12
13Dependencies:
14http://getid3.sourceforge.net/
15http://flv-player.net/players/maxi/documentation/
16
17/** History ***************
18  2009-05-24 2.0.e (Called ngoc version)
19                   buffermessage correction for flv
20                                                 The lumenation bypass is maintain (but no longer needed with recent Piwigo versions)
21                                                 getID3 v2.0.0-b5 not tested => Still in v2.0.0-b4
22  2009-05-24 2.0.d (Called lumenation bypass)
23                   some url were generated with https://
24  2009-04-13 2.0.c
25                   Flipflip proposal to exclude GETID3 for some extends
26                                                 nolive proposal to support GPX extensions
27                                                 Forced width/height are supported by flvstreamer
28  2009-02-15 2.0.b
29                   Admin configuration menu
30                                                 And related changes (New version of GetID3)
31
32  2008-10-30 2.0.a (Not distributed)
33             Smarty version for Piwigo (Don't use it with PhpWebGallery 1.7.x)
34  2008/03/26: error_reporting(E_ERROR | E_WARNING | E_PARSE);
35             during getid3 call (Only one referenced case).             
36  2008/02/22:
37 * 3GP support : video streams from mobile phones.
38   There are two different standards for this format:
39   3gp for GSM-based Phones, or 3g2 for CDMA-based Phones.
40 * $page['slideshow'] active/inactive support for "Pause" enhancement
41   so Charlies won't act on active slideshow but will act on Slideshow pause
42
43  2007-10-21 1.7.a First release for PhpWebGallery 1.7
44  2006-01-06 Video Integrator and followed by Media Integrator
45  and previously Kitof's Original MOD.
46 **/
47
48/**
49 * All media file have to be broadcasted via an embedded player
50 * so link its extention to a player name as to be define
51 * the same player can be used for several extentions
52 */
53  global $conf, $charlie;
54
55if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
56define('CHARLIES_DIR' , basename(dirname(__FILE__)));
57define('CHARLIES_PATH' , PHPWG_PLUGINS_PATH . CHARLIES_DIR . '/');
58define('CHARLIES_VER' , '2.0.e');
59$x = @file_get_contents( $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat');
60if ($x!==false) $charlie = unserialize($x);
61if (!isset($charlie['version']) or  $charlie['version'] != CHARLIES_VER) 
62{
63        $charlie['version'] = CHARLIES_VER;
64        if (!isset($charlie['FlvStreamer'])) $charlie['FlvStreamer'] = array('flv',); 
65        if (!isset($charlie['Flash']))                  $charlie['Flash'] = array('swf',); 
66        if (!isset($charlie['Music']))                  $charlie['Music'] = array('pls','m3u','wav','mid','au','aif',); 
67        if (!isset($charlie['mp3Player']))      $charlie['mp3Player'] = array('mp3',); 
68        if (!isset($charlie['Acrobat']))                $charlie['Acrobat'] = array('pdf',); 
69        if (!isset($charlie['WMplayer']))       $charlie['WMplayer'] = array('asf','wmv','divx','xvid',); 
70        if (!isset($charlie['QuickTime']))      $charlie['QuickTime'] = 
71        array('aiff','aac','bmp','gsm','mov','mpg','mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif','tiff','3g2','3pg');
72        if (!isset($charlie['Archive']))                $charlie['Archive'] = array('zip','rar',); 
73        if (!isset($charlie['GPS']))                            $charlie['GPS'] = array('gpx',); 
74
75        if (!isset($charlie['autoplay']))       $charlie['autoplay'] = 1;
76        if (!isset($charlie['loop']))                   $charlie['loop'] = 1;
77        if (!isset($charlie['full']))                   $charlie['full'] = 1;
78        if (!isset($charlie['forced_width']))   $charlie['forced_width'] = '';
79        if (!isset($charlie['forced_height']))  $charlie['forced_height'] = '';
80        if (!isset($charlie['video_default_width']))            $charlie['video_default_width'] =  320;
81        if (!isset($charlie['video_default_height']))           $charlie['video_default_height'] =  240;
82        if (!isset($charlie['volume']))                 $charlie['volume'] = 150;
83        if (!isset($charlie['onclick']))                $charlie['onclick'] = 'playpause';
84        if (!isset($charlie['onclicktarget']))  $charlie['onclicktarget'] = 0;
85        if (!isset($charlie['ondoubleclick']))  $charlie['ondoubleclick'] = 'fullscreen';
86        if (!isset($charlie['ondoubleclicktarget']))            $charlie['ondoubleclicktarget'] = 0;
87        if (!isset($charlie['buffer']))                 $charlie['buffer'] = 10;
88        if (!isset($charlie['buffermessage']))  $charlie['buffermessage'] = 'Buffering _n_';
89        if ($charlie['buffermessage']==1)       $charlie['buffermessage'] = 'Buffering _n_';
90        if (!isset($charlie['buffershowbg']))   $charlie['buffershowbg'] = 0;
91        if (!isset($charlie['config']))                 $charlie['config'] = 0;
92        if (!isset($charlie['configxml']))      $charlie['configxml'] = 0;
93        if (!isset($charlie['margin']))                 $charlie['margin'] = 8;
94        if (!isset($charlie['skin']))                   $charlie['skin'] = ''; // './plugins/charlies_content/skin.jpg';
95        if (!isset($charlie['title']))                  $charlie['title'] = '/n/n/nCharlies\' content ';
96        if (!isset($charlie['titlesize']))      $charlie['titlesize'] = 26;
97        if (!isset($charlie['start_image']))            $charlie['start_image'] = './plugins/charlies_content/city-lights.jpg';
98        if (!isset($charlie['showtitleandstartimage']))         $charlie['showtitleandstartimage'] = 0;
99        if (!isset($charlie['showiconplay']))           $charlie['showiconplay'] = 0;
100        if (!isset($charlie['iconplaybgalpha']))        $charlie['iconplaybgalpha'] = 20;
101        if (!isset($charlie['srt']))            $charlie['onclick'] = 0;
102        if (!isset($charlie['showplayer']))             $charlie['showplayer'] = 1;
103        if (!isset($charlie['showloading']))            $charlie['showloading'] = 1;
104        if (!isset($charlie['showmouse']))              $charlie['showmouse'] = 1;
105        if (!isset($charlie['showtime']))               $charlie['showtime'] = 2;
106        if (!isset($charlie['playeralpha']))            $charlie['playeralpha'] = 20;
107        if (!isset($charlie['playertimeout']))          $charlie['playertimeout'] = 1500;
108        if (!isset($charlie['showstop']))       $charlie['showstop'] = 1;
109        if (!isset($charlie['showvolume'])) $charlie['showvolume'] = 1;
110        if (!isset($charlie['showswitchsubtitles']))    $charlie['showswitchsubtitles'] = 0;
111        if (!isset($charlie['loadonstop'])) $charlie['loadonstop'] = 0;
112        if (!isset($charlie['shortcut']))       $charlie['shortcut'] = 1;
113        if (!isset($charlie['phpstream']))              $charlie['phpstream'] = 1;
114        if (!isset($charlie['curtain']))                $charlie['curtain'] = 'none';
115        if (!isset($charlie['start_image']))    $charlie['start_image'] =  CHARLIES_PATH . 'background.jpg';
116        if (!isset($charlie['color16']))
117        {
118                $charlie['color0'] = '#111111';
119                $charlie['color1'] = '#ff7700';
120                $charlie['color2'] = '#444444';
121                $charlie['color3'] = '#ff3333';
122                $charlie['color4'] = '#ff3363';
123                $charlie['color5'] = '#ff7700';
124                $charlie['color6'] = '#111111';
125                $charlie['color7'] = '#ff3333';
126                $charlie['color8'] = '#ff3363';
127                $charlie['color9'] = '#111111';
128                $charlie['color10'] = '#444444';
129                $charlie['color11'] = '#ff3333';
130                $charlie['color12'] = '#ff3363';
131                $charlie['color13'] = '#ff7700';
132                $charlie['color14'] = '#444444';
133                $charlie['color15'] = '#ff3333';
134                $charlie['color16'] = '#111111';
135        }
136
137        $dir = $conf['local_data_dir'].'/plugins/';
138        @mkdir($dir);
139        $file = fopen( $dir.basename(dirname(__FILE__)).'.dat', 'w' );
140        fwrite($file, serialize($charlie));
141        fclose( $file );
142}
143  /* Note: Uppercase extensions are not requested */
144  /**
145   * That means you must have a tpl file for each... player
146   * like for Flash => ./plugings/charlies_content/flash_content.tpl
147   *
148   * Player name is in lower-case followed by _content.tpl
149   */
150
151add_event_handler('render_element_content', 'render_Charlie_element_content', 40, 2 );
152add_event_handler('get_admin_plugin_menu_links', 'Charlie_plugin_admin_menu');
153$all = array();
154foreach ($charlie as $ext) { 
155  if ( is_array($ext)) $all = array_merge ($all, $ext); 
156}
157$conf['file_ext'] = array_merge (
158    $conf['file_ext'], $all, array_map('strtoupper', $all) );
159
160function Charlie_plugin_admin_menu($menu)
161{
162        array_push($menu, array(
163                                'NAME' => 'Charlies\'', 
164                                'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/charlies_config.php'), 
165                        ));
166        return $menu;
167} 
168
169/**
170 * Only if picture.php is active
171 */
172function render_Charlie_element_content($content, $picture)
173{
174  global $template, $charlie, $page, $conf;
175  if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
176  if ( @$picture['is_picture'] ) return $content; 
177  $all = array();
178  foreach ($charlie as $ext) { if (is_array($ext)) $all = array_merge ($all, $ext); }
179  $charlie['all'] = $all;
180  $extension = strtolower(get_extension($picture['file']));
181  if (!in_array($extension, $charlie['all']))
182  { // in fact nothing to do (Lucky Charlies)
183    return $content; }
184  unset($charlie['all']);
185  include_once(CHARLIES_PATH.'charlies.inc.php');
186  return Charlies_content($picture);
187}
188?>
Note: See TracBrowser for help on using the repository browser.