| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @file 4 * Provides the administration settings for the Video Drupal module. 5 */ 6 video_add_adminjs(); 7 8 /** 9 * Video transcoder admin settings 10 * @return <type> 11 */ 12 function video_transcoder_admin_settings() { 13 module_load_include('inc', 'video', '/includes/transcoder'); 14 $transcoder = new video_transcoder; 15 $form = $transcoder->admin_settings(); 16 return system_settings_form($form); 17 } 18 19 /** 20 * Form API callback to validate the upload settings form. 21 */ 22 function video_transcoder_admin_settings_validate($form, &$form_state) { 23 // add validations by transcoder interface 24 $transcoder = $form_state['values']['vid_convertor']; 25 module_load_include('inc', 'video', '/includes/transcoder'); 26 $transcoder = new video_transcoder($transcoder); 27 $transcoder->admin_settings_validate($form, $form_state); 28 } 29 30 /** 31 * Video transcoder admin settings 32 * @return <type> 33 */ 34 function video_preset_admin_settings() { 35 module_load_include('inc', 'video', '/includes/preset'); 36 $preset = new video_preset(); 37 $form = $preset->admin_settings(); 38 return system_settings_form($form); 39 } 40 41 /** 42 * Video general admin settings 43 * @return <type> 44 */ 45 function video_general_admin_settings() { 46 $form = array(); 47 $form['video_autoplay'] = array( 48 '#type' => 'checkbox', 49 '#title' => t('Automatically start video on page load'), 50 '#default_value' => variable_get('video_autoplay', FALSE), 51 '#description' => t('Start the video when the page and video loads') 52 ); 53 $form['video_autobuffering'] = array( 54 '#type' => 'checkbox', 55 '#title' => t('Automatically start video buffering'), 56 '#default_value' => variable_get('video_autobuffering', TRUE), 57 '#description' => t('Start buffering video when the page and video loads') 58 ); 59 $form['video_bypass_conversion'] = array( 60 '#type' => 'checkbox', 61 '#title' => t('Bypass auto conversion by default'), 62 '#default_value' => variable_get('video_bypass_conversion', FALSE), 63 '#description' => t('Bypass video conversion when creating videos. This setting can be overriden by users with the %perm permission.', array('%checkbox' => t('Bypass auto conversion'), '%perm' => t('bypass conversion video'))) 64 ); 65 $form['video_convert_on_save'] = array( 66 '#type' => 'checkbox', 67 '#title' => t('Video Convert on Node Submit'), 68 '#default_value' => variable_get('video_convert_on_save', FALSE), 69 '#description' => t('Convert videos on node submit.') 70 ); 71 $form['video_use_default_thumb'] = array( 72 '#type' => 'checkbox', 73 '#title' => t('Override Auto Thumbnails with Default'), 74 '#default_value' => variable_get('video_use_default_thumb', FALSE), 75 '#description' => t('Override auto thumbnails with default thumbnail.') 76 ); 77 return system_settings_form($form); 78 } 79 80 /** 81 * Video player admin settings 82 * @return <type> 83 */ 84 function video_players_admin_settings($form_state) { 85 // Check for SWF Tools and Amazon S3 Private URLs 86 if (module_exists('video_s3') && module_exists('swftools') && variable_get('vid_filesystem', NULL) == 'video_s3' && variable_get('amazon_s3_private', FALSE)) { 87 drupal_set_message(t('Using the Flowplayer FLV player via SWF Tools does not work when the S3 %setting-name setting is turned on. Install and enable the <a href="@flowplayer-api-url">Flowplayer API</a> module to use Flowplayer.', array('%setting-name' => t('Enable private file storage'), '@flowplayer-api-url' => 'http://drupal.org/project/flowplayer')), 'warning'); 88 } 89 90 $form = array(); 91 $form['extensions'] = array( 92 '#type' => 'fieldset', 93 '#title' => t('Video Extensions'), 94 '#description' => t('Here you can map specific players to each video extension type.'), 95 ); 96 //lets get all our supported extensions and players. 97 $extensions = video_video_extensions(); 98 $players = video_video_players(); 99 $flv_players = video_video_flv_players(); 100 $html5_players = video_video_html5_players(); 101 102 foreach ($extensions as $ext => $player) { 103 $form['extensions']['video_extension_' . $ext] = array( 104 '#type' => 'select', 105 '#title' => t('Extension:') . ' ' . $ext, 106 '#default_value' => variable_get('video_extension_' . $ext, $player), 107 '#options' => $players, 108 '#prefix' => '<div class="video_select" rel="' . $ext . '">', 109 '#suffix' => '</div>', 110 ); 111 112 $form['extensions']['video_extension_' . $ext . '_flash_player'] = array( 113 '#type' => !empty($flv_players) ? 'radios' : 'markup', 114 '#title' => t('Flash Player for') . ' ' . $ext, 115 '#value' => !empty($flv_players) ? '' : t('No flash players detected.<br />You need to install !swf_tools or !flowplayer.', array('!swf_tools' => l(t('SWF Tools'), 'http://www.drupal.org/project/swftools'), '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'))), 116 '#options' => $flv_players, 117 '#default_value' => variable_get('video_extension_' . $ext . '_flash_player', ''), 118 '#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">', 119 '#suffix' => '</div>', 120 ); 121 $form['extensions']['video_extension_' . $ext . '_html5_player'] = array( 122 '#type' => !empty($html5_players) ? 'radios' : 'markup', 123 '#title' => t('HTML5 Player for') . ' ' . $ext, 124 '#value' => !empty($html5_players) ? '' : t('No HTML5 players detected.<br />You need to install !videojs.', array('!videojs' => l(t('VideoJS'), 'http://www.drupal.org/project/videojs'), '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'))), 125 '#options' => $html5_players, 126 '#default_value' => variable_get('video_extension_' . $ext . '_html5_player', ''), 127 '#prefix' => '<div class="admin_html5_player_wrapper" id="html5_player_' . $ext . '">', 128 '#suffix' => '</div>', 129 ); 130 } 131 132 $form['extra'] = array( 133 '#type' => 'fieldset', 134 '#title' => t('Player Settings'), 135 ); 136 137 if (isset($flv_players['flowplayer'])) { 138 $form['extra']['video_flowplayer_extraplayerheight'] = array( 139 '#type' => 'textfield', 140 '#title' => t('Flowplayer: add vertical space to accommodate the control bar'), 141 '#field_suffix' => 'pixels', 142 '#default_value' => variable_get('video_flowplayer_extraplayerheight', 24), 143 '#description' => t('The control bar in Flowplayer 3.2 and up uses an overlay on top of the video, so the player size is equal to the video size. For custom control bars or older Flowplayer versions you can use this field to add vertical space to the player height.'), 144 '#size' => 5, 145 '#maxlength' => 3, 146 '#element_validate' => array('_video_validate_number'), 147 ); 148 } 149 150 if (count($form['extra']) == 2) { 151 unset($form['extra']); 152 } 153 154 return system_settings_form($form); 155 } 156 157 function _video_validate_number($element, $form_state) { 158 $key = end($element['#parents']); 159 $val = $form_state['values'][$key]; 160 161 if (!empty($val) && (!preg_match('#^\d+$#', $val) || intval($val) < 0)) { 162 form_error($element, t('You must enter an integer value for field %field.', array('%field' => $element['#title']))); 163 } 164 } 165 166 /** 167 * Video Metadata admin settings 168 * @return <type> 169 */ 170 function video_metadata_admin_settings() { 171 module_load_include('inc', 'video', '/includes/metadata'); 172 $metadata = new video_metadata; 173 $form = $metadata->admin_settings(); 174 return system_settings_form($form); 175 } 176 177 function video_metadata_admin_settings_validate($form, &$form_state) { 178 // add vallidations by metadata interface 179 $metadata = $form_state['values']['vid_metadata']; 180 module_load_include('inc', 'video', '/includes/metadata'); 181 $metadata = new video_metadata($metadata); 182 $metadata->admin_settings_validate($form, $form_state); 183 } 184 185 /** 186 * Video cron admin settings 187 * @return <type> 188 */ 189 function video_cron_admin_settings() { 190 $form = array(); 191 $form['video_cron'] = array( 192 '#type' => 'checkbox', 193 '#title' => t('Use Drupals built in cron.'), 194 '#default_value' => variable_get('video_cron', TRUE), 195 '#description' => t('If you would like to use Drupals built in cron hook, check this box. Please be warned that transcoding videos is very resource intensive. If you use poor mans cron, I highly discourage this option. I also suggest you setup your cron to call this function through CLI instead of WGET.'), 196 ); 197 $form['video_ffmpeg_instances'] = array( 198 '#type' => 'textfield', 199 '#title' => t('Total videos to convert during each cron process.'), 200 '#default_value' => variable_get('video_ffmpeg_instances', 5), 201 '#description' => t('How many videos do you want to process on each cron run? Either through hook_cron or the video_scheduler.php.'), 202 ); 203 return system_settings_form($form); 204 } 205 206 /** 207 * File system admin settings 208 * @return <type> 209 */ 210 function video_filesystem_admin_settings() { 211 module_load_include('inc', 'video', '/includes/filesystem'); 212 $filesystem = new video_filesystem; 213 $form = $filesystem->admin_settings(); 214 return system_settings_form($form); 215 } 216 217 function video_filesystem_admin_settings_validate($form, &$form_state) { 218 // add vallidations by metadata interface 219 $filesystem = $form_state['values']['vid_filesystem']; 220 module_load_include('inc', 'video', '/includes/filesystem'); 221 $filesystem = new video_filesystem($filesystem); 222 $filesystem->admin_settings_validate($form, $form_state); 223 } 224 225 /** 226 * Return our possible flash players. 227 */ 228 function video_video_flv_players() { 229 $options = array(); 230 if (module_exists('swftools')) { 231 $options['swftools'] = t('SWF Tools'); 232 } 233 if (module_exists('flowplayer')) { 234 $options['flowplayer'] = t('Flowplayer'); 235 } 236 return $options; 237 } 238 239 /** 240 * Return our possible html5 players. 241 */ 242 function video_video_html5_players() { 243 $options = array(); 244 if (module_exists('videojs')) { 245 $options['videojs'] = t('Video JS'); 246 } 247 if (module_exists('video')) { 248 $options['video'] = t('Video (Default)'); 249 } 250 return $options; 251 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |