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