Skip to content

Commit 566d8a1

Browse files
committed
[fix] bug with debug output and using set of map widgets together on a single page
1 parent e687891 commit 566d8a1

File tree

2 files changed

+43
-38
lines changed

2 files changed

+43
-38
lines changed

map_ex/views/debug.php

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,43 @@
2424
if ( (class_exists('JURI')) && (method_exists('JURI','base')) )
2525
$isJoomla=true;
2626

27-
if ($settings['debug_output']){
28-
if ($isJoomla)
29-
$CMS=getJoomlaVersion();
30-
else
31-
$CMS=getWPVersion();
32-
33-
$wk_version=getWidgetkitVersion();
34-
$php_version=@phpversion();
35-
array_push($debug_info,'Processing widget '.$widget_name.' (version '.$widget_version.') on '.$CMS.' with Widgetkit '.$wk_version.' and PHP '.$php_version.'('.@php_sapi_name().')');
36-
if (version_compare('5.3',$php_version)>0)
37-
array_push($debug_error,'Your PHP is too old! Upgrade is strongly required! This widget may not work with your version of PHP.');
27+
if ($isJoomla)
28+
$CMS=getJoomlaVersion();
29+
else
30+
$CMS=getWPVersion();
31+
32+
$wk_version=getWidgetkitVersion();
33+
$php_version=@phpversion();
34+
array_push($debug_info,'Processing widget '.$widget_name.' (version '.$widget_version.') on '.$CMS.' with Widgetkit '.$wk_version.' and PHP '.$php_version.'('.@php_sapi_name().')');
35+
if (version_compare('5.3',$php_version)>0)
36+
array_push($debug_error,'Your PHP is too old! Upgrade is strongly required! This widget may not work with your version of PHP.');
37+
else
38+
if (version_compare('5.6',$php_version)>0)
39+
array_push($debug_warning,'Your PHP is quite old. Although this widget can work with your version of PHP, upgrade is recommended to the latest stable version of PHP.');
40+
41+
if (version_compare('2.5.0',$wk_version)>0)
42+
array_push($debug_warning,"Your Widgetkit version is quite old. Although this widget may work with your version of Widgetkit, upgrade is recommended to the latest stable version of Widgetkit. Besides, you may experience some issues of missing options in the settings of this widget if you don't upgrade.");
43+
44+
array_push($debug_info,'Host: '.@php_uname());
45+
$ipath=dirname(dirname(__FILE__));
46+
array_push($debug_info,'Widget installation path: '.$ipath);
47+
if ($isJoomla)
48+
if (preg_match_all('@.*\/administrator\/components\/com_widgetkit\/plugins\/widgets\/.+@',$ipath))
49+
array_push($debug_info,'Installation path is correct');
3850
else
39-
if (version_compare('5.6',$php_version)>0)
40-
array_push($debug_warning,'Your PHP is quite old. Although this widget can work with your version of PHP, upgrade is recommended to the latest stable version of PHP.');
41-
42-
if (version_compare('2.5.0',$wk_version)>0)
43-
array_push($debug_warning,"Your Widgetkit version is quite old. Although this widget may work with your version of Widgetkit, upgrade is recommended to the latest stable version of Widgetkit. Besides, you may experience some issues of missing options in the settings of this widget if you don't upgrade.");
44-
45-
array_push($debug_info,'Host: '.@php_uname());
46-
$ipath=dirname(dirname(__FILE__));
47-
array_push($debug_info,'Widget installation path: '.$ipath);
48-
if ($isJoomla)
49-
if (preg_match_all('@.*\/administrator\/components\/com_widgetkit\/plugins\/widgets\/.+@',$ipath))
50-
array_push($debug_info,'Installation path is correct');
51-
else
52-
array_push($debug_error,'Installation path is not correct, please fix it. Read more in the Wiki.');
51+
array_push($debug_error,'Installation path is not correct, please fix it. Read more in the Wiki.');
52+
else
53+
if (preg_match_all('@.*\/wp-content\/plugins\/widgetkit\/plugins\/widgets\/.+@',$ipath))
54+
array_push($debug_info,'Installation path is correct');
5355
else
54-
if (preg_match_all('@.*\/wp-content\/plugins\/widgetkit\/plugins\/widgets\/.+@',$ipath))
55-
array_push($debug_info,'Installation path is correct');
56-
else
57-
array_push($debug_warning,'Installation path is not correct, please fix it. Read more in the Wiki.');
56+
array_push($debug_warning,'Installation path is not correct, please fix it. Read more in the Wiki.');
5857

59-
if ($isJoomla)
60-
array_push($debug_info,'Detected CMS: Joomla');
61-
else
62-
array_push($debug_info,'Detected CMS: WordPress');
58+
if ($isJoomla)
59+
array_push($debug_info,'Detected CMS: Joomla');
60+
else
61+
array_push($debug_info,'Detected CMS: WordPress');
6362

64-
array_push($debug_info,'Widget settings: '.print_r($settings,true));
65-
}
63+
array_push($debug_info,'Widget settings: '.print_r($settings,true));
6664

6765
function ExtractWidgetInfo(){
6866
global $widget_name;

map_ex/views/widget.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
$map_id = uniqid('wk-map-ex');
1111
$map_id2 = substr($map_id,9);
1212

13+
global $debug_info;
14+
global $debug_warning;
15+
global $debug_error;
16+
global $isJoomla;
17+
global $widget_id;
18+
global $widget_name;
19+
1320
require_once(__DIR__.'/debug.php');
1421

1522
$markers = array();
@@ -185,9 +192,9 @@ function checkWidgetkitMaps() {
185192
if (modal_dialog.length){
186193
var box_id=modal_dialog.attr("id");
187194
if (box_id){
188-
<?php if ($settings['debug_output'])
189-
printJSDebugString("'Modal fix setup successfull for modal id #'+box_id");
190-
?>
195+
<?php if ($settings['debug_output']):?>
196+
console.info('<?php echo '['.$widget_name.' #'.$widget_id.'] ';?>Modal fix setup successfull for modal id #'+box_id);
197+
<?php endif;?>
191198
$('#'+box_id).on({
192199
'show.uk.modal': function(){
193200
var map = jQuery('#<?php echo $map_id?>', '#'+box_id).first().get(0);

0 commit comments

Comments
 (0)