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

93 lines 3.2 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.4.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', '3.4.2' );
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 // ensure we don't allow invalid option structure
47 add_action( 'init', array( 'DocumentGallery', 'addValidation' ) );
48
49 // I18n
50 add_action( 'plugins_loaded', array( 'DocumentGallery', 'loadTextDomain' ) );
51
52 // cleanup cached data when thumbed attachment deleted
53 include_once DG_PATH . 'inc/class-thumber.php';
54 add_action( 'delete_attachment', array( 'DG_Thumber', 'deleteThumbMeta' ) );
55
56 if ( is_admin() ) {
57 // admin house keeping
58 include_once DG_PATH . 'admin/class-admin.php';
59
60 // add links to plugin index
61 add_filter( 'plugin_action_links_' . DG_BASENAME, array( 'DG_Admin', 'addSettingsLink' ) );
62 add_filter( 'plugin_row_meta', array( 'DG_Admin', 'addDonateLink' ), 10, 2 );
63
64 // build options page
65 add_action( 'admin_menu', array( 'DG_Admin', 'addAdminPage' ) );
66
67 // add meta box for managing thumbnail generation to attachment Edit Media page
68 add_action( 'add_meta_boxes', array( 'DG_Admin', 'addMetaBox' ) );
69 add_action( 'wp_ajax_dg_upload_thumb', array( 'DG_Admin', 'saveMetaBox' ) );
70
71 // Media Manager integration
72 add_action( 'admin_print_footer_scripts', array(
73 'DG_Admin',
74 'loadCustomTemplates'
75 ) ); //wp_print_scripts || wp_footer
76
77 if ( DG_Admin::doRegisterSettings() ) {
78 add_action( 'admin_init', array( 'DG_Admin', 'registerSettings' ) );
79 }
80 } else {
81 // styling for gallery
82 if ( apply_filters( 'dg_use_default_gallery_style', true ) ) {
83 add_action( 'wp_enqueue_scripts', array( 'DocumentGallery', 'enqueueGalleryStyle' ) );
84 }
85 add_action( 'wp_print_scripts', array( 'DocumentGallery', 'printCustomStyle' ) );
86 }
87
88 // adds 'dg' shortcode
89 add_shortcode( 'dg', array( 'DocumentGallery', 'doShortcode' ) );
90
91 // public API for developers
92 include_once DG_PATH . 'inc/class-api.php';
93