Changeset 51
- Timestamp:
- 02/18/07 17:17:34 (5 years ago)
- Files:
-
- trunk/tools/copy2test.bat.sample (modified) (1 diff)
- trunk/wp_iminr.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tools/copy2test.bat.sample
r50 r51 1 1 REM Set path to WordPress installation (version 2.1 and 2.0) 2 2 set WORDPRESS_PATH_2_0=C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wordpress_2_0 3 set WORDPRESS_PATH_2_1=C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wordpress_2_ 03 set WORDPRESS_PATH_2_1=C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wordpress_2_1 4 4 5 5 REM Set path to plugin folder from WordPress root trunk/wp_iminr.php
r50 r51 29 29 // print current tracker without other tags 30 30 function iMinR () { 31 if (wp_iminr_enable_for_user()) { 32 echo wp_iminr_get_tracker(); 33 } else { 34 echo '<!-- iMinR for WordPress is desable for current user -->'; 35 } 31 wp_iminr_insert_tracker(); 36 32 } 37 33 38 34 // print current tracker with meta tags 39 35 function wp_iminr_meta() { 40 if (wp_iminr_enable_for_user()) { 41 echo wp_iminr_get_option('js_in_meta_before'). wp_iminr_get_tracker() . wp_iminr_get_option('js_in_meta_after'); 42 } else { 43 echo '<!-- iMinR for WordPress is desable for current user -->'; 44 } 36 wp_iminr_insert_tracker('meta'); 45 37 } 46 38 47 39 // print current tracker with footer tags 48 40 function wp_iminr_footer() { 49 if (wp_iminr_enable_for_user()) { 50 echo wp_iminr_get_option('js_in_footer_before') . wp_iminr_get_tracker() . wp_iminr_get_option('js_in_footer_after'); 51 } else { 52 echo '<!-- iMinR for WordPress is desable for current user -->'; 53 } 54 } 55 56 // get tracker code or "desable" comment 57 function wp_iminr_get_tracker() { 58 $account_id = wp_iminr_get_option('account_id'); 59 if ($account_id != '') { 60 if (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') { 61 return "<script language=\"javascript\" src=\"http://tag.iminr.com/audit/tag.aspx?id=$account_id\"></script>"; 41 wp_iminr_insert_tracker('footer'); 42 } 43 44 // insert tracker code or "desable" comment 45 function wp_iminr_insert_tracker($location='') { 46 global $wp_iminr_tracker_inserted; 47 48 if (!$wp_iminr_tracker_inserted) { 49 $account_id = wp_iminr_get_option('account_id'); 50 if ($account_id != '' && wp_iminr_enable_for_user()) { 51 echo "<!-- iMinR for WordPress is enable -->\n"; 52 $wp_iminr_tracker_inserted = true; 53 54 if (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') { 55 $tracker = "<script language=\"javascript\" src=\"http://tag.iminr.com/audit/tag.aspx?id=$account_id\"></script>"; 56 } else { 57 $tracker = "<script language=\"javascript\" src=\"https://tags.iminr.com/audit/tag.aspx?id=$account_id\"></script>"; 58 } 59 60 switch ($location) { 61 case 'meta': 62 echo wp_iminr_get_option('tracker_in_meta_before') . $tracker . wp_iminr_get_option('tracker_in_meta_after'); 63 break; 64 case 'footer': 65 echo wp_iminr_get_option('tracker_in_footer_before') . $tracker . wp_iminr_get_option('tracker_in_footer_after'); 66 break; 67 default: 68 echo $tracker; 69 } 70 } elseif ($account_id != '' && !wp_iminr_enable_for_user()) { 71 echo "<!-- iMinR for WordPress is desable for current user -->\n"; 62 72 } else { 63 return "<script language=\"javascript\" src=\"https://tags.iminr.com/audit/tag.aspx?id=$account_id\"></script>";73 echo "<!-- iMinR for WordPress is desable because account id isn\'t set -->\n"; 64 74 } 65 75 } 66 return '<!-- iMinR for WordPress is desable -->';67 76 } 68 77 … … 80 89 $wp_iminr_default_options['account_id'] = ''; 81 90 82 $wp_iminr_default_options['enable_ js'] = false;83 $wp_iminr_default_options[' js_in_meta'] = true;84 $wp_iminr_default_options[' js_in_meta_before'] = '<li>';85 $wp_iminr_default_options[' js_in_meta_after'] = '</li>';86 $wp_iminr_default_options[' js_in_footer'] = false;87 $wp_iminr_default_options[' js_in_footer_before'] = '<br />';88 $wp_iminr_default_options[' js_in_footer_after'] = '';91 $wp_iminr_default_options['enable_tracker'] = false; 92 $wp_iminr_default_options['tracker_in_meta'] = true; 93 $wp_iminr_default_options['tracker_in_meta_before'] = '<li>'; 94 $wp_iminr_default_options['tracker_in_meta_after'] = '</li>'; 95 $wp_iminr_default_options['tracker_in_footer'] = false; 96 $wp_iminr_default_options['tracker_in_footer_before'] = '<br />'; 97 $wp_iminr_default_options['tracker_in_footer_after'] = ''; 89 98 $wp_iminr_default_options['desable_for_roles'] = array('administrator'); 90 99 … … 116 125 $wp_iminr_options['account_id'] = $_POST['account_id']; 117 126 118 $wp_iminr_options['enable_ js'] = ($_POST['enable_js'] == 'true' ? true : false);119 $wp_iminr_options[' js_in_meta'] = ($_POST['js_in'] == 'meta' ? true : false);120 $wp_iminr_options[' js_in_meta_before'] = $_POST['js_in_meta_before'];121 $wp_iminr_options[' js_in_meta_after'] = $_POST['js_in_meta_after'];122 $wp_iminr_options[' js_in_footer'] = ($_POST['js_in'] == 'footer' ? true : false);123 $wp_iminr_options[' js_in_footer_before'] = $_POST['js_in_footer_before'];124 $wp_iminr_options[' js_in_footer_after'] = $_POST['js_in_footer_after'];127 $wp_iminr_options['enable_tracker'] = ($_POST['enable_tracker'] == 'true' ? true : false); 128 $wp_iminr_options['tracker_in_meta'] = ($_POST['tracker_in'] == 'meta' ? true : false); 129 $wp_iminr_options['tracker_in_meta_before'] = $_POST['tracker_in_meta_before']; 130 $wp_iminr_options['tracker_in_meta_after'] = $_POST['tracker_in_meta_after']; 131 $wp_iminr_options['tracker_in_footer'] = ($_POST['tracker_in'] == 'footer' ? true : false); 132 $wp_iminr_options['tracker_in_footer_before'] = $_POST['tracker_in_footer_before']; 133 $wp_iminr_options['tracker_in_footer_after'] = $_POST['tracker_in_footer_after']; 125 134 $wp_iminr_options['desable_for_roles'] = $_POST['desable_for_roles']; 126 135 … … 154 163 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 155 164 <tr> 156 <th nowrap valign="top"><label for="enable_ js"><?php _e('Enable tracker', 'wp_iminr') ?></label></th>157 <td valign="top"> 158 <input type="checkbox" name="enable_ js" id="enable_js" value="true" <?php if (wp_iminr_get_option('enable_js')) echo 'checked="checked"'; ?> />165 <th nowrap valign="top"><label for="enable_tracker"><?php _e('Enable tracker', 'wp_iminr') ?></label></th> 166 <td valign="top"> 167 <input type="checkbox" name="enable_tracker" id="enable_tracker" value="true" <?php if (wp_iminr_get_option('enable_tracker')) echo 'checked="checked"'; ?> /> 159 168 <br /><small><?php _e('By unchecking this checkbox tracker will be not included on the page.', 'wp_iminr') ?></small> 160 169 </td> 161 170 </tr> 162 171 <tr> 163 <th nowrap valign="top"><label for=" js_in_meta"><?php _e('Add in sidebar', 'wp_iminr') ?></label></th>164 <td valign="top"> 165 <input type="radio" name=" js_in" id="js_in_meta" value="meta" <?php if (wp_iminr_get_option('js_in_meta')) echo 'checked="checked"'; ?> />172 <th nowrap valign="top"><label for="tracker_in_meta"><?php _e('Add in sidebar', 'wp_iminr') ?></label></th> 173 <td valign="top"> 174 <input type="radio" name="tracker_in" id="tracker_in_meta" value="meta" <?php if (wp_iminr_get_option('tracker_in_meta')) echo 'checked="checked"'; ?> /> 166 175 <small><?php _e('By checking this radio button tracker will be included in meta (if template implemente this option).', 'wp_iminr') ?></small> 167 <br /><input type="text" name=" js_in_meta_before" id="js_in_meta_before" value="<?php echo wp_iminr_get_option('js_in_meta_before'); ?>" size="25" style="text-align: right;" />176 <br /><input type="text" name="tracker_in_meta_before" id="tracker_in_meta_before" value="<?php echo wp_iminr_get_option('tracker_in_meta_before'); ?>" size="25" style="text-align: right;" /> 168 177 <img src="" alt="iMinR" /> 169 <input type="text" name=" js_in_meta_after" id="js_in_meta_after" value="<?php echo wp_iminr_get_option('js_in_meta_after'); ?>" size="25" />178 <input type="text" name="tracker_in_meta_after" id="tracker_in_meta_after" value="<?php echo wp_iminr_get_option('tracker_in_meta_after'); ?>" size="25" /> 170 179 <br /><small><?php _e('This tags inclose iMinR javascript, useful with logo.', 'wp_iminr') ?></small> 171 180 </td> 172 181 </tr> 173 182 <tr> 174 <th nowrap valign="top"><label for=" js_in_footer"><?php _e('Add in footer', 'wp_iminr') ?></label></th>175 <td valign="top"> 176 <input type="radio" name=" js_in" id="js_in_footer" value="footer" <?php if (wp_iminr_get_option('js_in_footer')) echo 'checked="checked"'; ?> />183 <th nowrap valign="top"><label for="tracker_in_footer"><?php _e('Add in footer', 'wp_iminr') ?></label></th> 184 <td valign="top"> 185 <input type="radio" name="tracker_in" id="tracker_in_footer" value="footer" <?php if (wp_iminr_get_option('tracker_in_footer')) echo 'checked="checked"'; ?> /> 177 186 <small><?php _e('By checking this radio button tracker will be included in footer.', 'wp_iminr') ?></small> 178 187 <br /> 179 <input type="text" name=" js_in_footer_before" id="js_in_footer_before" value="<?php echo wp_iminr_get_option('js_in_footer_before'); ?>" size="25" style="text-align: right;" />188 <input type="text" name="tracker_in_footer_before" id="tracker_in_footer_before" value="<?php echo wp_iminr_get_option('tracker_in_footer_before'); ?>" size="25" style="text-align: right;" /> 180 189 <img src="" alt="iMinR" /> 181 <input type="text" name=" js_in_footer_after" id="js_in_footer_after" value="<?php echo wp_iminr_get_option('js_in_footer_after'); ?>" size="25" />190 <input type="text" name="tracker_in_footer_after" id="tracker_in_footer_after" value="<?php echo wp_iminr_get_option('tracker_in_footer_after'); ?>" size="25" /> 182 191 <br /><small><?php _e('This tags inclose iMinR javascript, useful with logo.', 'wp_iminr') ?></small> 183 192 </td> … … 241 250 242 251 // tracker inclusion 243 if ( wp_iminr_get_option('enable_ js') && wp_iminr_get_option('js_in_meta') ) {252 if ( wp_iminr_get_option('enable_tracker') && wp_iminr_get_option('tracker_in_meta') ) { 244 253 add_action('wp_meta', 'wp_iminr_meta'); 245 } elseif ( wp_iminr_get_option('enable_ js') && wp_iminr_get_option('js_in_footer') ) {254 } elseif ( wp_iminr_get_option('enable_tracker') && wp_iminr_get_option('tracker_in_footer') ) { 246 255 add_action('wp_footer', 'wp_iminr_footer'); 247 256 }
