Changeset 13370 for trunk/src/bp-core/bp-core-moderation.php
- Timestamp:
- 11/19/2022 10:26:02 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-moderation.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-moderation.php
r13297 r13370 78 78 79 79 // Define local variable(s). 80 $_post = array();81 $match _out= '';80 $_post = array(); 81 $matches = ''; 82 82 83 83 /** User Data ************************************************************ … … 91 91 // If data exists, map it. 92 92 if ( ! empty( $user ) ) { 93 $_post['author'] = $user->display_name; 94 $_post['email'] = $user->user_email; 95 $_post['url'] = $user->user_url; 93 $_post['user_id'] = $user->ID; 94 $_post['author'] = $user->display_name; 95 $_post['email'] = $user->user_email; 96 $_post['url'] = $user->user_url; 96 97 } 97 98 } … … 112 113 113 114 // How many links? 114 $num_links = preg_match_all( '/(http|ftp|https):\/\//i', $content, $match_out ); 115 116 // Allow for bumping the max to include the user's URL. 115 $num_links = preg_match_all( '/(http|ftp|https):\/\/(.+?)([\s\'"])/i', $content, $matches ); 116 117 // Neutralize the current site's URL. 118 if ( isset( $matches[0] ) && is_array( $matches[0] ) ) { 119 foreach ( $matches[0] as $found_url ) { 120 if ( 0 === strpos( $found_url, home_url() ) ) { 121 $num_links -=1; 122 } 123 } 124 } 125 126 // Allow for bumping the max according to the user's URL or content data. 117 127 if ( ! empty( $_post['url'] ) ) { 128 $user_url = $_post['url']; 118 129 119 130 /** … … 121 132 * 122 133 * @since 1.6.0 134 * @since 11.0.0 Introduced the $content parameter as WordPress did the same in 4.7.0. 123 135 * 124 * @param string $num_links How many links found. 125 * @param string $value User's url. 136 * @param string $num_links How many links found. 137 * @param string $user_url User's url. 138 * @param array $content The content being moderated. 126 139 */ 127 $num_links = apply_filters( 'comment_max_links_url', $num_links, $ _post['url']);140 $num_links = apply_filters( 'comment_max_links_url', $num_links, $user_url, $content ); 128 141 } 129 142
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)