From 133a0692e24137a831f3c0c465c6ed9efb0df7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Wed, 30 Mar 2016 16:00:31 +0200 Subject: [PATCH] Fixed: proper usage of default values in JS. --- e107_plugins/gallery/admin_gallery.php | 33 -------- .../gallery/includes/gallery_load.php | 18 ++--- e107_plugins/gallery/js/gallery.js | 75 +++++++++---------- e107_plugins/gallery/plugin.xml | 2 +- 4 files changed, 46 insertions(+), 82 deletions(-) diff --git a/e107_plugins/gallery/admin_gallery.php b/e107_plugins/gallery/admin_gallery.php index 0b3e091c8..9246bbe55 100644 --- a/e107_plugins/gallery/admin_gallery.php +++ b/e107_plugins/gallery/admin_gallery.php @@ -366,9 +366,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'title' => LAN_GALLERY_ADMIN_70, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_hook' => array( @@ -406,9 +403,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'title' => LAN_GALLERY_ADMIN_35, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 0, - ), 'tab' => 2, ), 'pp_opacity' => array( @@ -425,9 +419,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'title' => LAN_GALLERY_ADMIN_38, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_allow_resize' => array( @@ -435,9 +426,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_40, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_default_width' => array( @@ -499,9 +487,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_49, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 0, - ), 'tab' => 2, ), 'pp_wmode' => array( @@ -518,9 +503,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'title' => LAN_GALLERY_ADMIN_52, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_modal' => array( @@ -528,9 +510,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_54, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 0, - ), 'tab' => 2, ), 'pp_deeplinking' => array( @@ -538,9 +517,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_56, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 0, - ), 'tab' => 2, ), 'pp_overlay_gallery' => array( @@ -548,9 +524,6 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_58, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_keyboard_shortcuts' => array( @@ -558,18 +531,12 @@ class gallery_cat_admin_ui extends e_admin_ui 'help' => LAN_GALLERY_ADMIN_60, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), 'pp_ie6_fallback' => array( 'title' => LAN_GALLERY_ADMIN_61, 'type' => 'boolean', 'data' => 'int', - 'writeParms' => array( - 'default' => 1, - ), 'tab' => 2, ), ); diff --git a/e107_plugins/gallery/includes/gallery_load.php b/e107_plugins/gallery/includes/gallery_load.php index 1f4954ecf..d617db27b 100644 --- a/e107_plugins/gallery/includes/gallery_load.php +++ b/e107_plugins/gallery/includes/gallery_load.php @@ -50,15 +50,15 @@ function gallery_load_prettyphoto() 'overlay_gallery' => (bool) varset($plugPref['pp_overlay_gallery'], true), 'keyboard_shortcuts' => (bool) varset($plugPref['pp_keyboard_shortcuts'], true), 'ie6_fallback' => (bool) varset($plugPref['pp_ie6_fallback'], true), - 'markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['markup']), - 'gallery_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['gallery_markup']), - 'image_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['image_markup']), - 'flash_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['flash_markup']), - 'quicktime_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['quicktime_markup']), - 'iframe_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['iframe_markup']), - 'inline_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['inline_markup']), - 'custom_markup' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['custom_markup']), - 'social_tools' => str_replace(array("\r", "\n", "\t"), '', $template['prettyphoto']['social_tools']), + 'markup' => $template['prettyphoto']['markup'], + 'gallery_markup' => $template['prettyphoto']['gallery_markup'], + 'image_markup' => $template['prettyphoto']['image_markup'], + 'flash_markup' => $template['prettyphoto']['flash_markup'], + 'quicktime_markup' => $template['prettyphoto']['quicktime_markup'], + 'iframe_markup' => $template['prettyphoto']['iframe_markup'], + 'inline_markup' => $template['prettyphoto']['inline_markup'], + 'custom_markup' => $template['prettyphoto']['custom_markup'], + 'social_tools' => $template['prettyphoto']['social_tools'], ), ); diff --git a/e107_plugins/gallery/js/gallery.js b/e107_plugins/gallery/js/gallery.js index 4f20312f0..c71283486 100644 --- a/e107_plugins/gallery/js/gallery.js +++ b/e107_plugins/gallery/js/gallery.js @@ -14,47 +14,44 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; var pPhoto = settings.gallery.prettyphoto || {}; var pPhook = pPhoto.hook || 'data-gal'; - $(context).find("a[" + pPhook + "^='prettyPhoto']").once('gallery-prettyPhoto').each(function () - { - $(this).prettyPhoto( + $(context).find("a[" + pPhook + "^='prettyPhoto']").once('gallery-prettyPhoto').prettyPhoto( + { + hook: pPhook, + animation_speed: pPhoto.animation_speed || 'fast', // fast/slow/normal + slideshow: pPhoto.slideshow || 5000, // false OR interval time in ms + autoplay_slideshow: pPhoto.autoplay_slideshow || false, // true/false + opacity: pPhoto.opacity || 0.80, // Value between 0 and 1 + show_title: pPhoto.show_title || false, // true/false + allow_resize: pPhoto.allow_resize || false, // Resize the photos bigger than viewport. true/false + default_width: pPhoto.default_width || 500, + default_height: pPhoto.default_height || 344, + counter_separator_label: pPhoto.counter_separator_label || '/', // The separator for the gallery counter 1 "of" 2 + theme: pPhoto.theme || 'pp_default', // light_rounded / dark_rounded / light_square / dark_square / facebook + horizontal_padding: pPhoto.horizontal_padding || 20, // The padding on each side of the picture + hideflash: pPhoto.hideflash || false, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto + wmode: pPhoto.wmode || 'opaque', // Set the flash wmode attribute + autoplay: pPhoto.autoplay || false, // Automatically start videos: true/false + modal: pPhoto.modal || false, // If set to true, only the close button will close the window + deeplinking: pPhoto.deeplinking || false, // Allow prettyPhoto to update the url to enable deeplinking. + overlay_gallery: pPhoto.overlay_gallery || false, // If set to true, a gallery will overlay the fullscreen image on mouse over + keyboard_shortcuts: pPhoto.keyboard_shortcuts || false, // Set to false if you open forms inside prettyPhoto + ie6_fallback: pPhoto.ie6_fallback || false, // true/false + markup: decodeURIComponent(pPhoto.markup) || null, + gallery_markup: decodeURIComponent(pPhoto.gallery_markup) || null, + image_markup: decodeURIComponent(pPhoto.image_markup) || null, + flash_markup: pPhoto.flash_markup || null, + quicktime_markup: pPhoto.quicktime_markup || null, + iframe_markup: pPhoto.iframe_markup || null, + inline_markup: pPhoto.inline_markup || null, + custom_markup: pPhoto.custom_markup || null, + social_tools: decodeURIComponent(pPhoto.social_tools) || null, + changepicturecallback: function () { - hook: pPhook, - animation_speed: pPhoto.animation_speed || 'fast', // fast/slow/normal - slideshow: pPhoto.slideshow || 5000, // false OR interval time in ms - autoplay_slideshow: pPhoto.autoplay_slideshow || false, // true/false - opacity: pPhoto.opacity || 0.80, // Value between 0 and 1 - show_title: pPhoto.show_title || true, // true/false - allow_resize: pPhoto.allow_resize || true, // Resize the photos bigger than viewport. true/false - default_width: pPhoto.default_width || 500, - default_height: pPhoto.default_height || 344, - counter_separator_label: pPhoto.counter_separator_label || '/', // The separator for the gallery counter 1 "of" 2 - theme: pPhoto.theme || 'pp_default', // light_rounded / dark_rounded / light_square / dark_square / facebook - horizontal_padding: pPhoto.horizontal_padding || 20, // The padding on each side of the picture - hideflash: pPhoto.hideflash || false, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto - wmode: pPhoto.wmode || 'opaque', // Set the flash wmode attribute - autoplay: pPhoto.autoplay || true, // Automatically start videos: true/false - modal: pPhoto.modal || false, // If set to true, only the close button will close the window - deeplinking: pPhoto.deeplinking || false, // Allow prettyPhoto to update the url to enable deeplinking. - overlay_gallery: pPhoto.overlay_gallery || true, // If set to true, a gallery will overlay the fullscreen image on mouse over - keyboard_shortcuts: pPhoto.keyboard_shortcuts || true, // Set to false if you open forms inside prettyPhoto - ie6_fallback: pPhoto.ie6_fallback || true, // true/false - markup: pPhoto.markup || null, - gallery_markup: pPhoto.gallery_markup || null, - image_markup: pPhoto.image_markup || null, - flash_markup: pPhoto.flash_markup || null, - quicktime_markup: pPhoto.quicktime_markup || null, - iframe_markup: pPhoto.iframe_markup || null, - inline_markup: pPhoto.inline_markup || null, - custom_markup: pPhoto.custom_markup || null, - social_tools: pPhoto.social_tools || null, - changepicturecallback: function () - { - var $ppContent = $(".pp_content"); - $ppContent.css("height", $ppContent.height() + jQuery(".download-btn").outerHeight() + 10); - } + var $ppContent = $(".pp_content"); + $ppContent.css("height", $ppContent.height() + jQuery(".download-btn").outerHeight() + 10); } - ); - }); + } + ); } }; diff --git a/e107_plugins/gallery/plugin.xml b/e107_plugins/gallery/plugin.xml index 60aec9d1f..56397a04f 100644 --- a/e107_plugins/gallery/plugin.xml +++ b/e107_plugins/gallery/plugin.xml @@ -42,7 +42,7 @@ 1 0 0 - 1 + 0 1 1