usergallery plugin use lightboxes per option

extends to the 2.0 version of the new lightbox plugin
This commit is contained in:
Ian 2014-10-27 14:41:13 +01:00
parent 3563d92983
commit 9ac3a75378
6 changed files with 106 additions and 20 deletions

View file

@ -1,3 +1,12 @@
2.63:
-----
* Added options for lightbox path and lightbox scripts.
This needs to have the lightbox plugin >= v.2.0 installed.
To use the lightbox plugin for usergalleries only, move it into
the hidden event field of your pluginlist!
* The file plugin_usergallery.tpl has changed. Please update your template copy file, if have.
* Required Serendipity and PHP version have changed.
2.62:
-----
* Since being stackable, avoid loading multiple css into stream

View file

@ -84,7 +84,7 @@
@define('PLUGIN_EVENT_USERGALLERY_MEDIA_PROPERTIES_NAME', 'Liste der Medien-Eigenschaften');
@define('PLUGIN_EVENT_USERGALLERY_MEDIA_PROPERTIES_DESC', 'Dies ist eine Liste der Medien-Eigenschaften und der Namen, die Sie für jede Eigenschaft auf der Seite anzeigen möchten. Das Format der Liste ist: "ITEM1:Item1;ITEM2:Item2", wobei die Eigenschaft durch Semikolons getrennt sind. Für jede Eigenschaft wird zuerst der Name (wie in den Konfigurationseinstellungen aufgelistet) angegeben, danach folgen ein Doppelpunkt sowie der jeweilige Anzeigename.');
//Several consants used in the template
//Several constants used in the template
@define('PLUGIN_EVENT_USERGALLERY_IMAGES', 'Bilder');
@define('PLUGIN_EVENT_USERGALLERY_PAGINATION', 'Seite %s von %s, insgesamt %s Bilder');
@ -92,9 +92,11 @@
@define('PLUGIN_EVENT_USERGALLERY_RSS_FEED_BODY_DESC', 'Falls ausgewählt, wird zu einem Bild aus der Mediendatenbank, das in einem Blog-Eintrag verlinkt wurde, im RSS-Feed auch der Inhalt des Blog-Eintrages ausgegebn, anstatt (Standard) nur einen Link zum Blog-Eintrag und dem ursprünglichen Platz des Bildes.');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_NAME', 'Nutze Lightbox Ausgabe');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-Typ, wie im Lightbox-Plugin gewählt');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"! Wenn das Lightbox Plugin nur für Usergalerieseiten benutzt werden soll, installiere und verschiebe es anschließend in der Pluginliste in das Inaktiv (hidden) event Feld!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Wähle Lightbox-Plugin-Typ');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Zeige alle Nicht-Bild Dateien');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Erweitere das Galerie Array mit allen Nicht-Bild Dateien aus der Mediendatendank, zB. *.pdf Dateien.');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOX_PATH', 'Pfad zum Lightbox Plugin Verzeichnis');

View file

@ -84,16 +84,18 @@
@define('PLUGIN_EVENT_USERGALLERY_MEDIA_PROPERTIES_NAME', 'Liste der Medien-Eigenschaften');
@define('PLUGIN_EVENT_USERGALLERY_MEDIA_PROPERTIES_DESC', 'Dies ist eine Liste der Medien-Eigenschaften und der Namen, die Sie für jede Eigenschaft auf der Seite anzeigen möchten. Das Format der Liste ist: "ITEM1:Item1;ITEM2:Item2", wobei die Eigenschaft durch Semikolons getrennt sind. Für jede Eigenschaft wird zuerst der Name (wie in den Konfigurationseinstellungen aufgelistet) angegeben, danach folgen ein Doppelpunkt sowie der jeweilige Anzeigename.');
//Several consants used in the template
//Several constants used in the template
@define('PLUGIN_EVENT_USERGALLERY_IMAGES', 'Bilder');
@define('PLUGIN_EVENT_USERGALLERY_PAGINATION', 'Seite %s von %s, insgesamt %s Bilder');
@define('PLUGIN_EVENT_USERGALLERY_RSS_FEED_BODY', 'Use original blog entry for the picture in RSS-Feed?');
@define('PLUGIN_EVENT_USERGALLERY_RSS_FEED_BODY_DESC', 'Falls ausgewählt, wird zu einem Bild aus der Mediendatenbank, das in einem Blog-Eintrag verlinkt wurde, im RSS-Feed auch der Inhalt des Blog-Eintrages ausgegebn, anstatt (Standard) nur einen Link zum Blog-Eintrag und dem ursprünglichen Platz des Bildes.');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_NAME', 'Nutze Lightbox Ausgabe');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-Typ, wie im Lightbox-Plugin gewählt');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"! Wenn das Lightbox Plugin nur für Usergalerieseiten benutzt werden soll, installiere und verschiebe es anschließend in der Pluginliste in das Inaktiv (hidden) event Feld!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Wähle Lightbox-Plugin-Typ');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Zeige alle Nicht-Bild Dateien');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Erweitere das Galerie Array mit allen Nicht-Bild Dateien aus der Mediendatendank, zB. *.pdf Dateien.');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOX_PATH', 'Pfad zum Lightbox Plugin Verzeichnis');

