Document Gallery - Version 2.2

Version Description

  • Note: This release is the first release where development has been done by multiple people. I would like to give a massive thank you to demur who has been an equal partner throughout the development of this version. Couldn't have done it without you!
  • Note: With multiple developing this project, it made sense to setup a formal method to track issues and possible future enhancements. With this in mind we've begun to maintain an issue tracker. Feel free to read through possible future features and even suggest new features you would like to see!
  • Enhancement: You can now view which thumbnails have been generated and manually delete individual thumbnails from the Document Gallery settings page, located at Dashboard -> Settings -> Document Gallery.
  • Enhancement:* The logging for Document Gallery is now **much more advanced. Logging can be configured and viewed directly from the Document Gallery settings page.
  • Enhancement: Max width and height of generated thumbnails is now configurable.
  • Enhancement: We had a couple of reports of the Document Gallery options being corrupted in some installs, so we added functionality to force validation of option structure on save. This will not be of much use to most users, but will help us track down some of the more difficult to reproduce bugs.
  • Enhancement: For developers. New filters have been added to support modifying all aspects of HTML generated by the plugin. Look at the Installation tab for documentation on these new filters.
Download this release

Release Info

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

Code changes from version 2.1 to 2.2

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dan.rossiter
3
  Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 3.6
6
- Tested up to: 3.9.1
7
- Stable tag: 2.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,6 +22,16 @@ Watch the following video for a brief demonstration of Document Gallery in actio
22
 
23
  Read more in the **Installation** tab!
24
 
 
 
 
 
 
 
 
 
 
 
25
  = Developers =
26
 
27
  Document Gallery includes features intended to make integration with other plugins
