Document Gallery - Version 2.0.2

Version Description

  • Bug Fix: Imagick was actually never working... My bad -- it is now! Thanks to kaldimar for reporting this.
  • Enhancement: Document Gallery en el Espaol por Andrew de WebHostingHub. (To help translate to another language, see here.)
Download this release

Release Info

Developer dan.rossiter
Plugin Icon 128x128 Document Gallery
Version 2.0.2
Comparing to
See all releases

Code changes from version 2.0.1 to 2.0.2

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: dan.rossiter
3
  Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Requires at least: 3.6
5
  Tested up to: 3.8.1
6
- Stable tag: 2.0.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -259,6 +259,13 @@ Note that the display inherits styling from your active theme.
259
  forum](http://wordpress.org/support/plugin/document-gallery) if you have
260
  ideas)!
261
 
 
 
 
 
 
 
 
262
  = 2.0.1 =
263
  * **Bug Fix:** Resolves issue with `2.0` where DG options were not properly
264
  initialized when the plugin was updated. This caused the settings page to
3
  Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Requires at least: 3.6
5
  Tested up to: 3.8.1
6
+ Stable tag: 2.0.2
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
259
  forum](http://wordpress.org/support/plugin/document-gallery) if you have
260
  ideas)!
261
 
262
+ = 2.0.2 =
263
+ * **Bug Fix:** Imagick was actually never working... My bad -- it is now! Thanks to
264
+ [kaldimar](http://wordpress.org/support/profile/kaldimar) for reporting this.
265
+ * **Enhancement:** Document Gallery en el Español por Andrew de
266
+ [WebHostingHub](http://www.webhostinghub.com/). (To help translate to another
267
+ language, [see here](http://wordpress.org/support/topic/seeking-translators).)
268
+
269
  = 2.0.1 =
270
  * **Bug Fix:** Resolves issue with `2.0` where DG options were not properly
271
  initialized when the plugin was updated. This caused the settings page to
document-gallery.php CHANGED
@@ -4,7 +4,7 @@ defined('WPINC') OR exit;
4
  /*
5
  Plugin Name: Document Gallery
6
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
7
- Version: 2.0.1
8
  Author: Dan Rossiter
9
  Author URI: http://danrossiter.org/
10
  License: GPLv2
@@ -12,7 +12,7 @@ defined('WPINC') OR exit;
12
  */
13
 
14
  // define helper paths & URLs
15
- define('DG_VERSION', '2.0.1');
16
  define('DG_URL', plugin_dir_url(__FILE__));
17
  define('DG_PATH', plugin_dir_path(__FILE__));
18
  if(!defined('WP_INCLUDE_DIR')) {
@@ -113,7 +113,7 @@ class DocumentGallery {
113
  *=========================================================================*/
114
 
115
  public static function loadTextDomain() {
116
- load_plugin_textdomain('document-gallery', false, DG_PATH . 'languages');
117
  }
118
 
119
  /*==========================================================================
4
  /*
5
  Plugin Name: Document Gallery
6
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
7
+ Version: 2.0.2
8
  Author: Dan Rossiter
9
  Author URI: http://danrossiter.org/
10
  License: GPLv2
12
  */
13
 
14
  // define helper paths & URLs
15
+ define('DG_VERSION', '2.0.2');
16
  define('DG_URL', plugin_dir_url(__FILE__));
17
  define('DG_PATH', plugin_dir_path(__FILE__));
18
  if(!defined('WP_INCLUDE_DIR')) {
113
  *=========================================================================*/
114
 
115
  public static function loadTextDomain() {
116
+ load_plugin_textdomain('document-gallery', false, dirname(plugin_basename(__FILE__ )) . '/languages/');
117
  }
118
 
119
  /*==========================================================================
inc/class-image-editor-imagick.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WPINC') OR exit;
3
+
4
+ include_once WP_INCLUDE_DIR . '/class-wp-image-editor.php';
5
+ include_once WP_INCLUDE_DIR . '/class-wp-image-editor-imagick.php';
6
+
7
+ /**
8
+ * Extends WP_Image_Editor_Imagick to support specifying which
9
+ * page to open for an Imagick file.
10
+ *
11
+ * @author drossiter
12
+ */
13
+ class DG_Image_Editor_Imagick extends WP_Image_Editor_Imagick {
14
+ /**
15
+ * @var int The 0-indexed pg number
16
+ */
17
+ private $pg;
18
+
19
+ /**
20
+ * @param str $file
21
+ * @param int $pg The 0-indexed pg number to edit.
22
+ */
23
+ public function __construct($file, $pg = null) {
24
+ parent::__construct($file);
25
+ $this->pg = $pg;
26
+ }
27
+
28
+ /**
29
+ * Loads the filepath into Imagick object.
30
+ */
31
+ public function load() {
32
+ $ret = parent::load();
33
+
34
+ // set correct page number
35
+ if (!is_wp_error($ret) && !is_null($this->pg)) {
36
+ if (is_callable(array($this->image, 'setIteratorIndex'))) {
37
+ $this->image->setIteratorIndex($this->pg);
38
+ }
39
+ }
40
+
41
+ return $ret;
42
+ }
43
+ }
44
+ ?>
inc/class-setup.php CHANGED
@@ -51,19 +51,31 @@ class DG_Setup {
51
  global $dg_options;
52
 
53
  // first installation
54
- if (is_null($dg_options)) {
55
  $options = self::getDefaultOptions();
56
  add_option(DG_OPTION_NAME, $options);
57
  }
58
 
59
  // do update
60
  elseif (DG_VERSION !== $dg_options['version']) {
 
61
  $dg_options['version'] = DG_VERSION;
62
- update_option(DG_OPTION_NAME, $dg_options);
63
 
 
 
 
 
 
 
 
 
 
64
  if ('' !== $dg_options['css']['text']) {
65
  DocumentGallery::updateUserGalleryStyle($dg_options['css']['text']);
66
  }
 
 
 
67
  }
68
  }
69
 
51
  global $dg_options;
52
 
53
  // first installation
54
+ if (empty($dg_options)) {
55
  $options = self::getDefaultOptions();
56
  add_option(DG_OPTION_NAME, $options);
57
  }
58
 
59
  // do update
60
  elseif (DG_VERSION !== $dg_options['version']) {
61
+ // update version in DB
62
  $dg_options['version'] = DG_VERSION;
 
63
 
64
+ // remove previously-failed thumbs
65
+ $thumbs = $dg_options['thumber']['thumbs'];
66
+ foreach ($thumbs as $k => $v) {
67
+ if (false === $v) {
68
+ unset($dg_options['thumber']['thumbs'][$k]);
69
+ }
70
+ }
71
+
72
+ // re-edit CSS file
73
  if ('' !== $dg_options['css']['text']) {
74
  DocumentGallery::updateUserGalleryStyle($dg_options['css']['text']);
75
  }
76
+
77
+ // commit DB changes
78
+ update_option(DG_OPTION_NAME, $dg_options);
79
  }
80
  }
81
 
inc/class-thumber.php CHANGED
@@ -162,12 +162,10 @@ class DG_Thumber {
162
  * @return bool|str False on failure, URL to thumb on success.
163
  */
164
  public static function getImagickThumbnail($ID, $pg = 1) {
165
- include_once WP_INCLUDE_DIR . '/class-wp-image-editor.php';
166
- include_once WP_INCLUDE_DIR . '/class-wp-image-editor-imagick.php';
167
 
168
- $doc_path = get_attached_file($ID) . '[' . $pg - 1 . ']';
169
-
170
- $img = new WP_Image_Editor_Imagick($doc_path);
171
  $err = $img->load();
172
  if(is_wp_error($err)) {
173
  self::writeLog(
162
  * @return bool|str False on failure, URL to thumb on success.
163
  */
164
  public static function getImagickThumbnail($ID, $pg = 1) {
165
+ include_once DG_PATH . 'inc/class-image-editor-imagick.php';
 
166
 
167
+ $doc_path = get_attached_file($ID);
168
+ $img = new DG_Image_Editor_Imagick($doc_path, $pg - 1);
 
169
  $err = $img->load();
170
  if(is_wp_error($err)) {
171
  self::writeLog(
languages/document-gallery-es_ES.mo ADDED
Binary file
languages/document-gallery-es_ES.po ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 Document Gallery
2
+ # This file is distributed under the same license as the Document Gallery package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Document Gallery 2.0.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
+ "POT-Creation-Date: 2014-03-22 07:07:30+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-03-27 21:33-0600\n"
12
+ "Last-Translator: Dan Rossiter <dan.rossiters@gmail.com>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "X-Generator: Poedit 1.6.4\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "Language: es\n"
17
+
18
+ #: admin/class-admin.php:27
19
+ msgid "Settings"
20
+ msgstr "Configuración"
21
+
22
+ #: admin/class-admin.php:37
23
+ msgid "Document Gallery Settings"
24
+ msgstr "Configuración de Document Gallery"
25
+
26
+ #. Plugin Name of the plugin/theme
27
+ #: admin/class-admin.php:38
28
+ msgid "Document Gallery"
29
+ msgstr "Document Gallery"
30
+
31
+ #: admin/class-admin.php:67
32
+ msgid "Default Settings"
33
+ msgstr "Configuración por Defecto"
34
+
35
+ #: admin/class-admin.php:71
36
+ msgid "Thumbnail Generation"
37
+ msgstr "Generación de Miniaturas"
38
+
39
+ #: admin/class-admin.php:75
40
+ msgid "Custon CSS"
41
+ msgstr "CSS Personalizado"
42
+
43
+ #: admin/class-admin.php:79
44
+ msgid "Advanced Thumbnail Generation"
45
+ msgstr "Generación Avanzada de Miniatura "
46
+
47
+ #: admin/class-admin.php:91
48
+ msgid "Link to attachment page rather than to file"
49
+ msgstr "Enlace a la página del adjunto en lugar de al archivo"
50
+
51
+ #: admin/class-admin.php:103
52
+ msgid "Include document descriptions"
53
+ msgstr "Incluir descripciones de documentos"
54
+
55
+ #: admin/class-admin.php:115
56
+ msgid "Use auto-generated document thumbnails"
57
+ msgstr "Usar miniaturas de documento generadas automáticamente"
58
+
59
+ #: admin/class-admin.php:127
60
+ msgid "Include image attachments in gallery"
61
+ msgstr "Incluir adjuntos de imágenes en la galería"
62
+
63
+ #: admin/class-admin.php:139
64
+ msgid "Only look for attachments in post where [dg] is used"
65
+ msgstr "Buscar sólo los archivos adjuntos en correos donde se utiliza [dg]"
66
+
67
+ #: admin/class-admin.php:152
68
+ msgid "Ascending or decending sorting of documents"
69
+ msgstr "Clasificación de documentosascendente o descendente"
70
+
71
+ #: admin/class-admin.php:165
72
+ msgid "Which field to order documents by"
73
+ msgstr "Qué campo para ordenar los documentos por"
74
+
75
+ #: admin/class-admin.php:178
76
+ msgid ""
77
+ "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
78
+ msgstr ""
79
+ "Si los documentos coincidentes deben tener todos taxa_names (AND) o por lo "
80
+ "menos uno (OR)"
81
+
82
+ #: admin/class-admin.php:190
83
+ msgid "Locally generate thumbnails for audio & video files."
84
+ msgstr "Generar localmente las miniaturas para los archivos de audio y vídeo."
85
+
86
+ #: admin/class-admin.php:203
87
+ msgid ""
88
+ "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
89
+ "a> for faster local PDF processing (compared to Imagick)."
90
+ msgstr ""
91
+ "Usar <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
92
+ "a> para acelerar el procesamiento local de PDF (en comparación con Imagick)."
93
+
94
+ #: admin/class-admin.php:204
95
+ msgid ""
96
+ "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
97
+ "target=\"_blank\">Ghostscript</a>."
98
+ msgstr ""
99
+ "Su servidor no está configurado para ejecutar <a href=\"http://www."
100
+ "ghostscript.com/\" target=\"_blank\">Ghostscript</a>."
101
+
102
+ #: admin/class-admin.php:218
103
+ msgid ""
104
+ "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
105
+ "\">Imagick</a> to handle lots of filetypes locally."
106
+ msgstr ""
107
+ "Usar <a href=\"http://www.php.net/manual/es/book.imagick.php\" target="
108
+ "\"_blank\">Imagick</a> para manejar una gran cantidad de tipos de archivos "
109
+ "localmente."
110
+
111
+ #: admin/class-admin.php:219
112
+ msgid ""
113
+ "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
114
+ "book.imagick.php\" target=\"_blank\">Imagick</a>."
115
+ msgstr ""
116
+ "Su servidor no está configurado para ejecutar <a href=\"http://www.php.net/"
117
+ "manual/es/book.imagick.php\" target=\"_blank\">Imagick</a>."
118
+
119
+ #: admin/class-admin.php:233
120
+ msgid ""
121
+ "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
122
+ "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
123
+ "file types remotely."
124
+ msgstr ""
125
+ "Usar <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
126
+ "Drive Viewer</a> para generar imágenes en miniatura para archivos de MS "
127
+ "Office y muchos otros tipos de archivos de forma remota."
128
+
129
+ #: admin/class-admin.php:234
130
+ msgid "Your server does not allow remote HTTP access."
131
+ msgstr "Su servidor no permite el acceso HTTP remoto."
132
+
133
+ #: admin/class-admin.php:248
134
+ msgid "Successfully auto-detected the location of Ghostscript."
135
+ msgstr "La ubicación de Ghostscript fue auto-detectada con éxito."
136
+
137
+ #: admin/class-admin.php:249
138
+ msgid "Failed to auto-detect the location of Ghostscript."
139
+ msgstr "Fallo al auto-detectar la localización de Ghostscript."
140
+
141
+ #: admin/class-admin.php:257
142
+ msgid ""
143
+ "The following values will be used by default in the shortcode. You can still "
144
+ "manually set each of these values in each individual shortcode."
145
+ msgstr ""
146
+ "Los siguientes valores se utilizarán por defecto en el código corto. Todavía "
147
+ "se puede configurar manualmente cada uno de estos valores en cada código "
148
+ "corto individualmente."
149
+
150
+ #: admin/class-admin.php:264
151
+ msgid "Select which tools to use when generating thumbnails."
152
+ msgstr ""
153
+ "Seleccione las herramientas que se utilizan en la generación de imágenes en "
154
+ "miniatura."
155
+
156
+ #: admin/class-admin.php:270
157
+ msgid ""
158
+ "Enter custom CSS styling for use with document galleries. To see which ids "
159
+ "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
160
+ "\">style.css</a>."
161
+ msgstr ""
162
+ "Introduzca un estilo CSS personalizado para su uso con galerías de "
163
+ "documentos. Para ver los identificadores de clases de estilo, vea <a href="
164
+ "\"%s\" target=\"_blank\">style.css</a>."
165
+
166
+ #: admin/class-admin.php:288
167
+ msgid ""
168
+ "Unless you <em>really</em> know what you're doing, you should not touch "
169
+ "these values."
170
+ msgstr ""
171
+ "A menos que usted <em>realmente</em> sepa lo que está haciendo, no debe "
172
+ "tocar estos valores."
173
+
174
+ #: admin/class-admin.php:290
175
+ msgid ""
176
+ "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
177
+ msgstr ""
178
+ "NOTA: <code>exec()</code> no está accesible. Ghostscript no funcionará."
179
+
180
+ #: admin/class-admin.php:387
181
+ msgid "Failed to update CSS file."
182
+ msgstr "Falló actualizar el archivo CSS."
183
+
184
+ #: admin/class-admin.php:398
185
+ msgid "Invalid Ghostscript path given: "
186
+ msgstr "Camino dado de Ghostscript inválido:"
187
+
188
+ #: inc/class-gallery.php:88
189
+ msgid "Generated using Document Gallery. Get yours here: "
190
+ msgstr "Generado usando Document Gallery. Obtenga el suyo aquí:"
191
+
192
+ #: inc/class-gallery.php:91
193
+ msgid "No attachments to display. How boring! :("
194
+ msgstr "No hay adjuntos a mostrar. ¡Qué aburrido! :("
195
+
196
+ #: inc/class-gallery.php:92
197
+ msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
198
+ msgstr "El parámetro %s puede ser solo \"%s\" o \"%s.\" Usted entró \"%s.\""
199
+
200
+ #: inc/class-gallery.php:263
201
+ msgid "The following ID is invalid: "
202
+ msgid_plural "The following IDs are invalid: "
203
+ msgstr[0] "El ID siguiente no es válido:"
204
+ msgstr[1] "Los IDs siguientes son válidos:"
205
+
206
+ #: inc/class-gallery.php:329
207
+ msgid "The orderby value entered, \"%s,\" is not valid."
208
+ msgstr "El valor orderby entrado, \"%s,\" no es válido."
209
+
210
+ #: inc/class-gallery.php:438
211
+ msgid "The following attributes are invalid: "
212
+ msgstr "Los siguientes atributos son inválidos:"
213
+
214
+ #: inc/class-gallery.php:488
215
+ msgid "%s is not a valid term name in %s."
216
+ msgstr "%s no es un nombre de término válido en %s."
217
+
218
+ #: inc/class-thumber.php:131
219
+ msgid "Could not open file: "
220
+ msgstr "No se pudo abrir el archivo:"
221
+
222
+ #: inc/class-thumber.php:136
223
+ msgid "Could not write file: "
224
+ msgstr "No se pudo escribir el archivo:"
225
+
226
+ #: inc/class-thumber.php:174
227
+ msgid "Failed to open file in Imagick: "
228
+ msgstr "Falló abrir imagen en Imagick:"
229
+
230
+ #: inc/class-thumber.php:184
231
+ msgid "Failed to save image in Imagick: "
232
+ msgstr "Falló salvar imagen en Imagick:"
233
+
234
+ #: inc/class-thumber.php:244
235
+ msgid "Ghostscript failed: "
236
+ msgstr "Falló Ghostscript:"
237
+
238
+ #: inc/class-thumber.php:357
239
+ msgid "Failed to retrieve thumbnail from Google: "
240
+ msgstr "Falló obtener miniatura desde Google:"
241
+
242
+ #: inc/class-thumber.php:644
243
+ msgid "Failed to get image editor: "
244
+ msgstr "Falló obtener el editor de imagen:"
245
+
246
+ #: inc/class-thumber.php:655
247
+ msgid "Failed to save image: "
248
+ msgstr "Falló salvar la imagen:"
249
+
250
+ #. Description of the plugin/theme
251
+ msgid ""
252
+ "Display non-images (and images) in gallery format on a page or post with the "
253
+ "[dg] shortcode."
254
+ msgstr ""
255
+ "Mostrar los archivos que no son imágenes (e imágenes) en formato de galería "
256
+ "en una página o post con el código corto [dg]."
257
+
258
+ #. Author of the plugin/theme
259
+ msgid "Dan Rossiter"
260
+ msgstr "Dan Rossiter"
261
+
262
+ #. Author URI of the plugin/theme
263
+ msgid "http://danrossiter.org/"
264
+ msgstr "http://danrossiter.org/"
languages/document-gallery.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the same license as the Document Gallery package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Document Gallery 2.0\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
  "POT-Creation-Date: 2014-03-22 07:07:30+00:00\n"
8
  "MIME-Version: 1.0\n"
2
  # This file is distributed under the same license as the Document Gallery package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Document Gallery 2.0.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
  "POT-Creation-Date: 2014-03-22 07:07:30+00:00\n"
8
  "MIME-Version: 1.0\n"