Changeset 4042
- Timestamp:
- 07/25/2006 07:01:52 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r4041 r4042 13 13 function get_out_now() { exit; } 14 14 add_action( 'shutdown', 'get_out_now', -1 ); 15 16 function wp_clean_ajax_input( $i ) {17 global $wpdb;18 $i = is_array($i) ? array_map('wp_clean_ajax_input', $i) : $wpdb->escape( rawurldecode(stripslashes($i)) );19 return $i;20 }21 15 22 16 function wp_ajax_echo_meta( $pid, $mid, $key, $value ) { … … 36 30 } 37 31 38 $_POST = wp_clean_ajax_input( $_POST );39 32 $id = (int) $_POST['id']; 40 33 switch ( $_POST['action'] ) : … … 225 218 break; 226 219 default : 220 do_action( 'wp_ajax_' . $_POST['action'] ); 227 221 die('0'); 228 222 break; -
trunk/wp-admin/list-manipulation-js.php
r3847 r4042 2 2 require_once('admin.php'); 3 3 header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true); 4 $handler = get_settings( 'siteurl' ) . '/wp-admin/admin-ajax.php'; 4 5 ?> 5 6 addLoadEvent(function(){theList=new listMan();}); … … 28 29 WPAjax.prototype.init=function(f,r){ 29 30 this.encVar('cookie', document.cookie); 30 this.requestFile=f ;this.getResponseElement(r);this.method='POST';31 this.requestFile=f?f:'<?php echo $handler; ?>';this.getResponseElement(r);this.method='POST'; 31 32 this.onLoading=function(){this.myResponseElement.innerHTML="<?php _e('Sending Data...'); ?>";}; 32 33 this.onLoaded=function(){this.myResponseElement.innerHTML="<?php _e('Data Sent...'); ?>";}; … … 35 36 36 37 function listMan(theListId){ 37 this.theList=null; 38 this.ajaxRespEl=null; 38 this.theList=null;this.theListId=theListId; 39 this.ajaxRespEl=null;this.ajaxHandler='<?php echo $handler; ?>'; 39 40 this.inputData='';this.clearInputs=new Array();this.showLink=1; 40 41 this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1'; … … 45 46 this.ajaxAdder=function(what,where,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it 46 47 if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300); 47 this.ajaxAdd=new WPAjax( 'admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');48 this.ajaxAdd=new WPAjax(this.ajaxHandler,this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); 48 49 if(this.ajaxAdd.failed)return true; 49 50 this.grabInputs(where); … … 54 55 if(tempObj.topAdder)tempObj.recolorPos=0; 55 56 if(newItems){for (c=0;c<newItems.length;c++){ 56 var id= parseInt(getNodeValue(newItems[c],'id'),10);57 var id=getNodeValue(newItems[c],'id'); 57 58 var exists=document.getElementById(what+'-'+id); 58 59 if(exists)tempObj.replaceListItem(exists.id,getNodeValue(newItems[c],'newitem'),newItems.length,update); … … 72 73 this.ajaxDelete=function(what,id){ 73 74 if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300); 74 this.ajaxDel=new WPAjax( 'admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');75 this.ajaxDel=new WPAjax(this.ajaxHandler,this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); 75 76 if(this.ajaxDel.failed)return true; 76 77 var tempObj=this; … … 81 82 this.ajaxDimmer=function(what,id,dimClass){ 82 83 if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300); 83 this.ajaxDim=new WPAjax( 'admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');84 this.ajaxDim=new WPAjax(this.ajaxHandler,this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); 84 85 if(this.ajaxDim.failed)return true; 85 86 var tempObj=this; … … 138 139 if(this.theList)return; 139 140 listItems=new Array(); 140 if(th eListId){this.theList=document.getElementById(theListId);if(!this.theList)return false;}141 else{this.theList=document.getElementById('the-list');if(this.theList)th eListId='the-list';}141 if(this.theListId){this.theList=document.getElementById(this.theListId);if(!this.theList)return false;} 142 else{this.theList=document.getElementById('the-list');if(this.theList)this.theListId='the-list';} 142 143 if(this.theList){ 143 144 var items=this.theList.getElementsByTagName('tr');listType='table'; … … 156 157 this.getListItems(); 157 158 } 158 //No submit unless eval(code) returns true. 159 function killSubmit(code,e){if(!e){if(window.event)e=window.event;else return;}var t=e.target?e.target:e.srcElement;if(('text'==t.type&&e.keyCode==13)||('submit'==t.type&&'click'==e.type)){if(!eval(code)){e.returnValue=false;e.cancelBubble=true;return false;}}} 160 //Pretty func from ALA http://www.alistapart.com/articles/gettingstartedwithajax 161 function getNodeValue(tree,el){return tree.getElementsByTagName(el)[0].firstChild.nodeValue;} 159 //No submit unless code returns true. 160 function killSubmit ( code, e ) { 161 e = e ? e : window.event; 162 if ( !e ) return; 163 var t = e.target ? e.target : e.srcElement; 164 if ( ( 'text' == t.type && e.keyCode == 13 ) || ( 'submit' == t.type && 'click' == e.type ) ) { 165 if ( ( 'string' == typeof code && !eval(code) ) || 'function' == typeof code && !code() ) { 166 if ( !eval(code) ) { e.returnValue = false; e.cancelBubble = true; return false; } 167 } 168 } 169 } 170 //Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax 171 function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; } 162 172 //Generic but lame JS closure 163 173 function encloseFunc(f){var a=arguments[1];return function(){return f(a);}} -
trunk/wp-includes/script-loader.php
r3930 r4042 20 20 if ( is_admin() ) { 21 21 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 22 $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), ' 3850' ); // Make changeset # the correct one22 $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '4042' ); // Make changeset # the correct one 23 23 $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '3684' ); 24 24 $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' );
Note: See TracChangeset
for help on using the changeset viewer.