Skip to content

Commit

Permalink
Merge pull request #905 from warfare-plugins/staging
Browse files Browse the repository at this point in the history
Version 4.4.6.1
  • Loading branch information
warfare-plugins authored Mar 21, 2024
2 parents bf97e50 + cc73c07 commit 4fd0b83
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .cache/phpcs.json

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions lib/options/SWP_Section_HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,6 @@ private function system_status() {
$curl_status = '<span style="color:red;">Disabled</span>';
endif;

$Facebook_Authentication = new SWP_Auth_Helper( 'facebook' );

if ( $Facebook_Authentication->has_valid_token() ) {
$facebook_status = '<span style="color:green;">Connected</span>';
$facebook_debug_link = '<span style="color:green;">https://graph.facebook.com/v18.0/?id={url_placeholder}&fields=engagement&access_token=' . $Facebook_Authentication->get_access_token() . '</span>';
$facebook_token = '<span style="color:green;">' . $Facebook_Authentication->get_access_token() . '</span>';
} else {
$facebook_status = '<span style="color:red;">Not Connected</span>';
$facebook_debug_link = '<span style="color:red;">Not Connected</span>';
$facebook_token = '<span style="color:red;">Not Connected</span>';
}

$theme = wp_get_theme();

$system_status = '
Expand All @@ -172,9 +160,6 @@ private function system_status() {
<tr><td><h2>Connection Statuses</h2></td><td></td></tr>
<tr><td><b>fsockopen</b></td><td>' . $fsockopen . '</td></tr>
<tr><td><b>cURL</b></td><td>' . $curl_status . '</td></tr>
<tr><td><b>Facebook</b></td><td>' . $facebook_status . '</td></tr>
<tr><td><b>FB Debug Link</b></td><td>' . $facebook_debug_link . '</td></tr>
<tr><td><b>FB Access Token</b></td><td>' . $facebook_token . '</td></tr>
<tr><td><h2>Plugin Statuses</h2></td><td></td></tr>
<tr><td><b>Theme Name</b></td><td>' . $theme['Name'] . '</td></tr>
<tr><td><b>Theme Version</b></td><td>' . $theme['Version'] . '</td></tr>
Expand Down Expand Up @@ -302,7 +287,7 @@ public function do_buttons_preview() {
$style = 'swp_' . SWP_Utility::get_option( 'button_shape' );

$this->html = '';
$this->html .= '<div class="swp_social_panel swp_horizontal_panel swp_flat_fresh swp_default_full_color swp_other_full_color swp_individual_full_color scale-100 scale-full_width" data-float-color="#ffffff" data-float="none" data-float-mobile="none" data-transition="slide"><div class="nc_tweetContainer swp_share_button swp_facebook" data-network="facebook"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" target="_blank" href="https://www.facebook.com/share.php?u=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dfacebook%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare" data-link="https://www.facebook.com/share.php?u=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dfacebook%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_facebook_icon"></i><span class="swp_share">Share</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">17.5K</span></a></div><div class="nc_tweetContainer swp_share_button swp_twitter" data-network="twitter"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" target="_blank" href="https://twitter.com/intent/tweet?text=Ultimate+Social+Share+%23WordPress+plugin%21+Beautiful%2C+super+fast+%26+more+http%3A%2F%2Fwarfareplugins.com+pic.twitter.com%2FA2zcCJwZtO&amp;url=/&amp;via=warfareplugins" data-link="https://twitter.com/intent/tweet?text=Ultimate+Social+Share+%23WordPress+plugin%21+Beautiful%2C+super+fast+%26+more+http%3A%2F%2Fwarfareplugins.com+pic.twitter.com%2FA2zcCJwZtO&amp;url=/&amp;via=warfareplugins"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_twitter_icon"></i><span class="swp_share">Tweet</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">158.9K</span></a></div><div class="nc_tweetContainer swp_share_button swp_pinterest" data-network="pinterest"><a rel="nofollow noreferrer noopener" class="nc_tweet swp_share_link" data-count="0" data-link="https://pinterest.com/pin/create/button/?url=https://warfareplugins.com/&amp;media=https%3A%2F%2Fwarfareplugins.com%2Fwp-content%2Fuploads%2Fincrease-shares-drive-traffic-735x1498.jpg&amp;description=Customize+your+Pinterest+sharing+options%2C+create+easy+%22click+to+tweet%22+buttons+within+your+blog+posts%2C+beautiful+sharing+buttons+and+more.+Social+Warfare+is+the+ultimate+social+sharing+arsenal+for+WordPress%21+via+%40warfareplugins"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_pinterest_icon"></i><span class="swp_share">Pin</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">122.0K</span></a></div><div class="nc_tweetContainer swp_share_button swp_linkedin" data-network="linkedin"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" target="_blank" href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dlinkedin%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare" data-link="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dlinkedin%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_linkedin_icon"></i><span class="swp_share">Share</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">1.5K</span></a></div><div class="nc_tweetContainer swp_share_button total_shares total_sharesalt"><span class="swp_count " style="transition: padding 0.1s linear 0s;">298.4K <span class="swp_label">Shares</span></span></div></div>';
$this->html .= '<div class="swp_social_panel swp_horizontal_panel swp_flat_fresh swp_default_full_color swp_other_full_color swp_individual_full_color scale-100 scale-full_width" data-float-color="#ffffff" data-float="none" data-float-mobile="none" data-transition="slide"><div class="nc_tweetContainer swp_share_button swp_facebook" data-network="facebook"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" style="justify-content: center;" target="_blank" href="https://www.facebook.com/share.php?u=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dfacebook%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare" data-link="https://www.facebook.com/share.php?u=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dfacebook%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare"><span class="swp_count swp_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_facebook_icon"></i><span class="swp_share">Share</span></span></span></span></a></div><div class="nc_tweetContainer swp_share_button swp_twitter" data-network="twitter"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" target="_blank" href="https://twitter.com/intent/tweet?text=Ultimate+Social+Share+%23WordPress+plugin%21+Beautiful%2C+super+fast+%26+more+http%3A%2F%2Fwarfareplugins.com+pic.twitter.com%2FA2zcCJwZtO&amp;url=/&amp;via=warfareplugins" data-link="https://twitter.com/intent/tweet?text=Ultimate+Social+Share+%23WordPress+plugin%21+Beautiful%2C+super+fast+%26+more+http%3A%2F%2Fwarfareplugins.com+pic.twitter.com%2FA2zcCJwZtO&amp;url=/&amp;via=warfareplugins"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_twitter_icon"></i><span class="swp_share">Tweet</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">158.9K</span></a></div><div class="nc_tweetContainer swp_share_button swp_pinterest" data-network="pinterest"><a rel="nofollow noreferrer noopener" class="nc_tweet swp_share_link" data-count="0" data-link="https://pinterest.com/pin/create/button/?url=https://warfareplugins.com/&amp;media=https%3A%2F%2Fwarfareplugins.com%2Fwp-content%2Fuploads%2Fincrease-shares-drive-traffic-735x1498.jpg&amp;description=Customize+your+Pinterest+sharing+options%2C+create+easy+%22click+to+tweet%22+buttons+within+your+blog+posts%2C+beautiful+sharing+buttons+and+more.+Social+Warfare+is+the+ultimate+social+sharing+arsenal+for+WordPress%21+via+%40warfareplugins"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_pinterest_icon"></i><span class="swp_share">Pin</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">122.0K</span></a></div><div class="nc_tweetContainer swp_share_button swp_linkedin" data-network="linkedin"><a class="nc_tweet swp_share_link" rel="nofollow noreferrer noopener" target="_blank" href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dlinkedin%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare" data-link="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwarfareplugins.com%2F%3Futm_source%3Dlinkedin%26utm_medium%3DSocial%26utm_campaign%3DSocialWarfare"><span class="iconFiller"><span class="spaceManWilly"><i class="sw swp_linkedin_icon"></i><span class="swp_share">Share</span></span></span><span class="swp_count" style="transition: padding 0.1s linear 0s;">1.5K</span></a></div><div class="nc_tweetContainer swp_share_button total_shares total_sharesalt"><span class="swp_count " style="transition: padding 0.1s linear 0s;">298.4K <span class="swp_label">Shares</span></span></div></div>';

return $this;
}
Expand Down
11 changes: 6 additions & 5 deletions lib/social-networks/SWP_Facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ class SWP_Facebook extends SWP_Social_Network {
public function __construct() {

// Update the class properties for this network
$this->name = __( 'Facebook', 'social-warfare' );
$this->cta = __( 'Share', 'social-warfare' );
$this->key = 'facebook';
$this->default = 'true';
$this->base_share_url = 'https://www.facebook.com/share.php?u=';
$this->name = __( 'Facebook', 'social-warfare' );
$this->cta = __( 'Share', 'social-warfare' );
$this->key = 'facebook';
$this->default = 'true';
$this->base_share_url = 'https://www.facebook.com/share.php?u=';
$this->are_shares_shown = false;

$this->init_social_network();
}
Expand Down
45 changes: 42 additions & 3 deletions lib/utilities/SWP_Database_Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SWP_Database_Migration {
* @var string
*
*/
public $last_migrated = '3.0.5';
public $last_migrated = '4.4.6.1';


/**
Expand All @@ -42,8 +42,8 @@ public function __construct() {
*
*/

// global $post;
// add_action( 'plugins_loaded', array( $this, 'init' ), 100 );
global $post;
add_action( 'plugins_loaded', array( $this, 'init' ), 100 );
}


Expand Down Expand Up @@ -74,6 +74,11 @@ public function init() {
$this->update_last_migrated();
}

// Check if the migration to remove _facebook_shares should run.
if ( $this->is_facebook_shares_migrated() ) {
$this->delete_facebook_shares_meta();
}

$this->debug_parameters();
}

Expand Down Expand Up @@ -817,4 +822,38 @@ public function update_last_migrated() {

update_option( 'social_warfare_settings', $options );
}

/**
* Checks if there are more than one post meta entries with meta_key '_facebook_shares'.
*
* @since 4.4.4.1 | 18 MAR 2024 | Added method to check _facebook_shares meta entries.
* @return bool True if more than one entry exists, false otherwise.
*/
public function is_facebook_shares_migrated() {
global $wpdb;

$meta_key = '_facebook_shares';
$sql = $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key = %s", $meta_key );
$count = $wpdb->get_var( $sql );

return ( $count > 1 );
}

/**
* Deletes all post_meta entries where meta_key equals '_facebook_shares'.
*
* @since 4.4.6.1 | 18 MAR 2024 | Added method to remove _facebook_shares meta.
* @return void
*/
public function delete_facebook_shares_meta() {
global $wpdb;

$meta_key = '_facebook_shares';
$sql = $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_key = %s", $meta_key );

$wpdb->query( $sql );

$rows_affected = $wpdb->rows_affected;
error_log( "Deleted $rows_affected rows from postmeta where meta_key is '_facebook_shares'." );
}
}
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: holas84, webinator, warfareplugins, cdegraff1, goqflash, andbalash
Tags: sharing buttons, social media share, floating share buttons, facebook share, linkedin share, pin it, pinterest save, mix button, tweet button, twitter share, click to tweet, social sharing buttons, social share, social sharing, social media sharing, wordpress social sharing plugin, social sharing plugin, share buttons, share counts
Requires at least: 4.5.0
Tested up to: 6.5
Stable tag: 4.4.6
Stable tag: 4.4.6.1
Requires PHP: 5.6
License: GNU General Public License v2.0 or later

Expand Down Expand Up @@ -183,6 +183,12 @@ We have a growing archive of <a href="https://warfareplugins.com/support/" rel="

== Changelog ==

= 4.4.6.1 (21 Mar 2024) =
* Updated social sharing buttons style, providing a modern look and improving user interface design. Issue #900 (https://github.com/warfare-plugins/social-warfare/issues/900)
- Removed Facebook share count functionality, simplifying the display and enhancing performance.
* Upgraded SWP_Database_Migration class to version 4.4.6.1, introducing new methods and improvements for database handling.
* Fixed an initialization issue in the SWP_Database_Migration class, ensuring smooth operation and compatibility with the latest WordPress versions.

= 4.4.6 (12 Mar 2024) =
* Upgraded to Facebook's Graph API v18.0, ensuring compatibility and compliance with the latest API standards.
- Deprecated Graph API v6.0 and v17.0 endpoints removed, aligning with Facebook's 2-year lifecycle policy.
Expand Down
6 changes: 3 additions & 3 deletions social-warfare.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Social Warfare
* Plugin URI: https://warfareplugins.com
* Description: A plugin to maximize social shares and drive more traffic using the fastest and most intelligent share buttons on the market, calls to action via in-post click-to-tweets, popular posts widgets based on share popularity, link-shortening, Google Analytics and much, much more!
* Version: 4.4.6
* Version: 4.4.6.1
* Author: Warfare Plugins
* Author URI: https://warfareplugins.com
* Text Domain: social-warfare
Expand All @@ -20,8 +20,8 @@
* @since 4.2.0 | 19 NOV 2020 | The str_replace() removes any linebreaks in the string.
*
*/
define( 'SWP_VERSION', '4.4.6' );
define( 'SWP_DEV_VERSION', '2024.03.12 MASTER' );
define( 'SWP_VERSION', '4.4.6.1' );
define( 'SWP_DEV_VERSION', '2024.03.18 MASTER' );
define( 'SWP_PLUGIN_FILE', __FILE__ );
define( 'SWP_PLUGIN_URL', str_replace( array( "\r", "\n" ), '', untrailingslashit( plugin_dir_url( __FILE__ ) ) ) );
define( 'SWP_PLUGIN_DIR', __DIR__ );
Expand Down

0 comments on commit 4fd0b83

Please sign in to comment.