-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
203 lines (164 loc) · 4.54 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Xculture</title>
<link rel="stylesheet" href="./css/jquery-jvectormap-1.2.2.css" type="text/css" media="screen"/>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.css">
<script src="./js/jquery.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/jquery-jvectormap-1.2.2.min.js"></script>
<script src="./js/jquery-jvectormap-world-mill-en.js"></script>
<script>
$(function(){
var countries = [];
var palette = ['#66C2A5', '#FC8D62', '#8DA0CB', '#E78AC3', '#A6D854'];
generateColors = function(){
var colors = {},
key;
for (key in map.regions) {
colors[key] = palette[Math.floor(Math.random()*palette.length)];
}
return colors;
},
map;
map = new jvm.WorldMap({
map: 'world_mill_en',
container: $('#map'),
regionsSelectable : true,
onRegionSelected : function(e,code,isSelected){
if(isSelected)
{
countries.push(code);
}
else{
countries.splice(countries.indexOf(code),1);
}
},
series: {
regions: [{
attribute: 'fill'
}]
}
});
map.series.regions[0].setValues(generateColors());
$('#reg').click(function(e){
e.preventDefault();
if(countries.length == 0){
alert('Please select some country');
}
else
{
for (key in countries)
{
countries[key] = map.getRegionName(countries[key]);
}
var ccode = countries.join('$');
window.location="index.php?data="+ccode;
}
});
});
</script>
<script src="js/modernizr.custom.63321.js"></script>
<script>
var ray=
{
ajax:function(st)
{
this.show('load');
},
show:function(el)
{
this.getID(el).style.display='';
},
getID:function(el)
{
return document.getElementById(el);
}
}
</script>
</head>
<body>
<div class="container">
<h1><p class="text-success" align="center">Welcome to xCulture</p></h1>
<p class="lead" align=center>Select countries and click culturize button</p>
<div id="load" class="demo-5" style="display:none;">
<div class="pre-loader"></div>
</div>
<div id="map" style="width: 900px; height: 480px;margin-left:160px" ></div>
</br>
<div class="text-center" align="center"><button type="button" id="reg" class="btn btn-success" onclick="return ray.ajax()">Culturize</button></div>
<table class="table">
<?php
include "Crawler.php";
if(isset($_GET["data"]) and !empty($_GET["data"]))
{
$countries = explode('$',$_GET['data']);
$length = sizeof($countries);
foreach ($countries as $z)
{
$cat = $z;
$flag = 0;
$count = array("India","China","Brazil","Venezuela","Kuwait","Russia","Egypt","Morocco","Cyprus","Denmark","Finland","France","Germany","Greece","Hungary","Norway","Mexico","Hongkong","Japan","Philippines","Austria","Bahrain","Belgium","Iran","Japan","Spain","Thiland","Tunisia","Turkey");
foreach( $count as $value )
{
if ($value == $cat)
$flag = 1;
}
$url = "http://www.kwintessential.co.uk/resources/global-etiquette/$cat-country-profile.html";
$url1 = "http://www.kwintessential.co.uk/resources/global-etiquette/$cat.html";
if($flag == 1)
$html= @file_get_contents($url);
else
$html= @file_get_contents($url1);
if($html === FALSE)
{
echo "<legend id=\"legend\">No Data Found For ".$cat."</legend>";
}
else
{
echo "<legend id=\"legend\">Culture About ".$cat."</legend>";
}
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xPath = new DOMXPath($dom);
$elements = $xPath->query("//strong");
echo '<table id=table1 class="table"><tr>';
$x=0;
foreach ($elements as $e)
{
if($x>0)
{
if($e->nextSibling->nodeValue != '')
{
echo "<th><h2>".$e->nodeValue. "</h2></th>";
$z = $e->nextSibling;
echo "<td><p id=\"data-info\" >". $z->nodeValue. "</p></td></tr>";
}
else
{
echo "<th><h2>".$e->nodeValue. "</h2></th>";
$z = $e->nextSibling->nextSibling->nextSibling;
echo "<td><p id=\"data-info\"> ". $z->nodeValue. "</p></td></tr>";
}
}
$x++;
if($x == 19)
break;
echo '</table>';
}
}
}
?>
</table>
</br>
<div class="navbar navbar-static-bottom">
<div class="container text-center">©. 2013 codehunks. All rights reserved</div>
</div>
</div>
</div>
</body>
</html>