View file

@ -98,9 +98,11 @@
@define('PLUGIN_EVENT_USERGALLERY_RSS_FEED_BODY_DESC', 'If enabled, an image of the mediadatabase that has been linked within an blog entry will have the original blog entry\'s body within the RSS feed, instead of (by default) having a simple link to the blog article and the original image location.');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_NAME', 'Use lightbox output');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Needs the lightbox-plugin installed and upper option "Display Single Image" set to "Scaled to fit"!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-type as selected in lightbox-plugin');
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Needs the lightbox-plugin installed and upper option "Display Single Image" set to "Scaled to fit"! When you want to use lightboxes only for Usergallery pages, install the lightbox plugin and move it into the hidden event field in your pluginlist!');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Use lightbox plugin type');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Show all Non-Image objects');
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Include other media library object files to show up too, eg *.pdf application objects.');
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOX_PATH', 'Path to the lightbox plugin directory');

View file

@ -115,7 +115,7 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim}
{else}
<!-- download link -->
<a href="{$image.fullimage}" target=blank><img class="gallery_thumb" src="{$image.link}" alt="" /></a><br><a href="{$image.fullimage}" target=blank>Download {$image.name}.{$image.extension}</a>
<a href="{$image.fullimage}" target="blank"><img class="gallery_thumb" src="{$image.link}" alt="" /></a><br><a href="{$image.fullimage}" target="blank">Download {$image.name}.{$image.extension}</a>
{/if}
</div>
@ -134,7 +134,6 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim}
{/if}
{/if}
{/foreach}
<!-- end images -->
{if $plugin_usergallery_pagination}
@ -158,3 +157,59 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim}
</div>
</div>
</div>
{if $plugin_usergallery_uselightbox}
{if $plugin_usergallery_lightbox_jquery}
<script type="text/javascript" src="{$plugin_usergallery_lightbox_dir}/jquery-1.11.1.min.js" charset="utf-8"></script>
{/if}
{if ($plugin_usergallery_lightbox_script == 'colorbox')}
<link rel="stylesheet" type="text/css" href="{$plugin_usergallery_lightbox_dir}/colorbox/colorbox.css" />
<script type="text/javascript" src="{$plugin_usergallery_lightbox_dir}/colorbox/jquery.colorbox-min.js" charset="utf-8"></script>
<script type="text/javascript">
jQuery('a[rel^="colorbox"]').colorbox({
slideshow: true,
slideshowAuto: false,
slideshowSpeed: 6000,
scalePhotos: true,
maxWidth: '98%'
});
</script>
{elseif ($plugin_usergallery_lightbox_script == 'lightbox')}
<link rel="stylesheet" type="text/css" href="{$plugin_usergallery_lightbox_dir}/lightbox2-jquery/css/lightbox.css" />
<script type="text/javascript" src="{$plugin_usergallery_lightbox_dir}/lightbox2-jquery/js/lightbox.min.js" charset="utf-8"></script>
{elseif ($plugin_usergallery_lightbox_script == 'magnific')}
<link rel="stylesheet" type="text/css" href="{$plugin_usergallery_lightbox_dir}/magnific-popup/magnific-popup.css" />
<script type="text/javascript" src="{$plugin_usergallery_lightbox_dir}/magnific-popup/jquery.magnific-popup.min.js" charset="utf-8"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('a[rel^="magnificPopup"]').magnificPopup({
gallery:{
enabled:true
},
type:'image'
});
});
</script>
{elseif ($plugin_usergallery_lightbox_script == 'prettyphoto')}
<link rel="stylesheet" type="text/css" href="{$plugin_usergallery_lightbox_dir}/prettyphoto/css/prettyPhoto.css" />
<script type="text/javascript" src="{$plugin_usergallery_lightbox_dir}/prettyphoto/js/jquery.prettyPhoto.min.js" charset="utf-8"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('a[rel^="prettyPhoto"]').prettyPhoto({
social_tools: false
});
});
</script>
{/if}
{/if}

