Changeset 3139317
- Timestamp:
- 08/21/2024 10:38:08 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
email-post-changes/trunk/class.email-post-changes.php
r3139316 r3139317 94 94 // If this is a new post, set an empty title for $this->left_post so that it appears in the diff. 95 95 $child_posts = wp_get_post_revisions( $post_id, array( 'numberposts' => 1 ) ); 96 if ( count( $child_posts) == 0 ) {96 if ( ( is_countable( $child_posts ) ? count( $child_posts ) : 0 ) == 0 ) { 97 97 $this->left_post->post_title = ''; 98 98 } … … 160 160 161 161 $emails = array_unique( array_merge( $options['emails'], $user_emails ) ); 162 if ( ! count( $emails ) && apply_filters( 'email_post_changes_admin_email_fallback', true ) )162 if ( $emails === [] && apply_filters( 'email_post_changes_admin_email_fallback', true ) ) { 163 163 $emails[] = get_option( 'admin_email' ); 164 164 } 165 165 $emails = apply_filters( 'email_post_changes_emails', $emails, $this->left_post->ID, $this->right_post->ID ); 166 166 … … 311 311 312 312 if ( empty( $options['emails'] ) ) { 313 if ( count( $return['users'] ) )313 if ( is_countable( $return['users'] ) ? count( $return['users'] ) : 0 ) { 314 314 $return['emails'] = array(); 315 else315 } else { 316 316 $return['emails'] = $this->defaults['emails']; 317 } 317 318 } else { 318 319 $_emails = is_string( $options['emails'] ) ? preg_split( '(\n|\r)', $options['emails'], -1, PREG_SPLIT_NO_EMPTY ) : array(); … … 325 326 $return['invalid_emails'] = $invalid_emails; 326 327 327 if ( $emails ) 328 if ( $emails ) { 328 329 $return['emails'] = $emails; 329 elseif ( count( $return['users'] ) )330 } elseif ( is_countable( $return['users'] ) ? count( $return['users'] ) : 0 ) { 330 331 $return['emails'] = array(); 331 else332 } else { 332 333 $return['emails'] = $this->defaults['emails']; 334 } 333 335 334 336 // Don't store a huge list of invalid emails addresses in the option … … 339 341 340 342 // Cap to at max 200 email addresses 341 if ( count( $return['emails']) > 200 ) {343 if ( ( is_countable( $return['emails'] ) ? count( $return['emails'] ) : 0 ) > 200 ) { 342 344 $return['emails'] = array_slice( $return['emails'], 0, 200 ); 343 345 } … … 389 391 <?php if ( !empty( $options['invalid_emails'] ) && $_GET['settings-updated'] ) : ?> 390 392 <div class="error"> 391 <p><?php printf( _n( 'Invalid Email: %s', 'Invalid Emails: %s', count( $options['invalid_emails'] ) ), '<kbd>' . join( '</kbd>, <kbd>', array_map( 'esc_html', $options['invalid_emails'] ) ) ); ?></p>393 <p><?php printf( _n( 'Invalid Email: %s', 'Invalid Emails: %s', is_countable( $options['invalid_emails'] ) ? count( $options['invalid_emails'] ) : 0 ), '<kbd>' . implode( '</kbd>, <kbd>', array_map( 'esc_html', $options['invalid_emails'] ) ) ); ?></p> 392 394 </div> 393 395 <?php endif; ?> … … 448 450 $options = $this->get_options(); 449 451 ?> 450 <textarea class="epc-additional-emails" rows="4" cols="40" name="email_post_changes[emails]"><?php echo esc_html( join( "\n", $options['emails'] ) ); ?></textarea>452 <textarea class="epc-additional-emails" rows="4" cols="40" name="email_post_changes[emails]"><?php echo esc_html( implode( "\n", $options['emails'] ) ); ?></textarea> 451 453 <p class="description"><?php _e( 'One email address per line.' ); ?></p> 452 454 <?php
Note: See TracChangeset
for help on using the changeset viewer.