Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1595 | Rev 1600 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1474 delphine 1
<?php
2
 
3
function __autoload($nom_classe) {
4
	$chemins = array(
5
			'..'.DS.'bibliotheque'.DS.'dao',
6
			'..'.DS.'bibliotheque'.DS.'utilitaires',
7
			'bibliotheque'.DS.'pear','composants');	foreach ($chemins as $chemin) {
8
		$fichier_a_inclure = dirname(__FILE__).DS.$chemin.DS.$nom_classe.'.php';
9
		if (file_exists($fichier_a_inclure)) {
10
			include_once $fichier_a_inclure;
11
			return null;
12
		}
13
	}
14
}
15
 
16
// ATTENTION: aucune autre langue que le français n'est supportée pour eflore
17
// pour le moment on supprime le paramètre à la main car la présence des fichiers d'i18n n'est pas testée
18
if(isset($_GET['langue'])) {
19
	unset($_GET['langue']);
20
}
21
 
1477 mathias 22
// Inclusion du Framework
23
$framework = __DIR__ . '/framework.php';
24
require_once $framework;
1474 delphine 25
 
1477 mathias 26
// Ajout d'information concernant cette application
27
Framework::setCheminAppli(__FILE__);// Obligatoire
28
Framework::setInfoAppli(Config::get('info'));// Optionnel
1474 delphine 29
 
1477 mathias 30
// Annuler les fausses bonnes idées du JPFramework
31
restore_exception_handler();
32
restore_error_handler();
33
//error_reporting(E_ALL ^ E_NOTICE);
1474 delphine 34
 
1477 mathias 35
// Configuration issue de la page ACF "Applis externes"
36
Config::set('base_url_application', $chemin_eflore_http);
1483 delphine 37
Config::set('url_css_appli', $chemin_eflore_http . '/presentations/styles/eflore_wordpress.css');
1479 mathias 38
Config::set('url_css_pdf', $chemin_eflore_http . '/presentations/styles/pdf.css');
39
Config::set('url_css_images', $chemin_eflore_http . '/presentations/images/');
1474 delphine 40
 
1479 mathias 41
// Configuration des URL d'après l'URL actuelle de Wordpress
42
global $wp;
43
$current_url = home_url(add_query_arg(array(),$wp->request));
44
Config::set('url_base', $current_url);
45
Config::set('url_base_index', $current_url);
46
Config::set('base_url_application_index', $current_url . '/');
47
 
1477 mathias 48
// Initialisation du controleur principal de l'application
49
AppControleur::initialiser();
1474 delphine 50
 
1477 mathias 51
// Hook d'ajout des scripts
52
add_action('wp_enqueue_scripts', 'eflore_scripts_et_styles');
1474 delphine 53
 
1477 mathias 54
// ajout des scripts - utiliser dans le hook ci-dessus uniquement
55
function eflore_scripts_et_styles() {
1481 mathias 56
	// Cette variable est définie dans le thème WP par template-eflore.php,
57
	// d'après l'option "applis_externes_chemin_eflore"
1477 mathias 58
	global $chemin_eflore_http;
59
	// Styles
60
	wp_enqueue_style('eFlore-wordpress', $chemin_eflore_http . '/presentations/styles/eflore_wordpress.css');
61
	wp_enqueue_style('jquery-ui', 'https://resources.tela-botanica.org/jquery/jquery-ui/1.10.2/css/smoothness/jquery-ui-1.10.2.custom.css');
62
	wp_enqueue_style('jquery-fancybox', 'https://resources.tela-botanica.org/jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css');
1474 delphine 63
 
1477 mathias 64
	// Scripts
65
	// @TODO remplacer ce patch cracra par une mise à jour du code JS d'eFlore
66
	wp_enqueue_script('jquery-noconflict-compat', 'https://resources.tela-botanica.org/jquery/jquery-noconflict-compat.js');
67
	//wp_enqueue_script('jquery', 'https://resources.tela-botanica.org/jquery/1.9.1/jquery.min.js');
68
	wp_enqueue_script('jquery-cookie', 'https://resources.tela-botanica.org/jquery/cookie/1.0/jquery.cookie.min.js');
69
	wp_enqueue_script('jquery-ui', 'https://resources.tela-botanica.org/jquery/jquery-ui/1.10.2/js/jquery-ui-1.10.2.custom.min.js');
1597 killian 70
	wp_enqueue_script('jquery-fancybox', 'https://resources.tela-botanica.org/jquery/fancybox/2.1.4/jquery.fancybox.pack.js');
71
	wp_enqueue_script('jquery-migrate', 'https://code.jquery.com/jquery-migrate-1.0.0.min.js');
1474 delphine 72
 
1477 mathias 73
	//wp_enqueue_script('eFlore-commun', $chemin_eflore_http . '/presentations/scripts/commun.js');
74
	wp_enqueue_script('eFlore-eFlore', $chemin_eflore_http . '/presentations/scripts/eflore.js');
1517 delphine 75
	//wp_enqueue_script('eFlore-recherche', $chemin_eflore_http . '/presentations/scripts/recherche.js');
1477 mathias 76
	wp_enqueue_script('eFlore-fiche-synthese', $chemin_eflore_http . '/presentations/scripts/fiche-synthese.js');
77
}
1474 delphine 78
 
1477 mathias 79
// Affichage du contenu de l'application
80
function eflore_get_contenu() {
81
	return AppControleur::getContenuCorps();
82
}