Skip to content

Commit

Permalink
Merge pull request #32 from devuri/2.6.4
Browse files Browse the repository at this point in the history
2.6.4
  • Loading branch information
devuri authored Dec 7, 2020
2 parents afdcc50 + a3bd439 commit bcab0c9
Show file tree
Hide file tree
Showing 19 changed files with 660 additions and 436 deletions.
96 changes: 96 additions & 0 deletions assets/css/igfeed-gird.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.igfeed-container {
margin: 0 auto;
}

.igfeed {
display: flex;
flex-direction: row;
flex-wrap: wrap;
/* justify-content: flex-start; */
justify-content: center;
align-content: stretch;
padding: 0;
}

.igfeed-item {
display: block;
float: left;
flex: 0 0 auto;
padding: 2px;
position: relative;
}

/* item description */
.igfeed-item-info {
display: none;
font-size: small;
padding: 8px;
position: absolute;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0);
transform: translate(-50%, -50%);
transition: background-color 300ms linear;
}

.igfeed-item-info p {
font-weight: 600;
vertical-align: middle;
color: rgba(255, 255, 255, 0);
text-align: center;
transition: color 300ms linear;
position: relative;
top: 50%;
-ms-transform: translateY(-50%);
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}

.igfeed-item:hover .igfeed-item-info,
.igfeed-item:focus .igfeed-item-info {
display: block;
background-color: rgba(0, 0, 0, .6);
}

.igfeed-item-info:hover p {
color: rgba(255, 255, 255, 1);
}

/* item description */

@media screen and (min-width: 1024px) {
.igfeed-item {
width: calc(100%/6);
height: calc(100%/6);
}
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
.igfeed-item {
width: calc(100%/4);
height: calc(100%/4);
}
}

@media screen and (min-width: 481px) and (max-width: 768px) {
.igfeed-item {
width: calc(100%/3);
height: calc(100%/3);
}
}

@media screen and (min-width: 321px) and (max-width: 480px) {
.igfeed-item {
width: calc(100%/2);
height: calc(100%/2);
}
}

@media screen and (max-width: 320px) {
.igfeed-item {
width: 100%;
height: 100%;
}
}
58 changes: 0 additions & 58 deletions assets/css/simsocial-photo-gird.css

This file was deleted.

2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<exclude-pattern>*/WPAdminPage/*</exclude-pattern>
<exclude-pattern>*/dev-lib/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>.github/</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://switchwebdev.com/wordpress-plugins/
Tags: Instagram, Instagram photos, Instagram feed, Instagram widget, Instagram gallery
Requires at least: 3.4
Tested up to: 5.5
Stable tag: 2.5.0
Stable tag: 2.6.4
Requires PHP: 5.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
47 changes: 15 additions & 32 deletions sim-social.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Sim Social Feed
* Plugin URI: https://switchwebdev.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.5.0
* Version: 2.6.4
* Requires at least: 3.4
* Requires PHP: 5.6
* Author: SwitchWebdev.com
Expand All @@ -23,11 +23,22 @@
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/

// deny direct access.
// deny direct access.
if ( ! defined( 'WPINC' ) ) {
die;
die;
}

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

// require_once / schedule.
require_once plugin_dir_path( __FILE__ ) . '/src/schedule.php';

// require_once / shortcode.
require_once plugin_dir_path( __FILE__ ) . '/src/shortcode.php';

/**
* Setup some defualts setup activation schedule
*/
Expand Down Expand Up @@ -79,41 +90,13 @@
}
);

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

// require_once / schedule.
require_once plugin_dir_path( __FILE__ ) . '/src/schedule.php';

// require_once / shortcode.
require_once plugin_dir_path( __FILE__ ) . '/src/shortcode.php';

// register styles.
add_action( 'init', function() {

wp_register_style( 'sim-social-feed-grid', plugin_dir_url( __FILE__ ) . 'assets/css/simsocial-photo-gird.css', array(), '1.4.3', 'all' );
wp_register_style( 'igfeed-grid', plugin_dir_url( __FILE__ ) . 'assets/css/igfeed-gird.css', array(), '1.6.3', 'all' );
}
);

/**
* Setup the IG class
*/
function simsocial() {
/**
* Initialize the feed API
* how to get the token
*
* @link https://www.youtube.com/watch?v=rWUcb8jXgVA
*/
$instagram = new EspressoDev\InstagramBasicDisplay\InstagramBasicDisplay( get_option( 'simsf_token' )['access_token'] );

// Get IG the object.
return $instagram;
}