View file

@ -23,11 +23,11 @@ class serendipity_event_usergallery extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_USERGALLERY_DESC);
$propbag->add('stackable', true);
$propbag->add('author', 'Arnan de Gans, Matthew Groeninger, Stefan Willoughby, Ian');
$propbag->add('version', '2.62');
$propbag->add('version', '2.63');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'serendipity' => '1.6',
'smarty' => '2.6.7',
'php' => '4.1.0'
'php' => '5.2.0'
));
$propbag->add('event_hooks', array(
'css' => true,
@ -39,7 +39,7 @@ class serendipity_event_usergallery extends serendipity_event
));
$propbag->add('groups', array('IMAGES'));
$propbag->add('configuration', array('title', 'num_cols', 'subpage', 'frontpage', 'permalink', 'style', 'base_directory', 'dir_list', 'show_1lvl_sub',
'display_dir_tree', 'dir_tab', 'images_per_page', 'image_order','intro', 'image_display', 'show_lightbox', 'lightbox_type', 'show_objects', 'image_strict', 'fixed_width', 'image_width',
'display_dir_tree', 'dir_tab', 'images_per_page', 'image_order','intro', 'image_display', 'show_lightbox', 'lightbox_type', 'lightbox_path', 'show_objects', 'image_strict', 'fixed_width', 'image_width',
'feed_width', 'feed_linked_only', 'feed_body', 'exif_show_data', 'exif_data', 'show_media_properties', 'media_properties', 'linked_entries'));
}
@ -186,10 +186,10 @@ class serendipity_event_usergallery extends serendipity_event
break;
case 'lightbox_type':
$select_type["lightbox"] = 'Lightboxes all';
$select_type["lightbox"] = 'Lightbox2 jQuery';
$select_type["prettyphoto"] = 'Prettyphoto';
$select_type["thickbox"] = 'Thickbox';
$select_type["greybox"] = 'Greybox';
$select_type["colorbox"] = 'Colorbox';
$select_type["magnific"] = 'Magnific-Popup';
$propbag->add('type', 'select');
$propbag->add('name', PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME);
$propbag->add('description', '');
@ -197,6 +197,12 @@ class serendipity_event_usergallery extends serendipity_event
$propbag->add('default', 'lightbox');
break;
case 'lightbox_path':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_USERGALLERY_LIGHTBOX_PATH);
$propbag->add('default', $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_lightbox');
break;
case 'show_objects':
$propbag->add('type', 'radio');
$propbag->add('name', PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME);
@ -413,9 +419,15 @@ class serendipity_event_usergallery extends serendipity_event
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
static $pluginDir = null;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
if ($pluginDir === null) {
$pluginDir = $this->get_config('lightbox_path');
}
switch($event) {
case 'entry_display':
if ($this->selected()) {
@ -837,11 +849,12 @@ class serendipity_event_usergallery extends serendipity_event
$limit_output = '';
}
// this needs the latest >= v. 2.0 lightbox plugin installed!
$lightbox_type = $this->get_config('lightbox_type');
$lbtype = 'rel="lightbox[lightbox_group_entry]"';
$lbtype = 'rel="lightbox[]"';
if ($lightbox_type == 'prettyphoto') $lbtype = 'rel="prettyPhoto[]"';
elseif ($lightbox_type == 'thickbox') $lbtype = 'class="thickbox" rel="thickbox_group_entry"';
elseif ($lightbox_type == 'greybox') $lbtype = 'rel="gb_imageset[greybox_group_entry]"';
elseif ($lightbox_type == 'colorbox') $lbtype = 'rel="colorbox[]"';
elseif ($lightbox_type == 'magnific') $lbtype = 'rel="magnificPopup[]"';
$serendipity['smarty']->assign(
array(
@ -856,6 +869,9 @@ class serendipity_event_usergallery extends serendipity_event
'plugin_usergallery_colwidth' => round((10/$num_cols*10)-6,2),
'plugin_usergallery_limit_directory' => preg_replace('@[^a-z0-9]@i', ' ',$limit_output),
'plugin_usergallery_uselightbox' => serendipity_db_bool($this->get_config('show_lightbox', false)),
'plugin_usergallery_lightbox_script' => $lightbox_type,
'plugin_usergallery_lightbox_dir' => $this->get_config('lightbox_path'),
'plugin_usergallery_lightbox_jquery' => (!class_exists('serendipity_event_jquery') && !$serendipity['capabilities']['jquery']) ? true : false,
'plugin_usergallery_lightbox_type' => $lbtype,
'plugin_usergallery_images' => $process_images
)