68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Plugin Name: PhotoSwipe
|
|
* Version: 2.0
|
|
* Plugin URI: https://www.flatpress.org
|
|
* Description: Displays images and galleries with <a href="http://photoswipe.com">PhotoSwipe</a>.<br>Part of the standard distribution. Needs the BBCode plugin to be activated.
|
|
* Author: FlatPress
|
|
* Author URI: https://www.flatpress.org
|
|
*/
|
|
|
|
/**
|
|
* --------
|
|
* About
|
|
* --------
|
|
*
|
|
* This plugin displays single images and whole image galleries with the JavaScript library
|
|
* PhotoSwipe (photoswipe.com). Since it uses FlatPress default functionality for building
|
|
* the image HTML, you may use the documented parameters of the [img] tag such as "alt",
|
|
* "title", "height", "width" or "float" (see FlatPress BBCode documentation for details).
|
|
*
|
|
*
|
|
* --------
|
|
* Usage
|
|
* --------
|
|
*
|
|
* For a single image: [img="images/image.jpg"]
|
|
* Floating image with given width: [img="images/image.jpg" width="200" float="right"]
|
|
*
|
|
* For an image gallery: [gallery="images/GalleryName"]
|
|
* Gallery width given image height: [gallery="images/GalleryName" height="100"]
|
|
*
|
|
*
|
|
* --------
|
|
* HTML+CSS
|
|
* --------
|
|
*
|
|
* The HTML code of the images is generated by the FlatPress standard function
|
|
* do_bbcode_img() (see fp-plugins/bbcode/plugin.bbcode.php). Therefore, standard image
|
|
* attributes (such as "width", "height", etc.) can be used. Floating images will get a
|
|
* corresponding CSS class (e.g. "floatright").
|
|
* The plugin will wrap that HTML in a <figure> element with the same CSS class as the
|
|
* image (e.g. "floatright"). The <figure> also contains a <figcaption> displaying the
|
|
* title of the image.
|
|
* The <figure> element itself is surrounded by a <div class="photoswipe">.
|
|
*
|
|
* Galleries are displayed as a series of images as described above, encapsulated by a
|
|
* <div class="img-gallery GalleryName">.
|
|
*
|
|
*
|
|
* --------
|
|
* Captions
|
|
* --------
|
|
*
|
|
* Captions of the gallery images are read from a text file "captions.conf" within the
|
|
* gallery directory. You may edit them with the Gallery captions plugin.
|
|
*/
|
|
|
|
// include the plugin's PHP files
|
|
include_once dirname(__FILE__) . '/photoswipefunctions.class.php';
|
|
|
|
// intialize the BBCode tags of the plugin
|
|
add_filter('init', 'PhotoSwipeFunctions::initializePluginTags');
|
|
|
|
// inject neccessary JS in the <head> section
|
|
add_action('wp_head', 'PhotoSwipeFunctions::echoScriptTags', 0);
|
|
|