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

Last change on this file since 29142 was 29056, checked in by jdd, 10 years ago

Chage plugin name in main.inc (to allow beta and stable together)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 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'                      => 1,
46                        'autoplay'                      => 1,
47                        'loop'                                  => 1,
48                        'full'                                  => 1,
49                        'forced_width'                  => '',
50                        'forced_height'                 => '',
51                        'video_default_width'   =>  320,
52                        'video_default_height'  =>  240,
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'                                => 8,
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                        'color0'                                => '#111111',
87                        'color1'                                => '#ff7700',
88                        'color2'                                => '#444444',
89                        'color3'                                => '#ff3333',
90                        'color4'                                => '#ff3363',
91                        'color5'                                => '#ff7700',
92                        'color6'                                => '#111111',
93                        'color7'                                => '#ff3333',
94                        'color8'                                => '#ff3363',
95                        'color9'                                => '#111111',
96                        'color10'                               => '#444444',
97                        'color11'                               => '#ff3333',
98                        'color12'                               => '#ff3363',
99                        'color13'                               => '#ff7700',
100                        'color14'                               => '#444444',
101                        'color15'                               => '#ff3333',
102                        'color16'                               => '#111111',
103                );
104        if (!isset($charlie['version'])) $charlie = $default;
105        else $charlie = array_merge( $default, $charlie );
106        if (!isset($charlie['FlvStreamer']))    $charlie['FlvStreamer'] = array('flv',); 
107        if (!isset($charlie['Flash']))                  $charlie['Flash'] = array('swf',); 
108        if (!isset($charlie['Music']))                  $charlie['Music'] = array('pls','m3u','wav','mid','au','aif',); 
109        if (!isset($charlie['mp3Player']))              $charlie['mp3Player'] = array('mp3',); 
110        if (!isset($charlie['Acrobat']))                $charlie['Acrobat'] = array('pdf',); 
111        if (!isset($charlie['WMplayer']))               $charlie['WMplayer'] = array('asf','wmv','divx','xvid',); 
112        if (!isset($charlie['QuickTime']))              $charlie['QuickTime'] = 
113        array('aiff','aac','bmp','gsm','mov','mpg','mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif','tiff','3g2','3pg','3gp');
114        if (!isset($charlie['Archive']))                $charlie['Archive'] = array('zip','rar',); 
115        if (!isset($charlie['GPS']))                    $charlie['GPS'] = array('gpx',); 
116        $charlie['version'] = CHARLIES_VER;
117
118        $dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'/plugins/';
119        @mkdir($dir);
120        $file = fopen( $dir.basename(dirname(__FILE__)).'.dat', 'w' );
121        fwrite($file, serialize($charlie));
122        fclose( $file );
123}
124  /* Note: Uppercase extensions are not requested */
125  /**
126   * That means you must have a tpl file for each... player
127   * like for Flash => ./plugings/charlies_content/flash_content.tpl
128   *
129   * Player name is in lower-case followed by _content.tpl (non)
130   */
131
132$all = array();
133foreach ($charlie as $ext) { 
134  if ( is_array($ext) ) { $all = array_merge ($all, $ext); }
135}
136$conf['file_ext'] = array_merge (
137    $conf['file_ext'], $all, array_map('strtoupper', $all) );
138
139# $charlie['all'] = $all;
140add_event_handler('render_element_content', 'render_Charlie_element_content', 40, 2 );
141add_event_handler('get_admin_plugin_menu_links', 'Charlie_plugin_admin_menu');
142
143function Charlie_plugin_admin_menu($menu)
144{
145        array_push($menu, array(
146                                'NAME' => 'Charlies\'', 
147                                'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/charlies_config.php'), 
148                        ));
149        return $menu;
150} 
151
152/**
153 * Only if picture.php is active
154 */
155function render_Charlie_element_content($content, $picture)
156{
157  global $template, $charlie, $page, $conf;
158  if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
159  if ( @$picture['is_picture'] ) return $content;
160  $all = array();
161  foreach ($charlie as $ext) { 
162        if (is_array($ext)) $all = array_merge ($all, $ext); 
163  }
164  $extension = strtolower(get_extension($picture['file']));
165  if (!in_array($extension, $all))
166  { // in fact nothing to do (Lucky Charlies)
167    return $content; }
168  include_once(CHARLIES_PATH.'charlies.inc.php');
169  return Charlies_content($picture);
170}
171?>
Note: See TracBrowser for help on using the repository browser.