| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: Document Gallery |
| 5 |
Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode. |
| 6 |
Version: 1.4 |
| 7 |
Author: Dan Rossiter |
| 8 |
Author URI: http://danrossiter.org/ |
| 9 |
License: GPL2 |
| 10 |
*/ |
| 11 |
|
| 12 |
define('DG_URL', plugin_dir_url(__FILE__)); |
| 13 |
define('DG_PATH', dirname(__FILE__).'/'); |
| 14 |
|
| 15 |
/** |
| 16 |
* Takes values passed from attributes and returns sutable HTML to represent |
| 17 |
* all valid attachments requested. |
| 18 |
* |
| 19 |
* @param array $atts Arguments from the user. |
| 20 |
* @return string HTML for the Document Gallery. |
| 21 |
*/ |
| 22 |
function dg_get_attachment_icons($atts) { |
| 23 |
include_once(DG_PATH . 'models/class-gallery.php'); |
| 24 |
return (string)(new DG_Gallery($atts)); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* 'document gallery' shortcode depreciated as of v1.0. left for backward compatibility |
| 29 |
*/ |
| 30 |
add_shortcode('document gallery', 'dg_get_attachment_icons'); |
| 31 |
add_shortcode('dg', 'dg_get_attachment_icons'); |
| 32 |
|
| 33 |
/** |
| 34 |
* Include stylesheet for some basic design. |
| 35 |
*/ |
| 36 |
function dg_add_header_css() { |
| 37 |
wp_enqueue_style('document-gallery-css', DG_URL . 'style.css'); |
| 38 |
} |
| 39 |
add_action('wp_print_styles', 'dg_add_header_css'); |