'imeem', 'name' => t('IMEEM'), 'url' => EMVIDEO_IMEEM_MAIN_URL, 'settings_description' => t('These settings specifically affect videos displayed from IMEEM. You can learn more about its API here.', array('@imeem' => EMVIDEO_IMEEM_MAIN_URL, '@api' => EMVIDEO_IMEEM_API_INFO)), 'supported_features' => $features, ); } function emvideo_imeem_settings() { $form['imeem']['api'] = array( '#type' => 'fieldset', '#title' => t('IMEEM API'), '#description' => t('If you wish to be able to display IMEEM thumbnails automatically, you will first need to apply for an API Developer Key from the IMEEM Developer Profile page. Note that you do not need this key to display IMEEM videos themselves.', array('@imeem' => EMVIDEO_IMEEM_API_APPLICATION_URL)), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['imeem']['api']['emvideo_imeem_api_key'] = array( '#type' => 'textfield', '#title' => t('IMEEM API Key'), '#default_value' => variable_get('emvideo_imeem_api_key', ''), '#description' => t('Please enter your IMEEM Developer Key here.'), ); $form['imeem']['api']['emvideo_imeem_api_secret'] = array( '#type' => 'textfield', '#title' => t('IMEEM API Secret'), '#default_value' => variable_get('emvideo_imeem_api_secret', ''), '#description' => t('If you have a secret for the IMEEM API, enter it here.'), ); return $form; } function emvideo_imeem_request($embed, $cacheable = TRUE) { $args = array('docid' => $embed); return module_invoke('emfield', 'request_xml', 'imeem', EMVIDEO_IMEEM_XML . $embed .'&version=1.0', $args, $cacheable); } function emvideo_imeem_extract($embed = '') { return array( '@http://media\.imeem\.com/[a-z]{1,2}/([^"\?/]+)/@i', ); } function emvideo_imeem_embedded_link($video_code) { return 'http://www.imeem.com/v/'. $video_code; } function theme_emvideo_imeem_flash($embed, $width, $height, $autoplay) { $autoplay = $autoplay ? '/aus=true' : '/aus=false'; $colors = 'backColor=666666&primaryColor=cccccc&secondaryColor=333333&linkColor=cccccc'; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; return $output; } function emvideo_imeem_thumbnail($field, $item, $formatter, $node, $width, $height) { $xml = emvideo_imeem_request($item['value']); $tmpthm = $xml['ITEM']['ICONURL'][0]; $imgmax = $xml['ITEM']['DURATION'][0]; $formatnum = str_pad(rand(0, $imgmax) .'.jpg', 9, "0", STR_PAD_LEFT);; $thm = str_replace('00010.jpg', $formatnum, $tmpthm); return $thm; } function emvideo_imeem_video($embed, $width, $height, $field, $item, $node, $autoplay) { $output = theme('emvideo_imeem_flash', $embed, $width, $height, $autoplay); return $output; } function emvideo_imeem_preview($embed, $width, $height, $field, $item, $node, $autoplay) { $output = theme('emvideo_imeem_flash', $embed, $width, $height, $autoplay); return $output; } function emvideo_imeem_emfield_subtheme() { return array( 'emvideo_imeem_flash' => array( 'arguments' => array('embed' => NULL, 'width' => NULL, 'height' => NULL, 'autoplay' => NULL), 'file' => 'providers/imeem.inc' ) ); }