Version Description
- Fixed: Compatibility with Instagram updated API.
Download this release
Release Info
Developer | webdorado |
Plugin | Photo Gallery by WD – Responsive Photo Gallery |
Version | 1.4.4 |
Comparing to | |
See all releases |
Code changes from version 1.4.3 to 1.4.4
- admin/views/Galleries.php +0 -4
- framework/WDWLibraryEmbed.php +22 -51
- js/bwg.js +0 -3
- photo-gallery.php +3 -3
- readme.txt +4 -1
admin/views/Galleries.php
CHANGED
@@ -323,10 +323,6 @@ class GalleriesView_bwg extends AdminView_bwg {
|
|
323 |
</div>
|
324 |
<!-- instagram gallery -->
|
325 |
<div id="add_instagram_gallery" <?php echo($params['gallery_type'] == 'instagram' ? '' : 'style="display:none"'); ?>>
|
326 |
-
<div class="wd-group" id='tr_gallery_source'>
|
327 |
-
<label class="wd-label" for="gallery_source"><?php _e('Instagram username', BWG()->prefix); ?></label>
|
328 |
-
<input type="text" id="gallery_source" name="gallery_source" value="<?php echo $row->gallery_source; ?>" class="bwg_requried" />
|
329 |
-
</div>
|
330 |
<div class="wd-group" id='tr_autogallery_image_number'>
|
331 |
<label class="wd-label" for="autogallery_image_number"><?php _e('Number of Instagram recent posts to add to gallery', BWG()->prefix); ?> </label>
|
332 |
<input type="number" id="autogallery_image_number" name="autogallery_image_number" value="<?php echo $row->autogallery_image_number; ?>" />
|
323 |
</div>
|
324 |
<!-- instagram gallery -->
|
325 |
<div id="add_instagram_gallery" <?php echo($params['gallery_type'] == 'instagram' ? '' : 'style="display:none"'); ?>>
|
|
|
|
|
|
|
|
|
326 |
<div class="wd-group" id='tr_autogallery_image_number'>
|
327 |
<label class="wd-label" for="autogallery_image_number"><?php _e('Number of Instagram recent posts to add to gallery', BWG()->prefix); ?> </label>
|
328 |
<input type="number" id="autogallery_image_number" name="autogallery_image_number" value="<?php echo $row->autogallery_image_number; ?>" />
|
framework/WDWLibraryEmbed.php
CHANGED
@@ -633,81 +633,52 @@ class WDWLibraryEmbed {
|
|
633 |
|
634 |
}
|
635 |
|
636 |
-
/**
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
public static function add_instagram_gallery($instagram_user, $access_token, $whole_post, $autogallery_image_number) {
|
642 |
@set_time_limit(0);
|
643 |
-
$
|
644 |
-
|
645 |
-
|
646 |
-
return json_encode(array("error", "cannot get Instagram user parameters"));
|
647 |
-
}
|
648 |
-
$user_json = wp_remote_retrieve_body($instagram_user_response);
|
649 |
-
$response_code = json_decode($user_json)->meta->code;
|
650 |
-
|
651 |
-
/*
|
652 |
-
instagram API returns
|
653 |
-
|
654 |
-
*wrong username
|
655 |
-
{"meta":{"code":200},"data":[]}
|
656 |
-
|
657 |
-
*wrong access_token
|
658 |
-
{"meta":{"error_type":"OAuthParameterException","code":400,"error_message":"The access_token provided is invalid and does not match a valid application."}}
|
659 |
-
*/
|
660 |
-
if($response_code != 200){
|
661 |
-
return json_encode(array("error", json_decode($user_json)->meta->error_message));
|
662 |
-
}
|
663 |
-
if(!property_exists(json_decode($user_json), 'data')){
|
664 |
-
return json_encode(array("error", "cannot get Instagram user parameters"));
|
665 |
-
}
|
666 |
-
if(empty(json_decode($user_json)->data)){
|
667 |
-
return json_encode(array("error", "wrong Instagram username"));
|
668 |
-
}
|
669 |
-
$user_data = json_decode($user_json)->data[0];
|
670 |
-
$user_id = $user_data->id;
|
671 |
-
$instagram_posts_response = wp_remote_get("https://api.instagram.com/v1/users/".$user_id."/media/recent/?access_token=".$access_token."&count=".$autogallery_image_number);
|
672 |
-
if ( is_wp_error( $instagram_posts_response ) ) {
|
673 |
-
return json_encode(array("error", "cannot get Instagram user posts"));
|
674 |
}
|
675 |
$posts_json = wp_remote_retrieve_body($instagram_posts_response);
|
676 |
$response_code = json_decode($posts_json)->meta->code;
|
677 |
-
|
678 |
/*
|
679 |
instagram API returns
|
680 |
*private user
|
681 |
'{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}'
|
682 |
*/
|
683 |
-
if($response_code != 200){
|
684 |
-
return json_encode(array("error", json_decode($posts_json)->meta->error_message));
|
685 |
}
|
686 |
-
if(!property_exists(json_decode($posts_json), 'data')){
|
687 |
-
return json_encode(array("error", "cannot get Instagram user posts data"));
|
688 |
}
|
689 |
/*
|
690 |
if instagram user has no posts
|
691 |
*/
|
692 |
-
if(empty(json_decode($posts_json)->data)){
|
693 |
-
return json_encode(array("error", "Instagram user has no posts"));
|
694 |
}
|
695 |
$posts_array = json_decode($posts_json)->data;
|
696 |
$instagram_album_data = array();
|
697 |
-
if($whole_post==1){
|
698 |
-
$post_flag ="post";
|
699 |
}
|
700 |
-
else{
|
701 |
-
$post_flag ='';
|
702 |
}
|
703 |
-
foreach ($posts_array as $post_data) {
|
704 |
$url = $post_data->link . $post_flag;
|
705 |
-
$post_to_embed = json_decode(self::add_embed($url, $post_data),
|
706 |
/* if add_embed function did not indexed array because of error */
|
707 |
-
if(!isset($post_to_embed[0]) ){
|
708 |
array_push($instagram_album_data, $post_to_embed);
|
709 |
}
|
710 |
}
|
|
|
711 |
return json_encode($instagram_album_data);
|
712 |
}
|
713 |
|
633 |
|
634 |
}
|
635 |
|
636 |
+
/**
|
637 |
+
* @return json_encode(array("error","error message")) on failure
|
638 |
+
* @return json_encode(array of data of instagram user recent posts) on success
|
639 |
+
*/
|
640 |
+
public static function add_instagram_gallery( $instagram_user, $access_token, $whole_post, $autogallery_image_number ) {
|
|
|
641 |
@set_time_limit(0);
|
642 |
+
$instagram_posts_response = wp_remote_get("https://api.instagram.com/v1/users/self/media/recent/?access_token=" . $access_token . "&count=" . $autogallery_image_number);
|
643 |
+
if ( is_wp_error($instagram_posts_response) ) {
|
644 |
+
return json_encode(array( "error", "cannot get Instagram user posts" ));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
}
|
646 |
$posts_json = wp_remote_retrieve_body($instagram_posts_response);
|
647 |
$response_code = json_decode($posts_json)->meta->code;
|
|
|
648 |
/*
|
649 |
instagram API returns
|
650 |
*private user
|
651 |
'{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}'
|
652 |
*/
|
653 |
+
if ( $response_code != 200 ) {
|
654 |
+
return json_encode(array( "error", json_decode($posts_json)->meta->error_message ));
|
655 |
}
|
656 |
+
if ( !property_exists(json_decode($posts_json), 'data') ) {
|
657 |
+
return json_encode(array( "error", "cannot get Instagram user posts data" ));
|
658 |
}
|
659 |
/*
|
660 |
if instagram user has no posts
|
661 |
*/
|
662 |
+
if ( empty(json_decode($posts_json)->data) ) {
|
663 |
+
return json_encode(array( "error", "Instagram user has no posts" ));
|
664 |
}
|
665 |
$posts_array = json_decode($posts_json)->data;
|
666 |
$instagram_album_data = array();
|
667 |
+
if ( $whole_post == 1 ) {
|
668 |
+
$post_flag = "post";
|
669 |
}
|
670 |
+
else {
|
671 |
+
$post_flag = '';
|
672 |
}
|
673 |
+
foreach ( $posts_array as $post_data ) {
|
674 |
$url = $post_data->link . $post_flag;
|
675 |
+
$post_to_embed = json_decode(self::add_embed($url, $post_data), TRUE);
|
676 |
/* if add_embed function did not indexed array because of error */
|
677 |
+
if ( !isset($post_to_embed[0]) ) {
|
678 |
array_push($instagram_album_data, $post_to_embed);
|
679 |
}
|
680 |
}
|
681 |
+
|
682 |
return json_encode($instagram_album_data);
|
683 |
}
|
684 |
|
js/bwg.js
CHANGED
@@ -1109,9 +1109,6 @@ function bwg_check_instagram_gallery_input(instagram_client_id, from_popup){
|
|
1109 |
}
|
1110 |
else{
|
1111 |
if (bwg_is_instagram_gallery()){
|
1112 |
-
if(spider_check_required('gallery_source', 'Instagram user URL')){
|
1113 |
-
is_error = true;
|
1114 |
-
}
|
1115 |
if(instagram_client_id == ''){
|
1116 |
alert(bwg_objectL10B.bwg_access_token);
|
1117 |
is_error = true;
|
1109 |
}
|
1110 |
else{
|
1111 |
if (bwg_is_instagram_gallery()){
|
|
|
|
|
|
|
1112 |
if(instagram_client_id == ''){
|
1113 |
alert(bwg_objectL10B.bwg_access_token);
|
1114 |
is_error = true;
|
photo-gallery.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Photo Gallery
|
4 |
* Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
|
5 |
* Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
|
6 |
-
* Version: 1.4.
|
7 |
* Author: Photo Gallery Team
|
8 |
* Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -83,8 +83,8 @@ final class BWG {
|
|
83 |
$this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
|
84 |
$this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
|
85 |
$this->main_file = plugin_basename(__FILE__);
|
86 |
-
$this->plugin_version = '1.4.
|
87 |
-
$this->db_version = '1.4.
|
88 |
$this->prefix = 'bwg';
|
89 |
$this->nicename = __('Photo Gallery', $this->prefix);
|
90 |
|
3 |
* Plugin Name: Photo Gallery
|
4 |
* Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
|
5 |
* Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
|
6 |
+
* Version: 1.4.4
|
7 |
* Author: Photo Gallery Team
|
8 |
* Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
83 |
$this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
|
84 |
$this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
|
85 |
$this->main_file = plugin_basename(__FILE__);
|
86 |
+
$this->plugin_version = '1.4.4';
|
87 |
+
$this->db_version = '1.4.4';
|
88 |
$this->prefix = 'bwg';
|
89 |
$this->nicename = __('Photo Gallery', $this->prefix);
|
90 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,wdsupport,photogallerysupport
|
|
3 |
Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 1.4.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -279,6 +279,9 @@ Choose whether to display random or the first/last specific number of images.
|
|
279 |
|
280 |
== Changelog ==
|
281 |
|
|
|
|
|
|
|
282 |
= 1.4.3 =
|
283 |
* Fixed: Embed type galleries.
|
284 |
* Fixed: Minor bug with PHP v5.3.
|
3 |
Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 1.4.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
279 |
|
280 |
== Changelog ==
|
281 |
|
282 |
+
= 1.4.4 =
|
283 |
+
* Fixed: Compatibility with Instagram updated API.
|
284 |
+
|
285 |
= 1.4.3 =
|
286 |
* Fixed: Embed type galleries.
|
287 |
* Fixed: Minor bug with PHP v5.3.
|