<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[3100] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php: Plugin Directory: Allow for third party content to be displayed.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/3100">3100</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/3100","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-05-08 22:26:26 +0000 (Sun, 08 May 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Plugin Directory: Allow for third party content to be displayed.

Having an action here allows for more flexibility to enhance the author card in
the future.

H/t coffee2code.
See <a href="http://meta.trac.wordpress.org/ticket/1695">#1695</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassauthorcardphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassauthorcardphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php     2016-05-08 00:05:18 UTC (rev 3099)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php       2016-05-08 22:26:26 UTC (rev 3100)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,255 +181,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px">                <?php
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                self::show_warning_flags( $post, $author, $all_plugins );
-       }
-
-       /**
-        * Displays listing of warning flags for the plugin and its authors.
-        *
-        * @param \WP_Post $plugin           The plugin object.
-        * @param \WP_User $author           The plugin author.
-        * @param array    $all_plugins      Array of plugin objects for all of user's plugins.
-        */
-       public static function show_warning_flags( $plugin, $author, $all_plugins ) {
-               $flagged = array(
-                       'critical' => array(),
-                       'med'      => array(),
-                       'low'      => array(),
-                       'info'     => array(),
-               );
-
-               $approved_plugins = wp_list_filter( $all_plugins, array( 'post_status' => 'publish' ) );
-               $rejected_plugins = wp_list_filter( $all_plugins, array( 'post_status' => 'rejected' ) );
-
-               // More than one instance of a spammer coming from one of these IPs or IP blocks (critical)
-               $post_ip       = get_post_meta( $plugin->ID, 'post_ip', true );
-               $is_spammer_ip = false;
-
-               $suspected_spammer_ip_blocks = array(
-                       '2.240.101.121',
-                       '2.240.163.90',
-                       '2.240.118.188',
-                       '2.241.60.160',
-                       '2.241.66.20',
-                       '2.241.124.187',
-                       '5.102.170.',
-                       '5.102.171.',
-                       '38.78.',
-                       '49.50.124.',
-                       '65.33.104.38',
-                       '71.41.77.202',
-                       '76.73.108.',
-                       '80.131.192.168',
-                       '87.188.67.',
-                       '87.188.75.',
-                       '87.188.82.',
-                       '91.228.',
-                       '94.103.41.',
-                       '109.123.',
-                       '110.55.1.251',
-                       '110.55.4.248',
-                       '116.193.162.',
-                       '119.235.251.',
-                       '159.253.145.183',
-                       '173.171.9.190',
-                       '173.234.140.18',
-                       '188.116.36.',
-                       '217.87.249.',
-                       '217.87.251.',
-                       '217.87.252.',
-               );
-
-               foreach ( $suspected_spammer_ip_blocks as $spammer_ip ) {
-                       if ( 0 === strpos( $post_ip, $spammer_ip ) ) {
-                               $flagged['critical'][] = "spammer IP '$spammer_ip" . ( substr( $spammer_ip, - 1 ) == '.' ? '*' : '' ) . "'";
-                               $is_spammer_ip         = true;
-                               break;
-                       }
-               }
-
-               /*
-                * These IPs or IP blocks have instances of being used by spammers, but aren't concrete
-                * (or are fairly broad) that we don't want to auto-reject them. But we want to be wary. (high)
-                */
-               $possible_spammer_ip_blocks = array(
-                       '2.240.',
-                       '2.241.',
-                       '91.238.',
-                       '182.68.',
-               );
-               if ( ! $is_spammer_ip ) {
-                       foreach ( $possible_spammer_ip_blocks as $spammer_ip ) {
-                               if ( 0 === strpos( $post_ip, $spammer_ip ) ) {
-                                       $flagged['med'][] = "possible spammer IP '$spammer_ip" . ( substr( $spammer_ip, - 1 ) == '.' ? '*' : '' ) . "'";
-                                       break;
-                               }
-                       }
-               }
-
-               /*
-                * If user is banned from logging into WP.org (critical)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         /**
+                * Fires at the end of a plugin's author card.
</ins><span class="cx" style="display: block; padding: 0 10px">                  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * This is pretty rare. They would have to have been banned after having
-                * submitted the plugin.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param \WP_Post $plugin           The plugin object.
+                * @param \WP_User $author           The plugin author.
+                * @param array    $all_plugins      Array of plugin objects for all of user's plugins.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( property_exists( $author, 'capabilities' ) && isset( $author->capabilities['blocked'] ) && '1' == $author->capabilities['blocked'] ) {
-                       $flagged['critical'][] = 'user has been banned from logging into WP.org';
-               }
-
-               // If user < 2 days old, extra red-flaggy (high). ElseIf user is < 2 weeks old, consider them new. (med)
-               $user_date    = new \DateTime( $author->user_registered );
-               $user_date    = $user_date->format( 'U' );
-               $request_date = new \DateTime( $plugin->post_date );
-               $request_date = $request_date->format( 'U' );
-
-               if ( $user_date > strtotime( '-3 days', $request_date ) ) {
-                       $flagged['med'][] = 'user &lt; 3 days old at request';
-               } elseif ( $user_date > strtotime( '-2 weeks', $request_date ) ) {
-                       $flagged['low'][] = 'user &lt; 2 weeks old at request';
-               }
-
-               // If username ends in numbers and the user doesn't have any approved plugins.
-               if ( preg_match( '/\d{3,}$/', $author->user_login ) && 0 === count( $approved_plugins ) ) {
-                       $flagged['med'][] = 'username ends in numbers';
-               }
-
-               // If username contains spammer-used words.
-               $spam_username_substrings = array(
-                       'design',
-                       'develop',
-                       'html',
-                       'market',
-                       'seo',
-               );
-               foreach ( $spam_username_substrings as $spam ) {
-                       if ( false !== strpos( $author->user_login, $spam ) ) {
-                               $flagged['med'][] = "spammer-used username substring ($spam)";
-                               break;
-                       }
-               }
-
-               // If user's email is @yahoo.* or @mail.com (med).
-               $suspicious_email_hosts = array( '@yahoo.', '@mail.com' );
-               foreach ( $suspicious_email_hosts as $email_host ) {
-                       if ( false !== strpos( $author->user_email, $email_host ) ) {
-                               $flagged['med'][] = 'spammer-used email host';
-                               break;
-                       }
-               }
-
-               // If the plugin is for a typically spammed genre (med).
-               $spam_names   = array();
-               $spam_targets = array(
-                       'bookmark',
-                       'cookie',
-                       'facebook',
-                       'gallery',
-                       'google',
-                       'lightbox',
-                       'seo',
-                       'sitemap',
-                       'slide',
-                       'social',
-                       'twitter',
-                       'youtube',
-               );
-               foreach ( $spam_targets as $spam_target ) {
-                       if ( false !== strpos( $plugin->post_name, $spam_target ) || false !== strpos( $plugin->post_title, $spam_target ) ) {
-                               $spam_names[] = $spam_target;
-                       }
-               }
-               if ( ! empty( $spam_names ) ) {
-                       $flagged['low'][] = "plugin name/slug contains '" . implode( "', '", $spam_names ) . "'";
-               }
-
-               // If the plugin's name contains undesirable terms.
-               $undesirables      = array();
-               $undesirable_terms = array( 'autoblog', 'auto-blog', 'booking', 'plugin', 'spinning' );
-               foreach ( $undesirable_terms as $undesirable ) {
-                       if ( false !== strpos( $plugin->post_name, $undesirable ) || false !== strpos( $plugin->post_title, $undesirable ) ) {
-                               $undesirables[] = $undesirable;
-                       }
-               }
-               if ( ! empty( $undesirables ) ) {
-                       $flagged['med'][] = "plugin name/slug contains potentially undesirable term(s) '" . implode( "', '", $undesirables ) . "'";
-               }
-
-               // Home URL is at weebly.com.
-               if ( false !== strpos( $author->user_url, 'weebly.com' ) ) {
-                       $flagged['med'][] = 'spammer-used web host for user URL (weebly.com)';
-               }
-
-               // User's first plugin (low).
-               if ( 0 === count( $approved_plugins ) ) {
-                       $flagged['low'][] = 'user has no open plugins';
-               }
-
-               // User was rejected for this plugin before.
-               if ( ! empty( $rejected_plugins ) && in_array( $plugin->post_name, $rejected_plugins ) ) {
-                       $flagged['med'][] = 'user was previously rejected for this plugin';
-               }
-
-               // User has previously rejected plugins (med).
-               if ( count( $rejected_plugins ) > 0 ) {
-                       $flagged['med'][] = 'user has rejected plugins';
-               }
-
-               // User is blocked from posting to the support forums (med).
-               if ( property_exists( $author, 'elf_not_trusted' ) && '1' == $author->elf_not_trusted ) {
-                       $flagged['med'][] = 'user is blocked from posting to the support forums';
-               }
-
-               // User is marked as a bozo in the support forums (low).
-               if ( property_exists( $author, 'is_bozo' ) && '1' == $author->is_bozo ) {
-                       $flagged['low'][] = 'user is a bozo in the support forums';
-               }
-
-               // No home URL (low).
-               if ( empty( $author->user_url ) ) {
-                       $flagged['low'][] = 'no URL for user';
-               } elseif ( false !== strpos( $author->user_url, 'blogspot.com' ) ) {
-                       $flagged['med'][] = 'user URL at blogspot.com';
-               } elseif ( false !== strpos( $author->user_url, 'wordpress.com' ) ) {
-                       $flagged['low'][] = 'user URL at WordPress.com';
-               }
-
-               // User has submitted this plugin before (info).
-               if ( in_array( $plugin->post_name, wp_list_pluck( $all_plugins, 'post_name' ) ) ) {
-                       $flagged['info'][] = 'user has submitted this plugin before';
-               }
-
-               $flagged = array_filter( $flagged );
-
-               if ( empty( $flagged ) ) {
-                       echo '<span class="plugin-flagged-status plugin-queue-unflagged" style="display:none;" title="This plugin has no warning flags">&nbsp;</span>';
-               } else {
-                       if ( isset( $flagged['critical'] ) ) {
-                               echo '<span class="plugin-flagged-status plugin-queue-flagged-critical" style="display:none;" title="This plugin should be rejected">&nbsp;</span>';
-                       }
-                       echo '<div class="plugin-queue-flagged">';
-                       echo '<h4>FLAGGED!</h4>';
-                       echo '<ul class="plugin-flagged">';
-
-                       foreach ( $flagged as $flag_level => $flag ) {
-                               $flag_name = 'critical' == $flag_level ? 'DO NOT APPROVE' : strtoupper( $flag_level );
-
-                               echo '<li class="plugin-flagged-' . $flag_level . '"><strong>' . $flag_name . ' (' . count( $flagged[ $flag_level ] ) . '):</strong> ';
-                               echo implode( '; ', $flagged[ $flag_level ] );
-
-                               // Critically flagged plugins should sit in queue for at least a week to give spammer
-                               // the impression that we're reviewing it
-                               if ( 'critical' == $flag_level ) {
-                                       $reject_on = strftime( '%h. %e', strtotime( '+1 week', $request_date ) );
-                                       echo '<br />Reject this plugin after ' . $reject_on . ' (to give impression we\'re reviewing it).';
-                               }
-
-                               echo '</li>';
-                       }
-                       echo '</ul>';
-                       echo '</div>';
-               }
-
-               return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         do_action( 'wporg_plugins_author_card', $post, $author, $all_plugins );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>

</body>
</html>