Ticket #12400: 12400.2.diff
File 12400.2.diff, 2.7 KB (added by , 15 years ago) |
---|
-
wp-includes/link-template.php
2015 2015 echo "<link rel='canonical' href='$link' />\n"; 2016 2016 } 2017 2017 2018 ?> 2018 /** 2019 * Prints the ajax url on the front end 2020 * 2021 * @since 3.0 2022 **/ 2023 function _wp_ajaxurl() { 2024 echo '<script type="text/javascript">', 2025 "var ajaxurl = '", site_url('wp-ajax.php'), "';", 2026 '</script>'; 2027 } 2028 2029 /** 2030 * Hooks _wp_ajaxurl() to wp_head 2031 * 2032 * @since 3.0 2033 **/ 2034 2035 function wp_ajaxurl() { 2036 add_action('wp_head', '_wp_ajaxurl', 1); 2037 } 2038 ?> 2039 No newline at end of file -
wp-ajax.php
1 <?php 2 /** 3 * Execute an AJAX action. 4 * 5 * To take full advantage of this file, call wp_ajaxurl(); in your theme 6 * or plugin while registering your front-end scripts. Doing so will make 7 * an ajaxurl variable available for use in javascripts. The ajaxurl 8 * variable will point to this file's absolute URL. 9 * 10 * In the admin area, an ajaxurl variable is always available, and points 11 * to wp-admin/admin-ajax.php instead - with slightly different hooks. 12 * 13 * @since 3.0 14 */ 15 define('DOING_AJAX', true); 16 require_once('wp-load.php'); 17 18 @header('Content-Type: text/html; charset=' . get_option('blog_charset')); 19 20 do_action('ajax_init'); 21 22 $action = !empty($_REQUEST['action']) ? stripslashes($_REQUEST['action']) : false; 23 24 if ( !$action || ! has_action('ajax_' . $action) ) { 25 status_header(400); // invalid request 26 exit; 27 } 28 29 do_action('ajax_' . $action); 30 ?> 31 No newline at end of file -
wp-admin/admin-ajax.php
Property changes on: wp-ajax.php ___________________________________________________________________ Added: svn:eol-style + native
43 43 } 44 44 45 45 if ( !empty( $_REQUEST['action'] ) ) 46 do_action( 'wp_ajax_nopriv_' . $_REQUEST['action']);46 do_action( 'wp_ajax_nopriv_' . stripslashes($_REQUEST['action']) ); 47 47 48 48 die('-1'); 49 49 } … … 136 136 die( $return ); 137 137 break; 138 138 default : 139 do_action( 'wp_ajax_' . $_GET['action'] ); 139 if ( !empty($_GET['action']) ) 140 do_action( 'wp_ajax_' . stripslashes($_GET['action']) ); 140 141 die('0'); 141 142 break; 142 143 endswitch; … … 1414 1415 } 1415 1416 die( '0' ); 1416 1417 default : 1417 do_action( 'wp_ajax_' . $_POST['action'] ); 1418 if ( !empty($_POST['action']) ) 1419 do_action( 'wp_ajax_' . stripslashes($_POST['action']) ); 1418 1420 die('0'); 1419 1421 break; 1420 1422 endswitch;