1
1
<?php
2
2
/**
3
3
* Codecanyon plugin updates notificator *
4
- * version 1.13 *
4
+ * version 1.14 *
5
5
* fully compatible from WP 3.5 *
6
6
* *
7
7
* Author: Luca Montanari (LCweb) *
8
- * Site: http://www.projects. lcweb.it/ *
8
+ * Site: http://www.lcweb.it/ *
9
9
* *
10
10
**/
11
11
@@ -224,7 +224,7 @@ public function upgrade_core_message() {
224
224
<table class="update-premium-plugins-table widefat" cellspacing="0">
225
225
<tbody class="plugins">
226
226
' ;
227
-
227
+
228
228
foreach ($ GLOBALS ['lcun_to_update ' ] as $ pid => $ data ) {
229
229
echo '
230
230
<tr style="box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) inset;">
@@ -259,7 +259,7 @@ public function upgrade_core_message() {
259
259
e.preventDefault();
260
260
tb_show('Plugin Information: '+ jQuery(this).attr('pcun_name') , '#TB_inline?height=600&width=640&inlineId='+ jQuery(this).attr('rel'));
261
261
setTimeout(function() {
262
- jQuery('#TB_window').css('background-color', '#fff');
262
+ jQuery('#TB_window').css('background-color', '#fff').css('background-image', 'none') ;
263
263
}, 50);
264
264
});
265
265
});
@@ -269,7 +269,7 @@ public function upgrade_core_message() {
269
269
}
270
270
271
271
272
- // dinamically add code to show updates
272
+ // dinamically add code to show updates in plugins list
273
273
public function plugin_list_message () {
274
274
global $ current_screen ;
275
275
if (isset ($ current_screen ->base ) && $ current_screen ->base == 'plugins ' && is_array ($ GLOBALS ['lcun_to_update ' ])) {
@@ -287,19 +287,19 @@ public function plugin_list_message() {
287
287
$ new_ver [] = $ data ['new_ver ' ];
288
288
$ notes [] = addslashes ($ data ['note ' ]);
289
289
}
290
-
290
+
291
291
wp_enqueue_script ('jquery ' );
292
292
?>
293
293
<script type="text/javascript">
294
294
var id = ['<?php echo implode ("',' " , $ id ) ?> '];
295
- var name = ['<?php echo implode ("',' " , $ name ) ?> '];
295
+ var lcun_name = ['<?php echo implode ("',' " , $ name ) ?> ']; // safe name with prefix
296
296
var new_ver = ['<?php echo implode ("',' " , $ new_ver ) ?> '];
297
297
var notes = ['<?php echo implode ("',' " , $ notes ) ?> '];
298
298
299
299
jQuery(document).ready(function(e) {
300
300
jQuery.each(id, function(i, v) {
301
301
if(notes[i] != '') {
302
- var pl_note = ' or <a class="lcun_update_note" pcun_name="'+ name [i] +'" rel="pcunh_'+ v +'" href="">view update notes</a>';
302
+ var pl_note = ' or <a class="lcun_update_note" pcun_name="'+ lcun_name [i] +'" rel="pcunh_'+ v +'" href="">view update notes</a>';
303
303
jQuery('body').append('<div id="pcunh_'+ v +'" style="display: none;">'+ notes[i] +'</div>');
304
304
}
305
305
else {var pl_note = '';}
@@ -308,19 +308,31 @@ public function plugin_list_message() {
308
308
<tr class="plugin-update-tr">\
309
309
<td colspan="3" class="plugin-update colspanchange">\
310
310
<div class="update-message">\
311
- There is a new version of '+ name [i] +' available. \
312
- <a href="http://codecanyon.net/downloads" title="'+ name [i] +'" target="_blank">Download version '+ new_ver[i] +'</a>'+ pl_note +'.</div>\
311
+ There is a new version of '+ lcun_name [i] +' available. \
312
+ <a href="http://codecanyon.net/downloads" title="'+ lcun_name [i] +'" target="_blank">Download version '+ new_ver[i] +'</a>'+ pl_note +'.</div>\
313
313
</td>\
314
314
</tr>';
315
315
jQuery('#'+v).addClass('update');
316
316
jQuery('#'+v).after(code);
317
+
318
+ <?php
319
+ // if WP 4 - hide "view details" link
320
+ if ((float )substr (get_bloginfo ('version ' ), 0 , 3 ) >= 4 ) {
321
+ ?>
322
+ jQuery('#'+v).find('a.thickbox').remove();
323
+ var v4_txt = jQuery('#'+v).find('.plugin-version-author-uri').html();
324
+ jQuery('#'+v).find('.plugin-version-author-uri').html( v4_txt.slice(0,-2) );
325
+ <?php
326
+ }
327
+ ?>
317
328
});
318
329
330
+ // show thickbox
319
331
jQuery('body').delegate('.lcun_update_note', "click", function (e) {
320
332
e.preventDefault();
321
333
tb_show('Plugin Information: '+ jQuery(this).attr('pcun_name') , '#TB_inline?height=600&width=640&inlineId='+ jQuery(this).attr('rel'));
322
334
setTimeout(function() {
323
- jQuery('#TB_window').css('background-color', '#fff');
335
+ jQuery('#TB_window').css('background-color', '#fff').css('background-image', 'none') ;
324
336
}, 50);
325
337
});
326
338
});
0 commit comments