PluginProbe
Document Gallery / 3.3
Document Gallery v3.3
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 3.3, at document-gallery.php

95 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: 3.3
9 Author: Dan Rossiter
10 Author URI: http://danrossiter.org/
11 License: GPLv2
12 Text Domain: document-gallery
13 */
14
15 define( 'DG_VERSION', '3.3' );
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
32 // DG general utility functions
33 include_once DG_PATH . 'inc/class-util.php';
34
35 // logging functionality
36 include_once DG_PATH . 'inc/class-logger.php';
37 add_action( DG_Logger::PurgeLogsAction, array( 'DG_Logger', 'purgeExpiredEntries' ) );
38
39 // handle activation, updates, and uninstallation
40 include_once DG_PATH . 'inc/class-setup.php';
41 register_activation_hook( __FILE__, array( 'DG_Setup', 'activate' ) );
42 add_action( 'wpmu_new_blog', array( 'DG_Setup', 'activateNewBlog' ) );
43 register_uninstall_hook( __FILE__, array( 'DG_Setup', 'uninstall' ) );
44 DG_Setup::maybeUpdate();
45
46 // validate options if desired
47 if ( $dg_options['validation'] ) {
48 add_action( 'init', array( 'DocumentGallery', 'addValidation' ) );
49 }
50
51 // I18n
52 add_action( 'plugins_loaded', array( 'DocumentGallery', 'loadTextDomain' ) );
53
54 // cleanup cached data when thumbed attachment deleted
55 include_once DG_PATH . 'inc/class-thumber.php';
56 add_action( 'delete_attachment', array( 'DG_Thumber', 'deleteThumbMeta' ) );
57
58 if ( is_admin() ) {
59 // admin house keeping
60 include_once DG_PATH . 'admin/class-admin.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 // Media Manager integration
74 add_action( 'admin_print_footer_scripts', array(
75 'DG_Admin',
76 'loadCustomTemplates'
77 ) ); //wp_print_scripts || wp_footer
78
79 if ( DG_Admin::doRegisterSettings() ) {
80 add_action( 'admin_init', array( 'DG_Admin', 'registerSettings' ) );
81 }
82 } else {
83 // styling for gallery
84 if ( apply_filters( 'dg_use_default_gallery_style', true ) ) {
85 add_action( 'wp_enqueue_scripts', array( 'DocumentGallery', 'enqueueGalleryStyle' ) );
86 }
87 add_action( 'wp_print_scripts', array( 'DocumentGallery', 'printCustomStyle' ) );
88 }
89
90 // adds 'dg' shortcode
91 add_shortcode( 'dg', array( 'DocumentGallery', 'doShortcode' ) );
92
93 // public API for developers
94 include_once DG_PATH . 'inc/class-api.php';
95