fooplugins /
foogallery
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | jQuery(document).ready(function($) { |
||
| 2 | $.admin_tabs = { |
||
| 3 | |||
| 4 | init : function() { |
||
| 5 | $("a.nav-tab").click( function(e) { |
||
| 6 | e.preventDefault(); |
||
| 7 | |||
| 8 | $this = $(this); |
||
| 9 | |||
| 10 | $this.parents(".nav-tab-wrapper:first").find(".nav-tab-active").removeClass("nav-tab-active"); |
||
| 11 | $this.addClass("nav-tab-active"); |
||
| 12 | |||
| 13 | $(".nav-container:visible").hide(); |
||
| 14 | |||
| 15 | var hash = $this.attr("href"); |
||
| 16 | |||
| 17 | $(hash+'_tab').show(); |
||
| 18 | |||
| 19 | //fix the referer so if changes are saved, we come back to the same tab |
||
| 20 | var referer = $("input[name=_wp_http_referer]").val(); |
||
| 21 | if (referer.indexOf("#") >= 0) { |
||
| 22 | referer = referer.substr(0, referer.indexOf("#")); |
||
| 23 | } |
||
| 24 | referer += hash; |
||
| 25 | |||
| 26 | window.location.hash = hash; |
||
| 27 | |||
| 28 | $("input[name=_wp_http_referer]").val(referer); |
||
| 29 | }); |
||
| 30 | |||
| 31 | if (window.location.hash) { |
||
| 32 | $('a.nav-tab[href="' + window.location.hash + '"]').click(); |
||
| 33 | } |
||
| 34 | |||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | }; //End of admin_tabs |
||
| 39 | |||
| 40 | $.admin_tabs.init(); |
||
| 41 | }); |
||
| 42 | |||
| 43 | // |
||
| 44 | (function(FOOGALLERY, $, undefined) { |
||
| 45 | |||
| 46 | FOOGALLERY.loadImageOptimizationContent = function() { |
||
| 47 | var data = 'action=foogallery_get_image_optimization_info' + |
||
| 48 | '&_wpnonce=' + $('#foogallery_setting_image_optimization-nonce').val() + |
||
| 49 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 50 | |||
| 51 | $.ajax({ |
||
| 52 | type: "POST", |
||
| 53 | url: ajaxurl, |
||
| 54 | data: data, |
||
| 55 | success: function(data) { |
||
| 56 | $('#foogallery_settings_image_optimization_container').replaceWith(data); |
||
| 57 | } |
||
| 58 | }); |
||
| 59 | }; |
||
| 60 | |||
| 61 | FOOGALLERY.bindClearCssOptimizationButton = function() { |
||
| 62 | $('.foogallery_clear_css_optimizations').click(function(e) { |
||
| 63 | e.preventDefault(); |
||
| 64 | |||
| 65 | var $button = $(this), |
||
| 66 | $container = $('#foogallery_clear_css_optimizations_container'), |
||
| 67 | $spinner = $('#foogallery_clear_css_cache_spinner'), |
||
| 68 | data = 'action=foogallery_clear_css_optimizations' + |
||
| 69 | '&_wpnonce=' + $button.data('nonce') + |
||
| 70 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 71 | |||
| 72 | $spinner.addClass('is-active'); |
||
| 73 | $button.prop('disabled', true); |
||
| 74 | |||
| 75 | $.ajax({ |
||
| 76 | type: "POST", |
||
| 77 | url: ajaxurl, |
||
| 78 | data: data, |
||
| 79 | success: function(data) { |
||
| 80 | $container.html(data); |
||
| 81 | }, |
||
| 82 | complete: function() { |
||
| 83 | $spinner.removeClass('is-active'); |
||
| 84 | $button.prop('disabled', false); |
||
| 85 | } |
||
| 86 | }); |
||
| 87 | }); |
||
| 88 | }; |
||
| 89 | |||
| 90 | FOOGALLERY.bindTestThumbnailButton = function() { |
||
| 91 | $('.foogallery_thumb_generation_test').click(function(e) { |
||
| 92 | e.preventDefault(); |
||
| 93 | |||
| 94 | var $button = $(this), |
||
| 95 | $container = $('#foogallery_thumb_generation_test_container'), |
||
| 96 | $spinner = $('#foogallery_thumb_generation_test_spinner'), |
||
| 97 | data = 'action=foogallery_thumb_generation_test' + |
||
| 98 | '&_wpnonce=' + $button.data('nonce') + |
||
| 99 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 100 | |||
| 101 | $spinner.addClass('is-active'); |
||
| 102 | $button.prop('disabled', true); |
||
| 103 | |||
| 104 | $.ajax({ |
||
| 105 | type: "POST", |
||
| 106 | url: ajaxurl, |
||
| 107 | data: data, |
||
| 108 | success: function(data) { |
||
| 109 | $container.html(data); |
||
| 110 | }, |
||
| 111 | complete: function() { |
||
| 112 | $spinner.removeClass('is-active'); |
||
| 113 | $button.prop('disabled', false); |
||
| 114 | } |
||
| 115 | }); |
||
| 116 | }); |
||
| 117 | }; |
||
| 118 | |||
| 119 | FOOGALLERY.bindApplyRetinaDefaults = function() { |
||
| 120 | $('.foogallery_apply_retina_support').click(function(e) { |
||
| 121 | e.preventDefault(); |
||
| 122 | |||
| 123 | var $button = $(this), |
||
| 124 | $container = $('#foogallery_apply_retina_support_container'), |
||
| 125 | $spinner = $('#foogallery_apply_retina_support_spinner'), |
||
| 126 | data = 'action=foogallery_apply_retina_defaults' + |
||
| 127 | '&_wpnonce=' + $button.data('nonce') + |
||
| 128 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 129 | |||
| 130 | var selected = []; |
||
| 131 | $( $button.data('inputs') ).each(function() { |
||
| 132 | if ($(this).is(":checked")) { |
||
| 133 | selected.push($(this).attr('name')); |
||
| 134 | } |
||
| 135 | }); |
||
| 136 | |||
| 137 | data += '&defaults=' + selected; |
||
| 138 | |||
| 139 | $spinner.addClass('is-active'); |
||
| 140 | $button.prop('disabled', true); |
||
| 141 | |||
| 142 | $.ajax({ |
||
| 143 | type: "POST", |
||
| 144 | url: ajaxurl, |
||
| 145 | data: data, |
||
| 146 | success: function(data) { |
||
| 147 | $container.html(data); |
||
| 148 | }, |
||
| 149 | complete: function() { |
||
| 150 | $spinner.removeClass('is-active'); |
||
| 151 | $button.prop('disabled', false); |
||
| 152 | } |
||
| 153 | }); |
||
| 154 | }); |
||
| 155 | }; |
||
| 156 | |||
| 157 | FOOGALLERY.bindUninstallButton = function() { |
||
| 158 | $('.foogallery_uninstall').click(function(e) { |
||
| 159 | e.preventDefault(); |
||
| 160 | |||
| 161 | var $button = $(this), |
||
| 162 | $container = $('#foogallery_uninstall_container'), |
||
| 163 | $spinner = $('#foogallery_uninstall_spinner'), |
||
| 164 | data = 'action=foogallery_uninstall' + |
||
| 165 | '&_wpnonce=' + $button.data('nonce') + |
||
| 166 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 167 | |||
| 168 | $spinner.addClass('is-active'); |
||
| 169 | $button.prop('disabled', true); |
||
| 170 | |||
| 171 | $.ajax({ |
||
| 172 | type: "POST", |
||
| 173 | url: ajaxurl, |
||
| 174 | data: data, |
||
| 175 | success: function(data) { |
||
| 176 | $container.html(data); |
||
| 177 | }, |
||
| 178 | complete: function() { |
||
| 179 | $spinner.removeClass('is-active'); |
||
| 180 | $button.prop('disabled', false); |
||
| 181 | } |
||
| 182 | }); |
||
| 183 | }); |
||
| 184 | }; |
||
| 185 | |||
| 186 | FOOGALLERY.bindClearHTMLCacheButton = function() { |
||
| 187 | $('.foogallery_clear_html_cache').click(function(e) { |
||
| 188 | e.preventDefault(); |
||
| 189 | |||
| 190 | var $button = $(this), |
||
| 191 | $container = $('#foogallery_clear_html_cache_container'), |
||
| 192 | $spinner = $('#foogallery_clear_html_cache_spinner'), |
||
| 193 | data = 'action=foogallery_clear_html_cache' + |
||
| 194 | '&_wpnonce=' + $button.data('nonce') + |
||
| 195 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 196 | |||
| 197 | $spinner.addClass('is-active'); |
||
| 198 | $button.prop('disabled', true); |
||
| 199 | |||
| 200 | $.ajax({ |
||
| 201 | type: "POST", |
||
| 202 | url: ajaxurl, |
||
| 203 | data: data, |
||
| 204 | success: function(data) { |
||
| 205 | $container.html(data); |
||
| 206 | }, |
||
| 207 | complete: function() { |
||
| 208 | $spinner.removeClass('is-active'); |
||
| 209 | $button.prop('disabled', false); |
||
| 210 | } |
||
| 211 | }); |
||
| 212 | }); |
||
| 213 | }; |
||
| 214 | |||
| 215 | //find all generic foogallery ajax buttons and bind them |
||
| 216 | FOOGALLERY.bindSettingsAjaxButtons = function () { |
||
| 217 | $('.foogallery_settings_ajax').click(function(e) { |
||
| 218 | e.preventDefault(); |
||
| 219 | |||
| 220 | var $button = $(this), |
||
| 221 | $container = $button.parents('.foogallery_settings_ajax_container:first'), |
||
| 222 | $spinner = $container.find('.spinner'), |
||
| 223 | response = $button.data('response'), |
||
| 224 | confirmMessage = $button.data('confirm'), |
||
| 225 | confirmResult = true, |
||
| 226 | data = 'action=' + $button.data('action') + |
||
| 227 | '&_wpnonce=' + $button.data('nonce') + |
||
| 228 | '&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val()); |
||
| 229 | |||
| 230 | if ( confirmMessage ) { |
||
| 231 | confirmResult = confirm( confirmMessage ); |
||
| 232 | }; |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 233 | |||
| 234 | if ( confirmResult ) { |
||
| 235 | $spinner.addClass('is-active'); |
||
| 236 | $button.prop('disabled', true); |
||
| 237 | |||
| 238 | $.ajax({ |
||
| 239 | type : "POST", |
||
| 240 | url : ajaxurl, |
||
| 241 | data : data, |
||
| 242 | success : function (data) { |
||
| 243 | if (response === 'replace_container') { |
||
| 244 | $container.html(data); |
||
| 245 | } else if (response === 'alert') { |
||
| 246 | alert(data); |
||
| 247 | } |
||
| 248 | }, |
||
| 249 | complete: function () { |
||
| 250 | $spinner.removeClass('is-active'); |
||
| 251 | $button.prop('disabled', false); |
||
| 252 | } |
||
| 253 | }); |
||
| 254 | } |
||
| 255 | }); |
||
| 256 | }; |
||
| 257 | |||
| 258 | $(function() { //wait for ready |
||
| 259 | FOOGALLERY.loadImageOptimizationContent(); |
||
| 260 | FOOGALLERY.bindClearCssOptimizationButton(); |
||
| 261 | FOOGALLERY.bindTestThumbnailButton(); |
||
| 262 | FOOGALLERY.bindApplyRetinaDefaults(); |
||
| 263 | FOOGALLERY.bindUninstallButton(); |
||
| 264 | FOOGALLERY.bindClearHTMLCacheButton(); |
||
| 265 | |||
| 266 | FOOGALLERY.bindSettingsAjaxButtons(); |
||
| 267 | }); |
||
| 268 | |||
| 269 | }(window.FOOGALLERY = window.FOOGALLERY || {}, jQuery)); |