Skip to content

Commit 58f6adb

Browse files
author
Emmanuel ROY
committed
update for compatibility ie11
1 parent 037e2b0 commit 58f6adb

File tree

132 files changed

+26633
-32
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+26633
-32
lines changed

application/class/Browser.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,104 @@ public function __construct()
1515
//Logger::addLog('http.browser',$this->user);
1616
}
1717

18+
public static function get()
19+
{
20+
// Make case insensitive.
21+
$t = strtolower($_SERVER['HTTP_USER_AGENT']);
22+
23+
// If the string *starts* with the string, strpos returns 0 (i.e., FALSE). Do a ghetto hack and start with a space.
24+
// "[strpos()] may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE."
25+
// http://php.net/manual/en/function.strpos.php
26+
$t = " " . $t;
27+
28+
// Humans / Regular Users
29+
if (strpos($t, 'opera') || strpos($t, 'opr/')) {
30+
return 'Opera';
31+
} elseif (strpos($t, 'edge')) {
32+
return 'Edge';
33+
} elseif (strpos($t, 'chrome')) {
34+
return 'Chrome';
35+
} elseif (strpos($t, 'safari')) {
36+
return 'Safari';
37+
} elseif (strpos($t, 'firefox')) {
38+
return 'Firefox';
39+
} elseif (strpos($t, 'msie') || strpos($t, 'trident/7')) {
40+
return 'Internet Explorer';
41+
}
42+
}
43+
44+
public static function get_firefox_version() {
45+
// Make case insensitive.
46+
$t = strtolower($_SERVER['HTTP_USER_AGENT']);
47+
48+
// If the string *starts* with the string, strpos returns 0 (i.e., FALSE). Do a ghetto hack and start with a space.
49+
// "[strpos()] may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE."
50+
// http://php.net/manual/en/function.strpos.php
51+
$t = " " . $t;
52+
53+
// Firefox Users
54+
if (strpos($t, 'firefox')) {
55+
preg_match('/rv:(.*)\)/', $_SERVER['HTTP_USER_AGENT'], $matches, PREG_OFFSET_CAPTURE);
56+
if(isset($matches[1])) {
57+
return intval($matches[1][0]);
58+
}else{
59+
return 'no-version';
60+
}
61+
}
62+
return 'not-firefox';
63+
}
64+
65+
public static function get_ip() {
66+
// IP si internet partagé
67+
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
68+
return $_SERVER['HTTP_CLIENT_IP'];
69+
}
70+
// IP derrière un proxy
71+
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
72+
return $_SERVER['HTTP_X_FORWARDED_FOR'];
73+
}
74+
// Sinon : IP normale
75+
else {
76+
return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '');
77+
}
78+
}
79+
80+
public static function get_os() {
81+
$user_agent = $_SERVER['HTTP_USER_AGENT'];
82+
$os_platform = "Inconnu";
83+
$os_array = array(
84+
'/windows nt 10/i' => 'Windows 10',
85+
'/windows nt 6.3/i' => 'Windows 8.1',
86+
'/windows nt 6.2/i' => 'Windows 8',
87+
'/windows nt 6.1/i' => 'Windows 7',
88+
'/windows nt 6.0/i' => 'Windows Vista',
89+
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
90+
'/windows nt 5.1/i' => 'Windows XP',
91+
'/windows xp/i' => 'Windows XP',
92+
'/windows nt 5.0/i' => 'Windows 2000',
93+
'/windows me/i' => 'Windows ME',
94+
'/win98/i' => 'Windows 98',
95+
'/win95/i' => 'Windows 95',
96+
'/win16/i' => 'Windows 3.11',
97+
'/macintosh|mac os x/i' => 'Mac OS X',
98+
'/mac_powerpc/i' => 'Mac OS 9',
99+
'/linux/i' => 'Linux',
100+
'/ubuntu/i' => 'Ubuntu',
101+
'/iphone/i' => 'iPhone',
102+
'/ipod/i' => 'iPod',
103+
'/ipad/i' => 'iPad',
104+
'/android/i' => 'Android',
105+
'/blackberry/i' => 'BlackBerry',
106+
'/webos/i' => 'Mobile'
107+
);
108+
foreach ($os_array as $regex => $value) {
109+
if (preg_match($regex, $user_agent)) {
110+
$os_platform = $value;
111+
}
112+
}
113+
return $os_platform;
114+
}
115+
18116
protected function get_browser_name()
19117
{
20118

application/class/Url.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,43 @@ public static function getRootDirectoryUrl(){
277277
return $url . "/" . BASE_SERVER_DIRECTORY;
278278
}
279279
}
280+
281+
public static function getPageName(){
282+
283+
$url = parse_url($_SERVER['REQUEST_URI']);
284+
$urlTrim = trim($url['path'], '/');
285+
$urlParts = explode('/', $urlTrim);
286+
287+
//suppression des sous repertoires du BASE_SERVER_DIRECTORY
288+
$basePath = explode( '/', BASE_SERVER_DIRECTORY);
289+
foreach($basePath as $subDir) {
290+
if ($urlParts[0] == $subDir) {
291+
array_shift($urlParts);
292+
}
293+
}
294+
295+
//Récupération du nom de la page
296+
if (isset($urlParts[0])) {
297+
//il se peut que l'on ait des variable avec ? dans l'url
298+
$urlQuery = explode('?', $urlParts[0]);
299+
$urlQueryPageName = $urlQuery[0];
300+
($urlQueryPageName == 'index' || $urlQueryPageName == '') ? $page['name'] = 'index' : $page['name'] = $urlQueryPageName;
301+
unset($urlParts[0]);
302+
} else {
303+
$page['name'] = 'index';
304+
}
305+
306+
$page['name'] = strtolower($page['name']);
307+
308+
//si c'est une page de controle de formulaire : on renomme la page
309+
if ($page['name'] == 'control') {
310+
$page['control'] = true;
311+
($urlParts[1] == 'index' || $urlParts[1] == '') ? $page['name']='index' : $page['name']=$urlParts[1];
312+
unset($urlParts[1]);
313+
}
314+
return $page;
315+
}
316+
280317
/**
281318
* Obtiens le fragment depuis une variable serveur,
282319
* ce qui est selon moi possible avec une bonne configuration serveur

application/include/vues/system/system.blade.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,26 @@
3030
@section('top-css')
3131
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/bootstrap-5.0.0-beta1-dist/css/bootstrap.min.css')}}">
3232
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/css/custom.css')}}">
33+
@if(\MVC\Classe\Browser::get() == 'Internet Explorer')
34+
<link rel="stylesheet" href="{{\MVC\Classe\Url::asset_rewrite('assets/html5-simple-date-input-polyfill-master/html5-simple-date-input-polyfill.css')}}">
35+
<!--<link rel="stylesheet" href="{{\MVC\Classe\Url::asset_rewrite('assets/hyperform-0.12.0/css/hyperform.css')}}">-->
36+
@endif
3337
@show
3438

3539
</head>
3640

3741
<body>
3842

3943
@section('top-javascript')
44+
@if(\MVC\Classe\Browser::get() == 'Internet Explorer')
45+
<!-- Polyfill.io will load polyfills your browser needs -->
46+
<script src="https://polyfill.io/v3/polyfill.min.js?features=default%2CNumber.parseInt%2CNumber.parseFloat%2CArray.prototype.find%2CArray.prototype.includes"></script>
47+
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.12.1/polyfill.min.js" integrity="sha512-uzOpZ74myvXTYZ+mXUsPhDF+/iL/n32GDxdryI2SJronkEyKC8FBFRLiBQ7l7U/PTYebDbgTtbqTa6/vGtU23A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
48+
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>
49+
<script src="{{\MVC\Classe\Url::asset_rewrite('assets/html5-simple-date-input-polyfill-master/html5-simple-date-input-polyfill.js')}}"></script>
50+
<script src="{{\MVC\Classe\Url::asset_rewrite('assets/hyperform-0.12.0/dist/hyperform.js')}}"></script>
51+
<script>hyperform(window);</script>
52+
@endif
4053
@show
4154

4255
@yield('body')
@@ -45,6 +58,7 @@
4558
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/bootstrap-5.0.0-beta1-dist/js/bootstrap.min.js')}}"></script>
4659
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/custom.js')}}"></script>
4760

61+
@if(\MVC\Classe\Browser::get() !== 'Internet Explorer')
4862
<script>
4963
5064
/*
@@ -71,6 +85,7 @@ function submitted(event) {
7185
}
7286
}
7387
</script>
88+
@endif
7489
@show
7590

7691
</body>

console/skel/page-vuejs.blade.php

Lines changed: 70 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,44 @@
77
@endsection
88

99
@section('content')
10-
<h1>%%PAGE%% - VUE.js Controlleur</h1>
11-
<br/><br/><br/>
12-
<div id="app">
13-
<div>
14-
<input v-model="searchText" placeholder="Search...">
15-
</div>
16-
<div v-if="is_loading">
17-
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
18-
</div>
19-
<div v-if="items" >
20-
<a href="#" v-for="item in itemsSearched" :key="item.id">
10+
<h1>ghibli - VUE.js Controlleur</h1>
11+
<br/><br/><br/>
12+
<div id="app">
13+
<div>
14+
<input v-model="searchText" placeholder="Search...">
15+
</div>
16+
<div v-if="is_loading" id="is-loading">
17+
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
18+
</div>
19+
<div v-if="items" >
20+
<a href="#" v-for="item in itemsSearched" :key="item.id">
21+
<div>
2122
<div>
22-
<div>
23-
<h2>
23+
<h2>
2424
@{{ item.title }}
25-
</h2>
26-
</div>
25+
</h2>
2726
</div>
28-
<div>
29-
<p>
30-
@{{ item.description.slice(0, 300) + "..." }}
31-
</p>
32-
</div>
33-
<div>
34-
<span>Year : @{{ item.release_date }}</span>
35-
<span>Director : @{{ item.director }}</span>
36-
<span>Producer : @{{ item.producer }}</span>
37-
</div>
38-
</a>
39-
</div>
40-
27+
</div>
28+
<div>
29+
<p>
30+
@{{ item.description.slice(0, 300) + "..." }}
31+
</p>
32+
</div>
33+
<div>
34+
<span>Year : @{{ item.release_date }}</span>
35+
<span>Director : @{{ item.director }}</span>
36+
<span>Producer : @{{ item.producer }}</span>
37+
</div>
38+
</a>
4139
</div>
40+
41+
</div>
4242
@endsection
4343

4444
@section('bottom-javascript')
4545
@parent
4646
<script>
47+
@if(\MVC\Classe\Browser::get() !== 'Internet Explorer')
4748
const vue = new Vue({
4849
el: '#app',
4950
data: {
@@ -53,11 +54,11 @@
5354
},
5455
mounted() {
5556
axios
56-
.get('https://ghibliapi.herokuapp.com/films')
57-
.then(response => {
58-
this.items = response.data;
57+
.get('https://ghibliapi.herokuapp.com/films')
58+
.then(response => {
59+
this.items = response.data;
5960
this.is_loading = false
60-
})
61+
})
6162
.catch(error => console.log(error))
6263
},
6364
computed : {
@@ -78,5 +79,42 @@
7879
}
7980
}
8081
});
82+
@else
83+
const vue = new Vue({
84+
el: '#app',
85+
data: {
86+
items: [],
87+
searchText: '',
88+
is_loading: true,
89+
},
90+
mounted: function() {
91+
axios
92+
.get('https://ghibliapi.herokuapp.com/films')
93+
.then(function(response) {
94+
this.items = response.data;
95+
this.is_loading = false;
96+
document.getElementById('is-loading').style.display = 'none';
97+
})
98+
.catch(function(error) {console.log(error)})
99+
},
100+
computed: {
101+
itemsSearched : function(){
102+
var self = this;
103+
if( this.searchText == ''){
104+
return this.items;
105+
}
106+
return this.items.filter(function(item){
107+
// https://www.reddit.com/r/vuejs/comments/62kfae/how_do_i_create_very_simple_instant_search_filter/
108+
// Must be of string type
109+
return item.title.toLowerCase().indexOf(self.searchText) >= 0 ||
110+
item.producer.toLowerCase().indexOf(self.searchText) >= 0 ||
111+
item.director.toLowerCase().indexOf(self.searchText) >= 0 ||
112+
item.release_date.toString().indexOf(self.searchText) >= 0;
113+
114+
});
115+
}
116+
}
117+
});
118+
@endif
81119
</script>
82120
@endsection
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 liorwohl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# html5-simple-date-input-polyfill
2+
Just include this simple script and IE (>=10) and Firefox will support `<input type="date">` without any dependencies, not even jQuery! 🎉
3+
4+
Support dynamically created inputs, so can be used in single page applications.
5+
6+
Support [AngularJS](https://github.com/angular/angular.js) (and possibly other libraries) bindings.
7+
8+
# Usage
9+
10+
#### browserify
11+
12+
`npm install html5-simple-date-input-polyfill --save`
13+
14+
`require('html5-simple-date-input-polyfill');`
15+
16+
#### Browser
17+
18+
`<link rel="stylesheet" href="html5-simple-date-input-polyfill.css" />`
19+
20+
`<script src="html5-simple-date-input-polyfill.min.js"></script>`
21+
22+
#### SCSS (optional)
23+
`@import "../node_modules/html5-simple-date-input-polyfill/html5-simple-date-input-polyfill.scss";`

0 commit comments

Comments
 (0)