Changeset 11713
- Timestamp:
- 03/28/2022 11:06:18 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/photo.php
r11687 r11713 1026 1026 } 1027 1027 1028 /** 1029 * Determines if a photo is controversial. 1030 * 1031 * This only applies for unpublished photos that also meet one of these 1032 * criteria: 1033 * - Flagged by Vision as being "possible" or more likely in any criteria category 1034 * 1035 * @param int|WP_Post|null Optional. The post or attachment. Default null, 1036 * indicating the current post. 1037 * @return bool True if photo is controversial, else false. 1038 */ 1039 public static function is_controversial( $post = null ) { 1040 $post = get_post( $post ); 1041 1042 // If post is an attachment, get its parent. 1043 if ( 'attachment' === get_post_type( $post ) ) { 1044 $post = get_post( wp_get_post_parent_id( $post->ID ) ); 1045 } 1046 1047 if ( ! $post ) { 1048 return false; 1049 } 1050 1051 // Controversial if photo got flagged as 'possible' or more likely by Vision. 1052 $flags = Photo::get_filtered_moderation_assessment( $post->ID ); 1053 if ( ! empty( $flags ) ) { 1054 return true; 1055 } 1056 1057 return false; 1058 } 1059 1028 1060 } 1029 1061
Note: See TracChangeset
for help on using the changeset viewer.