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

Last change on this file since 31963 was 31305, checked in by jdd, 9 years ago

uvelle version beta3 au 20150907

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