summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
committerAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
commita6b006c0f1ef757f23375f7906193370337d8bd7 (patch)
tree4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/modules/publicize
parentUpdate akismet 4.0.7 (diff)
downloadblogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/modules/publicize')
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize-rtl.css1
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.css1
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.min.css2
-rw-r--r--plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css3
-rw-r--r--plugins/jetpack/modules/publicize/enhanced-open-graph.php4
-rw-r--r--plugins/jetpack/modules/publicize/publicize-jetpack.php25
-rw-r--r--plugins/jetpack/modules/publicize/publicize.php148
-rw-r--r--plugins/jetpack/modules/publicize/ui.php4
9 files changed, 163 insertions, 27 deletions
diff --git a/plugins/jetpack/modules/publicize/assets/publicize-rtl.css b/plugins/jetpack/modules/publicize/assets/publicize-rtl.css
index 3f9c39d0..31fb06a5 100644
--- a/plugins/jetpack/modules/publicize/assets/publicize-rtl.css
+++ b/plugins/jetpack/modules/publicize/assets/publicize-rtl.css
@@ -110,7 +110,6 @@ div.publicize-service-right li {
border-top-style: none;
border-top-width: 0px;
color: #CCC;
- cursor: auto;
display: inline;
font-size: 20px;
font-style: normal;
diff --git a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css b/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css
index 6e943b26..6bfc77c9 100644
--- a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css
+++ b/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css
@@ -1 +1 @@
-div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 20px 5px 25px;overflow:hidden;max-width:1200px}span.pub-logos{float:right;display:block;width:130px;height:75px;margin-top:-18px;margin-right:5px;vertical-align:top}.left,.right{width:50%;float:right}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-left:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:left;float:left;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-right:0;margin-left:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-right:0;padding-left:0;padding-top:0;position:static;left:auto;text-align:right;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-left:20px}table#option-profile td.thumbnail{padding-left:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-left:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red} \ No newline at end of file
+div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 20px 5px 25px;overflow:hidden;max-width:1200px}span.pub-logos{float:right;display:block;width:130px;height:75px;margin-top:-18px;margin-right:5px;vertical-align:top}.left,.right{width:50%;float:right}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-left:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:left;float:left;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-right:0;margin-left:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-right:0;padding-left:0;padding-top:0;position:static;left:auto;text-align:right;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-left:20px}table#option-profile td.thumbnail{padding-left:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-left:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red} \ No newline at end of file
diff --git a/plugins/jetpack/modules/publicize/assets/publicize.css b/plugins/jetpack/modules/publicize/assets/publicize.css
index 842612fc..3d75ab7b 100644
--- a/plugins/jetpack/modules/publicize/assets/publicize.css
+++ b/plugins/jetpack/modules/publicize/assets/publicize.css
@@ -109,7 +109,6 @@ div.publicize-service-right li {
border-top-style: none;
border-top-width: 0px;
color: #CCC;
- cursor: auto;
display: inline;
font-size: 20px;
font-style: normal;
diff --git a/plugins/jetpack/modules/publicize/assets/publicize.min.css b/plugins/jetpack/modules/publicize/assets/publicize.min.css
index 675e8ce7..43b2583e 100644
--- a/plugins/jetpack/modules/publicize/assets/publicize.min.css
+++ b/plugins/jetpack/modules/publicize/assets/publicize.min.css
@@ -1,2 +1,2 @@
/* Do not modify this file directly. It is concatenated from individual module CSS files. */
-div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 25px 5px 20px;overflow:hidden;max-width:1200px}span.pub-logos{float:left;display:block;width:130px;height:75px;margin-top:-18px;margin-left:5px;vertical-align:top}.left,.right{width:50%;float:left}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-right:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:right;float:right;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;position:static;right:auto;text-align:left;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-right:20px}table#option-profile td.thumbnail{padding-right:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-right:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red} \ No newline at end of file
+div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 25px 5px 20px;overflow:hidden;max-width:1200px}span.pub-logos{float:left;display:block;width:130px;height:75px;margin-top:-18px;margin-left:5px;vertical-align:top}.left,.right{width:50%;float:left}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-right:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:right;float:right;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;position:static;right:auto;text-align:left;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-right:20px}table#option-profile td.thumbnail{padding-right:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-right:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red} \ No newline at end of file
diff --git a/plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css b/plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css
index 9a8f314c..33ea3813 100644
--- a/plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css
+++ b/plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css
@@ -1,4 +1,4 @@
-/* This file was automatically generated on Jan 15 2014 20:27:52 */
+/* This file was automatically generated on Mar 01 2018 13:02:41 */
div#publicize-services-block {
display: block;
@@ -111,7 +111,6 @@ div.publicize-service-right li {
border-top-style: none;
border-top-width: 0px;
color: #CCC;
- cursor: auto;
display: inline;
font-family: sans-serif;
font-size: 20px;
diff --git a/plugins/jetpack/modules/publicize/enhanced-open-graph.php b/plugins/jetpack/modules/publicize/enhanced-open-graph.php
index 26322245..ba60b821 100644
--- a/plugins/jetpack/modules/publicize/enhanced-open-graph.php
+++ b/plugins/jetpack/modules/publicize/enhanced-open-graph.php
@@ -101,8 +101,8 @@ function enhanced_og_video( $tags ) {
if ( preg_match( '/((youtube|vimeo)\.com|youtu.be)/', $video_url ) ) {
if ( strstr( $video_url, 'youtube' ) ) {
$id = jetpack_get_youtube_id( $video_url );
- $video_url = 'http://www.youtube.com/v/' . $id . '?version=3&autohide=1';
- $secure_video_url = 'https://www.youtube.com/v/' . $id . '?version=3&autohide=1';
+ $video_url = 'http://www.youtube.com/embed/' . $id;
+ $secure_video_url = 'https://www.youtube.com/embed/' . $id;
} else if ( strstr( $video_url, 'vimeo' ) ) {
preg_match( '|vimeo\.com/(\d+)/?$|i', $video_url, $match );
$id = (int) $match[1];
diff --git a/plugins/jetpack/modules/publicize/publicize-jetpack.php b/plugins/jetpack/modules/publicize/publicize-jetpack.php
index 0923af21..9834fe20 100644
--- a/plugins/jetpack/modules/publicize/publicize-jetpack.php
+++ b/plugins/jetpack/modules/publicize/publicize-jetpack.php
@@ -138,6 +138,27 @@ class Publicize extends Publicize_Base {
return false;
}
+ function get_all_connections_for_user() {
+ $connections = Jetpack_Options::get_option( 'publicize_connections' );
+
+ $connections_to_return = array();
+ if ( ! empty( $connections ) ) {
+ foreach ( (array) $connections as $service_name => $connections_for_service ) {
+ foreach ( $connections_for_service as $id => $connection ) {
+ $user_id = intval( $connection['connection_data']['user_id'] );
+ // phpcs:ignore WordPress.PHP.YodaConditions.NotYoda
+ if ( $user_id === 0 || $this->user_id() === $user_id ) {
+ $connections_to_return[ $service_name ][ $id ] = $connection;
+ }
+ }
+ }
+
+ return $connections_to_return;
+ }
+
+ return false;
+ }
+
function get_connection_id( $connection ) {
return $connection['connection_data']['id'];
}
@@ -395,6 +416,10 @@ class Publicize extends Publicize_Base {
}
function flag_post_for_publicize( $new_status, $old_status, $post ) {
+ if ( ! $this->post_type_is_publicizeable( $post->post_type ) ) {
+ return;
+ }
+
if ( 'publish' == $new_status && 'publish' != $old_status ) {
/**
* Determines whether a post being published gets publicized.
diff --git a/plugins/jetpack/modules/publicize/publicize.php b/plugins/jetpack/modules/publicize/publicize.php
index 8f051f75..d438859c 100644
--- a/plugins/jetpack/modules/publicize/publicize.php
+++ b/plugins/jetpack/modules/publicize/publicize.php
@@ -46,7 +46,7 @@ abstract class Publicize_Base {
* Sets up the basics of Publicize
*/
function __construct() {
- $this->default_message = Publicize_Util::build_sprintf( array(
+ $this->default_message = self::build_sprintf( array(
/**
* Filter the default Publicize message.
*
@@ -61,7 +61,7 @@ abstract class Publicize_Base {
'url',
) );
- $this->default_prefix = Publicize_Util::build_sprintf( array(
+ $this->default_prefix = self::build_sprintf( array(
/**
* Filter the message prepended to the Publicize custom message.
*
@@ -75,7 +75,7 @@ abstract class Publicize_Base {
'url',
) );
- $this->default_suffix = Publicize_Util::build_sprintf( array(
+ $this->default_suffix = self::build_sprintf( array(
/**
* Filter the message appended to the Publicize custom message.
*
@@ -107,6 +107,7 @@ abstract class Publicize_Base {
// then check meta and publicize based on that. stage 3 implemented on wpcom
add_action( 'transition_post_status', array( $this, 'flag_post_for_publicize' ), 10, 3 );
add_action( 'save_post', array( &$this, 'save_meta' ), 20, 2 );
+ add_filter( 'post_updated_messages', array( $this, 'update_published_message' ), 20, 1 );
// Connection test callback
add_action( 'wp_ajax_test_publicize_conns', array( $this, 'test_publicize_conns' ) );
@@ -133,8 +134,8 @@ abstract class Publicize_Base {
/**
* Returns an external URL to the connection's profile
*/
- function get_profile_link( $service_name, $c ) {
- $cmeta = $this->get_connection_meta( $c );
+ function get_profile_link( $service_name, $connection ) {
+ $cmeta = $this->get_connection_meta( $connection );
if ( isset( $cmeta['connection_data']['meta']['link'] ) ) {
if ( 'facebook' == $service_name && 0 === strpos( parse_url( $cmeta['connection_data']['meta']['link'], PHP_URL_PATH ), '/app_scoped_user_id/' ) ) {
@@ -177,8 +178,8 @@ abstract class Publicize_Base {
/**
* Returns a display name for the connection
*/
- function get_display_name( $service_name, $c ) {
- $cmeta = $this->get_connection_meta( $c );
+ function get_display_name( $service_name, $connection ) {
+ $cmeta = $this->get_connection_meta( $connection );
if ( isset( $cmeta['connection_data']['meta']['display_name'] ) ) {
return $cmeta['connection_data']['meta']['display_name'];
@@ -211,8 +212,8 @@ abstract class Publicize_Base {
}
}
- function show_options_popup( $service_name, $c ) {
- $cmeta = $this->get_connection_meta( $c );
+ function show_options_popup( $service_name, $connection ) {
+ $cmeta = $this->get_connection_meta( $connection );
// always show if no selection has been made for facebook
if ( 'facebook' == $service_name && empty( $cmeta['connection_data']['meta']['facebook_profile'] ) && empty( $cmeta['connection_data']['meta']['facebook_page'] ) )
@@ -418,15 +419,99 @@ abstract class Publicize_Base {
// Next up will be ::publicize_post()
}
+ public function update_published_message( $messages ) {
+ global $post_type, $post_type_object, $post;
+ if ( ! $this->post_type_is_publicizeable( $post_type ) ) {
+ return $messages;
+ }
+ $view_post_link_html = '';
+ $viewable = is_post_type_viewable( $post_type_object );
+ if ( $viewable ) {
+ $view_text = esc_html__( 'View post' ); // intentionally omitted domain
+
+ if ( 'jetpack-portfolio' == $post_type ) {
+ $view_text = esc_html__( 'View project', 'jetpack' );
+ }
+
+ $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
+ esc_url( get_permalink( $post ) ),
+ $view_text
+ );
+ }
+
+ $services = $this->get_publicizing_services( $post->ID );
+ if ( empty( $services ) ) {
+ return $messages;
+ }
+
+ $labels = array();
+ foreach ( $services as $service => $display_names ) {
+ $labels[] = sprintf(
+ /* translators: Service name is %1$s, and account name is %2$s. */
+ esc_html__( '%1$s (%2$s)', 'jetpack' ),
+ esc_html( $service ),
+ esc_html( implode( ', ', $display_names ) )
+ );
+ }
+
+ $messages['post'][6] = sprintf(
+ /* translators: %1$s is a comma-separated list of services and accounts. Ex. Facebook (@jetpack), Twitter (@jetpack) */
+ esc_html__( 'Post published and sharing on %1$s.', 'jetpack' ),
+ implode( ', ', $labels )
+ ) . $view_post_link_html;
+
+ if ( $post_type == 'post' && class_exists('Jetpack_Subscriptions' ) ) {
+ $subscription = Jetpack_Subscriptions::init();
+ if ( $subscription->should_email_post_to_subscribers( $post ) ) {
+ $messages['post'][6] = sprintf(
+ /* translators: %1$s is a comma-separated list of services and accounts. Ex. Facebook (@jetpack), Twitter (@jetpack) */
+ esc_html__( 'Post published, sending emails to subscribers and sharing post on %1$s.', 'jetpack' ),
+ implode( ', ', $labels )
+ ) . $view_post_link_html;
+ }
+ }
+
+ $messages['jetpack-portfolio'][6] = sprintf(
+ /* translators: %1$s is a comma-separated list of services and accounts. Ex. Facebook (@jetpack), Twitter (@jetpack) */
+ esc_html__( 'Project published and sharing project on %1$s.', 'jetpack' ),
+ implode( ', ', $labels )
+ ) . $view_post_link_html;
+
+ return $messages;
+ }
+
+ function get_publicizing_services( $post_id ) {
+ $services = array();
+
+ foreach ( (array) $this->get_services( 'connected' ) as $service_name => $connections ) {
+ // services have multiple connections.
+ foreach ( $connections as $connection ) {
+ $unique_id = '';
+ if ( ! empty( $connection->unique_id ) )
+ $unique_id = $connection->unique_id;
+ else if ( ! empty( $connection['connection_data']['token_id'] ) )
+ $unique_id = $connection['connection_data']['token_id'];
+
+ // Did we skip this connection?
+ if ( get_post_meta( $post_id, $this->POST_SKIP . $unique_id, true ) ) {
+ continue;
+ }
+ $services[ $this->get_service_label( $service_name ) ][] = $this->get_display_name( $service_name, $connection );
+ }
+ }
+
+ return $services;
+ }
+
/**
- * Is a given post type Publicize-able?
- *
- * Not every CPT lends itself to Publicize-ation. Allow CPTs to register by adding their CPT via
- * the publicize_post_types array filter.
- *
- * @param string $post_type The post type to check.
- * $return bool True if the post type can be Publicized.
- */
+ * Is a given post type Publicize-able?
+ *
+ * Not every CPT lends itself to Publicize-ation. Allow CPTs to register by adding their CPT via
+ * the publicize_post_types array filter.
+ *
+ * @param string $post_type The post type to check.
+ * @return bool True if the post type can be Publicized.
+ */
function post_type_is_publicizeable( $post_type ) {
if ( 'post' == $post_type )
return true;
@@ -480,4 +565,33 @@ abstract class Publicize_Base {
wp_send_json_success( $test_results );
}
+
+ protected static function build_sprintf( $args ) {
+ $search = array();
+ $replace = array();
+ foreach ( $args as $k => $arg ) {
+ if ( 0 == $k ) {
+ $string = $arg;
+ continue;
+ }
+ $search[] = "%$arg%";
+ $replace[] = "%$k\$s";
+ }
+ return str_replace( $search, $replace, $string );
+ }
+}
+
+function publicize_calypso_url() {
+ $calypso_sharing_url = 'https://wordpress.com/sharing/';
+ if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) {
+ $site_suffix = Jetpack::build_raw_urls( home_url() );
+ } elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) {
+ $site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() );
+ }
+
+ if ( $site_suffix ) {
+ return $calypso_sharing_url . $site_suffix;
+ } else {
+ return $calypso_sharing_url;
+ }
}
diff --git a/plugins/jetpack/modules/publicize/ui.php b/plugins/jetpack/modules/publicize/ui.php
index 38215545..162c3ee0 100644
--- a/plugins/jetpack/modules/publicize/ui.php
+++ b/plugins/jetpack/modules/publicize/ui.php
@@ -86,9 +86,9 @@ class Publicize_UI {
'20121019'
);
if( is_rtl() ) {
- wp_enqueue_style( 'publicize', plugins_url( 'assets/rtl/publicize-rtl.css', __FILE__ ), array(), '20120925' );
+ wp_enqueue_style( 'publicize', plugins_url( 'assets/rtl/publicize-rtl.css', __FILE__ ), array(), '20180301' );
} else {
- wp_enqueue_style( 'publicize', plugins_url( 'assets/publicize.css', __FILE__ ), array(), '20120925' );
+ wp_enqueue_style( 'publicize', plugins_url( 'assets/publicize.css', __FILE__ ), array(), '20180301' );
}