| 1 | Index: wp-includes/link-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/link-template.php (revision 13499) |
|---|
| 4 | +++ wp-includes/link-template.php (working copy) |
|---|
| 5 | @@ -2015,4 +2015,24 @@ |
|---|
| 6 | echo "<link rel='canonical' href='$link' />\n"; |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | -?> |
|---|
| 10 | +/** |
|---|
| 11 | + * Prints the ajax url on the front end |
|---|
| 12 | + * |
|---|
| 13 | + * @since 3.0 |
|---|
| 14 | + **/ |
|---|
| 15 | +function _wp_ajaxurl() { |
|---|
| 16 | + echo '<script type="text/javascript">', |
|---|
| 17 | + "var ajaxurl = '", site_url('wp-ajax.php'), "';", |
|---|
| 18 | + '</script>'; |
|---|
| 19 | +} |
|---|
| 20 | + |
|---|
| 21 | +/** |
|---|
| 22 | + * Hooks _wp_ajaxurl() to wp_head |
|---|
| 23 | + * |
|---|
| 24 | + * @since 3.0 |
|---|
| 25 | + **/ |
|---|
| 26 | + |
|---|
| 27 | +function wp_ajaxurl() { |
|---|
| 28 | + add_action('wp_head', '_wp_ajaxurl', 1); |
|---|
| 29 | +} |
|---|
| 30 | +?> |
|---|
| 31 | \ No newline at end of file |
|---|
| 32 | Index: wp-ajax.php |
|---|
| 33 | =================================================================== |
|---|
| 34 | --- wp-ajax.php (revision 0) |
|---|
| 35 | +++ wp-ajax.php (revision 0) |
|---|
| 36 | @@ -0,0 +1,30 @@ |
|---|
| 37 | +<?php |
|---|
| 38 | +/** |
|---|
| 39 | + * Execute an AJAX action. |
|---|
| 40 | + * |
|---|
| 41 | + * To take full advantage of this file, call wp_ajaxurl(); in your theme |
|---|
| 42 | + * or plugin while registering your front-end scripts. Doing so will make |
|---|
| 43 | + * an ajaxurl variable available for use in javascripts. The ajaxurl |
|---|
| 44 | + * variable will point to this file's absolute URL. |
|---|
| 45 | + * |
|---|
| 46 | + * In the admin area, an ajaxurl variable is always available, and points |
|---|
| 47 | + * to wp-admin/admin-ajax.php instead - with slightly different hooks. |
|---|
| 48 | + * |
|---|
| 49 | + * @since 3.0 |
|---|
| 50 | + */ |
|---|
| 51 | +define('DOING_AJAX', true); |
|---|
| 52 | +require_once('wp-load.php'); |
|---|
| 53 | + |
|---|
| 54 | +@header('Content-Type: text/html; charset=' . get_option('blog_charset')); |
|---|
| 55 | + |
|---|
| 56 | +do_action('ajax_init'); |
|---|
| 57 | + |
|---|
| 58 | +$action = !empty($_REQUEST['action']) ? stripslashes($_REQUEST['action']) : false; |
|---|
| 59 | + |
|---|
| 60 | +if ( !$action || ! has_action('ajax_' . $action) ) { |
|---|
| 61 | + status_header(400); // invalid request |
|---|
| 62 | + exit; |
|---|
| 63 | +} |
|---|
| 64 | + |
|---|
| 65 | +do_action('ajax_' . $action); |
|---|
| 66 | +?> |
|---|
| 67 | \ No newline at end of file |
|---|
| 68 | |
|---|
| 69 | Property changes on: wp-ajax.php |
|---|
| 70 | ___________________________________________________________________ |
|---|
| 71 | Added: svn:eol-style |
|---|
| 72 | + native |
|---|
| 73 | |
|---|
| 74 | Index: wp-admin/admin-ajax.php |
|---|
| 75 | =================================================================== |
|---|
| 76 | --- wp-admin/admin-ajax.php (revision 13499) |
|---|
| 77 | +++ wp-admin/admin-ajax.php (working copy) |
|---|
| 78 | @@ -43,7 +43,7 @@ |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | if ( !empty( $_REQUEST['action'] ) ) |
|---|
| 82 | - do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); |
|---|
| 83 | + do_action( 'wp_ajax_nopriv_' . stripslashes($_REQUEST['action']) ); |
|---|
| 84 | |
|---|
| 85 | die('-1'); |
|---|
| 86 | } |
|---|
| 87 | @@ -136,7 +136,8 @@ |
|---|
| 88 | die( $return ); |
|---|
| 89 | break; |
|---|
| 90 | default : |
|---|
| 91 | - do_action( 'wp_ajax_' . $_GET['action'] ); |
|---|
| 92 | + if ( !empty($_GET['action']) ) |
|---|
| 93 | + do_action( 'wp_ajax_' . stripslashes($_GET['action']) ); |
|---|
| 94 | die('0'); |
|---|
| 95 | break; |
|---|
| 96 | endswitch; |
|---|
| 97 | @@ -1414,7 +1415,8 @@ |
|---|
| 98 | } |
|---|
| 99 | die( '0' ); |
|---|
| 100 | default : |
|---|
| 101 | - do_action( 'wp_ajax_' . $_POST['action'] ); |
|---|
| 102 | + if ( !empty($_POST['action']) ) |
|---|
| 103 | + do_action( 'wp_ajax_' . stripslashes($_POST['action']) ); |
|---|
| 104 | die('0'); |
|---|
| 105 | break; |
|---|
| 106 | endswitch; |
|---|