├── admin └── admin.php ├── cleaner-gallery.php ├── css ├── gallery.css └── gallery.min.css ├── inc ├── default-filters.php └── gallery.php ├── languages └── cleaner-gallery.pot ├── license.txt ├── readme.md ├── readme.txt ├── screenshot-1.jpg ├── screenshot-2.jpg ├── screenshot-3.jpg └── screenshot-4.png /admin/admin.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Copyright (c) 2008 - 2014, Justin Tadlock 10 | * @link http://themehybrid.com/plugins/cleaner-gallery 11 | * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 12 | */ 13 | 14 | /* Plugin admin and settings setup. */ 15 | add_action( 'admin_menu', 'cleaner_gallery_admin_setup' ); 16 | 17 | /* Custom meta for plugin on the plugins admin screen. */ 18 | add_filter( 'plugin_row_meta', 'cleaner_gallery_plugin_row_meta', 10, 2 ); 19 | 20 | /** 21 | * Sets up the plugin settings page and registers the plugin settings. 22 | * 23 | * @since 0.9.0 24 | * @access public 25 | * @return void 26 | */ 27 | function cleaner_gallery_admin_setup() { 28 | 29 | /* Add the Cleaner Gallery settings page. */ 30 | $settings = add_theme_page( 31 | __( 'Cleaner Gallery', 'cleaner-gallery' ), 32 | __( 'Cleaner Gallery', 'cleaner-gallery' ), 33 | 'edit_theme_options', 34 | 'cleaner-gallery', 35 | 'cleaner_gallery_settings_page' 36 | ); 37 | 38 | /* Register the plugin settings. */ 39 | add_action( 'admin_init', 'cleaner_gallery_register_settings' ); 40 | } 41 | 42 | /** 43 | * Registers the cleaner gallery settings with WordPress. 44 | * 45 | * @since 0.9.0 46 | * @access public 47 | * @return void 48 | */ 49 | function cleaner_gallery_register_settings() { 50 | register_setting( 'cleaner_gallery_settings', 'cleaner_gallery_settings', 'cleaner_gallery_validate_settings' ); 51 | } 52 | 53 | /** 54 | * Validates/sanitizes the plugins settings after they've been submitted. 55 | * 56 | * @since 0.9.0 57 | * @access public 58 | * @return void 59 | */ 60 | function cleaner_gallery_validate_settings( $settings ) { 61 | 62 | $setttings['size'] = wp_filter_post_kses( $settings['size'] ); 63 | $setttings['image_link'] = wp_filter_post_kses( $settings['image_link'] ); 64 | $setttings['orderby'] = wp_filter_post_kses( $settings['orderby'] ); 65 | $setttings['order'] = wp_filter_post_kses( $settings['order'] ); 66 | $setttings['image_script'] = wp_filter_post_kses( $settings['image_script'] ); 67 | 68 | $settings['caption_remove'] = isset( $settings['caption_remove'] ) ? 1 : 0; 69 | $settings['caption_title'] = isset( $settings['caption_title'] ) ? 1 : 0; 70 | $settings['thickbox_js'] = isset( $settings['thickbox_js'] ) ? 1 : 0; 71 | $settings['thickbox_css'] = isset( $settings['thickbox_css'] ) ? 1 : 0; 72 | 73 | return $settings; 74 | } 75 | 76 | /** 77 | * Displays the settings page for the plugin. 78 | * 79 | * @since 0.9.0 80 | * @access public 81 | * @return void 82 | */ 83 | function cleaner_gallery_settings_page() { 84 | 85 | /* Set up some default empty variables. */ 86 | $size_field = ''; 87 | $image_link_field = ''; 88 | $orderby_field = ''; 89 | $order_field = ''; 90 | 91 | /* Get the available image sizes. */ 92 | foreach ( get_intermediate_image_sizes() as $size ) 93 | $image_sizes[ $size ] = $size; 94 | 95 | $image_sizes = array_merge( 96 | $image_sizes, 97 | array( 98 | 'thumbnail' => __( 'Thumbnail', 'cleaner-gallery' ), 99 | 'medium' => __( 'Medium', 'cleaner-gallery' ), 100 | 'large' => __( 'Large', 'cleaner-gallery' ), 101 | 'full' => __( 'Full', 'cleaner-gallery' ) 102 | ) 103 | ); 104 | 105 | /* WP filter. */ 106 | $image_sizes = apply_filters( 'image_size_names_choose', $image_sizes ); 107 | 108 | /* Set up an array items that gallery items can link to. */ 109 | $image_link = array_merge( 110 | array( 111 | 'none' => __( 'No image or page', 'cleaner-gallery' ), 112 | '' => __( 'Attachment Page', 'cleaner-gallery' ) 113 | ), 114 | $image_sizes 115 | ); 116 | 117 | /* Set up an array of orderby options. */ 118 | $orderby_options = array( 119 | 'comment_count' => __( 'Comment Count', 'cleaner-gallery' ), 120 | 'date' => __( 'Date', 'cleaner-gallery' ), 121 | 'ID' => __( 'ID', 'cleaner-gallery' ), 122 | 'menu_order ID' => __( 'Menu Order', 'cleaner-gallery' ), 123 | 'none' => __( 'None', 'cleaner-gallery' ), 124 | 'rand' => __( 'Random', 'cleaner-gallery' ), 125 | 'title' => __( 'Title', 'cleaner-gallery' ) 126 | ); 127 | 128 | /* Set up an array of ordering options. */ 129 | $order_options = array( 130 | 'ASC' => __( 'Ascending', 'cleaner-gallery' ), 131 | 'DESC' => __( 'Descending', 'cleaner_gallery' ) 132 | ); 133 | 134 | /* Set up an array of supported Lightbox-type scripts the plugin supports. */ 135 | $scripts = cleaner_gallery_get_supported_scripts(); 136 | 137 | /* === Set up form fields for use inline with text. === */ 138 | 139 | /* Set up the image size select element. */ 140 | foreach ( $image_sizes as $size => $label ) 141 | $size_field .= ''; 142 | $size_field = ''; 143 | 144 | /* Set up the image link select element. */ 145 | foreach ( $image_link as $option => $option_name ) 146 | $image_link_field .= ''; 147 | $image_link_field = ''; 148 | 149 | /* Set up the orderby select element. */ 150 | foreach ( $orderby_options as $option => $option_name ) 151 | $orderby_field .= ''; 152 | $orderby_field = ''; 153 | 154 | /* Set up the order select element. */ 155 | foreach ( $order_options as $option => $option_name ) 156 | $order_field .= ''; 157 | $order_field = ''; 158 | 159 | ?> 160 | 161 |
162 | 163 | 164 | 165 |

166 | 167 |

' . __( 'Settings saved.', 'cleaner-gallery' ) . '

'; ?> 168 | 169 |
170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 190 | 191 | 192 | 193 | 194 | 201 | 202 | 203 | 204 | 205 | 212 | 213 | 214 | 215 | 216 | 228 | 229 | 230 | 231 | 232 | 239 | 240 |
178 | 179 |
180 | 181 |
182 | 183 |
184 | 185 |
186 |

187 | 188 |

189 |
195 | value="true" /> 196 | 197 |
198 | value="true" /> 199 | 200 |
206 | value="true" /> 207 | 208 |
209 | value="true" /> 210 | 211 |
217 | 223 |
224 |

225 | 226 |

227 |
233 |

234 |
    235 |
  • 236 |
  • 237 |