@@ -195,42 +205,61 @@ For those unfamiliar with content filters, [here is some
195
  documentation](http://codex.wordpress.org/Plugin_API/Filter_Reference) that you
196
  should read before continuing.
197
 
198
- **Filter .document-icon Content**
199
 
200
- Document Gallery provides a filter allowing developers to customize
201
- the HTML returned. Specifically, the `div.document-icon` content, including
202
- the div itself, the URL to the attachment, the attachment icon, and the
203
- attachment title. Hooking into the `dg_doc_icon` filter will allow you to
204
- modify any of this content before it reaches your users.
 
 
205
 
206
- Any function using this filter will receive two parameters, the content to be
207
- filtered and the ID number of the file represented by the icon in question.
208
- If you are implementing something to override the plugin default functionality,
209
- it may be useful to be able to query various attributes of the attachment with
210
- this value.
211
 
212
- One example use for this filter, which I have personally used in a project I
213
- am working on, will add a query parameter to the end of each attachment URL.
214
- This parameter, `rid`, specifies the referring page and allows the page
215
- receiving the URL to dynamically detect which page ID the link came from.
216
 
217
- `function dg_doc_icon( $icon, $id ){
218
- $ptn = '/(.* href=")([^"]+)(".*)/s';
 
 
 
219
 
220
- if( !preg_match( $ptn, $icon, $matches ) || count( $matches ) !== 4 )
221
- return $icon;
 
222
 
223
- if( strpos( $matches[2], '?' ) !== false )
224
- return "{$matches[1]}{$matches[2]}&rid=".get_the_ID().$matches[3];
225
 
226
- return "{$matches[1]}{$matches[2]}?rid=".get_the_ID().$matches[3];
227
- }
228
- add_filter( 'dg_doc_icon', 'dg_doc_icon', null, 2 );`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
- Obviously this is just one very specific example, but anything that requires
231
- modifying the image tag, the anchor tag, or the title can be handled with this
232
- filter. Note that this function does not use the $id value it receives, which
233
- is perfectly alright.
234
 
235
  **Filter Thumbnail Generation Methods**
236
 
@@ -359,14 +388,45 @@ Note that the display inherits styling from your active theme.
359
 
360
  = Features For The Future =
361
 
362
- * Full integration with the new [Wordpress 3.5 Media
363
- Manager](http://codex.wordpress.org/Version_3.5#Highlights).
364
- * Option to open music or video files directly from your gallery.
365
- * Option to open documents directly from your gallery (à la [Google Drive
366
- Viewer](https://drive.google.com/viewer)).
367
- * Whatever else **you** would like (post on the [support
368
- forum](http://wordpress.org/support/plugin/document-gallery) if you have
369
- ideas)!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
  = 2.1 =
372
  * **Enhancement:** Document Gallery now supports
3
  Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 3.6
6
+ Tested up to: 4.0
7
+ Stable tag: 2.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
22
 
23
  Read more in the **Installation** tab!
24
 
25
+ = Translation =
26
+
27
+ Document Gallery has to-date been translated into **5** languages, listed below.
28
+
29
+ 1. **French** — *Thanks, Marc Liotard!*
30
+ 1. **Russian** — *Thanks, [demur](http://wordpress.org/support/profile/demur)!*
31
+ 1. **Spanish** — *Thanks, Andrew Kurtis and [WebHostingHub](http://www.webhostinghub.com/)!*
32
+ 1. **Swedish** — *Thanks, [mepmepmep](http://wordpress.org/support/profile/mepmepmep)!*
33
+ 1. **Ukrainian** — *Thanks, [demur](http://wordpress.org/support/profile/demur)!*
34
+
35
  = Developers =
36
 
37
  Document Gallery includes features intended to make integration with other plugins
205
  documentation](http://codex.wordpress.org/Plugin_API/Filter_Reference) that you
206
  should read before continuing.
207
 
208
+ **Filter HTML Output**
209
 
210
+ In Documnet Gallery version 2.2, we've released a more powerful HTML
211
+ templating framework, making all generated output filterable, and thus
212
+ configurable, by developers wishing to control the gallery output. Three
213
+ different filters are provided in order to access the various segments
214
+ of a gallery: `dg_gallery_template`, `dg_row_template`, and `dg_icon_template`.
215
+ These filtered templates are used when dynamically generating output for each
216
+ gallery.
217
 
218
+ *NOTE: The `dg_doc_icon` has been deprecated with the release and is
219
+ scheduled to be removed in a future release. If you are using this
220
+ filter, you are encouraged to replace its usages with `dg_icon_template`.*
 
 
221
 
222
+ Each of the following filters provides an bool argument which indicates
223
+ whither the gallery being generated will display descriptions, which
224
+ allows you to handle galleries with and without descriptions differently.
 
225
 
226
+ If you wish to wrap your galleries in some additional content, the
227
+ `dg_gallery_template` is the tool for the job. With it you can include
228
+ content prior to or following your document galleries. The filter
229
+ exposes 1 special tag which is replaced during gallery generation
230
+ with data specific to that gallery. The tag is described below:
231
 
232
+ * **%rows%**: This tag is replaced by all of the document gallery rows.
233
+ Everything before this string will be rendered before the gallery and
234
+ everything after this string will be rendered following the gallery.
235
 
 
 
236
 
237
+ If you wish to modify how gallery rows are generated, `dg_row_template`,
238
+ is provided for this purpose. This filter gives you control at the row
239
+ level for how a gallery will be generated. The filter exposes 2 special tags
240
+ which are replaced during gallery generation with row-specific data.
241
+ These tags are as follows:
242
+
243
+ * **%class%**: The class attribute value for this row.
244
+ * **%icons%**: The icon data for this row.
245
+
246
+
247
+ If you wish to modify the HTML that wraps individual icons, the
248
+ `dg_icon_template` filter is what you will use. The filter is passed
249
+ two arguments which may be used to gain additional information about
250
+ the document that will be used in generating this icon. The first
251
+ argument is a bool value which indicates whether descriptions will
252
+ be used along with the icon and the second value is an integer WordPress
253
+ attachment ID which may be used to lookup any relevant information
254
+ you need specific to that document. The filter exposes 4 special tags
255
+ which are replaced during gallery generation with document-specific data.
256
+ These tags are as follows:
257
+
258
+ * **%link%**: The URL that will be loaded when the user clicks the icon.
259
+ * **%img%**: The URL pointing the the image that will be displayed.
260
+ * **%title%**: The human-readable title of the attachment.
261
+ * **%title_attribute%**: The escaped title (above), safe for using HTML tag attributes.
262
 
 
 
 
 
263
 
264
  **Filter Thumbnail Generation Methods**
265
 
388
 
389
  = Features For The Future =
390
 
391
+ To see a list of features planned for the future as well as to propose your own
392
+ ideas for future Document Gallery development, take a look at our
393
+ [issue tracker](https://github.com/thenadz/document-gallery/issues).
394
+
395
+ = 2.2 =
396
+ * **Note:** This release is the first release where development has been done by
397
+ multiple people. I would like to give a massive thank you to
398
+ [demur](http://wordpress.org/support/profile/demur) who has been an equal
399
+ partner throughout the development of this version. Couldn't have done it without you!
400
+ * **Note:** With multiple developing this project, it made sense to setup
401
+ a formal method to track issues and possible future enhancements. With this in mind
402
+ we've begun to maintain an [issue tracker](https://github.com/thenadz/document-gallery/issues).
403
+ Feel free to read through possible future features and even suggest new features
404
+ you would like to see!
405
+ * **Enhancement:** You can now view which thumbnails have been generated and manually
406
+ delete individual thumbnails from the Document Gallery settings page, located at
407
+ Dashboard -> Settings -> Document Gallery.
408
+ * **Enhancement:* The logging for Document Gallery is now **much** more advanced.
409
+ Logging can be configured and viewed directly from the Document Gallery settings
410
+ page.
411
+ * **Enhancement:** Max width and height of generated thumbnails is now configurable.
412
+ * **Enhancement:** We had a couple of reports of the Document Gallery options
413
+ being corrupted in some installs, so we added functionality to force validation
414
+ of option structure on save. This will not be of much use to most users, but
415
+ will help us track down some of the more difficult to reproduce bugs.
416
+ * **Enhancement:** For developers. New filters have been added to support modifying all
417
+ aspects of HTML generated by the plugin. Look at the Installation tab for documentation
418
+ on these new filters.
419
+
420
+ = 2.1.1 =
421
+ * **Translation:** Thanks to [mepmepmep](http://wordpress.org/support/profile/mepmepmep)
422
+ who has translated Document Gallery into Swedish!
423
+ * **Translation:** Thanks to Marc Liotard who has translated Document Gallery into French!
424
+ * **Note:** If you would like to help translate Document Gallery into another language,
425
+ get started [here](http://wordpress.org/support/topic/seeking-translators)!
426
+ * **Note:** This is an extremely minor release, but big changes are on the
427
+ way in version `2.2`! Stay tuned as it should be going live in the very
428
+ near future. Look for a complete makeover of the admin options including
429
+ lots of new ways to configure DG to best meet your needs!
430
 
431
  = 2.1 =
432
  * **Enhancement:** Document Gallery now supports
admin/class-admin.php CHANGED
@@ -1,29 +1,70 @@
1
  <?php
2
  defined('WPINC') OR exit;
3
 
4
- class DG_Admin {
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  /**
7
  * Renders Document Gallery options page.
8
  */
9
  public static function renderOptions() { ?>
10
  <div class="wrap">
11
- <h2>Document Gallery Settings</h2>
12
 
13
- <form method="post" action="options.php">
14
- <?php settings_fields(DG_OPTION_NAME); ?>
15
- <?php do_settings_sections('document_gallery'); ?>
16
- <?php submit_button(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
17
  </form>
18
 
19
  </div>
20
- <?php }
21
 
22
  /**
23
  * Adds settings link to main plugin view.
24
  */
25
  public static function addSettingsLink($links) {
26
- $settings = '<a href="options-general.php?page=document_gallery">' .
27
  __('Settings', 'document-gallery') . '</a>';
28
  array_unshift($links, $settings);
29
  return $links;
@@ -33,47 +74,68 @@ class DG_Admin {
33
  * Adds Document Gallery settings page to admin navigation.
34
  */
35
  public static function addAdminPage() {
36
- add_options_page(
37
  __('Document Gallery Settings', 'document-gallery'),
38
  __('Document Gallery', 'document-gallery'),
39
- 'manage_options', 'document_gallery', array(__CLASS__, 'renderOptions'));
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  /**
43
  * Registers settings for the Document Gallery options page.
44
  */
45
  public static function registerSettings() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  global $dg_options;
47
 
48
  include_once DG_PATH . 'inc/class-gallery.php';
49
  include_once DG_PATH . 'inc/class-thumber.php';
50
 
51
- $defaults = $dg_options['gallery']['defaults'];
52
- $thumber_active = $dg_options['thumber']['active'];
53
- $thumber_gs = $dg_options['thumber']['gs'];
54
-
55
- register_setting(DG_OPTION_NAME, DG_OPTION_NAME, array(__CLASS__, 'validateSettings'));
56
 
57
  add_settings_section(
58
  'gallery_defaults', __('Default Settings', 'document-gallery'),
59
- array(__CLASS__, 'renderDefaultSettingsSection'), 'document_gallery');
60
 
61
  add_settings_section(
62
- 'thumber_active', __('Thumbnail Generation', 'document-gallery'),
63
- array(__CLASS__, 'renderThumberSection'), 'document_gallery');
64
 
65
  add_settings_section(
66
  'css', __('Custom CSS', 'document-gallery'),
67
- array(__CLASS__, 'renderCssSection'), 'document_gallery');
68
-
69
- add_settings_section(
70
- 'thumber_advanced', __('Advanced Thumbnail Generation', 'document-gallery'),
71
- array(__CLASS__, 'renderThumberAdvancedSection'), 'document_gallery');
72
 
73
  add_settings_field(
74
  'gallery_defaults_attachment_pg', 'attachment_pg',
75
  array(__CLASS__, 'renderCheckboxField'),
76
- 'document_gallery', 'gallery_defaults',
77
  array (
78
  'label_for' => 'label_gallery_defaults_attachment_pg',
79
  'name' => 'gallery_defaults][attachment_pg',
@@ -85,7 +147,7 @@ class DG_Admin {
85
  add_settings_field(
86
  'gallery_defaults_descriptions', 'descriptions',
87
  array(__CLASS__, 'renderCheckboxField'),
88
- 'document_gallery', 'gallery_defaults',
89
  array (
90
  'label_for' => 'label_gallery_defaults_descriptions',
91
  'name' => 'gallery_defaults][descriptions',
@@ -97,7 +159,7 @@ class DG_Admin {
97
  add_settings_field(
98
  'gallery_defaults_fancy', 'fancy',
99
  array(__CLASS__, 'renderCheckboxField'),
100
- 'document_gallery', 'gallery_defaults',
101
  array (
102
  'label_for' => 'label_gallery_defaults_fancy',
103
  'name' => 'gallery_defaults][fancy',
@@ -109,7 +171,7 @@ class DG_Admin {
109
  add_settings_field(
110
  'gallery_defaults_images', 'images',
111
  array(__CLASS__, 'renderCheckboxField'),
112
- 'document_gallery', 'gallery_defaults',
113
  array (
114
  'label_for' => 'label_gallery_defaults_images',
115
  'name' => 'gallery_defaults][images',
@@ -121,7 +183,7 @@ class DG_Admin {
121
  add_settings_field(
122
  'gallery_defaults_localpost', 'localpost',
123
  array(__CLASS__, 'renderCheckboxField'),
124
- 'document_gallery', 'gallery_defaults',
125
  array (
126
  'label_for' => 'label_gallery_defaults_localpost',
127
  'name' => 'gallery_defaults][localpost',
@@ -133,7 +195,7 @@ class DG_Admin {
133
  add_settings_field(
134
  'gallery_defaults_order', 'order',
135
  array(__CLASS__, 'renderSelectField'),
136
- 'document_gallery', 'gallery_defaults',
137
  array (
138
  'label_for' => 'label_gallery_defaults_order',
139
  'name' => 'gallery_defaults][order',
@@ -146,7 +208,7 @@ class DG_Admin {
146
  add_settings_field(
147
  'gallery_defaults_orderby', 'orderby',
148
  array(__CLASS__, 'renderSelectField'),
149
- 'document_gallery', 'gallery_defaults',
150
  array (
151
  'label_for' => 'label_gallery_defaults_orderby',
152
  'name' => 'gallery_defaults][orderby',
@@ -159,7 +221,7 @@ class DG_Admin {
159
  add_settings_field(
160
  'gallery_defaults_relation', 'relation',
161
  array(__CLASS__, 'renderSelectField'),
162
- 'document_gallery', 'gallery_defaults',
163
  array (
164
  'label_for' => 'label_gallery_defaults_relation',
165
  'name' => 'gallery_defaults][relation',
@@ -168,27 +230,27 @@ class DG_Admin {
168
  'option_name' => DG_OPTION_NAME,
169
  'description' => __('Whether matched documents must have all taxa_names (AND) or at least one (OR)', 'document-gallery')
170
  ));
171
-
172
  add_settings_field(
173
- 'thumber_active_av', 'Audio/Video',
174
  array(__CLASS__, 'renderCheckboxField'),
175
- 'document_gallery', 'thumber_active',
176
  array (
177
- 'label_for' => 'label_thumber_active_av',
178
- 'name' => 'thumber_active][av',
179
- 'value' => esc_attr($thumber_active['av']),
180
  'option_name' => DG_OPTION_NAME,
181
  'description' => esc_html__('Locally generate thumbnails for audio & video files.', 'document-gallery')
182
  ));
183
 
184
  add_settings_field(
185
- 'thumber_active_gs', 'Ghostscript',
186
  array(__CLASS__, 'renderCheckboxField'),
187
- 'document_gallery', 'thumber_active',
188
  array (
189
- 'label_for' => 'label_thumber_active_gs',
190
- 'name' => 'thumber_active][gs',
191
- 'value' => esc_attr($thumber_active['gs']),
192
  'option_name' => DG_OPTION_NAME,
193
  'description' => DG_Thumber::isGhostscriptAvailable()
194
  ? __('Use <a href="http://www.ghostscript.com/" target="_blank">Ghostscript</a> for faster local PDF processing (compared to Imagick).', 'document-gallery')
@@ -197,13 +259,13 @@ class DG_Admin {
197
  ));
198
 
199
  add_settings_field(
200
- 'thumber_active_imagick', 'Imagick',
201
  array(__CLASS__, 'renderCheckboxField'),
202
- 'document_gallery', 'thumber_active',
203
  array (
204
- 'label_for' => 'label_thumber_active_imagick',
205
- 'name' => 'thumber_active][imagick',
206
- 'value' => esc_attr($thumber_active['imagick']),
207
  'option_name' => DG_OPTION_NAME,
208
  'description' => DG_Thumber::isImagickAvailable()
209
  ? __('Use <a href="http://www.php.net/manual/en/book.imagick.php" target="_blank">Imagick</a> to handle lots of filetypes locally.', 'document-gallery')
@@ -212,13 +274,13 @@ class DG_Admin {
212
  ));
213
 
214
  add_settings_field(
215
- 'thumber_active_google', 'Google Drive Viewer',
216
  array(__CLASS__, 'renderCheckboxField'),
217
- 'document_gallery', 'thumber_active',
218
  array (
219
- 'label_for' => 'label_thumber_active_google',
220
- 'name' => 'thumber_active][google',
221
- 'value' => esc_attr($thumber_active['google']),
222
  'option_name' => DG_OPTION_NAME,
223
  'description' => DG_Thumber::isGoogleDriveAvailable()
224
  ? __('Use <a href="https://drive.google.com/viewer" target="_blank">Google Drive Viewer</a> to generate thumbnails for MS Office files and many other file types remotely.', 'document-gallery')
@@ -227,18 +289,302 @@ class DG_Admin {
227
  ));
228
 
229
  add_settings_field(
230
- 'thumber_advanced_gs', 'Ghostscript Absolute Path',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  array(__CLASS__, 'renderTextField'),
232
- 'document_gallery', 'thumber_advanced',
233
  array (
234
- 'label_for' => 'label_thumber_advanced_gs',
235
- 'name' => 'thumber_advanced][gs',
236
- 'value' => esc_attr($thumber_gs),
237
  'option_name' => DG_OPTION_NAME,
238
- 'description' => $thumber_gs
239
  ? __('Successfully auto-detected the location of Ghostscript.', 'document-gallery')
240
  : __('Failed to auto-detect the location of Ghostscript.', 'document-gallery')
241
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  }
243
 
244
  /**
@@ -259,42 +605,301 @@ class DG_Admin {
259
  * Render the Default Settings section.
260
  */
261
  public static function renderDefaultSettingsSection() { ?>
262
- <p><?php _e('The following values will be used by default in the shortcode. You can still manually set each of these values in each individual shortcode.', 'document-gallery'); ?></p>
263
- <?php }
264
 
265
  /**
266
  * Render the Thumber section.
267
  */
268
  public static function renderThumberSection() { ?>
269
- <p><?php _e('Select which tools to use when generating thumbnails.', 'document-gallery'); ?></p>
270
- <?php }
271
 
 
 
 
272
  public static function renderCssSection() {
273
  global $dg_options; ?>
274
- <p><?php printf(
275
  __('Enter custom CSS styling for use with document galleries. To see which ids and classes you can style, take a look at <a href="%s" target="_blank">style.css</a>.'),
276
  DG_URL . 'assets/css/style.css'); ?></p>
277
- <table class="form-table">
278
- <tbody>
279
- <tr valign="top">
280
- <td>
281
- <textarea name="document_gallery[css]" rows="10" cols="50" class="large-text code"><?php echo $dg_options['css']['text']; ?></textarea>
282
- </td>
283
- </tr>
284
- </tbody>
285
- </table>
286
- <?php }
287
 
288
  /**
289
  * Render the Thumber Advanced section.
290
  */
291
- public static function renderThumberAdvancedSection() {
292
  include_once DG_PATH . 'inc/class-thumber.php';?>
293
- <p><?php _e('Unless you <em>really</em> know what you\'re doing, you should not touch these values.', 'document-gallery'); ?></p>
294
- <?php if (!DG_Thumber::isExecAvailable()) : ?>
295
- <p><em><?php _e('NOTE: <code>exec()</code> is not accessible. Ghostscript will not function.', 'document-gallery'); ?></em></p>
296
- <?php endif; ?>
 
 
297
  <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  /**
300
  * Render a checkbox field.
@@ -302,7 +907,7 @@ class DG_Admin {
302
  */
303
  public static function renderCheckboxField($args) {
304
  $args['disabled'] = isset($args['disabled']) ? $args['disabled'] : false;
305
- printf('<input type="checkbox" value="1" name="%1$s[%2$s]" id="%3$s" %4$s %5$s/> %6$s',
306
  $args['option_name'],
307
  $args['name'],
308
  $args['label_for'],
@@ -316,12 +921,23 @@ class DG_Admin {
316
  * @param array $args
317
  */
318
  public static function renderTextField($args) {
319
- printf('<input type="text" value="%1$s" name="%2$s[%3$s]" id="%4$s" /> %5$s',
320
- $args['value'],
321
- $args['option_name'],
322
- $args['name'],
323
- $args['label_for'],
324
- $args['description']);
 
 
 
 
 
 
 
 
 
 
 
325
  }
326
 
327
  /**
@@ -345,73 +961,6 @@ class DG_Admin {
345
  print '</select> ' . $args['description'];
346
  }
347
 
348
- /**
349
- * Validates submitted options, sanitizing any invalid options.
350
- * @param array $values User-submitted new options.
351
- * @return array Sanitized new options.
352
- */
353
- public static function validateSettings($values) {
354
- include_once DG_PATH . 'inc/class-gallery.php';
355
-
356
- global $dg_options;
357
- $ret = $dg_options;
358
-
359
- // handle gallery shortcode defaults
360
- $errs = array();
361
- $ret['gallery']['defaults'] =
362
- DG_Gallery::sanitizeDefaults($values['gallery_defaults'], $errs);
363
-
364
- foreach ($errs as $k => $v) {
365
- add_settings_error(DG_OPTION_NAME, str_replace('_', '-', $k), $v);
366
- }
367
-
368
- // handle setting the active thumbers
369
- foreach ($ret['thumber']['active'] as $k => $v) {
370
- $ret['thumber']['active'][$k] = isset($values['thumber_active'][$k]);
371
- }
372
-
373
- // if new thumbers available, clear failed thumbnails for retry
374
- foreach ($dg_options['thumber']['active'] as $k => $v) {
375
- if (!$v && $ret['thumber']['active'][$k]) {
376
- foreach ($dg_options['thumber']['thumbs'] as $k => $v) {
377
- if (false === $v) {
378
- unset($ret['thumber']['thumbs'][$k]);
379
- }
380
- }
381
- break;
382
- }
383
- }
384
-
385
- // handle modified CSS
386
- if (trim($ret['css']['text']) !== trim($values['css'])) {
387
- $ret['css']['text'] = trim($values['css']);
388
- $ret['css']['version']++;
389
- $ret['css']['last-modified'] = gmdate('D, d M Y H:i:s');
390
- $ret['css']['etag'] = md5($ret['css']['last-modified']);
391
-
392
- if (empty($ret['css']['text'])) {
393
- unset($ret['css']['minified']);
394
- } else {
395
- $ret['css']['minified'] =
396
- DocumentGallery::compileCustomCss($ret['css']['text']);
397
- }
398
- }
399
-
400
- // handle setting the Ghostscript path
401
- if (isset($values['thumber_advanced']['gs']) &&
402
- 0 != strcmp($values['thumber_advanced']['gs'], $ret['thumber']['gs'])) {
403
- if (false === strpos($values['thumber_advanced']['gs'], ';')) {
404
- $ret['thumber']['gs'] = $values['thumber_advanced']['gs'];
405
- } else {
406
- add_settings_error(DG_OPTION_NAME, 'thumber-gs',
407
- __('Invalid Ghostscript path given: ', 'document-gallery')
408
- . $values['thumber_advanced']['gs']);
409
- }
410
- }
411
-
412
- return $ret;
413
- }
414
-
415
  /**
416
  * Blocks instantiation. All functions are static.
417
  */
1
  <?php
2
  defined('WPINC') OR exit;
3
 
4
+ DG_Admin::init();
5
 
6
+ class DG_Admin {
7
+ /**
8
+ * @var string The hook for the Document Gallery settings page.
9
+ */
10
+ private static $hook;
11
+
12
+ /**
13
+ * @var string The current tab being rendered.
14
+ */
15
+ private static $current;
16
+
17
+ /**
18
+ * @var multitype:string Associative array containing all tab names, keyed by tab slug.
19
+ */
20
+ private static $tabs;
21
+
22
+ /**
23
+ * Initializes static values for this class.
24
+ */
25
+ public static function init() {
26
+ if (empty(self::$tabs)) {
27
+ self::$tabs = array(
28
+ 'General' => __('General', 'document-gallery'),
29
+ 'Thumbnail' => __('Thumbnail Management', 'document-gallery'),
30
+ 'Logging' => __('Logging', 'document-gallery'),
31
+ 'Advanced' => __('Advanced', 'document-gallery'));
32
+ }
33
+ }
34
+
35
  /**
36
  * Renders Document Gallery options page.
37
  */
38
  public static function renderOptions() { ?>
39
  <div class="wrap">
40
+ <h2>Document Gallery Settings</h2>
41
 
42
+ <h2 class="nav-tab-wrapper">
43
+ <?php foreach (self::$tabs as $tab => $name) {
44
+ $class = ($tab == self::$current) ? ' nav-tab-active' : '';
45
+ echo '<a class="nav-tab '.$tab.'-tab'.$class.'" href="?page=' . DG_OPTION_NAME . '&tab='.$tab.'">'.$name.'</a>';
46
+ } ?>
47
+ </h2>
48
+
49
+ <form method="post" action="options.php" id="tab-<?php echo self::$current?>">
50
+ <input type="hidden" name="<?php echo DG_OPTION_NAME; ?>[tab]" value="<?php echo self::$current; ?>" />
51
+ <?php
52
+ settings_fields(DG_OPTION_NAME);
53
+ do_settings_sections(DG_OPTION_NAME);
54
+ if (self::$current != 'Thumbnail' && self::$current != 'Logging') {
55
+ submit_button();
56
+ }
57
+ ?>
58
  </form>
59
 
60
  </div>
61
+ <?php }
62
 
63
  /**
64
  * Adds settings link to main plugin view.
65
  */
66
  public static function addSettingsLink($links) {
67
+ $settings = '<a href="options-general.php?page=' . DG_OPTION_NAME . '">' .
68
  __('Settings', 'document-gallery') . '</a>';
69
  array_unshift($links, $settings);
70
  return $links;
74
  * Adds Document Gallery settings page to admin navigation.
75
  */
76
  public static function addAdminPage() {
77
+ DG_Admin::$hook = add_options_page(
78
  __('Document Gallery Settings', 'document-gallery'),
79
  __('Document Gallery', 'document-gallery'),
80
+ 'manage_options', DG_OPTION_NAME, array(__CLASS__, 'renderOptions'));
81
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueueScriptsAndStyles'));
82
+ }
83
+
84
+ /**
85
+ * Enqueues styles and scripts for the admin settings page.
86
+ */
87
+ public static function enqueueScriptsAndStyles($hook) {
88
+ if ($hook !== DG_Admin::$hook) return;
89
+
90
+ wp_enqueue_style('document-gallery-admin', DG_URL . 'assets/css/admin.css', null, DG_VERSION);
91
+ wp_enqueue_script('document-gallery-admin', DG_URL . 'assets/js/admin.js', array('jquery'), DG_VERSION, true);
92
  }
93
 
94
  /**
95
  * Registers settings for the Document Gallery options page.
96
  */
97
  public static function registerSettings() {
98
+ if (empty($_REQUEST['tab']) || !array_key_exists($_REQUEST['tab'], self::$tabs)) {
99
+ reset(self::$tabs);
100
+ self::$current = key(self::$tabs);
101
+ } else {
102
+ self::$current = $_REQUEST['tab'];
103
+ }
104
+
105
+ register_setting(DG_OPTION_NAME, DG_OPTION_NAME, array(__CLASS__, 'validateSettings'));
106
+
107
+ $funct = 'register' . self::$current . 'Settings';
108
+ DG_Admin::$funct();
109
+ }
110
+
111
+ /**
112
+ * Registers settings for the general tab.
113
+ */
114
+ private static function registerGeneralSettings() {
115
  global $dg_options;
116
 
117
  include_once DG_PATH . 'inc/class-gallery.php';
118
  include_once DG_PATH . 'inc/class-thumber.php';
119
 
120
+ $defaults = $dg_options['gallery'];
121
+ $active = $dg_options['thumber']['active'];
 
 
 
122
 
123
  add_settings_section(
124
  'gallery_defaults', __('Default Settings', 'document-gallery'),
125
+ array(__CLASS__, 'renderDefaultSettingsSection'), DG_OPTION_NAME);
126
 
127
  add_settings_section(
128
+ 'thumbnail_generation', __('Thumbnail Generation', 'document-gallery'),
129
+ array(__CLASS__, 'renderThumberSection'), DG_OPTION_NAME);
130
 
131
  add_settings_section(
132
  'css', __('Custom CSS', 'document-gallery'),
133
+ array(__CLASS__, 'renderCssSection'), DG_OPTION_NAME);
 
 
 
 
134
 
135
  add_settings_field(
136
  'gallery_defaults_attachment_pg', 'attachment_pg',
137
  array(__CLASS__, 'renderCheckboxField'),
138
+ DG_OPTION_NAME, 'gallery_defaults',
139
  array (
140
  'label_for' => 'label_gallery_defaults_attachment_pg',
141
  'name' => 'gallery_defaults][attachment_pg',
147
  add_settings_field(
148
  'gallery_defaults_descriptions', 'descriptions',
149
  array(__CLASS__, 'renderCheckboxField'),
150
+ DG_OPTION_NAME, 'gallery_defaults',
151
  array (
152
  'label_for' => 'label_gallery_defaults_descriptions',
153
  'name' => 'gallery_defaults][descriptions',
159
  add_settings_field(
160
  'gallery_defaults_fancy', 'fancy',
161
  array(__CLASS__, 'renderCheckboxField'),
162
+ DG_OPTION_NAME, 'gallery_defaults',
163
  array (
164
  'label_for' => 'label_gallery_defaults_fancy',
165
  'name' => 'gallery_defaults][fancy',
171
  add_settings_field(
172
  'gallery_defaults_images', 'images',
173
  array(__CLASS__, 'renderCheckboxField'),
174
+ DG_OPTION_NAME, 'gallery_defaults',
175
  array (
176
  'label_for' => 'label_gallery_defaults_images',
177
  'name' => 'gallery_defaults][images',
183
  add_settings_field(
184
  'gallery_defaults_localpost', 'localpost',
185
  array(__CLASS__, 'renderCheckboxField'),
186
+ DG_OPTION_NAME, 'gallery_defaults',
187
  array (
188
  'label_for' => 'label_gallery_defaults_localpost',
189
  'name' => 'gallery_defaults][localpost',
195
  add_settings_field(
196
  'gallery_defaults_order', 'order',
197
  array(__CLASS__, 'renderSelectField'),
198
+ DG_OPTION_NAME, 'gallery_defaults',
199
  array (
200
  'label_for' => 'label_gallery_defaults_order',
201
  'name' => 'gallery_defaults][order',
208
  add_settings_field(
209
  'gallery_defaults_orderby', 'orderby',
210
  array(__CLASS__, 'renderSelectField'),
211
+ DG_OPTION_NAME, 'gallery_defaults',
212
  array (
213
  'label_for' => 'label_gallery_defaults_orderby',
214
  'name' => 'gallery_defaults][orderby',
221
  add_settings_field(
222
  'gallery_defaults_relation', 'relation',
223
  array(__CLASS__, 'renderSelectField'),
224
+ DG_OPTION_NAME, 'gallery_defaults',
225
  array (
226
  'label_for' => 'label_gallery_defaults_relation',
227
  'name' => 'gallery_defaults][relation',
230
  'option_name' => DG_OPTION_NAME,
231
  'description' => __('Whether matched documents must have all taxa_names (AND) or at least one (OR)', 'document-gallery')
232
  ));
233
+
234
  add_settings_field(
235
+ 'thumbnail_generation_av', 'Audio/Video',
236
  array(__CLASS__, 'renderCheckboxField'),
237
+ DG_OPTION_NAME, 'thumbnail_generation',
238
  array (
239
+ 'label_for' => 'label_thumbnail_generation_av',
240
+ 'name' => 'thumbnail_generation][av',
241
+ 'value' => esc_attr($active['av']),
242
  'option_name' => DG_OPTION_NAME,
243
  'description' => esc_html__('Locally generate thumbnails for audio & video files.', 'document-gallery')
244
  ));
245
 
246
  add_settings_field(
247
+ 'thumbnail_generation_gs', 'Ghostscript',
248
  array(__CLASS__, 'renderCheckboxField'),
249
+ DG_OPTION_NAME, 'thumbnail_generation',
250
  array (
251
+ 'label_for' => 'label_thumbnail_generation_gs',
252
+ 'name' => 'thumbnail_generation][gs',
253
+ 'value' => esc_attr($active['gs']),
254
  'option_name' => DG_OPTION_NAME,
255
  'description' => DG_Thumber::isGhostscriptAvailable()
256
  ? __('Use <a href="http://www.ghostscript.com/" target="_blank">Ghostscript</a> for faster local PDF processing (compared to Imagick).', 'document-gallery')
259
  ));
260
 
261
  add_settings_field(
262
+ 'thumbnail_generation_imagick', 'Imagick',
263
  array(__CLASS__, 'renderCheckboxField'),
264
+ DG_OPTION_NAME, 'thumbnail_generation',
265
  array (
266
+ 'label_for' => 'label_thumbnail_generation_imagick',
267
+ 'name' => 'thumbnail_generation][imagick',
268
+ 'value' => esc_attr($active['imagick']),
269
  'option_name' => DG_OPTION_NAME,
270
  'description' => DG_Thumber::isImagickAvailable()
271
  ? __('Use <a href="http://www.php.net/manual/en/book.imagick.php" target="_blank">Imagick</a> to handle lots of filetypes locally.', 'document-gallery')
274
  ));
275
 
276
  add_settings_field(
277
+ 'thumbnail_generation_google', 'Google Drive Viewer',
278
  array(__CLASS__, 'renderCheckboxField'),
279
+ DG_OPTION_NAME, 'thumbnail_generation',
280
  array (
281
+ 'label_for' => 'label_thumbnail_generation_google',
282
+ 'name' => 'thumbnail_generation][google',
283
+ 'value' => esc_attr($active['google']),
284
  'option_name' => DG_OPTION_NAME,
285
  'description' => DG_Thumber::isGoogleDriveAvailable()
286
  ? __('Use <a href="https://drive.google.com/viewer" target="_blank">Google Drive Viewer</a> to generate thumbnails for MS Office files and many other file types remotely.', 'document-gallery')
289
  ));
290
 
291
  add_settings_field(
292
+ 'thumbnail_generation_width', 'Max Thumbnail Dimensions',
293
+ array(__CLASS__, 'renderMultiTextField'),
294
+ DG_OPTION_NAME, 'thumbnail_generation',
295
+ array (
296
+ array (
297
+ 'label_for' => 'label_advanced_width',
298
+ 'name' => 'thumbnail_generation][width',
299
+ 'value' => esc_attr($dg_options['thumber']['width']),
300
+ 'type' => 'number" min="1" step="1',
301
+ 'option_name' => DG_OPTION_NAME,
302
+ 'description' => ' x '),
303
+ array (
304
+ 'label_for' => 'label_advanced_height',
305
+ 'name' => 'thumbnail_generation][height',
306
+ 'value' => esc_attr($dg_options['thumber']['height']),
307
+ 'type' => 'number" min="1" step="1',
308
+ 'option_name' => DG_OPTION_NAME,
309
+ 'description' => __('The max width and height (in pixels) that thumbnails will be generated.', 'document-gallery'))
310
+ ));
311
+ }
312
+
313
+ /**
314
+ * Registers settings for the thumbnail management tab.
315
+ */
316
+ private static function registerThumbnailSettings() {
317
+ add_settings_section(
318
+ 'thumbnail_table', '',
319
+ array(__CLASS__, 'renderThumbnailSection'), DG_OPTION_NAME);
320
+ }
321
+
322
+ /**
323
+ * Registers settings for the logging tab.
324
+ */
325
+ private static function registerLoggingSettings() {
326
+ add_settings_section(
327
+ 'logging_table', '',
328
+ array(__CLASS__, 'renderLoggingSection'), DG_OPTION_NAME);
329
+ }
330
+
331
+ /**
332
+ * Registers settings for the advanced tab.
333
+ */
334
+ private static function registerAdvancedSettings() {
335
+ global $dg_options;
336
+
337
+ add_settings_section(
338
+ 'advanced', __('Advanced Thumbnail Generation', 'document-gallery'),
339
+ array(__CLASS__, 'renderAdvancedSection'), DG_OPTION_NAME);
340
+
341
+ add_settings_field(
342
+ 'advanced_logging', 'Logging',
343
+ array(__CLASS__, 'renderCheckboxField'),
344
+ DG_OPTION_NAME, 'advanced',
345
+ array (
346
+ 'label_for' => 'label_advanced_logging',
347
+ 'name' => 'logging',
348
+ 'value' => esc_attr($dg_options['logging']),
349
+ 'option_name' => DG_OPTION_NAME,
350
+ 'description' => __('Whether to log debug and error information related to Document Gallery.', 'document-gallery')
351
+ ));
352
+
353
+ add_settings_field(
354
+ 'advanced_validation', 'Option Validation',
355
+ array(__CLASS__, 'renderCheckboxField'),
356
+ DG_OPTION_NAME, 'advanced',
357
+ array (
358
+ 'label_for' => 'label_advanced_validation',
359
+ 'name' => 'validation',
360
+ 'value' => esc_attr($dg_options['validation']),
361
+ 'option_name' => DG_OPTION_NAME,
362
+ 'description' => __('Whether option structure should be validated before save. This is not generally necessary.', 'document-gallery')
363
+ ));
364
+
365
+ add_settings_field(
366
+ 'advanced_thumb_timeout', 'Thumbnail Generation Timeout',
367
+ array(__CLASS__, 'renderTextField'),
368
+ DG_OPTION_NAME, 'advanced',
369
+ array (
370
+ 'label_for' => 'label_advanced_thumb_timeout',
371
+ 'name' => 'timeout',
372
+ 'value' => esc_attr($dg_options['thumber']['timeout']),
373
+ 'type' => 'number" min="1" step="1',
374
+ 'option_name' => DG_OPTION_NAME,
375
+ 'description' => __('Max number of seconds to wait for thumbnail generation before defaulting to filetype icons.', 'document-gallery') .
376
+ ' <em>' . __('Note that generation will continue where timeout happened next time the gallery is loaded.', 'document-gallery') . '</em>'));
377
+
378
+ add_settings_field(
379
+ 'advanced_gs', 'Ghostscript Absolute Path',
380
  array(__CLASS__, 'renderTextField'),
381
+ DG_OPTION_NAME, 'advanced',
382
  array (
383
+ 'label_for' => 'label_advanced_gs',
384
+ 'name' => 'gs',
385
+ 'value' => esc_attr($dg_options['thumber']['gs']),
386
  'option_name' => DG_OPTION_NAME,
387
+ 'description' => $dg_options['thumber']['gs']
388
  ? __('Successfully auto-detected the location of Ghostscript.', 'document-gallery')
389
  : __('Failed to auto-detect the location of Ghostscript.', 'document-gallery')
390
  ));
391
+
392
+ add_settings_section(
393
+ 'advanced_options_dump', __('Options Array Dump', 'document-gallery'),
394
+ array(__CLASS__, 'renderOptionsDumpSection'), DG_OPTION_NAME);
395
+ }
396
+
397
+ /**
398
+ * Validates submitted options, sanitizing any invalid options.
399
+ * @param array $values User-submitted new options.
400
+ * @return array Sanitized new options.
401
+ */
402
+ public static function validateSettings($values) {
403
+ if (empty($values['tab']) || !array_key_exists($values['tab'], self::$tabs)) {
404
+ reset(self::$tabs);
405
+ $values['tab'] = key(self::$tabs);
406
+ }
407
+ $funct = 'validate'.$values['tab'].'Settings';
408
+ unset($values['tab']);
409
+ return DG_Admin::$funct($values);
410
+ }
411
+
412
+ /**
413
+ * Validates general settings, sanitizing any invalid options.
414
+ * @param array $values User-submitted new options.
415
+ * @return array Sanitized new options.
416
+ */
417
+ private static function validateGeneralSettings($values) {
418
+ global $dg_options;
419
+ $ret = $dg_options;
420
+
421
+ include_once DG_PATH . 'inc/class-gallery.php';
422
+
423
+ $thumbs_cleared = false;
424
+
425
+ // handle gallery shortcode defaults
426
+ $errs = array();
427
+ $ret['gallery'] = DG_Gallery::sanitizeDefaults($values['gallery_defaults'], $errs);
428
+
429
+ foreach ($errs as $k => $v) {
430
+ add_settings_error(DG_OPTION_NAME, str_replace('_', '-', $k), $v);
431
+ }
432
+
433
+ // handle setting width
434
+ if (isset($values['thumbnail_generation']['width'])) {
435
+ $width = (int)$values['thumbnail_generation']['width'];
436
+ if ($width > 0) {
437
+ $ret['thumber']['width'] = $width;
438
+ } else {
439
+ add_settings_error(DG_OPTION_NAME, 'thumber-width',
440
+ __('Invalid width given: ', 'document-gallery') . $values['thumbnail_generation']['width']);
441
+ }
442
+
443
+ unset($values['thumbnail_generation']['width']);
444
+ }
445
+
446
+ // handle setting height
447
+ if (isset($values['thumbnail_generation']['height'])) {
448
+ $height = (int)$values['thumbnail_generation']['height'];
449
+ if ($height > 0) {
450
+ $ret['thumber']['height'] = $height;
451
+ } else {
452
+ add_settings_error(DG_OPTION_NAME, 'thumber-height',
453
+ __('Invalid height given: ', 'document-gallery') . $values['thumbnail_generation']['height']);
454
+ }
455
+
456
+ unset($values['thumbnail_generation']['width']);
457
+ }
458
+
459
+ // delete thumb cache to force regeneration if max dimensions changed
460
+ if ($ret['thumber']['width'] !== $dg_options['thumber']['width'] ||
461
+ $ret['thumber']['height'] !== $dg_options['thumber']['height']) {
462
+ foreach ($ret['thumber']['thumbs'] as $v) {
463
+ if (isset($v['thumber'])) {
464
+ @unlink($v['thumb_path']);
465
+ }
466
+ }
467
+
468
+ $ret['thumber']['thumbs'] = array();
469
+ $thumbs_cleared = true;
470
+ }
471
+
472
+ // handle setting the active thumbers
473
+ foreach (array_keys($ret['thumber']['active']) as $k) {
474
+ $ret['thumber']['active'][$k] = isset($values['thumbnail_generation'][$k]);
475
+ }
476
+
477
+ // if new thumbers available, clear failed thumbnails for retry
478
+ if (!$thumbs_cleared) {
479
+ foreach ($dg_options['thumber']['active'] as $k => $v) {
480
+ if (!$v && $ret['thumber']['active'][$k]) {
481
+ foreach ($dg_options['thumber']['thumbs'] as $k => $v) {
482
+ if (empty($v['thumber'])) {
483
+ unset($ret['thumber']['thumbs'][$k]);
484
+ }
485
+ }
486
+ break;
487
+ }
488
+ }
489
+ }
490
+
491
+ // handle modified CSS
492
+ if (trim($ret['css']['text']) !== trim($values['css'])) {
493
+ $ret['css']['text'] = trim($values['css']);
494
+ $ret['css']['version']++;
495
+ $ret['css']['last-modified'] = gmdate('D, d M Y H:i:s');
496
+ $ret['css']['etag'] = md5($ret['css']['last-modified']);
497
+
498
+ if (empty($ret['css']['text'])) {
499
+ unset($ret['css']['minified']);
500
+ } else {
501
+ $ret['css']['minified'] = DocumentGallery::compileCustomCss($ret['css']['text']);
502
+ }
503
+ }
504
+
505
+ return $ret;
506
+ }
507
+
508
+ /**
509
+ * Validates thumbnail management settings, sanitizing any invalid options.
510
+ * @param array $values User-submitted new options.
511
+ * @return array Sanitized new options.
512
+ */
513
+ private static function validateThumbnailSettings($values) {
514
+ global $dg_options;
515
+ $ret = $dg_options;
516
+
517
+ if (isset($values['ids'])) {
518
+ $deleted = array_values(array_intersect(array_keys($dg_options['thumber']['thumbs']), $values['ids']));
519
+
520
+ foreach ($deleted as $k) {
521
+ if (isset($ret['thumber']['thumbs'][$k]['thumber'])) {
522
+ @unlink($ret['thumber']['thumbs'][$k]['thumb_path']);
523
+ }
524
+
525
+ unset($ret['thumber']['thumbs'][$k]);
526
+ }
527
+
528
+ if (isset($values['ajax'])) {
529
+ echo '[' . implode(',', $deleted) . ']';
530
+ add_filter('wp_redirect', function(){ die; }, 1, 0);
531
+ }
532
+ }
533
+
534
+ return $ret;
535
+ }
536
+
537
+ /**
538
+ * Validates logging settings, sanitizing any invalid options.
539
+ * @param array $values User-submitted new options.
540
+ * @return array Sanitized new options.
541
+ */
542
+ private static function validateLoggingSettings($values) {
543
+ global $dg_options;
544
+ if (isset($values['clearLog'])) {
545
+ DG_Logger::clearLog();
546
+ }
547
+ return $dg_options;
548
+ }
549
+
550
+ /**
551
+ * Validates advanced settings, sanitizing any invalid options.
552
+ * @param array $values User-submitted new options.
553
+ * @return array Sanitized new options.
554
+ */
555
+ private static function validateAdvancedSettings($values) {
556
+ global $dg_options;
557
+ $ret = $dg_options;
558
+
559
+ // handle setting the Ghostscript path
560
+ if (isset($values['gs']) &&
561
+ 0 != strcmp($values['gs'], $ret['thumber']['gs'])) {
562
+ if (false === strpos($values['gs'], ';')) {
563
+ $ret['thumber']['gs'] = $values['gs'];
564
+ } else {
565
+ add_settings_error(DG_OPTION_NAME, 'thumber-gs',
566
+ __('Invalid Ghostscript path given: ', 'document-gallery') . $values['gs']);
567
+ }
568
+ }
569
+
570
+ // handle setting timeout
571
+ if (isset($values['timeout'])) {
572
+ $timeout = (int)$values['timeout'];
573
+ if ($timeout > 0) {
574
+ $ret['thumber']['timeout'] = $timeout;
575
+ } else {
576
+ add_settings_error(DG_OPTION_NAME, 'thumber-timeout',
577
+ __('Invalid timeout given: ', 'document-gallery') . $values['timeout']);
578
+ }
579
+ }
580
+
581
+ // validation checkbox
582
+ $ret['validation'] = isset($values['validation']);
583
+
584
+ // logging checkbox
585
+ $ret['logging'] = isset($values['logging']);
586
+
587
+ return $ret;
588
  }
589
 
590
  /**
605
  * Render the Default Settings section.
606
  */
607
  public static function renderDefaultSettingsSection() { ?>
608
+ <p><?php _e('The following values will be used by default in the shortcode. You can still manually set each of these values in each individual shortcode.', 'document-gallery'); ?></p>
609
+ <?php }
610
 
611
  /**
612
  * Render the Thumber section.
613
  */
614
  public static function renderThumberSection() { ?>
615
+ <p><?php _e('Select which tools to use when generating thumbnails.', 'document-gallery'); ?></p>
616
+ <?php }
617
 
618
+ /**
619
+ * Renders a text field for use when modifying the CSS to be printed in addition to the default CSS.
620
+ */
621
  public static function renderCssSection() {
622
  global $dg_options; ?>
623
+ <p><?php printf(
624
  __('Enter custom CSS styling for use with document galleries. To see which ids and classes you can style, take a look at <a href="%s" target="_blank">style.css</a>.'),
625
  DG_URL . 'assets/css/style.css'); ?></p>
626
+ <table class="form-table">
627
+ <tbody>
628
+ <tr valign="top">
629
+ <td>
630
+ <textarea name="<?php echo DG_OPTION_NAME; ?>[css]" rows="10" cols="50" class="large-text code"><?php echo $dg_options['css']['text']; ?></textarea>
631
+ </td>
632
+ </tr>
633
+ </tbody>
634
+ </table>
635
+ <?php }
636
 
637
  /**
638
  * Render the Thumber Advanced section.
639
  */
640
+ public static function renderAdvancedSection() {
641
  include_once DG_PATH . 'inc/class-thumber.php';?>
642
+ <p><?php _e('Unless you <em>really</em> know what you\'re doing, you should not touch these values.', 'document-gallery'); ?></p>
643
+ <?php if (!DG_Thumber::isExecAvailable()) : ?>
644
+ <p>
645
+ <em><?php _e('NOTE: <code>exec()</code> is not accessible. Ghostscript will not function.', 'document-gallery'); ?></em>
646
+ </p>
647
+ <?php endif; ?>
648
  <?php }
649
+
650
+ /**
651
+ * Renders a readonly textfield containing a dump of current DG options.
652
+ */
653
+ public static function renderOptionsDumpSection() {
654
+ global $dg_options; ?>
655
+ <p><?php
656
+ _e('The following <em>readonly text</em> should be provided when <a href="http://wordpress.org/support/plugin/document-gallery" target="_blank">reporting a bug</a>:', 'documet-gallery');
657
+ ?></p>
658
+ <table class="form-table">
659
+ <tbody>
660
+ <tr valign="top">
661
+ <td>
662
+ <textarea readonly="true" rows="10" cols="50" id="options-dump" class="large-text code"><?php var_dump($dg_options); ?></textarea>
663
+ </td>
664
+ </tr>
665
+ </tbody>
666
+ </table>
667
+ <?php }
668
+
669
+ /**
670
+ * Render the Thumbnail table.
671
+ */
672
+ public static function renderThumbnailSection() {
673
+ include_once DG_PATH . 'inc/class-thumber.php';
674
+ $options = DG_Thumber::getOptions();
675
+
676
+ $URL_params = array('page' => DG_OPTION_NAME, 'tab' => 'Thumbnail');
677
+ $att_ids = array();
678
+
679
+ if (isset($_REQUEST['orderby']) && in_array(strtolower($_REQUEST['orderby']), array('title', 'date'))) {
680
+ $orderby = strtolower($_REQUEST['orderby']);
681
+ $URL_params['orderby'] = $orderby;
682
+
683
+ switch ($orderby)
684
+ {
685
+ case 'date':
686
+ foreach ($options['thumbs'] as $key => $node) {
687
+ $keyArray[$key] = $node['timestamp'];
688
+ $options['thumbs'][$key]['thumb_id'] = $att_ids[] = $key;
689
+ }
690
+ break;
691
+
692
+ case 'title':
693
+ foreach ($options['thumbs'] as $key => $node) {
694
+ $keyArray[$key] = basename($node['thumb_path']);
695
+ $options['thumbs'][$key]['thumb_id'] = $att_ids[] = $key;
696
+ }
697
+ break;
698
+ }
699
+
700
+ $order = strtolower($_REQUEST['order']);
701
+ if (!isset($_REQUEST['order']) || !in_array($order, array('asc', 'desc'))) {
702
+ $order = 'asc';
703
+ }
704
+ $URL_params['order'] = $order;
705
+
706
+ if ($order == 'asc') {
707
+ array_multisort($keyArray, SORT_ASC, $options['thumbs']);
708
+ } else {
709
+ array_multisort($keyArray, SORT_DESC, $options['thumbs']);
710
+ }
711
+ } else {
712
+ $orderby = '';
713
+ foreach ($options['thumbs'] as $key => $node) {
714
+ $options['thumbs'][$key]['thumb_id'] = $att_ids[] = $key;
715
+ }
716
+ }
717
+
718
+ static $limit_options = array(10, 25, 75);
719
+ if (!isset($_REQUEST['limit']) || !in_array(intval($_REQUEST['limit']), $limit_options)) {
720
+ $limit = $limit_options[0];
721
+ } else {
722
+ $limit = intval($_REQUEST['limit']);
723
+ }
724
+
725
+ $URL_params['limit'] = $limit;
726
+ $select_limit = '';
727
+ foreach ($limit_options as $l_o) {
728
+ $select_limit .= '<option value="'.$l_o.'"'.selected($limit, $l_o, false).'>'.$l_o.'</option>'.PHP_EOL;
729
+ }
730
+ $thumbs_number = count($options['thumbs']);
731
+ $lastsheet = ceil($thumbs_number/$limit);
732
+ $sheet = isset($_REQUEST['sheet']) ? intval($_REQUEST['sheet']) : 1;
733
+ if ($sheet <= 0 || $sheet > $lastsheet) {
734
+ $sheet = 1;
735
+ }
736
+
737
+ $offset = ($sheet - 1) * $limit;
738
+
739
+ $att_ids = array_slice($att_ids, $offset, $limit);
740
+ $atts = get_posts(
741
+ array(
742
+ 'post_type' => 'attachment',
743
+ 'post_status' => 'inherit',
744
+ 'numberposts' => -1,
745
+ 'post__in' => $att_ids,
746
+ 'orderby' => 'post__in'
747
+ ));
748
+ $titles = array();
749
+ foreach ($atts as $att) {
750
+ $path_parts = pathinfo($att->guid);
751
+ $titles[$att->ID] = $att->post_title.'.'.$path_parts['extension'];
752
+ }
753
+ unset($atts);
754
+
755
+ $thead = '<tr>'.
756
+ '<th scope="col" class="manage-column column-cb check-column">'.
757
+ '<label class="screen-reader-text" for="cb-select-all-%1$d">'.__('Select All', 'document-gallery').'</label>'.
758
+ '<input id="cb-select-all-%1$d" type="checkbox">'.
759
+ '</th>'.
760
+ '<th scope="col" class="manage-column column-icon">'.__('Thumbnail', 'document-gallery').'</th>'.
761
+ '<th scope="col" class="manage-column column-title '.(($orderby != 'title')?'sortable desc':'sorted '.$order).'"><a href="?'.http_build_query(array_merge($URL_params, array('orderby'=>'title','order'=>(($orderby != 'title')?'asc':(($order == 'asc')?'desc':'asc'))))).'"><span>'.__('File name', 'document-gallery').'</span><span class="sorting-indicator"></span></th>'.
762
+ '<th scope="col" class="manage-column column-date '.(($orderby != 'date')?'sortable asc':'sorted '.$order).'"><a href="?'.http_build_query(array_merge($URL_params, array('orderby'=>'date','order'=>(($orderby != 'date')?'desc':(($order == 'asc')?'desc':'asc'))))).'"><span>'.__('Date', 'document-gallery').'</span><span class="sorting-indicator"></span></th>'.
763
+ '</tr>';
764
+
765
+ $pagination = '<div class="alignleft bulkactions"><button class="button action deleteSelected">'.__('Delete Selected', 'document-gallery').'</button></div><div class="tablenav-pages">'.
766
+ '<span class="displaying-num">'.
767
+ $thumbs_number.' '._n('item', 'items', $thumbs_number).
768
+ '</span>'.($lastsheet>1?
769
+ '<span class="pagination-links">'.
770
+ '<a class="first-page'.( $sheet==1 ? ' disabled' : '').'" title="'.__('Go to the first page', 'document-gallery').'"'.( $sheet==1 ? '' : ' href="?'.http_build_query($URL_params).'"').'>«</a>'.
771
+ '<a class="prev-page'.( $sheet==1 ? ' disabled' : '').'" title="'.__('Go to the previous page', 'document-gallery').'"'.( $sheet==1 ? '' : ' href="?'.http_build_query(array_merge($URL_params, array('sheet'=>$sheet-1))).'"').'>‹</a>'.
772
+ '<span class="paging-input">'.
773
+ '<input class="current-page" title="'.__('Current page', 'document-gallery').'" type="text" name="paged" value="'.$sheet.'" size="'.strlen($sheet).'" maxlength="'.strlen($sheet).'"> '.__('of', 'document-gallery').' <span class="total-pages">'.$lastsheet.'</span></span>'.
774
+ '<a class="next-page'.( $sheet==$lastsheet ? ' disabled' : '').'" title="'.__('Go to the next page', 'document-gallery').'"'.( $sheet==$lastsheet ? '' : ' href="?'.http_build_query(array_merge($URL_params, array('sheet'=>$sheet+1))).'"').'>›</a>'.
775
+ '<a class="last-page'.( $sheet==$lastsheet ? ' disabled' : '').'" title="'.__('Go to the last page', 'document-gallery').'"'.( $sheet==$lastsheet ? '' : ' href="?'.http_build_query(array_merge($URL_params, array('sheet'=>$lastsheet))).'"').'>»</a>'.
776
+ '</span>':' <b>|</b> ').
777
+ '<span class="displaying-num"><select dir="rtl" class="limit_per_page">'.$select_limit.'</select> '.__('items per page', 'document-gallery').'</span>'.
778
+ '</div>'.
779
+ '<br class="clear" />';
780
+
781
+ // Avoiding json_encode to avoid compatibility issues on some systems
782
+ $json_like = '';
783
+ foreach ($URL_params as $k => $v) {
784
+ $json_like .= '"'.$k.'":"'.$v.'",';
785
+ }
786
+ ?>
787
+
788
+ <script type="text/javascript">
789
+ var URL_params = <?php echo '{'.trim($json_like,', ').'}'; ?>;
790
+ </script>
791
+ <div class="thumbs-list-wrapper">
792
+ <div>
793
+ <div class="tablenav top"><?php echo $pagination; ?></div>
794
+ <table id="ThumbsTable" class="wp-list-table widefat fixed media"
795
+ cellpadding="0" cellspacing="0">
796
+ <thead>
797
+ <?php printf($thead, 1); ?>
798
+ </thead>
799
+ <tfoot>
800
+ <?php printf($thead, 2); ?>
801
+ </tfoot>
802
+ <tbody><?php
803
+ $i = 0;
804
+ foreach ($options['thumbs'] as $v) {
805
+ if ($i < $offset) { $i++; continue; }
806
+ if (++$i > $offset + $limit) { break; }
807
+
808
+ $icon = isset($v['thumb_url']) ? $v['thumb_url'] : DG_URL . 'assets/icons/missing.png';
809
+ $title = isset($titles[$v['thumb_id']]) ? $titles[$v['thumb_id']] : '';
810
+ $date = DocumentGallery::localDateTimeFromTimestamp($v['timestamp']);
811
+
812
+ echo '<tr><td scope="row" class="check-column"><input type="checkbox" class="cb-ids" name="' . DG_OPTION_NAME . '[ids][]" value="' .
813
+ $v['thumb_id'].'"></td><td class="column-icon media-icon"><img src="' .
814
+ $icon.'" />'.'</td><td class="title column-title">' .
815
+ ($title ? '<strong><a href="' . home_url('/?attachment_id='.$v['thumb_id']).'" target="_blank" title="'.__('View', 'document-gallery').' \'' .
816
+ $title.'\' '.__('attachment page', 'document-gallery').'">'.$title.'</a></strong>' : __('Attachment not found', 'document-gallery')) .
817
+ '</td><td class="date column-date">'.$date.'</td></tr>'.PHP_EOL;
818
+ } ?>
819
+ </tbody>
820
+ </table>
821
+ <div class="tablenav bottom"><?php echo $pagination; ?></div>
822
+ </div>
823
+ </div>
824
+ <?php }
825
+ /**
826
+ * Render the Logging table.
827
+ */
828
+ public static function renderLoggingSection() {
829
+ $log_list = DG_Logger::readLog();
830
+ if ($log_list) {
831
+ $levels = array_map(
832
+ function($e) { return '<span class="logLabel ' . strtolower($e) . '">' . strtoupper($e) . '</span>'; },
833
+ array_keys(DG_LogLevel::getLogLevels()));
834
+
835
+ $thead = '<tr>'.
836
+ '<th scope="col" class="manage-column column-date"><span>'.__('Date', 'document-gallery').'</span></th>'.
837
+ '<th scope="col" class="manage-column column-level"><span>'.__('Level', 'document-gallery').'</span></th>'.
838
+ '<th scope="col" class="manage-column column-message"><span>'.__('Message', 'document-gallery').'</span></th>'.
839
+ '</tr>';
840
+
841
+ ?>
842
+ <div class="log-list-wrapper">
843
+ <div>
844
+ <div class="tablenav top">
845
+ <div class="alignleft bulkactions">
846
+ <button class="action expandAll">
847
+ <?php echo __('Expand All', 'document-gallery'); ?>
848
+ </button>
849
+ <button class="action collapseAll">
850
+ <?php echo __('Collapse All', 'document-gallery'); ?>
851
+ </button>
852
+ </div>
853
+ <div class="levelSelector">
854
+ <input type="checkbox" id="allLevels" name="lswitch" value="all" checked />
855
+ <label for="allLevels" class="allLevels">ALL</label>
856
+ <?php
857
+ foreach (array_keys(DG_LogLevel::getLogLevels()) as $k) { ?>
858
+ <?php
859
+ $lower = strtolower($k);
860
+ $upper = strtoupper($k);
861
+ ?>
862
+ <input type="checkbox" id="<?php echo $lower; ?>Level" name="lswitch" value="<?php echo $lower; ?>" checked />
863
+ <label for="<?php echo $lower; ?>Level" class="<?php echo $lower; ?>Level"><?php echo $upper; ?></label>
864
+ <?php }
865
+ ?>
866
+ </div>
867
+ </div>
868
+ <table id="LogTable" class="wp-list-table widefat fixed media" cellpadding="0" cellspacing="0">
869
+ <thead>
870
+ <?php echo $thead; ?>
871
+ </thead>
872
+ <tfoot>
873
+ <?php echo $thead; ?>
874
+ </tfoot>
875
+ <tbody><?php
876
+ $i = 0;
877
+ foreach ($log_list as $v) {
878
+ $date = DocumentGallery::localDateTimeFromTimestamp($v[0]);
879
+ $v[2] = preg_replace('/ (attachment #)(\d+) /', ' <a href="' . home_url() . '/?attachment_id=\2" target="_blank">\1<strong>\2</strong></a> ', $v[2]);
880
+ $v[2] = preg_replace('/^(\(\w+::\w+\)) /', '<strong>\1</strong> ', $v[2]);
881
+ $v[2] = preg_replace('/(\(?\w+::\w+\)?)/m', '<i>\1</i>', $v[2]);
882
+
883
+ echo '<tr><td class="date column-date" data-sort-value="'.$v[0].'"><span class="logLabel date">'.$date.'</span></td>' .
884
+ '<td class="column-level">'.$levels[$v[1]].'</td>' .
885
+ '<td class="column-entry">'.(empty($v[3]) ? '<pre>'.$v[2].'</pre>' : '<div class="expander" title="Click to Expand"><pre>'.$v[2].'</pre><div><span class="dashicons dashicons-arrow-down-alt2"></span></div></div><div class="spoiler-body"><pre>'.$v[3].'</pre></div>').'</td>' .
886
+ '</tr>'.PHP_EOL;
887
+ } ?>
888
+ </tbody>
889
+ </table>
890
+ <div class="tablenav bottom">
891
+ <div class="alignright bulkactions">
892
+ <button class="button action clearLog" name = '<?php echo DG_OPTION_NAME; ?>[clearLog]' value = 'true'>
893
+ <?php echo __('Clear Log', 'document-gallery'); ?>
894
+ </button>
895
+ </div>
896
+ </div>
897
+ </div>
898
+ </div>
899
+ <?php } else {
900
+ echo '<div class="noLog">'.__('There are no log entries at this time.', 'document-gallery').'<br />'.__('For Your information:', 'document-gallery').' <strong><i>'.__('Logging', 'document-gallery').'</i></strong> '.(DG_Logger::logEnabled()?'<span class="loggingON">'.__('is turned ON', 'document-gallery').'!</span>':'<span class="loggingOFF">'.__('is turned OFF', 'document-gallery').'!</span>').'</div>';
901
+ }
902
+ }
903
 
904
  /**
905
  * Render a checkbox field.
907
  */
908
  public static function renderCheckboxField($args) {
909
  $args['disabled'] = isset($args['disabled']) ? $args['disabled'] : false;
910
+ printf('<label><input type="checkbox" value="1" name="%1$s[%2$s]" id="%3$s" %4$s %5$s/> %6$s</label>',
911
  $args['option_name'],
912
  $args['name'],
913
  $args['label_for'],
921
  * @param array $args
922
  */
923
  public static function renderTextField($args) {
924
+ printf('<input type="%1$s" value="%2$s" name="%3$s[%4$s]" id="%5$s" /> %6$s',
925
+ isset($args['type']) ? $args['type'] : 'text',
926
+ $args['value'],
927
+ $args['option_name'],
928
+ $args['name'],
929
+ $args['label_for'],
930
+ $args['description']);
931
+ }
932
+
933
+ /**
934
+ * Accepts a two-dimensional array where each inner array consists of valid arguments for renderTextField.
935
+ * @param array $args
936
+ */
937
+ public static function renderMultiTextField($args) {
938
+ foreach ($args as $arg) {
939
+ self::renderTextField($arg);
940
+ }
941
  }
942
 
943
  /**
961
  print '</select> ' . $args['description'];
962
  }
963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  /**
965
  * Blocks instantiation. All functions are static.
966
  */
assets/css/admin.css ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.thumbs-list-wrapper, div.log-list-wrapper{
2
+ text-align:center;
3
+ margin-top: 1.5em;
4
+ }
5
+ div.thumbs-list-wrapper>div, div.log-list-wrapper>div{
6
+ margin: 0 auto;
7
+ display: inline-block;
8
+ }
9
+ #ThumbsTable, #LogTable{
10
+ border: none;
11
+ box-shadow: none;
12
+ -webkit-box-shadow: none;
13
+ -moz-box-shadow: none;
14
+ border-radius: 10px;
15
+ -webkit-border-radius: 10px;
16
+ -moz-border-radius: 10px;
17
+ background: #B9C9FE;
18
+ color: #039;
19
+ width: auto;
20
+ margin: 10px auto;
21
+ }
22
+ #ThumbsTable tbody, #LogTable tbody {
23
+ background: #e8edff;
24
+ color: #669;
25
+ }
26
+ #ThumbsTable>tbody>tr:hover, #LogTable>tbody>tr:hover {
27
+ background: #d0dafd;
28
+ }
29
+ #ThumbsTable>tbody>tr:not(:last-child) td, #LogTable>tbody>tr:not(:last-child) td {
30
+ border-bottom-color: #b9c9fe;
31
+ border-bottom-style: solid;
32
+ border-bottom-width: 1px;
33
+ }
34
+ #ThumbsTable td, #ThumbsTable th, #LogTable td, #LogTable th{
35
+ text-align: center;
36
+ vertical-align: middle;
37
+ margin: 0;
38
+ padding: 4px;
39
+ }
40
+ #LogTable td {
41
+ text-align: left;
42
+ }
43
+ td.title.column-title{
44
+ text-align: left !important;
45
+ }
46
+ #ThumbsTable img{
47
+ display: block;
48
+ margin: 5px auto;
49
+ }
50
+ #LogTable td > pre, .spoiler-body > pre, .expander pre, .collapser pre {
51
+ margin: 0;
52
+ display: inline-block;
53
+ white-space: pre-line;
54
+ }
55
+ tr.selected{
56
+ background: #B6ADCE;
57
+ }
58
+ tr.selected:hover{
59
+ background: #D8D3E5 !important;
60
+ }
61
+ .column-date, .column-level, .check-column, .column-icon {
62
+ white-space: nowrap;
63
+ }
64
+ .column-entry, .column-title {
65
+ width: 100%;
66
+ }
67
+ .nav-tab:before, .deleteSelected:before, .clearLog:before, .expandAll:before, .collapseAll:before, .logLabel.date:before, .collapser:after, .expander:after{
68
+ display: inline-block;
69
+ -webkit-font-smoothing: antialiased;
70
+ font: normal 20px/1 'dashicons';
71
+ vertical-align: text-bottom;
72
+ padding-right: 5px;
73
+ }
74
+ .General-tab:before{
75
+ content: '\f108';
76
+ }
77
+ .Thumbnail-tab:before{
78
+ content: '\f233';
79
+ }
80
+ .Logging-tab:before{
81
+ content: '\f163';
82
+ }
83
+ .Advanced-tab:before{
84
+ content: '\f332';
85
+ }
86
+ .deleteSelected:before, .clearLog:before{
87
+ content: '\f182';
88
+ }
89
+ .expandAll:before {
90
+ content: '\f211';
91
+ }
92
+ .collapseAll:before {
93
+ content: '\f506';
94
+ }
95
+ .expandAll, .collapseAll {
96
+ display: none;
97
+ }
98
+ #ThumbsTable .title a:after, #LogTable>tbody a:after{
99
+ content: '\f504';
100
+ display: inline-block;
101
+ -webkit-font-smoothing: antialiased;
102
+ font-family: 'dashicons';
103
+ font-size: inherit;
104
+ font-style: normal;
105
+ font-variant: normal;
106
+ font-weight: normal;
107
+ line-height: 1;
108
+ vertical-align: inherit;
109
+ padding-left: 5px;
110
+ }
111
+ #LogTable>tbody a {
112
+ -webkit-transition: none;
113
+ transition: none;
114
+ text-decoration: none;
115
+ outline: 0;
116
+ }
117
+ #LogTable>tbody pre strong {
118
+ font-weight: bolder;
119
+ }
120
+ #LogTable>tbody a:active, #LogTable>tbody a:hover {
121
+ color: #2ea2cc;
122
+ }
123
+ .levelSelector {
124
+ float: right;
125
+ }
126
+ .logLabel {
127
+ padding: 0 10px;
128
+ color: #fff !important;
129
+ text-decoration: none;
130
+ font-weight: bolder;
131
+ border: none !important;
132
+ float:left;
133
+ margin-left: 1px;
134
+ margin-top: 1px;
135
+ -webkit-border-radius: 100px;
136
+ -moz-border-radius: 100px;
137
+ border-radius: 100px;
138
+ cursor: context-menu;
139
+ }
140
+ .logLabel.warning {
141
+ background: #F89406;
142
+ }
143
+ .logLabel.detail {
144
+ background: #3A87AD;
145
+ }
146
+ .logLabel.error {
147
+ background: #CC0000;
148
+ }
149
+ .logLabel.date {
150
+ background: #999999;
151
+ white-space: nowrap;
152
+ font-weight: inherit;
153
+ }
154
+ .logLabel.date:before{
155
+ font-size: inherit;
156
+ vertical-align: middle;
157
+ padding-bottom: 0.2em;
158
+ content: '\f469';
159
+ }
160
+ .spoiler-body {
161
+ padding: 1px 6px 2px;
162
+ display: none;
163
+ border-top: 1px solid #C3CBD1;
164
+ background: #F5F5F5;
165
+ }
166
+ .column-entry {
167
+ text-align: left !important;
168
+ }
169
+ .expander pre, .collapser pre {
170
+ vertical-align: middle;
171
+ float: left;
172
+ white-space: pre-wrap;
173
+ }
174
+ .expander, .collapser {
175
+ display: table;
176
+ vertical-align: middle;
177
+ width: 100%;
178
+ cursor: pointer;
179
+ }
180
+ .expander > div, .collapser > div {
181
+ display: table-cell;
182
+ vertical-align: middle;
183
+ height: 100%;
184
+ }
185
+ .dashicons.dashicons-arrow-down-alt2, .dashicons.dashicons-arrow-up-alt2 {
186
+ float: right;
187
+ padding-right: 15px;
188
+ }
189
+ .levelSelector > * {
190
+ -webkit-touch-callout: none;
191
+ -webkit-user-select: none;
192
+ -khtml-user-select: none;
193
+ -moz-user-select: none;
194
+ -ms-user-select: none;
195
+ user-select: none;
196
+ }
197
+ .levelSelector > input[type=checkbox] {
198
+ display:none;
199
+ }
200
+ .levelSelector > input[type=checkbox] + label {
201
+ color: #6B6B6B;
202
+ font-weight: bolder;
203
+ margin: 4px 0px;
204
+ overflow: auto;
205
+ text-align: center;
206
+ padding: 3px 8px;
207
+ display: table-cell;
208
+ background-color: #f5f5f5;
209
+ background-image: -moz-linear-gradient(top,#fff,#e6e6e6);
210
+ background-image: -webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));
211
+ background-image: -webkit-linear-gradient(top,#fff,#e6e6e6);
212
+ background-image: -o-linear-gradient(top,#fff,#e6e6e6);
213
+ background-image: linear-gradient(to bottom,#fff,#e6e6e6);
214
+ background-repeat: repeat-x;
215
+ border: 1px solid #ccc;
216
+ border-color: #e6e6e6 #e6e6e6 #bfbfbf;
217
+ border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
218
+ border-bottom-color: #b3b3b3;
219
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);
220
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
221
+ -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
222
+ -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
223
+ box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
224
+ }
225
+ .levelSelector > input[type=checkbox] + label:first-of-type {
226
+ border-top-left-radius: 4px;
227
+ border-bottom-left-radius: 4px;
228
+ }
229
+ .levelSelector > input[type=checkbox] + label:last-of-type {
230
+ border-top-right-radius: 4px;
231
+ border-bottom-right-radius: 4px;
232
+ }
233
+ .levelSelector > input[type=checkbox]:checked + label {
234
+ background-image: none;
235
+ outline: 0;
236
+ -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
237
+ -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
238
+ box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
239
+ }
240
+ .levelSelector > input[type=checkbox] + label.errorLevel {
241
+ color: #CC0000;
242
+ }
243
+ .levelSelector > input[type=checkbox]:checked + label.errorLevel {
244
+ background-color: #CC0000;
245
+ color: #fff;
246
+ }
247
+ .levelSelector > input[type=checkbox] + label.warningLevel {
248
+ color: #F89406;
249
+ }
250
+ .levelSelector > input[type=checkbox]:checked + label.warningLevel {
251
+ background-color: #F89406;
252
+ color: #fff;
253
+ }
254
+ .levelSelector > input[type=checkbox] + label.detailLevel {
255
+ color: #3A87AD;
256
+ }
257
+ .levelSelector > input[type=checkbox]:checked + label.detailLevel {
258
+ background-color: #3A87AD;
259
+ color: #fff;
260
+ }
261
+ .noLog {
262
+ font-size: x-large;
263
+ display: block;
264
+ width: 100%;
265
+ text-align: center;
266
+ margin-top: 20ex;
267
+ line-height: 150%;
268
+ }
269
+ .loggingON, .loggingOFF {
270
+ font-weight: bolder;
271
+ }
272
+ .loggingON {
273
+ color: green;
274
+ }
275
+ .loggingOFF {
276
+ color: red;
277
+ }
278
+ th input{
279
+ margin-left: 0 !important;
280
+ margin-top: 1px !important;
281
+ }
282
+ td input{
283
+ margin-right: 0 !important;
284
+ }
285
+
286
+ textarea[readonly], input[readonly], select[readonly] {
287
+ background-color: #dcdcdc;
288
+ }
assets/js/admin.js ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+ jQuery('.cb-ids').change(function() {
3
+ if(jQuery(this).is(':checked')) {
4
+ jQuery(this).closest('tr').addClass('selected');
5
+ }
6
+ else {
7
+ jQuery(this).closest('tr').removeClass('selected');
8
+ }
9
+ });
10
+ jQuery('th input:checkbox').change(function() {
11
+ if(jQuery(this).is(':checked')) {
12
+ jQuery('#ThumbsTable tbody tr').addClass('selected');
13
+ }
14
+ else {
15
+ jQuery('#ThumbsTable tbody tr').removeClass('selected');
16
+ }
17
+ });
18
+ jQuery('input.current-page').bind('keypress', {}, function(e) {
19
+ var code = (e.keyCode ? e.keyCode : e.which);
20
+ if (code == 13) { //Enter keycode
21
+ e.preventDefault();
22
+ jQuery(location).attr('href','?'+jQuery.param(jQuery.extend(URL_params,{ sheet: this.value })));
23
+ }
24
+ });
25
+ jQuery('select.limit_per_page').change(function() {
26
+ jQuery(location).attr('href','?'+jQuery.param(jQuery.extend(URL_params,{ limit: this.value })));
27
+ });
28
+ jQuery('#tab-Thumbnail').submit( function (event) {
29
+ event.preventDefault();
30
+ if (jQuery('.cb-ids:checked').length > 0) {
31
+ var a = jQuery(this).attr('action');
32
+ var b = jQuery(this).serialize() + '&document_gallery%5Bajax%5D=true';
33
+ jQuery.post(a, b, function(response) {
34
+ if (response.indexOf("\n") == -1) {
35
+ var result = eval(response);
36
+ for (var index in result) {
37
+ jQuery('input[type=checkbox][value='+result[index]+']').closest('tr').fadeOut('slow', 0.00, function() {jQuery(this).slideUp('slow', function() {jQuery(this).remove();});});
38
+ }
39
+ } else {
40
+ console.log('Invalid response from server:');
41
+ console.log(response);
42
+ }
43
+ } ).fail(function() {
44
+ console.log( 'Problem in reaching the server' );
45
+ });
46
+ }
47
+ return false;
48
+ });
49
+
50
+ jQuery('#tab-Advanced #options-dump').click(function() {
51
+ jQuery(this).select();
52
+ });
53
+
54
+ function toggleSpoiler() {
55
+ var sel = getSelection().toString();
56
+ if(!sel){
57
+ jQuery(this).next().slideToggle('slow');
58
+ jQuery(this).find('.dashicons').toggleClass('dashicons-arrow-down-alt2 dashicons-arrow-up-alt2');
59
+ jQuery(this).toggleClass('expander collapser');
60
+ jQuery(this).attr('title', (jQuery(this).hasClass('expander') ? 'Click to Expand' : 'Click to Collapse'));
61
+ }
62
+ }
63
+
64
+ jQuery('.expander').click(toggleSpoiler);
65
+
66
+ if (jQuery('.spoiler-body').length)
67
+ {
68
+ jQuery('.expandAll, .collapseAll').addClass('button');
69
+ jQuery('.expandAll').click(function(e) {
70
+ e.preventDefault();
71
+ jQuery('.expander').trigger('click');
72
+ });
73
+ jQuery('.collapseAll').click(function(e) {
74
+ e.preventDefault();
75
+ jQuery('.collapser').trigger('click');
76
+ });
77
+ }
78
+
79
+ jQuery('.levelSelector input').change(function() {
80
+ if (jQuery(this).val() == 'all') {
81
+ jQuery('.levelSelector input').not("[value='all']").prop('checked', jQuery(this).is(':checked'));
82
+ jQuery(this).is(':checked') ? jQuery('#LogTable tbody tr').show() : jQuery('#LogTable tbody tr').hide();
83
+ }
84
+ else {
85
+ jQuery(this).is(':checked') ? jQuery('#LogTable tbody tr:has(span.'+jQuery(this).val()+')').show() : jQuery('#LogTable tbody tr:has(span.'+jQuery(this).val()+')').hide();
86
+ if ( (jQuery('.levelSelector input:checked').not("[value='all']").length + 1) == jQuery('.levelSelector input[type="checkbox"]').length ) {
87
+ jQuery('.levelSelector input[value="all"]').prop('checked', true);
88
+ } else {
89
+ jQuery('.levelSelector input[value="all"]').prop('checked', false);
90
+ }
91
+ }
92
+ });
93
+ });
document-gallery.php CHANGED
@@ -5,14 +5,14 @@ defined('WPINC') OR exit;
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
- Version: 2.1
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
- define('DG_VERSION', '2.1');
16
 
17
  // define helper paths & URLs
18
  define('DG_BASENAME', plugin_basename(__FILE__));
@@ -26,6 +26,9 @@ global $dg_options;
26
  define('DG_OPTION_NAME', 'document_gallery');
27
  $dg_options = get_option(DG_OPTION_NAME, null);
28
 
 
 
 
29
  // handle activation, updates, and uninstallation
30
  include_once DG_PATH . 'inc/class-setup.php';
31
  register_activation_hook(__FILE__, array('DG_Setup', 'activate'));
@@ -33,6 +36,14 @@ add_action('wpmu_new_blog', array('DG_Setup','activateNewBlog'));
33
  register_uninstall_hook(__FILE__, array('DG_Setup', 'uninstall'));
34
  DG_Setup::maybeUpdate();
35
 
 
 
 
 
 
 
 
 
36
  // I18n
37
  add_action('plugins_loaded', array('DocumentGallery', 'loadTextDomain'));
38
 
@@ -45,8 +56,7 @@ if (is_admin()) {
45
  include_once DG_PATH . 'admin/class-admin.php';
46
 
47
  // add settings link
48
- add_filter('plugin_action_links_' . DG_BASENAME,
49
- array('DG_Admin', 'addSettingsLink'));
50
 
51
  // build options page
52
  add_action('admin_menu', array('DG_Admin', 'addAdminPage'));
@@ -87,15 +97,15 @@ class DocumentGallery {
87
  * Takes values passed from attributes and returns sutable HTML to represent
88
  * all valid attachments requested.
89
  *
90
- * @param array $atts Arguments from the user.
91
- * @return string HTML for the Document Gallery.
92
  */
93
  public static function doShortcode($atts) {
94
  include_once 'inc/class-gallery.php';
95
 
96
  $start = microtime(true);
97
  $gallery = (string)new DG_Gallery($atts);
98
- DocumentGallery::writeLog('Generation Time: ' . (microtime(true) - $start) . ' s');
99
 
100
  return $gallery;
101
  }
@@ -104,8 +114,7 @@ class DocumentGallery {
104
  * Enqueue standard DG CSS.
105
  */
106
  public static function enqueueGalleryStyle() {
107
- wp_register_style('document-gallery', DG_URL . 'assets/css/style.css', null, DG_VERSION);
108
- wp_enqueue_style('document-gallery');
109
  }
110
 
111
  /**
@@ -121,8 +130,8 @@ class DocumentGallery {
121
  /**
122
  * Add query custom CSS query string.
123
  * Taken from here: http://ottopress.com/2010/dont-include-wp-load-please/
124
- * @param array $vars
125
- * @return array
126
  */
127
  public static function addCustomStyleQueryVar($vars) {
128
  $vars[] = self::$query_var;
@@ -150,45 +159,12 @@ class DocumentGallery {
150
  }
151
 
152
  /*==========================================================================
153
- * Logging
154
  *=========================================================================*/
155
 
156
  /**
157
- * Appends error log with $entry if WordPress is in debug mode.
158
- *
159
- * @param str $entry
160
- */
161
- public static function writeLog($entry) {
162
- if (self::logEnabled()) {
163
- // NOTE: First entry in stack trace is this method -- need to get second
164
- $callers = debug_backtrace();
165
- $caller = $callers[1];
166
- $caller = (isset($caller['class']) ? $caller['class'] : '') . $caller['type'] . $caller['function'];
167
-
168
- // build log entry, removing any extra spaces
169
- $err = preg_replace('/\s+/', ' ', trim(print_r($entry, true)));
170
- $err = 'DG (' . $caller . '): ' . $err . PHP_EOL;
171
-
172
- // insert log entry
173
- if (defined('ERRORLOGFILE')) {
174
- error_log($err, 3, ERRORLOGFILE);
175
- } else {
176
- error_log($err);
177
- }
178
- }
179
- }
180
-
181
- /**
182
- * @return bool Whether debug logging is currently enabled.
183
  */
184
- public static function logEnabled() {
185
- return defined('WP_DEBUG') && WP_DEBUG;
186
- }
187
-
188
- /*==========================================================================
189
- * I18n
190
- *=========================================================================*/
191
-
192
  public static function loadTextDomain() {
193
  load_plugin_textdomain('document-gallery', false, dirname(DG_BASENAME) . '/languages/');
194
  }
@@ -199,7 +175,7 @@ class DocumentGallery {
199
 
200
  /**
201
  * @param int $blog ID of the blog to be retrieved in multisite env.
202
- * @return array Options for the blog.
203
  */
204
  public static function getOptions($blog = null) {
205
  global $dg_options;
@@ -208,6 +184,10 @@ class DocumentGallery {
208
  : get_blog_option($blog, DG_OPTION_NAME, null);
209
  }
210
 
 
 
 
 
211
  public static function setOptions($options, $blog = null) {
212
  if (is_null($blog)) {
213
  global $dg_options;
@@ -218,6 +198,9 @@ class DocumentGallery {
218
  }
219
  }
220
 
 
 
 
221
  public static function deleteOptions($blog = null) {
222
  if (is_null($blog)) {
223
  delete_option(DG_OPTION_NAME);
@@ -226,11 +209,75 @@ class DocumentGallery {
226
  }
227
  }
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  /**
230
  * Compiles any custom CSS plus the default CSS together,
231
  * minifying in the process.
232
- * @param str $custom The custom CSS to compile.
233
- * @return str Compiled CSS, including both standard and any custom.
234
  */
235
  public static function compileCustomCss($custom) {
236
  $css = file_get_contents(DG_PATH . 'assets/css/style.css');
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
+ Version: 2.2
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
+ define('DG_VERSION', '2.2');
16
 
17
  // define helper paths & URLs
18
  define('DG_BASENAME', plugin_basename(__FILE__));
26
  define('DG_OPTION_NAME', 'document_gallery');
27
  $dg_options = get_option(DG_OPTION_NAME, null);
28
 
29
+ // logging functionality
30
+ include_once DG_PATH . 'inc/class-logger.php';
31
+
32
  // handle activation, updates, and uninstallation
33
  include_once DG_PATH . 'inc/class-setup.php';
34
  register_activation_hook(__FILE__, array('DG_Setup', 'activate'));
36
  register_uninstall_hook(__FILE__, array('DG_Setup', 'uninstall'));
37
  DG_Setup::maybeUpdate();
38
 
39
+ // validate options if desired
40
+ if ($dg_options['validation']) {
41
+ add_action('init', function(){
42
+ add_filter('pre_update_option_' . DG_OPTION_NAME,
43
+ array('DocumentGallery', 'validateOptionsStructure'), 10, 2);
44
+ });
45
+ }
46
+
47
  // I18n
48
  add_action('plugins_loaded', array('DocumentGallery', 'loadTextDomain'));
49
 
56
  include_once DG_PATH . 'admin/class-admin.php';
57
 
58
  // add settings link
59
+ add_filter('plugin_action_links_' . DG_BASENAME, array('DG_Admin', 'addSettingsLink'));
 
60
 
61
  // build options page
62
  add_action('admin_menu', array('DG_Admin', 'addAdminPage'));
97
  * Takes values passed from attributes and returns sutable HTML to represent
98
  * all valid attachments requested.
99
  *
100
+ * @param multitype:string $atts Arguments from the user.
101
+ * @return string HTML for the Document Gallery.
102
  */
103
  public static function doShortcode($atts) {
104
  include_once 'inc/class-gallery.php';
105
 
106
  $start = microtime(true);
107
  $gallery = (string)new DG_Gallery($atts);
108
+ DG_Logger::writeLog(DG_LogLevel::Detail, 'Generation Time: ' . sprintf('%.2f', (microtime(true) - $start)) . ' s');
109
 
110
  return $gallery;
111
  }
114
  * Enqueue standard DG CSS.
115
  */
116
  public static function enqueueGalleryStyle() {
117
+ wp_enqueue_style('document-gallery', DG_URL . 'assets/css/style.css', null, DG_VERSION);
 
118
  }
119
 
120
  /**
130
  /**
131
  * Add query custom CSS query string.
132
  * Taken from here: http://ottopress.com/2010/dont-include-wp-load-please/
133
+ * @param multitype:string $vars Variables to be added.
134
+ * @return multitype:string All variables to be included in query string.
135
  */
136
  public static function addCustomStyleQueryVar($vars) {
137
  $vars[] = self::$query_var;
159
  }
160
 
161
  /*==========================================================================
162
+ * I18n
163
  *=========================================================================*/
164
 
165
  /**
166
+ * Loads language files into WP core.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  */
 
 
 
 
 
 
 
 
168
  public static function loadTextDomain() {
169
  load_plugin_textdomain('document-gallery', false, dirname(DG_BASENAME) . '/languages/');
170
  }
175
 
176
  /**
177
  * @param int $blog ID of the blog to be retrieved in multisite env.
178
+ * @return multitype:unknown Options for the blog.
179
  */
180
  public static function getOptions($blog = null) {
181
  global $dg_options;
184
  : get_blog_option($blog, DG_OPTION_NAME, null);
185
  }
186
 
187
+ /**
188
+ * @param multitype:unknown $options
189
+ * @param int $blog ID of the blog to be set in multisite env.
190
+ */
191
  public static function setOptions($options, $blog = null) {
192
  if (is_null($blog)) {
193
  global $dg_options;
198
  }
199
  }
200
 
201
+ /**
202
+ * @param int $blog ID of the blog to be deleted in multisite env.
203
+ */
204
  public static function deleteOptions($blog = null) {
205
  if (is_null($blog)) {
206
  delete_option(DG_OPTION_NAME);
209
  }
210
  }
211
 
212
+ /**
213
+ * Checks whether the given options match the option schema.
214
+ * @param multivar $new The new options to be validated.
215
+ * @param multivar $old The old options.
216
+ * @return array The options to be saved.
217
+ */
218
+ public static function validateOptionsStructure($new, $old) {
219
+ if (self::isValidOptionsStructure($new)) {
220
+ $ret = $new;
221
+ } else {
222
+ $ret = $old;
223
+ DG_Logger::writeLog(DG_LogLevel::Error, 'Attempted to save invalid options.' . PHP_EOL . print_r($new, true), true, true);
224
+ }
225
+
226
+ return $ret;
227
+ }
228
+
229
+ /**
230
+ * @param multivar|unknown $o The options structure to validate.
231
+ * @param multivar $schema The schema to validate against (note that only keys matter -- non-array values are ignored).
232
+ * @return bool Whether the given options structure matches the schema.
233
+ */
234
+ private static function isValidOptionsStructure($o, $schema = null) {
235
+ if (is_null($schema)) {
236
+ include_once DG_PATH . 'inc/class-setup.php';
237
+ $schema = DG_Setup::getDefaultOptions(true);
238
+ }
239
+
240
+ // simple checks first
241
+ $valid = is_array($o) && (count($schema) === count($o));
242
+
243
+ if ($valid) {
244
+ foreach ($schema as $sk => $sv) {
245
+ $valid = array_key_exists($sk, $o);
246
+ if (is_array($sv) && !empty($sv)) {
247
+ $valid = $valid && self::isValidOptionsStructure($o[$sk], $sv);
248
+ }
249
+
250
+ if (!$valid) {
251
+ break;
252
+ }
253
+ }
254
+ }
255
+
256
+ return $valid;
257
+ }
258
+
259
+ /**
260
+ * Function takes a GMT timestamp and returns a date/time string in the
261
+ * current timezone and WP format.
262
+ * @param int $timestamp The GMT timestamp to translate.
263
+ * @return string The local time in the WP date/time format.
264
+ */
265
+ public static function localDateTimeFromTimestamp($timestamp) {
266
+ static $gmt_offet = null;
267
+ static $wp_format = null;
268
+ if (is_null($gmt_offet)) {
269
+ $gmt_offet = get_option('gmt_offset');
270
+ $wp_format = get_option('date_format').' '.get_option('time_format');
271
+ }
272
+
273
+ return date($wp_format, $timestamp + $gmt_offet * 3600);
274
+ }
275
+
276
  /**
277
  * Compiles any custom CSS plus the default CSS together,
278
  * minifying in the process.
279
+ * @param string $custom The custom CSS to compile.
280
+ * @return string Compiled CSS, including both standard and any custom.
281
  */
282
  public static function compileCustomCss($custom) {
283
  $css = file_get_contents(DG_PATH . 'assets/css/style.css');
inc/class-document.php CHANGED
@@ -12,10 +12,6 @@ class DG_Document {
12
  * PRIVATE FIELDS
13
  *=========================================================================*/
14
 
15
- // templates for HTML output
16
- private static $doc_icon = false;
17
- private static $img_string = '<img src="%s" title="%s" alt="%s" />';
18
-
19
  // general document data
20
  private $description, $gallery, $ID, $link, $title, $title_attribute;
21
 
@@ -30,16 +26,7 @@ class DG_Document {
30
  */
31
  public function __construct($attachment, $gallery) {
32
  include_once DG_PATH . 'inc/class-thumber.php';
33
-
34
- // init template for HTML output
35
- if(false === self::$doc_icon)
36
- {
37
- self::$doc_icon =
38
- ' <div class="document-icon">' . PHP_EOL .
39
- ' <a href="%s">%s<br>%s</a>' . PHP_EOL .
40
- ' </div>' . PHP_EOL;
41
- }
42
-
43
  // init general document data
44
  $this->gallery = $gallery;
45
  $this->description = $attachment->post_content;
@@ -57,22 +44,39 @@ class DG_Document {
57
 
58
  /**
59
  * Returns HTML representing this Document.
 
 
 
60
  * @return string
61
  */
62
  public function __toString() {
 
 
 
 
 
63
  $thumb = $this->gallery->useFancyThumbs()
64
  ? DG_Thumber::getThumbnail($this->ID)
65
  : DG_Thumber::getDefaultThumbnail($this->ID);
66
- $icon = sprintf(self::$img_string, $thumb,
67
- $this->title_attribute, $this->title_attribute);
68
- $core = sprintf(self::$doc_icon, $this->link, $icon, $this->title);
69
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  if($this->gallery->useDescriptions()) {
71
  $core .= " <p>$this->description</p>" . PHP_EOL;
72
  }
73
 
74
  // users may filter icon here
75
- return apply_filters('dg_doc_icon', $core, $this->ID);
76
  }
77
  }
78
 
12
  * PRIVATE FIELDS
13
  *=========================================================================*/
14
 
 
 
 
 
15
  // general document data
16
  private $description, $gallery, $ID, $link, $title, $title_attribute;
17
 
26
  */
27
  public function __construct($attachment, $gallery) {
28
  include_once DG_PATH . 'inc/class-thumber.php';
29
+
 
 
 
 
 
 
 
 
 
30
  // init general document data
31
  $this->gallery = $gallery;
32
  $this->description = $attachment->post_content;
44
 
45
  /**
46
  * Returns HTML representing this Document.
47
+ * @filter dg_icon_template Filters the DG icon HTML. Passes a single
48
+ * bool value indicating whether the gallery is using descriptions or not.
49
+ * @filter dg_doc_icon Deprecated. To be removed in a future relesase.
50
  * @return string
51
  */
52
  public function __toString() {
53
+ static $find = null;
54
+ if (is_null($find)) {
55
+ $find = array("%link%", "%img%", "%title_attribute%", "%title%");
56
+ }
57
+
58
  $thumb = $this->gallery->useFancyThumbs()
59
  ? DG_Thumber::getThumbnail($this->ID)
60
  : DG_Thumber::getDefaultThumbnail($this->ID);
 
 
 
61
 
62
+ $repl = array($this->link, $thumb, $this->title_attribute, $this->title);
63
+
64
+ $doc_icon = apply_filters(
65
+ 'dg_icon_template',
66
+ ' <div class="document-icon">' . PHP_EOL .
67
+ ' <a href="%link%"><img src="%img%" title="%title_attribute%" alt="%title_attribute%" /><br>%title%</a>' . PHP_EOL .
68
+ ' </div>' . PHP_EOL,
69
+ $this->gallery->useDescriptions(),
70
+ $this->ID);
71
+
72
+ $core = str_replace($find, $repl, $doc_icon);
73
+
74
  if($this->gallery->useDescriptions()) {
75
  $core .= " <p>$this->description</p>" . PHP_EOL;
76
  }
77
 
78
  // users may filter icon here
79
+ return apply_filters('dg_doc_icon', $core, $this->ID, $this->gallery->useDescriptions());
80
  }
81
  }
82
 
inc/class-gallery.php CHANGED
@@ -19,31 +19,31 @@ class DG_Gallery {
19
  private $errs = array();
20
 
21
  // templates for HTML output
22
- private static $no_docs = false;
23
- private static $icon_wrapper = false;
24
- private static $comment = false;
25
 
26
- private static $binary_err = false;
27
 
28
  /*==========================================================================
29
  * PUBLIC FUNCTIONS
30
  *=========================================================================*/
31
 
32
  /**
33
- * Returns whether to link to attachment pg.
34
- * @return bool
35
  */
36
  public function linkToAttachmentPg() {
37
  return $this->atts['attachment_pg'];
38
  }
39
 
 
 
 
40
  public function useFancyThumbs() {
41
  return $this->atts['fancy'];
42
  }
43
 
44
  /**
45
- * Returns whether descriptions should be included in output.
46
- * @return bool
47
  */
48
  public function useDescriptions() {
49
  return $this->atts['descriptions'];
@@ -54,56 +54,50 @@ class DG_Gallery {
54
  *=========================================================================*/
55
 
56
  /**
57
- * Gets the DG options specific to Gallery.
58
- * @return array
59
  */
60
- public static function getOptions() {
61
- global $dg_options;
62
- return $dg_options['gallery'];
63
  }
64
 
65
  /**
66
- * Sets the DG options specific to Gallery.
67
- * @param array $options
68
  */
69
- public static function setOptions($options) {
70
- global $dg_options;
71
  $dg_options['gallery'] = $options;
72
- update_option(DG_OPTION_NAME, $dg_options);
73
- }
74
-
75
- public static function getDefaults() {
76
- $options = self::getOptions();
77
- return $options['defaults'];
78
- }
79
-
80
- public static function setDefaults($defaults) {
81
- $options = self::getOptions();
82
- $options['defaults'] = $defaults;
83
- self::setOptions($options);
84
  }
85
 
86
  /*==========================================================================
87
  * INIT GALLERY
88
  *=========================================================================*/
89
 
 
 
 
90
  public static function init() {
91
- self::$comment =
92
- PHP_EOL . '<!-- ' . __('Generated using Document Gallery. Get yours here: ', 'document-gallery') .
93
- 'http://wordpress.org/extend/plugins/document-gallery -->' . PHP_EOL;
94
- self::$icon_wrapper = '<div class="%s">'. PHP_EOL . '%s</div>' . PHP_EOL;
95
- self::$no_docs = '<!-- ' . __('No attachments to display. How boring! :(', 'document-gallery') . ' -->';
96
- self::$binary_err = __('The %s parameter may only be "%s" or "%s." You entered "%s."', 'document-gallery');
 
 
97
  }
98
 
99
  /**
100
  * Builds a gallery object with attributes passed.
101
- * @param array $atts Array of attributes used in shortcode.
102
  */
103
  public function __construct($atts) {
104
  // empty string is passed when no arguments are given, but constructor expects an array
105
  $atts = empty($atts) ? array() : $atts;
106
- $defaults = self::getDefaults();
107
 
108
  // values used to construct tax query (may be empty)
109
  $this->taxa = array_diff_key($atts, $defaults);
@@ -129,10 +123,11 @@ class DG_Gallery {
129
 
130
  /**
131
  * Cleans up user input, making sure we don't pass crap on to WP core.
132
- * @global string $wp_version
 
133
  */
134
  public static function sanitizeDefaults($defaults, &$errs) {
135
- $old_defaults = self::getDefaults();
136
 
137
  // remove invalid keys
138
  $defaults = array_intersect_key($defaults, $old_defaults);
@@ -207,8 +202,14 @@ class DG_Gallery {
207
  return $defaults;
208
  }
209
 
 
 
 
 
 
 
210
  private static function sanitizeAttachmentPg($value, &$err) {
211
- $defaults = self::getDefaults();
212
  $ret = $defaults['attachment_pg'];
213
 
214
  $attachment_pg = self::toBool($value);
@@ -222,8 +223,14 @@ class DG_Gallery {
222
  return $ret;
223
  }
224
 
 
 
 
 
 
 
225
  private static function sanitizeDescriptions($value, &$err) {
226
- $defaults = self::getDefaults();
227
  $ret = $defaults['descriptions'];
228
 
229
  $descriptions = self::toBool($value);
@@ -237,8 +244,14 @@ class DG_Gallery {
237
  return $ret;
238
  }
239
 
 
 
 
 
 
 
240
  private static function sanitizeFancy($value, &$err) {
241
- $defaults = self::getDefaults();
242
  $ret = $defaults['fancy'];
243
 
244
  $fancy = self::toBool($value);
@@ -252,8 +265,14 @@ class DG_Gallery {
252
  return $ret;
253
  }
254
 
 
 
 
 
 
 
255
  private static function sanitizeIds($value, &$err) {
256
- $defaults = self::getDefaults();
257
  $ret = $defaults['ids'];
258
 
259
  if(false === self::toBool($value)) {
@@ -275,8 +294,14 @@ class DG_Gallery {
275
  return $ret;
276
  }
277
 
 
 
 
 
 
 
278
  private static function sanitizeImages($value, &$err) {
279
- $defaults = self::getDefaults();
280
  $ret = $defaults['images'];
281
 
282
  $images = self::toBool($value);
@@ -290,8 +315,14 @@ class DG_Gallery {
290
  return $ret;
291
  }
292
 
 
 
 
 
 
 
293
  private static function sanitizeLocalpost($value, &$err) {
294
- $defaults = self::getDefaults();
295
  $ret = $defaults['localpost'];
296
 
297
  $localpost = self::toBool($value);
@@ -305,8 +336,14 @@ class DG_Gallery {
305
  return $ret;
306
  }
307
 
 
 
 
 
 
 
308
  private static function sanitizeOrder($value, &$err) {
309
- $defaults = self::getDefaults();
310
  $ret = $defaults['order'];
311
 
312
  $order = strtoupper($value);
@@ -319,12 +356,21 @@ class DG_Gallery {
319
  return $ret;
320
  }
321
 
 
 
 
322
  public static function getOrderOptions() {
323
  return array('ASC', 'DESC');
324
  }
325
 
 
 
 
 
 
 
326
  private static function sanitizeOrderby($value, &$err) {
327
- $defaults = self::getDefaults();
328
  $ret = $defaults['orderby'];
329
 
330
  $orderby = 'ID' === strtoupper($value) ? 'ID' : strtolower($value);
@@ -339,14 +385,23 @@ class DG_Gallery {
339
  return $ret;
340
  }
341
 
 
 
 
342
  public static function getOrderbyOptions() {
343
  return array('author', 'comment_count', 'date', 'ID',
344
  'menu_order', 'modified', 'name', 'none',
345
  'parent', 'post__in', 'rand', 'title');
346
  }
347
 
 
 
 
 
 
 
348
  private static function sanitizeRelation($value, &$err) {
349
- $defaults = self::getDefaults();
350
  $ret = $defaults['relation'];
351
 
352
  $relation = strtoupper($value);
@@ -359,13 +414,16 @@ class DG_Gallery {
359
  return $ret;
360
  }
361
 
 
 
 
362
  public static function getRelationOptions() {
363
  return array('AND', 'OR');
364
  }
365
 
366
  /**
367
  * Gets all valid Documents based on the attributes passed by the user.
368
- * @return array Contains all documents matching the query.
369
  * @throws InvalidArgumentException Thrown when $this->errs is not empty.
370
  */
371
  private function getDocuments() {
@@ -401,8 +459,8 @@ class DG_Gallery {
401
  * Function loops through all attributes passed that did not match
402
  * self::$defaults. If they are the name of a taxonomy, they are plugged
403
  * into the query, otherwise $this->errs is appended with an error string.
404
- * @global string $wp_version Determines which tax query to use.
405
- * @param array $query Query to insert tax query into.
406
  */
407
  private function setTaxa(&$query) {
408
  if(!empty($this->taxa)) {
@@ -435,9 +493,9 @@ class DG_Gallery {
435
  /**
436
  * Returns an array of term ids when provided with a list of term names.
437
  * Also appends an entry onto $errs if any invalid names are found.
438
- * @param string $taxon
439
- * @param array $term_names
440
- * @return array
441
  */
442
  private function getTermIdsByNames($taxon, $term_names) {
443
  return $this->getTermXByNames('term_id', $taxon, $term_names);
@@ -446,24 +504,24 @@ class DG_Gallery {
446
  /**
447
  * Returns an array of term slugs when provided with a list of term names.
448
  * Also appends an entry onto $errs if any invalid names are found.
449
- * @param string $taxon
450
- * @param array $term_names
451
- * @return array
452
  */
453
  private function getTermSlugsByNames($taxon, $term_names) {
454
  return $this->getTermXByNames('slug', $taxon, $term_names);
455
  }
456
 
457
  /**
458
- * (WP >= 2.3) Returns a list of x, where x may be any of the fields within a
459
  * term object, when provided with a list of term names (not slugs).
460
  * (http://codex.wordpress.org/Function_Reference/get_term_by#Return_Values)
461
  *
462
  * Also appends an entry onto $errs if any invalid names are found.
463
- * @param string $x
464
- * @param string $taxon
465
- * @param array $term_names
466
- * @return array
467
  */
468
  private function getTermXByNames($x, $taxon, $term_names) {
469
  $ret = array();
@@ -482,7 +540,7 @@ class DG_Gallery {
482
 
483
  /**
484
  * Given a list of IDs, all attachments represented by these IDs are returned.
485
- * @return array post objects
486
  */
487
  private function getAttachmentsByIds() {
488
  $args = array(
@@ -507,6 +565,11 @@ class DG_Gallery {
507
  || (int)$var < 0; // isn't positive
508
  }
509
 
 
 
 
 
 
510
  private static function toBool($val) {
511
  if (is_bool($val)) {
512
  return $val;
@@ -535,10 +598,17 @@ class DG_Gallery {
535
  *=========================================================================*/
536
 
537
  /**
538
- * Returns HTML representing this Gallery.
539
- * @return string
 
 
540
  */
541
  public function __toString() {
 
 
 
 
 
542
  if(!empty($this->errs)) {
543
  return '<p>' . implode('</p><p>', $this->errs) . '</p>';
544
  }
@@ -546,6 +616,11 @@ class DG_Gallery {
546
  if(empty($this->docs)) {
547
  return self::$no_docs;
548
  }
 
 
 
 
 
549
 
550
  $core = '';
551
  $classes = array('document-icon-wrapper');
@@ -553,26 +628,28 @@ class DG_Gallery {
553
  $classes[] = 'descriptions';
554
  }
555
 
556
- $icon_wrapper = sprintf(self::$icon_wrapper, implode(' ', $classes), '%s');
557
-
558
  if($this->useDescriptions()) {
559
  foreach($this->docs as $doc) {
560
- $core .= sprintf($icon_wrapper, $doc);
 
561
  }
562
  } else {
563
  for($i = 0; $i < count($this->docs); $i+=4) {
564
- $row = '';
565
 
566
  $min = min($i+4, count($this->docs));
567
  for($x = $i; $x < $min; $x++) {
568
- $row .= $this->docs[$x];
569
  }
570
 
571
- $core .= sprintf($icon_wrapper, $row);
572
  }
573
  }
574
 
575
- return self::$comment . $core;
 
 
576
  }
577
  }
578
 
19
  private $errs = array();
20
 
21
  // templates for HTML output
22
+ private static $no_docs = null;
23
+ private static $comment = null;
 
24
 
25
+ private static $binary_err = null;
26
 
27
  /*==========================================================================
28
  * PUBLIC FUNCTIONS
29
  *=========================================================================*/
30
 
31
  /**
32
+ * @return bool Whether to link to attachment pg.
 
33
  */
34
  public function linkToAttachmentPg() {
35
  return $this->atts['attachment_pg'];
36
  }
37
 
38
+ /**
39
+ * @return bool Whether to use "fancy" thumbnails.
40
+ */
41
  public function useFancyThumbs() {
42
  return $this->atts['fancy'];
43
  }
44
 
45
  /**
46
+ * @return bool Whether descriptions should be included in output.
 
47
  */
48
  public function useDescriptions() {
49
  return $this->atts['descriptions'];
54
  *=========================================================================*/
55
 
56
  /**
57
+ * @param int $blog The blog we're retrieving options for (null => current blog).
58
+ * @return multitype:unknown Gets gallery branch of DG options array.
59
  */
60
+ public static function getOptions($blog = null) {
61
+ $options = DocumentGallery::getOptions($blog);
62
+ return $options['gallery'];
63
  }
64
 
65
  /**
66
+ * @param multitype:unknown $options New value for gallery branch of DG options array.
67
+ * @param int $blog The blog we're retrieving options for (null => current blog).
68
  */
69
+ public static function setOptions($options, $blog = null) {
70
+ $dg_options = DocumentGallery::getOptions($blog);
71
  $dg_options['gallery'] = $options;
72
+ DocumentGallery::setOptions($dg_options, $blog);
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  /*==========================================================================
76
  * INIT GALLERY
77
  *=========================================================================*/
78
 
79
+ /**
80
+ * Initializes static values for this class.
81
+ */
82
  public static function init() {
83
+ if (is_null(self::$comment))
84
+ {
85
+ self::$comment =
86
+ PHP_EOL . '<!-- ' . __('Generated using Document Gallery. Get yours here: ', 'document-gallery') .
87
+ 'http://wordpress.org/extend/plugins/document-gallery -->' . PHP_EOL;
88
+ self::$no_docs = '<!-- ' . __('No attachments to display. How boring! :(', 'document-gallery') . ' -->';
89
+ self::$binary_err = __('The %s parameter may only be "%s" or "%s." You entered "%s."', 'document-gallery');
90
+ }
91
  }
92
 
93
  /**
94
  * Builds a gallery object with attributes passed.
95
+ * @param multitype:string $atts Array of attributes used in shortcode.
96
  */
97
  public function __construct($atts) {
98
  // empty string is passed when no arguments are given, but constructor expects an array
99
  $atts = empty($atts) ? array() : $atts;
100
+ $defaults = self::getOptions();
101
 
102
  // values used to construct tax query (may be empty)
103
  $this->taxa = array_diff_key($atts, $defaults);
123
 
124
  /**
125
  * Cleans up user input, making sure we don't pass crap on to WP core.
126
+ * @param multitype:string $defaults The defaults array to sanitize.
127
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
128
  */
129
  public static function sanitizeDefaults($defaults, &$errs) {
130
+ $old_defaults = self::getOptions();
131
 
132
  // remove invalid keys
133
  $defaults = array_intersect_key($defaults, $old_defaults);
202
  return $defaults;
203
  }
204
 
205
+ /**
206
+ * Takes the provided value and returns a sanitized value.
207
+ * @param string $value The attachment_pg value to be sanitized.
208
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
209
+ * @return bool The sanitized attachment_pg value.
210
+ */
211
  private static function sanitizeAttachmentPg($value, &$err) {
212
+ $defaults = self::getOptions();
213
  $ret = $defaults['attachment_pg'];
214
 
215
  $attachment_pg = self::toBool($value);
223
  return $ret;
224
  }
225
 
226
+ /**
227
+ * Takes the provided value and returns a sanitized value.
228
+ * @param string $value The descriptions value to be sanitized.
229
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
230
+ * @return bool The sanitized descriptions value.
231
+ */
232
  private static function sanitizeDescriptions($value, &$err) {
233
+ $defaults = self::getOptions();
234
  $ret = $defaults['descriptions'];
235
 
236
  $descriptions = self::toBool($value);
244
  return $ret;
245
  }
246
 
247
+ /**
248
+ * Takes the provided value and returns a sanitized value.
249
+ * @param string $value The fancy value to be sanitized.
250
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
251
+ * @return bool The sanitized fancy value.
252
+ */
253
  private static function sanitizeFancy($value, &$err) {
254
+ $defaults = self::getOptions();
255
  $ret = $defaults['fancy'];
256
 
257
  $fancy = self::toBool($value);
265
  return $ret;
266
  }
267
 
268
+ /**
269
+ * Takes the provided value and returns a sanitized value.
270
+ * @param string $value The ids value to be sanitized.
271
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
272
+ * @return bool|multitype:int The sanitized ids value.
273
+ */
274
  private static function sanitizeIds($value, &$err) {
275
+ $defaults = self::getOptions();
276
  $ret = $defaults['ids'];
277
 
278
  if(false === self::toBool($value)) {
294
  return $ret;
295
  }
296
 
297
+ /**
298
+ * Takes the provided value and returns a sanitized value.
299
+ * @param string $value The images value to be sanitized.
300
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
301
+ * @return bool The sanitized images value.
302
+ */
303
  private static function sanitizeImages($value, &$err) {
304
+ $defaults = self::getOptions();
305
  $ret = $defaults['images'];
306
 
307
  $images = self::toBool($value);
315
  return $ret;
316
  }
317
 
318
+ /**
319
+ * Takes the provided value and returns a sanitized value.
320
+ * @param string $value The localpost value to be sanitized.
321
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
322
+ * @return bool The sanitized localpost value.
323
+ */
324
  private static function sanitizeLocalpost($value, &$err) {
325
+ $defaults = self::getOptions();
326
  $ret = $defaults['localpost'];
327
 
328
  $localpost = self::toBool($value);
336
  return $ret;
337
  }
338
 
339
+ /**
340
+ * Takes the provided value and returns a sanitized value.
341
+ * @param string $value The order value to be sanitized.
342
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
343
+ * @return string The sanitized order value.
344
+ */
345
  private static function sanitizeOrder($value, &$err) {
346
+ $defaults = self::getOptions();
347
  $ret = $defaults['order'];
348
 
349
  $order = strtoupper($value);
356
  return $ret;
357
  }
358
 
359
+ /**
360
+ * @return multitype:string The valid options for order parameter.
361
+ */
362
  public static function getOrderOptions() {
363
  return array('ASC', 'DESC');
364
  }
365
 
366
+ /**
367
+ * Takes the provided value and returns a sanitized value.
368
+ * @param string $value The orderby value to be sanitized.
369
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
370
+ * @return string The sanitized orderby value.
371
+ */
372
  private static function sanitizeOrderby($value, &$err) {
373
+ $defaults = self::getOptions();
374
  $ret = $defaults['orderby'];
375
 
376
  $orderby = 'ID' === strtoupper($value) ? 'ID' : strtolower($value);
385
  return $ret;
386
  }
387
 
388
+ /**
389
+ * @return multitype:string The valid options for orderby parameter.
390
+ */
391
  public static function getOrderbyOptions() {
392
  return array('author', 'comment_count', 'date', 'ID',
393
  'menu_order', 'modified', 'name', 'none',
394
  'parent', 'post__in', 'rand', 'title');
395
  }
396
 
397
+ /**
398
+ * Takes the provided value and returns a sanitized value.
399
+ * @param string $value The relation value to be sanitized.
400
+ * @param multitype:string &$errs The array of errors, which will be appended with any errors found.
401
+ * @return string The sanitized relation value.
402
+ */
403
  private static function sanitizeRelation($value, &$err) {
404
+ $defaults = self::getOptions();
405
  $ret = $defaults['relation'];
406
 
407
  $relation = strtoupper($value);
414
  return $ret;
415
  }
416
 
417
+ /**
418
+ * @return multitype:string The valid options for relation parameter.
419
+ */
420
  public static function getRelationOptions() {
421
  return array('AND', 'OR');
422
  }
423
 
424
  /**
425
  * Gets all valid Documents based on the attributes passed by the user.
426
+ * @return multitype:unknown Contains all documents matching the query.
427
  * @throws InvalidArgumentException Thrown when $this->errs is not empty.
428
  */
429
  private function getDocuments() {
459
  * Function loops through all attributes passed that did not match
460
  * self::$defaults. If they are the name of a taxonomy, they are plugged
461
  * into the query, otherwise $this->errs is appended with an error string.
462
+ * @global string $wp_version Determines which tax query to use.
463
+ * @param multitype:unknown $query Query to insert tax query into.
464
  */
465
  private function setTaxa(&$query) {
466
  if(!empty($this->taxa)) {
493
  /**
494
  * Returns an array of term ids when provided with a list of term names.
495
  * Also appends an entry onto $errs if any invalid names are found.
496
+ * @param string $taxon The taxon these terms are a member of.
497
+ * @param multitype:string $term_names Terms to retrieve.
498
+ * @return multitype:string All matched terms.
499
  */
500
  private function getTermIdsByNames($taxon, $term_names) {
501
  return $this->getTermXByNames('term_id', $taxon, $term_names);
504
  /**
505
  * Returns an array of term slugs when provided with a list of term names.
506
  * Also appends an entry onto $errs if any invalid names are found.
507
+ * @param string $taxon The taxon these terms are a member of.
508
+ * @param multitype:string $term_names Terms to retrieve.
509
+ * @return multitype:string All matched terms.
510
  */
511
  private function getTermSlugsByNames($taxon, $term_names) {
512
  return $this->getTermXByNames('slug', $taxon, $term_names);
513
  }
514
 
515
  /**
516
+ * Returns a list of x, where x may be any of the fields within a
517
  * term object, when provided with a list of term names (not slugs).
518
  * (http://codex.wordpress.org/Function_Reference/get_term_by#Return_Values)
519
  *
520
  * Also appends an entry onto $errs if any invalid names are found.
521
+ * @param string $x Field to retrieve from matched term.
522
+ * @param string $taxon The taxon these terms are a member of.
523
+ * @param multitype:string $term_names Terms to retrieve.
524
+ * @return multitype:string All matched terms.
525
  */
526
  private function getTermXByNames($x, $taxon, $term_names) {
527
  $ret = array();
540
 
541
  /**
542
  * Given a list of IDs, all attachments represented by these IDs are returned.
543
+ * @return multitype:Post The posts matched.
544
  */
545
  private function getAttachmentsByIds() {
546
  $args = array(
565
  || (int)$var < 0; // isn't positive
566
  }
567
 
568
+ /**
569
+ * Converts provided value to bool.
570
+ * @param unknown $val To be converted.
571
+ * @return bool|NULL Bool value if can be parsed, else NULL.
572
+ */
573
  private static function toBool($val) {
574
  if (is_bool($val)) {
575
  return $val;
598
  *=========================================================================*/
599
 
600
  /**
601
+ * @filter dg_gallery_template Allows the user to filter anything content surrounding the generated gallery.
602
+ * @filter dg_row_template Filters the outer DG wrapper HTML. Passes a single
603
+ * bool value indicating whether the gallery is using descriptions or not.
604
+ * @return string HTML representing this Gallery.
605
  */
606
  public function __toString() {
607
+ static $find = null;
608
+ if (is_null($find)) {
609
+ $find = array('%class%', '%icons%');
610
+ }
611
+
612
  if(!empty($this->errs)) {
613
  return '<p>' . implode('</p><p>', $this->errs) . '</p>';
614
  }
616
  if(empty($this->docs)) {
617
  return self::$no_docs;
618
  }
619
+
620
+ $icon_wrapper = apply_filters(
621
+ 'dg_row_template',
622
+ '<div class="%class%">'. PHP_EOL . '%icons%' . PHP_EOL . '</div>' . PHP_EOL,
623
+ $this->useDescriptions());
624
 
625
  $core = '';
626
  $classes = array('document-icon-wrapper');
628
  $classes[] = 'descriptions';
629
  }
630
 
631
+ $repl = array(implode(' ', $classes));
 
632
  if($this->useDescriptions()) {
633
  foreach($this->docs as $doc) {
634
+ $repl[1] = $doc;
635
+ $core .= str_replace($find, $repl, $icon_wrapper);
636
  }
637
  } else {
638
  for($i = 0; $i < count($this->docs); $i+=4) {
639
+ $repl[1] = '';
640
 
641
  $min = min($i+4, count($this->docs));
642
  for($x = $i; $x < $min; $x++) {
643
+ $repl[1] .= $this->docs[$x];
644
  }
645
 
646
+ $core .= str_replace($find, $repl, $icon_wrapper);
647
  }
648
  }
649
 
650
+ // allow user to wrap gallery output
651
+ $gallery = apply_filters('dg_gallery_template', '%rows%', $this->useDescriptions());
652
+ return self::$comment . str_replace('%rows%', $core, $gallery);
653
  }
654
  }
655
 
inc/class-image-editor-imagick.php CHANGED
@@ -42,10 +42,10 @@ class DG_Image_Editor_Imagick extends WP_Image_Editor_Imagick {
42
  // log anything on failure...
43
  try {
44
  if (!$this->image->setIteratorIndex($this->pg)) {
45
- DocumentGallery::writeLog($err . '.');
46
  }
47
  } catch(Exception $e) {
48
- DocumentGallery::writeLog($err . ': ' . $e->getMessage());
49
  }
50
  }
51
 
42
  // log anything on failure...
43
  try {
44
  if (!$this->image->setIteratorIndex($this->pg)) {
45
+ DG_Logger::writeLog(DG_LogLevel::Error, $err . '.');
46
  }
47
  } catch(Exception $e) {
48
+ DG_Logger::writeLog(DG_LogLevel::Error, $err . ': ' . $e->getMessage());
49
  }
50
  }
51
 
inc/class-logger.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WPINC') OR exit;
3
+
4
+ /**
5
+ * Encapsulates the logic required to maintain and read log files.
6
+ */
7
+ class DG_Logger {
8
+ /**
9
+ * Appends DG log file if logging is enabled. The following format is used for each line:
10
+ * datetime | level | entry | stacktrace (optional)
11
+ *
12
+ * @param int The level of serverity (should be passed using DG_LogLevel consts).
13
+ * @param string $entry Value to be logged.
14
+ * @param bool $stacktrace Whether to include full stack trace.
15
+ * @param bool $force Whether to ignore logging flag and log no matter what.
16
+ */
17
+ public static function writeLog($level, $entry, $stacktrace = false, $force = false) {
18
+ if ($force || self::logEnabled()) {
19
+ $fp = fopen(self::getLogFileName(), 'a');
20
+ if (false !== $fp) {
21
+ $fields = array(time(), $level, $entry);
22
+
23
+ $trace = debug_backtrace(false);
24
+ if ($stacktrace) {
25
+ unset($trace[0]);
26
+
27
+ $trace_str = '';
28
+ $i = 1;
29
+
30
+ foreach($trace as $node) {
31
+ $trace_str .= "#$i ";
32
+
33
+ $file = '';
34
+ if (isset($node['file'])) {
35
+ // convert to relative path from WP root
36
+ $file = str_replace(ABSPATH, '', $node['file']);
37
+ }
38
+
39
+ if (isset($node['line'])) {
40
+ $file .= "({$node['line']})";
41
+ }
42
+
43
+ if ($file) {
44
+ $trace_str .= "$file: ";
45
+ }
46
+
47
+ if(isset($node['class'])) {
48
+ $trace_str .= "{$node['class']}{$node['type']}";
49
+ }
50
+
51
+ if (isset($node['function'])) {
52
+ $args = '';
53
+ if (isset($node['args'])) {
54
+ $args = implode(', ', array_map(
55
+ function($v) { return print_r($v, true); },
56
+ $node['args']));
57
+ }
58
+
59
+ $trace_str .= "{$node['function']}($args)" . PHP_EOL;
60
+ }
61
+ $i++;
62
+ }
63
+
64
+ $fields[] = $trace_str;
65
+ } else {
66
+ // Remove first item from backtrace as it's this function which is redundant.
67
+ $caller = $trace[1];
68
+ $caller = (isset($caller['class']) ? $caller['class'] : '') . $caller['type'] . $caller['function'];
69
+ $fields[2] = '(' . $caller . ') ' . $fields[2];
70
+ }
71
+
72
+ fputcsv($fp, $fields);
73
+ fclose($fp);
74
+ } // TODO: else
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Reads the current blog's log file, placing the values in to a 2-dimensional array.
80
+ * @param int $skip How many lines to skip before returning rows.
81
+ * @param int $limit Max number of lines to read.
82
+ * @return multitype:multitype:string|null The rows from the log file or null if no entries exist.
83
+ */
84
+ public static function readLog($skip = 0, $limit = PHP_INT_MAX) {
85
+ $ret = null;
86
+ $fp = @fopen(self::getLogFileName(), 'r');
87
+
88
+ if ($fp !== false) {
89
+ $ret = array();
90
+ while (count($ret) < $limit && ($fields = fgetcsv($fp)) !== false) {
91
+ if ($skip > 0) {
92
+ $skip--;
93
+ continue;
94
+ }
95
+
96
+ if (!is_null($fields)) {
97
+ $ret[] = $fields;
98
+ }
99
+ }
100
+ }
101
+
102
+ return $ret;
103
+ }
104
+
105
+ /**
106
+ * Clears the log file for the active blog.
107
+ */
108
+ public static function clearLog() {
109
+ // we don't care if the file actually exists -- it won't when we're done
110
+ @unlink(self::getLogFileName());
111
+ }
112
+
113
+ /**
114
+ * @return bool Whether debug logging is currently enabled.
115
+ */
116
+ public static function logEnabled() {
117
+ global $dg_options;
118
+ return $dg_options['logging'];
119
+ }
120
+
121
+ /**
122
+ * @return string Full path to log file for current blog.
123
+ */
124
+ private static function getLogFileName() {
125
+ return DG_PATH . 'log/' . get_current_blog_id() . '.log';
126
+ }
127
+ }
128
+
129
+ /**
130
+ * LogLevel acts as an enumeration of all possible log levels.
131
+ */
132
+ class DG_LogLevel {
133
+ /**
134
+ * @var int Log level for anything that doesn't indicate a problem.
135
+ */
136
+ const Detail = 0;
137
+
138
+ /**
139
+ * @var int Log level for anything that is a minor issue.
140
+ */
141
+ const Warning = 1;
142
+
143
+ /**
144
+ * @var int Log level for when something went wrong.
145
+ */
146
+ const Error = 2;
147
+
148
+ /**
149
+ * @var ReflectionClass Backs the getter.
150
+ */
151
+ private static $ref = null;
152
+
153
+ /**
154
+ * @return ReflectionClass Instance of reflection class for this class.
155
+ */
156
+ private static function getReflectionClass() {
157
+ if (is_null(self::$ref)) {
158
+ self::$ref = new ReflectionClass(__CLASS__);
159
+ }
160
+
161
+ return self::$ref;
162
+ }
163
+
164
+ /**
165
+ * @var multitype Backs the getter.
166
+ */
167
+ private static $levels = null;
168
+
169
+ /**
170
+ * @return multitype Associative array containing all log level names mapped to their int value.
171
+ */
172
+ public static function getLogLevels() {
173
+ if (is_null(self::$levels)) {
174
+ $ref = self::getReflectionClass();
175
+ self::$levels = $ref->getConstants();
176
+ }
177
+
178
+ return self::$levels;
179
+ }
180
+
181
+ /**
182
+ * @param string $name Name to be checked for validity.
183
+ * @return bool Whether given name represents valid log level.
184
+ */
185
+ public static function isValidName($name) {
186
+ return array_key_exists($name, self::getLogLevels());
187
+ }
188
+
189
+ /**
190
+ * @param int $value Value to be checked for validity.
191
+ * @return bool Whether given value represents valid log level.
192
+ */
193
+ public static function isValidValue($value) {
194
+ return (false !== array_search($value, self::getLogLevels()));
195
+ }
196
+
197
+ /**
198
+ * @param string $name The name for which to retrieve a value.
199
+ * @return int|null The value associated with the given name.
200
+ */
201
+ public static function getValueByName($name) {
202
+ $levels = self::getLogLevels();
203
+ return array_key_exists($name, self::getLogLevels()) ? $levels[$name] : null;
204
+ }
205
+
206
+ /**
207
+ * @param int $value The value for which to retrieve a name.
208
+ * @return string|null The name associated with the given value.
209
+ */
210
+ public static function getNameByValue($value) {
211
+ $ret = array_search($value, self::getLogLevels());
212
+ return (false !== $ret) ? $ret : null;
213
+ }
214
+
215
+ /**
216
+ * Blocks instantiation. All functions are static.
217
+ */
218
+ private function __construct() {
219
+
220
+ }
221
+ }
inc/class-setup.php CHANGED
@@ -9,44 +9,93 @@ defined('WPINC') OR exit;
9
  class DG_Setup {
10
 
11
  /**
 
 
12
  * @return array Contains default options for DG.
13
  */
14
- public static function getDefaultOptions() {
15
  include_once DG_PATH . 'inc/class-thumber.php';
16
- $date = gmdate('D, d M Y H:i:s');
17
- $etag = md5($date);
 
 
 
 
 
 
18
  return array(
19
  'thumber' => array(
20
- 'thumbs' => array(),
21
- 'gs' => DG_Thumber::getGhostscriptExecutable(),
22
- 'active' => DG_Thumber::getDefaultThumbers(),
23
- 'width' => 200,
24
- 'height' => 200
 
 
 
 
 
 
 
 
 
 
 
 
25
  ),
26
  'gallery' => array(
27
- 'defaults' => array(
28
- // default: link directly to file (true to link to attachment pg)
29
- 'attachment_pg' => false,
30
- 'descriptions' => false,
31
- // include thumbnail of actual document in gallery display
32
- 'fancy' => true,
33
- // comma-separated list of attachment ids
34
- 'ids' => false,
35
- // if true, all images attached to current page will be included also
36
- 'images' => false,
37
- 'localpost' => true,
38
- 'order' => 'ASC',
39
- 'orderby' => 'menu_order',
40
- 'relation' => 'AND'
41
- )
 
 
 
 
 
 
 
 
 
 
 
42
  ),
43
  'css' => array(
44
- 'text' => '',
45
- 'last-modified' => $date,
46
- 'etag' => $etag,
47
- 'version' => 0
 
 
 
 
 
 
 
 
 
 
48
  ),
49
- 'version' => DG_VERSION
 
 
 
 
 
 
 
 
50
  );
51
  }
52
 
@@ -80,22 +129,23 @@ class DG_Setup {
80
  $options = DocumentGallery::getOptions($blog);
81
  if (is_null($options)) return;
82
 
 
 
 
83
  // update plugin version
84
  $options['version'] = DG_VERSION;
85
 
86
  // setup CSS
87
- if (!empty($options['css']['text'])) {
88
- // Only populate minified if it will be used
89
- $options['css']['minified'] =
90
- DocumentGallery::compileCustomCss($options['css']['text']);
91
- }
92
  $options['css']['last-modified'] = gmdate('D, d M Y H:i:s');
93
  $options['css']['etag'] = md5($options['css']['last-modified']);
94
 
95
  // remove previously-failed thumbs
96
  $thumbs = $options['thumber']['thumbs'];
97
  foreach ($thumbs as $k => $v) {
98
- if (false === $v) {
99
  unset($options['thumber']['thumbs'][$k]);
100
  }
101
  }
@@ -103,6 +153,47 @@ class DG_Setup {
103
  DocumentGallery::setOptions($options, $blog);
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Sets up Document Gallery on all blog(s) activated.
108
  * @param bool $networkwide Whether this is a network-wide update (multisite only).
@@ -174,7 +265,7 @@ class DG_Setup {
174
  if (is_null($options)) return;
175
 
176
  foreach ($options['thumbs'] as $val) {
177
- if (false !== $val) {
178
  @unlink($val['thumb_path']);
179
  }
180
  }
9
  class DG_Setup {
10
 
11
  /**
12
+ * The default DG options to be used on install and when validating structure of options.
13
+ * @param $skeleton bool When true, expensive values are not calculated. Only keys may be trusted when returning skeleton.
14
  * @return array Contains default options for DG.
15
  */
16
+ public static function getDefaultOptions($skeleton = false) {
17
  include_once DG_PATH . 'inc/class-thumber.php';
18
+
19
+ $date = $etag = $gs = null;
20
+ if (!$skeleton) {
21
+ $date = gmdate('D, d M Y H:i:s');
22
+ $etag = md5($date);
23
+ $gs = DG_Thumber::getGhostscriptExecutable();
24
+ }
25
+
26
  return array(
27
  'thumber' => array(
28
+ // cached thumbnails, keyed by post ID
29
+ 'thumbs' => array(),
30
+
31
+ // Ghostscript path
32
+ 'gs' => $gs,
33
+
34
+ // which thumbnail generation methods are available
35
+ 'active' => DG_Thumber::getDefaultThumbers($skeleton),
36
+
37
+ // max width to generate thumbnails
38
+ 'width' => 200,
39
+
40
+ // max height to generate thumbnails
41
+ 'height' => 200,
42
+
43
+ // time after which to quite trying to generate new thumbanils for gallery
44
+ 'timeout' => 30
45
  ),
46
  'gallery' => array(
47
+ // default: link directly to file (true to link to attachment pg)
48
+ 'attachment_pg' => false,
49
+
50
+ // include the attachment description in output
51
+ 'descriptions' => false,
52
+
53
+ // include thumbnail of actual document in gallery display
54
+ 'fancy' => true,
55
+
56
+ // comma-separated list of attachment ids
57
+ 'ids' => false,
58
+
59
+ // if true, all images attached to current page will be included also
60
+ 'images' => false,
61
+
62
+ // include just attached to the post using shortcode
63
+ 'localpost' => true,
64
+
65
+ // ascending/descending order for included documents
66
+ 'order' => 'ASC',
67
+
68
+ // which property to order by
69
+ 'orderby' => 'menu_order',
70
+
71
+ // AND or OR
72
+ 'relation' => 'AND'
73
  ),
74
  'css' => array(
75
+ // plain text of CSS to be edited by user
76
+ 'text' => '',
77
+
78
+ // "minified" text to be rendered on pages
79
+ 'minified' => '',
80
+
81
+ // date/time last modified
82
+ 'last-modified' => $date,
83
+
84
+ // used when telling browser whether to load from cache
85
+ 'etag' => $etag,
86
+
87
+ // used in cache busting after user modifies CSS
88
+ 'version' => 0
89
  ),
90
+
91
+ // current DG version
92
+ 'version' => DG_VERSION,
93
+
94
+ // whether to validate DG option structure on save
95
+ 'validation' => false,
96
+
97
+ // whether to logging DG activity
98
+ 'logging' => false
99
  );
100
  }
101
 
129
  $options = DocumentGallery::getOptions($blog);
130
  if (is_null($options)) return;
131
 
132
+ // version-specific updates
133
+ self::twoPointTwo($options);
134
+
135
  // update plugin version
136
  $options['version'] = DG_VERSION;
137
 
138
  // setup CSS
139
+ $options['css']['minified'] = isset($options['css']['text'])
140
+ ? DocumentGallery::compileCustomCss($options['css']['text'])
141
+ : '';
 
 
142
  $options['css']['last-modified'] = gmdate('D, d M Y H:i:s');
143
  $options['css']['etag'] = md5($options['css']['last-modified']);
144
 
145
  // remove previously-failed thumbs
146
  $thumbs = $options['thumber']['thumbs'];
147
  foreach ($thumbs as $k => $v) {
148
+ if (empty($v['thumber'])) {
149
  unset($options['thumber']['thumbs'][$k]);
150
  }
151
  }
153
  DocumentGallery::setOptions($options, $blog);
154
  }
155
 
156
+ /**
157
+ * The 'created_timestamp' key in each thumb record is being moved
158
+ * to 'timestamp' as part of a move to store timestamp for failed
159
+ * thumbnails in addition to successful ones.
160
+ *
161
+ * The defaults sub-branch in the gallery branch is being flattened into its parent.
162
+ *
163
+ * @param array $options The options to be modified.
164
+ */
165
+ private static function twoPointTwo(&$options) {
166
+ if (version_compare($options['version'], '2.2', '<')) {
167
+ $thumbs = array();
168
+
169
+ // "created_timestamp" moving to just "timestamp"
170
+ foreach ($options['thumber']['thumbs'] as $id => $thumb) {
171
+ if (false === $thumb) continue;
172
+
173
+ $thumbs[$id] = array(
174
+ 'timestamp' => $thumb['created_timestamp'],
175
+ 'thumb_url' => $thumb['thumb_url'],
176
+ 'thumb_path' => $thumb['thumb_path'],
177
+ 'thumber' => $thumb['thumber']
178
+ );
179
+ }
180
+
181
+ $options['thumber']['thumbs'] = $thumbs;
182
+
183
+ // adding default thumbnail generation timeout
184
+ $options['thumber']['timeout'] = 30;
185
+
186
+ // flatten out "defaults" level
187
+ $options['gallery'] = $options['gallery']['defaults'];
188
+
189
+ // adding "validation" branch
190
+ $options['validation'] = false;
191
+
192
+ // adding "logging" branch
193
+ $options['logging'] = false;
194
+ }
195
+ }
196
+
197
  /**
198
  * Sets up Document Gallery on all blog(s) activated.
199
  * @param bool $networkwide Whether this is a network-wide update (multisite only).
265
  if (is_null($options)) return;
266
 
267
  foreach ($options['thumbs'] as $val) {
268
+ if (isset($val['thumber'])) {
269
  @unlink($val['thumb_path']);
270
  }
271
  }
inc/class-thumber.php CHANGED
@@ -11,11 +11,16 @@ class DG_Thumber {
11
 
12
  /**
13
  * Returns the default mapping of thumber slug to whether it is active or not.
 
 
14
  * @return array
15
  */
16
- public static function getDefaultThumbers() {
17
- $gs_active = (bool)self::getGhostscriptExecutable();
18
- $imagick_active = self::isImagickAvailable();
 
 
 
19
 
20
  return array('av' => true, 'gs' => $gs_active,
21
  'imagick' => $imagick_active, 'google' => false);
@@ -29,17 +34,17 @@ class DG_Thumber {
29
  * @return str URL to the thumbnail.
30
  */
31
  public static function getThumbnail($ID, $pg = 1) {
32
- static $timeout = null;
33
- if (is_null($timeout)) {
34
- $timeout = time();
35
  }
36
 
37
  $options = self::getOptions();
38
 
39
  // if we haven't saved a thumb, generate one
40
- if (!isset($options['thumbs'][$ID])) {
41
- // prevent page timing out -- generate for no more than 30 sec
42
- if ((time() - $timeout) > 30) {
43
  return self::getDefaultThumbnail($ID, $pg);
44
  }
45
 
@@ -49,23 +54,31 @@ class DG_Thumber {
49
  foreach (self::getThumbers() as $ext_preg => $thumber) {
50
  $ext_preg = '!\.(' . $ext_preg . ')$!i';
51
 
52
- if (preg_match($ext_preg, $file)
53
- && ($thumb = self::getThumbnailTemplate($thumber, $ID, $pg))) {
54
- $options['thumbs'][$ID] = array(
55
- 'created_timestamp' => time(),
56
- 'thumb_url' => $thumb['url'],
57
- 'thumb_path' => $thumb['path'],
58
- 'thumber' => $thumber
59
- );
60
- self::setOptions($options);
61
- break;
 
 
 
 
 
 
 
62
  }
63
  }
64
  }
65
 
66
- if (!isset($options['thumbs'][$ID]) || false === $options['thumbs'][$ID]) {
67
- if (!isset($options['thumbs'][$ID])) {
68
- $options['thumbs'][$ID] = false;
 
69
  self::setOptions($options);
70
  }
71
 
@@ -122,12 +135,12 @@ class DG_Thumber {
122
  $temp_file = self::getTempFile($ext);
123
 
124
  if (!$fp = @fopen($temp_file, 'wb')) {
125
- DocumentGallery::writeLog(__('Could not open file: ', 'document-gallery') . $temp_file);
126
  return false;
127
  }
128
 
129
  if (!@fwrite($fp, $metadata['image']['data'])) {
130
- DocumentGallery::writeLog(__('Could not write file: ', 'document-gallery') . $temp_file);
131
  fclose($fp);
132
  return false;
133
  }
@@ -162,9 +175,10 @@ class DG_Thumber {
162
  $img = new DG_Image_Editor_Imagick($doc_path, $pg - 1);
163
  $err = $img->load();
164
  if(is_wp_error($err)) {
165
- DocumentGallery::writeLog(
166
- __('Failed to open file in Imagick: ', 'document-gallery') .
167
- $err->get_error_message());
 
168
  return false;
169
  }
170
 
@@ -172,9 +186,10 @@ class DG_Thumber {
172
 
173
  $err = $img->save($temp_file, 'image/png');
174
  if (is_wp_error($err)) {
175
- DocumentGallery::writeLog(
176
- __('Failed to save image in Imagick: ', 'document-gallery') .
177
- $err->get_error_message());
 
178
  return false;
179
  }
180
 
@@ -231,7 +246,7 @@ class DG_Thumber {
231
  exec(sprintf($gs, $pg, $pg, $temp_path, $doc_path), $out, $ret);
232
 
233
  if ($ret != 0) {
234
- DocumentGallery::writeLog(__('Ghostscript failed: ', 'document-gallery') . print_r($out));
235
  @unlink($temp_path);
236
  return false;
237
  }
@@ -360,7 +375,7 @@ class DG_Thumber {
360
  );
361
 
362
  // prevent PHP timeout before HTTP completes
363
- set_time_limit($timeout);
364
 
365
  $options = self::getOptions();
366
  $google_viewer = sprintf($google_viewer, urlencode($doc_url), (int)$pg, $options['width']);
@@ -369,7 +384,7 @@ class DG_Thumber {
369
  $response = wp_remote_get($google_viewer, $args);
370
 
371
  if (is_wp_error($response) || !preg_match('/[23][0-9]{2}/', $response['response']['code'])) {
372
- DocumentGallery::writeLog(__('Failed to retrieve thumbnail from Google: ', 'document-gallery') .
373
  (is_wp_error($response)
374
  ? $response->get_error_message()
375
  : $response['response']['message']));
@@ -533,7 +548,7 @@ class DG_Thumber {
533
  /**
534
  * Key: Attachment ID
535
  * Val: array
536
- * + created_timestamp - When the thumbnail was generated.
537
  * + thumb_path - System path to thumbnail image.
538
  * + thumb_url - URL pointing to the thumbnail for this document.
539
  * + thumber - Generator used to create thumb OR false if failed to gen.
@@ -547,7 +562,7 @@ class DG_Thumber {
547
  /**
548
  * Key: Attachment ID
549
  * Val: array
550
- * + created_timestamp - When the thumbnail was generated.
551
  * + thumb_path - System path to thumbnail image.
552
  * + thumb_url - URL pointing to the thumbnail for this document.
553
  * + thumber - Generator used to create thumb OR false if failed to gen.
@@ -611,16 +626,22 @@ class DG_Thumber {
611
  $thumbers = array_filter($thumbers, 'is_callable');
612
 
613
  // log which thumbers are being used
614
- if (DocumentGallery::logEnabled()) {
615
  if (count($thumbers) > 0) {
616
  $entry = __('Thumbnail Generators: ', 'document-gallery');
617
  foreach ($thumbers as $k => $v) {
618
- $entry .= '{' . $k . ' => ' . print_r($v, true) . '} ';
 
 
 
 
 
 
619
  }
620
  } else {
621
  $entry = __('No thumbnail generators enabled.', 'document-gallery');
622
  }
623
- DocumentGallery::writeLog($entry);
624
  }
625
  }
626
 
@@ -659,9 +680,10 @@ class DG_Thumber {
659
  $img = wp_get_image_editor($temp_path);
660
 
661
  if (is_wp_error($img)) {
662
- DocumentGallery::writeLog(
663
- __('Failed to get image editor: ', 'document-gallery') .
664
- $img->get_error_message());
 
665
  return false;
666
  }
667
 
@@ -670,9 +692,10 @@ class DG_Thumber {
670
  $err = $img->save($thumb_path);
671
 
672
  if (is_wp_error($err)) {
673
- DocumentGallery::writeLog(
674
- __('Failed to save image: ', 'document-gallery') .
675
- $err->get_error_message());
 
676
  return false;
677
  }
678
 
@@ -716,22 +739,27 @@ class DG_Thumber {
716
  }
717
 
718
  /**
719
- * Removes the existing thumbnail/document meta for the attachment
720
- * with $ID, if such a thumbnail exists.
721
  *
722
- * @param int $ID
723
  */
724
- public static function deleteThumbMeta($ID) {
725
  $options = self::getOptions();
 
726
 
727
- if (isset($options['thumbs'][$ID])) {
728
- if (false !== $options['thumbs'][$ID]) {
729
- @unlink($options['thumbs'][$ID]['thumb_path']);
730
- }
 
731
 
732
- unset($options['thumbs'][$ID]);
733
- self::setOptions($options);
 
734
  }
 
 
735
  }
736
 
737
  /**
11
 
12
  /**
13
  * Returns the default mapping of thumber slug to whether it is active or not.
14
+ * @param $skeleton bool When true, values that require computation will be
15
+ * skipped. Useful when only structure of options is needed.
16
  * @return array
17
  */
18
+ public static function getDefaultThumbers($skeleton = false) {
19
+ $gs_active = $imagick_active = null;
20
+ if (!$skeleton) {
21
+ $gs_active = (bool)self::getGhostscriptExecutable();
22
+ $imagick_active = self::isImagickAvailable();
23
+ }
24
 
25
  return array('av' => true, 'gs' => $gs_active,
26
  'imagick' => $imagick_active, 'google' => false);
34
  * @return str URL to the thumbnail.
35
  */
36
  public static function getThumbnail($ID, $pg = 1) {
37
+ static $start = null;
38
+ if (is_null($start)) {
39
+ $start = time();
40
  }
41
 
42
  $options = self::getOptions();
43
 
44
  // if we haven't saved a thumb, generate one
45
+ if (empty($options['thumbs'][$ID])) {
46
+ // prevent page timing out or user waiting too long for page
47
+ if ((time() - $start) > $options['timeout']) {
48
  return self::getDefaultThumbnail($ID, $pg);
49
  }
50
 
54
  foreach (self::getThumbers() as $ext_preg => $thumber) {
55
  $ext_preg = '!\.(' . $ext_preg . ')$!i';
56
 
57
+ if (preg_match($ext_preg, $file)) {
58
+ if (DG_Logger::logEnabled()) {
59
+ $toLog = sprintf(__('Attempting to generate thumbnail for attachment #%d with (%s)',
60
+ 'document-gallery'), $ID, is_array($thumber) ? implode('::',$thumber) : print_r($thumber, true));
61
+ DG_Logger::writeLog(DG_LogLevel::Detail, $toLog);
62
+ }
63
+
64
+ if ($thumb = self::getThumbnailTemplate($thumber, $ID, $pg)) {
65
+ $options['thumbs'][$ID] = array(
66
+ 'timestamp' => time(),
67
+ 'thumb_url' => $thumb['url'],
68
+ 'thumb_path' => $thumb['path'],
69
+ 'thumber' => $thumber
70
+ );
71
+ self::setOptions($options);
72
+ break;
73
+ }
74
  }
75
  }
76
  }
77
 
78
+ $new = empty($options['thumbs'][$ID]);
79
+ if ($new || empty($options['thumbs'][$ID]['thumber'])) {
80
+ if ($new) {
81
+ $options['thumbs'][$ID] = array('timestamp' => time());
82
  self::setOptions($options);
83
  }
84
 
135
  $temp_file = self::getTempFile($ext);
136
 
137
  if (!$fp = @fopen($temp_file, 'wb')) {
138
+ DG_Logger::writeLog(DG_LogLevel::Error, __('Could not open file: ', 'document-gallery') . $temp_file);
139
  return false;
140
  }
141
 
142
  if (!@fwrite($fp, $metadata['image']['data'])) {
143
+ DG_Logger::writeLog(DG_LogLevel::Error, __('Could not write file: ', 'document-gallery') . $temp_file);
144
  fclose($fp);
145
  return false;
146
  }
175
  $img = new DG_Image_Editor_Imagick($doc_path, $pg - 1);
176
  $err = $img->load();
177
  if(is_wp_error($err)) {
178
+ DG_Logger::writeLog(
179
+ DG_LogLevel::Error,
180
+ __('Failed to open file in Imagick: ', 'document-gallery') .
181
+ $err->get_error_message());
182
  return false;
183
  }
184
 
186
 
187
  $err = $img->save($temp_file, 'image/png');
188
  if (is_wp_error($err)) {
189
+ DG_Logger::writeLog(
190
+ DG_LogLevel::Error,
191
+ __('Failed to save image in Imagick: ', 'document-gallery') .
192
+ $err->get_error_message());
193
  return false;
194
  }
195
 
246
  exec(sprintf($gs, $pg, $pg, $temp_path, $doc_path), $out, $ret);
247
 
248
  if ($ret != 0) {
249
+ DG_Logger::writeLog(DG_LogLevel::Error, __('Ghostscript failed: ', 'document-gallery') . print_r($out));
250
  @unlink($temp_path);
251
  return false;
252
  }
375
  );
376
 
377
  // prevent PHP timeout before HTTP completes
378
+ @set_time_limit($timeout);
379
 
380
  $options = self::getOptions();
381
  $google_viewer = sprintf($google_viewer, urlencode($doc_url), (int)$pg, $options['width']);
384
  $response = wp_remote_get($google_viewer, $args);
385
 
386
  if (is_wp_error($response) || !preg_match('/[23][0-9]{2}/', $response['response']['code'])) {
387
+ DG_Logger::writeLog(DG_LogLevel::Warning, __('Failed to retrieve thumbnail from Google: ', 'document-gallery') .
388
  (is_wp_error($response)
389
  ? $response->get_error_message()
390
  : $response['response']['message']));
548
  /**
549
  * Key: Attachment ID
550
  * Val: array
551
+ * + timestamp - When the thumbnail was generated (or generation failed).
552
  * + thumb_path - System path to thumbnail image.
553
  * + thumb_url - URL pointing to the thumbnail for this document.
554
  * + thumber - Generator used to create thumb OR false if failed to gen.
562
  /**
563
  * Key: Attachment ID
564
  * Val: array
565
+ * + timestamp - When the thumbnail was generated (or generation failed).
566
  * + thumb_path - System path to thumbnail image.
567
  * + thumb_url - URL pointing to the thumbnail for this document.
568
  * + thumber - Generator used to create thumb OR false if failed to gen.
626
  $thumbers = array_filter($thumbers, 'is_callable');
627
 
628
  // log which thumbers are being used
629
+ if (DG_Logger::logEnabled()) {
630
  if (count($thumbers) > 0) {
631
  $entry = __('Thumbnail Generators: ', 'document-gallery');
632
  foreach ($thumbers as $k => $v) {
633
+ $thumber = is_array($v) ? implode('::', $v) : print_r($v, true);
634
+
635
+ // TODO: The following works for all internal regexes, but may have unpredictable
636
+ // results if developer adds additional thumbnail generators using different regexes
637
+ $filetypes = str_replace('|', ', ', $k);
638
+
639
+ $entry .= PHP_EOL . "$thumber: $filetypes";
640
  }
641
  } else {
642
  $entry = __('No thumbnail generators enabled.', 'document-gallery');
643
  }
644
+ DG_Logger::writeLog(DG_LogLevel::Detail, $entry);
645
  }
646
  }
647
 
680
  $img = wp_get_image_editor($temp_path);
681
 
682
  if (is_wp_error($img)) {
683
+ DG_Logger::writeLog(
684
+ DG_LogLevel::Error,
685
+ __('Failed to get image editor: ', 'document-gallery') .
686
+ $img->get_error_message());
687
  return false;
688
  }
689
 
692
  $err = $img->save($thumb_path);
693
 
694
  if (is_wp_error($err)) {
695
+ DG_Logger::writeLog(
696
+ DG_LogLevel::Error,
697
+ __('Failed to save image: ', 'document-gallery') .
698
+ $err->get_error_message());
699
  return false;
700
  }
701
 
739
  }
740
 
741
  /**
742
+ * Removes the existing thumbnail/document meta for the attachment(s)
743
+ * with the ID(s), if such a thumbnails exists.
744
  *
745
+ * @param int|array $ids
746
  */
747
+ public static function deleteThumbMeta($ids) {
748
  $options = self::getOptions();
749
+ $modified = false;
750
 
751
+ foreach ((array)$ids as $id) {
752
+ if (isset($options['thumbs'][$id])) {
753
+ if (isset($options['thumbs'][$id]['thumber'])) {
754
+ @unlink($options['thumbs'][$id]['thumb_path']);
755
+ }
756
 
757
+ unset($options['thumbs'][$id]);
758
+ $modified = true;
759
+ }
760
  }
761
+
762
+ if ($modified) { self::setOptions($options); }
763
  }
764
 
765
  /**
languages/document-gallery-es_ES.mo CHANGED
Binary file
languages/document-gallery-es_ES.po CHANGED
@@ -8,10 +8,10 @@ msgstr ""
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-04-20 21:59-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
 
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-09-12 19:47-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.9\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "Language: es\n"
17
 
languages/document-gallery-fr_FR.mo ADDED
Binary file
languages/document-gallery-fr_FR.po ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-09-12 19:47-0600\n"
12
+ "Last-Translator: Marc LIOTARD <tech@trafic-influence.com>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "X-Generator: Poedit 1.6.9\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "Language: fr\n"
17
+
18
+ #: admin/class-admin.php:27
19
+ msgid "Settings"
20
+ msgstr "Configuration"
21
+
22
+ #: admin/class-admin.php:37
23
+ msgid "Document Gallery Settings"
24
+ msgstr "Configuration 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 "Configuration par défaut"
34
+
35
+ #: admin/class-admin.php:71
36
+ msgid "Thumbnail Generation"
37
+ msgstr "Génération de miniatures"
38
+
39
+ #: admin/class-admin.php:75
40
+ msgid "Custom CSS"
41
+ msgstr "CSS personnalisé"
42
+
43
+ #: admin/class-admin.php:79
44
+ msgid "Advanced Thumbnail Generation"
45
+ msgstr "Génération avancée de miniatures "
46
+
47
+ #: admin/class-admin.php:91
48
+ msgid "Link to attachment page rather than to file"
49
+ msgstr "Faire un lien vers la page du média plutôt que vers le fichier"
50
+
51
+ #: admin/class-admin.php:103
52
+ msgid "Include document descriptions"
53
+ msgstr "Inclure la description du document"
54
+
55
+ #: admin/class-admin.php:115
56
+ msgid "Use auto-generated document thumbnails"
57
+ msgstr "Utiliser les miniatures du document générées automatiquement"
58
+
59
+ #: admin/class-admin.php:127
60
+ msgid "Include image attachments in gallery"
61
+ msgstr "Inclure les images dans la galerie"
62
+
63
+ #: admin/class-admin.php:139
64
+ msgid "Only look for attachments in post where [dg] is used"
65
+ msgstr ""
66
+ "Chercher uniquement les médias attachés à l'article où [dg] est utilisé"
67
+
68
+ #: admin/class-admin.php:152
69
+ msgid "Ascending or descending sorting of documents"
70
+ msgstr "Classement ascendant ou descendant des documents"
71
+
72
+ #: admin/class-admin.php:165
73
+ msgid "Which field to order documents by"
74
+ msgstr "Champ par lequel classer les documents"
75
+
76
+ #: admin/class-admin.php:178
77
+ msgid ""
78
+ "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
79
+ msgstr ""
80
+ "Permet de définir si les documents qui coïncident doivent avoir toutes les "
81
+ "taxa_names (AND) ou au moins une (OR)"
82
+
83
+ #: admin/class-admin.php:190
84
+ msgid "Locally generate thumbnails for audio & video files."
85
+ msgstr ""
86
+ "Générer localement les miniatures pour les médias de type audio et vidéo."
87
+
88
+ #: admin/class-admin.php:203
89
+ msgid ""
90
+ "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
91
+ "a> for faster local PDF processing (compared to Imagick)."
92
+ msgstr ""
93
+ "Utiliser <a href=\"http://www.ghostscript.com/\" target=\"_blank"
94
+ "\">Ghostscript</a> pour accélérer le processus de PDF localement (en "
95
+ "comparaison avec Imagick)."
96
+
97
+ #: admin/class-admin.php:204
98
+ msgid ""
99
+ "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
100
+ "target=\"_blank\">Ghostscript</a>."
101
+ msgstr ""
102
+ "Votre serveur n'est pas configuré pour exécuter <a href=\"http://www."
103
+ "ghostscript.com/\" target=\"_blank\">Ghostscript</a>."
104
+
105
+ #: admin/class-admin.php:218
106
+ msgid ""
107
+ "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
108
+ "\">Imagick</a> to handle lots of filetypes locally."
109
+ msgstr ""
110
+ "Utiliser <a href=\"http://www.php.net/manual/es/book.imagick.php\" target="
111
+ "\"_blank\">Imagick</a> pour gérer la majeure partie des types de fichier "
112
+ "localement."
113
+
114
+ #: admin/class-admin.php:219
115
+ msgid ""
116
+ "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
117
+ "book.imagick.php\" target=\"_blank\">Imagick</a>."
118
+ msgstr ""
119
+ "Votre serveur n'est pas configuré pour exécuter <a href=\"http://www.php.net/"
120
+ "manual/es/book.imagick.php\" target=\"_blank\">Imagick</a>."
121
+
122
+ #: admin/class-admin.php:233
123
+ msgid ""
124
+ "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
125
+ "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
126
+ "file types remotely."
127
+ msgstr ""
128
+ "Utiliser <a href=\"https://drive.google.com/viewer\" target=\"_blank"
129
+ "\">Google Drive Viewer</a> pour générer les miniatures des fichiers MS "
130
+ "Office et autres types de fichiers."
131
+
132
+ #: admin/class-admin.php:234
133
+ msgid "Your server does not allow remote HTTP access."
134
+ msgstr ""
135
+ "Votre serveur n'est pas configuré pour gérer les accès HTTP à distance."
136
+
137
+ #: admin/class-admin.php:248
138
+ msgid "Successfully auto-detected the location of Ghostscript."
139
+ msgstr "Le répertoire de GhostScript a été localisé avec succès."
140
+
141
+ #: admin/class-admin.php:249
142
+ msgid "Failed to auto-detect the location of Ghostscript."
143
+ msgstr "La tentative de localisation du répertoire de GhostScript a échoué."
144
+
145
+ #: admin/class-admin.php:257
146
+ msgid ""
147
+ "The following values will be used by default in the shortcode. You can still "
148
+ "manually set each of these values in each individual shortcode."
149
+ msgstr ""
150
+ "Les valeurs suivantes seront utilisées par défaut dans le shortcode [dg]. "
151
+ "Vous pouvez néanmoins paramétrer manuellement ces valeurs pour chaque "
152
+ "shortcode individuel."
153
+
154
+ #: admin/class-admin.php:264
155
+ msgid "Select which tools to use when generating thumbnails."
156
+ msgstr "Choisir les outils utilisés pour la génération des miniatures."
157
+
158
+ #: admin/class-admin.php:270
159
+ msgid ""
160
+ "Enter custom CSS styling for use with document galleries. To see which ids "
161
+ "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
162
+ "\">style.css</a>."
163
+ msgstr ""
164
+ "Saisissez CSS personalizado para su uso con galerías de documentos. Para ver "
165
+ "los identificadores de clases de estilo, vea <a href=\"%s\" target=\"_blank"
166
+ "\">style.css</a>."
167
+
168
+ #: admin/class-admin.php:288
169
+ msgid ""
170
+ "Unless you <em>really</em> know what you're doing, you should not touch "
171
+ "these values."
172
+ msgstr ""
173
+ "A moins de <em>vraiment</em> savoir ce que vous faites, vous ne devriez pas "
174
+ "modifier cette valeur."
175
+
176
+ #: admin/class-admin.php:290
177
+ msgid ""
178
+ "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
179
+ msgstr ""
180
+ "NOTE : <code>exec()</code> n'est pas accessible. Ghostscript ne fonctionnera "
181
+ "pas."
182
+
183
+ #: admin/class-admin.php:387
184
+ msgid "Failed to update CSS file."
185
+ msgstr "Échec de l'enregistrement du fichier CSS."
186
+
187
+ #: admin/class-admin.php:398
188
+ msgid "Invalid Ghostscript path given: "
189
+ msgstr "Chemin de GhostScript invalide :"
190
+
191
+ #: inc/class-gallery.php:88
192
+ msgid "Generated using Document Gallery. Get yours here: "
193
+ msgstr "Génération réalisée avec Document Gallery. Obtenez votre version ici :"
194
+
195
+ #: inc/class-gallery.php:91
196
+ msgid "No attachments to display. How boring! :("
197
+ msgstr "Aucun média à afficher... Quel ennui ! :("
198
+
199
+ #: inc/class-gallery.php:92
200
+ msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
201
+ msgstr ""
202
+ "Le paramètre %s ne peut être que \"%s\" ou \"%s.\" Vous avez saisi \"%s.\""
203
+
204
+ #: inc/class-gallery.php:263
205
+ msgid "The following ID is invalid: "
206
+ msgid_plural "The following IDs are invalid: "
207
+ msgstr[0] "L'ID suivant est invalide :"
208
+ msgstr[1] "Les ID suivants sont invalides :"
209
+
210
+ #: inc/class-gallery.php:329
211
+ msgid "The orderby value entered, \"%s,\" is not valid."
212
+ msgstr "La valeur orderby saisie, \"%s,\" est invalide."
213
+
214
+ #: inc/class-gallery.php:438
215
+ msgid "The following attributes are invalid: "
216
+ msgstr "Les attributs suivants sont invalides :"
217
+
218
+ #: inc/class-gallery.php:488
219
+ msgid "%s is not a valid term name in %s."
220
+ msgstr "%s n'est pas un terme valide dans %s."
221
+
222
+ #: inc/class-thumber.php:131
223
+ msgid "Could not open file: "
224
+ msgstr "Impossible d'ouvrir le fichier :"
225
+
226
+ #: inc/class-thumber.php:136
227
+ msgid "Could not write file: "
228
+ msgstr "Impossible d'écrire dans le fichier :"
229
+
230
+ #: inc/class-thumber.php:174
231
+ msgid "Failed to open file in Imagick: "
232
+ msgstr "Échec de l'ouverture du fichier dans Imagick:"
233
+
234
+ #: inc/class-thumber.php:184
235
+ msgid "Failed to save image in Imagick: "
236
+ msgstr "Échec de l'enregistrement de l'image dans Imagick:"
237
+
238
+ #: inc/class-thumber.php:244
239
+ msgid "Ghostscript failed: "
240
+ msgstr "Échec Ghostscript :"
241
+
242
+ #: inc/class-thumber.php:357
243
+ msgid "Failed to retrieve thumbnail from Google: "
244
+ msgstr "Échec de l'obtention de la miniature depuis Google :"
245
+
246
+ #: inc/class-thumber.php:644
247
+ msgid "Failed to get image editor: "
248
+ msgstr "Échec de l'obtention de l'éditeur d'image :"
249
+
250
+ #: inc/class-thumber.php:655
251
+ msgid "Failed to save image: "
252
+ msgstr "Échec de la sauvegarde de l'image :"
253
+
254
+ #. Description of the plugin/theme
255
+ msgid ""
256
+ "Display non-images (and images) in gallery format on a page or post with the "
257
+ "[dg] shortcode."
258
+ msgstr ""
259
+ "Affiche les fichiers non-images (et aussi les images) en format gallerie "
260
+ "dans une page ou un article grâce au shortcode [dg]."
261
+
262
+ #. Author of the plugin/theme
263
+ msgid "Dan Rossiter"
264
+ msgstr "Dan Rossiter"
265
+
266
+ #. Author URI of the plugin/theme
267
+ msgid "http://danrossiter.org/"
268
+ msgstr "http://danrossiter.org/"
languages/document-gallery-ru_RU.mo CHANGED
Binary file
languages/document-gallery-ru_RU.po CHANGED
@@ -2,89 +2,102 @@
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.9\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
- "POT-Creation-Date: 2014-04-21 02:57:10+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-04-21 17:59-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: ru\n"
 
17
 
18
- #: admin/class-admin.php:27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  msgid "Settings"
20
  msgstr "Настройки"
21
 
22
- #: admin/class-admin.php:37
23
  msgid "Document Gallery Settings"
24
  msgstr "Настройки 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:58
32
  msgid "Default Settings"
33
- msgstr "Настройки По Умолчанию"
34
 
35
- #: admin/class-admin.php:62
36
  msgid "Thumbnail Generation"
37
- msgstr "Создание Миниатюр"
38
 
39
- #: admin/class-admin.php:66
40
  msgid "Custom CSS"
41
  msgstr "Индивидуальные CSS"
42
 
43
- #: admin/class-admin.php:70
44
- msgid "Advanced Thumbnail Generation"
45
- msgstr "Настройки Создания Миниатюр для Опытных Пользователей"
46
-
47
- #: admin/class-admin.php:82
48
  msgid "Link to attachment page rather than to file"
49
  msgstr "Ссылка на страницу вложения, а не на сам файл"
50
 
51
- #: admin/class-admin.php:94
52
  msgid "Include document descriptions"
53
  msgstr "Включать описания документов"
54
 
55
- #: admin/class-admin.php:106
56
  msgid "Use auto-generated document thumbnails"
57
  msgstr "Использовать автоматически создаваемые миниатюры документов"
58
 
59
- #: admin/class-admin.php:118
60
  msgid "Include image attachments in gallery"
61
  msgstr "Включать прикрепленные к посту картинки в галерею"
62
 
63
- #: admin/class-admin.php:130
64
  msgid "Only look for attachments in post where [dg] is used"
65
  msgstr "Искать вложения только в постах, где используется [dg]"
66
 
67
- #: admin/class-admin.php:143
68
  msgid "Ascending or descending sorting of documents"
69
  msgstr "Сортировка документов по возрастанию или по убыванию"
70
 
71
- #: admin/class-admin.php:156
72
  msgid "Which field to order documents by"
73
  msgstr "По какому полю сортировать документы"
74
 
75
- #: admin/class-admin.php:169
76
  msgid ""
77
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
78
  msgstr ""
79
  "Искать документы, принадлежащие всем категориям (AND) перечисленным в "
80
- "параметре category, также возмозжно использование taxon_name, или хотя бы "
81
  "одной (OR)"
82
 
83
- #: admin/class-admin.php:181
84
  msgid "Locally generate thumbnails for audio & video files."
85
  msgstr "Локально создавать миниатюры для аудио и видео файлов."
86
 
87
- #: admin/class-admin.php:194
88
  msgid ""
89
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
90
  "a> for faster local PDF processing (compared to Imagick)."
@@ -93,7 +106,7 @@ msgstr ""
93
  "\">Ghostscript</a> для более быстрой локальной обработки PDF (в сравнении с "
94
  "Imagick)."
95
 
96
- #: admin/class-admin.php:195
97
  msgid ""
98
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
99
  "target=\"_blank\">Ghostscript</a>."
@@ -101,7 +114,7 @@ msgstr ""
101
  "Ваш сервер не настроен для использования <a href=\"http://www.ghostscript."
102
  "com/\" target=\"_blank\">Ghostscript</a>."
103
 
104
- #: admin/class-admin.php:209
105
  msgid ""
106
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
107
  "\">Imagick</a> to handle lots of filetypes locally."
@@ -109,7 +122,7 @@ msgstr ""
109
  "Использовать <a href=\"http://www.php.net/manual/ru/book.imagick.php\" "
110
  "target=\"_blank\">Imagick</a> для локальной обработки множества типов файлов."
111
 
112
- #: admin/class-admin.php:210
113
  msgid ""
114
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
115
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
@@ -117,7 +130,7 @@ msgstr ""
117
  "Ваш сервер не настроен для использования <a href=\"http://www.php.net/manual/"
118
  "ru/book.imagick.php\" target=\"_blank\">Imagick</a>."
119
 
120
- #: admin/class-admin.php:224
121
  msgid ""
122
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
123
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
@@ -127,19 +140,79 @@ msgstr ""
127
  "\">Google Drive Viewer</a> для создания миниатюр файлов MS Office и многих "
128
  "других типов файлов удалённо."
129
 
130
- #: admin/class-admin.php:225
131
  msgid "Your server does not allow remote HTTP access."
132
  msgstr "Ваш сервер не разрешает удаленные HTTP обращения."
133
 
134
- #: admin/class-admin.php:239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  msgid "Successfully auto-detected the location of Ghostscript."
136
  msgstr "Успешно автоматически определено местонахождение Ghostscript."
137
 
138
- #: admin/class-admin.php:240
139
  msgid "Failed to auto-detect the location of Ghostscript."
140
  msgstr "Не удалось автоматически определить местонахождение Ghostscript."
141
 
142
- #: admin/class-admin.php:248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  msgid ""
144
  "The following values will be used by default in the shortcode. You can still "
145
  "manually set each of these values in each individual shortcode."
@@ -148,11 +221,12 @@ msgstr ""
148
  "этом вручную можно установить любые из этих значений в каждом конкретном "
149
  "экземпляре шорткода."
150
 
151
- #: admin/class-admin.php:255
152
  msgid "Select which tools to use when generating thumbnails."
153
  msgstr "Выберите, какие инструменты использовать для создании миниатюр."
154
 
155
- #: admin/class-admin.php:261
 
156
  msgid ""
157
  "Enter custom CSS styling for use with document galleries. To see which ids "
158
  "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
@@ -162,7 +236,7 @@ msgstr ""
162
  "Чтобы увидеть, какие селекторы стоит использовать, посмотрите на <a href=\"%s"
163
  "\" target=\"_blank\">style.css</a>."
164
 
165
- #: admin/class-admin.php:279
166
  msgid ""
167
  "Unless you <em>really</em> know what you're doing, you should not touch "
168
  "these values."
@@ -170,43 +244,120 @@ msgstr ""
170
  "Не стоит менять этих значений, за исключением случаев когда Вы "
171
  "<em>действительно</em> знаете что делаете."
172
 
173
- #: admin/class-admin.php:281
174
  msgid ""
175
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
176
  msgstr ""
177
  "ВНИМАНИЕ: <code>exec()</code> недоступный. Ghostscript не будет работать."
178
 
179
- #: admin/class-admin.php:388
180
- msgid "Invalid Ghostscript path given: "
181
- msgstr "Задан неверный путь Ghostscript: "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- #: inc/class-gallery.php:92
 
 
 
 
184
  msgid "Generated using Document Gallery. Get yours here: "
185
  msgstr ""
186
  "Сгенерировано используя Document Gallery. Понравилось? Получите Вашу копию "
187
  "здесь: "
188
 
189
- #: inc/class-gallery.php:95
190
  msgid "No attachments to display. How boring! :("
191
  msgstr "Ни одного вложения для отображения. Скукотища! :("
192
 
193
- #: inc/class-gallery.php:96
 
194
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
195
  msgstr ""
196
  "Параметр %s может принимать только значения \"%s\" или \"%s.\" Вы же ввели "
197
  "\"%s.\""
198
 
199
- #: inc/class-gallery.php:267
200
  msgid "The following ID is invalid: "
201
  msgid_plural "The following IDs are invalid: "
202
  msgstr[0] "Следующий идентификатор (ID) недействительный: "
203
  msgstr[1] "Следующие идентификаторы (IDs) недействительны: "
 
204
 
205
- #: inc/class-gallery.php:333
 
206
  msgid "The orderby value entered, \"%s,\" is not valid."
207
  msgstr "Указанное значение параметра orderby, \"%s,\" недопустимо."
208
 
209
- #: inc/class-gallery.php:475
 
210
  msgid "%s is not a valid term name in %s."
211
  msgstr "Определение %s не является допустимым значением параметра %s."
212
 
@@ -214,36 +365,49 @@ msgstr "Определение %s не является допустимым з
214
  msgid "Failed to set Imagick page number"
215
  msgstr "Не удалось установить номер страницы в Imagick"
216
 
217
- #: inc/class-thumber.php:125
 
 
 
 
 
218
  msgid "Could not open file: "
219
  msgstr "Не удалось открыть файл: "
220
 
221
- #: inc/class-thumber.php:130
222
  msgid "Could not write file: "
223
  msgstr "Не удалось записать файл: "
224
 
225
- #: inc/class-thumber.php:166
226
  msgid "Failed to open file in Imagick: "
227
  msgstr "Не удалось открыть файл в Imagick: "
228
 
229
- #: inc/class-thumber.php:176
230
  msgid "Failed to save image in Imagick: "
231
  msgstr "Не удалось сохранить изображение в Imagick: "
232
 
233
- #: inc/class-thumber.php:234
234
  msgid "Ghostscript failed: "
235
  msgstr "Сбой в Ghostscript: "
236
 
237
- #: inc/class-thumber.php:364
238
  msgid "Failed to retrieve thumbnail from Google: "
239
  msgstr "Не удалось получить от Google миниатюру: "
240
 
241
- #: inc/class-thumber.php:644
 
 
 
 
 
 
 
 
242
  msgid "Failed to get image editor: "
243
  msgstr ""
244
  "Сбой при попытке использовании графического редактора (WP_Image_Editor): "
245
 
246
- #: inc/class-thumber.php:655
247
  msgid "Failed to save image: "
248
  msgstr "Не удалось сохранить изображение: "
249
 
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.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
+ "POT-Creation-Date: 2014-09-04 02:15:50+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-09-12 19:42-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.9\n"
15
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
16
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
17
+ "Language: ru_RU\n"
18
 
19
+ #: admin/class-admin.php:28
20
+ msgid "General"
21
+ msgstr "Основные"
22
+
23
+ #: admin/class-admin.php:29
24
+ msgid "Thumbnail Management"
25
+ msgstr "Управление миниатюрами"
26
+
27
+ #: admin/class-admin.php:30
28
+ msgid "Logging"
29
+ msgstr "Журнал событий"
30
+
31
+ #: admin/class-admin.php:31
32
+ msgid "Advanced"
33
+ msgstr "Для опытных пользователей"
34
+
35
+ #: admin/class-admin.php:68
36
  msgid "Settings"
37
  msgstr "Настройки"
38
 
39
+ #: admin/class-admin.php:78
40
  msgid "Document Gallery Settings"
41
  msgstr "Настройки Document Gallery"
42
 
43
  #. Plugin Name of the plugin/theme
44
+ #: admin/class-admin.php:79
45
  msgid "Document Gallery"
46
  msgstr "Document Gallery"
47
 
48
+ #: admin/class-admin.php:124
49
  msgid "Default Settings"
50
+ msgstr "Настройки по умолчанию"
51
 
52
+ #: admin/class-admin.php:128
53
  msgid "Thumbnail Generation"
54
+ msgstr "Создание миниатюр"
55
 
56
+ #: admin/class-admin.php:132
57
  msgid "Custom CSS"
58
  msgstr "Индивидуальные CSS"
59
 
60
+ #: admin/class-admin.php:144
 
 
 
 
61
  msgid "Link to attachment page rather than to file"
62
  msgstr "Ссылка на страницу вложения, а не на сам файл"
63
 
64
+ #: admin/class-admin.php:156
65
  msgid "Include document descriptions"
66
  msgstr "Включать описания документов"
67
 
68
+ #: admin/class-admin.php:168
69
  msgid "Use auto-generated document thumbnails"
70
  msgstr "Использовать автоматически создаваемые миниатюры документов"
71
 
72
+ #: admin/class-admin.php:180
73
  msgid "Include image attachments in gallery"
74
  msgstr "Включать прикрепленные к посту картинки в галерею"
75
 
76
+ #: admin/class-admin.php:192
77
  msgid "Only look for attachments in post where [dg] is used"
78
  msgstr "Искать вложения только в постах, где используется [dg]"
79
 
80
+ #: admin/class-admin.php:205
81
  msgid "Ascending or descending sorting of documents"
82
  msgstr "Сортировка документов по возрастанию или по убыванию"
83
 
84
+ #: admin/class-admin.php:218
85
  msgid "Which field to order documents by"
86
  msgstr "По какому полю сортировать документы"
87
 
88
+ #: admin/class-admin.php:231
89
  msgid ""
90
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
91
  msgstr ""
92
  "Искать документы, принадлежащие всем категориям (AND) перечисленным в "
93
+ "параметре category, также возможно использование taxon_name, или хотя бы "
94
  "одной (OR)"
95
 
96
+ #: admin/class-admin.php:243
97
  msgid "Locally generate thumbnails for audio & video files."
98
  msgstr "Локально создавать миниатюры для аудио и видео файлов."
99
 
100
+ #: admin/class-admin.php:256
101
  msgid ""
102
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
103
  "a> for faster local PDF processing (compared to Imagick)."
106
  "\">Ghostscript</a> для более быстрой локальной обработки PDF (в сравнении с "
107
  "Imagick)."
108
 
109
+ #: admin/class-admin.php:257
110
  msgid ""
111
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
112
  "target=\"_blank\">Ghostscript</a>."
114
  "Ваш сервер не настроен для использования <a href=\"http://www.ghostscript."
115
  "com/\" target=\"_blank\">Ghostscript</a>."
116
 
117
+ #: admin/class-admin.php:271
118
  msgid ""
119
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
120
  "\">Imagick</a> to handle lots of filetypes locally."
122
  "Использовать <a href=\"http://www.php.net/manual/ru/book.imagick.php\" "
123
  "target=\"_blank\">Imagick</a> для локальной обработки множества типов файлов."
124
 
125
+ #: admin/class-admin.php:272
126
  msgid ""
127
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
128
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
130
  "Ваш сервер не настроен для использования <a href=\"http://www.php.net/manual/"
131
  "ru/book.imagick.php\" target=\"_blank\">Imagick</a>."
132
 
133
+ #: admin/class-admin.php:286
134
  msgid ""
135
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
136
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
140
  "\">Google Drive Viewer</a> для создания миниатюр файлов MS Office и многих "
141
  "других типов файлов удалённо."
142
 
143
+ #: admin/class-admin.php:287
144
  msgid "Your server does not allow remote HTTP access."
145
  msgstr "Ваш сервер не разрешает удаленные HTTP обращения."
146
 
147
+ #: admin/class-admin.php:309
148
+ msgid "The max width and height (in pixels) that thumbnails will be generated."
149
+ msgstr ""
150
+ "Максимальная ширина и высота (в пикселях) с которыми будут создаваться "
151
+ "миниатюры."
152
+
153
+ #: admin/class-admin.php:336
154
+ msgid "Advanced Thumbnail Generation"
155
+ msgstr "Создание миниатюр"
156
+
157
+ #: admin/class-admin.php:348
158
+ msgid "Whether to log debug and error information related to Document Gallery."
159
+ msgstr ""
160
+ "Вести ли журнал отладки и информации об ошибках имеющих отношение к Document "
161
+ "Gallery."
162
+
163
+ #: admin/class-admin.php:360
164
+ msgid ""
165
+ "Whether option structure should be validated before save. This is not "
166
+ "generally necessary."
167
+ msgstr ""
168
+ "Проверять ли структуру выбранных настроек при сохранении. Как правило в этом "
169
+ "нет необходимости."
170
+
171
+ #: admin/class-admin.php:373
172
+ msgid ""
173
+ "Max number of seconds to wait for thumbnail generation before defaulting to "
174
+ "filetype icons."
175
+ msgstr ""
176
+ "Максимальное количество секунд ожидания при создании миниатюры до "
177
+ "использования иконки по умолчанию."
178
+
179
+ #: admin/class-admin.php:374
180
+ msgid ""
181
+ "Note that generation will continue where timeout happened next time the "
182
+ "gallery is loaded."
183
+ msgstr ""
184
+ "Обратите внимание, что создание продолжится с того места, где оно было "
185
+ "приостановлено, при следующем обращении к галереи."
186
+
187
+ #: admin/class-admin.php:386
188
  msgid "Successfully auto-detected the location of Ghostscript."
189
  msgstr "Успешно автоматически определено местонахождение Ghostscript."
190
 
191
+ #: admin/class-admin.php:387
192
  msgid "Failed to auto-detect the location of Ghostscript."
193
  msgstr "Не удалось автоматически определить местонахождение Ghostscript."
194
 
195
+ #: admin/class-admin.php:391
196
+ msgid "Options Array Dump"
197
+ msgstr "Дамп массива установленных настроек"
198
+
199
+ #: admin/class-admin.php:438
200
+ msgid "Invalid width given: "
201
+ msgstr "Задана неверная ширина: "
202
+
203
+ #: admin/class-admin.php:451
204
+ msgid "Invalid height given: "
205
+ msgstr "Задана неверная высота: "
206
+
207
+ #: admin/class-admin.php:562
208
+ msgid "Invalid Ghostscript path given: "
209
+ msgstr "Задан неверный путь Ghostscript: "
210
+
211
+ #: admin/class-admin.php:573
212
+ msgid "Invalid timeout given: "
213
+ msgstr "Задано неверное время ожидания: "
214
+
215
+ #: admin/class-admin.php:604
216
  msgid ""
217
  "The following values will be used by default in the shortcode. You can still "
218
  "manually set each of these values in each individual shortcode."
221
  "этом вручную можно установить любые из этих значений в каждом конкретном "
222
  "экземпляре шорткода."
223
 
224
+ #: admin/class-admin.php:611
225
  msgid "Select which tools to use when generating thumbnails."
226
  msgstr "Выберите, какие инструменты использовать для создании миниатюр."
227
 
228
+ #: admin/class-admin.php:620
229
+ #, c-format
230
  msgid ""
231
  "Enter custom CSS styling for use with document galleries. To see which ids "
232
  "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
236
  "Чтобы увидеть, какие селекторы стоит использовать, посмотрите на <a href=\"%s"
237
  "\" target=\"_blank\">style.css</a>."
238
 
239
+ #: admin/class-admin.php:640
240
  msgid ""
241
  "Unless you <em>really</em> know what you're doing, you should not touch "
242
  "these values."
244
  "Не стоит менять этих значений, за исключением случаев когда Вы "
245
  "<em>действительно</em> знаете что делаете."
246
 
247
+ #: admin/class-admin.php:643
248
  msgid ""
249
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
250
  msgstr ""
251
  "ВНИМАНИЕ: <code>exec()</code> недоступный. Ghostscript не будет работать."
252
 
253
+ #: admin/class-admin.php:654
254
+ msgid ""
255
+ "The following <em>readonly text</em> should be provided when <a href="
256
+ "\"http://wordpress.org/support/plugin/document-gallery\" target=\"_blank"
257
+ "\">reporting a bug</a>:"
258
+ msgstr ""
259
+ "Нижеследующий <em>доступный только для чтения текст</em> должен быть "
260
+ "предоставлен при <a href=\"http://wordpress.org/support/plugin/document-"
261
+ "gallery\" target=\"_blank\">сообщении об ошибке</a>:"
262
+
263
+ #: admin/class-admin.php:755
264
+ msgid "Select All"
265
+ msgstr "Выбрать всё"
266
+
267
+ #: admin/class-admin.php:758
268
+ msgid "Thumbnail"
269
+ msgstr "Миниатюра"
270
+
271
+ #: admin/class-admin.php:759
272
+ msgid "File name"
273
+ msgstr "Имя файла"
274
+
275
+ #: admin/class-admin.php:760
276
+ msgid "Date"
277
+ msgstr "Дата"
278
+
279
+ #: admin/class-admin.php:763
280
+ msgid "Delete Selected"
281
+ msgstr "Удалить выбранные"
282
+
283
+ #: admin/class-admin.php:765
284
+ msgid "item"
285
+ msgid_plural "items"
286
+ msgstr[0] "запись"
287
+ msgstr[1] "записи"
288
+ msgstr[2] "записей"
289
+
290
+ #: admin/class-admin.php:768
291
+ msgid "Go to the first page"
292
+ msgstr "Перейти к первой странице"
293
+
294
+ #: admin/class-admin.php:769
295
+ msgid "Go to the previous page"
296
+ msgstr "Перейти к предыдущей странице"
297
+
298
+ #: admin/class-admin.php:771
299
+ msgid "Current page"
300
+ msgstr "Текущая страница"
301
+
302
+ #: admin/class-admin.php:771
303
+ msgid "of"
304
+ msgstr "из"
305
+
306
+ #: admin/class-admin.php:772
307
+ msgid "Go to the next page"
308
+ msgstr "Перейти к следующей странице"
309
+
310
+ #: admin/class-admin.php:773
311
+ msgid "Go to the last page"
312
+ msgstr "Перейти к последней странице"
313
+
314
+ #: admin/class-admin.php:775
315
+ msgid "items per page"
316
+ msgstr "записей на странице"
317
+
318
+ #: admin/class-admin.php:808
319
+ msgid "View"
320
+ msgstr "Посмотреть страницу вложения"
321
+
322
+ #: admin/class-admin.php:809
323
+ msgid "attachment page"
324
+ msgstr ""
325
 
326
+ #: admin/class-admin.php:809
327
+ msgid "Attachment not found"
328
+ msgstr "Вложение не найдено"
329
+
330
+ #: inc/class-gallery.php:85
331
  msgid "Generated using Document Gallery. Get yours here: "
332
  msgstr ""
333
  "Сгенерировано используя Document Gallery. Понравилось? Получите Вашу копию "
334
  "здесь: "
335
 
336
+ #: inc/class-gallery.php:88
337
  msgid "No attachments to display. How boring! :("
338
  msgstr "Ни одного вложения для отображения. Скукотища! :("
339
 
340
+ #: inc/class-gallery.php:89
341
+ #, c-format
342
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
343
  msgstr ""
344
  "Параметр %s может принимать только значения \"%s\" или \"%s.\" Вы же ввели "
345
  "\"%s.\""
346
 
347
+ #: inc/class-gallery.php:285
348
  msgid "The following ID is invalid: "
349
  msgid_plural "The following IDs are invalid: "
350
  msgstr[0] "Следующий идентификатор (ID) недействительный: "
351
  msgstr[1] "Следующие идентификаторы (IDs) недействительны: "
352
+ msgstr[2] "Следующие идентификаторы (IDs) недействительны: "
353
 
354
+ #: inc/class-gallery.php:378
355
+ #, c-format
356
  msgid "The orderby value entered, \"%s,\" is not valid."
357
  msgstr "Указанное значение параметра orderby, \"%s,\" недопустимо."
358
 
359
+ #: inc/class-gallery.php:532
360
+ #, c-format
361
  msgid "%s is not a valid term name in %s."
362
  msgstr "Определение %s не является допустимым значением параметра %s."
363
 
365
  msgid "Failed to set Imagick page number"
366
  msgstr "Не удалось установить номер страницы в Imagick"
367
 
368
+ #: inc/class-thumber.php:59
369
+ #, c-format
370
+ msgid "Attempting to generate thumbnail for attachment #%d with '%s'"
371
+ msgstr "Попытка создания миниатюры для вложения №%d с помощью '%s'"
372
+
373
+ #: inc/class-thumber.php:138
374
  msgid "Could not open file: "
375
  msgstr "Не удалось открыть файл: "
376
 
377
+ #: inc/class-thumber.php:143
378
  msgid "Could not write file: "
379
  msgstr "Не удалось записать файл: "
380
 
381
+ #: inc/class-thumber.php:180
382
  msgid "Failed to open file in Imagick: "
383
  msgstr "Не удалось открыть файл в Imagick: "
384
 
385
+ #: inc/class-thumber.php:191
386
  msgid "Failed to save image in Imagick: "
387
  msgstr "Не удалось сохранить изображение в Imagick: "
388
 
389
+ #: inc/class-thumber.php:249
390
  msgid "Ghostscript failed: "
391
  msgstr "Сбой в Ghostscript: "
392
 
393
+ #: inc/class-thumber.php:387
394
  msgid "Failed to retrieve thumbnail from Google: "
395
  msgstr "Не удалось получить от Google миниатюру: "
396
 
397
+ #: inc/class-thumber.php:631
398
+ msgid "Thumbnail Generators: "
399
+ msgstr "Генераторы миниатюр: "
400
+
401
+ #: inc/class-thumber.php:636
402
+ msgid "No thumbnail generators enabled."
403
+ msgstr "Отсутствуют включенные генераторы миниатюр."
404
+
405
+ #: inc/class-thumber.php:679
406
  msgid "Failed to get image editor: "
407
  msgstr ""
408
  "Сбой при попытке использовании графического редактора (WP_Image_Editor): "
409
 
410
+ #: inc/class-thumber.php:691
411
  msgid "Failed to save image: "
412
  msgstr "Не удалось сохранить изображение: "
413
 
languages/document-gallery-sv_SE.mo ADDED
Binary file
languages/document-gallery-sv_SE.po ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
+ "POT-Creation-Date: 2014-09-04 02:15:50+00:00\n"
8
+ "PO-Revision-Date: 2014-09-12 19:44-0600\n"
9
+ "Last-Translator: P. E.\n"
10
+ "Language-Team: P. E.\n"
11
+ "Language: sv_SE\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Generator: Poedit 1.6.9\n"
17
+
18
+ #: admin/class-admin.php:28
19
+ msgid "General"
20
+ msgstr "Generellt"
21
+
22
+ #: admin/class-admin.php:29
23
+ msgid "Thumbnail Management"
24
+ msgstr "Miniatyrhantering"
25
+
26
+ #: admin/class-admin.php:30
27
+ msgid "Logging"
28
+ msgstr "Loggning"
29
+
30
+ #: admin/class-admin.php:31
31
+ msgid "Advanced"
32
+ msgstr "Avancerat"
33
+
34
+ #: admin/class-admin.php:68
35
+ msgid "Settings"
36
+ msgstr "Inställningar"
37
+
38
+ #: admin/class-admin.php:78
39
+ msgid "Document Gallery Settings"
40
+ msgstr "Document Gallery Inställningar"
41
+
42
+ #. Plugin Name of the plugin/theme
43
+ #: admin/class-admin.php:79
44
+ msgid "Document Gallery"
45
+ msgstr "Document Gallery"
46
+
47
+ #: admin/class-admin.php:124
48
+ msgid "Default Settings"
49
+ msgstr "Standardinställningar"
50
+
51
+ #: admin/class-admin.php:128
52
+ msgid "Thumbnail Generation"
53
+ msgstr "Miniatyrgenerering"
54
+
55
+ #: admin/class-admin.php:132
56
+ msgid "Custom CSS"
57
+ msgstr "Anpassad CSS"
58
+
59
+ #: admin/class-admin.php:144
60
+ msgid "Link to attachment page rather than to file"
61
+ msgstr "Länka till sida för bilaga istället för direkt till filen"
62
+
63
+ #: admin/class-admin.php:156
64
+ msgid "Include document descriptions"
65
+ msgstr "Ta med dokumentbeskrivningar"
66
+
67
+ #: admin/class-admin.php:168
68
+ msgid "Use auto-generated document thumbnails"
69
+ msgstr "Använd autogenererade dokumentminiatyrer"
70
+
71
+ #: admin/class-admin.php:180
72
+ msgid "Include image attachments in gallery"
73
+ msgstr "Ta med bildbilagor i galleriet"
74
+
75
+ #: admin/class-admin.php:192
76
+ msgid "Only look for attachments in post where [dg] is used"
77
+ msgstr "Sök endast efter bilagor i inlägg där kortkoden [dg] har använts"
78
+
79
+ #: admin/class-admin.php:205
80
+ msgid "Ascending or descending sorting of documents"
81
+ msgstr "Stigande eller fallande dokumentsortering"
82
+
83
+ #: admin/class-admin.php:218
84
+ msgid "Which field to order documents by"
85
+ msgstr "Det fält som dokumenten skall sorteras efter"
86
+
87
+ #: admin/class-admin.php:231
88
+ msgid ""
89
+ "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
90
+ msgstr ""
91
+ "Ifall matchade dokument måste ha alla taxa_names (AND) eller minst ett (OR)"
92
+
93
+ #: admin/class-admin.php:243
94
+ msgid "Locally generate thumbnails for audio & video files."
95
+ msgstr "Generera miniatyrer för audio- & videofiler lokalt."
96
+
97
+ #: admin/class-admin.php:256
98
+ msgid ""
99
+ "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
100
+ "a> for faster local PDF processing (compared to Imagick)."
101
+ msgstr ""
102
+ "Använd <a href=\"http://www.ghostscript.com/\" target=\"_blank"
103
+ "\">Ghostscript</a> för snabbare lokal PDF-behandling (jämfört med Imagick)."
104
+
105
+ #: admin/class-admin.php:257
106
+ msgid ""
107
+ "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
108
+ "target=\"_blank\">Ghostscript</a>."
109
+ msgstr ""
110
+ "Din server är inte konfigurerad att köra <a href=\"http://www.ghostscript."
111
+ "com/\" target=\"_blank\">Ghostscript</a>."
112
+
113
+ #: admin/class-admin.php:271
114
+ msgid ""
115
+ "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
116
+ "\">Imagick</a> to handle lots of filetypes locally."
117
+ msgstr ""
118
+ "Anänd <a href=\"http://www.php.net/manual/en/book.imagick.php\" target="
119
+ "\"_blank\">Imagick</a> för att hantera mängder av filtyper lokalt."
120
+
121
+ #: admin/class-admin.php:272
122
+ msgid ""
123
+ "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
124
+ "book.imagick.php\" target=\"_blank\">Imagick</a>."
125
+ msgstr ""
126
+ "Din server är inte konfigurerad att köra <a href=\"http://www.php.net/manual/"
127
+ "en/book.imagick.php\" target=\"_blank\">Imagick</a>."
128
+
129
+ #: admin/class-admin.php:286
130
+ msgid ""
131
+ "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
132
+ "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
133
+ "file types remotely."
134
+ msgstr ""
135
+ "Använd <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
136
+ "Drive Viewer</a> för att generera miniatyrer för MS Office-dokument samt "
137
+ "många andra filtyper externt."
138
+
139
+ #: admin/class-admin.php:287
140
+ msgid "Your server does not allow remote HTTP access."
141
+ msgstr "Din server tillåter inte externt HTTP-tillträde."
142
+
143
+ #: admin/class-admin.php:309
144
+ msgid "The max width and height (in pixels) that thumbnails will be generated."
145
+ msgstr "Max bredd och höjd (i pixlar) för genererade miniatyrer."
146
+
147
+ #: admin/class-admin.php:336
148
+ msgid "Advanced Thumbnail Generation"
149
+ msgstr "Avancerad Miniatyrgenerering"
150
+
151
+ #: admin/class-admin.php:348
152
+ msgid "Whether to log debug and error information related to Document Gallery."
153
+ msgstr ""
154
+ "Ifall debug- och felinformation relaterat till Document Gallery skall loggas."
155
+
156
+ #: admin/class-admin.php:360
157
+ msgid ""
158
+ "Whether option structure should be validated before save. This is not "
159
+ "generally necessary."
160
+ msgstr ""
161
+ "Ifall alternativstruktur skall valideras innan nedsparning. Detta är "
162
+ "generellt ej nödvändigt."
163
+
164
+ #: admin/class-admin.php:373
165
+ msgid ""
166
+ "Max number of seconds to wait for thumbnail generation before defaulting to "
167
+ "filetype icons."
168
+ msgstr ""
169
+ "Max antal sekunder att vänta på miniatyrgenerering innan standard "
170
+ "filtypsikoner används."
171
+
172
+ #: admin/class-admin.php:374
173
+ msgid ""
174
+ "Note that generation will continue where timeout happened next time the "
175
+ "gallery is loaded."
176
+ msgstr ""
177
+ "Notera att genereringen kommer att fortsätta därifrån den avbröts av "
178
+ "tidsgränsen nästa gång galleriet laddas."
179
+
180
+ #: admin/class-admin.php:386
181
+ msgid "Successfully auto-detected the location of Ghostscript."
182
+ msgstr "Hittade platsen för Ghostscript automatiskt."
183
+
184
+ #: admin/class-admin.php:387
185
+ msgid "Failed to auto-detect the location of Ghostscript."
186
+ msgstr "Kunde inte hitta platsen för Ghostscript automatiskt."
187
+
188
+ #: admin/class-admin.php:391
189
+ msgid "Options Array Dump"
190
+ msgstr "Dumpning av Alternativmatris"
191
+
192
+ #: admin/class-admin.php:438
193
+ msgid "Invalid width given: "
194
+ msgstr "Ogiltig bredd angiven:"
195
+
196
+ #: admin/class-admin.php:451
197
+ msgid "Invalid height given: "
198
+ msgstr "Ogiltig höjd angiven:"
199
+
200
+ #: admin/class-admin.php:562
201
+ msgid "Invalid Ghostscript path given: "
202
+ msgstr "Ogiltig sökväg till Ghostscript angiven:"
203
+
204
+ #: admin/class-admin.php:573
205
+ msgid "Invalid timeout given: "
206
+ msgstr "Ogiltig tidsgräns angiven:"
207
+
208
+ #: admin/class-admin.php:604
209
+ msgid ""
210
+ "The following values will be used by default in the shortcode. You can still "
211
+ "manually set each of these values in each individual shortcode."
212
+ msgstr ""
213
+ "Följande värden kommer att användas som standard i kortkoden. Du kan "
214
+ "fortfarande sätta varje värde, i varje kortkod, manuellt."
215
+
216
+ #: admin/class-admin.php:611
217
+ msgid "Select which tools to use when generating thumbnails."
218
+ msgstr "Välj vilka verktyg som skall användas vid miniatyrgenerering."
219
+
220
+ #: admin/class-admin.php:620
221
+ msgid ""
222
+ "Enter custom CSS styling for use with document galleries. To see which ids "
223
+ "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
224
+ "\">style.css</a>."
225
+ msgstr ""
226
+ "Ange anpassad CSS-stil att använda för dokumentgallerier. För att se vilka "
227
+ "ID:n och klasser du kan använda, ta en titt på <a href=\"%s\" target=\"_blank"
228
+ "\">style.css</a>."
229
+
230
+ #: admin/class-admin.php:640
231
+ msgid ""
232
+ "Unless you <em>really</em> know what you're doing, you should not touch "
233
+ "these values."
234
+ msgstr ""
235
+ "Om du inte <em>verkligen</em> vet vad du gör så bör du lämna dessa värden "
236
+ "orörda."
237
+
238
+ #: admin/class-admin.php:643
239
+ msgid ""
240
+ "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
241
+ msgstr ""
242
+ "NOTERA: <code>exec()</code> är ej tillgängligt. Ghostscript kommer inte att "
243
+ "fungera."
244
+
245
+ #: admin/class-admin.php:654
246
+ msgid ""
247
+ "The following <em>readonly text</em> should be provided when <a href="
248
+ "\"http://wordpress.org/support/plugin/document-gallery\" target=\"_blank"
249
+ "\">reporting a bug</a>:"
250
+ msgstr ""
251
+ "Följande <em>skrivskyddade text</em> skall skickas med vid <a href=\"http://"
252
+ "wordpress.org/support/plugin/document-gallery\" target=\"_blank"
253
+ "\">buggrapportering</a>:"
254
+
255
+ #: admin/class-admin.php:755
256
+ msgid "Select All"
257
+ msgstr "Välj Alla"
258
+
259
+ #: admin/class-admin.php:758
260
+ msgid "Thumbnail"
261
+ msgstr "Miniatyr"
262
+
263
+ #: admin/class-admin.php:759
264
+ msgid "File name"
265
+ msgstr "Filnamn"
266
+
267
+ #: admin/class-admin.php:760
268
+ msgid "Date"
269
+ msgstr "Datum"
270
+
271
+ #: admin/class-admin.php:763
272
+ msgid "Delete Selected"
273
+ msgstr "Ta Bort Valda"
274
+
275
+ #: admin/class-admin.php:765
276
+ msgid "item"
277
+ msgid_plural "items"
278
+ msgstr[0] "objekt"
279
+ msgstr[1] "objekt"
280
+
281
+ #: admin/class-admin.php:768
282
+ msgid "Go to the first page"
283
+ msgstr "Gå till första sidan"
284
+
285
+ #: admin/class-admin.php:769
286
+ msgid "Go to the previous page"
287
+ msgstr "Gå till föregående sida"
288
+
289
+ #: admin/class-admin.php:771
290
+ msgid "Current page"
291
+ msgstr "Aktuell sida"
292
+
293
+ #: admin/class-admin.php:771
294
+ msgid "of"
295
+ msgstr "av"
296
+
297
+ #: admin/class-admin.php:772
298
+ msgid "Go to the next page"
299
+ msgstr "Gå till nästa sida"
300
+
301
+ #: admin/class-admin.php:773
302
+ msgid "Go to the last page"
303
+ msgstr "Gå till sista sidan"
304
+
305
+ #: admin/class-admin.php:775
306
+ msgid "items per page"
307
+ msgstr "objekt per sida"
308
+
309
+ #: admin/class-admin.php:808
310
+ msgid "View"
311
+ msgstr "Visa"
312
+
313
+ #: admin/class-admin.php:809
314
+ msgid "attachment page"
315
+ msgstr "sida för bilaga"
316
+
317
+ #: admin/class-admin.php:809
318
+ msgid "Attachment not found"
319
+ msgstr "Bilaga hittades ej"
320
+
321
+ #: inc/class-gallery.php:85
322
+ msgid "Generated using Document Gallery. Get yours here: "
323
+ msgstr "Genererat med Document Gallery. Skaffa det här: "
324
+
325
+ #: inc/class-gallery.php:88
326
+ msgid "No attachments to display. How boring! :("
327
+ msgstr "Inga bilagor att visa. Så tråkigt! :("
328
+
329
+ #: inc/class-gallery.php:89
330
+ msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
331
+ msgstr "Parametern %s får endast vara \"%s\" eller \"%s.\" Du angav \"%s.\""
332
+
333
+ #: inc/class-gallery.php:285
334
+ msgid "The following ID is invalid: "
335
+ msgid_plural "The following IDs are invalid: "
336
+ msgstr[0] "Följande ID är ogiltigt:"
337
+ msgstr[1] "Följande ID:n är ogiltiga:"
338
+
339
+ #: inc/class-gallery.php:378
340
+ msgid "The orderby value entered, \"%s,\" is not valid."
341
+ msgstr "Värdet som angävs för sortering, \"%s,\" är ogiltigt."
342
+
343
+ #: inc/class-gallery.php:532
344
+ msgid "%s is not a valid term name in %s."
345
+ msgstr "%s är ej ett giltigt termnamn i %s."
346
+
347
+ #: inc/class-image-editor-imagick.php:37
348
+ msgid "Failed to set Imagick page number"
349
+ msgstr "Kunde inte sätta Imagick sidnummer"
350
+
351
+ #: inc/class-thumber.php:59
352
+ msgid "Attempting to generate thumbnail for attachment #%d with '%s'"
353
+ msgstr "Försöker generera miniatyr för bilagan #%d med '%s'"
354
+
355
+ #: inc/class-thumber.php:138
356
+ msgid "Could not open file: "
357
+ msgstr "Kunde inte öppna fil:"
358
+
359
+ #: inc/class-thumber.php:143
360
+ msgid "Could not write file: "
361
+ msgstr "Kunde inte skriva till fil:"
362
+
363
+ #: inc/class-thumber.php:180
364
+ msgid "Failed to open file in Imagick: "
365
+ msgstr "Kunde inte öppna fil i Imagick:"
366
+
367
+ #: inc/class-thumber.php:191
368
+ msgid "Failed to save image in Imagick: "
369
+ msgstr "Kunde inte spara bild i Imagick:"
370
+
371
+ #: inc/class-thumber.php:249
372
+ msgid "Ghostscript failed: "
373
+ msgstr "Ghostscript misslyckades:"
374
+
375
+ #: inc/class-thumber.php:387
376
+ msgid "Failed to retrieve thumbnail from Google: "
377
+ msgstr "Kunde inte hämta miniatyr från Google:"
378
+
379
+ #: inc/class-thumber.php:631
380
+ msgid "Thumbnail Generators: "
381
+ msgstr "Miniatyrgeneratorer:"
382
+
383
+ #: inc/class-thumber.php:636
384
+ msgid "No thumbnail generators enabled."
385
+ msgstr "Inga miniatyrgeneratorer aktiverade."
386
+
387
+ #: inc/class-thumber.php:679
388
+ msgid "Failed to get image editor: "
389
+ msgstr "Kunde inte hämta bildredigerare:"
390
+
391
+ #: inc/class-thumber.php:691
392
+ msgid "Failed to save image: "
393
+ msgstr "Kunde inte spara bild:"
394
+
395
+ #. Plugin URI of the plugin/theme
396
+ msgid "http://wordpress.org/extend/plugins/document-gallery/"
397
+ msgstr "http://wordpress.org/extend/plugins/document-gallery/"
398
+
399
+ #. Description of the plugin/theme
400
+ msgid ""
401
+ "Display non-images (and images) in gallery format on a page or post with the "
402
+ "[dg] shortcode."
403
+ msgstr ""
404
+ "Visa dokument (och bilder) i galleriformat på en sida eller i ett inlägg med "
405
+ "kortkoden [dg]."
406
+
407
+ #. Author of the plugin/theme
408
+ msgid "Dan Rossiter"
409
+ msgstr "Dan Rossiter"
410
+
411
+ #. Author URI of the plugin/theme
412
+ msgid "http://danrossiter.org/"
413
+ msgstr "http://danrossiter.org/"
languages/document-gallery-uk_UA.mo CHANGED
Binary file
languages/document-gallery-uk_UA.po CHANGED
@@ -2,77 +2,90 @@
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.9\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
- "POT-Creation-Date: 2014-04-21 02:57:10+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-04-21 17:57-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: uk\n"
 
17
 
18
- #: admin/class-admin.php:27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  msgid "Settings"
20
  msgstr "Параметри"
21
 
22
- #: admin/class-admin.php:37
23
  msgid "Document Gallery Settings"
24
  msgstr "Параметри 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:58
32
  msgid "Default Settings"
33
- msgstr "Типові Параметри"
34
 
35
- #: admin/class-admin.php:62
36
  msgid "Thumbnail Generation"
37
- msgstr "Утворення Мініатюр"
38
 
39
- #: admin/class-admin.php:66
40
  msgid "Custom CSS"
41
  msgstr "Особисті CSS"
42
 
43
- #: admin/class-admin.php:70
44
- msgid "Advanced Thumbnail Generation"
45
- msgstr "Параметри Утворення Мініатюр для Досвідчених Користувачів"
46
-
47
- #: admin/class-admin.php:82
48
  msgid "Link to attachment page rather than to file"
49
  msgstr "Посилання на сторінку прикріпленого до запису файла, а не на сам файл"
50
 
51
- #: admin/class-admin.php:94
52
  msgid "Include document descriptions"
53
  msgstr "Додавати описи документів"
54
 
55
- #: admin/class-admin.php:106
56
  msgid "Use auto-generated document thumbnails"
57
  msgstr "Використовувати автоматично згенеровані мініатюри документів"
58
 
59
- #: admin/class-admin.php:118
60
  msgid "Include image attachments in gallery"
61
  msgstr "Включати прикріплені до посту зображення в галерею"
62
 
63
- #: admin/class-admin.php:130
64
  msgid "Only look for attachments in post where [dg] is used"
65
  msgstr "Шукати прикріплені файли лише у записах, де використовується [dg]"
66
 
67
- #: admin/class-admin.php:143
68
  msgid "Ascending or descending sorting of documents"
69
  msgstr "Сортування документів за зростанням або за спаданням"
70
 
71
- #: admin/class-admin.php:156
72
  msgid "Which field to order documents by"
73
  msgstr "За яким полем сортувати документи"
74
 
75
- #: admin/class-admin.php:169
76
  msgid ""
77
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
78
  msgstr ""
@@ -80,11 +93,11 @@ msgstr ""
80
  "параметрі category, також можливе використання taxon_name, або хоча б однієї "
81
  "(OR)"
82
 
83
- #: admin/class-admin.php:181
84
  msgid "Locally generate thumbnails for audio & video files."
85
  msgstr "Локально утворювати мініатюри для аудіо та відео файлів."
86
 
87
- #: admin/class-admin.php:194
88
  msgid ""
89
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
90
  "a> for faster local PDF processing (compared to Imagick)."
@@ -93,7 +106,7 @@ msgstr ""
93
  "\">Ghostscript</a> для більш швидкої локальної обробки PDF (порівняно з "
94
  "Imagick)."
95
 
96
- #: admin/class-admin.php:195
97
  msgid ""
98
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
99
  "target=\"_blank\">Ghostscript</a>."
@@ -101,7 +114,7 @@ msgstr ""
101
  "Ваш сервер не налаштований для використання <a href=\"http://www.ghostscript."
102
  "com/\" target=\"_blank\">Ghostscript</a>."
103
 
104
- #: admin/class-admin.php:209
105
  msgid ""
106
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
107
  "\">Imagick</a> to handle lots of filetypes locally."
@@ -110,7 +123,7 @@ msgstr ""
110
  "target=\"_blank\">Imagick</a> для локальної обробки великої кількості типів "
111
  "файлів."
112
 
113
- #: admin/class-admin.php:210
114
  msgid ""
115
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
116
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
@@ -118,7 +131,7 @@ msgstr ""
118
  "Ваш сервер не налаштований для використання <a href=\"http://www.php.net/"
119
  "manual/en/book.imagick.php\" target=\"_blank\">Imagick</a>."
120
 
121
- #: admin/class-admin.php:224
122
  msgid ""
123
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
124
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
@@ -128,19 +141,79 @@ msgstr ""
128
  "\">Google Drive Viewer</a> для утворення мініатюр файлів MS Office та "
129
  "багатьох інших типів файлів віддалено."
130
 
131
- #: admin/class-admin.php:225
132
  msgid "Your server does not allow remote HTTP access."
133
  msgstr "Ваш сервер не дозволяє віддалені HTTP запити."
134
 
135
- #: admin/class-admin.php:239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  msgid "Successfully auto-detected the location of Ghostscript."
137
  msgstr "Успішно автоматично визначено місцезнаходження Ghostscript."
138
 
139
- #: admin/class-admin.php:240
140
  msgid "Failed to auto-detect the location of Ghostscript."
141
  msgstr "Не вдалося автоматично визначити місцезнаходження Ghostscript."
142
 
143
- #: admin/class-admin.php:248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  msgid ""
145
  "The following values will be used by default in the shortcode. You can still "
146
  "manually set each of these values in each individual shortcode."
@@ -149,11 +222,12 @@ msgstr ""
149
  "цьому вручну можна встановити будь-які з цих значень в кожному конкретному "
150
  "екземплярі шорткоду."
151
 
152
- #: admin/class-admin.php:255
153
  msgid "Select which tools to use when generating thumbnails."
154
  msgstr "Оберіть, які інструменти використовувати для утворення мініатюр."
155
 
156
- #: admin/class-admin.php:261
 
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"
@@ -163,7 +237,7 @@ msgstr ""
163
  "побачити, які селектори варто використовувати, зверніть увагу на <a href=\"%s"
164
  "\" target=\"_blank\">style.css</a>."
165
 
166
- #: admin/class-admin.php:279
167
  msgid ""
168
  "Unless you <em>really</em> know what you're doing, you should not touch "
169
  "these values."
@@ -171,42 +245,119 @@ msgstr ""
171
  "Не варто міняти цих значень, за винятком випадків коли Ви <em>насправді</em> "
172
  "знаєте що робите."
173
 
174
- #: admin/class-admin.php:281
175
  msgid ""
176
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
177
  msgstr "УВАГА: <code>exec()</code> недосяжний. Ghostscript не працюватиме."
178
 
179
- #: admin/class-admin.php:388
180
- msgid "Invalid Ghostscript path given: "
181
- msgstr "Задано невірний шлях Ghostscript: "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- #: inc/class-gallery.php:92
 
 
 
 
184
  msgid "Generated using Document Gallery. Get yours here: "
185
  msgstr ""
186
  "Згенеровано використовуючи Document Gallery. Сподобалось? Отримайте Вашу "
187
  "копію тут: "
188
 
189
- #: inc/class-gallery.php:95
190
  msgid "No attachments to display. How boring! :("
191
  msgstr "Жодного вкладення для відображення. Нудьга! :("
192
 
193
- #: inc/class-gallery.php:96
 
194
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
195
  msgstr ""
196
  "Параметр %s може приймати тільки значення \"%s\" або \"%s.\" Ви ж ввели \"%s."
197
  "\""
198
 
199
- #: inc/class-gallery.php:267
200
  msgid "The following ID is invalid: "
201
  msgid_plural "The following IDs are invalid: "
202
  msgstr[0] "Наступний ідентифікатор (ID) недійсний: "
203
  msgstr[1] "Наступні ідентифікатори (IDs) недійсні: "
 
204
 
205
- #: inc/class-gallery.php:333
 
206
  msgid "The orderby value entered, \"%s,\" is not valid."
207
  msgstr "Задане значення параметра orderby, \"%s,\" неприпустиме."
208
 
209
- #: inc/class-gallery.php:475
 
210
  msgid "%s is not a valid term name in %s."
211
  msgstr "%s не є припустимим значенням параметра %s."
212
 
@@ -214,36 +365,49 @@ msgstr "%s не є припустимим значенням параметра
214
  msgid "Failed to set Imagick page number"
215
  msgstr "Не вдалося встановити номер сторінки в Imagick"
216
 
217
- #: inc/class-thumber.php:125
 
 
 
 
 
218
  msgid "Could not open file: "
219
  msgstr "Не вдалося відкрити файл: "
220
 
221
- #: inc/class-thumber.php:130
222
  msgid "Could not write file: "
223
  msgstr "Не вдалося записати файл: "
224
 
225
- #: inc/class-thumber.php:166
226
  msgid "Failed to open file in Imagick: "
227
  msgstr "Не вдалося відкрити файл в Imagick: "
228
 
229
- #: inc/class-thumber.php:176
230
  msgid "Failed to save image in Imagick: "
231
  msgstr "Не вдалося зберегти зображення в Imagick: "
232
 
233
- #: inc/class-thumber.php:234
234
  msgid "Ghostscript failed: "
235
- msgstr "Ghostscript вийшов із ладу: "
236
 
237
- #: inc/class-thumber.php:364
238
  msgid "Failed to retrieve thumbnail from Google: "
239
  msgstr "Не вдалося отримати від Google мініатюру: "
240
 
241
- #: inc/class-thumber.php:644
 
 
 
 
 
 
 
 
242
  msgid "Failed to get image editor: "
243
  msgstr ""
244
  "Невдача при спробі використання графічного редактора (WP_Image_Editor): "
245
 
246
- #: inc/class-thumber.php:655
247
  msgid "Failed to save image: "
248
  msgstr "Не вдалося зберегти зображення: "
249
 
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.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
+ "POT-Creation-Date: 2014-09-04 02:15:50+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-09-12 19:42-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.9\n"
15
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
16
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
17
+ "Language: uk_UA\n"
18
 
19
+ #: admin/class-admin.php:28
20
+ msgid "General"
21
+ msgstr "Загальні"
22
+
23
+ #: admin/class-admin.php:29
24
+ msgid "Thumbnail Management"
25
+ msgstr "Керування мініатюрами"
26
+
27
+ #: admin/class-admin.php:30
28
+ msgid "Logging"
29
+ msgstr "Журнал подій"
30
+
31
+ #: admin/class-admin.php:31
32
+ msgid "Advanced"
33
+ msgstr "Для досвідчених користувачів"
34
+
35
+ #: admin/class-admin.php:68
36
  msgid "Settings"
37
  msgstr "Параметри"
38
 
39
+ #: admin/class-admin.php:78
40
  msgid "Document Gallery Settings"
41
  msgstr "Параметри Document Gallery"
42
 
43
  #. Plugin Name of the plugin/theme
44
+ #: admin/class-admin.php:79
45
  msgid "Document Gallery"
46
  msgstr "Document Gallery"
47
 
48
+ #: admin/class-admin.php:124
49
  msgid "Default Settings"
50
+ msgstr "Типові параметри"
51
 
52
+ #: admin/class-admin.php:128
53
  msgid "Thumbnail Generation"
54
+ msgstr "Утворення мініатюр"
55
 
56
+ #: admin/class-admin.php:132
57
  msgid "Custom CSS"
58
  msgstr "Особисті CSS"
59
 
60
+ #: admin/class-admin.php:144
 
 
 
 
61
  msgid "Link to attachment page rather than to file"
62
  msgstr "Посилання на сторінку прикріпленого до запису файла, а не на сам файл"
63
 
64
+ #: admin/class-admin.php:156
65
  msgid "Include document descriptions"
66
  msgstr "Додавати описи документів"
67
 
68
+ #: admin/class-admin.php:168
69
  msgid "Use auto-generated document thumbnails"
70
  msgstr "Використовувати автоматично згенеровані мініатюри документів"
71
 
72
+ #: admin/class-admin.php:180
73
  msgid "Include image attachments in gallery"
74
  msgstr "Включати прикріплені до посту зображення в галерею"
75
 
76
+ #: admin/class-admin.php:192
77
  msgid "Only look for attachments in post where [dg] is used"
78
  msgstr "Шукати прикріплені файли лише у записах, де використовується [dg]"
79
 
80
+ #: admin/class-admin.php:205
81
  msgid "Ascending or descending sorting of documents"
82
  msgstr "Сортування документів за зростанням або за спаданням"
83
 
84
+ #: admin/class-admin.php:218
85
  msgid "Which field to order documents by"
86
  msgstr "За яким полем сортувати документи"
87
 
88
+ #: admin/class-admin.php:231
89
  msgid ""
90
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
91
  msgstr ""
93
  "параметрі category, також можливе використання taxon_name, або хоча б однієї "
94
  "(OR)"
95
 
96
+ #: admin/class-admin.php:243
97
  msgid "Locally generate thumbnails for audio & video files."
98
  msgstr "Локально утворювати мініатюри для аудіо та відео файлів."
99
 
100
+ #: admin/class-admin.php:256
101
  msgid ""
102
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
103
  "a> for faster local PDF processing (compared to Imagick)."
106
  "\">Ghostscript</a> для більш швидкої локальної обробки PDF (порівняно з "
107
  "Imagick)."
108
 
109
+ #: admin/class-admin.php:257
110
  msgid ""
111
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
112
  "target=\"_blank\">Ghostscript</a>."
114
  "Ваш сервер не налаштований для використання <a href=\"http://www.ghostscript."
115
  "com/\" target=\"_blank\">Ghostscript</a>."
116
 
117
+ #: admin/class-admin.php:271
118
  msgid ""
119
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
120
  "\">Imagick</a> to handle lots of filetypes locally."
123
  "target=\"_blank\">Imagick</a> для локальної обробки великої кількості типів "
124
  "файлів."
125
 
126
+ #: admin/class-admin.php:272
127
  msgid ""
128
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
129
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
131
  "Ваш сервер не налаштований для використання <a href=\"http://www.php.net/"
132
  "manual/en/book.imagick.php\" target=\"_blank\">Imagick</a>."
133
 
134
+ #: admin/class-admin.php:286
135
  msgid ""
136
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
137
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
141
  "\">Google Drive Viewer</a> для утворення мініатюр файлів MS Office та "
142
  "багатьох інших типів файлів віддалено."
143
 
144
+ #: admin/class-admin.php:287
145
  msgid "Your server does not allow remote HTTP access."
146
  msgstr "Ваш сервер не дозволяє віддалені HTTP запити."
147
 
148
+ #: admin/class-admin.php:309
149
+ msgid "The max width and height (in pixels) that thumbnails will be generated."
150
+ msgstr ""
151
+ "Максимальна ширина і висота (у пікселях) з якими будуть утворюватися "
152
+ "мініатюри."
153
+
154
+ #: admin/class-admin.php:336
155
+ msgid "Advanced Thumbnail Generation"
156
+ msgstr "Утворення мініатюр"
157
+
158
+ #: admin/class-admin.php:348
159
+ msgid "Whether to log debug and error information related to Document Gallery."
160
+ msgstr ""
161
+ "Чи вести журнал налагоджування та інформації щодо помилок які мають "
162
+ "відношення до Document Gallery."
163
+
164
+ #: admin/class-admin.php:360
165
+ msgid ""
166
+ "Whether option structure should be validated before save. This is not "
167
+ "generally necessary."
168
+ msgstr ""
169
+ "Чи перевіряти структуру обраних налаштувань при збереженні. Як правило в "
170
+ "цьому нема потреби."
171
+
172
+ #: admin/class-admin.php:373
173
+ msgid ""
174
+ "Max number of seconds to wait for thumbnail generation before defaulting to "
175
+ "filetype icons."
176
+ msgstr ""
177
+ "Максимальна кількість секунд очікування при утворенні мініатюри до "
178
+ "використання іконки за замовчуванням."
179
+
180
+ #: admin/class-admin.php:374
181
+ msgid ""
182
+ "Note that generation will continue where timeout happened next time the "
183
+ "gallery is loaded."
184
+ msgstr ""
185
+ "Зверніть увагу, що утворення продовжиться з того місця, де воно було "
186
+ "призупинене, при наступному зверненні до галереї."
187
+
188
+ #: admin/class-admin.php:386
189
  msgid "Successfully auto-detected the location of Ghostscript."
190
  msgstr "Успішно автоматично визначено місцезнаходження Ghostscript."
191
 
192
+ #: admin/class-admin.php:387
193
  msgid "Failed to auto-detect the location of Ghostscript."
194
  msgstr "Не вдалося автоматично визначити місцезнаходження Ghostscript."
195
 
196
+ #: admin/class-admin.php:391
197
+ msgid "Options Array Dump"
198
+ msgstr "Дамп масиву обраних налаштувань"
199
+
200
+ #: admin/class-admin.php:438
201
+ msgid "Invalid width given: "
202
+ msgstr "Задана невірна ширина: "
203
+
204
+ #: admin/class-admin.php:451
205
+ msgid "Invalid height given: "
206
+ msgstr "Задана невірна висота: "
207
+
208
+ #: admin/class-admin.php:562
209
+ msgid "Invalid Ghostscript path given: "
210
+ msgstr "Задано невірний шлях Ghostscript: "
211
+
212
+ #: admin/class-admin.php:573
213
+ msgid "Invalid timeout given: "
214
+ msgstr "Задано невірний час очікування: "
215
+
216
+ #: admin/class-admin.php:604
217
  msgid ""
218
  "The following values will be used by default in the shortcode. You can still "
219
  "manually set each of these values in each individual shortcode."
222
  "цьому вручну можна встановити будь-які з цих значень в кожному конкретному "
223
  "екземплярі шорткоду."
224
 
225
+ #: admin/class-admin.php:611
226
  msgid "Select which tools to use when generating thumbnails."
227
  msgstr "Оберіть, які інструменти використовувати для утворення мініатюр."
228
 
229
+ #: admin/class-admin.php:620
230
+ #, c-format
231
  msgid ""
232
  "Enter custom CSS styling for use with document galleries. To see which ids "
233
  "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
237
  "побачити, які селектори варто використовувати, зверніть увагу на <a href=\"%s"
238
  "\" target=\"_blank\">style.css</a>."
239
 
240
+ #: admin/class-admin.php:640
241
  msgid ""
242
  "Unless you <em>really</em> know what you're doing, you should not touch "
243
  "these values."
245
  "Не варто міняти цих значень, за винятком випадків коли Ви <em>насправді</em> "
246
  "знаєте що робите."
247
 
248
+ #: admin/class-admin.php:643
249
  msgid ""
250
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
251
  msgstr "УВАГА: <code>exec()</code> недосяжний. Ghostscript не працюватиме."
252
 
253
+ #: admin/class-admin.php:654
254
+ msgid ""
255
+ "The following <em>readonly text</em> should be provided when <a href="
256
+ "\"http://wordpress.org/support/plugin/document-gallery\" target=\"_blank"
257
+ "\">reporting a bug</a>:"
258
+ msgstr ""
259
+ "Наведений нижче <em>доступний тільки для читання текст</em> має бути наданий "
260
+ "при <a href=\"http://wordpress.org/support/plugin/document-gallery\" target="
261
+ "\"_blank\">повідомленні про помилку</a>:"
262
+
263
+ #: admin/class-admin.php:755
264
+ msgid "Select All"
265
+ msgstr "Вибрати всі"
266
+
267
+ #: admin/class-admin.php:758
268
+ msgid "Thumbnail"
269
+ msgstr "Мініатюра"
270
+
271
+ #: admin/class-admin.php:759
272
+ msgid "File name"
273
+ msgstr "Назва файла"
274
+
275
+ #: admin/class-admin.php:760
276
+ msgid "Date"
277
+ msgstr "Дата"
278
+
279
+ #: admin/class-admin.php:763
280
+ msgid "Delete Selected"
281
+ msgstr "Вилучити вибрані"
282
+
283
+ #: admin/class-admin.php:765
284
+ msgid "item"
285
+ msgid_plural "items"
286
+ msgstr[0] "елемент"
287
+ msgstr[1] "елемента"
288
+ msgstr[2] "елементів"
289
+
290
+ #: admin/class-admin.php:768
291
+ msgid "Go to the first page"
292
+ msgstr "Перейти до першої сторінки"
293
+
294
+ #: admin/class-admin.php:769
295
+ msgid "Go to the previous page"
296
+ msgstr "Перейти до попередньої сторінки"
297
+
298
+ #: admin/class-admin.php:771
299
+ msgid "Current page"
300
+ msgstr "Поточна сторінка"
301
+
302
+ #: admin/class-admin.php:771
303
+ msgid "of"
304
+ msgstr "з"
305
+
306
+ #: admin/class-admin.php:772
307
+ msgid "Go to the next page"
308
+ msgstr "Перейти до наступної сторінки"
309
+
310
+ #: admin/class-admin.php:773
311
+ msgid "Go to the last page"
312
+ msgstr "Перейти до останньої сторінки"
313
+
314
+ #: admin/class-admin.php:775
315
+ msgid "items per page"
316
+ msgstr "елементів на сторінці"
317
+
318
+ #: admin/class-admin.php:808
319
+ msgid "View"
320
+ msgstr "Переглянути сторінку вкладення"
321
+
322
+ #: admin/class-admin.php:809
323
+ msgid "attachment page"
324
+ msgstr ""
325
 
326
+ #: admin/class-admin.php:809
327
+ msgid "Attachment not found"
328
+ msgstr "Вкладення не знайдено"
329
+
330
+ #: inc/class-gallery.php:85
331
  msgid "Generated using Document Gallery. Get yours here: "
332
  msgstr ""
333
  "Згенеровано використовуючи Document Gallery. Сподобалось? Отримайте Вашу "
334
  "копію тут: "
335
 
336
+ #: inc/class-gallery.php:88
337
  msgid "No attachments to display. How boring! :("
338
  msgstr "Жодного вкладення для відображення. Нудьга! :("
339
 
340
+ #: inc/class-gallery.php:89
341
+ #, c-format
342
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
343
  msgstr ""
344
  "Параметр %s може приймати тільки значення \"%s\" або \"%s.\" Ви ж ввели \"%s."
345
  "\""
346
 
347
+ #: inc/class-gallery.php:285
348
  msgid "The following ID is invalid: "
349
  msgid_plural "The following IDs are invalid: "
350
  msgstr[0] "Наступний ідентифікатор (ID) недійсний: "
351
  msgstr[1] "Наступні ідентифікатори (IDs) недійсні: "
352
+ msgstr[2] "Наступні ідентифікатори (IDs) недійсні: "
353
 
354
+ #: inc/class-gallery.php:378
355
+ #, c-format
356
  msgid "The orderby value entered, \"%s,\" is not valid."
357
  msgstr "Задане значення параметра orderby, \"%s,\" неприпустиме."
358
 
359
+ #: inc/class-gallery.php:532
360
+ #, c-format
361
  msgid "%s is not a valid term name in %s."
362
  msgstr "%s не є припустимим значенням параметра %s."
363
 
365
  msgid "Failed to set Imagick page number"
366
  msgstr "Не вдалося встановити номер сторінки в Imagick"
367
 
368
+ #: inc/class-thumber.php:59
369
+ #, c-format
370
+ msgid "Attempting to generate thumbnail for attachment #%d with '%s'"
371
+ msgstr "Спроба утворення мініатюри для вкладення №%d за допомоги '%s'"
372
+
373
+ #: inc/class-thumber.php:138
374
  msgid "Could not open file: "
375
  msgstr "Не вдалося відкрити файл: "
376
 
377
+ #: inc/class-thumber.php:143
378
  msgid "Could not write file: "
379
  msgstr "Не вдалося записати файл: "
380
 
381
+ #: inc/class-thumber.php:180
382
  msgid "Failed to open file in Imagick: "
383
  msgstr "Не вдалося відкрити файл в Imagick: "
384
 
385
+ #: inc/class-thumber.php:191
386
  msgid "Failed to save image in Imagick: "
387
  msgstr "Не вдалося зберегти зображення в Imagick: "
388
 
389
+ #: inc/class-thumber.php:249
390
  msgid "Ghostscript failed: "
391
+ msgstr "Ghostscript вийшов із ладу: "
392
 
393
+ #: inc/class-thumber.php:387
394
  msgid "Failed to retrieve thumbnail from Google: "
395
  msgstr "Не вдалося отримати від Google мініатюру: "
396
 
397
+ #: inc/class-thumber.php:631
398
+ msgid "Thumbnail Generators: "
399
+ msgstr "Генератори мініатюр: "
400
+
401
+ #: inc/class-thumber.php:636
402
+ msgid "No thumbnail generators enabled."
403
+ msgstr "Відсутні підключені генератори мініатюр."
404
+
405
+ #: inc/class-thumber.php:679
406
  msgid "Failed to get image editor: "
407
  msgstr ""
408
  "Невдача при спробі використання графічного редактора (WP_Image_Editor): "
409
 
410
+ #: inc/class-thumber.php:691
411
  msgid "Failed to save image: "
412
  msgstr "Не вдалося зберегти зображення: "
413
 
languages/document-gallery.pot CHANGED
@@ -2,9 +2,9 @@
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.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
- "POT-Creation-Date: 2014-05-26 15:34:24+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,171 +12,338 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: admin/class-admin.php:27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  msgid "Settings"
17
  msgstr ""
18
 
19
- #: admin/class-admin.php:37
20
  msgid "Document Gallery Settings"
21
  msgstr ""
22
 
23
- #. #-#-#-#-# plugin.pot (Document Gallery 2.1) #-#-#-#-#
24
  #. Plugin Name of the plugin/theme
25
- #: admin/class-admin.php:38
26
  msgid "Document Gallery"
27
  msgstr ""
28
 
29
- #: admin/class-admin.php:58
30
  msgid "Default Settings"
31
  msgstr ""
32
 
33
- #: admin/class-admin.php:62
34
  msgid "Thumbnail Generation"
35
  msgstr ""
36
 
37
- #: admin/class-admin.php:66
38
  msgid "Custom CSS"
39
  msgstr ""
40
 
41
- #: admin/class-admin.php:70
42
- msgid "Advanced Thumbnail Generation"
43
- msgstr ""
44
-
45
- #: admin/class-admin.php:82
46
  msgid "Link to attachment page rather than to file"
47
  msgstr ""
48
 
49
- #: admin/class-admin.php:94
50
  msgid "Include document descriptions"
51
  msgstr ""
52
 
53
- #: admin/class-admin.php:106
54
  msgid "Use auto-generated document thumbnails"
55
  msgstr ""
56
 
57
- #: admin/class-admin.php:118
58
  msgid "Include image attachments in gallery"
59
  msgstr ""
60
 
61
- #: admin/class-admin.php:130
62
  msgid "Only look for attachments in post where [dg] is used"
63
  msgstr ""
64
 
65
- #: admin/class-admin.php:143
66
  msgid "Ascending or descending sorting of documents"
67
  msgstr ""
68
 
69
- #: admin/class-admin.php:156
70
  msgid "Which field to order documents by"
71
  msgstr ""
72
 
73
- #: admin/class-admin.php:169
74
  msgid ""
75
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
76
  msgstr ""
77
 
78
- #: admin/class-admin.php:181
79
  msgid "Locally generate thumbnails for audio & video files."
80
  msgstr ""
81
 
82
- #: admin/class-admin.php:194
83
  msgid ""
84
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
85
  "a> for faster local PDF processing (compared to Imagick)."
86
  msgstr ""
87
 
88
- #: admin/class-admin.php:195
89
  msgid ""
90
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
91
  "target=\"_blank\">Ghostscript</a>."
92
  msgstr ""
93
 
94
- #: admin/class-admin.php:209
95
  msgid ""
96
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
97
  "\">Imagick</a> to handle lots of filetypes locally."
98
  msgstr ""
99
 
100
- #: admin/class-admin.php:210
101
  msgid ""
102
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
103
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
104
  msgstr ""
105
 
106
- #: admin/class-admin.php:224
107
  msgid ""
108
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
109
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
110
  "file types remotely."
111
  msgstr ""
112
 
113
- #: admin/class-admin.php:225
114
  msgid "Your server does not allow remote HTTP access."
115
  msgstr ""
116
 
117
- #: admin/class-admin.php:239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  msgid "Successfully auto-detected the location of Ghostscript."
119
  msgstr ""
120
 
121
- #: admin/class-admin.php:240
122
  msgid "Failed to auto-detect the location of Ghostscript."
123
  msgstr ""
124
 
125
- #: admin/class-admin.php:262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  msgid ""
127
  "The following values will be used by default in the shortcode. You can still "
128
  "manually set each of these values in each individual shortcode."
129
  msgstr ""
130
 
131
- #: admin/class-admin.php:269
132
  msgid "Select which tools to use when generating thumbnails."
133
  msgstr ""
134
 
135
- #: admin/class-admin.php:275
136
  msgid ""
137
  "Enter custom CSS styling for use with document galleries. To see which ids "
138
  "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
139
  "\">style.css</a>."
140
  msgstr ""
141
 
142
- #: admin/class-admin.php:293
143
  msgid ""
144
  "Unless you <em>really</em> know what you're doing, you should not touch "
145
  "these values."
146
  msgstr ""
147
 
148
- #: admin/class-admin.php:295
149
  msgid ""
150
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
151
  msgstr ""
152
 
153
- #: admin/class-admin.php:407
154
- msgid "Invalid Ghostscript path given: "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  msgstr ""
156
 
157
- #: inc/class-gallery.php:92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  msgid "Generated using Document Gallery. Get yours here: "
159
  msgstr ""
160
 
161
- #: inc/class-gallery.php:95
162
  msgid "No attachments to display. How boring! :("
163
  msgstr ""
164
 
165
- #: inc/class-gallery.php:96
166
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
167
  msgstr ""
168
 
169
- #: inc/class-gallery.php:267
170
  msgid "The following ID is invalid: "
171
  msgid_plural "The following IDs are invalid: "
172
  msgstr[0] ""
173
  msgstr[1] ""
174
 
175
- #: inc/class-gallery.php:333
176
  msgid "The orderby value entered, \"%s,\" is not valid."
177
  msgstr ""
178
 
179
- #: inc/class-gallery.php:475
180
  msgid "%s is not a valid term name in %s."
181
  msgstr ""
182
 
@@ -184,43 +351,47 @@ msgstr ""
184
  msgid "Failed to set Imagick page number"
185
  msgstr ""
186
 
187
- #: inc/class-thumber.php:125
 
 
 
 
188
  msgid "Could not open file: "
189
  msgstr ""
190
 
191
- #: inc/class-thumber.php:130
192
  msgid "Could not write file: "
193
  msgstr ""
194
 
195
- #: inc/class-thumber.php:166
196
  msgid "Failed to open file in Imagick: "
197
  msgstr ""
198
 
199
- #: inc/class-thumber.php:176
200
  msgid "Failed to save image in Imagick: "
201
  msgstr ""
202
 
203
- #: inc/class-thumber.php:234
204
  msgid "Ghostscript failed: "
205
  msgstr ""
206
 
207
- #: inc/class-thumber.php:372
208
  msgid "Failed to retrieve thumbnail from Google: "
209
  msgstr ""
210
 
211
- #: inc/class-thumber.php:616
212
  msgid "Thumbnail Generators: "
213
  msgstr ""
214
 
215
- #: inc/class-thumber.php:621
216
  msgid "No thumbnail generators enabled."
217
  msgstr ""
218
 
219
- #: inc/class-thumber.php:663
220
  msgid "Failed to get image editor: "
221
  msgstr ""
222
 
223
- #: inc/class-thumber.php:674
224
  msgid "Failed to save image: "
225
  msgstr ""
226
 
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.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/document-gallery\n"
7
+ "POT-Creation-Date: 2014-09-23 02:11:20+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: admin/class-admin.php:28
16
+ msgid "General"
17
+ msgstr ""
18
+
19
+ #: admin/class-admin.php:29
20
+ msgid "Thumbnail Management"
21
+ msgstr ""
22
+
23
+ #: admin/class-admin.php:30 admin/class-admin.php:904
24
+ msgid "Logging"
25
+ msgstr ""
26
+
27
+ #: admin/class-admin.php:31
28
+ msgid "Advanced"
29
+ msgstr ""
30
+
31
+ #: admin/class-admin.php:68
32
  msgid "Settings"
33
  msgstr ""
34
 
35
+ #: admin/class-admin.php:78
36
  msgid "Document Gallery Settings"
37
  msgstr ""
38
 
39
+ #. #-#-#-#-# plugin.pot (Document Gallery 2.2) #-#-#-#-#
40
  #. Plugin Name of the plugin/theme
41
+ #: admin/class-admin.php:79
42
  msgid "Document Gallery"
43
  msgstr ""
44
 
45
+ #: admin/class-admin.php:124
46
  msgid "Default Settings"
47
  msgstr ""
48
 
49
+ #: admin/class-admin.php:128
50
  msgid "Thumbnail Generation"
51
  msgstr ""
52
 
53
+ #: admin/class-admin.php:132
54
  msgid "Custom CSS"
55
  msgstr ""
56
 
57
+ #: admin/class-admin.php:144
 
 
 
 
58
  msgid "Link to attachment page rather than to file"
59
  msgstr ""
60
 
61
+ #: admin/class-admin.php:156
62
  msgid "Include document descriptions"
63
  msgstr ""
64
 
65
+ #: admin/class-admin.php:168
66
  msgid "Use auto-generated document thumbnails"
67
  msgstr ""
68
 
69
+ #: admin/class-admin.php:180
70
  msgid "Include image attachments in gallery"
71
  msgstr ""
72
 
73
+ #: admin/class-admin.php:192
74
  msgid "Only look for attachments in post where [dg] is used"
75
  msgstr ""
76
 
77
+ #: admin/class-admin.php:205
78
  msgid "Ascending or descending sorting of documents"
79
  msgstr ""
80
 
81
+ #: admin/class-admin.php:218
82
  msgid "Which field to order documents by"
83
  msgstr ""
84
 
85
+ #: admin/class-admin.php:231
86
  msgid ""
87
  "Whether matched documents must have all taxa_names (AND) or at least one (OR)"
88
  msgstr ""
89
 
90
+ #: admin/class-admin.php:243
91
  msgid "Locally generate thumbnails for audio & video files."
92
  msgstr ""
93
 
94
+ #: admin/class-admin.php:256
95
  msgid ""
96
  "Use <a href=\"http://www.ghostscript.com/\" target=\"_blank\">Ghostscript</"
97
  "a> for faster local PDF processing (compared to Imagick)."
98
  msgstr ""
99
 
100
+ #: admin/class-admin.php:257
101
  msgid ""
102
  "Your server is not configured to run <a href=\"http://www.ghostscript.com/\" "
103
  "target=\"_blank\">Ghostscript</a>."
104
  msgstr ""
105
 
106
+ #: admin/class-admin.php:271
107
  msgid ""
108
  "Use <a href=\"http://www.php.net/manual/en/book.imagick.php\" target=\"_blank"
109
  "\">Imagick</a> to handle lots of filetypes locally."
110
  msgstr ""
111
 
112
+ #: admin/class-admin.php:272
113
  msgid ""
114
  "Your server is not configured to run <a href=\"http://www.php.net/manual/en/"
115
  "book.imagick.php\" target=\"_blank\">Imagick</a>."
116
  msgstr ""
117
 
118
+ #: admin/class-admin.php:286
119
  msgid ""
120
  "Use <a href=\"https://drive.google.com/viewer\" target=\"_blank\">Google "
121
  "Drive Viewer</a> to generate thumbnails for MS Office files and many other "
122
  "file types remotely."
123
  msgstr ""
124
 
125
+ #: admin/class-admin.php:287
126
  msgid "Your server does not allow remote HTTP access."
127
  msgstr ""
128
 
129
+ #: admin/class-admin.php:309
130
+ msgid "The max width and height (in pixels) that thumbnails will be generated."
131
+ msgstr ""
132
+
133
+ #: admin/class-admin.php:338
134
+ msgid "Advanced Thumbnail Generation"
135
+ msgstr ""
136
+
137
+ #: admin/class-admin.php:350
138
+ msgid "Whether to log debug and error information related to Document Gallery."
139
+ msgstr ""
140
+
141
+ #: admin/class-admin.php:362
142
+ msgid ""
143
+ "Whether option structure should be validated before save. This is not "
144
+ "generally necessary."
145
+ msgstr ""
146
+
147
+ #: admin/class-admin.php:375
148
+ msgid ""
149
+ "Max number of seconds to wait for thumbnail generation before defaulting to "
150
+ "filetype icons."
151
+ msgstr ""
152
+
153
+ #: admin/class-admin.php:376
154
+ msgid ""
155
+ "Note that generation will continue where timeout happened next time the "
156
+ "gallery is loaded."
157
+ msgstr ""
158
+
159
+ #: admin/class-admin.php:388
160
  msgid "Successfully auto-detected the location of Ghostscript."
161
  msgstr ""
162
 
163
+ #: admin/class-admin.php:389
164
  msgid "Failed to auto-detect the location of Ghostscript."
165
  msgstr ""
166
 
167
+ #: admin/class-admin.php:393
168
+ msgid "Options Array Dump"
169
+ msgstr ""
170
+
171
+ #: admin/class-admin.php:440
172
+ msgid "Invalid width given: "
173
+ msgstr ""
174
+
175
+ #: admin/class-admin.php:453
176
+ msgid "Invalid height given: "
177
+ msgstr ""
178
+
179
+ #: admin/class-admin.php:566
180
+ msgid "Invalid Ghostscript path given: "
181
+ msgstr ""
182
+
183
+ #: admin/class-admin.php:577
184
+ msgid "Invalid timeout given: "
185
+ msgstr ""
186
+
187
+ #: admin/class-admin.php:608
188
  msgid ""
189
  "The following values will be used by default in the shortcode. You can still "
190
  "manually set each of these values in each individual shortcode."
191
  msgstr ""
192
 
193
+ #: admin/class-admin.php:615
194
  msgid "Select which tools to use when generating thumbnails."
195
  msgstr ""
196
 
197
+ #: admin/class-admin.php:624
198
  msgid ""
199
  "Enter custom CSS styling for use with document galleries. To see which ids "
200
  "and classes you can style, take a look at <a href=\"%s\" target=\"_blank"
201
  "\">style.css</a>."
202
  msgstr ""
203
 
204
+ #: admin/class-admin.php:644
205
  msgid ""
206
  "Unless you <em>really</em> know what you're doing, you should not touch "
207
  "these values."
208
  msgstr ""
209
 
210
+ #: admin/class-admin.php:647
211
  msgid ""
212
  "NOTE: <code>exec()</code> is not accessible. Ghostscript will not function."
213
  msgstr ""
214
 
215
+ #: admin/class-admin.php:658
216
+ msgid ""
217
+ "The following <em>readonly text</em> should be provided when <a href="
218
+ "\"http://wordpress.org/support/plugin/document-gallery\" target=\"_blank"
219
+ "\">reporting a bug</a>:"
220
+ msgstr ""
221
+
222
+ #: admin/class-admin.php:759
223
+ msgid "Select All"
224
+ msgstr ""
225
+
226
+ #: admin/class-admin.php:762
227
+ msgid "Thumbnail"
228
+ msgstr ""
229
+
230
+ #: admin/class-admin.php:763
231
+ msgid "File name"
232
  msgstr ""
233
 
234
+ #: admin/class-admin.php:764 admin/class-admin.php:839
235
+ msgid "Date"
236
+ msgstr ""
237
+
238
+ #: admin/class-admin.php:767
239
+ msgid "Delete Selected"
240
+ msgstr ""
241
+
242
+ #: admin/class-admin.php:769
243
+ msgid "item"
244
+ msgid_plural "items"
245
+ msgstr[0] ""
246
+ msgstr[1] ""
247
+
248
+ #: admin/class-admin.php:772
249
+ msgid "Go to the first page"
250
+ msgstr ""
251
+
252
+ #: admin/class-admin.php:773
253
+ msgid "Go to the previous page"
254
+ msgstr ""
255
+
256
+ #: admin/class-admin.php:775
257
+ msgid "Current page"
258
+ msgstr ""
259
+
260
+ #: admin/class-admin.php:775
261
+ msgid "of"
262
+ msgstr ""
263
+
264
+ #: admin/class-admin.php:776
265
+ msgid "Go to the next page"
266
+ msgstr ""
267
+
268
+ #: admin/class-admin.php:777
269
+ msgid "Go to the last page"
270
+ msgstr ""
271
+
272
+ #: admin/class-admin.php:779
273
+ msgid "items per page"
274
+ msgstr ""
275
+
276
+ #: admin/class-admin.php:818
277
+ msgid "View"
278
+ msgstr ""
279
+
280
+ #: admin/class-admin.php:819
281
+ msgid "attachment page"
282
+ msgstr ""
283
+
284
+ #: admin/class-admin.php:819
285
+ msgid "Attachment not found"
286
+ msgstr ""
287
+
288
+ #: admin/class-admin.php:840
289
+ msgid "Level"
290
+ msgstr ""
291
+
292
+ #: admin/class-admin.php:841
293
+ msgid "Message"
294
+ msgstr ""
295
+
296
+ #: admin/class-admin.php:850
297
+ msgid "Expand All"
298
+ msgstr ""
299
+
300
+ #: admin/class-admin.php:853
301
+ msgid "Collapse All"
302
+ msgstr ""
303
+
304
+ #: admin/class-admin.php:897
305
+ msgid "Clear Log"
306
+ msgstr ""
307
+
308
+ #: admin/class-admin.php:904
309
+ msgid "There are no log entries at this time."
310
+ msgstr ""
311
+
312
+ #: admin/class-admin.php:904
313
+ msgid "For Your information:"
314
+ msgstr ""
315
+
316
+ #: admin/class-admin.php:904
317
+ msgid "is turned ON"
318
+ msgstr ""
319
+
320
+ #: admin/class-admin.php:904
321
+ msgid "is turned OFF"
322
+ msgstr ""
323
+
324
+ #: inc/class-gallery.php:85
325
  msgid "Generated using Document Gallery. Get yours here: "
326
  msgstr ""
327
 
328
+ #: inc/class-gallery.php:88
329
  msgid "No attachments to display. How boring! :("
330
  msgstr ""
331
 
332
+ #: inc/class-gallery.php:89
333
  msgid "The %s parameter may only be \"%s\" or \"%s.\" You entered \"%s.\""
334
  msgstr ""
335
 
336
+ #: inc/class-gallery.php:285
337
  msgid "The following ID is invalid: "
338
  msgid_plural "The following IDs are invalid: "
339
  msgstr[0] ""
340
  msgstr[1] ""
341
 
342
+ #: inc/class-gallery.php:378
343
  msgid "The orderby value entered, \"%s,\" is not valid."
344
  msgstr ""
345
 
346
+ #: inc/class-gallery.php:532
347
  msgid "%s is not a valid term name in %s."
348
  msgstr ""
349
 
351
  msgid "Failed to set Imagick page number"
352
  msgstr ""
353
 
354
+ #: inc/class-thumber.php:59
355
+ msgid "Attempting to generate thumbnail for attachment #%d with (%s)"
356
+ msgstr ""
357
+
358
+ #: inc/class-thumber.php:138
359
  msgid "Could not open file: "
360
  msgstr ""
361
 
362
+ #: inc/class-thumber.php:143
363
  msgid "Could not write file: "
364
  msgstr ""
365
 
366
+ #: inc/class-thumber.php:180
367
  msgid "Failed to open file in Imagick: "
368
  msgstr ""
369
 
370
+ #: inc/class-thumber.php:191
371
  msgid "Failed to save image in Imagick: "
372
  msgstr ""
373
 
374
+ #: inc/class-thumber.php:249
375
  msgid "Ghostscript failed: "
376
  msgstr ""
377
 
378
+ #: inc/class-thumber.php:387
379
  msgid "Failed to retrieve thumbnail from Google: "
380
  msgstr ""
381
 
382
+ #: inc/class-thumber.php:631
383
  msgid "Thumbnail Generators: "
384
  msgstr ""
385
 
386
+ #: inc/class-thumber.php:642
387
  msgid "No thumbnail generators enabled."
388
  msgstr ""
389
 
390
+ #: inc/class-thumber.php:685
391
  msgid "Failed to get image editor: "
392
  msgstr ""
393
 
394
+ #: inc/class-thumber.php:697
395
  msgid "Failed to save image: "
396
  msgstr ""
397
 
log/.htaccess ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <FilesMatch "\.(htaccess|log)$">
2
+ Order Allow,Deny
3
+ Deny from all
4
+ </FilesMatch>