Photo Gallery by WD – Responsive Photo Gallery - Version 1.0.2

Version Description

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (3) hide show
  1. filemanager/model.php +30 -12
  2. photo-gallery.php +1 -1
  3. readme.txt +1 -1
filemanager/model.php CHANGED
@@ -5,6 +5,8 @@
5
  * Time: 11:31 AM
6
  */
7
 
 
 
8
 
9
  class FilemanagerModel {
10
  ////////////////////////////////////////////////////////////////////////////////////////
@@ -155,9 +157,33 @@ class FilemanagerModel {
155
  return $result;
156
  }
157
 
158
-
159
  private function get_sorted_file_names($parent_dir, $sort_by, $sort_order) {
160
- $file_names = scandir($parent_dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  switch ($sort_by) {
162
  case 'name':
163
  natcasesort($file_names);
@@ -166,18 +192,10 @@ class FilemanagerModel {
166
  }
167
  break;
168
  case 'size':
169
- usort($file_names, function ($a, $b) use ($parent_dir, $sort_by, $sort_order) {
170
- $size_of_a = filesize($parent_dir . '/' . $a);
171
- $size_of_b = filesize($parent_dir . '/' . $b);
172
- return $sort_order == 'asc' ? $size_of_a > $size_of_b : $size_of_a < $size_of_b;
173
- });
174
  break;
175
  case 'date_modified':
176
- usort($file_names, function ($a, $b) use ($parent_dir, $sort_by, $sort_order) {
177
- $m_time_a = filemtime($parent_dir . '/' . $a);
178
- $m_time_b = filemtime($parent_dir . '/' . $b);
179
- return $sort_order == 'asc' ? $m_time_a > $m_time_b : $m_time_a < $m_time_b;
180
- });
181
  break;
182
  }
183
 
5
  * Time: 11:31 AM
6
  */
7
 
8
+ $p_dir;
9
+ $s_order;
10
 
11
  class FilemanagerModel {
12
  ////////////////////////////////////////////////////////////////////////////////////////
157
  return $result;
158
  }
159
 
 
160
  private function get_sorted_file_names($parent_dir, $sort_by, $sort_order) {
161
+ $file_names = scandir($parent_dir);
162
+
163
+ global $p_dir;
164
+ global $s_order;
165
+
166
+ $p_dir = $parent_dir;
167
+ $s_order = $sort_order;
168
+
169
+ function sort_by_size ($a, $b) {
170
+ global $p_dir;
171
+ global $s_order;
172
+
173
+ $size_of_a = filesize($p_dir . '/' . $a);
174
+ $size_of_b = filesize($p_dir . '/' . $b);
175
+ return $s_order == 'asc' ? $size_of_a > $size_of_b : $size_of_a < $size_of_b;
176
+ }
177
+
178
+ function sort_by_date($a, $b) {
179
+ global $p_dir;
180
+ global $s_order;
181
+
182
+ $m_time_a = filemtime($p_dir . '/' . $a);
183
+ $m_time_b = filemtime($p_dir . '/' . $b);
184
+ return $s_order == 'asc' ? $m_time_a > $m_time_b : $m_time_a < $m_time_b;
185
+ }
186
+
187
  switch ($sort_by) {
188
  case 'name':
189
  natcasesort($file_names);
192
  }
193
  break;
194
  case 'size':
195
+ usort($file_names, 'sort_by_size');
 
 
 
 
196
  break;
197
  case 'date_modified':
198
+ usort($file_names, 'sort_by_date');
 
 
 
 
199
  break;
200
  }
201
 
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * 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.
7
- * Version: 1.0.1
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * 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.
7
+ * Version: 1.0.2
8
  * Author: http://web-dorado.com/
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: gallery, galleries, photo , photo gallery , image gallery, video gallery, wordpress gallery plugin, images gallery, album , photo albums, Simple gallery, best gallery plugin , free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, image, photogallery, widget gallery, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
4
  Tags: gallery, galleries, photo , photo gallery , image gallery, video gallery, wordpress gallery plugin, images gallery, album , photo albums, Simple gallery, best gallery plugin , free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, image, photogallery, widget gallery, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, Fotogalerie, Galleria, galerie, galeri
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10