Changeset 201072
- Timestamp:
- 02/02/2010 03:12:18 PM (15 years ago)
- Location:
- woopra/trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
woopra/trunk/inc/admin.php
r201033 r201072 11 11 */ 12 12 class WoopraAdmin extends Woopra { 13 14 /** 15 * Current Event 16 * @since 1.4.1 17 * @var array 18 */ 19 var $event; 20 21 /** 22 * All the events. 23 * @since 1.4.1 24 * @var array 25 */ 26 var $_events; 27 28 /** 29 * Initlize Test Error Code 30 * @since 1.5.0 31 * @var string 32 */ 33 var $init_error; 34 13 35 14 /** 36 15 * The plugin file. … … 114 93 * Test to see if we can even initilize 115 94 * @since 1.5.0 116 * @return boolean95 * @return 117 96 */ 118 97 function init_test() { … … 394 373 $newopts = array ( 395 374 'use_subdomain' => 0, 375 396 376 'root_domain' => $this->woopra_host(), 397 377 ); … … 410 390 function defaults() { 411 391 $defaults = array( 392 412 393 'version' => WOOPRA_VERSION, 413 394 'activated' => 1, 395 414 396 'api_key' => '', 415 397 'analytics_tab' => 'dashboard', 416 398 'run_status' => 'on', 417 'date_format' => 'yyyy-MM-dd', // hardcoded for now399 'date_format' => 'yyyy-MM-dd', // 418 400 'limit' => 50, 401 419 402 'auto_tagging' => 1, 420 403 'ignore_admin' => 0, 421 404 'track_admin' => 0, 405 422 406 'use_timeout' => 0, 423 407 'use_subdomain' => 0, … … 521 505 </tr> 522 506 <tr valign="top"> 507 508 509 510 511 512 513 514 515 516 517 518 523 519 <th scope="row"><?php _e('Ignore Administrator', 'woopra') ?></th> 524 520 <td> 525 521 <input type="checkbox" value="1"<?php checked('1', $this->get_option('ignore_admin')); ?> id="ignore_admin" name="woopra[ignore_admin]"/> <label for="ignore_admin"><?php _e("Ignore Administrator Visits", 'woopra'); ?></label><br /><?php _e("Enable this check box if you want Woopra to ignore <strong>your visits</strong> or any other administrator visits.", 'woopra'); ?> 526 </td>527 </tr>528 <tr valign="top">529 <th scope="row"><?php _e('Auto Tagging', 'woopra') ?></th>530 <td>531 <input type="checkbox" value="1"<?php checked('1', $this->get_option('auto_tagging')); ?> id="auto_tagging" name="woopra[auto_tagging]"/> <label for="auto_tagging"><?php _e("Automatically Tag Members & Commentators", 'woopra'); ?></label><br /><?php _e("Enable this check box if you want Woopra to auto-tag visitors.", 'woopra'); ?>532 522 </td> 533 523 </tr> -
woopra/trunk/inc/frontend.php
r200971 r201072 38 38 39 39 // Frontend Actions 40 add_action( 'wp', array(&$this, 'woopra_detect') );41 add_action( 'admin_head', array(&$this, 'woopra_detect'), 10 );42 add_action( 'wp_footer', array(&$this, 'woopra_widget'), 10 );43 40 add_action( 'init', array(&$this, 'init') ); 41 42 43 44 45 44 46 if ($this->get_option('track_admin')) 45 add_action( 'admin_footer', array(&$this, 'w oopra_widget'),10 );47 add_action( 'admin_footer', array(&$this, 'w 10 ); 46 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 99 100 101 102 103 104 105 106 107 108 109 110 47 111 } 48 112 … … 52 116 * @return boolean 53 117 */ 54 function woopra_status() {118 function _status() { 55 119 if ($this->get_option('run_status') == 'on') 56 120 return true; … … 64 128 * @return boolean 65 129 */ 66 function woopra_admin() {130 function _admin() { 67 131 if ($this->get_option('ignore_admin')) 68 132 if ($this->woopra_visitor['admin']) … … 73 137 return false; 74 138 } 75 76 function init() {77 wp_enqueue_script( 'woopra-tracking', $this->plugin_url() . '/js/jquery.tracking.js', array('jquery'), '20100201', true );78 139 79 // Set jQuery Options80 if ( $this->get_option('use_subdomain') )81 $this->create_localize( array('rootDomain' => $this->get_option('root_domain') ) );82 83 if ( $this->get_option('use_timeout') )84 $this->create_localize( array('setTimeoutValue' => ($this->get_option('timeout')*1000) ) );85 86 // For showing in the Woopra Desktop Application87 $this->create_localize( array('name' => __('Name')) );88 $this->create_localize( array('email' => __('email')) );89 90 // Output jQuery Options91 wp_localize_script( 'woopra-tracking', 'woopraFrontL10n', $this->local );92 }93 94 /**95 * Create the localized array string.96 * @since 1.5.097 * @param $array98 * @return none99 */100 function create_localize($array) {101 $this->local = array_merge($array, $this->local );102 }103 104 140 /** 105 141 * Create the Javascript Code at the Bottom … … 107 143 * @return none 108 144 */ 109 function w oopra_widget() {145 function widget() { 110 146 111 if ( !$this->woopra_status())147 if () 112 148 return; 113 149 114 if ($this->woopra_admin())115 return;116 117 150 /*** JQUERY CODE -- DO NOT MODFIY ***/ 118 151 echo "\r\n<!-- Woopra Analytics Code -->\r\n"; … … 130 163 * @return none 131 164 */ 132 function woopra_detect() {165 function detect() { 133 166 $current_user = wp_get_current_user(); 134 167 -
woopra/trunk/js/jquery.tracking.js
r200971 r201072 1 1 /* 2 * j query-woopra-analytics plugin2 * jlugin 3 3 * 4 4 * A jQuery plugin that makes it easier to implement Woopra tracking for your site. 5 * I've ported this from Christian Hellsten's excellent jQuery Google Analytics plugin.6 *7 * His plugin can be found at http://github.com/christianhellsten/jquery-google-analytics.8 5 * 9 6 * Adds the following methods to jQuery: … … 14 11 * See here for more: http://www.woopra.com/docs/customization/ 15 12 * 16 *17 13 * Copyright (c) 2009 Pranshu Arya 18 * 14 * Modifed by Shane <shane@bugssite.org> to work for the WordPress Woopra Plugin 15 * 19 16 * Version 1.1 20 17 ** … … 25 22 * - http://woopra.com 26 23 * - http://github.com/christianhellsten/jquery-google-analytics 27 * 28 * Modifed by Shane <shane@bugssite.org> to work for the WordPress Woopra Plugin 29 * 24 * - http://pranshuarya.com/jaal/Development/jquery-woopra-plugin.html 30 25 */ 31 26 32 27 (function($) { 33 28 34 /** 35 * Enables Woopra tracking on the page from which it's called. 36 * 37 * Usage: 38 * 39 * <script type="text/javascript"> 40 * $.trackWoopra(); 41 * </script> 42 * 43 * -or- 44 * 45 * <script type="text/javascript"> 46 * $.trackWoopra({domain : 'http://www.mydomain.com', url : 'http://www.myurl.com', title : 'My page', cookie : 'exclude_cookie'}); 47 * </script> 48 * 49 * domain parameter is optional - use it to specify root domain (to track sub-domains) 50 * 51 * url and title parameters are optional (but must be passed in together), 52 * in case you want to give pages custom names in Woopra 53 * 54 * use the cookie parameter to exclude visitors, including yourself, based on a cookie 55 * 56 */ 29 /** 30 * 31 */ 57 32 $.trackWoopra = function(woopra_data) { 58 33 var script; … … 113 88 if ( woopraTracker == 'undefined' ) { 114 89 debug('FATAL: woopraTracker is not defined'); // blocked by whatever 115 } 116 else if(excludeCookie == 'noCookie') { 90 } else { 117 91 var w_event = new WoopraEvent(title); 118 119 92 // For each property pair passed to woopraEvent, add it to w_event 120 93 $.each(woopra_options, function(i,val){ 121 94 w_event.addProperty(i,val); 122 // debug('w_event.addProperty(' + i + ', ' + val + ')');123 95 }); 124 96 w_event.fire(); 125 97 } 126 98 }; 127 128 /** 129 * Adds click tracking to elements. Usage: 130 * 131 * $('a').trackEvent({title : 'title', var1 : 'value1', var2: 'value2', var3 : 'value3', ..., event_name: 'mouseover'}); 132 * 133 * title parameter is required, all others are optional 134 * add as many property pairs as you want (as shown above) on your webpage 135 */ 136 $.fn.trackEvent = function(woopra_options) { 137 99 100 $.fn.trackEvent = function(woopra_options) { 101 138 102 // Add event handler to all matching elements 139 103 return this.each(function() { … … 142 106 143 107 // Prevent an element from being tracked multiple times. 144 if ( element.hasClass('w_tracked')) {108 if () { 145 109 return false; 146 } 147 else { 110 } else { 148 111 element.addClass('w_tracked'); 149 112 } 150 if (woopra_options){113 if{ 151 114 // Use default woopra_options, if necessary 152 var woop _settings = $.extend({}, $.fn.trackEvent.defaults, woopra_options);115 var woop_settings = $.extend({}, $.fn.trackEvent.defaults, woopra_options); 153 116 154 117 // Merge custom woopra_options with defaults. 155 var title = evaluate(element, woop _settings.title);156 var event_name = evaluate(element, woop _settings.event_name);118 var title = evaluate(element, woop_settings.title); 119 var event_name = evaluate(element, woop_settings.event_name); 157 120 158 121 // Iterate over the other property pairs in 'woopra_options'. Leave them alone if they are … … 178 141 var index = $(parent).find('> *').index(this); 179 142 // Should we skip internal links? REFACTOR 180 var skip = woop _settings.skip_internal && (element[0].hostname == location.hostname);143 var skip = woop_settings.skip_internal && (element[0].hostname == location.hostname); 181 144 // Get title and other property pair values for item that was clicked 182 145 // and pass them to $.woopraEvent 183 if( !skip) {184 var title = evaluate($(parent).children().eq(index), woop _settings.title);146 if() { 147 var title = evaluate($(parent).children().eq(index), woop_settings.title); 185 148 options = {} 186 149 $.each(woopra_options, function(i,val){ … … 188 151 }); 189 152 $.woopraEvent(title, options); 190 // Display item that was tracked when event_name was triggered 191 if(excludeCookie == 'noCookie'){ 192 debug('Tracked ' + message); 193 } 194 else { 195 debug('Tracking ' + message + ' skipped due to exclude cookie'); 196 } 153 debug('Tracked ' + message); 197 154 } else { 198 if(excludeCookie == 'noCookie'){ 199 debug('Skipped ' + message); 200 } 201 else { 202 debug('Skipped ' + message + ' due to exclude cookie'); 203 } 155 debug('Skipped ' + message); 204 156 } 205 157 return true; -
woopra/trunk/woopra.php
r200971 r201072 100 100 */ 101 101 function get_option($option) { 102 if ( isset($this->options[$option]))102 if () 103 103 return $this->options[$option]; 104 104 else
Note: See TracChangeset
for help on using the changeset viewer.