-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update v2.9.3 #40
Changes from all commits
be624e2
b921fae
5cf10b2
5db94b2
b8d8a71
399de6d
a4d47f9
8dbdfba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
// Silence is golden. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
<?php | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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() { | ||
|
||
/** | ||
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -91,7 +72,5 @@ | |
} | ||
); | ||
|
||
/** | ||
* Create admin pages | ||
*/ | ||
// Create admin pages. | ||
SimSocialFeed\Admin\SocialFeedAdmin::init(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
} | ||
|
||
/** | ||
|
@@ -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; | ||
|
||
|
@@ -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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). |
||
|
||
|
@@ -207,7 +209,7 @@ public static function refresh_token() { | |
|
||
// email message. | ||
$message = __( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 Error: Missing $domain arg (WordPress.WP.I18n.MissingArgDomain). |
||
'Hi, | ||
'Hey there! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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###. | ||
|
||
|
@@ -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, | ||
|
@@ -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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
$message = str_replace( '###ADMIN_EMAIL###', self::notification_email(), $message ); | ||
|
||
|
||
# new token array | ||
// new token array | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
@@ -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 | ||
* | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ! '; | ||
} | ||
|
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' ) ) { | ||
|
@@ -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. | ||
|
There was a problem hiding this comment.
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).