From 9ac3a75378c7c278933f2dcef9e8ff1255e6a8ec Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 27 Oct 2014 14:41:13 +0100 Subject: [PATCH] usergallery plugin use lightboxes per option extends to the 2.0 version of the new lightbox plugin --- serendipity_event_usergallery/ChangeLog | 9 +++ .../UTF-8/lang_de.inc.php | 8 ++- serendipity_event_usergallery/lang_de.inc.php | 8 ++- serendipity_event_usergallery/lang_en.inc.php | 6 +- .../plugin_usergallery.tpl | 59 ++++++++++++++++++- .../serendipity_event_usergallery.php | 36 +++++++---- 6 files changed, 106 insertions(+), 20 deletions(-) diff --git a/serendipity_event_usergallery/ChangeLog b/serendipity_event_usergallery/ChangeLog index 980fa884..52abcf31 100644 --- a/serendipity_event_usergallery/ChangeLog +++ b/serendipity_event_usergallery/ChangeLog @@ -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 diff --git a/serendipity_event_usergallery/UTF-8/lang_de.inc.php b/serendipity_event_usergallery/UTF-8/lang_de.inc.php index 374887e4..52afebaa 100644 --- a/serendipity_event_usergallery/UTF-8/lang_de.inc.php +++ b/serendipity_event_usergallery/UTF-8/lang_de.inc.php @@ -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'); + diff --git a/serendipity_event_usergallery/lang_de.inc.php b/serendipity_event_usergallery/lang_de.inc.php index f6a30a73..b8af0c71 100644 --- a/serendipity_event_usergallery/lang_de.inc.php +++ b/serendipity_event_usergallery/lang_de.inc.php @@ -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'); + diff --git a/serendipity_event_usergallery/lang_en.inc.php b/serendipity_event_usergallery/lang_en.inc.php index 52b747ed..e4ff4225 100644 --- a/serendipity_event_usergallery/lang_en.inc.php +++ b/serendipity_event_usergallery/lang_en.inc.php @@ -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'); + diff --git a/serendipity_event_usergallery/plugin_usergallery.tpl b/serendipity_event_usergallery/plugin_usergallery.tpl index dcdf8db7..b69889d4 100644 --- a/serendipity_event_usergallery/plugin_usergallery.tpl +++ b/serendipity_event_usergallery/plugin_usergallery.tpl @@ -115,7 +115,7 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim} {else} -
Download {$image.name}.{$image.extension} +
Download {$image.name}.{$image.extension} {/if} @@ -134,7 +134,6 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim} {/if} {/if} {/foreach} - {if $plugin_usergallery_pagination} @@ -158,3 +157,59 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim} + +{if $plugin_usergallery_uselightbox} + + {if $plugin_usergallery_lightbox_jquery} + + {/if} + + {if ($plugin_usergallery_lightbox_script == 'colorbox')} + + + + + + {elseif ($plugin_usergallery_lightbox_script == 'lightbox')} + + + + + {elseif ($plugin_usergallery_lightbox_script == 'magnific')} + + + + + + {elseif ($plugin_usergallery_lightbox_script == 'prettyphoto')} + + + + + + {/if} + +{/if} diff --git a/serendipity_event_usergallery/serendipity_event_usergallery.php b/serendipity_event_usergallery/serendipity_event_usergallery.php index 6277b090..74513374 100644 --- a/serendipity_event_usergallery/serendipity_event_usergallery.php +++ b/serendipity_event_usergallery/serendipity_event_usergallery.php @@ -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 )