402.1.1
by Keith Hughitt
Created simple JavaScript "Config" class to parse Helioviewer configuration parameters on the client-side. |
1 |
<?php
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
2 |
// Accepted URL parameters
|
797
by Jeff Stys
NOTE: |
3 |
// (except "imageLayers" and "eventLayers", handled separately)
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
4 |
$params = array( |
797
by Jeff Stys
NOTE: |
5 |
'strings' => array('date', 'movieId', 'output'), |
6 |
'floats' => array('centerX', 'centerY', 'imageScale'), |
|
7 |
'bools' => array('debug', 'hideWatermark', 'eventLabels') |
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
8 |
);
|
797
by Jeff Stys
NOTE: |
9 |
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
10 |
$urlSettings = array(); |
797
by Jeff Stys
NOTE: |
11 |
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
12 |
// Check for URL params and cast to appropriate types
|
13 |
foreach($params['strings'] as $str) { |
|
14 |
if (isset($_GET[$str])) |
|
15 |
$urlSettings[$str] = $_GET[$str]; |
|
16 |
}
|
|
17 |
foreach($params['floats'] as $float) { |
|
18 |
if (isset($_GET[$float])) |
|
19 |
$urlSettings[$float] = (float) $_GET[$float]; |
|
20 |
}
|
|
21 |
foreach($params['bools'] as $bool) { |
|
801
by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes. |
22 |
if ( isset($_GET[$bool]) && |
797
by Jeff Stys
NOTE: |
23 |
(strtolower($_GET[$bool]) == 'true' || $_GET[$bool] == 1) ) { |
24 |
||
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
25 |
$urlSettings[$bool] = true; |
797
by Jeff Stys
NOTE: |
26 |
}
|
801
by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes. |
27 |
else if ( isset($_GET[$bool]) && |
797
by Jeff Stys
NOTE: |
28 |
(strtolower($_GET[$bool]) == 'false' || $_GET[$bool] == 0) ) { |
29 |
||
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
30 |
$urlSettings[$bool] = false; |
31 |
}
|
|
797
by Jeff Stys
NOTE: |
32 |
else { |
33 |
unset($urlSettings[$bool]); |
|
34 |
}
|
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
35 |
}
|
797
by Jeff Stys
NOTE: |
36 |
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
37 |
// Process imageLayers separately if set
|
807
by jeff Stys
Addressed bug #1370257 |
38 |
if (isset($_GET['imageLayers']) && $_GET['imageLayers'] != '') { |
797
by Jeff Stys
NOTE: |
39 |
if ($_GET['imageLayers'][0] == '[') { |
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
40 |
$imageLayersString = substr($_GET['imageLayers'],1,-1); |
41 |
} else { |
|
42 |
$imageLayersString = $_GET['imageLayers']; |
|
43 |
}
|
|
44 |
$urlSettings['imageLayers'] = preg_split("/\],\[/", $imageLayersString); |
|
45 |
}
|
|
807
by jeff Stys
Addressed bug #1370257 |
46 |
else { |
47 |
$urlSettings['imageLayers'] = ''; |
|
48 |
}
|
|
797
by Jeff Stys
NOTE: |
49 |
|
50 |
// Process eventLayers separately if set
|
|
51 |
if (isset($_GET['eventLayers']) && $_GET['eventLayers'] != '') { |
|
52 |
if ($_GET['eventLayers'][0] == '[') { |
|
53 |
$eventLayersString = substr($_GET['eventLayers'],1,-1); |
|
54 |
} else { |
|
55 |
$eventLayersString = $_GET['eventLayers']; |
|
56 |
}
|
|
57 |
$urlSettings['eventLayers'] = preg_split("/\],\[/", $eventLayersString); |
|
58 |
}
|
|
59 |
else { |
|
60 |
$urlSettings['eventLayers'] = ''; |
|
61 |
}
|
|
62 |
||
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
63 |
// Default to HTML5 client
|
797
by Jeff Stys
NOTE: |
64 |
if ( !isset($urlSettings['output']) ) { |
65 |
require_once 'src/php/HelioviewerWebClient.php'; |
|
66 |
$helioviewer = new HelioviewerWebClient($urlSettings); |
|
67 |
}
|
|
68 |
else if ( $urlSettings['output'] == 'embed' ) { |
|
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
69 |
// Embedded version of Helioviewer.org
|
797
by Jeff Stys
NOTE: |
70 |
require_once 'src/php/HelioviewerEmbeddedClient.php'; |
637
by Keith Hughitt
Created HelioviewerEmbeddedClient PHP class. |
71 |
$helioviewer = new HelioviewerEmbeddedClient($urlSettings); |
72 |
}
|
|
807
by jeff Stys
Addressed bug #1370257 |
73 |
?>
|