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

Last change on this file since 16017 was 10406, checked in by Gotcha, 13 years ago

Suppression du contrôle sur le numéro de version.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
1<?php /*
2Plugin Name: Charlies content
3Version: auto
4Description: Charlies content is a global solution for none picture files.
5Plugin URI: http://piwigo.org/ext/extension_view.php?eid=119
6Author: VDigital, rvelices (Piwigo team)
7Author URI: http://piwigo.org/
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/**
18 * All media file have to be broadcasted via an embedded player
19 * so link its extention to a player name as to be define
20 * the same player can be used for several extentions
21 */
22  global $conf, $charlie;
23
24if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
25define('CHARLIES_DIR' , basename(dirname(__FILE__)));
26define('CHARLIES_PATH' , PHPWG_PLUGINS_PATH . CHARLIES_DIR . '/');
27$x = @file_get_contents( $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat');
28if ($x!==false) $charlie = unserialize($x);
29
30if ( isset($_POST['reset']) and defined('IN_ADMIN')
31    and isset($_GET['section']) and $_GET['section']=='charlies_content/charlies_config.php' ) {
32                unset( $charlie );
33                if (!isset($infos)) $infos = array();
34                array_push($infos, l10n('Your configuration configuration has been reset.'));
35}
36
37$default = array(
38                        'autoload'                      => 1,
39                        'autoplay'                      => 1,
40                        'loop'                                  => 1,
41                        'full'                                  => 1,
42                        'forced_width'                  => '',
43                        'forced_height'                 => '',
44                        'video_default_width'   =>  320,
45                        'video_default_height'  =>  240,
46                        'volume'                                => 150,
47                        'onclick'                               => 'playpause',
48                        'onclicktarget'                 => 0,
49                        'ondoubleclick'                 => 'fullscreen',
50                        'ondoubleclicktarget'   => 0,
51                        'buffer'                                => 10,
52                        'buffermessage'                 => 'Buffering _n_',
53                        'buffershowbg'                  => 0,
54                        'config'                                => 0,
55                        'configxml'                     => 0,
56                        'margin'                                => 8,
57                        'skin'                                  => '', /* './plugins/charlies_content/skin.jpg', */
58                        'title'                                 => '/n/n/nCharlies\' content ',
59                        'titlesize'                     => 26,
60                        'start_image'                   => './plugins/charlies_content/city-lights.jpg',
61                        'showtitleandstartimage'=> 0,
62                        'showiconplay'                  => 0,
63                        'iconplaybgalpha'               => 20,
64                        'showplayer'                    => 1,
65                        'showloading'                   => 1,
66                        'showmouse'                     => 1,
67                        'showtime'                      => 2,
68                        'srt'                                   => 0,
69                        'playeralpha'                   => 20,
70                        'playertimeout'                 => 1500,
71                        'showstop'                      => 1,
72                        'showvolume'                    => 1,
73                        'showswitchsubtitles'   => 0,
74                        'loadonstop'                    => 0,
75                        'shortcut'                      => 1,
76                        'phpstream'                     => 1,
77                        'curtain'                               => 'none',
78                        'start_image'                   =>  CHARLIES_PATH . 'background.jpg',
79                        'color0'                                => '#111111',
80                        'color1'                                => '#ff7700',
81                        'color2'                                => '#444444',
82                        'color3'                                => '#ff3333',
83                        'color4'                                => '#ff3363',
84                        'color5'                                => '#ff7700',
85                        'color6'                                => '#111111',
86                        'color7'                                => '#ff3333',
87                        'color8'                                => '#ff3363',
88                        'color9'                                => '#111111',
89                        'color10'                               => '#444444',
90                        'color11'                               => '#ff3333',
91                        'color12'                               => '#ff3363',
92                        'color13'                               => '#ff7700',
93                        'color14'                               => '#444444',
94                        'color15'                               => '#ff3333',
95                        'color16'                               => '#111111',
96                );
97        $charlie = array_merge( $default, $charlie );
98        if (!isset($charlie['FlvStreamer']))    $charlie['FlvStreamer'] = array('flv',); 
99        if (!isset($charlie['Flash']))                  $charlie['Flash'] = array('swf',); 
100        if (!isset($charlie['Music']))                  $charlie['Music'] = array('pls','m3u','wav','mid','au','aif',); 
101        if (!isset($charlie['mp3Player']))              $charlie['mp3Player'] = array('mp3',); 
102        if (!isset($charlie['Acrobat']))                $charlie['Acrobat'] = array('pdf',); 
103        if (!isset($charlie['WMplayer']))               $charlie['WMplayer'] = array('asf','wmv','divx','xvid',); 
104        if (!isset($charlie['QuickTime']))              $charlie['QuickTime'] = 
105        array('aiff','aac','bmp','gsm','mov','mpg','mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif','tiff','3g2','3pg','3gp');
106        if (!isset($charlie['Archive']))                $charlie['Archive'] = array('zip','rar',); 
107        if (!isset($charlie['GPS']))                    $charlie['GPS'] = array('gpx',); 
108
109        $dir = $conf['local_data_dir'].'/plugins/';
110        @mkdir($dir);
111        $file = fopen( $dir.basename(dirname(__FILE__)).'.dat', 'w' );
112        fwrite($file, serialize($charlie));
113        fclose( $file );
114
115  /* Note: Uppercase extensions are not requested */
116  /**
117   * That means you must have a tpl file for each... player
118   * like for Flash => ./plugings/charlies_content/flash_content.tpl
119   *
120   * Player name is in lower-case followed by _content.tpl
121   */
122
123$all = array();
124foreach ($charlie as $ext) { 
125  if ( is_array($ext) ) { $all = array_merge ($all, $ext); }
126}
127$conf['file_ext'] = array_merge (
128    $conf['file_ext'], $all, array_map('strtoupper', $all) );
129
130# $charlie['all'] = $all;
131add_event_handler('render_element_content', 'render_Charlie_element_content', 40, 2 );
132add_event_handler('get_admin_plugin_menu_links', 'Charlie_plugin_admin_menu');
133
134function Charlie_plugin_admin_menu($menu)
135{
136        array_push($menu, array(
137                                'NAME' => 'Charlies\'', 
138                                'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/charlies_config.php'), 
139                        ));
140        return $menu;
141} 
142
143/**
144 * Only if picture.php is active
145 */
146function render_Charlie_element_content($content, $picture)
147{
148  global $template, $charlie, $page, $conf;
149  if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
150  if ( @$picture['is_picture'] ) return $content;
151  $all = array();
152  foreach ($charlie as $ext) { 
153        if (is_array($ext)) $all = array_merge ($all, $ext); 
154  }
155  $extension = strtolower(get_extension($picture['file']));
156  if (!in_array($extension, $all))
157  { // in fact nothing to do (Lucky Charlies)
158    return $content; }
159  include_once(CHARLIES_PATH.'charlies.inc.php');
160  return Charlies_content($picture);
161}
162?>
Note: See TracBrowser for help on using the repository browser.