PluginProbe
Document Gallery / 4.1.4
Document Gallery v4.1.4
trunk 0.8 0.8.5 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 2.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 94 releases
document-gallery / document-gallery.php

document-gallery.php in Document Gallery 4.1.4, at document-gallery.php

91 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'WPINC' ) OR exit;
3
4 /*
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: 4.1.5
9 Author: Dan Rossiter
10 Author URI: http://danrossiter.org/
11 License: GPLv3
12 Text Domain: document-gallery
13 */
14
15 define( 'DG_VERSION', '4.1.5' );
16
17 // define helper paths & URLs
18 define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
19 define( 'DG_URL', plugin_dir_url( __FILE__ ) );
20 define( 'DG_PATH', plugin_dir_path( __FILE__ ) );
21 define( 'DG_WPINC_PATH', ABSPATH . WPINC . '/' );
22 define( 'DG_WPADMIN_PATH', ABSPATH . 'wp-admin/' );
23
24 // init DG options for use throughout plugin
25 global $dg_options;
26 define( 'DG_OPTION_NAME', 'document_gallery' );
27 $dg_options = get_option( DG_OPTION_NAME, null );
28
29 // core functionality
30 include_once DG_PATH . 'inc/class-document-gallery.php';
31 include_once DG_PATH . 'inc/class-thumb.php';
32 include_once DG_PATH . 'inc/class-util.php';
33
34 // logging functionality
35 include_once DG_PATH . 'inc/class-logger.php';
36 add_action( DG_Logger::PurgeLogsAction, array( 'DG_Logger', 'purgeExpiredEntries' ) );
37
38 // handle activation, updates, and uninstallation
39 include_once DG_PATH . 'inc/class-setup.php';
40 register_activation_hook( __FILE__, array( 'DG_Setup', 'activate' ) );
41 add_action( 'wpmu_new_blog', array( 'DG_Setup', 'activateNewBlog' ) );
42 register_uninstall_hook( __FILE__, array( 'DG_Setup', 'uninstall' ) );
43 DG_Setup::maybeUpdate();
44
45 // ensure we don't allow invalid option structure
46 add_action( 'init', array( 'DocumentGallery', 'addValidation' ) );
47
48 // I18n
49 add_action( 'plugins_loaded', array( 'DocumentGallery', 'loadTextDomain' ) );
50
51 // cleanup cached data when thumbed attachment deleted
52 include_once DG_PATH . 'inc/class-thumber.php';
53 add_action( 'delete_attachment', array( 'DG_Thumb', 'cleanupAttachmentMeta' ) );
54
55 if ( is_admin() ) {
56 // admin house keeping
57 include_once DG_PATH . 'admin/class-admin.php';
58
59 // AJAX handling
60 include_once DG_PATH . 'admin/class-ajax-handler.php';
61
62 // add links to plugin index
63 add_filter( 'plugin_action_links_' . DG_BASENAME, array( 'DG_Admin', 'addSettingsLink' ) );
64 add_filter( 'plugin_row_meta', array( 'DG_Admin', 'addDonateLink' ), 10, 2 );
65
66 // build options page
67 add_action( 'admin_menu', array( 'DG_Admin', 'addAdminPage' ) );
68
69 // add meta box for managing thumbnail generation to attachment Edit Media page
70 add_action( 'add_meta_boxes', array( 'DG_Admin', 'addMetaBox' ) );
71 add_action( 'wp_ajax_dg_upload_thumb', array( 'DG_Admin', 'saveMetaBox' ) );
72
73 if ( DG_Admin::doRegisterSettings() ) {
74 add_action( 'admin_init', array( 'DG_Admin', 'registerSettings' ) );
75 }
76 } else {
77 // styling for gallery
78 if ( apply_filters( 'dg_use_default_gallery_style', true ) ) {
79 add_action( 'wp_enqueue_scripts', array( 'DocumentGallery', 'enqueueGalleryStyle' ) );
80 }
81 add_action( 'wp_print_scripts', array( 'DocumentGallery', 'printCustomStyle' ) );
82
83 add_action( 'wp_enqueue_scripts', array( 'DocumentGallery', 'enqueueGalleryScript' ) );
84 }
85
86 // adds 'dg' shortcode
87 add_shortcode( 'dg', array( 'DocumentGallery', 'doShortcode' ) );
88
89 // public API for developers
90 include_once DG_PATH . 'inc/class-api.php';
91