Skip to content

Commit

Permalink
Merge pull request #107 from rtCamp/develop
Browse files Browse the repository at this point in the history
Develop to Master merge for v2.2.3
  • Loading branch information
Mukulsingh27 authored Mar 16, 2022
2 parents 0166f20 + 9d7bfe4 commit 4b0b85a
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 30 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
33 changes: 15 additions & 18 deletions js/rtss-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
});
}
}
);
Expand Down
21 changes: 17 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -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/
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
60 changes: 57 additions & 3 deletions source.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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' ) ) {
Expand All @@ -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' ) ) {
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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' );
64 changes: 62 additions & 2 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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 }
Expand All @@ -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; }

Expand All @@ -239,13 +294,15 @@ 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; }

/* 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; }
Expand Down Expand Up @@ -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
*/
17 changes: 16 additions & 1 deletion template/rtsocial-setting-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,21 @@
</td>
<td>&nbsp;</td>
</tr>
<tr class="fb_row">
<th><?php esc_html_e( 'Facebook App Access Token', 'rtSocial' ); ?>:</th>
<td>
<input type="text" value="<?php echo esc_attr( $options['fb_access_token'] ); ?>" id="fb_access_token" name="rtsocial_plugin_options[fb_access_token]" />
</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>&nbsp;</th>
<td colspan="2">
<b>Format:</b> App ID|App Secret <br/>
<b>Example:</b> 3245678987646576|dfghjhg4564768jjgvjvbnnh9876 <br/>
Follow these <a href="https://github.com/rtCamp/rtsocial/wiki#how-to-get-facebook-access-token" target="_blank">guideline</a> to generate your access token.
</td>
</tr>
</table>
</div>
</div>
Expand Down Expand Up @@ -379,7 +394,7 @@
<strong><?php esc_html_e( 'Free Support', 'rtSocial' ); ?></strong>
</span>
</h3>
<div class="inside"><?php esc_html_e( 'If you have any problems with this plugin or good ideas for improvements, please talk about them in the', 'rtSocial' ); ?> <a href="https://rtcamp.com/support/forum/rtsocial/" rel="nofollow" target="_blank" title="<?php esc_attr_e( 'free support forums', 'rtSocial' ); ?>"><?php esc_html_e( 'free support forums.', 'rtSocial' ); ?></a></div>
<div class="inside"><?php esc_html_e( 'If you have any problems with this plugin or good ideas for improvements, please talk about them in the', 'rtSocial' ); ?> <a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/rtsocial/' ); ?>" rel="nofollow" target="_blank" title="<?php esc_attr_e( 'free support forums', 'rtSocial' ); ?>"><?php esc_html_e( 'free support forums.', 'rtSocial' ); ?></a></div>
</div>
<div class="postbox" id="latest_news">
<div title="<?php esc_attr_e( 'Click to toggle', 'rtSocial' ); ?>" class="handlediv"><br/></div>
Expand Down

0 comments on commit 4b0b85a

Please sign in to comment.