Advertisement
Guest User

fix epc notices

a guest
Oct 8th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.76 KB | None | 0 0
  1. Index: class.email-post-changes.php
  2. ===================================================================
  3. --- class.email-post-changes.php    (revision 784251)
  4. +++ class.email-post-changes.php    (working copy)
  5. @@ -12,7 +12,7 @@
  6.     const OPTION_GROUP = 'email_post_changes';
  7.     const OPTION = 'email_post_changes';
  8.  
  9. -   function init() {
  10. +   static function init() {
  11.         static $instance = null;
  12.  
  13.         if ( $instance )
  14. @@ -100,8 +100,8 @@
  15.             $left  = normalize_whitespace( $left );
  16.             $right = normalize_whitespace( $right );
  17.  
  18. -           $left_lines  = split( "\n", $left );
  19. -           $right_lines = split( "\n", $right );
  20. +           $left_lines  = explode( "\n", $left );
  21. +           $right_lines = explode( "\n", $right );
  22.  
  23.             require_once( dirname( __FILE__ ) . '/unified.php' );
  24.  
  25. @@ -294,9 +294,8 @@
  26.             else
  27.                 $return['emails'] = $this->defaults['emails'];
  28.         } else {
  29. -           if ( is_string( $options['emails'] ) )
  30. -               $_emails = preg_split( '(\n|\r)', $options['emails'], -1, PREG_SPLIT_NO_EMPTY );
  31. -           $_emails = array_unique( (array) $_emails );
  32. +           $_emails = is_string( $options['emails'] ) ? preg_split( '(\n|\r)', $options['emails'], -1, PREG_SPLIT_NO_EMPTY ) : array();
  33. +           $_emails = array_unique( $_emails );
  34.             $emails = array_filter( $_emails, 'is_email' );
  35.  
  36.             $invalid_emails = array_diff( $_emails, $emails );
  37. @@ -311,7 +310,7 @@
  38.                 $return['emails'] = $this->defaults['emails'];
  39.  
  40.             // Don't store a huge list of invalid emails addresses in the option
  41. -           if ( count( $return['invalid_emails'] ) > 200 ) {
  42. +           if ( isset ( $return['invalid_emails'] ) && count( $return['invalid_emails'] ) > 200 ) {
  43.                 $return['invalid_emails'] = array_slice( $return['invalid_emails'], 0, 200 );
  44.                 $return['invalid_emails'][] = __( 'and many more not listed here' );
  45.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement