<!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>[3545] sites/trunk/wordpress.org/public_html/wp-content: Plugin Directory: Add plugin favoriting to the user interface.</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/3545">3545</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/3545","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-06-22 13:33:53 +0000 (Wed, 22 Jun 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: Add plugin favoriting to the user interface.
Someone will need to style this properly.
Fixes <a href="http://meta.trac.wordpress.org/ticket/1577">#1577</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryapiclassbasephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstemplatephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstoolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginscssstylertlcss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginscssstylecss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginssasssiteprimary_pluginsinglescss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/sass/site/primary/_plugin-single.scss</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartspluginsinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryapiroutesclasspluginfavoritesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-favorites.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryapiclassbasephp"></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/api/class-base.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/api/class-base.php 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,10 +11,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Initialises each API route we offer.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> static function load_routes() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- new Routes\Commit_Subscriptions();
</del><span class="cx" style="display: block; padding: 0 10px"> new Routes\Internal_Stats();
</span><span class="cx" style="display: block; padding: 0 10px"> new Routes\Plugin();
</span><span class="cx" style="display: block; padding: 0 10px"> new Routes\Plugin_Translations();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ new Routes\Plugin_Favorites();
+ new Routes\Commit_Subscriptions();
</ins><span class="cx" style="display: block; padding: 0 10px"> new Routes\Popular_Categories();
</span><span class="cx" style="display: block; padding: 0 10px"> new Routes\Query_Plugins();
</span><span class="cx" style="display: block; padding: 0 10px"> new Routes\SVN_Access();
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryapiroutesclasspluginfavoritesphpfromrev3523sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryapiroutesclasscommitsubscriptionsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-favorites.php (from rev 3523, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-commit-subscriptions.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/api/routes/class-plugin-favorites.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-favorites.php 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,56 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\API\Routes;
+use WordPressdotorg\Plugin_Directory\Plugin_Directory;
+use WordPressdotorg\Plugin_Directory\API\Base;
+use WordPressdotorg\Plugin_Directory\Tools;
+
+/**
+ * An API endpoint for favoriting a particular plugin.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Plugin_Favorites extends Base {
+
+ public function __construct() {
+ register_rest_route( 'plugins/v1', '/plugin/(?P<plugin_slug>[^/]+)/favorite', array(
+ 'methods' => array( \WP_REST_Server::READABLE, \WP_REST_Server::CREATABLE ),
+ 'callback' => array( $this, 'favorite' ),
+ 'args' => array(
+ 'plugin_slug' => array(
+ 'validate_callback' => array( $this, 'validate_plugin_slug_callback' ),
+ ),
+ 'favorite' => array(
+ 'validate_callback' => function( $bool ) { return is_numeric( $bool ); },
+ ),
+ 'unfavorite' => array(
+ 'validate_callback' => function( $bool ) { return is_numeric( $bool ); },
+ ),
+ ),
+ 'permission_callback' => 'is_user_logged_in'
+ ) );
+ }
+
+ /**
+ * Endpoint to favorite a plugin.
+ *
+ * @param \WP_REST_Request $request The Rest API Request.
+ * @return bool True if the favoriting was successful.
+ */
+ public function favorite( $request ) {
+ $location = get_permalink( Plugin_Directory::get_plugin_post( $request['plugin_slug'] ) );
+ header( "Location: $location" );
+
+ $result = array(
+ "location" => $location,
+ );
+
+ if ( ! isset( $request['favorite'] ) && ! isset( $request['unfavorite'] ) ) {
+ $result['error'] = 'Unknown Action';
+ }
+
+ $result['favorite'] = Tools::favorite_plugin( $request['plugin_slug'], get_current_user_id(), isset( $request['favorite'] ) );
+
+ return (object) $result;
+ }
+
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstemplatephp"></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/class-template.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/class-template.php 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -461,4 +461,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return ent2ncr( htmlspecialchars_decode( htmlentities( $string, ENT_NOQUOTES, 'UTF-8' ), ENT_NOQUOTES ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Generates a link to toggle a plugin favorites state.
+ *
+ * @param string $plugin_slug The plugin slug.
+ * @param mixed $user The user to alter the favorite status for.
+ * @return string URL to toggle status.
+ */
+ public static function get_favourite_link( $plugin_slug, $user = 0 ) {
+ $post = Plugin_Directory::get_plugin_post( $plugin_slug );
+ if ( ! $post ) {
+ return false;
+ }
+
+ $favorited = Tools::favorited_plugin( $post, $user );
+
+ return add_query_arg(
+ array(
+ '_wpnonce' => wp_create_nonce( 'wp_rest' ),
+ ( $favorited ? 'unfavorite' : 'favorite' ) => '1'
+ ),
+ home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/favorite' )
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstoolsphp"></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/class-tools.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/class-tools.php 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -256,6 +256,68 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determine if a plugin has been favorited by a user.
+ *
+ * @param string $plugin_slug The plugin to check.
+ * @param mixed $user The user to check.
+ * @return bool
+ */
+ public static function favorited_plugin( $plugin_slug, $user = 0 ) {
+ $post = Plugin_Directory::get_plugin_post( $plugin_slug );
+ if ( ! $post ) {
+ return false;
+ }
+
+ $user = new WP_User( $user ?: get_current_user_id() );
+ if ( ! $user->exists() ) {
+ return false;
+ }
+
+ $users_favorites = get_user_meta( $user->ID, 'plugin_favorites', true ) ?: array();
+
+ return in_array( $post->post_name, $users_favorites, true );
+ }
+
+ /**
+ * Favorite a plugin
+ *
+ * @param string $plugin_slug The plugin to favorite
+ * @param mixed $user The user favorite
+ * @param bool $favorite Whether it's a favorite, or unfavorite.
+ * @return bool
+ */
+ public static function favorite_plugin( $plugin_slug, $user = 0, $favorite = true ) {
+ $post = Plugin_Directory::get_plugin_post( $plugin_slug );
+ if ( ! $post ) {
+ return false;
+ }
+
+ $user = new WP_User( $user ?: get_current_user_id() );
+ if ( ! $user->exists() ) {
+ return false;
+ }
+
+ $users_favorites = get_user_meta( $user->ID, 'plugin_favorites', true ) ?: array();
+
+ $already_favorited = in_array( $post->post_name, $users_favorites, true );
+
+ if ( $favorite && $already_favorited ) {
+ return true;
+ } elseif ( $favorite ) {
+ // Add it
+ $users_favorites[] = $post->post_name;
+ } elseif ( ! $favorite && $already_favorited ) {
+ // Remove it
+ unset( $users_favorites[ array_search( $post->post_name, $users_favorites, true ) ] );
+ } else {
+ return true;
+ }
+
+ return update_user_meta( $user->ID, 'plugin_favorites', wp_slash( array_values( $users_favorites ) ) );
+
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Retrieve a list of users who are subscribed to plugin commits.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $plugin_slug The plugin to retrieve subscribers for.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginscssstylertlcss"></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/themes/pub/wporg-plugins/css/style-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2158,10 +2158,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 96px !important;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.single .type-plugin .plugin-header .plugin-download {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.single .type-plugin .plugin-header .plugin-actions {
</ins><span class="cx" style="display: block; padding: 0 10px"> float: left;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.single .type-plugin .plugin-header .plugin-favorite-heart {
+ color: gray;
+ line-heght: 3em;
+ font-size: 3em;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart.favorited, .single .type-plugin .plugin-header .plugin-favorite-heart:hover, .single .type-plugin .plugin-header .plugin-favorite-heart:focus {
+ color: red;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart:hover, .single .type-plugin .plugin-header .plugin-favorite-heart:focus {
+ text-decoration: none;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart:after {
+ content: "\f487";
+ font-family: dashicons;
+ vertical-align: top;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .single .type-plugin .plugin-header .plugin-title {
</span><span class="cx" style="display: block; padding: 0 10px"> clear: none;
</span><span class="cx" style="display: block; padding: 0 10px"> font-size: 25px;
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginscssstylecss"></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/themes/pub/wporg-plugins/css/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2158,10 +2158,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 96px !important;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.single .type-plugin .plugin-header .plugin-download {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.single .type-plugin .plugin-header .plugin-actions {
</ins><span class="cx" style="display: block; padding: 0 10px"> float: right;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.single .type-plugin .plugin-header .plugin-favorite-heart {
+ /* FIX ME */
+ color: gray;
+ line-heght: 3em;
+ font-size: 3em;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart.favorited, .single .type-plugin .plugin-header .plugin-favorite-heart:hover, .single .type-plugin .plugin-header .plugin-favorite-heart:focus {
+ color: red;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart:hover, .single .type-plugin .plugin-header .plugin-favorite-heart:focus {
+ text-decoration: none;
+}
+
+.single .type-plugin .plugin-header .plugin-favorite-heart:after {
+ content: "\f487";
+ font-family: dashicons;
+ vertical-align: top;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .single .type-plugin .plugin-header .plugin-title {
</span><span class="cx" style="display: block; padding: 0 10px"> clear: none;
</span><span class="cx" style="display: block; padding: 0 10px"> font-size: 25px;
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginssasssiteprimary_pluginsinglescss"></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/themes/pub/wporg-plugins/sass/site/primary/_plugin-single.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/sass/site/primary/_plugin-single.scss 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/sass/site/primary/_plugin-single.scss 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -46,10 +46,35 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- .plugin-download {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ .plugin-actions {
</ins><span class="cx" style="display: block; padding: 0 10px"> float: right;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ .plugin-favorite-heart {
+ /* FIX ME */
+ color: gray;
+ line-heght: 3em;
+ font-size: 3em;
+
+ &.favorited,
+ &:hover,
+ &:focus {
+ color: red;
+ }
+
+ &:hover,
+ &:focus {
+ text-decoration: none;
+ }
+
+ &:after {
+ content: "\f487";
+ font-family: dashicons;
+ vertical-align: top;
+ }
+
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .plugin-title {
</span><span class="cx" style="display: block; padding: 0 10px"> clear: none;
</span><span class="cx" style="display: block; padding: 0 10px"> @include font-size( ms-unitless( ms(4) ) );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpluginstemplatepartspluginsinglephp"></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/themes/pub/wporg-plugins/template-parts/plugin-single.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/themes/pub/wporg-plugins/template-parts/plugin-single.php 2016-06-22 13:16:20 UTC (rev 3544)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php 2016-06-22 13:33:53 UTC (rev 3545)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,6 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Theme;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Plugin_Directory;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Template;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordPressdotorg\Plugin_Directory\Tools;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,10 +33,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo Template::get_plugin_icon( get_post(), 'html' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
- <meta itemprop="softwareVersion" content="<?php echo esc_attr( get_post_meta( get_the_ID(), 'version', true ) ); ?>">
- <meta itemprop="fileFormat" content="application/zip">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="plugin-actions">
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ if ( is_user_logged_in() ) {
+ $url = Template::get_favourite_link( $post );
+ echo '<a href="' . esc_url( $url ) . '" class="plugin-favorite-heart' . (Tools::favorited_plugin( $post ) ? ' favorited' : '' ) . '" onclick="jQuery(this).toggleClass(\'favorited\')"></a>';
+ }
+ ?>
+
+ <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
+ <meta itemprop="softwareVersion" content="<?php echo esc_attr( get_post_meta( get_the_ID(), 'version', true ) ); ?>">
+ <meta itemprop="fileFormat" content="application/zip">
+ </div>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php the_title( '<h1 class="plugin-title">', '</h1>' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="byline"><?php printf( esc_html_x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( Template::encode( get_the_author() ) ) . '</a></span>' ); ?></span>
</span></span></pre>
</div>
</div>
</body>
</html>