PluginProbe
Wp-Insert / 1.0
Wp-Insert v1.0
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
← All changes | tracking/insert-analytics.php +68 -68 1.21.0 View file →
@@ -1,69 +1,69 @@
1 -<?php
2 -add_action('wp_footer', 'smart_add_footer_code');
3 -add_action('wp_head', 'smart_add_header_code');
4 -
5 -function smart_add_header_code($arg) {
6 -if(get_option('smart_analytics_header_enabled')) {
7 -echo get_option('smart_analytics_header_code');
8 -}
9 -return $arg;
10 -}
11 -
12 -function smart_add_footer_code($arg) {
13 -if(get_option('smart_analytics_enabled')) { ?>
14 -<script type="text/javascript">
15 - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
16 - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
17 -</script>
18 -<script type="text/javascript">
19 - var pageTracker = _gat._getTracker("<?php echo get_option('smart_analytics_id'); ?>");
20 - pageTracker._trackPageview();
21 -</script>
22 -<?php }
23 -if(get_option('smart_analytics_footer_enabled')) {
24 -echo get_option('smart_analytics_footer_code');
25 -}
26 -return $arg;
27 -}
28 -
29 -// action function for adding the administrative page
30 -function smart_add_analytics() { ?>
31 -<div class="wrap">
32 -<h2>WP-INSERT : Tracking Codes</h2>
33 -<?php show_support_options(); ?>
34 -<form method="post" action="options.php">
35 -<?php wp_nonce_field('update-options'); ?>
36 -
37 -<table class="form-table">
38 -
39 -<tr valign="top">
40 -<th scope="row">Google Analytics Tracker ID
41 -<br/><input id="smart_analytics_enabled" name="smart_analytics_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
42 -<td><input id="smart_analytics_id" name="smart_analytics_id" type="text" value="<?php echo get_option('smart_analytics_id'); ?>" style="width:350px;" /><br/>
43 -<small>( Paste your Google Analytics Tracker ID (XX-XXXXX-X) above )</small></td>
44 -</tr>
45 -
46 -<tr valign="top">
47 -<th scope="row">Insert Code into Header<br/>
48 -<br/><input id="smart_analytics_header_enabled" name="smart_analytics_header_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_header_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
49 -<td><textarea id="smart_analytics_header_code" name="smart_analytics_header_code" style="width:350px;height:150px;"><?php echo get_option('smart_analytics_header_code'); ?></textarea><br/>
50 -<small>( Paste Analytics or similar code in the box above )</small></td>
51 -</tr>
52 -
53 -<tr valign="top">
54 -<th scope="row">Insert Code into Footer<br/>
55 -<br/><input id="smart_analytics_footer_enabled" name="smart_analytics_footer_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_footer_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
56 -<td><textarea id="smart_analytics_footer_code" name="smart_analytics_footer_code" style="width:350px;height:150px;"><?php echo get_option('smart_analytics_footer_code'); ?></textarea><br/>
57 -<small>( Paste Analytics or similar code in the box above )</small></td>
58 -</tr>
59 -
60 -</table>
61 -
62 -<input type="hidden" name="action" value="update" />
63 -<input type="hidden" name="page_options" value="smart_analytics_enabled,smart_analytics_id,smart_analytics_header_enabled,smart_analytics_header_code,smart_analytics_footer_enabled,smart_analytics_footer_code" />
64 -<p class="submit">
65 -<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
66 -</p>
67 -</form>
68 -</div>
1 +<?php
2 +add_action('wp_footer', 'smart_add_footer_code');
3 +add_action('wp_head', 'smart_add_header_code');
4 +
5 +function smart_add_header_code($arg) {
6 +if(get_option('smart_analytics_header_enabled')) {
7 +echo get_option('smart_analytics_header_code');
8 +}
9 +return $arg;
10 +}
11 +
12 +function smart_add_footer_code($arg) {
13 +if(get_option('smart_analytics_enabled')) { ?>
14 +<script type="text/javascript">
15 + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
16 + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
17 +</script>
18 +<script type="text/javascript">
19 + var pageTracker = _gat._getTracker("<?php echo get_option('smart_analytics_id'); ?>");
20 + pageTracker._trackPageview();
21 +</script>
22 +<?php }
23 +if(get_option('smart_analytics_footer_enabled')) {
24 +echo get_option('smart_analytics_footer_code');
25 +}
26 +return $arg;
27 +}
28 +
29 +// action function for adding the administrative page
30 +function smart_add_analytics() { ?>
31 +<div class="wrap">
32 +<h2>WP-INSERT : Tracking Codes</h2>
33 +<?php show_support_options(); ?>
34 +<form method="post" action="options.php">
35 +<?php wp_nonce_field('update-options'); ?>
36 +
37 +<table class="form-table">
38 +
39 +<tr valign="top">
40 +<th scope="row">Google Analytics Tracker ID
41 +<br/><input id="smart_analytics_enabled" name="smart_analytics_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
42 +<td><input id="smart_analytics_id" name="smart_analytics_id" type="text" value="<?php echo get_option('smart_analytics_id'); ?>" style="width:350px;" /><br/>
43 +<small>( Paste your Google Analytics Tracker ID (XX-XXXXX-X) above )</small></td>
44 +</tr>
45 +
46 +<tr valign="top">
47 +<th scope="row">Insert Code into Header<br/>
48 +<br/><input id="smart_analytics_header_enabled" name="smart_analytics_header_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_header_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
49 +<td><textarea id="smart_analytics_header_code" name="smart_analytics_header_code" style="width:350px;height:150px;"><?php echo get_option('smart_analytics_header_code'); ?></textarea><br/>
50 +<small>( Paste Analytics or similar code in the box above )</small></td>
51 +</tr>
52 +
53 +<tr valign="top">
54 +<th scope="row">Insert Code into Footer<br/>
55 +<br/><input id="smart_analytics_footer_enabled" name="smart_analytics_footer_enabled" type="checkbox" value="1"<?php if(get_option('smart_analytics_footer_enabled')) echo ' checked="checked"'; ?>/> Enabled</th>
56 +<td><textarea id="smart_analytics_footer_code" name="smart_analytics_footer_code" style="width:350px;height:150px;"><?php echo get_option('smart_analytics_footer_code'); ?></textarea><br/>
57 +<small>( Paste Analytics or similar code in the box above )</small></td>
58 +</tr>
59 +
60 +</table>
61 +
62 +<input type="hidden" name="action" value="update" />
63 +<input type="hidden" name="page_options" value="smart_analytics_enabled,smart_analytics_id,smart_analytics_header_enabled,smart_analytics_header_code,smart_analytics_footer_enabled,smart_analytics_footer_code" />
64 +<p class="submit">
65 +<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
66 +</p>
67 +</form>
68 +</div>
69 69 <?php } ?>