summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/publicize')
-rw-r--r--plugins/jetpack/modules/publicize/assets/connected.gifbin1681 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/assets/facebook-logo.pngbin18719 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/assets/linkedin-logo.pngbin6783 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize-rtl.css227
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css1
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.css226
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.js184
-rw-r--r--plugins/jetpack/modules/publicize/assets/publicize.min.css2
-rw-r--r--plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css200
-rw-r--r--plugins/jetpack/modules/publicize/assets/spinner.gifbin457 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/assets/tumblr-logo.pngbin8902 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/assets/twitter-logo.pngbin4524 -> 0 bytes
-rw-r--r--plugins/jetpack/modules/publicize/publicize-jetpack.php20
-rw-r--r--plugins/jetpack/modules/publicize/publicize.php55
-rw-r--r--plugins/jetpack/modules/publicize/ui.php349
15 files changed, 143 insertions, 1121 deletions
diff --git a/plugins/jetpack/modules/publicize/assets/connected.gif b/plugins/jetpack/modules/publicize/assets/connected.gif
deleted file mode 100644
index 24e0c11f..00000000
--- a/plugins/jetpack/modules/publicize/assets/connected.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/assets/facebook-logo.png b/plugins/jetpack/modules/publicize/assets/facebook-logo.png
deleted file mode 100644
index 785d0850..00000000
--- a/plugins/jetpack/modules/publicize/assets/facebook-logo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/assets/linkedin-logo.png b/plugins/jetpack/modules/publicize/assets/linkedin-logo.png
deleted file mode 100644
index b480ce54..00000000
--- a/plugins/jetpack/modules/publicize/assets/linkedin-logo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/assets/publicize-rtl.css b/plugins/jetpack/modules/publicize/assets/publicize-rtl.css
deleted file mode 100644
index eb1eacbb..00000000
--- a/plugins/jetpack/modules/publicize/assets/publicize-rtl.css
+++ /dev/null
@@ -1,227 +0,0 @@
-/* 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 20px 5px 25px;
- overflow: hidden;
- max-width: 1200px;
-}
-
-/* Add the logos for the Publicize services */
-span.pub-logos {
- float: right;
- display: block;
- width: 130px;
- height: 75px;
- margin-top: -18px;
- margin-right: 5px;
- vertical-align: top;
-}
-
-@media screen and ( min-width: 782px ) {
- .left, .right {
- width: 50%;
- float: right;
- }
- div.publicize-service-entry:last-of-type{
- border-width: 0px;
- }
-}
-
-div#facebook:before {
- color: #3B5998;
- content: '\f203';
-}
-
-div#twitter:before {
- color: #1DA1F2;
- content: '\f610';
-}
-
-div#linkedin:before {
- color: #0077b5;
- content: '\f207';
-}
-
-div#tumblr:before {
- color: #35465c;
- content: '\f214';
-}
-
-div#google_plus:before {
- color: #dd4b39;
- content: '\f206';
-}
-
-div.publicize-service-left:before {
- font: normal 30px/1 social-logos;
- vertical-align: middle;
-}
-
-a.publicize-profile-link, a.publicize-profile-link:visited {
- text-decoration: none;
- font-weight: bold;
-}
-
-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;
-}
-
-.right div.publicize-service-entry:last-of-type{
- border-width: 0px;
-}
-
-div.publicize-service-left {
- display: inline-block;
- width: 150px;
- vertical-align: top;
- min-height: 35px;
-}
-
-div.publicize-service-left a{
- font-size: 18px;
- 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: 0px;
- border-right-color: #CCC;
- border-right-style: none;
- border-right-width: 0px;
- border-left-color: #CCC;
- border-left-style: none;
- border-left-width: 0px;
- border-top-color: #CCC;
- border-top-style: none;
- border-top-width: 0px;
- color: #CCC;
- display: inline;
- font-size: 20px;
- font-style: normal;
- font-weight: normal;
- height: auto;
- line-height: 22px;
- list-style-image: none;
- list-style-position: outside;
- list-style-type: none;
- margin-bottom: 0px;
- margin-right: 0px;
- margin-left: 0px;
- margin-top: 0px;
- outline-color: #CCC;
- outline-style: none;
- outline-width: 0px;
- overflow-y: visible;
- padding-bottom: 0px;
- padding-right: 0px;
- padding-left: 0px;
- padding-top: 0px;
- 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: bold; color: #333333
-}
-
-table#option-fb-fanpage td, table#option-fanpage td {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- vertical-align: middle;
-}
-
-table#option-fb-fanpage td.thumbnail, table#option-fanpage td.thumbnail {
- padding: 5px 20px 5px 20px;
-}
-
-table#option-fb-fanpage td.details, table#option-fanpage td.details {
- width: 130px;
- padding-left: 10px;
-}
-
-table#option-fb-fanpage td.details span.name, table#option-fanpage td.details span.name {
- font-weight: bold; color: #333333;
-}
-
-table#option-fb-fanpage td.details span.category, table#option-fanpage td.details span.category {
- font-size: 10px; color: #888888;
-}
-
-input.fb-options {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- font-size: 12px;
-}
-
-.pub-connection-error {
- color: #ff0000;
-}
-
-.pub-connection-test. test-failed p { margin-top: 0; }
diff --git a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css b/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css
deleted file mode 100644
index a0e4a6f4..00000000
--- a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css
+++ /dev/null
@@ -1 +0,0 @@
-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}@media screen and (min-width:782px){.left,.right{width:50%;float:right}div.publicize-service-entry:last-of-type{border-width:0}}div#facebook:before{color:#3b5998;content:'\f203'}div#twitter:before{color:#1da1f2;content:'\f610'}div#linkedin:before{color:#0077b5;content:'\f207'}div#tumblr:before{color:#35465c;content:'\f214'}div#google_plus:before{color:#dd4b39;content:'\f206'}div.publicize-service-left:before{font:normal 30px/1 social-logos;vertical-align:middle}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}.right 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:18px;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}.pub-connection-test. test-failed p{margin-top:0} \ No newline at end of file
diff --git a/plugins/jetpack/modules/publicize/assets/publicize.css b/plugins/jetpack/modules/publicize/assets/publicize.css
deleted file mode 100644
index 4b4054f5..00000000
--- a/plugins/jetpack/modules/publicize/assets/publicize.css
+++ /dev/null
@@ -1,226 +0,0 @@
-div#publicize-services-block {
- display: block;
- clear: both;
- margin-bottom: 25px;
- background-color: #fff;
- padding: 25px 25px 5px 20px;
- overflow: hidden;
- max-width: 1200px;
-}
-
-/* Add the logos for the Publicize services */
-span.pub-logos {
- float: left;
- display: block;
- width: 130px;
- height: 75px;
- margin-top: -18px;
- margin-left: 5px;
- vertical-align: top;
-}
-
-@media screen and ( min-width: 782px ) {
- .left, .right {
- width: 50%;
- float: left;
- }
- div.publicize-service-entry:last-of-type{
- border-width: 0px;
- }
-}
-
-div#facebook:before {
- color: #3B5998;
- content: '\f203';
-}
-
-div#twitter:before {
- color: #1DA1F2;
- content: '\f610';
-}
-
-div#linkedin:before {
- color: #0077b5;
- content: '\f207';
-}
-
-div#tumblr:before {
- color: #35465c;
- content: '\f214';
-}
-
-div#google_plus:before {
- color: #dd4b39;
- content: '\f206';
-}
-
-div.publicize-service-left:before {
- font: normal 30px/1 social-logos;
- vertical-align: middle;
-}
-
-a.publicize-profile-link, a.publicize-profile-link:visited {
- text-decoration: none;
- font-weight: bold;
-}
-
-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;
-}
-
-.right div.publicize-service-entry:last-of-type{
- border-width: 0px;
-}
-
-div.publicize-service-left {
- display: inline-block;
- width: 150px;
- vertical-align: top;
- min-height: 35px;
-}
-
-div.publicize-service-left a{
- font-size: 18px;
- 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: 0px;
- border-left-color: #CCC;
- border-left-style: none;
- border-left-width: 0px;
- border-right-color: #CCC;
- border-right-style: none;
- border-right-width: 0px;
- border-top-color: #CCC;
- border-top-style: none;
- border-top-width: 0px;
- color: #CCC;
- display: inline;
- font-size: 20px;
- font-style: normal;
- font-weight: normal;
- height: auto;
- line-height: 22px;
- list-style-image: none;
- list-style-position: outside;
- list-style-type: none;
- margin-bottom: 0px;
- margin-left: 0px;
- margin-right: 0px;
- margin-top: 0px;
- outline-color: #CCC;
- outline-style: none;
- outline-width: 0px;
- overflow-y: visible;
- padding-bottom: 0px;
- padding-left: 0px;
- padding-right: 0px;
- padding-top: 0px;
- 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: bold; color: #333333
-}
-
-table#option-fb-fanpage td, table#option-fanpage td {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- vertical-align: middle;
-}
-
-table#option-fb-fanpage td.thumbnail, table#option-fanpage td.thumbnail {
- padding: 5px 20px 5px 20px;
-}
-
-table#option-fb-fanpage td.details, table#option-fanpage td.details {
- width: 130px;
- padding-right: 10px;
-}
-
-table#option-fb-fanpage td.details span.name, table#option-fanpage td.details span.name {
- font-weight: bold; color: #333333;
-}
-
-table#option-fb-fanpage td.details span.category, table#option-fanpage td.details span.category {
- font-size: 10px; color: #888888;
-}
-
-input.fb-options {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- font-size: 12px;
-}
-
-.pub-connection-error {
- color: #ff0000;
-}
-
-.pub-connection-test. test-failed p { margin-top: 0; }
diff --git a/plugins/jetpack/modules/publicize/assets/publicize.js b/plugins/jetpack/modules/publicize/assets/publicize.js
deleted file mode 100644
index 9227dbd8..00000000
--- a/plugins/jetpack/modules/publicize/assets/publicize.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/* jshint onevar: false, smarttabs: true */
-/* global tb_show, tb_pathToImage, ajaxurl, tb_init, tb_remove */
-/* global myblogsResponse, publicizeConnTestStart:true, publicizeConnTestComplete:true, publicizeConnRefreshClick:true */
-
-var showOptionsPage;
-
-jQuery( function( $ ) {
-
- showOptionsPage = function( service, nonce, connection, blogId ) {
- tb_show( null, null, null );
- $('body').append( '<div id=\'TB_load\'><img src=\'' + tb_pathToImage + '\' /></div>' );
- $('#TB_load').show();
-
- var query = '';
- if ( connection ) {
- query += '&connection=' + encodeURIComponent( connection );
- }
- if ( 'undefined' !== typeof( blogId ) && blogId ) {
- query += '&blog_id=' + Number( blogId );
- }
-
- $.post( ajaxurl, 'action=publicize_' + service + '_options_page&_wpnonce=' + nonce + query, function( response ) {
- $('#TB_load').remove();
-
- try {
- var obj = jQuery.parseJSON( response );
- if ( obj && 'object' === typeof( obj ) ) {
- if ( obj.hasOwnProperty( 'fb_redirect' ) ) {
- location.href = obj.fb_redirect + '&redirect_uri=' + encodeURIComponent( location.href );
- return;
- }
- }
- } catch (err) {
- // Do nothing and move on
- }
-
- if ( response ) {
- var blogID = $( 'input[name=wpas_ajax_blog_id]' ).val();
-
- var message = $( '<div id="wpas-ajax-' + blogID + '" class="wrap"></div>' ).append( response );
- message.append( '<a href="#TB_inline?thickbox&height=420&width=555&inlineId=wpas-ajax-' + blogID + '" id="wpas-click-' + blogID + '" class="new-thickbox" style="display: none;"></a>' );
- $('#wpas-message').html( message );
-
-
- tb_init( 'a.new-thickbox' );
- $('#wpas-click-' + blogID).click();
-
- var tb_height = parseInt( $('#TB_ajaxContent').css('height'), 10 );
- var content_height = $('#thickbox-content').height();
- if ( content_height < tb_height ) {
- var new_height = content_height + 15;
- $('#TB_ajaxContent').css( 'height', new_height );
-
- var new_margin = parseInt( $('#TB_window').css( 'margin-top'), 10 ) + (tb_height - new_height) / 2 + 'px';
- $('#TB_window').css( 'margin-top', new_margin);
- }
-
- $('.save-options').unbind('click').click( function() {
- var sel = $( 'input[name=\'option\']:checked' );
- var global = $( 'input[name=\'global\']:checked' );
-
- var connection = $(this).data('connection');
- var token = encodeURIComponent( sel.val() );
- var id = encodeURIComponent( sel.attr( 'id' ) );
- var type = encodeURIComponent( sel.attr( 'data-type' ) );
- var nonce = $(this).attr('rel');
- var global_conn = 'off';
- var global_nonce = '';
-
- if ( global.length ) {
- global_conn = 'on';
- global_nonce = global.val();
- }
-
- $.post( ajaxurl, 'action=publicize_'+ service + '_options_save&connection=' + connection + '&selected_id=' + id + '&token=' + token + '&type=' + type + '&_wpnonce=' + nonce + '&global=' + global_conn + '&global_nonce=' + global_nonce, function( /*response*/ ) {
- var frameNonce;
- tb_remove();
- frameNonce = document.location.search.match( /frame-nonce=([^&]+)/ );
- if ( /inside-newdash=1/.test( document.location.search ) && frameNonce ) {
- document.location = 'options-general.php?page=sharing&inside-newdash=1&frame-nonce' + frameNonce[1];
- } else {
- top.location = 'options-general.php?page=sharing';
- }
- } );
-
- } );
- }
-
- }, 'html' );
- };
-
- $( 'body' ).append( '<div id="wpas-message" style="display: none"></div>' );
-
- $( '.wpas-posts' ).change( function() {
- var inputs = $(this).parents( 'td:first' ).find( ':input' );
- var _this = this;
- var blogID = inputs.filter( '[name=wpas_ajax_blog_id]' ).val();
-
- $( '#waiting_' + blogID ).show();
- $.post( ajaxurl, inputs.serialize() + '&action=wpas_post', function( response ) { myblogsResponse.call( _this, blogID, response ); }, 'html' );
- } );
-
- $( '.options' ).unbind('click').bind( 'click', function(e) {
- e.preventDefault();
- e.stopPropagation();
-
- var service = $(this).attr('class').replace( 'options ', '' );
-
- var blogId = null;
- if ( 'undefined' !== typeof( $(this).attr('id') ) ) {
- blogId = parseInt( $(this).attr('id').replace( 'options-', '' ), 10 );
- }
-
- var nonce = $(this).attr('href').replace( '#nonce=', '' );
- var connection = $(this).data( 'connection' );
- showOptionsPage.call( this, service, nonce, connection, blogId );
- });
-
- /**
- * Kicks off tests for all connections
- */
- publicizeConnTestStart = function() {
- $( '.pub-connection-test' )
- .addClass( 'test-in-progress' );
- $.post( ajaxurl, { action: 'test_publicize_conns' }, publicizeConnTestComplete );
- };
-
- publicizeConnRefreshClick = function( event ) {
- event.preventDefault();
- var popupURL = event.currentTarget.href;
- var popupTitle = event.currentTarget.title;
- // open a popup window
- // when it is closed, kick off the tests again
- var popupWin = window.open( popupURL, popupTitle, '' );
- var popupWinTimer= window.setInterval( function() {
- if ( popupWin.closed !== false ) {
- window.clearInterval( popupWinTimer );
- publicizeConnTestStart();
- }
- }, 500 );
- };
-
- publicizeConnTestComplete = function( response ) {
- $( '.pub-connection-test' ).removeClass( 'test-in-progress' );
-
- $.each( response.data, function( index, testResult ) {
- // find the li for this connection
- var testSelector = '#pub-connection-test-' + testResult.connectionID;
- if ( testResult.connectionTestPassed ) {
- $( testSelector )
- .addClass( 'test-passed' )
- .html( '' )
- .removeClass( 'test-failed' );
- } else {
- $( testSelector )
- .addClass( 'test-failed' )
- .html( '<p><span class="pub-connection-error">' + testResult.connectionTestMessage + '</span></p>' )
- .removeClass( 'test-passed' );
-
- if ( testResult.userCanRefresh ) {
- $( testSelector )
- .append( '<br/>' );
- $( '<a/>', {
- 'class' : 'pub-refresh-button button',
- 'title' : testResult.refreshText,
- 'href' : testResult.refreshURL,
- 'text' : testResult.refreshText,
- 'target' : '_refresh_' + testResult.serviceName
- } )
- .appendTo( testSelector )
- .click( publicizeConnRefreshClick );
- }
- }
- } );
- };
-
- $( document ).ready( function() {
- // If we have at least one .pub-connection-test div present, kick off the connection test
- if ( $( '.pub-connection-test' ).length ) {
- publicizeConnTestStart();
- }
- } );
-
-} );
diff --git a/plugins/jetpack/modules/publicize/assets/publicize.min.css b/plugins/jetpack/modules/publicize/assets/publicize.min.css
deleted file mode 100644
index fd7b8c59..00000000
--- a/plugins/jetpack/modules/publicize/assets/publicize.min.css
+++ /dev/null
@@ -1,2 +0,0 @@
-/* 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}@media screen and (min-width:782px){.left,.right{width:50%;float:left}div.publicize-service-entry:last-of-type{border-width:0}}div#facebook:before{color:#3b5998;content:'\f203'}div#twitter:before{color:#1da1f2;content:'\f610'}div#linkedin:before{color:#0077b5;content:'\f207'}div#tumblr:before{color:#35465c;content:'\f214'}div#google_plus:before{color:#dd4b39;content:'\f206'}div.publicize-service-left:before{font:normal 30px/1 social-logos;vertical-align:middle}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}.right 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:18px;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}.pub-connection-test. test-failed p{margin-top:0} \ 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
deleted file mode 100644
index 33ea3813..00000000
--- a/plugins/jetpack/modules/publicize/assets/rtl/publicize-rtl.css
+++ /dev/null
@@ -1,200 +0,0 @@
-/* This file was automatically generated on Mar 01 2018 13:02:41 */
-
-div#publicize-services-block {
- display: block;
- clear: both;
- margin-bottom: 25px;
- background-color: #fff;
- padding: 25px 20px 5px 25px;
- overflow: hidden;
- max-width: 1200px;
-}
-
-/* Add the logos for the Publicize services */
-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: 0px 0px;padding-top:5px; }
-div#twitter { background: url( ../publicize-twitter-2x.png ) no-repeat; background-size: 32px 32px; padding-right: 42px;background-position: 0px 0px;padding-top:5px; }
-div#linkedin { background: url( ../publicize-linkedin-2x.png )no-repeat; background-size: 32px 32px; padding-right: 42px;background-position: 0px 0px;padding-top:5px; }
-div#tumblr { background: url( ../publicize-tumblr-2x.png ) no-repeat; background-size: 32px 32px; padding-right: 42px;background-position: 0px 0px;padding-top:5px; }
-div#path { background: url( ../publicize-path-2x.png ) no-repeat; background-size: 32px 32px; padding-right: 42px;background-position: 0px 0px;padding-top:5px; }
-div#google_plus { background: url( ../publicize-google-2x.png ) no-repeat; background-size: 32px 32px; padding-right: 42px;background-position: 0px 0px;padding-top:5px; }
-
-a.publicize-profile-link, a.publicize-profile-link:visited {
- text-decoration: none;
- font-weight: bold;
-}
-
-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: 0px;
-}
-
-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: 0px;
- border-right-color: #CCC;
- border-right-style: none;
- border-right-width: 0px;
- border-left-color: #CCC;
- border-left-style: none;
- border-left-width: 0px;
- border-top-color: #CCC;
- border-top-style: none;
- border-top-width: 0px;
- color: #CCC;
- display: inline;
- font-family: sans-serif;
- font-size: 20px;
- font-style: normal;
- font-weight: normal;
- height: auto;
- line-height: 22px;
- list-style-image: none;
- list-style-position: outside;
- list-style-type: none;
- margin-bottom: 0px;
- margin-right: 0px;
- margin-left: 0px;
- margin-top: 0px;
- outline-color: #CCC;
- outline-style: none;
- outline-width: 0px;
- overflow-y: visible;
- padding-bottom: 0px;
- padding-right: 0px;
- padding-left: 0px;
- padding-top: 0px;
- 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: bold; color: #333333
-}
-
-table#option-fb-fanpage td, table#option-fanpage td {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- vertical-align: middle;
-}
-
-table#option-fb-fanpage td.thumbnail, table#option-fanpage td.thumbnail {
- padding: 5px 20px 5px 20px;
-}
-
-table#option-fb-fanpage td.details, table#option-fanpage td.details {
- width: 130px;
- padding-left: 10px;
-}
-
-table#option-fb-fanpage td.details span.name, table#option-fanpage td.details span.name {
- font-weight: bold; color: #333333;
-}
-
-table#option-fb-fanpage td.details span.category, table#option-fanpage td.details span.category {
- font-size: 10px; color: #888888;
-}
-
-input.fb-options {
- font-family: "Lucida Grande",Verdana,Arial,sans-serif;
- font-size: 12px;
-}
-
-.pub-connection-error {
- color: #ff0000;
-}
diff --git a/plugins/jetpack/modules/publicize/assets/spinner.gif b/plugins/jetpack/modules/publicize/assets/spinner.gif
deleted file mode 100644
index 6e5bace6..00000000
--- a/plugins/jetpack/modules/publicize/assets/spinner.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/assets/tumblr-logo.png b/plugins/jetpack/modules/publicize/assets/tumblr-logo.png
deleted file mode 100644
index ac26184e..00000000
--- a/plugins/jetpack/modules/publicize/assets/tumblr-logo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/assets/twitter-logo.png b/plugins/jetpack/modules/publicize/assets/twitter-logo.png
deleted file mode 100644
index f8ab3aa2..00000000
--- a/plugins/jetpack/modules/publicize/assets/twitter-logo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/jetpack/modules/publicize/publicize-jetpack.php b/plugins/jetpack/modules/publicize/publicize-jetpack.php
index 8ab8e95c..b2ec20e8 100644
--- a/plugins/jetpack/modules/publicize/publicize-jetpack.php
+++ b/plugins/jetpack/modules/publicize/publicize-jetpack.php
@@ -13,13 +13,11 @@ class Publicize extends Publicize_Base {
add_action( 'wp_ajax_publicize_facebook_options_page', array( $this, 'options_page_facebook' ) );
add_action( 'wp_ajax_publicize_twitter_options_page', array( $this, 'options_page_twitter' ) );
add_action( 'wp_ajax_publicize_linkedin_options_page', array( $this, 'options_page_linkedin' ) );
- add_action( 'wp_ajax_publicize_google_plus_options_page', array( $this, 'options_page_google_plus' ) );
add_action( 'wp_ajax_publicize_tumblr_options_save', array( $this, 'options_save_tumblr' ) );
add_action( 'wp_ajax_publicize_facebook_options_save', array( $this, 'options_save_facebook' ) );
add_action( 'wp_ajax_publicize_twitter_options_save', array( $this, 'options_save_twitter' ) );
add_action( 'wp_ajax_publicize_linkedin_options_save', array( $this, 'options_save_linkedin' ) );
- add_action( 'wp_ajax_publicize_google_plus_options_save', array( $this, 'options_save_google_plus' ) );
add_action( 'load-settings_page_sharing', array( $this, 'force_user_connection' ) );
@@ -117,7 +115,11 @@ class Publicize extends Publicize_Base {
}
function get_all_connections() {
- return Jetpack_Options::get_option( 'publicize_connections' );
+ $connections = Jetpack_Options::get_option( 'publicize_connections' );
+ if ( isset( $connections['google_plus'] ) ) {
+ unset( $connections['google_plus'] );
+ }
+ return $connections;
}
function get_connections( $service_name, $_blog_id = false, $_user_id = false ) {
@@ -239,12 +241,11 @@ class Publicize extends Publicize_Base {
function globalization() {
if ( 'on' == $_REQUEST['global'] ) {
$globalize_connection = $_REQUEST['connection'];
-
if ( ! current_user_can( $this->GLOBAL_CAP ) ) {
return;
}
- $this->globalize_connection( $connection_id );
+ $this->globalize_connection( $globalize_connection );
}
}
@@ -298,7 +299,6 @@ class Publicize extends Publicize_Base {
'twitter' => array(),
'linkedin' => array(),
'tumblr' => array(),
- 'google_plus' => array(),
);
if ( 'all' == $filter ) {
@@ -674,10 +674,6 @@ class Publicize extends Publicize_Base {
Publicize_UI::options_page_other( 'linkedin' );
}
- function options_page_google_plus() {
- Publicize_UI::options_page_other( 'google_plus' );
- }
-
function options_save_twitter() {
$this->options_save_other( 'twitter' );
}
@@ -686,10 +682,6 @@ class Publicize extends Publicize_Base {
$this->options_save_other( 'linkedin' );
}
- function options_save_google_plus() {
- $this->options_save_other( 'google_plus' );
- }
-
function options_save_other( $service_name ) {
// Nonce check
check_admin_referer( 'save_' . $service_name . '_token_' . $_REQUEST['connection'] );
diff --git a/plugins/jetpack/modules/publicize/publicize.php b/plugins/jetpack/modules/publicize/publicize.php
index 5821a871..73632d4e 100644
--- a/plugins/jetpack/modules/publicize/publicize.php
+++ b/plugins/jetpack/modules/publicize/publicize.php
@@ -40,7 +40,7 @@ abstract class Publicize_Base {
* All users with this cap can un-globalize all other global connections, and globalize any of their own
* Globalized connections cannot be unselected by users without this capability when publishing
*/
- public $GLOBAL_CAP = 'edit_others_posts';
+ public $GLOBAL_CAP = 'publish_posts';
/**
* Sets up the basics of Publicize
@@ -119,7 +119,7 @@ abstract class Publicize_Base {
add_action( 'init', array( $this, 'add_post_type_support' ) );
add_action( 'init', array( $this, 'register_post_meta' ), 20 );
- add_action( 'init', array( $this, 'register_gutenberg_extension' ), 30 );
+ add_action( 'jetpack_register_gutenberg_extensions', array( $this, 'register_gutenberg_extension' ) );
}
/*
@@ -140,6 +140,10 @@ abstract class Publicize_Base {
*/
abstract function get_services( $filter = 'all', $_blog_id = false, $_user_id = false );
+ function can_connect_service( $service_name ) {
+ return true;
+ }
+
/**
* Does the given user have a connection to the service on the given blog?
*
@@ -204,9 +208,6 @@ abstract class Publicize_Base {
case 'linkedin':
return 'LinkedIn';
break;
- case 'google_plus':
- return 'Google+';
- break;
case 'twitter':
case 'facebook':
case 'tumblr':
@@ -331,10 +332,6 @@ abstract class Publicize_Base {
return 'http://' . $cmeta['connection_data']['meta']['tumblr_base_hostname'];
} elseif ( 'twitter' == $service_name ) {
return 'https://twitter.com/' . substr( $cmeta['external_display'], 1 ); // Has a leading '@'
- } elseif ( 'google_plus' == $service_name && isset( $cmeta['connection_data']['meta']['google_plus_page'] ) ) {
- return 'https://plus.google.com/' . $cmeta['connection_data']['meta']['google_plus_page'];
- } elseif ( 'google_plus' == $service_name ) {
- return 'https://plus.google.com/' . $cmeta['external_id'];
} else if ( 'linkedin' == $service_name ) {
if ( !isset( $cmeta['connection_data']['meta']['profile_url'] ) ) {
return false;
@@ -430,6 +427,19 @@ abstract class Publicize_Base {
}
/**
+ * LinkedIn needs to be reauthenticated to use v2 of their API.
+ * If it's using LinkedIn old API, it's an 'invalid' connection
+ *
+ * @param object|array The Connection object (WordPress.com) or array (Jetpack)
+ * @return bool
+ */
+ function is_invalid_linkedin_connection( $connection ) {
+ // LinkedIn API v1 included the profile link in the connection data.
+ $connection_meta = $this->get_connection_meta( $connection );
+ return isset( $connection_meta['connection_data']['meta']['profile_url'] );
+ }
+
+ /**
* Whether the Connection currently being connected
*
* @param object|array The Connection object (WordPress.com) or array (Jetpack)
@@ -498,10 +508,17 @@ abstract class Publicize_Base {
if ( ! $this->is_valid_facebook_connection( $connection ) ) {
$connection_test_passed = false;
$user_can_refresh = false;
- $connection_test_message = __( 'Facebook no longer supports Publicize connections to Facebook Profiles, but you can still connect Facebook Pages. Please select a Facebook Page to publish updates to.' );
+ $connection_test_message = __( 'Please select a Facebook Page to publish updates.', 'jetpack' );
}
}
+ // LinkedIn needs reauthentication to be compatible with v2 of their API
+ if ( 'linkedin' === $service_name && $this->is_invalid_linkedin_connection( $connection ) ) {
+ $connection_test_passed = 'must_reauth';
+ $user_can_refresh = false;
+ $connection_test_message = esc_html__( 'Your LinkedIn connection needs to be reauthenticated to continue working – head to Sharing to take care of it.', 'jetpack' );
+ }
+
$unique_id = null;
if ( ! empty( $connection->unique_id ) ) {
$unique_id = $connection->unique_id;
@@ -780,9 +797,15 @@ abstract class Publicize_Base {
* Register the Publicize Gutenberg extension
*/
function register_gutenberg_extension() {
- // TODO: Not really a block. The underlying logic doesn't care, so we should rename to
- // `jetpack_register_gutenberg_extension()` (to account for both Gutenblocks and Gutenplugins).
- jetpack_register_block( 'publicize' );
+ // TODO: The `gutenberg/available-extensions` endpoint currently doesn't accept a post ID,
+ // so we cannot pass one to `$this->current_user_can_access_publicize_data()`.
+
+ if ( $this->current_user_can_access_publicize_data() ) {
+ Jetpack_Gutenberg::set_extension_available( 'jetpack/publicize' );
+ } else {
+ Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/publicize', 'unauthorized' );
+
+ }
}
/**
@@ -1030,6 +1053,12 @@ abstract class Publicize_Base {
if ( ! $this->post_type_is_publicizeable( $post_type ) ) {
return $messages;
}
+
+ // Bail early if the post is private.
+ if ( 'publish' !== $post->post_status ) {
+ return $messages;
+ }
+
$view_post_link_html = '';
$viewable = is_post_type_viewable( $post_type_object );
if ( $viewable ) {
diff --git a/plugins/jetpack/modules/publicize/ui.php b/plugins/jetpack/modules/publicize/ui.php
index 1cadc21d..43a6c05f 100644
--- a/plugins/jetpack/modules/publicize/ui.php
+++ b/plugins/jetpack/modules/publicize/ui.php
@@ -10,6 +10,9 @@ class Publicize_UI {
*/
public $publicize;
+ /**
+ * @var string URL to Sharing settings page in wordpress.com
+ */
protected $publicize_settings_url = '';
/**
@@ -24,13 +27,7 @@ class Publicize_UI {
}
function init() {
- $this->publicize_settings_url = apply_filters_deprecated(
- 'jetpack_override_publicize_settings_url',
- array( admin_url( 'options-general.php?page=sharing' ) ),
- '6.7',
- false,
- __( 'This filter will be removed in a future version of Jetpack', 'jetpack' )
- );
+ $this->publicize_settings_url = publicize_calypso_url();
// Show only to users with the capability required to manage their Publicize connections.
if ( ! $this->publicize->current_user_can_access_publicize_data() ) {
@@ -50,13 +47,13 @@ class Publicize_UI {
}
/**
- * If the ShareDaddy plugin is not active we need to add the sharing settings page to the menu still
- */
+ * If the ShareDaddy plugin is not active we need to add the sharing settings page to the menu still
+ */
function sharing_menu() {
add_submenu_page(
'options-general.php',
- __( 'Sharing Settings', 'jetpack' ),
- __( 'Sharing', 'jetpack' ),
+ esc_html__( 'Sharing Settings', 'jetpack' ),
+ esc_html__( 'Sharing', 'jetpack' ),
'publish_posts',
'sharing',
array( $this, 'wrapper_admin_page' )
@@ -64,20 +61,21 @@ class Publicize_UI {
}
function wrapper_admin_page() {
- Jetpack_Admin_Page::wrap_ui( array( $this, 'management_page' ), array( 'is-wide' => true ) );
+ Jetpack_Admin_Page::wrap_ui( array( $this, 'management_page' ) );
}
+
/**
- * Management page to load if Sharedaddy is not active so the 'pre_admin_screen_sharing' action exists.
- */
+ * Management page to load if Sharedaddy is not active so the 'pre_admin_screen_sharing' action exists.
+ */
function management_page() { ?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br /></div>
- <h1><?php _e( 'Sharing Settings', 'jetpack' ); ?></h1>
+ <h1><?php esc_html_e( 'Sharing Settings', 'jetpack' ); ?></h1>
- <?php
- /** This action is documented in modules/sharedaddy/sharing.php */
- do_action( 'pre_admin_screen_sharing' );
- ?>
+ <?php
+ /** This action is documented in modules/sharedaddy/sharing.php */
+ do_action( 'pre_admin_screen_sharing' );
+ ?>
</div> <?php
}
@@ -87,50 +85,7 @@ class Publicize_UI {
* JS for the options and switching
*/
function load_assets() {
- wp_enqueue_script(
- 'publicize',
- Jetpack::get_file_url_for_environment(
- '_inc/build/publicize/assets/publicize.min.js',
- 'modules/publicize/assets/publicize.js'
- ),
- array( 'jquery', 'thickbox' ),
- '20121019'
- );
- if ( is_rtl() ) {
- 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(), '20180301' );
- }
-
Jetpack_Admin_Page::load_wrapper_styles();
- wp_enqueue_style( 'social-logos' );
-
- add_thickbox();
- }
-
- public static function connected_notice( $service_name ) { ?>
- <div class='updated'>
- <p><?php
-
- if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
- $platform = 'WordPress.com';
- } else {
- $platform = 'Jetpack';
- }
-
- printf(
- /* translators: %1$s: Service Name (Facebook, Twitter, ...), %2$s: Site type (WordPress.com or Jetpack) */
- __( 'You have successfully connected your %1$s account with %2$s.', 'jetpack' ),
- Publicize::get_service_label( $service_name ),
- $platform
- ); ?></p>
- </div><?php
- }
-
- public static function denied_notice() { ?>
- <div class='updated'>
- <p><?php _e ( "You have chosen not to connect your blog. Please click 'accept' when prompted if you wish to connect your accounts.", 'jetpack' ); ?></p>
- </div><?php
}
/**
@@ -138,201 +93,21 @@ class Publicize_UI {
* looks exactly like Publicize v1 for now, UI and functionality updates will come after the move to keyring
*/
function admin_page() {
- $override_publicize_settings_page = apply_filters_deprecated(
- 'jetpack_override_publicize_settings_page',
- array( false ),
- '6.7',
- false,
- __( 'This filter will be removed in a future version of Jetpack', 'jetpack' )
- );
-
- if ( $override_publicize_settings_page ) {
- echo $override_publicize_settings_page;
- return;
- }
-
- $_blog_id = get_current_blog_id();
- ?>
-
- <form action="" id="publicize-form">
- <h2 id="publicize"><?php _e( 'Publicize', 'jetpack' ) ?></h2>
-
- <?php
- if ( ! empty( $_GET['action'] ) && 'deny' == $_GET['action'] ) {
- $this->denied_notice();
- }
- ?>
-
- <p>
- <?php esc_html_e( 'Connect your blog to popular social networking sites and automatically share new posts with your friends.', 'jetpack' ) ?>
- <?php esc_html_e( 'You can make a connection for just yourself or for all users on your blog. Shared connections are marked with the (Shared) text.', 'jetpack' ); ?>
- </p>
-
- <?php
- if ( $this->in_jetpack ) {
- $doc_link = "http://jetpack.com/support/publicize/";
- } else {
- $doc_link = "http://en.support.wordpress.com/publicize/";
- }
- ?>
-
- <p>&rarr; <a href="<?php echo esc_url( $doc_link ); ?>" rel="noopener noreferrer" target="_blank"><?php esc_html_e( 'More information on using Publicize.', 'jetpack' ); ?></a></p>
-
- <div id="publicize-services-block">
- <?php
- $services = $this->publicize->get_services( 'all' );
- $total_num_of_services = count ( $services );
- $service_num = 0;?>
-
- <div class='left'>
-
- <?php
- foreach ( $services as $service_name => $service ) :
- $connect_url = $this->publicize->connect_url( $service_name );
- if ( $service_num == ( round ( ( $total_num_of_services / 2 ), 0 ) ) )
- echo "</div><div class='right'>";
- $service_num++;
- ?>
- <div class="publicize-service-entry" <?php if ( $service_num > 0 ): ?>class="connected"<?php endif; ?> >
- <div id="<?php echo esc_attr( $service_name ); ?>" class="publicize-service-left">
- <a href="<?php echo esc_url( $connect_url ); ?>" id="service-link-<?php echo esc_attr( $service_name ); ?>" target="_top"><?php echo $this->publicize->get_service_label( $service_name ); ?></a>
- </div>
-
-
- <div class="publicize-service-right">
- <?php if ( $this->publicize->is_enabled( $service_name ) && $connections = $this->publicize->get_connections( $service_name ) ) : ?>
- <ul>
- <?php
- foreach( $connections as $c ) :
- $id = $this->publicize->get_connection_id( $c );
- $disconnect_url = $this->publicize->disconnect_url( $service_name, $id );
-
- $cmeta = $this->publicize->get_connection_meta( $c );
- $profile_link = $this->publicize->get_profile_link( $service_name, $c );
- $connection_display = $this->publicize->get_display_name( $service_name, $c );
-
- $options_nonce = wp_create_nonce( 'options_page_' . $service_name . '_' . $id ); ?>
-
- <?php if ( $this->publicize->show_options_popup( $service_name, $c ) ): ?>
- <script type="text/javascript">
- jQuery(document).ready( function($) {
- showOptionsPage.call(
- this,
- '<?php echo esc_js( $service_name ); ?>',
- '<?php echo esc_js( $options_nonce ); ?>',
- '<?php echo esc_js( $id ); ?>'
- );
- } );
- </script>
- <?php endif; ?>
-
- <li class="publicize-connection" data-connection-id="<?php echo esc_attr( $id ); ?>">
- <?php esc_html_e( 'Connected as:', 'jetpack' ); ?>
- <?php
- if ( !empty( $profile_link ) ) : ?>
- <a class="publicize-profile-link" href="<?php echo esc_url( $profile_link ); ?>" target="_top">
- <?php echo esc_html( $connection_display ); ?>
- </a><?php
- else :
- echo esc_html( $connection_display );
- endif;
- ?>
-
- <?php if ( 0 == $cmeta['connection_data']['user_id'] ) : ?>
- <small>(<?php esc_html_e( 'Shared', 'jetpack' ); ?>)</small>
-
- <?php if ( current_user_can( $this->publicize->GLOBAL_CAP ) ) : ?>
- <a class="pub-disconnect-button" title="<?php esc_html_e( 'Disconnect', 'jetpack' ); ?>" href="<?php echo esc_url( $disconnect_url ); ?>" target="_top">×</a>
- <?php endif; ?>
-
- <?php else : ?>
- <a class="pub-disconnect-button" title="<?php esc_html_e( 'Disconnect', 'jetpack' ); ?>" href="<?php echo esc_url( $disconnect_url ); ?>" target="_top">×</a>
- <?php endif; ?>
-
- <br/>
- <div class="pub-connection-test test-in-progress" id="pub-connection-test-<?php echo esc_attr( $id ); ?>" >
- </div>
- </li>
-
- <?php
- endforeach;
- ?>
- </ul>
- <?php endif; ?>
-
-
-
- <?php
- $connections = $this->publicize->get_connections( $service_name );
- if ( empty ( $connections ) ) { ?>
- <a id="<?php echo esc_attr( $service_name ); ?>" class="publicize-add-connection button" href="<?php echo esc_url( $connect_url ); ?>" target="_top"><?php echo esc_html( __( 'Connect', 'jetpack' ) ); ?></a>
- <?php } else { ?>
- <a id="<?php echo esc_attr( $service_name ); ?>" class="publicize-add-connection button add-new" href="<?php echo esc_url( $connect_url ); ?>" target="_top"><?php echo esc_html( __( 'Add New', 'jetpack' ) ); ?></a>
- <?php } ?>
- </div>
- </div>
- <?php endforeach; ?>
- </div>
- <script>
- (function($){
- $('.pub-disconnect-button').on('click', function(e){ if ( confirm( '<?php echo esc_js( __( 'Are you sure you want to stop Publicizing posts to this connection?', 'jetpack' ) ); ?>' ) ) {
- return true;
- } else {
- e.preventDefault();
- return false;
- }
- })
- })(jQuery);
- </script>
- </div>
-
- <?php wp_nonce_field( "wpas_posts_{$_blog_id}", "_wpas_posts_{$_blog_id}_nonce" ); ?>
- <input type="hidden" id="wpas_ajax_blog_id" name="wpas_ajax_blog_id" value="<?php echo $_blog_id; ?>" />
- </form><?php
-
- }
-
- public static function global_checkbox( $service_name, $id ) {
- global $publicize;
- if ( current_user_can( $publicize->GLOBAL_CAP ) ) : ?>
- <p>
- <input id="globalize_<?php echo $service_name; ?>" type="checkbox" name="global" value="<?php echo wp_create_nonce( 'publicize-globalize-' . $id ) ?>" />
- <label for="globalize_<?php echo $service_name; ?>"><?php _e( 'Make this connection available to all users of this blog?', 'jetpack' ); ?></label>
- </p>
- <?php endif;
- }
-
- function broken_connection( $service_name, $id ) { ?>
- <div id="thickbox-content">
- <div class='error'>
- <p><?php printf(
- /* translators: %s: Service Name (Facebook, Twitter, ...) */
- __( 'There was a problem connecting to %s. Please disconnect and try again.', 'jetpack' ),
- Publicize::get_service_label( $service_name )
- ); ?></p>
- </div>
- </div><?php
- }
-
- public static function options_page_other( $service_name ) {
- // Nonce check
- check_admin_referer( "options_page_{$service_name}_" . $_REQUEST['connection'] );
?>
- <div id="thickbox-content">
- <?php
- ob_start();
- Publicize_UI::connected_notice( $service_name );
- $update_notice = ob_get_clean();
- if ( ! empty( $update_notice ) )
- echo $update_notice;
+ <h2 id="publicize"><?php esc_html_e( 'Publicize', 'jetpack' ) ?></h2>
+ <p><?php esc_html_e( 'Connect social media services to automatically share new posts.', 'jetpack' ) ?></p>
+ <h4><?php
+ printf(
+ wp_kses(
+ __( "We've made some updates to Publicize. Please visit the <a href='%s' class='jptracks' data-jptracks-name='legacy_publicize_settings'>WordPress.com sharing page</a> to manage your publicize connections or use the button below.", 'jetpack' ),
+ array( 'a' => array( 'href' => array(), 'class' => array(), 'data-jptracks-name' => array() ) )
+ ),
+ esc_url( publicize_calypso_url() )
+ );
?>
+ </h4>
- <?php Publicize_UI::global_checkbox( $service_name, $_REQUEST['connection'] ); ?>
-
- <p style="text-align: center;">
- <input type="submit" value="<?php esc_attr_e( 'OK', 'jetpack' ) ?>" class="button <?php echo $service_name; ?>-options save-options" name="save" data-connection="<?php echo esc_attr( $_REQUEST['connection'] ); ?>" rel="<?php echo wp_create_nonce( 'save_'.$service_name.'_token_' . $_REQUEST['connection'] ) ?>" />
- </p> <br />
- </div>
+ <a href="<?php echo esc_url( publicize_calypso_url() ); ?>" class="button button-primary jptracks" data-jptracks-name='legacy_publicize_settings'><?php esc_html_e( 'Publicize Settings', 'jetpack' ); ?></a>
<?php
}
@@ -590,6 +365,23 @@ jQuery( function($) {
list-style: square;
padding-left: 1em;
}
+.publicize__notice-warning {
+ display: block;
+ padding: 7px 10px;
+ margin: 5px 0;
+ border-left-width: 4px;
+ border-left-style: solid;
+ font-size: 12px;
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
+}
+.publicize-external-link {
+ display: block;
+ text-decoration: none;
+ margin-top: 8px;
+}
+.publicize-external-link__text {
+ text-decoration: underline;
+}
#publicize-title:before {
content: "\f237";
font: normal 20px/1 dashicons;
@@ -612,6 +404,10 @@ jQuery( function($) {
.wpas-twitter-length-limit {
color: red;
}
+.publicize__notice-warning .dashicons {
+ font-size: 16px;
+ text-decoration: none;
+}
</style><?php
}
@@ -630,6 +426,24 @@ jQuery( function($) {
}
/**
+ * Extracts the connections that require reauthentication, for example, LinkedIn, when it switched v1 to v2 of its API.
+ *
+ * @return array Connections that must be reauthenticated
+ */
+ function get_must_reauth_connections() {
+ $must_reauth = array();
+ $connections = $this->publicize->get_connections( 'linkedin' );
+ if ( is_array( $connections ) ) {
+ foreach ( $connections as $index => $connection ) {
+ if ( $this->publicize->is_invalid_linkedin_connection( $connection ) ) {
+ $must_reauth[ $index ] = 'LinkedIn';
+ }
+ }
+ }
+ return $must_reauth;
+ }
+
+ /**
* Controls the metabox that is displayed on the post page
* Allows the user to customize the message that will be sent out to the social network, as well as pick which
* networks to publish to. Also displays the character counter and some other information.
@@ -659,6 +473,33 @@ jQuery( function($) {
if ( 0 < count( $connections_data ) ) :
$publicize_form = $this->get_metabox_form_connected( $connections_data );
+ $must_reauth = $this->get_must_reauth_connections();
+ if ( ! empty( $must_reauth ) ) {
+ foreach ( $must_reauth as $connection_name ) {
+ ?>
+ <span class="notice-warning publicize__notice-warning">
+ <?php
+ /* translators: %s is the name of a Pubilicize service like "LinkedIn" */
+ printf( esc_html__(
+ 'Your %s connection needs to be reauthenticated to continue working – head to Sharing to take care of it.',
+ 'jetpack'
+ ), $connection_name );
+ ?>
+ <a
+ class="publicize-external-link"
+ href="<?php echo publicize_calypso_url() ?>"
+ target="_blank"
+ >
+ <span class="publicize-external-link__text"><?php esc_html_e( 'Go to Sharing settings', 'jetpack' ); ?></span>
+ <span class="dashicons dashicons-external"></span>
+ </a>
+ </span>
+ <?php
+ }
+ ?>
+ <?php
+ }
+
$labels = array();
foreach ( $connections_data as $connection_data ) {
if ( ! $connection_data['enabled'] ) {