Changeset 141675
- Timestamp:
- 08/01/2009 07:24:25 AM (16 years ago)
- Location:
- wp-media-player/trunk
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-media-player/trunk/scripts/startplayer.js.dev.js
r141546 r141675 27 27 null, $get(this._hostname) ); 28 28 29 this.post_id = 0;30 31 29 this._playlist = this.getPlaylist(); 32 30 this._player.set_mediainfo( this._playlist[0] ); … … 34 32 35 33 _onMediaOpened: function(sender, eventArgs){ 36 this._sendMediaStatus(0); 37 //window.status = "Media Opened!"; 34 this._logMediaStatus(1); 38 35 }, 39 36 40 37 _onMediaEnded: function(sender, eventArgs) { 41 this._sendMediaStatus(1); 42 //window.status = "Media Ended!"; 38 this._logMediaStatus(2); 43 39 }, 44 40 … … 47 43 }, 48 44 49 _sendMediaStatus: function(status){ 50 //jQuery.ajax({type: 'GET', url: 'http://wordpress/wordpress/wp-content/plugins/wp-media-player/wp-media-player.php', data: 'pid=' + this.post_id + '&status=' + status, cache: false}); 45 _getDocument: function(full_path) { 46 var end = (full_path.indexOf("?") == -1) ? full_path.length : full_path.indexOf("?"); 47 return full_path.substring(full_path.lastIndexOf("/")+1, end); 48 }, 49 50 _logMediaStatus: function(status){ 51 jQuery.ajax({type: 'GET', url: this.ajaxUrl, data: 'pid=' + this.postId + '&stat=' + status + '&file=' + this._getDocument(this._playlist[0].mediaSource), cache: false}); 51 52 } 52 53 } … … 55 56 new StartMediaPlayer(parentId); 56 57 } 58 59 // strings used in scripts 60 61 Sys.UI.Silverlight.ControlRes={ 62 'runtimeErrorWithoutPosition': "Runtime error {2} in control '{0}', method {6}: {3}", 63 'scaleModeRequiresMatrixTransform': "When ScaleMode is set to zoom or stretch, the root Canvas must have not have a RenderTransform applied, or must only have a ScaleTransform.", 64 'mediaError_NotFound': "Media '{3}' in control '{0}' could not be found.", 65 'runtimeErrorWithPosition': "Runtime error {2} in control '{0}', method {6} (line {4}, col {5}): {3}", 66 'silverlightVersionFormat': "Must be in the format 'MajorVersion.MinorVersion'.", 67 'otherError': "{1} error #{2} in control '{0}': {3}", 68 'cannotChangeSource': "You cannot change the XAML source after initialization.", 69 'parserError': "Invalid XAML for control '{0}'. [{7}] (line {4}, col {5}): {3}", 70 'sourceAlreadySet': "You cannot change the XAML source after initialization.", 71 'parentNotFound' : "{1} error #{2} in control '{0}': {3}" 72 }; 73 74 Sys.UI.Silverlight.MediaRes={ 75 'volumeRange': "Volume must be a number greater than or equal to 0 and less than or equal to 1.", 76 'mediaFailed': "Unable to load media '{0}'. This may be because there is no such file at this location or the video file is encoded incorrectly.", 77 'noMediaElement': "The XAML document does not contain a media element.", 78 'noThumbElement': "{1} error #{2} in control '{0}': {3}", 79 'invalidChapter': "Must be greater than or equal to 0 and less than the length of the chapter's array.", 80 'silverlightNotLoaded': "{1} error #{2} in control '{0}': {3}" 81 }; -
wp-media-player/trunk/wp-media-player.php
r141511 r141675 76 76 var $post_needs_meta = false; 77 77 var $content_save_pre_count = 0; 78 var $playerlogs; 78 79 79 80 function wp_media_player() 80 81 { 81 register_activation_hook(__FILE__, array(&$this, 'store_options')); 82 global $wpdb; 83 $this-> playerlogs = $wpdb->prefix.'media_player_logs'; 84 register_activation_hook(__FILE__, array(&$this, 'create_playerlogs_table')); 82 85 83 86 add_action( 'init', array(&$this, 'initialize'), 12 ); … … 117 120 load_plugin_textdomain('wp-media-player', '/wp-content/plugins/wp-media-player/languages'); 118 121 } 119 120 function store_options() 121 { 122 /** 123 * Creates the database table for storing video views data. 124 * Also adds plugin options 125 * 126 * @return 127 */ 128 function create_playerlogs_table() 129 { 130 global $wpdb; 131 132 if( @is_file(ABSPATH.'/wp-admin/includes/upgrade.php') ) { 133 include_once(ABSPATH.'/wp-admin/includes/upgrade.php'); 134 } 135 elseif( @is_file(ABSPATH.'/wp-admin/upgrade-functions.php') ) { 136 include_once(ABSPATH.'/wp-admin/upgrade-functions.php'); 137 } 138 else { 139 die('We have problem finding your \'/wp-admin/upgrade.php\''); 140 } 141 142 $charset_collate = ''; 143 if( $wpdb->supports_collation() ) { 144 if( !empty($wpdb->charset) ) { 145 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 146 } 147 if( !empty($wpdb->collate) ) { 148 $charset_collate .= " COLLATE $wpdb->collate"; 149 } 150 } 151 152 $create_playerlogs_sql = "CREATE TABLE ".$this->playerlogs." (". 153 "play_id INT(11) NOT NULL auto_increment,". 154 "play_postid INT(11) NOT NULL ,". 155 "play_posttitle TEXT NOT NULL,". 156 "play_videofile TEXT NOT NULL,". 157 "play_opened INT(11) NOT NULL ,". 158 "play_ended INT(11) NOT NULL ,". 159 "PRIMARY KEY (play_id)) $charset_collate;"; 160 161 maybe_create_table($this->playerlogs, $create_playerlogs_sql); 162 122 163 add_option('wp_media_player_autoLoad', '0'); 123 164 add_option('wp_media_player_autoPlay', '0'); … … 129 170 add_option('wp_media_player_show_on_home_page', 0); 130 171 } 131 132 172 /** 133 173 * Create a 2D array from a CSV string … … 418 458 $scriptcode .= "player_".$post_id."_$i.mutedParam=".($tmp == '1'?'true':'false').";\n"; 419 459 460 $scriptcode .= "player_".$post_id."_$i.postId=".$post_id.";\n"; 461 $scriptcode .= "player_".$post_id."_$i.ajaxUrl='".$this -> pluginurl."wp-media-player.php';\n"; 462 420 463 $scriptcode .= "player_".$post_id."_$i.getPlaylist=getCustomPlaylist_".$post_id."_$i;\n"; 421 464 $scriptcode .= "-->\n"; … … 435 478 { 436 479 // This is a workaround for the weird behavior in content_save_pre. 437 // The filter is called multiple tims and the second time it contains the previo s480 // The filter is called multiple tims and the second time it contains the previous 438 481 // revision, which screws up the meta logic. 439 482 if ( $this -> content_save_pre_count > 0){ … … 478 521 { 479 522 if ($this -> show_player_check() == true) 480 { 523 { 524 global $post; 525 481 526 wp_enqueue_script('jquery'); 482 527 wp_enqueue_script('microsoftajax', $this -> pluginurl.'scripts/microsoftajax.js'); … … 485 530 wp_enqueue_script('silverlightmedia', $this -> pluginurl.'scripts/silverlightmedia.js'); 486 531 wp_enqueue_script('expressionplayer', $this -> pluginurl.'scripts/expressionplayer.js'); 487 wp_enqueue_script('playerstrings', $this -> pluginurl.'scripts/playerstrings.js');488 532 wp_enqueue_script('player', $this -> pluginurl.'styles/'.strtolower($this -> player_styles[$this -> plugin_parameters['style']]).'/player.js'); 489 wp_enqueue_script('startmediaplayer', $this -> pluginurl.'scripts/startplayer.js.dev.js', array('jquery')); 533 wp_enqueue_script('startmediaplayer', $this -> pluginurl.'scripts/startplayer.js.dev.js', array('jquery')); 490 534 } 491 535 } … … 631 675 } 632 676 633 function process_status_ajax() 634 { 635 if ( isset($_GET['pid']) && isset($_GET['status']) ){ 636 /* 637 $fp = fopen('C:\inetpub\wwwroot\wordpress\wp-content\data.txt', 'a'); 638 fwrite($fp, 'success for post '.$_GET['pid'].' at '.date('l jS \of F Y h:i:s A'."\n")); 639 fclose($fp); 640 */ 641 } 677 function process_ajax_log_request() 678 { 679 // if ( isset($_GET['pid']) && isset($_GET['stat']) && isset($_GET['file']) ){ 680 // $post_id = intval($_GET['pid']); 681 // $status = intval($_GET['stat']); 682 // // Check Whether Is A Valid Post 683 // $post = get_post($post_id); 684 // if ( $post ){ 685 // $post_title = addslashes($post->post_title); 686 // } 687 688 // REMOVE THIS 689 // $fp = fopen('C:\inetpub\wwwroot\wordpress\wp-content\data.txt', 'a'); 690 // fwrite($fp, 'video file '.$_GET['file'].': status '.$_GET['stat'].' for post '.$_GET['pid'].' at '.date('l jS \of F Y h:i:s A'."\n")); 691 // fclose($fp); 692 // } 642 693 } 643 694 } // End Class wp_media_player … … 650 701 $mp_plugin = new wp_media_player(); 651 702 652 $mp_plugin -> process_ status_ajax();703 $mp_plugin -> process_ajax_log_request(); 653 704 } 654 705
Note: See TracChangeset
for help on using the changeset viewer.