Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.67 KB | None | 0 0
  1. diff --git a/wp-content/plugins/co-authors-plus/co-authors-plus.php b/wp-content/plugins/co-authors-plus/co-authors-plus.php
  2. index e08ecca..ed9b88f 100644
  3. --- a/wp-content/plugins/co-authors-plus/co-authors-plus.php
  4. +++ b/wp-content/plugins/co-authors-plus/co-authors-plus.php
  5. @@ -34,6 +34,11 @@ require_once( dirname( __FILE__ ) . '/php/class-coauthors-template-filters.php'
  6.  if ( defined('WP_CLI') && WP_CLI )
  7.     require_once( dirname( __FILE__ ) . '/php/class-wp-cli.php' );
  8.  
  9. +function sanitize_slug($s)
  10. +{
  11. +    return strtolower(urlencode(sanitize_text_field($s)));
  12. +}
  13. +
  14.  class coauthors_plus {
  15.  
  16.     // Name for the taxonomy we're using to store relationships
  17. @@ -690,7 +695,7 @@ class coauthors_plus {
  18.  
  19.         // This action happens when a post is saved while editing a post
  20.         if( isset( $_REQUEST['coauthors-nonce'] ) && isset( $_POST['coauthors'] ) && is_array( $_POST['coauthors'] ) ) {
  21. -           $author = sanitize_text_field( $_POST['coauthors'][0] );
  22. +           $author = sanitize_slug( $_POST['coauthors'][0] );
  23.             if ( $author ) {
  24.                 $author_data = $this->get_coauthor_by( 'user_nicename', $author );
  25.                 // If it's a guest author and has a linked account, store that information in post_author
  26. @@ -733,7 +738,7 @@ class coauthors_plus {
  27.                 check_admin_referer( 'coauthors-edit', 'coauthors-nonce' );
  28.  
  29.                 $coauthors = (array) $_POST['coauthors'];
  30. -               $coauthors = array_map( 'sanitize_text_field', $coauthors );
  31. +               $coauthors = array_map( 'sanitize_slug', $coauthors );
  32.                 $this->add_coauthors( $post_id, $coauthors );
  33.             }
  34.         } else {
  35. @@ -974,7 +979,7 @@ class coauthors_plus {
  36.             die();
  37.  
  38.         $search = sanitize_text_field( strtolower( $_REQUEST['q'] ) );
  39. -       $ignore = array_map( 'sanitize_text_field', explode( ',', $_REQUEST['existing_authors'] ) );
  40. +       $ignore = array_map( 'sanitize_slug', explode( ',', $_REQUEST['existing_authors'] ) );
  41.  
  42.         $authors = $this->search_authors( $search, $ignore );
  43.  
  44. diff --git a/wp-content/plugins/co-authors-plus/js/co-authors-plus.js b/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
  45. index 2b2034c..3dbeeb1 100644
  46. --- a/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
  47. +++ b/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
  48. @@ -305,7 +305,7 @@ jQuery(document).ready(function () {
  49.                             'type': 'hidden',
  50.                             'id': 'coauthors_hidden_input',
  51.                             'name': 'coauthors[]',
  52. -                           'value': unescape(author.nicename)
  53. +                           'value': decodeURIComponent(author.nicename)
  54.                             })
  55.                         ;
  56.        
  57. @@ -530,4 +530,4 @@ jQuery(document).ready(function () {
  58.  if( typeof(console) === 'undefined' ) {
  59.     var console = {}
  60.     console.log = console.error = function() {};
  61. -}
  62. \ No newline at end of file
  63. +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement