Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update v2.9.3 #40

Merged
merged 8 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
// Silence is golden.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: You must use "/**" style comments for a file comment (Squiz.Commenting.FileComment.WrongStyle).

4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Sim Social Feed ===
Contributors: icelayer
Donate link: https://switchwebdev.com/wordpress-plugins/
Donate link: https://wpbrisko.com/wordpress-plugins/
Tags: Instagram, Instagram photos, Instagram feed, Instagram widget, Instagram gallery
Requires at least: 3.4
Tested up to: 5.7
Stable tag: 2.8.2
Stable tag: 2.9.3
Requires PHP: 5.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
43 changes: 11 additions & 32 deletions sim-social.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<?php
/**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Missing short description in doc comment (Generic.Commenting.DocComment.MissingShort).

* Sim Social Feed
*
* @package SimSocialFeed
* @author Uriel Wilson
* @copyright 2020 Uriel Wilson
* @license GPL-2.0
* @link https://urielwilson.com
*
* @wordpress-plugin
* Plugin Name: Sim Social Feed
* Plugin URI: https://switchwebdev.com/wordpress-plugins/
* Plugin URI: https://wpbrisko.com/wordpress-plugins/
* Description: Easily Display Social Media Photo Feed for Instagram. The feed will schedule twicedaily updates, you can also update manually with a single click.
* Version: 2.8.2
* Version: 2.9.3
* Requires at least: 3.4
* Requires PHP: 5.6
* Author: SwitchWebdev.com
* Author URI: https://switchwebdev.com
* Author: wpbrisko.com
* Author URI: https://wpbrisko.com
* Text Domain: sim-social-feed
* Domain Path: languages
* License: GPLv2
Expand All @@ -28,14 +21,10 @@
die;
}

/**
* Load composer
*/
// Load composer.
require_once 'vendor/autoload.php';

/**
* Setup some defualts setup activation schedule
*/
// Setup some defualts setup activation schedule.
register_activation_hook( __FILE__, function() {

/**
Expand All @@ -48,9 +37,7 @@
wp_schedule_event( time(), 'twicedaily', 'sim_social_feed_cron' );
}

/**
* Setup some defaults
*/
// Setup some defaults.
$simsf_token = array();
$simsf_token['token'] = null;
$simsf_token['reset'] = null;
Expand All @@ -61,19 +48,13 @@
}
);

/**
* Handle Deactivation
*/
// Handle Deactivation.
register_deactivation_hook( __FILE__, function() {

/**
* Remove the scheduled event
*/
// Remove the scheduled event.
wp_clear_scheduled_hook( 'sim_social_feed_cron' );

/**
* Setup some defaults
*/
// Setup some defaults.
$simsf_token = array();
$simsf_token['token'] = null;
$simsf_token['reset'] = null;
Expand All @@ -91,7 +72,5 @@
}
);

/**
* Create admin pages
*/
// Create admin pages.
SimSocialFeed\Admin\SocialFeedAdmin::init();
38 changes: 27 additions & 11 deletions src/InstagramData.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public static function user_check() {
* @return array
*/
public static function user_profile() {
$user = self::api()->getUserProfile();
$user_data = (array) $user;
return $user_data;
return (array) self::api()->getUserProfile();
}

/**
Expand Down Expand Up @@ -184,6 +182,10 @@ public static function maybe_refresh_token() {
*/
public static function refresh_token() {

/* get previous update date */
$previously = date_i18n( get_option( 'date_format' ), $user_token['created_at'] );

/* setup api */
$newtoken = self::api()->refreshToken( self::access_token() );
$user_token = (array) $newtoken;

Expand All @@ -194,7 +196,7 @@ public static function refresh_token() {
$user_token['expire_date'] = time() + $user_token['expires_in'];
$user_token['created_at'] = time();
$user_token['refresh'] = true;

// update token option.
update_option('simsf_access_token', $user_token );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket).


Expand All @@ -207,7 +209,7 @@ public static function refresh_token() {

// email message.
$message = __(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Missing $domain arg (WordPress.WP.I18n.MissingArgDomain).

'Hi,
'Hey there!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Multi-line function call not indented correctly; expected 12 spaces but found 8 (PEAR.Functions.FunctionCallSignature.Indent).


This notification confirms that your Instagram User Access Token Has Been Updated on ###SITENAME###.

Expand All @@ -216,6 +218,8 @@ public static function refresh_token() {
Refreshed tokens are valid for 60 days from the date at which they are refreshed.
The Sim Social Feed plugin will automatically refresh your Access Token before it expires.

Token was last Updated: ###PREVIOUS###

This email has been sent to ###ADMIN_EMAIL###.

Regards,
Expand All @@ -228,15 +232,16 @@ public static function refresh_token() {
$message = str_replace( '###SITENAME###', $blog_name, $message );
$message = str_replace( '###CREATED###', $token_created, $message );
$message = str_replace( '###EXPIRES###', $token_will_expire, $message );
$message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );
$message = str_replace( '###PREVIOUS###', $previously, $message );
//$message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: No space found before comment text; expected "// $message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );" but found "//$message = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $message );" (Squiz.Commenting.InlineComment.NoSpaceBefore).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: This comment is 55% valid code; is this commented out code? (Squiz.PHP.CommentedOutCode.Found).

$message = str_replace( '###ADMIN_EMAIL###', self::notification_email(), $message );


# new token array
// new token array

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Inline comments must end in full-stops, exclamation marks, or question marks (Squiz.Commenting.InlineComment.InvalidEndChar).

$igtoken = array();
$igtoken['access_token'] = get_option('simsf_access_token')['access_token'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket).

$igtoken['reset'] = false;

# set new token value
// set new token value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Inline comments must end in full-stops, exclamation marks, or question marks (Squiz.Commenting.InlineComment.InvalidEndChar).

update_option('simsf_token', $igtoken );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket).


// send email.
Expand All @@ -245,6 +250,18 @@ public static function refresh_token() {
return $user_token;
}

/**
* Notification about auto updates.
*
* @return string .
*/
public static function notification_email() {
if ( get_option( 'simsf_notification_email', false ) ) {
return get_option( 'simsf_notification_email' );
}
get_option( 'admin_email' );
}

/**
* Check if the token has been Refreshed
*
Expand Down Expand Up @@ -283,8 +300,7 @@ public static function token_expire_date() {
public static function token_created_date() {
if ( self::has_refresh() ) {
$created_date = get_option( 'simsf_access_token' )['created_at'];
$date = date_i18n( get_option( 'date_format' ), $created_date);
return $date;
return date_i18n( get_option( 'date_format' ), $created_date);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket).

}
return 'no date was found ! ';
}
Expand Down
15 changes: 1 addition & 14 deletions uninstall.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
<?php
/**
* Uninstall stuff.
* do some cleanup after user uninstalls the plugin
* ---------------------------------------------------------------------------
* -remove stuff
* ----------------------------------------------------------------------------
*
* @category Plugin
* @copyright Copyright © 2020 Uriel Wilson.
* @package SimSocialFeed
* @author Uriel Wilson
* @link https://switchwebdev.com
* ----------------------------------------------------------------------------
*/

// deny direct access.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: You must use "/**" style comments for a file comment (Squiz.Commenting.FileComment.WrongStyle).

if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
Expand All @@ -27,6 +13,7 @@
delete_option( 'simsf_access_token' );
delete_option( 'simsf_user' );
delete_option( 'simsf_user_media' );
delete_option( 'simsf_notification_email' );


// finally clear the cache.
Expand Down