Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 98 lines (69 sloc) 2.957 kb
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
<?php
/*
Plugin Name: Simple Spinnakr
Plugin URI: http://omaruddin.com/2012/05/03/simple-spinnakr-wordpress-plugin/

Description: A simple plugin to add Spinnakr integration code on your pages. You simply enter your ID and apply. Sprinkle more JS codes for deeper integrations.
Version: 1.0
Author: Omar Uddin
Author URI: http://omaruddin.com/
*/
?>
<?php


add_action('admin_menu', 'spinnakr_menu') ;


function spinnakr_menu() {

add_options_page('Simple Spinnakr', 'Spinnakr Settings', 'administrator', __FILE__, 'spinnakr_settings') ;


add_action( 'admin_init', 'spinnakr_register_mysettings') ;
}


function spinnakr_register_mysettings() {
register_setting('spinnakr-settings-group', 'spinnakr_site_id') ;
}


function spinnakr_settings() {

?>
<div class="wrap">
<h2><?php _e('Simple Spinnakr', 'simple_spinnakr') ; ?></h2>
<p>
<?php
_e('Simple Spinnakr allows you to easilly add your Spinnakr Project analytics tracking code on all your pages.', 'simple_spinnakr') ;
echo '<br/>' ;
_e('Just go to your Spinnakr <a href="http://spinnakr.com/">management console</a>, find your Site ID, add your ID below and hit save.', 'simple_spinnakr') ;
echo '<br/>' ;
_e('If you have any page level caching turned on, be sure to clear the cache across the entire site!', 'simple_spinnakr') ;
echo '<br/><br/>' ;
_e('That\'s all, you\'re ready to go.', 'simple_spinnakr') ;
?>
</p>
<form method="post" action="options.php" id="spinnakr_form">
<?php settings_fields('spinnakr-settings-group'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row" style="width: 300px; text-align:right;"><?php _e('Spinnakr Project ID', 'simple_spinnakr') ; ?></th>
<td>
<input type="text" size="80" name="spinnakr_site_id" value="<?php echo get_option('spinnakr_site_id'); ?>">
</td>
</tr>
</table>

<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Settings') ?>" />
</p>
</form>
<p>
<?php
_e('Get your own Spinnakr account now - <a href="http://spinnakr.com/">http://spinnakr.com/</a>', 'simple_spinnakr') ;
echo '<br/><br/>' ;
_e('If you need any support go to the plugin homepage and contact me !', 'simple_spinnakr') ;
echo '<br/><br/>' ;
echo '<a href="http://omaruddin.com/2012/05/03/simple-spinnakr/" target="_blank"></a>' ;
echo '<br/><br/>' ;


?>
</p>
</div>

<?php
}

add_action('wp_footer', 'spinnakr_function');


function spinnakr_function() {

if ( !is_user_logged_in() && get_option('spinnakr_site_id')!="") { ?>
<script>var _spinnakr_site_id="<?php echo get_option('spinnakr_site_id'); ?>";(function(d,t,a){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g[a]=a;g.src='//s5.spn.ee/js/so.js';s.parentNode.insertBefore(g,s)}(document,'script','async'))</script>



<?php
}
}
?>
Something went wrong with that request. Please try again.