238 |
241 | 242 | 243 | 244 |
245 | 246 | ' . __( 'Plugin support', 'cleaner-gallery' ) . ''; 261 | $meta[] = '' . __( 'Rate plugin', 'cleaner-gallery' ) . ''; 262 | $meta[] = '' . __( 'Donate', 'cleaner-gallery' ) . ''; 263 | } 264 | 265 | return $meta; 266 | } 267 | 268 | /** 269 | * @since 0.9.0 270 | * @deprecated 1.0.0 271 | */ 272 | function cleaner_gallery_load_settings_page() { 273 | _deprecated_function( __FUNCTION__, '1.0.0', '' ); 274 | } 275 | -------------------------------------------------------------------------------- /cleaner-gallery.php: -------------------------------------------------------------------------------- 1 | [gallery] shortcode with valid HTML5 markup and moves its inline styles to a proper stylesheet. Integrates with many Lightbox-type image scripts. 6 | * Version: 1.1.0 7 | * Author: Justin Tadlock 8 | * Author URI: http://justintadlock.com 9 | * Text Domain: cleaner-gallery 10 | * Domain Path: /languages 11 | * 12 | * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 13 | * General Public License as published by the Free Software Foundation; either version 2 of the License, 14 | * or (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 17 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | * 19 | * You should have received a copy of the GNU General Public License along with this program; if not, write 20 | * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | * @package CleanerGallery 23 | * @version 1.1.0 24 | * @author Justin Tadlock 25 | * @copyright Copyright (c) 2008 - 2014, Justin Tadlock 26 | * @link http://themehybrid.com/plugins/cleaner-gallery 27 | * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 28 | */ 29 | 30 | /** 31 | * Sets up the Cleaner Gallery plugin. 32 | * 33 | * @since 1.0.0 34 | */ 35 | final class Cleaner_Gallery_Plugin { 36 | 37 | /** 38 | * Holds the instance of this class. 39 | * 40 | * @since 1.0.0 41 | * @access private 42 | * @var object 43 | */ 44 | private static $instance; 45 | 46 | /** 47 | * Stores the directory path for this plugin. 48 | * 49 | * @since 1.0.0 50 | * @access private 51 | * @var string 52 | */ 53 | private $directory_path; 54 | 55 | /** 56 | * Stores the directory URI for this plugin. 57 | * 58 | * @since 1.0.0 59 | * @access private 60 | * @var string 61 | */ 62 | private $directory_uri; 63 | 64 | /** 65 | * Plugin setup. 66 | * 67 | * @since 1.0.0 68 | * @access public 69 | * @return void 70 | */ 71 | public function __construct() { 72 | 73 | /* Set the properties needed by the plugin. */ 74 | add_action( 'plugins_loaded', array( $this, 'setup' ), 1 ); 75 | 76 | /* Internationalize the text strings used. */ 77 | add_action( 'plugins_loaded', array( $this, 'i18n' ), 2 ); 78 | 79 | /* Load the functions files. */ 80 | add_action( 'plugins_loaded', array( $this, 'includes' ), 3 ); 81 | 82 | /* Load the admin files. */ 83 | add_action( 'plugins_loaded', array( $this, 'admin' ), 4 ); 84 | 85 | /* Check theme support for 'cleaner-gallery'. */ 86 | add_action( 'after_setup_theme', array( $this, 'theme_support' ), 25 ); 87 | 88 | /* Enqueue scripts and styles. */ 89 | add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 15 ); 90 | } 91 | 92 | /** 93 | * Defines the directory path and URI for the plugin. 94 | * 95 | * @since 1.0.0 96 | * @access public 97 | * @return void 98 | */ 99 | public function setup() { 100 | $this->directory_path = trailingslashit( plugin_dir_path( __FILE__ ) ); 101 | $this->directory_uri = trailingslashit( plugin_dir_url( __FILE__ ) ); 102 | 103 | /* Legacy */ 104 | define( 'CLEANER_GALLERY_DIR', $this->directory_path ); 105 | define( 'CLEANER_GALLERY_URI', $this->directory_uri ); 106 | } 107 | 108 | /** 109 | * Loads the initial files needed by the plugin. 110 | * 111 | * @since 1.0.0 112 | * @access public 113 | * @return void 114 | */ 115 | public function includes() { 116 | 117 | require_once( "{$this->directory_path}inc/gallery.php" ); 118 | require_once( "{$this->directory_path}inc/default-filters.php" ); 119 | } 120 | 121 | /** 122 | * Loads the translation files. 123 | * 124 | * @since 1.0.0 125 | * @access public 126 | * @return void 127 | */ 128 | public function i18n() { 129 | 130 | /* Load the translation of the plugin. */ 131 | load_plugin_textdomain( 'cleaner-gallery', false, 'cleaner-gallery/languages' ); 132 | } 133 | 134 | /** 135 | * Loads the admin functions and files. 136 | * 137 | * @since 1.0.0 138 | * @access public 139 | * @return void 140 | */ 141 | public function admin() { 142 | 143 | if ( is_admin() ) 144 | require_once( "{$this->directory_path}admin/admin.php" ); 145 | } 146 | 147 | /** 148 | * Checks for theme support of the 'cleaner-gallery' extension. This is used in the Hybrid 149 | * Core framework, so we want to make sure we're only loading the plugin stylesheet if the 150 | * theme is not handling styling for the gallery. 151 | * 152 | * @since 1.1.0 153 | * @access public 154 | * @return void 155 | */ 156 | public function theme_support() { 157 | 158 | if ( !current_theme_supports( 'cleaner-gallery' ) ) 159 | add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 160 | } 161 | 162 | /** 163 | * Enqueues scripts and styles on the front end. 164 | * 165 | * @since 1.0.0 166 | * @access public 167 | * @return void 168 | */ 169 | public function enqueue_scripts() { 170 | 171 | if ( cleaner_gallery_get_setting( 'thickbox_js' ) ) 172 | wp_enqueue_script( 'thickbox' ); 173 | 174 | if ( cleaner_gallery_get_setting( 'thickbox_css' ) ) 175 | wp_enqueue_style( 'thickbox' ); 176 | } 177 | 178 | 179 | /** 180 | * Enqueues the Cleaner Gallery stylesheet. 181 | * 182 | * @since 1.1.0 183 | * @access public 184 | * @return void 185 | */ 186 | public function enqueue_styles() { 187 | wp_enqueue_style( 'cleaner-gallery', "{$this->directory_uri}css/gallery.min.css", null, '20130526' ); 188 | } 189 | 190 | /** 191 | * Returns the instance. 192 | * 193 | * @since 1.0.0 194 | * @access public 195 | * @return object 196 | */ 197 | public static function get_instance() { 198 | 199 | if ( !self::$instance ) 200 | self::$instance = new self; 201 | 202 | return self::$instance; 203 | } 204 | } 205 | 206 | Cleaner_Gallery_Plugin::get_instance(); 207 | -------------------------------------------------------------------------------- /css/gallery.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Cleaner Gallery Stylesheet 3 | * @version 20130526 4 | */ 5 | 6 | .gallery { 7 | display: block; 8 | clear: both; 9 | overflow: hidden; 10 | margin: 0 auto; 11 | } 12 | 13 | .gallery-row { 14 | display: block; 15 | clear: both; 16 | overflow: hidden; 17 | margin: 0; 18 | } 19 | 20 | .gallery-item { 21 | overflow: hidden; 22 | float: left; 23 | margin: 0; 24 | padding: 0; 25 | text-align: center; 26 | list-style: none; 27 | border: none; 28 | background: transparent; 29 | 30 | -webkit-box-sizing: border-box; 31 | -moz-box-sizing: border-box; 32 | box-sizing: border-box; 33 | } 34 | 35 | .gallery-icon {} 36 | 37 | .gallery-icon img { 38 | width: auto; 39 | max-width: 89%; 40 | height: auto; 41 | margin: 0 auto; 42 | padding: 1%; 43 | 44 | -webkit-box-sizing: border-box; 45 | -moz-box-sizing: border-box; 46 | box-sizing: border-box; 47 | } 48 | 49 | .gallery-caption { 50 | margin-left: 0; 51 | 52 | -webkit-box-sizing: border-box; 53 | -moz-box-sizing: border-box; 54 | box-sizing: border-box; 55 | } 56 | 57 | /* Gallery item sizes depending on the number of columns */ 58 | .gallery-col-0 .gallery-item { width: 100%; } 59 | .gallery-col-1 .gallery-item { width: 100%; } 60 | .gallery-col-2 .gallery-item { width: 50%; } 61 | .gallery-col-3 .gallery-item { width: 33.33%; } 62 | .gallery-col-4 .gallery-item { width: 25%; } 63 | .gallery-col-5 .gallery-item { width: 20%; } 64 | .gallery-col-6 .gallery-item { width: 16.66%; } 65 | .gallery-col-7 .gallery-item { width: 14.28%; } 66 | .gallery-col-8 .gallery-item { width: 12.5%; } 67 | .gallery-col-9 .gallery-item { width: 11.11%; } 68 | .gallery-col-10 .gallery-item { width: 10%; } 69 | .gallery-col-11 .gallery-item { width: 9.09%; } 70 | .gallery-col-12 .gallery-item { width: 8.33%; } 71 | .gallery-col-13 .gallery-item { width: 7.69%; } 72 | .gallery-col-14 .gallery-item { width: 7.14%; } 73 | .gallery-col-15 .gallery-item { width: 6.66%; } 74 | .gallery-col-16 .gallery-item { width: 6.25%; } 75 | .gallery-col-17 .gallery-item { width: 5.88%; } 76 | .gallery-col-18 .gallery-item { width: 5.55%; } 77 | .gallery-col-19 .gallery-item { width: 5.26%; } 78 | .gallery-col-20 .gallery-item { width: 5%; } 79 | .gallery-col-21 .gallery-item { width: 4.76%; } 80 | .gallery-col-22 .gallery-item { width: 4.54%; } 81 | .gallery-col-23 .gallery-item { width: 4.34%; } 82 | .gallery-col-24 .gallery-item { width: 4.16%; } 83 | .gallery-col-25 .gallery-item { width: 4%; } 84 | .gallery-col-26 .gallery-item { width: 3.84%; } 85 | .gallery-col-27 .gallery-item { width: 3.7%; } 86 | .gallery-col-28 .gallery-item { width: 3.57%; } 87 | .gallery-col-29 .gallery-item { width: 3.44%; } 88 | .gallery-col-30 .gallery-item { width: 3.33%; } -------------------------------------------------------------------------------- /css/gallery.min.css: -------------------------------------------------------------------------------- 1 | .gallery{display: block;clear: both;overflow:hidden;margin: 0 auto}.gallery-row{display: block;clear: both;overflow:hidden;margin: 0}.gallery-item{overflow: hidden;float: left;margin: 0;padding: 0;text-align:center;list-style:none;border: none;background:transparent;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-icon{}.gallery-icon img{width: auto;max-width:89%;height: auto;margin: 0 auto;padding: 1%;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-caption{margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-col-0 .gallery-item {width:100%}.gallery-col-1 .gallery-item {width:100%}.gallery-col-2 .gallery-item {width:50%}.gallery-col-3 .gallery-item {width:33.33%}.gallery-col-4 .gallery-item {width:25%}.gallery-col-5 .gallery-item {width:20%}.gallery-col-6 .gallery-item {width:16.66%}.gallery-col-7 .gallery-item {width:14.28%}.gallery-col-8 .gallery-item {width:12.5%}.gallery-col-9 .gallery-item {width:11.11%}.gallery-col-10 .gallery-item{width:10%}.gallery-col-11 .gallery-item{width:9.09%}.gallery-col-12 .gallery-item{width:8.33%}.gallery-col-13 .gallery-item{width:7.69%}.gallery-col-14 .gallery-item{width:7.14%}.gallery-col-15 .gallery-item{width:6.66%}.gallery-col-16 .gallery-item{width:6.25%}.gallery-col-17 .gallery-item{width:5.88%}.gallery-col-18 .gallery-item{width:5.55%}.gallery-col-19 .gallery-item{width:5.26%}.gallery-col-20 .gallery-item{width:5%}.gallery-col-21 .gallery-item{width:4.76%}.gallery-col-22 .gallery-item{width:4.54%}.gallery-col-23 .gallery-item{width:4.34%}.gallery-col-24 .gallery-item{width:4.16%}.gallery-col-25 .gallery-item{width:4%}.gallery-col-26 .gallery-item{width:3.84%}.gallery-col-27 .gallery-item{width:3.7%}.gallery-col-28 .gallery-item{width:3.57%}.gallery-col-29 .gallery-item{width:3.44%}.gallery-col-30 .gallery-item{width:3.33%} -------------------------------------------------------------------------------- /inc/default-filters.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Copyright (c) 2008 - 2014, Justin Tadlock 9 | * @link http://themehybrid.com/plugins/cleaner-gallery 10 | * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 11 | * 12 | 13 | /* Filter the gallery images with user options. */ 14 | add_filter( 'cleaner_gallery_image', 'cleaner_gallery_plugin_gallery_image', 10, 4 ); 15 | 16 | /* Filter the gallery captions with user options. */ 17 | add_filter( 'cleaner_gallery_caption', 'cleaner_gallery_plugin_image_caption', 10, 3 ); 18 | 19 | /* Filter the cleaner gallery default shortcode attributes. */ 20 | add_filter( 'cleaner_gallery_defaults', 'cleaner_gallery_default_args' ); 21 | 22 | /** 23 | * @since 0.9.0 24 | * @access public 25 | * @return array 26 | */ 27 | function cleaner_gallery_default_settings() { 28 | 29 | $settings = array( 30 | 'size' => 'thumbnail', 31 | 'image_link' => '', 32 | 'orderby' => 'menu_order ID', 33 | 'order' => 'ASC', 34 | 'caption_remove' => false, 35 | 'caption_title' => false, 36 | 'thickbox_js' => false, 37 | 'thickbox_css' => false, 38 | 'image_script' => '' 39 | ); 40 | 41 | return $settings; 42 | } 43 | 44 | /** 45 | * Function for quickly grabbing settings for the plugin without having to call get_option() 46 | * every time we need a setting. 47 | * 48 | * @since 0.8.0 49 | * @access public 50 | * @param string $option 51 | * @return mixed 52 | */ 53 | function cleaner_gallery_get_setting( $option = '' ) { 54 | 55 | $settings = get_option( 'cleaner_gallery_settings', cleaner_gallery_default_settings() ); 56 | 57 | return $settings[ $option ]; 58 | } 59 | 60 | /** 61 | * @since 1.0.0 62 | * @access public 63 | * @return array 64 | */ 65 | function cleaner_gallery_get_supported_scripts() { 66 | 67 | $scripts = array( 68 | 'colorbox' => __( 'Colorbox', 'cleaner-gallery' ), 69 | 'fancybox' => __( 'FancyBox', 'cleaner-gallery' ), 70 | 'fancyzoom' => __( 'FancyZoom', 'cleaner-gallery' ), 71 | 'floatbox' => __( 'Floatbox', 'cleaner-gallery' ), 72 | 'greybox' => __( 'GreyBox', 'cleaner-gallery' ), 73 | 'jquery_lightbox' => __( 'jQuery Lightbox', 'cleaner-gallery' ), 74 | 'jquery_lightbox_plugin' => __( 'jQuery Lightbox Plugin', 'cleaner-gallery' ), 75 | 'jquery_lightbox_balupton' => __( 'jQuery Lightbox (Balupton)', 'cleaner-gallery' ), 76 | 'lightbox' => __( 'Lightbox', 'cleaner-gallery' ), 77 | 'lightview' => __( 'Lightview', 'cleaner-gallery' ), 78 | 'lightwindow' => __( 'LightWindow', 'cleaner-gallery' ), 79 | 'lytebox' => __( 'Lytebox', 'cleaner-gallery' ), 80 | 'pretty_photo' => __( 'prettyPhoto', 'cleaner-gallery' ), 81 | 'shadowbox' => __( 'Shadowbox', 'cleaner-gallery' ), 82 | 'shutter_reloaded' => __( 'Shutter Reloaded', 'cleaner-gallery' ), 83 | 'slimbox' => __( 'Slimbox', 'cleaner-gallery' ), 84 | 'thickbox' => __( 'Thickbox', 'cleaner-gallery' ) 85 | ); 86 | 87 | return apply_filters( 'cleaner_gallery_supported_scripts', $scripts ); 88 | } 89 | 90 | /** 91 | * Filters the default gallery arguments with user-selected arguments or the plugin defaults. 92 | * 93 | * @since 0.9.0 94 | * @access public 95 | * @param array $defaults 96 | * @return array 97 | */ 98 | function cleaner_gallery_default_args( $defaults ) { 99 | 100 | $defaults['order'] = cleaner_gallery_get_setting( 'order' ) ? cleaner_gallery_get_setting( 'order' ) : 'ASC'; 101 | $defaults['orderby'] = cleaner_gallery_get_setting( 'orderby' ) ? cleaner_gallery_get_setting( 'orderby' ) : 'menu_order ID'; 102 | $defaults['size'] = cleaner_gallery_get_setting( 'size' ) ? cleaner_gallery_get_setting( 'size' ) : 'thumbnail'; 103 | $defaults['link'] = cleaner_gallery_get_setting( 'image_link' ) ? cleaner_gallery_get_setting( 'image_link' ) : ''; 104 | 105 | return $defaults; 106 | } 107 | 108 | /** 109 | * Filters the gallery image if it has a link and adds the appropriate attributes for the lightbox 110 | * scripts. 111 | * 112 | * @since 0.9.0 113 | * @access public 114 | * @param string $image 115 | * @param int $id 116 | * @param array $attr 117 | * @param int $instance 118 | * @return string 119 | */ 120 | function cleaner_gallery_plugin_gallery_image( $image, $id, $attr, $instance ) { 121 | 122 | /* If the image should link to the 'file' (full-size image), add in extra link attributes. */ 123 | if ( 'file' == $attr['link'] ) { 124 | 125 | $attributes = cleaner_gallery_link_attributes( $instance ); 126 | 127 | if ( !empty( $attributes ) ) 128 | $image = str_replace( 'post_title ) . "'"; 140 | 141 | $image = preg_replace( '/(.*?)<\/a>/', "$1", $image ); 142 | } 143 | 144 | /* Return the formatted image. */ 145 | return $image; 146 | } 147 | 148 | /** 149 | * Modifies the gallery captions according to user-selected settings. 150 | * 151 | * @since 0.9.0 152 | * @access public 153 | * @param string $caption 154 | * @param int $id 155 | * @param array $attr 156 | * @return string 157 | */ 158 | function cleaner_gallery_plugin_image_caption( $caption, $id, $attr ) { 159 | 160 | /* If the caption should be removed, return empty string. */ 161 | if ( cleaner_gallery_get_setting( 'caption_remove' ) ) 162 | $caption = ''; 163 | 164 | /* If the caption is empty and the user is using the title as a caption, get the image title. */ 165 | else if ( empty( $caption ) && cleaner_gallery_get_setting( 'caption_title' ) ) 166 | $caption = wptexturize( get_the_title( $id ) ); 167 | 168 | /* Return the caption. */ 169 | return $caption; 170 | } 171 | 172 | /** 173 | * Returns the link class and rel attributes based on what the user selected in the plugin 174 | * settings. This is important for handling Lightbox-type image scripts. 175 | * 176 | * @since 0.7.0 177 | * @access public 178 | * @param int $id 179 | * @return string 180 | */ 181 | function cleaner_gallery_link_attributes( $id = 0 ) { 182 | 183 | $script = cleaner_gallery_get_setting( 'image_script' ); 184 | 185 | if ( !array_key_exists( $script, cleaner_gallery_get_supported_scripts() ) ) 186 | return ''; 187 | 188 | switch ( $script ) { 189 | 190 | case 'lightbox' : 191 | case 'slimbox' : 192 | case 'jquery_lightbox_plugin' : 193 | case 'jquery_lightbox_balupton' : 194 | 195 | $class = 'lightbox'; 196 | $rel = "lightbox[cleaner-gallery-{$id}]"; 197 | break; 198 | 199 | case 'colorbox' : 200 | 201 | $class = "colorbox colorbox-{$id}"; 202 | $rel = "colorbox-{$id}"; 203 | break; 204 | 205 | case 'jquery_lightbox' : 206 | 207 | $class = 'lightbox'; 208 | $rel = "cleaner-gallery-{$id}"; 209 | break; 210 | 211 | case 'lightwindow' : 212 | 213 | $class = 'lightwindow'; 214 | $rel = "lightwindow[cleaner-gallery-{$id}]"; 215 | break; 216 | 217 | case 'floatbox' : 218 | 219 | $class = 'floatbox'; 220 | $rel = "floatbox.cleaner-gallery-{$id}"; 221 | break; 222 | 223 | case 'shutter_reloaded' : 224 | 225 | $class = "shutterset_cleaner-gallery-{$id}"; 226 | $rel = "lightbox[cleaner-gallery-{$id}]"; 227 | break; 228 | 229 | case 'fancybox' : 230 | 231 | $class = 'fancybox'; 232 | $rel = "fancybox-{$id}"; 233 | break; 234 | 235 | case 'greybox' : 236 | 237 | $class = 'greybox'; 238 | $rel = "gb_imageset[cleaner-gallery-{$id}]"; 239 | break; 240 | 241 | case 'lightview' : 242 | 243 | $class = 'lightview'; 244 | $rel = "gallery[cleaner-gallery-{$id}]"; 245 | break; 246 | 247 | case 'lytebox' : 248 | 249 | $class = 'lytebox'; 250 | $rel = "lytebox[cleaner-gallery-{$id}]"; 251 | break; 252 | 253 | case 'thickbox' : 254 | 255 | $class = 'thickbox'; 256 | $rel = "clean-gallery-{$id}"; 257 | break; 258 | 259 | case 'shadowbox' : 260 | 261 | $class = 'shadowbox'; 262 | $rel = "shadowbox[cleaner-gallery-{$id}]"; 263 | break; 264 | 265 | case 'pretty_photo' : 266 | 267 | $class = 'prettyPhoto'; 268 | $rel = "prettyPhoto[{$id}]"; 269 | break; 270 | 271 | case 'fancyzoom' : 272 | default : 273 | 274 | $class = ''; 275 | $rel = ''; 276 | break; 277 | } 278 | 279 | $class = apply_filters( 'cleaner_gallery_image_link_class', $class ); 280 | $rel = apply_filters( 'cleaner_gallery_image_link_rel', $rel ); 281 | 282 | $class = !empty( $class ) ? " class='{$class}'" : ''; 283 | $rel = !empty( $rel ) ? " rel='{$rel}'" : ''; 284 | 285 | return $class . $rel; 286 | } 287 | 288 | /* === DEPRECATED === */ 289 | 290 | /** 291 | * @since 0.8.0 292 | * @deprecated 1.0.0 293 | */ 294 | function cleaner_gallery_enqueue_style() { 295 | _deprecated_function( __FUNCTION__, '1.0.0', '' ); 296 | } 297 | 298 | /** 299 | * @since 0.8.0 300 | * @deprecated 1.0.0 301 | */ 302 | function cleaner_gallery_enqueue_script() { 303 | _deprecated_function( __FUNCTION__, '1.0.0', '' ); 304 | } 305 | 306 | /** 307 | * @since 0.8.0 308 | * @deprecated 1.0.0 309 | */ 310 | function cleaner_gallery_setup() { 311 | _deprecated_function( __FUNCTION__, '1.0.0', '' ); 312 | } 313 | 314 | /** 315 | * @since 0.7.0 316 | * @deprecated 0.9.0 317 | */ 318 | function cleaner_gallery_id( $id = 0 ) { 319 | _deprecated_function( __FUNCTION__, '0.9.0', '' ); 320 | } 321 | -------------------------------------------------------------------------------- /inc/gallery.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Copyright (c) 2008 - 2014, Justin Tadlock 21 | * @link http://justintadlock.com/archives/2008/04/13/cleaner-wordpress-gallery-plugin 22 | * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 23 | */ 24 | 25 | /** 26 | * Cleaner Gallery class. This wraps everything up nicely. 27 | * 28 | * @since 1.1.0 29 | */ 30 | final class Cleaner_Gallery { 31 | 32 | /** 33 | * Holds the instance of this class. 34 | * 35 | * @since 1.1.0 36 | * @access private 37 | * @var object 38 | */ 39 | private static $instance; 40 | 41 | /** 42 | * Array of all the arguments for the gallery. 43 | * 44 | * @since 1.1.0 45 | * @access public 46 | * @var array 47 | */ 48 | public $args = array(); 49 | 50 | /** 51 | * Instance of the gallery for this post. Used so that galleries don't have duplicate IDs 52 | * when there's multiple galleries in a post. 53 | * 54 | * @since 1.1.0 55 | * @access public 56 | * @var int 57 | */ 58 | public $gallery_instance = 0; 59 | 60 | /** 61 | * Type of gallery currently being viewed. 62 | * 63 | * @since 1.1.0 64 | * @access public 65 | * @var string 66 | */ 67 | public $gallery_type = ''; 68 | 69 | /** 70 | * Array of all the media mime types in the current gallery. 71 | * 72 | * @since 1.1.0 73 | * @access public 74 | * @var array 75 | */ 76 | public $mime_types = array(); 77 | 78 | /** 79 | * Whether a gallery item has a caption. This changes per image. 80 | * 81 | * @since 1.1.0 82 | * @access public 83 | * @var bool 84 | */ 85 | public $has_caption = false; 86 | 87 | /** 88 | * 89 | * @since 1.1.0 90 | * @access public 91 | * @return void 92 | */ 93 | public function __construct() { 94 | 95 | /* Filter the post gallery shortcode output. */ 96 | add_filter( 'post_gallery', array( $this, 'gallery_shortcode' ), 10, 2 ); 97 | } 98 | 99 | /** 100 | * Filter for the 'post_gallery' hook, which is run when WordPress' [gallery] shortcode is 101 | * executed. This is the main function that handles the output of the new gallery. 102 | * 103 | * @since 1.1.0 104 | * @access public 105 | * @param string $output 106 | * @param array $attr 107 | * @return string 108 | */ 109 | public function gallery_shortcode( $output, $attr ) { 110 | 111 | /* We're not worried about galleries in feeds, so just return the output here. */ 112 | if ( is_feed() ) 113 | return $output; 114 | 115 | /* Filters to add Schema.org microdata support. */ 116 | add_filter( 'wp_get_attachment_image_attributes', array( $this, 'attachment_image_attributes' ), 5, 2 ); 117 | add_filter( 'wp_get_attachment_link', array( $this, 'get_attachment_link' ), 5 ); 118 | 119 | /* Iterate the gallery istance. */ 120 | $this->gallery_instance++; 121 | 122 | /* Set the gallery item iterator to 0. */ 123 | $i = 0; 124 | 125 | /* Set up the arguments. */ 126 | $this->set_up_args( $attr ); 127 | 128 | /* Set up the query arguments for getting the attachments. */ 129 | $children = array( 130 | 'post_status' => 'inherit', 131 | 'post_type' => 'attachment', 132 | 'post_mime_type' => $this->args['mime_type'], 133 | 'order' => $this->args['order'], 134 | 'orderby' => $this->args['orderby'], 135 | 'exclude' => $this->args['exclude'], 136 | 'include' => $this->args['include'], 137 | 'numberposts' => $this->args['numberposts'], 138 | 'offset' => $this->args['offset'], 139 | 'suppress_filters' => true 140 | ); 141 | 142 | /* If specific IDs should not be included, use the get_children() function. */ 143 | if ( empty( $this->args['include'] ) ) { 144 | $attachments = get_children( array_merge( array( 'post_parent' => $this->args['id'] ), $children ) ); 145 | } 146 | 147 | /* If getting specific attachments by ID, use get_posts(). */ 148 | else { 149 | $attachments = get_posts( $children ); 150 | } 151 | 152 | /* If there are no attachments, return an empty string. */ 153 | if ( empty( $attachments ) ) 154 | return ''; 155 | 156 | /* Count the number of attachments returned. */ 157 | $attachment_count = count( $attachments ); 158 | 159 | /* Allow developers to overwrite the number of columns. This can be useful for reducing columns with with fewer images than number of columns. */ 160 | //$columns = ( ( $columns <= $attachment_count ) ? intval( $columns ) : intval( $attachment_count ) ); 161 | $this->args['columns'] = apply_filters( 'cleaner_gallery_columns', intval( $this->args['columns'] ), $attachment_count, $this->args ); 162 | 163 | /* Loop through each attachment. */ 164 | foreach ( $attachments as $attachment ) { 165 | 166 | /* Open each gallery row. */ 167 | if ( $this->args['columns'] > 0 && $i % $this->args['columns'] == 0 ) 168 | $output .= "\n\t\t\t\t"; 176 | } 177 | 178 | /* Close gallery row. */ 179 | if ( $this->args['columns'] > 0 && $i % $this->args['columns'] !== 0 ) 180 | $output .= "\n\t\t\t"; 181 | 182 | /* Remove filters for Schema.org microdata support. */ 183 | remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'attachment_image_attributes' ) ); 184 | remove_filter( 'wp_get_attachment_link', array( $this, 'get_attachment_link' ) ); 185 | 186 | /* Gallery attributes. */ 187 | $gallery_attr = sprintf( "id='%s'", esc_attr( $this->args['id'] ) . '-' . esc_attr( $this->gallery_instance ) ); 188 | $gallery_attr .= sprintf( " class='gallery gallery-%s gallery-columns-%s gallery-size-%s'", esc_attr( $this->args['id'] ), esc_attr( $this->args['columns'] ), sanitize_html_class( $this->args['size'] ) ); 189 | $gallery_attr .= sprintf( " itemscope itemtype='%s'", esc_attr( $this->get_gallery_itemtype() ) ); 190 | 191 | /* Return out very nice, valid HTML gallery. */ 192 | return "\n\t\t\t" . sprintf( '
', $gallery_attr ) . $output . "\n\t\t\t
\n"; 193 | } 194 | 195 | /** 196 | * Method for setting up, parsing, and providing filter hooks for the arguments. 197 | * 198 | * @since 1.1.0 199 | * @access public 200 | * @return void 201 | */ 202 | public function set_up_args( $attr ) { 203 | 204 | /* Orderby. */ 205 | if ( isset( $attr['orderby'] ) ) { 206 | $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); 207 | if ( !$attr['orderby'] ) 208 | unset( $attr['orderby'] ); 209 | } 210 | 211 | /* Default gallery settings. */ 212 | $defaults = array( 213 | 'order' => 'ASC', 214 | 'orderby' => 'menu_order ID', 215 | 'id' => get_the_ID(), 216 | 'mime_type' => 'image', 217 | 'link' => '', 218 | 'itemtag' => 'figure', 219 | 'icontag' => 'div', 220 | 'captiontag' => 'figcaption', 221 | 'columns' => 3, 222 | 'size' => has_image_size( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail', 223 | 'ids' => '', 224 | 'include' => '', 225 | 'exclude' => '', 226 | 'numberposts' => -1, 227 | 'offset' => '' 228 | ); 229 | 230 | /* Apply filters to the default arguments. */ 231 | $defaults = apply_filters( 'cleaner_gallery_defaults', $defaults ); 232 | 233 | /* Merge the defaults with user input. */ 234 | $this->args = shortcode_atts( $defaults, $attr ); 235 | 236 | /* Apply filters to the arguments. */ 237 | $this->args = apply_filters( 'cleaner_gallery_args', $this->args ); 238 | 239 | /* Make sure the post ID is a valid integer. */ 240 | $this->args['id'] = intval( $this->args['id'] ); 241 | 242 | /* Properly escape the gallery tags. */ 243 | $this->args['itemtag'] = tag_escape( $this->args['itemtag'] ); 244 | $this->args['icontag'] = tag_escape( $this->args['icontag'] ); 245 | $this->args['captiontag'] = tag_escape( $this->args['captiontag'] ); 246 | } 247 | 248 | /** 249 | * Formats and returns the gallery item. The gallery item is composed of both the gallery 250 | * icon (image) and gallery caption. 251 | * 252 | * @since 1.1.0 253 | * @access public 254 | * @param object $attachment 255 | * @return string 256 | */ 257 | public function get_gallery_item( $attachment ) { 258 | 259 | /* Get the mime type for the current attachment. */ 260 | list( $type, $subtype ) = false !== strpos( $attachment->post_mime_type, '/' ) ? explode( '/', $attachment->post_mime_type ) : array( $attachment->post_mime_type, '' ); 261 | 262 | /* Add the mime type to the array of mime types for the gallery. */ 263 | $this->mime_types[] = $type; 264 | 265 | /* Set up the itemtype for the media based off the mime type. */ 266 | if ( 'image' === $type ) 267 | $itemtype = 'http://schema.org/ImageObject'; 268 | elseif ( 'video' === $type ) 269 | $itemtype = 'http://schema.org/VideoObject'; 270 | elseif ( 'audio' === $type ) 271 | $itemtype = 'http://schema.org/AudioObject'; 272 | else 273 | $itemtype = 'http://schema.org/MediaObject'; 274 | 275 | /* Open each gallery item. */ 276 | $output = "\n\t\t\t\t\t<{$this->args['itemtag']} class='gallery-item col-{$this->args['columns']}' itemprop='associatedMedia' itemscope itemtype='{$itemtype}'>"; 277 | 278 | /* Get the gallery caption first b/c we need it for 'aria-describedby'. */ 279 | $caption = $this->get_gallery_caption( $attachment ); 280 | 281 | /* Get the gallery icon. */ 282 | $icon = $this->get_gallery_icon( $attachment ); 283 | 284 | /* Add the icon and caption. */ 285 | $output .= $icon . $caption; 286 | 287 | /* Close individual gallery item. */ 288 | $output .= "\n\t\t\t\t\targs['itemtag']}>"; 289 | 290 | return $output; 291 | } 292 | 293 | /** 294 | * Gets the gallery icon, which is the gallery image. Formats the output. 295 | * 296 | * @since 1.1.0 297 | * @access public 298 | * @param object $attachment 299 | * @return string 300 | */ 301 | public function get_gallery_icon( $attachment ) { 302 | 303 | /* Get the image size. */ 304 | $size = $this->args['size']; 305 | 306 | /* Get the image attachment meta. */ 307 | $image_meta = wp_get_attachment_metadata( $attachment->ID ); 308 | 309 | /* Get the image orientation (portrait|landscape) based off the width and height. */ 310 | $orientation = ''; 311 | 312 | /* If the size for the current attachment exists and both the width and height are defined. */ 313 | if ( isset( $image_meta['sizes'][ $size ] ) && isset( $image_meta['sizes'][ $size ]['height'], $image_meta['sizes'][ $size ]['width'] ) ) { 314 | $orientation = ( $image_meta['sizes'][ $size ]['height'] > $image_meta['sizes'][ $size ]['width'] ) ? 'portrait' : 'landscape'; 315 | } 316 | 317 | /* Else, if both the width and height are defined, set the orientation. */ 318 | elseif ( isset( $image_meta['height'], $image_meta['width'] ) ) { 319 | $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape'; 320 | } 321 | 322 | /* Open the gallery icon element. */ 323 | $output = "\n\t\t\t\t\t\t<{$this->args['icontag']} class='gallery-icon {$orientation}'>"; 324 | 325 | /* Get the image if it should link to the image file. */ 326 | if ( isset( $this->args['link'] ) && 'file' == $this->args['link'] ) { 327 | $image = wp_get_attachment_link( $attachment->ID, $size, false, true ); 328 | } 329 | 330 | /* Else if, get the image if it should link to nothing. */ 331 | elseif ( isset( $this->args['link'] ) && 'none' == $this->args['link'] ) { 332 | $image = wp_get_attachment_image( $attachment->ID, $size, false ); 333 | } 334 | 335 | /* Else, get the image (links to attachment page). */ 336 | else { 337 | $image = wp_get_attachment_link( $attachment->ID, $size, true, true ); 338 | } 339 | 340 | /* Apply filters over the image itself. */ 341 | $output .= apply_filters( 'cleaner_gallery_image', $image, $attachment->ID, $this->args, $this->gallery_instance ); 342 | 343 | /* Close the gallery icon element. */ 344 | $output .= "args['icontag']}>"; 345 | 346 | /* Return the gallery icon output. */ 347 | return $output; 348 | } 349 | 350 | /** 351 | * Gets the gallery image caption and formats it. 352 | * 353 | * @since 1.1.0 354 | * @access public 355 | * @param object $attachment 356 | * @return string 357 | */ 358 | public function get_gallery_caption( $attachment ) { 359 | 360 | /* Get the caption. */ 361 | $caption = apply_filters( 'cleaner_gallery_caption', wptexturize( $attachment->post_excerpt ), $attachment->ID, $this->args, $this->gallery_instance ); 362 | 363 | /* If image caption is set, format and return. */ 364 | if ( !empty( $caption ) ) { 365 | $this->has_caption = true; 366 | return "\n\t\t\t\t\t\t" . sprintf( '<%1$s id="%2$s" class="gallery-caption" itemprop="caption">%3$s', $this->args['captiontag'], esc_attr( "figcaption-{$this->args['id']}-{$attachment->ID}" ), $caption ); 367 | } 368 | 369 | /* Return an empty string if there's no caption. */ 370 | $this->has_caption = false; 371 | return ''; 372 | } 373 | 374 | /** 375 | * Gets the gallery's itemptype. 376 | * 377 | * @since 1.1.0 378 | * @access public 379 | * @return string 380 | */ 381 | public function get_gallery_itemtype() { 382 | 383 | /* Make sure the array of mime types is unique. */ 384 | $this->mime_types = array_unique( $this->mime_types ); 385 | 386 | /* Get a count of the different mime types. */ 387 | $mime_count = count( $this->mime_types ); 388 | 389 | /* If the only mime type is 'image'. */ 390 | if ( 1 === $mime_count && 'image' === $this->mime_types[0] ) 391 | $itemtype = 'http://schema.org/ImageGallery'; 392 | 393 | /* If the only mime type is 'video'. */ 394 | elseif ( 1 === $mime_count && 'video' === $this->mime_types[0] ) 395 | $itemtype = 'http://schema.org/VideoGallery'; 396 | 397 | /* Else, set up a generall "collection". */ 398 | else 399 | $itemtype = 'http://schema.org/CollectionPage'; 400 | 401 | /* Return the itemtype. */ 402 | return $itemtype; 403 | } 404 | 405 | /** 406 | * Filters the gallery image attributes and adds the 'itemprop' attribute. 407 | * 408 | * @since 1.1.0 409 | * @access public 410 | * @param array $attr 411 | * @param object $attachment 412 | * @return array 413 | */ 414 | public function attachment_image_attributes( $attr, $attachment ) { 415 | 416 | if ( true === $this->has_caption ) 417 | $attr['aria-describedby'] = esc_attr( "figcaption-{$this->args['id']}-{$attachment->ID}" ); 418 | 419 | $attr['itemprop'] = 'thumbnail'; 420 | 421 | return $attr; 422 | } 423 | 424 | /** 425 | * Filters the attachment link and adds the 'itemprop' attribute. 426 | * 427 | * @since 1.1.0 428 | * @access public 429 | * @param string $link 430 | * @return string 431 | */ 432 | public function get_attachment_link( $link ) { 433 | 434 | return preg_replace( '/(/i', '$1 itemprop="contentURL">', $link ); 435 | } 436 | 437 | /** 438 | * Returns the instance. 439 | * 440 | * @since 1.1.0 441 | * @access public 442 | * @return object 443 | */ 444 | public static function get_instance() { 445 | 446 | if ( !self::$instance ) 447 | self::$instance = new self; 448 | 449 | return self::$instance; 450 | } 451 | } 452 | 453 | Cleaner_Gallery::get_instance(); 454 | 455 | /** 456 | * @since 0.9.0 457 | */ 458 | function cleaner_gallery( $output, $attr ) {} 459 | -------------------------------------------------------------------------------- /languages/cleaner-gallery.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 Cleaner Gallery 2 | # This file is distributed under the same license as the Cleaner Gallery package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: Cleaner Gallery 1.1.0-alpha-1\n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/cleaner-gallery\n" 7 | "POT-Creation-Date: 2014-07-11 15:11:37+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-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | 15 | #: admin/admin.php:31 admin/admin.php:32 16 | msgid "Cleaner Gallery" 17 | msgstr "" 18 | 19 | #: admin/admin.php:98 20 | msgid "Thumbnail" 21 | msgstr "" 22 | 23 | #: admin/admin.php:99 24 | msgid "Medium" 25 | msgstr "" 26 | 27 | #: admin/admin.php:100 28 | msgid "Large" 29 | msgstr "" 30 | 31 | #: admin/admin.php:101 32 | msgid "Full" 33 | msgstr "" 34 | 35 | #: admin/admin.php:111 36 | msgid "No image or page" 37 | msgstr "" 38 | 39 | #: admin/admin.php:112 40 | msgid "Attachment Page" 41 | msgstr "" 42 | 43 | #: admin/admin.php:119 44 | msgid "Comment Count" 45 | msgstr "" 46 | 47 | #: admin/admin.php:120 48 | msgid "Date" 49 | msgstr "" 50 | 51 | #: admin/admin.php:121 52 | msgid "ID" 53 | msgstr "" 54 | 55 | #: admin/admin.php:122 56 | msgid "Menu Order" 57 | msgstr "" 58 | 59 | #: admin/admin.php:123 60 | msgid "None" 61 | msgstr "" 62 | 63 | #: admin/admin.php:124 64 | msgid "Random" 65 | msgstr "" 66 | 67 | #: admin/admin.php:125 68 | msgid "Title" 69 | msgstr "" 70 | 71 | #: admin/admin.php:130 72 | msgid "Ascending" 73 | msgstr "" 74 | 75 | #: admin/admin.php:131 76 | msgid "Descending" 77 | msgstr "" 78 | 79 | #: admin/admin.php:165 80 | msgid "Cleaner Gallery Settings" 81 | msgstr "" 82 | 83 | #: admin/admin.php:167 84 | msgid "Settings saved." 85 | msgstr "" 86 | 87 | #: admin/admin.php:176 88 | msgid "Default gallery settings" 89 | msgstr "" 90 | 91 | #: admin/admin.php:178 92 | msgid "Display %s size images by default." 93 | msgstr "" 94 | 95 | #: admin/admin.php:180 96 | msgid "Images should link to %s by default." 97 | msgstr "" 98 | 99 | #: admin/admin.php:182 100 | msgid "Galleries should be ordered by %s by default." 101 | msgstr "" 102 | 103 | #: admin/admin.php:184 104 | msgid "Display gallery images in %s order by default." 105 | msgstr "" 106 | 107 | #: admin/admin.php:187 108 | msgid "(These settings may be overriden for individual galleries.)" 109 | msgstr "" 110 | 111 | #: admin/admin.php:193 112 | msgid "Image caption settings" 113 | msgstr "" 114 | 115 | #: admin/admin.php:196 116 | msgid "Completely remove image captions (overrules other caption settings)." 117 | msgstr "" 118 | 119 | #: admin/admin.php:199 120 | msgid "Use the image title as a caption if there is no caption available." 121 | msgstr "" 122 | 123 | #: admin/admin.php:204 124 | msgid "Script and style settings" 125 | msgstr "" 126 | 127 | #: admin/admin.php:207 128 | msgid "Load the Thickbox JavaScript (included with WordPress)." 129 | msgstr "" 130 | 131 | #: admin/admin.php:210 132 | msgid "Load the Thickbox stylesheet (included with WordPress)." 133 | msgstr "" 134 | 135 | #: admin/admin.php:215 136 | msgid "External image script" 137 | msgstr "" 138 | 139 | #: admin/admin.php:225 140 | msgid "The use, installation, and configuration of third-party image scripts are not supported by the Cleaner Gallery plugin developer. Please contact the image script developer for help using your preferred script." 141 | msgstr "" 142 | 143 | #: admin/admin.php:231 144 | msgid "Like this plugin?" 145 | msgstr "" 146 | 147 | #: admin/admin.php:233 148 | msgid "Here's how you can give back:" 149 | msgstr "" 150 | 151 | #: admin/admin.php:235 152 | msgid "Give the plugin a good rating." 153 | msgstr "" 154 | 155 | #: admin/admin.php:236 156 | msgid "Donate to the project." 157 | msgstr "" 158 | 159 | #: admin/admin.php:242 160 | msgid "Update Settings" 161 | msgstr "" 162 | 163 | #: admin/admin.php:260 164 | msgid "Plugin support" 165 | msgstr "" 166 | 167 | #: admin/admin.php:261 168 | msgid "Rate plugin" 169 | msgstr "" 170 | 171 | #: admin/admin.php:262 172 | msgid "Donate" 173 | msgstr "" 174 | 175 | #: inc/default-filters.php:68 176 | msgid "Colorbox" 177 | msgstr "" 178 | 179 | #: inc/default-filters.php:69 180 | msgid "FancyBox" 181 | msgstr "" 182 | 183 | #: inc/default-filters.php:70 184 | msgid "FancyZoom" 185 | msgstr "" 186 | 187 | #: inc/default-filters.php:71 188 | msgid "Floatbox" 189 | msgstr "" 190 | 191 | #: inc/default-filters.php:72 192 | msgid "GreyBox" 193 | msgstr "" 194 | 195 | #: inc/default-filters.php:73 196 | msgid "jQuery Lightbox" 197 | msgstr "" 198 | 199 | #: inc/default-filters.php:74 200 | msgid "jQuery Lightbox Plugin" 201 | msgstr "" 202 | 203 | #: inc/default-filters.php:75 204 | msgid "jQuery Lightbox (Balupton)" 205 | msgstr "" 206 | 207 | #: inc/default-filters.php:76 208 | msgid "Lightbox" 209 | msgstr "" 210 | 211 | #: inc/default-filters.php:77 212 | msgid "Lightview" 213 | msgstr "" 214 | 215 | #: inc/default-filters.php:78 216 | msgid "LightWindow" 217 | msgstr "" 218 | 219 | #: inc/default-filters.php:79 220 | msgid "Lytebox" 221 | msgstr "" 222 | 223 | #: inc/default-filters.php:80 224 | msgid "prettyPhoto" 225 | msgstr "" 226 | 227 | #: inc/default-filters.php:81 228 | msgid "Shadowbox" 229 | msgstr "" 230 | 231 | #: inc/default-filters.php:82 232 | msgid "Shutter Reloaded" 233 | msgstr "" 234 | 235 | #: inc/default-filters.php:83 236 | msgid "Slimbox" 237 | msgstr "" 238 | 239 | #: inc/default-filters.php:84 240 | msgid "Thickbox" 241 | msgstr "" 242 | #. Plugin Name of the plugin/theme 243 | msgid "Cleaner Gallery" 244 | msgstr "" 245 | 246 | #. Plugin URI of the plugin/theme 247 | msgid "http://themehybrid.com/plugins/cleaner-gallery" 248 | msgstr "" 249 | 250 | #. Description of the plugin/theme 251 | msgid "Replaces the default [gallery] shortcode with valid HTML5 markup and moves its inline styles to a proper stylesheet. Integrates with many Lightbox-type image scripts." 252 | msgstr "" 253 | 254 | #. Author of the plugin/theme 255 | msgid "Justin Tadlock" 256 | msgstr "" 257 | 258 | #. Author URI of the plugin/theme 259 | msgid "http://justintadlock.com" 260 | msgstr "" 261 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Cleaner Gallery 2 | 3 | This plugin was written to take care of the invalid HTML that WordPress produces when using the `[gallery]` shortcode. 4 | 5 | It does a bit more than that though. It will integrate with many Lightbox-type scripts and allow you to do much cooler things with your galleries. Plus, it has a couple of extra options that you can play around with. 6 | 7 | ## Features 8 | 9 | * Uses HTML5 `` and `
` elements. 10 | * Integrates with [Schema.org microdata](http://schema.org). 11 | * Uses the `aria-describedby` attribute to make images + captions more accessible to users with disabilities. 12 | * Validates the invalid code that WordPress spits out. 13 | * Several options on how you want your gallery images. 14 | * Allows multiple galleries in a single post. 15 | * Ability to set the number of images shown in each gallery. 16 | * Ability to exclude or include any images from your gallery. 17 | * Doesn't load any extra CSS or JavaScript unless you choose to do so. 18 | 19 | ## Integrates with 18 different Lightbox-type scripts 20 | 21 | 1. [Lightbox 2](http://www.huddletogether.com/projects/lightbox2/) 22 | 2. [Slimbox](http://www.digitalia.be/software/slimbox) 23 | 3. [Slimbox 2](http://www.digitalia.be/software/slimbox2) 24 | 4. [Thickbox](http://jquery.com/demo/thickbox/) 25 | 5. [Lytebox](http://dolem.com/lytebox/) 26 | 6. [Greybox](http://orangoo.com/labs/GreyBox/) 27 | 7. [Lightview](http://www.nickstakenburg.com/projects/lightview/) 28 | 8. [jQuery Lightbox Plugin](http://www.balupton.com/sandbox/jquery_lightbox/) (balupton edition) 29 | 9. [jQuery Lightbox Plugin](http://leandrovieira.com/projects/jquery/lightbox/) 30 | 10. [Shutter Reloaded](http://www.laptoptips.ca/projects/wp-shutter-reloaded/) 31 | 11. [Shadowbox](http://mjijackson.com/shadowbox/index.html) 32 | 12. [FancyBox](http://fancy.klade.lv) 33 | 13. [jQuery Lightbox](http://github.com/krewenki/jquery-lightbox/tree/master) 34 | 14. [LightWindow](http://www.stickmanlabs.com/lightwindow) 35 | 15. [FancyZoom](http://www.cabel.name/2008/02/fancyzoom-10.html) 36 | 16. [Floatbox](http://randomous.com/floatbox/home) 37 | 17. [Colorbox](http://colorpowered.com/colorbox) 38 | 18. [prettyPhoto](http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone) 39 | 40 | ## Changelog 41 | 42 | ### Version 1.1.0 ### 43 | 44 | * Introduce the `Cleaner_Gallery` class, which allows for better code reuse and consolidates all the gallery functionality. 45 | * Add support for Schema.org microdata. 46 | * Added the `.gallery-columns-x` class. 47 | * Added the `.gallery-size-x` class. 48 | * Added `aria-describedby` attribute for images with captions for better accessibility. 49 | 50 | ### Version 1.0.0 51 | 52 | * License change from GPL v2-only to GPL v2+. 53 | * Rewrote large chunks of the plugin from the ground up. 54 | * Galleries are now HTML5+, using the `` and `
` tags. 55 | * Dropped the caption link setting because captions in WordPress can now have links within them. Removing the setting was the best way to avoid conflicts. 56 | * Dropped the Cleaner Gallery stylesheet setting. It caused too much confusion for new users. If you're savvy enough to add styles to your theme, you can handle disabling the stylesheet via the `add_theme_support( 'cleaner-gallery' )` method. 57 | * Much cleaner settings page that now uses the standard Settings API screen design. 58 | * Upgraded to support all newer WordPress gallery arguments that have been added up to version 3.7. 59 | 60 | ### Version 0.9.1 61 | 62 | * Remove the default feature of overwriting the columns if gallery has too few images since users have asked for this. 63 | 64 | ### Version 0.9 65 | 66 | * Important! Users sould re-save their settings after updating to version 0.9. 67 | * Completely overhauled the plugin settings page to use the WordPress settings API. 68 | * Added the option of loading the Cleaner Gallery stylesheet. 69 | * Made the gallery shortcode script modular, allowing it to be ported to other projects. 70 | * Added support for the [prettyPhoto](http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone) script. 71 | * Plugin now only officially supports WordPress 3.0+. 72 | 73 | ### Version 0.8 74 | 75 | * Important! Users sould re-save their settings after updating to version 0.8. 76 | * Completely recoded the plugin from the ground up for a much needed code overhaul. 77 | * Added support for the [Colorbox](http://colorpowered.com/colorbox) script. 78 | * Added the `cleaner_gallery_image_link_class` filter hook. 79 | * Added the `cleaner_gallery_image_link_rel` filter hook. 80 | * Removed the link class and rel options in the admin for the more robust filter hooks. 81 | * Changed the Image Link option to the Default Image Link option, which allows users to always override this setting on a per-post basis. 82 | * Recognizes custom image sizes created using the `add_image_size()` WordPress function. 83 | * Split the plugin into new files so that specific parts of the code are only loaded when needed. 84 | * Changed the settings page to fully support the screen options and meta box functionality of WordPress. 85 | * Moved translations to the `/languages` folder. 86 | * Added the `offset` argument so that users could more easily make paginated galleries. 87 | 88 | ### Version 0.7 89 | 90 | * Recoded much of the plugin to be more efficient. 91 | * Added the `cleaner_gallery_id()` function to make sure multiple galleries in a single post have different IDs but the same class. 92 | * Added `cleaner_gallery_defaults` filter hook. 93 | * Added `cleaner_gallery_default_settings()` function to better handle user settings. 94 | * Moved Lightbox-type image scripts to an external function from the main script (`cleaner_gallery_link_attributes()`). 95 | * Deprecated CSS functions in favor of using `wp_enqueue_style()`.' 96 | * Dropped support for WordPress 2.5. 97 | * Added support for [jQuery Lightbox](http://github.com/krewenki/jquery-lightbox/tree/master). 98 | * Added support for [LightWindow](http://www.stickmanlabs.com/lightwindow). 99 | * Added support for [FancyZoom](http://www.cabel.name/2008/02/fancyzoom-10.html). 100 | * Added support for [Floatbox](http://randomous.com/floatbox/home). 101 | 102 | ### Version 0.6.1 103 | 104 | * Added `numberposts` parameter. 105 | * Added `exclude` parameter. 106 | * Added `include` parameter. 107 | 108 | ### Version 0.6 109 | 110 | * Cleaned up the code to be more efficient and understandable. 111 | * New options added to the settings page, which include *Default Image Size*, *Default Order*, and *Default Orderby*. 112 | * Added support for [Slimbox 2](http://www.digitalia.be/software/slimbox2). 113 | * Fixed the `[gallery columns="0"]` error. 114 | * Fully documented nearly every function and line of code within the PHP files. 115 | 116 | ### Version 0.5 117 | 118 | * Added in an options panel. 119 | * Support added for Fancybox. 120 | 121 | ## Professional Support 122 | 123 | If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing). 124 | 125 | ## Copyright and License 126 | 127 | This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later. 128 | 129 | 2008 – 2013 © [Justin Tadlock](http://justintadlock.com). 130 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Cleaner Gallery === 2 | 3 | Contributors: greenshady 4 | Donate link: http://themehybrid.com/donate 5 | Tags: gallery, lightbox, slimbox, images, jquery, fancybox, shadowbox, thickbox, html5 6 | Requires at least: 3.9 7 | Stable tag: 1.1.0 8 | License: GPLv2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | A cleaner WordPress [gallery] that integrates with multiple Lightbox-type scripts. 12 | 13 | == Description == 14 | 15 | This plugin was written to take care of the invalid HTML that WordPress produces when using the `[gallery]` shortcode. 16 | 17 | It does a bit more than that though. It will integrate with many Lightbox-type scripts and allow you to do much cooler things with your galleries. Plus, it has a couple of extra options that you can play around with. 18 | 19 | ### Features 20 | 21 | * Uses HTML5 `` and `
` elements. 22 | * Integrates with [Schema.org microdata](http://schema.org). 23 | * Uses the `aria-describedby` attribute to make images + captions more accessible to users with disabilities. 24 | * Validates the invalid code that WordPress spits out. 25 | * Several options on how you want your gallery images. 26 | * Allows multiple galleries in a single post. 27 | * Ability to set the number of images shown in each gallery. 28 | * Ability to exclude or include any images from your gallery. 29 | * Doesn't load any extra CSS or JavaScript unless you choose to do so. 30 | 31 | ### Integrates with 18 different Lightbox-type scripts 32 | 33 | 1. [Lightbox 2](http://www.huddletogether.com/projects/lightbox2/) 34 | 2. [Slimbox](http://www.digitalia.be/software/slimbox) 35 | 3. [Slimbox 2](http://www.digitalia.be/software/slimbox2) 36 | 4. [Thickbox](http://jquery.com/demo/thickbox/) 37 | 5. [Lytebox](http://dolem.com/lytebox/) 38 | 6. [Greybox](http://orangoo.com/labs/GreyBox/) 39 | 7. [Lightview](http://www.nickstakenburg.com/projects/lightview/) 40 | 8. [jQuery Lightbox Plugin](http://www.balupton.com/sandbox/jquery_lightbox/) (balupton edition) 41 | 9. [jQuery Lightbox Plugin](http://leandrovieira.com/projects/jquery/lightbox/) 42 | 10. [Shutter Reloaded](http://www.laptoptips.ca/projects/wp-shutter-reloaded/) 43 | 11. [Shadowbox](http://mjijackson.com/shadowbox/index.html) 44 | 12. [FancyBox](http://fancy.klade.lv) 45 | 13. [jQuery Lightbox](http://github.com/krewenki/jquery-lightbox/tree/master) 46 | 14. [LightWindow](http://www.stickmanlabs.com/lightwindow) 47 | 15. [FancyZoom](http://www.cabel.name/2008/02/fancyzoom-10.html) 48 | 16. [Floatbox](http://randomous.com/floatbox/home) 49 | 17. [Colorbox](http://colorpowered.com/colorbox) 50 | 18. [prettyPhoto](http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone) 51 | 52 | ### Professional Support 53 | 54 | If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing). 55 | 56 | ### Plugin Development 57 | 58 | If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/cleaner-gallery). 59 | 60 | ### Donations 61 | 62 | Yes, I do accept donations. If you want to buy me a beer or whatever, you can do so from my [donations page](http://themehybrid.com/donate). I appreciate all donations, no matter the size. Further development of this plugin is not contingent on donations, but they are always a nice incentive. 63 | 64 | == Installation == 65 | 66 | 1. Uzip the `cleaner-gallery.zip` folder. 67 | 2. Upload the `cleaner-gallery` folder to your `/wp-content/plugins` directory. 68 | 3. In your WordPress dashboard, head over to the *Plugins* section. 69 | 4. Activate *Cleaner Gallery*. 70 | 71 | == Upgrade Notice == 72 | 73 | If you're upgrading from a version prior to version 1.0.0 of this plugin, please check your Cleaner Gallery plugin settings page to make sure everything is in order. A few settings changed in the update. 74 | 75 | == Frequently Asked Questions == 76 | 77 | ### Why was this plugin created? 78 | 79 | The purpose of the Cleaner Gallery plugin is to get rid of the invalid HTML output by the default WordPress `[gallery]` shortcode. Since I was having so much fun with it, I decided to make it compatible with several Lightbox-type image scripts. 80 | 81 | It has eventually grown into an extremely robust and flexible image script. 82 | 83 | ### Why do I have one column of images? 84 | 85 | If you expect multiple columns of images but only have one column, it's most likely that your theme is doing something incorrectly. 86 | 87 | Also, the Cleaner Gallery plugin stylesheet doesn't load if your theme supports `cleaner-gallery`. If that's the case, it's your theme's responsibility to style the gallery output. 88 | 89 | ### My gallery columns aren't working. What to do? 90 | 91 | It's impossible for me to say for sure without looking at your site. More than likely, your theme is overwriting the gallery styles. You'd need to stop by my [support forums](http://themehybrid.com/support) for support for your specific case. 92 | 93 | ### Which Lightbox-type scripts will the plugin work with? 94 | 95 | The plugin has been tested and works with many different Lightbox-type image scripts. They are all listed in the plugin description. 96 | 97 | ### Can you help me set up an image script? 98 | 99 | I don't officially support any third-party code whatsoever. However, I'm more than willing to **attempt** helping you set up your preferred image script via my [support forums](http://themehybrid.com/support). 100 | 101 | ### Will you add support for X image script? 102 | 103 | There's a good chance that I will. It really depends on how feasible it is. Some scripts would require re-coding how the plugin works, which is something I probably won't do. However, most scripts don't require this. 104 | 105 | If you'd like for me to add a new image script, please provide me with as much information as you can. Particularly, a link to the page where I can download the script and view a demo of it. That will go a long way towards getting support for the script included in this plugin. 106 | 107 | ### How do I set it up? 108 | 109 | Technically, you don't have to set up anything at all. It should work right out of the box. 110 | 111 | However, you do have several configuration options that you can set from the "Appearance > Cleaner Gallery" screen in the admin. 112 | 113 | ### How do I integrate support for this plugin in a theme? 114 | 115 | If you're building a WordPress theme, it's extremely simple to add support for this plugin. Simply add the following line to your theme's setup function: 116 | 117 | add_theme_support( 'cleaner-gallery' ); 118 | 119 | Then, copy the plugins `css/gallery.css` file into your theme's stylesheet. You are free to make any customizations you wish. It's much more flexible than the default WordPress gallery, so you have a lot of freedom with design choices. 120 | 121 | ### How do I customize the styles for galleries? 122 | 123 | Customizing your galleries can be very simple. Here's some CSS you can add to your theme's `style.css` and modify. 124 | 125 | /* Style rules for the entire gallery */ 126 | .gallery {} 127 | 128 | /* Style rules for each item (image and caption) in the gallery */ 129 | .gallery-item {} 130 | 131 | /* Style rules for images within the gallery */ 132 | .gallery-icon {} 133 | 134 | /* Style rules for captions within the gallery */ 135 | .gallery-caption {} 136 | 137 | ### Can I paginate galleries? 138 | 139 | While the plugin has no way of paginating its own galleries, it's very much possible to make this happen using the WordPress `` tag. 140 | 141 | Let's suppose we have 12 images we want to show. The first six will be on the first page while the following six will be on the second page. You'd use this code in the post editor: 142 | 143 | [gallery numberposts="6"] 144 | 145 | 146 | 147 | [gallery numberposts="6" offset="6"] 148 | 149 | == Screenshots == 150 | 151 | A demo can be found on the [Cleaner Gallery page](http://justintadlock.com/archives/2008/04/13/cleaner-wordpress-gallery-plugin) or my [gallery archives](http://justintadlock.com/archives/type/gallery). 152 | 153 | 1. Gallery from the [Socially Awkward theme](http://wordpress.org/themes/socially-awkward). 154 | 2. Gallery from the [Chun theme](http://wordpress.org/themes/chun). 155 | 3. Gallery from the [Picturesque theme](http://wordpress.org/themes/picturesque). 156 | 4. Cleaner Gallery settings page. 157 | 158 | == Changelog == 159 | 160 | ### Version 1.1.0 ### 161 | 162 | * Introduce the `Cleaner_Gallery` class, which allows for better code reuse and consolidates all the gallery functionality. 163 | * Add support for Schema.org microdata. 164 | * Added the `.gallery-columns-x` class. 165 | * Added the `.gallery-size-x` class. 166 | * Added `aria-describedby` attribute for images with captions for better accessibility. 167 | 168 | ### Version 1.0.0 169 | 170 | * License change from GPL v2-only to GPL v2+. 171 | * Rewrote large chunks of the plugin from the ground up. 172 | * Galleries are now HTML5+, using the `` and `
` tags. 173 | * Dropped the caption link setting because captions in WordPress can now have links within them. Removing the setting was the best way to avoid conflicts. 174 | * Dropped the Cleaner Gallery stylesheet setting. It caused too much confusion for new users. If you're savvy enough to add styles to your theme, you can handle disabling the stylesheet via the `add_theme_support( 'cleaner-gallery' )` method. 175 | * Much cleaner settings page that now uses the standard Settings API screen design. 176 | * Upgraded to support all newer WordPress gallery arguments that have been added up to version 3.7. 177 | 178 | ### Version 0.9.1 179 | 180 | * Remove the default feature of overwriting the columns if gallery has too few images since users have asked for this. 181 | 182 | ### Version 0.9 183 | 184 | * Important! Users sould re-save their settings after updating to version 0.9. 185 | * Completely overhauled the plugin settings page to use the WordPress settings API. 186 | * Added the option of loading the Cleaner Gallery stylesheet. 187 | * Made the gallery shortcode script modular, allowing it to be ported to other projects. 188 | * Added support for the [prettyPhoto](http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone) script. 189 | * Plugin now only officially supports WordPress 3.0+. 190 | 191 | ### Version 0.8 192 | 193 | * Important! Users sould re-save their settings after updating to version 0.8. 194 | * Completely recoded the plugin from the ground up for a much needed code overhaul. 195 | * Added support for the [Colorbox](http://colorpowered.com/colorbox) script. 196 | * Added the `cleaner_gallery_image_link_class` filter hook. 197 | * Added the `cleaner_gallery_image_link_rel` filter hook. 198 | * Removed the link class and rel options in the admin for the more robust filter hooks. 199 | * Changed the Image Link option to the Default Image Link option, which allows users to always override this setting on a per-post basis. 200 | * Recognizes custom image sizes created using the `add_image_size()` WordPress function. 201 | * Split the plugin into new files so that specific parts of the code are only loaded when needed. 202 | * Changed the settings page to fully support the screen options and meta box functionality of WordPress. 203 | * Moved translations to the `/languages` folder. 204 | * Added the `offset` argument so that users could more easily make paginated galleries. 205 | 206 | ### Version 0.7 207 | 208 | * Recoded much of the plugin to be more efficient. 209 | * Added the `cleaner_gallery_id()` function to make sure multiple galleries in a single post have different IDs but the same class. 210 | * Added `cleaner_gallery_defaults` filter hook. 211 | * Added `cleaner_gallery_default_settings()` function to better handle user settings. 212 | * Moved Lightbox-type image scripts to an external function from the main script (`cleaner_gallery_link_attributes()`). 213 | * Deprecated CSS functions in favor of using `wp_enqueue_style()`.' 214 | * Dropped support for WordPress 2.5. 215 | * Added support for [jQuery Lightbox](http://github.com/krewenki/jquery-lightbox/tree/master). 216 | * Added support for [LightWindow](http://www.stickmanlabs.com/lightwindow). 217 | * Added support for [FancyZoom](http://www.cabel.name/2008/02/fancyzoom-10.html). 218 | * Added support for [Floatbox](http://randomous.com/floatbox/home). 219 | 220 | ### Version 0.6.1 221 | 222 | * Added `numberposts` parameter. 223 | * Added `exclude` parameter. 224 | * Added `include` parameter. 225 | 226 | ### Version 0.6 227 | 228 | * Cleaned up the code to be more efficient and understandable. 229 | * New options added to the settings page, which include *Default Image Size*, *Default Order*, and *Default Orderby*. 230 | * Added support for [Slimbox 2](http://www.digitalia.be/software/slimbox2). 231 | * Fixed the `[gallery columns="0"]` error. 232 | * Fully documented nearly every function and line of code within the PHP files. 233 | 234 | ### Version 0.5 235 | 236 | * Added in an options panel. 237 | * Support added for Fancybox. -------------------------------------------------------------------------------- /screenshot-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justintadlock/cleaner-gallery/bee84dd4db1e3da1b3582373f430dde186b5f1dd/screenshot-1.jpg -------------------------------------------------------------------------------- /screenshot-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justintadlock/cleaner-gallery/bee84dd4db1e3da1b3582373f430dde186b5f1dd/screenshot-2.jpg -------------------------------------------------------------------------------- /screenshot-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justintadlock/cleaner-gallery/bee84dd4db1e3da1b3582373f430dde186b5f1dd/screenshot-3.jpg -------------------------------------------------------------------------------- /screenshot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justintadlock/cleaner-gallery/bee84dd4db1e3da1b3582373f430dde186b5f1dd/screenshot-4.png --------------------------------------------------------------------------------