forked from bireme/bvs-site-wp-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bvs-site.php
82 lines (58 loc) · 2.15 KB
/
bvs-site.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
<?php
/*
Plugin Name: BVS Site
Plugin URI: http://reddes.bvsalud.org/projects/bvs-site/
Description: BVS Portal
Author: BIREME/OPAS/OMS
Version: 0.1
Author URI: http://reddes.bvsalud.org/
Site Wide Only: true
*/
define('BVS_VERSION', '0.1' );
define('BVS_URL', WP_PLUGIN_URL . '/bvs-site/');
define('BVS_PATH', dirname(__FILE__) );
// Load plugin files
require_once(BVS_PATH . '/bvs-core/widgets.php');
require_once(BVS_PATH . '/bvs-core/post_types.php');
require_once(BVS_PATH . '/bvs-core/page-links-to.php');
require_once(BVS_PATH . '/bvs-core/settings.php');
function vhl_init() {
wp_enqueue_script('jquery');
wp_enqueue_script('vhl-edit', BVS_URL . 'js/scripts.js');
wp_enqueue_style ('vhl-edit', BVS_URL . 'css/styles.css');
register_theme_directory( WP_PLUGIN_DIR . '/bvs-site/bvs-themes' );
new VHL_PageLinksTo;
}
function vhl_load_translation(){
// Translations
load_plugin_textdomain( 'vhl', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
function vhl_add_admin_menu() {
add_submenu_page( 'options-general.php', __('VHL Site Settings', 'vhl'), __('VHL Site', 'vhl'), 'manage_options', 'vhl',
'vhl_page_admin');
//call register settings function
add_action( 'admin_init', 'vhl_register_settings' );
}
function vhl_register_settings(){
register_setting('vhl-settings-group', 'vhl_config');
}
function vhl_google_analytics_code(){
$vhl_config = get_option('vhl_config');
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php echo $vhl_config['google_analytics_code'] ?>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
}
add_action( 'init', 'vhl_load_translation' );
add_action( 'plugins_loaded','vhl_init' );
add_action( 'admin_menu', 'vhl_add_admin_menu');
add_action( 'wp_head', 'vhl_google_analytics_code');
?>