Changeset 415 for media-filter/trunk/media-filter.php
- Timestamp:
- 08/20/08 05:45:56 (5 months ago)
- Files:
-
- 1 modified
-
media-filter/trunk/media-filter.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
media-filter/trunk/media-filter.php
r94 r415 4 4 Plugin URI: http://082net.com/tag/media-filter 5 5 Description: 글 작성시 동영상 삽입을 쉽게 할 수있도록 도와주는 플러그인 입니다. GoogleVideo, YouTube, Mncast, Daum(tvpot) 등의 FLV 동영상을 지원하며, 일반적인 동영상(wmv, mov, swf 등)의 삽입도 지원합니다. 이 플러그인은 <a href="http://www.coolcode.cn/?p=100">coolplayer</a> v3.5 에 기반을 두고 있습니다. 자세한 사용법은 플러그인페이지를 참고하세요. 6 Version: 0. 26 Version: 0.3 7 7 Author: Cheon, Yong-Min 8 8 Author URI: http://082net.com/ … … 20 20 // START Options 21 21 22 var $version = '0.3'; 23 var $base, $baseurl; 22 24 var $width = 320; // 플레이어 너비 기본값 23 25 var $height = 280; // 플레이어 높이 기본값 … … 26 28 27 29 // END Options 28 var $preset = array('d1', 'd2', 'd3', 'd4', 'gv', 'yt', 'yt2', 'mnc' );30 var $preset = array('d1', 'd2', 'd3', 'd4', 'gv', 'yt', 'yt2', 'mnc', 'tagstory',); 29 31 var $pre_url = array( 30 32 'd1' => 'http://controller.tvpot.media.daum.net/mflvPlayer.swf?vid=', … … 35 37 'yt' => 'http://www.youtube.com/v/', 36 38 'yt2' => 'http://www.youtube.com/?v=', 37 'mnc' =>'http://dory.mncast.com/mncHMovie.swf?movieID=' 39 'mnc' =>'http://dory.mncast.com/mncHMovie.swf?movieID=', 40 'tagstory' => 'http://play.tagstory.com/player/TS00@', 38 41 ); 39 42 … … 41 44 // change below line for default media URL (No trailing slash) 42 45 $this->base = get_option('siteurl') . "/wp-content/uploads/media"; 43 44 add_filter('the_content', array(&$this, '_filter'), 0); 45 add_filter('the_excerpt', array(&$this, '_filter'), 0); 46 $this->baseurl = get_option('siteurl') . '/wp-content/plugins/'.dirname(plugin_basename(__FILE__)); 47 $this->preset = array_keys($this->pre_url); 46 48 } 47 49 48 50 function _filter($content) { 49 51 if($this->use_html_tag) 50 $content = preg_replace('# <act(.*?)>(.*?)</act>#sie', '$this->get_script(\'$2\', \'$1\');', $content);51 $content = preg_replace('# \[act(.*?)\](.*?)\[/act\]#sie', '$this->get_script(\'$2\', \'$1\');', $content);52 $content = preg_replace('#(<p>)?\s*<act(.*?)>(.*?)</act>\s*(</p>)#sie', '$this->get_script(\'$3\', \'$2\');', $content); 53 $content = preg_replace('#(<p>)?\s*\[act(.*?)\](.*?)\[/act\]\s*(</p>)#sie', '$this->get_script(\'$3\', \'$2\');', $content); 52 54 return $content; 53 55 } … … 65 67 $type = ''; 66 68 $wh = false; 67 $result = "<p class=\"mediafilter\">"; 69 $myid = 'wpmf_'.rand(); 70 $result = "<p class=\"mediafilter\" id=\"{$myid}\">"; 68 71 if(preg_match('/type="([^"]*)"/i', $options, $match)) { 69 72 $type = trim($match[1]); … … 106 109 } else { $autostart = $this->autostart; } 107 110 } 108 $result .= $this->_replace_movie($ type, $url, $width, $height, $autostart);111 $result .= $this->_replace_movie($myid, $type, $url, $width, $height, $autostart); 109 112 $result .= "</p>"; 110 113 return $result; 111 114 } 112 115 113 function _replace_movie($type, $url, $width='', $height='', $autostart='') { 116 function _js() { 117 wp_enqueue_script('media-filter', $this->baseurl.'/media-filter.js', false, $this->version); 118 } 119 120 function _replace_movie($myid, $type, $url, $width='', $height='', $autostart=0) { 121 $result = "<script type=\"text/javascript\"><!--\n"; 122 $result .= "\tvar _{$myid} = media_filter_js(\"$myid\", \"$type\", \"$url\", \"$width\", \"$height\", \"$autostart\");\n"; 123 $result .= "--></script>"; 124 $result .= 'Hello, maybe you have JavaScript turned off'; 125 return $result; 126 } 127 128 // deprecated 129 function __replace_movie($myid, $type, $url, $width='', $height='', $autostart='') { 114 130 $result = ''; 115 131 switch($type) { … … 174 190 } 175 191 192 function options() { 193 if(isset($_POST['mediafilter_options'])) { 194 195 } 196 ?> 197 198 <?php 199 } 200 201 function option_page() { 202 203 } 204 176 205 function &get_instance() { 177 206 static $instance = array(); … … 184 213 185 214 $wpMediaFilter =& WpMediaFilter::get_instance(); 215 216 add_filter('the_content', array(&$wpMediaFilter, '_filter'), 30); 217 add_filter('the_excerpt', array(&$wpMediaFilter, '_filter'), 30); 218 add_action('wp_head', array(&$wpMediaFilter, '_js'), 1); 186 219 ?>