/**
* Create admin pages
*/
Expand Down
31 changes: 19 additions & 12 deletions src/Admin/pages/social-feed-settings/account-setup.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# lets verify the nonce
if ( ! $this->form()->verify_nonce() ) {
wp_die($this->form()->user_feedback('Verification Failed !!!' , 'error'));
wp_die($this->form()->user_feedback( 'Verification Failed !!!' , 'error' ) );
}

# set the token value
Expand All @@ -34,20 +34,27 @@
*/
if ( isset( $_POST['submit_activate_id'] ) ) :

# lets verify the nonce
// lets verify the nonce
if ( ! $this->form()->verify_nonce() ) {
wp_die($this->form()->user_feedback('Verification Failed !!!' , 'error'));
}

# update user info
$igsf_profile = SimSocialFeed\InstagramSocialFeed::user_profile();
update_option('simsf_user', $igsf_profile);
echo $this->form()->user_feedback('IG User Info Has Been Updated !!!');
// update user info
$igsf_profile = SimSocialFeed\InstagramData::user_profile();
update_option('simsf_user', $igsf_profile);
echo $this->form()->user_feedback('User Info Has Been Updated !!!');

// Update user data.
if ( SimSocialFeed\InstagramData::is_request_ok() ) :
$ig_user_media = SimSocialFeed\InstagramData::user_media();
update_option( 'simsf_user_media', $ig_user_media->data );
echo $this->form()->user_feedback( 'Instagram Feed Has Been Updated !!!' );
endif;

# check the user info
if ( ! SimSocialFeed\InstagramSocialFeed::user_check() ) {
# check the user info
if ( ! SimSocialFeed\InstagramData::user_check() ) {
echo $this->form()->user_feedback('User Activation Failed. <br> Configuration data is missing or incorrect <br> Please check your user token !!!', 'error');
}
}

endif;

Expand Down Expand Up @@ -85,7 +92,7 @@
*/
echo $this->form()->table('open');
if ( false === get_option('simsf_token')['reset'] ) {
_e('Instagram Token Has Been Set');
_e('Instagram Token Has Been Set, You can now Activate User ID to complete the setup.');
} else {
echo '<span style="color:#ba315c">';
_e('Impotant: Requires Long-live Token (60 Days)');
Expand Down Expand Up @@ -119,7 +126,7 @@


?></form>
<?php if ( SimSocialFeed\InstagramSocialFeed::user_check() ): ?>
<?php if ( SimSocialFeed\InstagramData::user_check() ): ?>
The Following Account is Active:
<br>
<strong><?php echo get_option('simsf_user')['id']; ?></strong>
Expand All @@ -128,7 +135,7 @@
<?php endif;

# check the user info
if ( ! SimSocialFeed\InstagramSocialFeed::user_check() ) {
if ( ! SimSocialFeed\InstagramData::user_check() ) {
echo $this->form()->user_feedback('Please Activate User ID. <br> Configuration data is missing or incorrect !!!', 'error');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
}

# SOMETHING WENT WRONG WITH THE REQUEST
if ( ! SimSocialFeed\InstagramSocialFeed::is_request_ok() ) :
echo $this->form()->user_feedback(SimSocialFeed\InstagramSocialFeed::error_message(), 'error');
if ( ! SimSocialFeed\InstagramData::is_request_ok() ) :
echo $this->form()->user_feedback(SimSocialFeed\InstagramData::error_message(), 'error');
endif;

# REQUEST TOKEN UPDATE
if ( SimSocialFeed\InstagramSocialFeed::is_request_ok() ) :
if ( SimSocialFeed\InstagramData::is_request_ok() ) :
# get new token
$newtoken = SimSocialFeed\InstagramSocialFeed::refresh_token();
$newtoken = SimSocialFeed\InstagramData::refresh_token();

# update the token
update_option('simsf_access_token', $newtoken );
Expand All @@ -39,7 +39,7 @@
<h2><?php _e('Refresh and Update User Access Token'); ?></h2>
<?php _e('Token Expire Date: '); ?>
<span style="color: #cc0000;">
<?php echo SimSocialFeed\InstagramSocialFeed::token_expire_date(); ?>
<?php echo SimSocialFeed\InstagramData::token_expire_date(); ?>
</span>
<hr/>
<div class="description">
Expand All @@ -65,7 +65,7 @@
/**
* only show if we have valid user
*/
if ( SimSocialFeed\InstagramSocialFeed::user_check() ) {
if ( SimSocialFeed\InstagramData::user_check() ) {
// submit button
echo $this->form()->submit_button('Get New Token', 'primary large', 'ig_token_update');
} else {
Expand Down
Loading

0 comments on commit bcab0c9

Please sign in to comment.