diff --git a/README.md b/README.md index 69996f4..f527631 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # rtSocial # -* **Contributors:** [rtcamp](http://profiles.wordpress.org/rtcamp), [rahul286](http://profiles.wordpress.org/rahul286), [faishal](http://profiles.wordpress.org/faishal), [rittesh.patel](http://profiles.wordpress.org/rittesh.patel), [sanketparmar](http://profiles.wordpress.org/sanketparmar), [pranalipatel](http://profiles.wordpress.org/pranalipatel), [UmeshSingla](http://profiles.wordpress.org/UmeshSingla), [rutwick](http://profiles.wordpress.org/rutwick), [saurabhshukla](http://profiles.wordpress.org/saurabhshukla), [HarishChaudhari](http://profiles.wordpress.org/HarishChaudhari), [5um17](http://profiles.wordpress.org/5um17), [JoshuaAbenazer](http://profiles.wordpress.org/JoshuaAbenazer), [paddyohanlon](http://profiles.wordpress.org/paddyohanlon), [chandrapatel](http://profiles.wordpress.org/chandrapatel), [1naveengiri](http://profiles.wordpress.org/1naveengiri), [bhargavbhandari90](http://profiles.wordpress.org/bhargavbhandari90), [vaishu.agola27](https://profiles.wordpress.org/vaishuagola27/), [pooja1210](https://profiles.wordpress.org/pooja1210/), [milindmore22](https://profiles.wordpress.org/milindmore22) +* **Contributors:** [rtcamp](http://profiles.wordpress.org/rtcamp), [rahul286](http://profiles.wordpress.org/rahul286), [faishal](http://profiles.wordpress.org/faishal), [rittesh.patel](http://profiles.wordpress.org/rittesh.patel), [sanketparmar](http://profiles.wordpress.org/sanketparmar), [pranalipatel](http://profiles.wordpress.org/pranalipatel), [UmeshSingla](http://profiles.wordpress.org/UmeshSingla), [rutwick](http://profiles.wordpress.org/rutwick), [saurabhshukla](http://profiles.wordpress.org/saurabhshukla), [HarishChaudhari](http://profiles.wordpress.org/HarishChaudhari), [5um17](http://profiles.wordpress.org/5um17), [JoshuaAbenazer](http://profiles.wordpress.org/JoshuaAbenazer), [paddyohanlon](http://profiles.wordpress.org/paddyohanlon), [chandrapatel](http://profiles.wordpress.org/chandrapatel), [1naveengiri](http://profiles.wordpress.org/1naveengiri), [bhargavbhandari90](http://profiles.wordpress.org/bhargavbhandari90), [vaishu.agola27](https://profiles.wordpress.org/vaishuagola27/), [pooja1210](https://profiles.wordpress.org/pooja1210/), [milindmore22](https://profiles.wordpress.org/milindmore22), [pavanpatil1](https://profiles.wordpress.org/pavanpatil1/), [devanshijoshi](https://profiles.wordpress.org/devanshijoshi/), [mukulsingh27](https://profiles.wordpress.org/mukulsingh27/) * **License:** [GPL v2 or later]( http://www.gnu.org/licenses/gpl-2.0.html) @@ -29,7 +29,7 @@ With just 1 image (CSS-sprite), 1 JavaScript and 1 CSS file loaded from WordPres ## Installation ## Install rtSocial plugin from the 'Plugins' section in your dashboard (Plugins > Add New > Search for rtSocial). -Alternatively you can [download latest version](https://downloads.wordpress.org/plugin/rtsocial.2.2.2.zip) of rtSocial plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (wp-content/plugins/ directory of your WordPress installation). +Alternatively you can [download latest version](https://downloads.wordpress.org/plugin/rtsocial.zip) of rtSocial plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (wp-content/plugins/ directory of your WordPress installation). Activate it through the 'Plugins' section. @@ -57,6 +57,19 @@ No. Right now you cannot. ## Changelog ## +#### 2.2.3 #### + +- ENHANCEMENTS + + - Compatible with WordPress latest version v5.9.1. + - Provided setting options for Facebook APP-ID. + - Added support for print friendly plugin. + +- FIXED + + - UI/UX issues + - Fixed support forum redirection link issue + #### 2.2.2 #### * Remove - Google Plus Icons and functions. * Improved - Improved code with phpcs. diff --git a/js/rtss-main.js b/js/rtss-main.js index 5a60dad..0eeac93 100644 --- a/js/rtss-main.js +++ b/js/rtss-main.js @@ -14,30 +14,27 @@ function rtsocial_facebook() { if ( '1' === args.facebook && 'icon' !== args.button_style && '1' !== args.hide_count ) { var rtsocial_urls = { }; // create an associative array of url as key and counts. var sep = '"'; // URL separatore initial value. - var tempFbUrl = ""; // temp variable for url. + var tempPostId = ""; // temp variable for post ID. jQuery( '.rtsocial-container' ).each( function () { var facebookSocial = this; var rtsocial_url_count = 0; - tempFbUrl = jQuery( this ).find( 'a.perma-link' ).attr( 'href' ); - if ( tempFbUrl !== '' || tempFbUrl !== 'undefined' ) { - - // Fetch share count by Facebook Graph API. - var rtsocial_fburl = 'https://graph.facebook.com/?id=' + tempFbUrl + '&fields=og_object{engagement}'; - - /** - * Facebook Data. - */ - jQuery.getJSON( - rtsocial_fburl, - function ( fbres ) { - if ( typeof fbres.og_object !== 'undefined' && fbres.og_object.engagement.count ) { - rtsocial_url_count = fbres.og_object.engagement.count; // Setting value. - } - jQuery( facebookSocial ).find( '.rtsocial-fb-count' ).text( rtsocial_url_count ); + tempPostId = jQuery( this ).find( '.rts_id' ).val(); + security = jQuery( this ).find( '#rts_media_nonce' ).val(); + if ( '' !== tempPostId || 'undefined' !== tempPostId ) { + jQuery.ajax({ + type: 'GET', + url: ajaxurl, + data: { + "action" : "rtss_wp_get_shares", + "post_id" : tempPostId, + "security": security + }, + success: function(data){ + jQuery( facebookSocial ).find( '.rtsocial-fb-count' ).text( data ); } - ); /* End of Callback function in JSON. */ + }); } } ); diff --git a/readme.txt b/readme.txt index c8ea1c0..4a68315 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,9 @@ === rtSocial === -Contributors: rtcamp, rahul286, faishal, rittesh.patel, sanketparmar, pranalipatel, UmeshSingla, rutwick, saurabhshukla, HarishChaudhari, 5um17, JoshuaAbenazer, paddyohanlon, chandrapatel, 1naveengiri, bhargavbhandari90, coderboy007, vaishu.agola27, pooja1210, milindmore22 +Contributors: rtcamp, rahul286, faishal, rittesh.patel, sanketparmar, pranalipatel, UmeshSingla, rutwick, saurabhshukla, HarishChaudhari, 5um17, JoshuaAbenazer, paddyohanlon, chandrapatel, 1naveengiri, bhargavbhandari90, coderboy007, vaishu.agola27, pooja1210, milindmore22, pavanpatil1, devanshijoshi9, Mukulsingh27 Tags: rtcamp, social, sharing, share, social links, twitter, facebook, pin it, pinterest, linkedin, linked in, linked in share, plus one button, social share, social sharing Requires at least: 3.0 -Tested up to: 5.8.1 -Stable tag: 2.2.2 +Tested up to: 5.9.1 +Stable tag: 2.2.3 License: GPLv2 or later (of-course) License URI: http://www.gnu.org/licenses/gpl-2.0.html Donate Link: http://rtcamp.com/donate/ @@ -31,7 +31,7 @@ With just 1 image (CSS-sprite), 1 JavaScript and 1 CSS file loaded from WordPres == Installation == Install rtSocial plugin from the 'Plugins' section in your dashboard (Plugins > Add New > Search for rtSocial). -Alternatively you can [download latest version](https://downloads.wordpress.org/plugin/rtsocial.2.1.19.zip) of rtSocial plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (wp-content/plugins/ directory of your WordPress installation). +Alternatively you can [download latest version](https://downloads.wordpress.org/plugin/rtsocial.zip) of rtSocial plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (wp-content/plugins/ directory of your WordPress installation). Activate it through the 'Plugins' section. @@ -59,6 +59,19 @@ No. Right now you cannot. == Changelog == += 2.2.3 = + +* ENHANCEMENTS + + * Compatible with WordPress latest version v5.9.1. + * Provided setting options for Facebook APP-ID. + * Added support for print friendly plugin. + +* FIXED + + * UI/UX issues + * Fixed support forum redirection link issue + = 2.2.2 = * Remove - Google Plus Icons and functions. * Improved - Improved code with phpcs. diff --git a/source.php b/source.php index 4da4762..9cff515 100644 --- a/source.php +++ b/source.php @@ -11,7 +11,7 @@ * Author URI: https://rtcamp.com/ * Text Domain: rtSocial * Domain Path: /languages - * Version: 2.2.2 + * Version: 2.2.3 * License: GPLv2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Description: It is the lightest social sharing plugin, uses non-blocking Javascript and a single sprite to get rid of all the clutter that comes along with the sharing buttons. @@ -97,7 +97,7 @@ function rtsocial_get_errors() { * Inject the widget in the posts */ add_filter( 'the_content', 'rtsocial_counter' ); -add_filter( 'the_excerpt', 'rtsocial_counter' ); +add_filter( 'get_the_excerpt', 'rtsocial_counter' ); /** * Dynamic Content. @@ -927,6 +927,7 @@ function rtsocial_set_defaults() { 'alignment_options_set' => 'right', 'active' => array( 'tw', 'fb', 'lin', 'pin' ), 'inactive' => array(), + 'fb_access_token' => '', ); if ( ! get_option( 'rtsocial_plugin_options' ) ) { @@ -945,6 +946,7 @@ function rtsocial_set_defaults() { 'alignment_options_set' => 'right', 'active' => array( 'tw', 'fb', 'lin', 'pin' ), 'inactive' => array(), + 'fb_access_token' => '', ); if ( ! get_option( 'rtsocial_plugin_options' ) ) { @@ -1153,7 +1155,7 @@ function rtsocial_ajaxurl() { * * @param string $feed_url Feed URL. */ -function rtsocial_get_feeds( $feed_url = 'https://rtcamp.com/blog/category/rtsocial/feed/' ) { +function rtsocial_get_feeds( $feed_url = 'https://rtcamp.com/blog/' ) { // Get RSS Feed(s). require_once ABSPATH . WPINC . '/feed.php'; @@ -1289,3 +1291,55 @@ function rtsocial_save_meta_box_data( $post_id ) { // Update the meta field in the database. update_post_meta( $post_id, '_rtsocial_visibility', $my_data ); } + +/** + * Display number of shares using WordPress HTTP API + */ +function rtss_wp_get_shares() { + if ( isset( $_GET['security'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + $security = sanitize_text_field( wp_unslash( $_GET['security'] ) ); + } else { + $security = ''; + } + + if ( isset( $_GET['post_id'] ) ) { + $post_id = sanitize_text_field( wp_unslash( $_GET['post_id'] ) ); + } else { + $post_id = ''; + } + + check_ajax_referer( 'rts_media_' . $post_id, 'security' ); + + $options = get_option( 'rtsocial_plugin_options' ); + $cache_key = 'rtss_fb' . $post_id; + $access_token = isset( $options['fb_access_token'] ) ? $options['fb_access_token'] : ''; + $count = get_transient( $cache_key ); // try to get value from WordPress cache. + + if ( ! $access_token ) { + $count = false; + } + + // if no value in the cache. + if ( false === $count || 0 === $count ) { + $response = wp_remote_get( + add_query_arg( + array( + 'id' => rawurlencode( get_permalink( $post_id ) ), + 'access_token' => $access_token, + 'fields' => 'engagement', + ), + 'https://graph.facebook.com/v3.0/' + ) + ); + $body = json_decode( $response['body'] ); + if ( isset( $body->engagement ) && isset( $body->engagement->share_count ) ) { + $count = $body->engagement->share_count; + set_transient( $cache_key, $count, 3600 ); // store value in cache for a 1 hour. + } + } + echo esc_html( $count ); + exit; +} + +add_action( 'wp_ajax_rtss_wp_get_shares', 'rtss_wp_get_shares' ); +add_action( 'wp_ajax_nopriv_rtss_wp_get_shares', 'rtss_wp_get_shares' ); diff --git a/styles/style.css b/styles/style.css index 411998d..2fdfef8 100644 --- a/styles/style.css +++ b/styles/style.css @@ -75,6 +75,7 @@ div#content_block { width: 70% } /* Metaboxes inner div */ #rtsocial .inside { font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; line-height: 1.2em; } +#rtsocial .inside .form-table th { padding: 16px 10px 20px 0; } /* Manual code info style */ #rtsocial .inside span.rtsocial-manual-code { font-style: italic; font-weight: bold; } @@ -121,8 +122,60 @@ div#content_block { width: 70% } .rtsocial-twitter-icon, .rtsocial-fb-icon, .rtsocial-pinterest-icon, -.rtsocial-linkedin-icon{ margin: 0 10px 0 0; position: relative; display: inline-block; } - +.rtsocial-linkedin-icon{ margin: 0 15px 0 0; position: relative; display: inline-block; } + +.rtsocial-twitter-horizontal:hover, +.rtsocial-fb-horizontal:hover, +.rtsocial-pinterest-horizontal:hover, +.rtsocial-linkedin-horizontal:hover, +.rtsocial-twitter-icon:hover, +.rtsocial-fb-icon:hover, +.rtsocial-pinterest-icon:hover, +.rtsocial-linkedin-icon:hover, +.rtsocial-container-align-right .rtsocial-twitter-vertical:hover, +.rtsocial-container-align-right .rtsocial-fb-vertical:hover, +.rtsocial-container-align-right .rtsocial-pinterest-vertical:hover, +.rtsocial-container-align-right .rtsocial-linkedin-vertical:hover, +.rtsocial-container-align-left .rtsocial-twitter-vertical:hover, +.rtsocial-container-align-left .rtsocial-fb-vertical:hover, +.rtsocial-container-align-left .rtsocial-pinterest-vertical:hover, +.rtsocial-container-align-left .rtsocial-linkedin-vertical:hover, +.rtsocial-container-align-none .rtsocial-twitter-vertical:hover, +.rtsocial-container-align-none .rtsocial-fb-vertical:hover, +.rtsocial-container-align-none .rtsocial-linkedin-vertical:hover, +.rtsocial-container-align-none .rtsocial-pinterest-vertical:hover { + position: relative; + animation-name: wobble-up-down; + animation-duration: 1s; + animation-timing-function: ease-in-out; + animation-iteration-count: 1; +} + +@keyframes wobble-up-down { + 16.65% { + transform: translateY(8px); + } + + 33.3% { + transform: translateY(-6px); + } + + 49.95% { + transform: translateY(4px); + } + + 66.6% { + transform: translateY(-2px); + } + + 83.25% { + transform: translateY(1px); + } + + 100% { + transform: translateY(0); + } +} /* Counts display styles */ .rtsocial-vertical-count { background: #FFF; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; height: 37px; margin: 0 auto 5px; max-width: 55px; min-width: 55px; padding: 0; text-align: center; position: relative; } @@ -210,6 +263,7 @@ div#content_block { width: 70% } /*Facebook Button Frontend Styles*/ .rtsocial-fb-button{ background-position: 0 -172px; display: block; height: 24px; width: 50px; text-indent: -9999px; text-transform: uppercase; margin: 0 auto;} +.rtsocial-fb-button:focus {background: url('../images/rtsocial-sprite-image.png') 0 -172px no-repeat !important;} .rtsocial-fb-button:hover{ background-position: 0 -128px } .rtsocial-fb-like-dark { background-position: 0 -260px } @@ -230,6 +284,7 @@ div#content_block { width: 70% } .rtsocial-twitter-vertical-button { text-align: center; } .rtsocial-twitter-button, #rtsocial-ord-tw label { background-position: 0 -557px; display: block; float: left; height: 21px; margin: 0; padding: 0; width: 58px; text-indent: -9999px; } +.rtsocial-twitter-button:focus {background: url('../images/rtsocial-sprite-image.png') 0 -557px no-repeat !important;} #rtsocial-ord-tw label{ float: none; display: inline-block; } @@ -239,6 +294,7 @@ div#content_block { width: 70% } /* Pinterest Button */ .rtsocial-pinterest-button, #rtsocial-ord-pin label { background-position: 0 -598px; border: 1px solid #c9c5c5; border-color: #E8E4E4 #C9C5C5 #C9C5C5; border-radius: 4px 4px 4px 4px; display: block; height: 22px; text-indent: -9999px; text-transform: uppercase; width: 47px; margin: 0 auto; } +.rtsocial-pinterest-button:focus {background: url('../images/rtsocial-sprite-image.png') 0 -598px no-repeat !important;} .rtsocial-pinterest-button:hover, #rtsocial-ord-pin label:hover{ background-position: 0 -640px; border: 1px solid #B8B4B4; } @@ -246,6 +302,7 @@ div#content_block { width: 70% } /* Linked In Button */ .rtsocial-linkedin-button, #rtsocial-ord-lin label{ background-position: 0 -682px; border-color: #E2E2E2 #BFBFBF #B9B9B9; border-style: solid; border-width: 1px; border-radius: 2px; display: block; height: 18px; margin: 0 auto; text-indent: -9999px; text-transform: uppercase; width: 59px; } +.rtsocial-linkedin-button:focus {background: url('../images/rtsocial-sprite-image.png') 0 -682px no-repeat !important;} .rtsocial-linkedin-button:hover, #rtsocial-ord-lin label:hover{ background-position: 0 -720px; border-color: #ababab #9a9a9a #787878; } @@ -332,6 +389,9 @@ div#content_block { width: 70% } .rtsocial-linkedin-icon-link{ background-position: -130px -398px; } +.postbox .handle-order-higher, .postbox .handle-order-lower, .postbox .handlediv { display: none; } +.postbox .handle-order-higher, .postbox .handle-order-lower, .postbox .ui-sortable-handle { font-size: 17px !important; padding: 8px 12px !important; font-weight: bold; } + /** * End of rtSocial Plugin Style */ diff --git a/template/rtsocial-setting-form.php b/template/rtsocial-setting-form.php index ed0dd63..97e58e5 100644 --- a/template/rtsocial-setting-form.php +++ b/template/rtsocial-setting-form.php @@ -310,6 +310,21 @@   + + : + + + +   + + +   + + Format: App ID|App Secret
+ Example: 3245678987646576|dfghjhg4564768jjgvjvbnnh9876
+ Follow these guideline to generate your access token. + + @@ -379,7 +394,7 @@ -
+