Tracking Code Manager - Version 1.5

Version Description

Release Date - 13/04/2015

  • Insert a non-intrusive rate-us button (top-right of the screen)
  • Bugfix in metabox widget
  • Some translations corrected
  • Minor bugfixes
Download this release

Release Info

Developer IntellyWP
Plugin Icon 128x128 Tracking Code Manager
Version 1.5
Comparing to
See all releases

Code changes from version 1.4 to 1.5

assets/css/style.css CHANGED
@@ -74,6 +74,9 @@
74
  .tcm-checkbox {
75
  margin:0px;
76
  }
 
 
 
77
  .tcm-select {
78
 
79
  }
74
  .tcm-checkbox {
75
  margin:0px;
76
  }
77
+ .tcm-checkbox:disabled {
78
+ background-color: #f8f8f8;
79
+ }
80
  .tcm-select {
81
 
82
  }
assets/deps/starrr/starrr.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .starrr {
2
+ display: inline-block; }
3
+ .starrr i {
4
+ font-size: 16px;
5
+ padding: 0 1px;
6
+ cursor: pointer;
7
+ color: #ffd119; }
assets/deps/starrr/starrr.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var __slice = [].slice;
2
+
3
+ (function(jQuery, window) {
4
+ var Starrr;
5
+ window.Starrr = Starrr = (function() {
6
+ Starrr.prototype.defaults = {
7
+ rating: void 0,
8
+ numStars: 5,
9
+ emptyStarClass: 'fa fa-star-o',
10
+ fullStarClass: 'fa fa-star',
11
+ change: function(e, value) {}
12
+ };
13
+
14
+ function Starrr($el, options) {
15
+ var i, _, _ref;
16
+ this.options = jQuery.extend({}, this.defaults, options);
17
+ this.$el = $el;
18
+ _ref = this.defaults;
19
+ for (i in _ref) {
20
+ _ = _ref[i];
21
+ if (this.$el.data(i.toLowerCase()) != null) {
22
+ this.options[i] = this.$el.data(i.toLowerCase());
23
+ }
24
+ }
25
+ if (this.$el.data('connected-input')) {
26
+ this.$connectedInput = jQuery("[name=\"" + (this.$el.data('connected-input')) + "\"]");
27
+ this.options.rating = this.$connectedInput.val() ? parseInt(this.$connectedInput.val(), 10) : void 0;
28
+ }
29
+ this.createStars();
30
+ this.syncRating();
31
+ if (this.$connectedInput && this.$connectedInput.is(':disabled')) {
32
+ return;
33
+ }
34
+ this.$el.on('mouseover.starrr', 'i', (function(_this) {
35
+ return function(e) {
36
+ return _this.syncRating(_this.getStars().index(e.currentTarget) + 1);
37
+ };
38
+ })(this));
39
+ this.$el.on('mouseout.starrr', (function(_this) {
40
+ return function() {
41
+ return _this.syncRating();
42
+ };
43
+ })(this));
44
+ this.$el.on('click.starrr', 'i', (function(_this) {
45
+ return function(e) {
46
+ return _this.setRating(_this.getStars().index(e.currentTarget) + 1);
47
+ };
48
+ })(this));
49
+ this.$el.on('starrr:change', this.options.change);
50
+ if (this.$connectedInput != null) {
51
+ this.$el.on('starrr:change', (function(_this) {
52
+ return function(e, value) {
53
+ _this.$connectedInput.val(value);
54
+ return _this.$connectedInput.trigger('focusout');
55
+ };
56
+ })(this));
57
+ }
58
+ }
59
+
60
+ Starrr.prototype.getStars = function() {
61
+ return this.$el.find('i');
62
+ };
63
+
64
+ Starrr.prototype.createStars = function() {
65
+ var _i, _ref, _results;
66
+ _results = [];
67
+ for (_i = 1, _ref = this.options.numStars; 1 <= _ref ? _i <= _ref : _i >= _ref; 1 <= _ref ? _i++ : _i--) {
68
+ _results.push(this.$el.append("<i class='" + this.options.emptyStarClass + "'></i>"));
69
+ }
70
+ return _results;
71
+ };
72
+
73
+ Starrr.prototype.setRating = function(rating) {
74
+ if (this.options.rating === rating) {
75
+ rating = void 0;
76
+ }
77
+ this.options.rating = rating;
78
+ this.syncRating();
79
+ return this.$el.trigger('starrr:change', rating);
80
+ };
81
+
82
+ Starrr.prototype.getRating = function() {
83
+ return this.options.rating;
84
+ };
85
+
86
+ Starrr.prototype.syncRating = function(rating) {
87
+ var i, _i, _j, _ref, _ref1;
88
+ rating || (rating = this.options.rating);
89
+ if (rating) {
90
+ for (i = _i = 0, _ref = rating - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
91
+ this.getStars().eq(i).removeClass(this.options.emptyStarClass).addClass(this.options.fullStarClass);
92
+ }
93
+ }
94
+ if (rating && rating < this.options.numStars) {
95
+ for (i = _j = rating, _ref1 = this.options.numStars - 1; rating <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = rating <= _ref1 ? ++_j : --_j) {
96
+ this.getStars().eq(i).removeClass(this.options.fullStarClass).addClass(this.options.emptyStarClass);
97
+ }
98
+ }
99
+ if (!rating) {
100
+ return this.getStars().removeClass(this.options.fullStarClass).addClass(this.options.emptyStarClass);
101
+ }
102
+ };
103
+
104
+ return Starrr;
105
+
106
+ })();
107
+ return jQuery.fn.extend({
108
+ starrr: function() {
109
+ var args, option;
110
+ option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
111
+ return this.each(function() {
112
+ var data;
113
+ data = jQuery(this).data('starrr');
114
+ if (!data) {
115
+ jQuery(this).data('starrr', (data = new Starrr(jQuery(this), option)));
116
+ }
117
+ if (typeof option === 'string') {
118
+ return data[option].apply(data, args);
119
+ }
120
+ });
121
+ }
122
+ });
123
+ })(window.jQuery, window);
assets/deps/starrr/starrr.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .starrr{display:inline-block}.starrr i{font-size:16px;padding:0 1px;cursor:pointer;color:#ffd119}
assets/deps/starrr/starrr.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var __slice=[].slice;!function(a,b){var c;return b.Starrr=c=function(){function b(b,c){var d,e,f;this.options=a.extend({},this.defaults,c),this.$el=b,f=this.defaults;for(d in f)e=f[d],null!=this.$el.data(d.toLowerCase())&&(this.options[d]=this.$el.data(d.toLowerCase()));this.$el.data("connected-input")&&(this.$connectedInput=a('[name="'+this.$el.data("connected-input")+'"]'),this.options.rating=this.$connectedInput.val()?parseInt(this.$connectedInput.val(),10):void 0),this.createStars(),this.syncRating(),this.$connectedInput&&this.$connectedInput.is(":disabled")||(this.$el.on("mouseover.starrr","i",function(a){return function(b){return a.syncRating(a.getStars().index(b.currentTarget)+1)}}(this)),this.$el.on("mouseout.starrr",function(a){return function(){return a.syncRating()}}(this)),this.$el.on("click.starrr","i",function(a){return function(b){return a.setRating(a.getStars().index(b.currentTarget)+1)}}(this)),this.$el.on("starrr:change",this.options.change),null!=this.$connectedInput&&this.$el.on("starrr:change",function(a){return function(b,c){return a.$connectedInput.val(c),a.$connectedInput.trigger("focusout")}}(this)))}return b.prototype.defaults={rating:void 0,numStars:5,emptyStarClass:"fa fa-star-o",fullStarClass:"fa fa-star",change:function(){}},b.prototype.getStars=function(){return this.$el.find("i")},b.prototype.createStars=function(){var a,b,c;for(c=[],a=1,b=this.options.numStars;b>=1?b>=a:a>=b;b>=1?a++:a--)c.push(this.$el.append("<i class='"+this.options.emptyStarClass+"'></i>"));return c},b.prototype.setRating=function(a){return this.options.rating===a&&(a=void 0),this.options.rating=a,this.syncRating(),this.$el.trigger("starrr:change",a)},b.prototype.getRating=function(){return this.options.rating},b.prototype.syncRating=function(a){var b,c,d,e,f;if(a||(a=this.options.rating),a)for(b=c=0,e=a-1;e>=0?e>=c:c>=e;b=e>=0?++c:--c)this.getStars().eq(b).removeClass(this.options.emptyStarClass).addClass(this.options.fullStarClass);if(a&&a<this.options.numStars)for(b=d=a,f=this.options.numStars-1;f>=a?f>=d:d>=f;b=f>=a?++d:--d)this.getStars().eq(b).removeClass(this.options.fullStarClass).addClass(this.options.emptyStarClass);return a?void 0:this.getStars().removeClass(this.options.fullStarClass).addClass(this.options.emptyStarClass)},b}(),a.fn.extend({starrr:function(){var b,d;return d=arguments[0],b=2<=arguments.length?__slice.call(arguments,1):[],this.each(function(){var e;return e=a(this).data("starrr"),e||a(this).data("starrr",e=new c(a(this),d)),"string"==typeof d?e[d].apply(e,b):void 0})}})}(window.jQuery,window),$(function(){return $(".starrr").starrr()});
includes/admin/about.php CHANGED
@@ -1,12 +1,4 @@
1
  <?php
2
- function tcm_ui_rate_us() {
3
- $rate_text = sprintf(__('Thank you for using <a href="%1$s" target="_blank">Easy Digital Downloads</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'edd'),
4
- 'https://easydigitaldownloads.com',
5
- 'https://wordpress.org/support/view/plugin-reviews/easy-digital-downloads?rate=5#postform'
6
- );
7
- return $rate_text;
8
- }
9
-
10
  function tcm_ui_about() {
11
  global $tcm;
12
 
@@ -23,15 +15,15 @@ function tcm_ui_about() {
23
  <ul>
24
  <li>
25
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>email.png" />
26
- <a href="mailto:aleste@intellywp.com">Email aleste@intellywp.com</a>
27
  </li>
28
  <li>
29
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>twitter.png" />
30
- <a href="https://twitter.com/intellywp" target="_new">Twitter @intellywp</a>
31
  </li>
32
  <li>
33
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>internet.png" />
34
- <a href="http://www.intellywp.com" target="_new">Website intellywp.com</a>
35
  </li>
36
  </ul>
37
  <?php
1
  <?php
 
 
 
 
 
 
 
 
2
  function tcm_ui_about() {
3
  global $tcm;
4
 
15
  <ul>
16
  <li>
17
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>email.png" />
18
+ <a href="mailto:aleste@intellywp.com">aleste@intellywp.com</a>
19
  </li>
20
  <li>
21
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>twitter.png" />
22
+ <?php $tcm->Utils->twitter('intellywp')?>
23
  </li>
24
  <li>
25
  <img style="float:left; margin-right:10px;" src="<?php echo TCM_PLUGIN_IMAGES?>internet.png" />
26
+ <a href="http://www.intellywp.com" target="_new">IntellyWP.com</a>
27
  </li>
28
  </ul>
29
  <?php
includes/admin/editor.php CHANGED
@@ -169,7 +169,7 @@ function tcm_ui_editor() {
169
 
170
  $args=array('id'=>'tcm-except-div', 'name'=>'tcm-except-div');
171
  $tcm->Form->divStarts($args);
172
- $tcm->Form->p('Except when?');
173
  tcm_formOptions('except', $snippet);
174
  $tcm->Form->divEnds();
175
 
@@ -202,10 +202,14 @@ function tcm_notice_pro_features() {
202
  <?php
203
 
204
  $options = array('public' => TRUE, '_builtin' => FALSE);
205
- $q = get_post_types($options, 'names');
206
- $q = array_merge($q, array('post', 'page'));
207
- sort($q);
208
- $q=implode(', ', $q);
 
 
 
 
209
 
210
  while($tcm->Lang->H('Notice.ProFeature'.$i)) { ?>
211
  <div style="clear:both; margin-top: 2px;"></div>
169
 
170
  $args=array('id'=>'tcm-except-div', 'name'=>'tcm-except-div');
171
  $tcm->Form->divStarts($args);
172
+ $tcm->Form->p('Exclude when?');
173
  tcm_formOptions('except', $snippet);
174
  $tcm->Form->divEnds();
175
 
202
  <?php
203
 
204
  $options = array('public' => TRUE, '_builtin' => FALSE);
205
+ $q=get_post_types($options, 'names');
206
+ if(is_array($q) && count($q)>0) {
207
+ sort($q);
208
+ $q=implode(', ', $q);
209
+ $q='(<b>'.$q.'</b>)';
210
+ } else {
211
+ $q='';
212
+ }
213
 
214
  while($tcm->Lang->H('Notice.ProFeature'.$i)) { ?>
215
  <div style="clear:both; margin-top: 2px;"></div>
includes/admin/manager.php CHANGED
@@ -45,13 +45,17 @@ function tcm_ui_manager() {
45
  global $tcm;
46
 
47
  $id=intval($tcm->Utils->qs('id', 0));
48
- if ($tcm->Utils->qs('action')=='delete' && $id>0 && wp_verify_nonce($tcm->Utils->qs('tcm_nonce'), 'tcm_delete')) {
49
- $snippet=$tcm->Manager->get($id);
50
  if ($tcm->Manager->remove($id)) {
51
  $tcm->Options->pushSuccessMessage('CodeDeleteNotice', $id, $snippet['name']);
52
  }
53
- } else if($id!='') {
54
  $snippet=$tcm->Manager->get($id);
 
 
 
 
55
  $tcm->Options->pushSuccessMessage('CodeUpdateNotice', $id, $snippet['name']);
56
  }
57
 
@@ -105,9 +109,23 @@ function tcm_ui_manager() {
105
  <tr>
106
  <td><?php echo $snippet['name']?></td>
107
  <td><?php $tcm->Lang->P('Editor.position.'.$snippet['position'])?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  <?php
109
- tcm_ui_manager_column($snippet['active']);
110
-
111
  $hide=!$snippet['active'];
112
  tcm_ui_manager_column($snippet['includeEverywhereActive'], NULL, $hide);
113
  ?>
45
  global $tcm;
46
 
47
  $id=intval($tcm->Utils->qs('id', 0));
48
+ if ($tcm->Utils->is('action', 'delete') && $id>0 && wp_verify_nonce($tcm->Utils->qs('tcm_nonce'), 'tcm_delete')) {
49
+ $snippet = $tcm->Manager->get($id);
50
  if ($tcm->Manager->remove($id)) {
51
  $tcm->Options->pushSuccessMessage('CodeDeleteNotice', $id, $snippet['name']);
52
  }
53
+ } elseif($id>0) {
54
  $snippet=$tcm->Manager->get($id);
55
+ if($tcm->Utils->is('action', 'toggle') && $id>0 && wp_verify_nonce($tcm->Utils->qs('tcm_nonce'), 'tcm_toggle')) {
56
+ $snippet['active']=($snippet['active']==0 ? 1 : 0);
57
+ $tcm->Manager->put($snippet['id'], $snippet);
58
+ }
59
  $tcm->Options->pushSuccessMessage('CodeUpdateNotice', $id, $snippet['name']);
60
  }
61
 
109
  <tr>
110
  <td><?php echo $snippet['name']?></td>
111
  <td><?php $tcm->Lang->P('Editor.position.'.$snippet['position'])?></td>
112
+ <td style="text-align:center;">
113
+ <?php
114
+ $color='red';
115
+ $text='No';
116
+ $question='QuestionActiveOn';
117
+ if($snippet['active']==1) {
118
+ $color='green';
119
+ $text='Yes';
120
+ $question='QuestionActiveOff';
121
+ }
122
+ $text='<span style="font-weight:bold; color:'.$color.'">'.$tcm->Lang->L($text).'</span>';
123
+ ?>
124
+ <a onclick="return confirm('<?php echo $tcm->Lang->L($question)?>');" href="<?php echo TCM_TAB_MANAGER_URI?>&tcm_nonce=<?php echo esc_attr(wp_create_nonce('tcm_toggle')); ?>&action=toggle&id=<?php echo $snippet['id'] ?>">
125
+ <?php echo $text?>
126
+ </a>
127
+ </td>
128
  <?php
 
 
129
  $hide=!$snippet['active'];
130
  tcm_ui_manager_column($snippet['includeEverywhereActive'], NULL, $hide);
131
  ?>
includes/admin/metabox.php CHANGED
@@ -6,31 +6,38 @@ function tcm_ui_metabox($post) {
6
 
7
  $args=array('metabox'=>TRUE, 'field'=>'id');
8
  $ids=$tcm->Manager->getCodes(-1, $post, $args);
9
- $snippetsIds=$tcm->Manager->keys();
10
  ?>
11
  <div>
12
- <?php $tcm->Lang->P('Select existing Tracking Code')?>..
13
  </div>
14
  <input type="hidden" name="tcm_previous_ids" value="<?php echo implode(',', $ids)?>" />
15
 
16
  <div>
17
  <?php
18
- foreach($snippetsIds as $id) {
19
- $snippet=$tcm->Manager->get($id);
20
- $text=$snippet['name'];
 
21
  $checked='';
22
- if(in_array($id, $ids)) {
23
- $checked=' checked';
24
- $active=FALSE;
25
- if($snippet['active']) {
26
- $postType=$post->post_type;
27
- $active=$snippet['includePostsOfType_'.$postType.'_Active']>0;
 
 
 
 
 
 
 
28
  }
29
- $text='<b style="color:'.($active ? 'green' : 'red').';">'.$text.'</b>';
30
  }
31
  ?>
32
- <input type="checkbox" name="tcm_ids[]" value="<?php echo $id?>" <?php echo $checked ?> />
33
- <a href="<?php echo TCM_TAB_EDITOR_URI?>&id=<?php echo $id?>" target="_blank"><?php echo $text?></a>
34
  <br/>
35
  <?php } ?>
36
  </div>
@@ -38,14 +45,14 @@ function tcm_ui_metabox($post) {
38
  <br/>
39
  <?php if($tcm->Manager->rc()>0) { ?>
40
  <div>
41
- <label for="tcm_name">...<?php $tcm->Lang->P('or add a name')?></label>
42
  <br/>
43
  <input type="text" name="tcm_name" value="" style="width:100%"/>
44
  </div>
45
  <div>
46
  <label for="code"><?php $tcm->Lang->P('and paste HTML code here')?></label>
47
  <br/>
48
- <textarea dir="ltr" dirname="ltr" name="tcm_code" rows="10" style="font-family:Monaco,'Courier New',Courier,monospace;font-size:12px;width:100%;color:#555;background-color: #f8f8f8;"></textarea>
49
  </div>
50
  <?php } else { ?>
51
  <span style="color:red;font-weight:bold;"><?php $tcm->Lang->P('FreeLicenseReached')?></span>
@@ -116,7 +123,11 @@ function tcm_save_meta_box_data($postId) {
116
  $snippet['include'.$keyArray] = array_diff($snippet['include'.$keyArray], array($postId));
117
  $snippet['include'.$keyArray] = array_unique($snippet['include'.$keyArray]);
118
  $snippet['include'.$keyActive]=(count($snippet['include'.$keyArray])>0 ? 1 : 0);
 
119
  //include it in post type exception
 
 
 
120
  $snippet['except'.$keyArray] = array_merge($snippet['except'.$keyArray], array($postId));
121
  $snippet['except'.$keyArray] = array_unique($snippet['except'.$keyArray]);
122
  $snippet['except'.$keyActive]=1;
@@ -131,6 +142,9 @@ function tcm_save_meta_box_data($postId) {
131
  $snippet = $tcm->Manager->get($id);
132
  if ($snippet) {
133
  //include my id in post type includes
 
 
 
134
  $snippet['include'.$keyArray] = array_merge($snippet['include'.$keyArray], array($postId));
135
  $snippet['include'.$keyArray] = array_unique($snippet['include'.$keyArray]);
136
  $snippet['include'.$keyActive]=1;
6
 
7
  $args=array('metabox'=>TRUE, 'field'=>'id');
8
  $ids=$tcm->Manager->getCodes(-1, $post, $args);
9
+ $snippets=$tcm->Manager->values();
10
  ?>
11
  <div>
12
+ <?php $tcm->Lang->P('Select existing Tracking Code')?>
13
  </div>
14
  <input type="hidden" name="tcm_previous_ids" value="<?php echo implode(',', $ids)?>" />
15
 
16
  <div>
17
  <?php
18
+ $postType=$post->post_type;
19
+ foreach($snippets as $snippet) {
20
+ $id=$snippet['id'];
21
+ $disabled='';
22
  $checked='';
23
+
24
+ if($snippet['active']==0) {
25
+ $disabled=' DISABLED';
26
+ } elseif($snippet['exceptPostsOfType_'.$postType.'_Active']>0 && in_array(-1, $snippet['exceptPostsOfType_'.$postType])) {
27
+ //the user have excluded all the posts of this type from code definition
28
+ $disabled=' DISABLED';
29
+ } else {
30
+ if(in_array($id, $ids)) {
31
+ $checked=' checked';
32
+ $active=($snippet['includePostsOfType_'.$postType.'_Active']>0);
33
+ if(!$active) {
34
+ $checked='';
35
+ }
36
  }
 
37
  }
38
  ?>
39
+ <input type="checkbox" class="tcm-checkbox" name="tcm_ids[]" value="<?php echo $id?>" <?php echo $checked ?> <?php echo $disabled ?> />
40
+ <a href="<?php echo TCM_TAB_EDITOR_URI?>&id=<?php echo $id?>" target="_blank"><?php echo $snippet['name']?></a>
41
  <br/>
42
  <?php } ?>
43
  </div>
45
  <br/>
46
  <?php if($tcm->Manager->rc()>0) { ?>
47
  <div>
48
+ <label for="tcm_name"><?php $tcm->Lang->P('Or add a name')?></label>
49
  <br/>
50
  <input type="text" name="tcm_name" value="" style="width:100%"/>
51
  </div>
52
  <div>
53
  <label for="code"><?php $tcm->Lang->P('and paste HTML code here')?></label>
54
  <br/>
55
+ <textarea dir="ltr" dirname="ltr" name="tcm_code" class="tcm-textarea" style="width:100%; height:175px;"></textarea>
56
  </div>
57
  <?php } else { ?>
58
  <span style="color:red;font-weight:bold;"><?php $tcm->Lang->P('FreeLicenseReached')?></span>
123
  $snippet['include'.$keyArray] = array_diff($snippet['include'.$keyArray], array($postId));
124
  $snippet['include'.$keyArray] = array_unique($snippet['include'.$keyArray]);
125
  $snippet['include'.$keyActive]=(count($snippet['include'.$keyArray])>0 ? 1 : 0);
126
+
127
  //include it in post type exception
128
+ if($snippet['except'.$keyActive]==0) {
129
+ $snippet['except'.$keyArray]=array();
130
+ }
131
  $snippet['except'.$keyArray] = array_merge($snippet['except'.$keyArray], array($postId));
132
  $snippet['except'.$keyArray] = array_unique($snippet['except'.$keyArray]);
133
  $snippet['except'.$keyActive]=1;
142
  $snippet = $tcm->Manager->get($id);
143
  if ($snippet) {
144
  //include my id in post type includes
145
+ if($snippet['include'.$keyActive]==0) {
146
+ $snippet['include'.$keyArray]=array();
147
+ }
148
  $snippet['include'.$keyArray] = array_merge($snippet['include'.$keyArray], array($postId));
149
  $snippet['include'.$keyArray] = array_unique($snippet['include'.$keyArray]);
150
  $snippet['include'.$keyActive]=1;
includes/class-TCM-logger.php CHANGED
@@ -23,18 +23,18 @@ class TCM_Logger {
23
  array_pop($this->context);
24
  }
25
 
26
- public function fatal($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
27
- $what=$this->write('[FATAL]', $message, $v1, $v2, $v3, $v4, $v5);
28
  die($what);
29
  }
30
- public function debug($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
31
- $this->write('[DEBUG]', $message, $v1, $v2, $v3, $v4, $v5);
32
  }
33
- public function info($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
34
- $this->write('[INFO] ', $message, $v1, $v2, $v3, $v4, $v5);
35
  }
36
- public function error($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
37
- $this->write('[ERROR]', $message, $v1, $v2, $v3, $v4, $v5);
38
  }
39
  private function dump($v) {
40
  if($v!=NULL) {
@@ -44,7 +44,7 @@ class TCM_Logger {
44
  }
45
  return $v;
46
  }
47
- private function write($verbosity, $message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
48
  global $tcm;
49
 
50
  $text=sprintf($message
@@ -52,7 +52,8 @@ class TCM_Logger {
52
  , $this->dump($v2)
53
  , $this->dump($v3)
54
  , $this->dump($v4)
55
- , $this->dump($v5));
 
56
  $message=date("d/m/Y H:i:s")." ".$verbosity." ";
57
  if(count($this->context)>0) {
58
  $message.='{'.$this->context[count($this->context)-1].'} ';
23
  array_pop($this->context);
24
  }
25
 
26
+ public function fatal($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL, $v6=NULL) {
27
+ $what=$this->write('[FATAL]', $message, $v1, $v2, $v3, $v4, $v5, $v6);
28
  die($what);
29
  }
30
+ public function debug($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL, $v6=NULL) {
31
+ $this->write('[DEBUG]', $message, $v1, $v2, $v3, $v4, $v5, $v6);
32
  }
33
+ public function info($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL, $v6=NULL) {
34
+ $this->write('[INFO] ', $message, $v1, $v2, $v3, $v4, $v5, $v6);
35
  }
36
+ public function error($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL, $v6=NULL) {
37
+ $this->write('[ERROR]', $message, $v1, $v2, $v3, $v4, $v5, $v6);
38
  }
39
  private function dump($v) {
40
  if($v!=NULL) {
44
  }
45
  return $v;
46
  }
47
+ private function write($verbosity, $message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL, $v6=NULL) {
48
  global $tcm;
49
 
50
  $text=sprintf($message
52
  , $this->dump($v2)
53
  , $this->dump($v3)
54
  , $this->dump($v4)
55
+ , $this->dump($v5)
56
+ , $this->dump($v6));
57
  $message=date("d/m/Y H:i:s")." ".$verbosity." ";
58
  if(count($this->context)>0) {
59
  $message.='{'.$this->context[count($this->context)-1].'} ';
includes/class-TCM-manager.php CHANGED
@@ -12,6 +12,7 @@ class TCM_Manager {
12
  public function exists($name) {
13
  $snippets = $this->values();
14
  $result = NULL;
 
15
  if (isset($snippets[$name])) {
16
  $result=$snippets[$name];
17
  }
@@ -153,7 +154,7 @@ class TCM_Manager {
153
  $what=$prefix.'PostsOfType_'.$postType;
154
  if(!$include && $snippet[$what.'_Active'] && $tcm->Utils->inArray($postId, $snippet[$what])) {
155
  $tcm->Logger->debug('MATCH=%s SNIPPET=%s[%s] DUE TO POST=%s OF TYPE=%s IN [%s]'
156
- , $prefix, $snippet['ID'], $snippet['name'], $postId, $postType, $snippet[$what]);
157
  $include=TRUE;
158
  }
159
  }
@@ -213,13 +214,13 @@ class TCM_Manager {
213
  continue;
214
  }
215
  if($tcm->Options->hasSnippetWritten($v)) {
216
- $tcm->Logger->debug('SKIPPED SNIPPET=%s[%s] DUE TO ALREADY WRITTEN', $v['ID'], $v['name']);
217
  continue;
218
  }
219
 
220
  $match=FALSE;
221
  if(!$match && $v['includeEverywhereActive']) {
222
- $tcm->Logger->debug('INCLUDED SNIPPET=%s[%s] DUE TO EVERYWHERE', $v['ID'], $v['name']);
223
  $match=TRUE;
224
  }
225
  if(!$match && $postId>0 && $this->matchSnippet($postId, $postType, $categoriesIds, $tagsIds, 'include', $v)) {
12
  public function exists($name) {
13
  $snippets = $this->values();
14
  $result = NULL;
15
+ $name=strtoupper($name);
16
  if (isset($snippets[$name])) {
17
  $result=$snippets[$name];
18
  }
154
  $what=$prefix.'PostsOfType_'.$postType;
155
  if(!$include && $snippet[$what.'_Active'] && $tcm->Utils->inArray($postId, $snippet[$what])) {
156
  $tcm->Logger->debug('MATCH=%s SNIPPET=%s[%s] DUE TO POST=%s OF TYPE=%s IN [%s]'
157
+ , $prefix, $snippet['id'], $snippet['name'], $postId, $postType, $snippet[$what]);
158
  $include=TRUE;
159
  }
160
  }
214
  continue;
215
  }
216
  if($tcm->Options->hasSnippetWritten($v)) {
217
+ $tcm->Logger->debug('SKIPPED SNIPPET=%s[%s] DUE TO ALREADY WRITTEN', $v['id'], $v['name']);
218
  continue;
219
  }
220
 
221
  $match=FALSE;
222
  if(!$match && $v['includeEverywhereActive']) {
223
+ $tcm->Logger->debug('INCLUDED SNIPPET=%s[%s] DUE TO EVERYWHERE', $v['id'], $v['name']);
224
  $match=TRUE;
225
  }
226
  if(!$match && $postId>0 && $this->matchSnippet($postId, $postType, $categoriesIds, $tagsIds, 'include', $v)) {
includes/class-TCM-options.php CHANGED
@@ -102,12 +102,24 @@ class TCM_Options {
102
  public function setTrackingNotice($value) {
103
  $this->setOption('TrackingNotice', $value);
104
  }
105
- //TrackingLastSendPro
106
  public function getTrackingLastSend() {
107
- return $this->getOption('TrackingLastSend', 0);
108
  }
109
  public function setTrackingLastSend($value) {
110
- $this->setOption('TrackingLastSend', $value);
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
 
113
  //LoggerEnable
102
  public function setTrackingNotice($value) {
103
  $this->setOption('TrackingNotice', $value);
104
  }
105
+
106
  public function getTrackingLastSend() {
107
+ return $this->getOption('TrackingLastSend['.TCM_PLUGIN_NAME.']', 0);
108
  }
109
  public function setTrackingLastSend($value) {
110
+ $this->setOption('TrackingLastSend['.TCM_PLUGIN_NAME.']', $value);
111
+ }
112
+ public function getPluginInstallDate() {
113
+ return $this->getOption('PluginInstallDate['.TCM_PLUGIN_NAME.']', 0);
114
+ }
115
+ public function setPluginInstallDate($value) {
116
+ $this->setOption('PluginInstallDate['.TCM_PLUGIN_NAME.']', $value);
117
+ }
118
+ public function getPluginUpdateDate() {
119
+ return $this->getOption('PluginUpdateDate['.TCM_PLUGIN_NAME.']', 0);
120
+ }
121
+ public function setPluginUpdateDate($value) {
122
+ $this->setOption('PluginUpdateDate['.TCM_PLUGIN_NAME.']', $value);
123
  }
124
 
125
  //LoggerEnable
includes/class-TCM-tracking.php CHANGED
@@ -111,6 +111,8 @@ class TCM_Tracking {
111
  $result['iwpm_plugin_name']=TCM_PLUGIN_NAME;
112
  $result['iwpm_plugin_version']=TCM_PLUGIN_VERSION;
113
  $result['iwpm_plugin_data']=$data;
 
 
114
 
115
  $result['iwpm_tracking_enable']=$tcm->Options->isTrackingEnable();
116
  $result['iwpm_logger_enable']=$tcm->Options->isLoggerEnable();
111
  $result['iwpm_plugin_name']=TCM_PLUGIN_NAME;
112
  $result['iwpm_plugin_version']=TCM_PLUGIN_VERSION;
113
  $result['iwpm_plugin_data']=$data;
114
+ $result['iwpm_plugin_install_date']=$tcm->Options->getPluginInstallDate();
115
+ $result['iwpm_plugin_update_date']=$tcm->Options->getPluginUpdateDate();
116
 
117
  $result['iwpm_tracking_enable']=$tcm->Options->isTrackingEnable();
118
  $result['iwpm_logger_enable']=$tcm->Options->isLoggerEnable();
includes/class-TCM-utils.php CHANGED
@@ -67,6 +67,34 @@ class TCM_Utils {
67
  return $result;
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  //per ottenere un campo dal $_GET oppure dal $_POST
72
  function qs($name, $default = '') {
67
  return $result;
68
  }
69
 
70
+ function is($name, $compare, $default='', $ignoreCase=TRUE) {
71
+ $what=$this->qs($name, $default);
72
+ $result=FALSE;
73
+ if(is_string($compare)) {
74
+ $compare=explode(',', $compare);
75
+ }
76
+ if($ignoreCase){
77
+ $what=strtolower($what);
78
+ }
79
+
80
+ foreach($compare as $v) {
81
+ if($ignoreCase){
82
+ $v=strtolower($v);
83
+ }
84
+ if($what==$v) {
85
+ $result=TRUE;
86
+ break;
87
+ }
88
+ }
89
+ return $result;
90
+ }
91
+
92
+ public function twitter($name) {
93
+ ?>
94
+ <a href="https://twitter.com/<?php echo $name?>" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @<?php echo $name?></a>
95
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
96
+ <?php
97
+ }
98
 
99
  //per ottenere un campo dal $_GET oppure dal $_POST
100
  function qs($name, $default = '') {
includes/install.php CHANGED
@@ -1,7 +1,13 @@
1
  <?php
2
 
3
  function tcm_install($networkwide=NULL) {
4
- global $wpdb;
 
 
 
 
 
 
5
  }
6
 
7
  register_activation_hook(TCM_PLUGIN_FILE, 'tcm_install');
1
  <?php
2
 
3
  function tcm_install($networkwide=NULL) {
4
+ global $wpdb, $tcm;
5
+
6
+ $time=$tcm->Options->getPluginInstallDate();
7
+ if($time==0) {
8
+ $tcm->Options->setPluginInstallDate(time());
9
+ }
10
+ $tcm->Options->setPluginUpdateDate(time());
11
  }
12
 
13
  register_activation_hook(TCM_PLUGIN_FILE, 'tcm_install');
languages/TCM.txt CHANGED
@@ -47,10 +47,10 @@ Editor.includeEverywhereActive=Include in the whole website (pages, posts and ar
47
  Editor.includeCategoriesActive=Include in posts with specific categories
48
  Editor.includeTagsActive=Include in posts with specific tags
49
  Editor.includePostsOfTypeActive=Include in "<b>{0}</b>"
50
- Editor.exceptCategoriesActive=Except in posts with specific categories
51
- Editor.exceptTagsActive=Except in posts with specific tags
52
- Editor.exceptPostsOfTypeActive=Except in "<b>{0}</b>"
53
- Editor.includeLastPostsActive=Include in lastest posts (specify the number posts)
54
 
55
  DeactivateSuccess=License key "{0}" successfully deactivated
56
  DeactivateError=Errors deactivating key. Network problem??
@@ -67,8 +67,11 @@ License.key=Insert the activation key received by email
67
  EmptyTrackingList=Your tracking code list is empty, please <a href="{0}">CLICK HERE</a> to create new ones.
68
 
69
  Notice.ProHeader1=Do you like this plugin?
70
- Notice.ProHeader2=Using the <b>PREMIUM</b> version you can also include/except tracking code:
71
- Notice.ProFeature1=In your custom post type (p.e. <b>{0}</b>)
72
- Notice.ProFeature2=In the lastest post
73
  Notice.ProFeature3=In specific categories
74
  Notice.ProFeature4=In specific tags
 
 
 
47
  Editor.includeCategoriesActive=Include in posts with specific categories
48
  Editor.includeTagsActive=Include in posts with specific tags
49
  Editor.includePostsOfTypeActive=Include in "<b>{0}</b>"
50
+ Editor.exceptCategoriesActive=Exclude in posts with specific categories
51
+ Editor.exceptTagsActive=Exclude in posts with specific tags
52
+ Editor.exceptPostsOfTypeActive=Exclude in "<b>{0}</b>"
53
+ Editor.includeLastPostsActive=Include in latest posts (specify the number of posts)
54
 
55
  DeactivateSuccess=License key "{0}" successfully deactivated
56
  DeactivateError=Errors deactivating key. Network problem??
67
  EmptyTrackingList=Your tracking code list is empty, please <a href="{0}">CLICK HERE</a> to create new ones.
68
 
69
  Notice.ProHeader1=Do you like this plugin?
70
+ Notice.ProHeader2=Using the <b>PREMIUM</b> version you can also include/exclude tracking code:
71
+ Notice.ProFeature1=In your custom post type {0}
72
+ Notice.ProFeature2=In the latest post
73
  Notice.ProFeature3=In specific categories
74
  Notice.ProFeature4=In specific tags
75
+
76
+ QuestionActiveOn=Are you sure you want to active this code?
77
+ QuestionActiveOff=Are you sure you want to disactive this code?
readme.txt CHANGED
@@ -10,7 +10,7 @@ Compatible with Facebook Ads, Google Adwords and ALL kind of Saas tool.
10
 
11
  == Description ==
12
 
13
- **Tracking Code manageris a plugin that give you the ability to manage ALL your tracking code and scripts in one single page.**
14
 
15
  It doesn’t matter the place where you want to put your code, because with Tracking Code Manager you can put it wherever you want, with no restrictions.
16
 
@@ -82,12 +82,17 @@ Nope! We tested the most famous Google Analytics plugins and it will not brake a
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
 
 
85
  = 1.4 =
86
- * 06/04/2015
87
- * Created the FREE version following Wordpress specs. Branching the PRO version available to buy using website http://www.intellywp.com/tracking-code-manager
88
 
89
- = 1.3 =
90
- * 02/04/2015
91
  * Fixed a bug that caused the hidden of "Save" button when the license if FREE
92
 
93
  = 1.2 =
10
 
11
  == Description ==
12
 
13
+ **Tracking Code manager is a plugin that give you the ability to manage ALL your tracking code and scripts in one single page.**
14
 
15
  It doesn’t matter the place where you want to put your code, because with Tracking Code Manager you can put it wherever you want, with no restrictions.
16
 
82
 
83
  == Changelog ==
84
 
85
+ = 1.5 =
86
+ *Release Date - 13/04/2015*
87
+
88
+ * Insert a non-intrusive rate-us button (top-right of the screen)
89
+ * Bugfix in metabox widget
90
+ * Some translations corrected
91
+ * Minor bugfixes
92
+
93
  = 1.4 =
94
+ *Release Date - 06/04/2015*
 
95
 
 
 
96
  * Fixed a bug that caused the hidden of "Save" button when the license if FREE
97
 
98
  = 1.2 =
tracking-code-manager.php CHANGED
@@ -6,11 +6,11 @@ Description: A plugin to manage ALL your tracking code and conversion pixels, si
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: aleste@intellywp.com
9
- Version: 1.4
10
  */
11
  define('TCM_PLUGIN_FILE',__FILE__);
12
  define('TCM_PLUGIN_NAME', 'tracking-code-manager');
13
- define('TCM_PLUGIN_VERSION', '1.4');
14
  define('TCM_PLUGIN_AUTHOR', 'IntellyWP');
15
  define('TCM_PLUGIN_ROOT', dirname(__FILE__).'/');
16
  define('TCM_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
@@ -122,8 +122,8 @@ class TCM_Tabs {
122
 
123
  wp_enqueue_style('tcm-css', plugins_url('assets/css/style.css', __FILE__ ));
124
  wp_enqueue_style('tcm-select2-css', plugins_url('assets/deps/select2-3.5.2/select2.css', __FILE__ ));
125
- //wp_enqueue_style('tcm-select2-css2', plugins_url('deps/select2/css/select2.custom.css', __FILE__ ));
126
  wp_enqueue_script('tcm-select2-js', plugins_url('assets/deps/select2-3.5.2/select2.min.js', __FILE__ ));
 
127
 
128
  wp_register_script('tcm-autocomplete', plugins_url('assets/js/tcm-autocomplete.js', __FILE__ ), array('jquery', 'jquery-ui-autocomplete'), '1.0', FALSE);
129
  wp_localize_script('tcm-autocomplete', 'TCMAutocomplete', array('url' => admin_url('admin-ajax.php')
@@ -199,13 +199,40 @@ class TCM_Tabs {
199
  global $tcm;
200
  $tab=$tcm->Check->of('tab', TCM_TAB_MANAGER);
201
 
202
- echo '<h2 class="nav-tab-wrapper">';
203
- foreach ($this->tabs as $k=>$v) {
204
- $active = ($tab==$k ? 'nav-tab-active' : '');
205
- echo '<a class="nav-tab '.$active.'" href="?page='.TCM_PLUGIN_NAME.'&tab='.$k.'">'.$v.'</a>';
206
- }
207
- echo '</h2>';
208
- }
209
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
  $tcmTabs=new TCM_Tabs();
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: aleste@intellywp.com
9
+ Version: 1.5
10
  */
11
  define('TCM_PLUGIN_FILE',__FILE__);
12
  define('TCM_PLUGIN_NAME', 'tracking-code-manager');
13
+ define('TCM_PLUGIN_VERSION', '1.5');
14
  define('TCM_PLUGIN_AUTHOR', 'IntellyWP');
15
  define('TCM_PLUGIN_ROOT', dirname(__FILE__).'/');
16
  define('TCM_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
122
 
123
  wp_enqueue_style('tcm-css', plugins_url('assets/css/style.css', __FILE__ ));
124
  wp_enqueue_style('tcm-select2-css', plugins_url('assets/deps/select2-3.5.2/select2.css', __FILE__ ));
 
125
  wp_enqueue_script('tcm-select2-js', plugins_url('assets/deps/select2-3.5.2/select2.min.js', __FILE__ ));
126
+ wp_enqueue_script('tcm-starrr-js', plugins_url('assets/deps/starrr/starrr.js', __FILE__ ));
127
 
128
  wp_register_script('tcm-autocomplete', plugins_url('assets/js/tcm-autocomplete.js', __FILE__ ), array('jquery', 'jquery-ui-autocomplete'), '1.0', FALSE);
129
  wp_localize_script('tcm-autocomplete', 'TCMAutocomplete', array('url' => admin_url('admin-ajax.php')
199
  global $tcm;
200
  $tab=$tcm->Check->of('tab', TCM_TAB_MANAGER);
201
 
202
+ ?>
203
+ <h2 class="nav-tab-wrapper" style="float:left; width:97%;">
204
+ <?php
205
+ foreach ($this->tabs as $k=>$v) {
206
+ $active = ($tab==$k ? 'nav-tab-active' : '');
207
+ ?>
208
+ <a style="float:left" class="nav-tab <?php echo $active?>" href="?page=<?php echo TCM_PLUGIN_NAME?>&tab=<?php echo $k?>"><?php echo $v?></a>
209
+ <?php
210
+ }
211
+ ?>
212
+ <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
213
+ <style>
214
+ .starrr {display:inline-block}
215
+ .starrr i{font-size:16px;padding:0 1px;cursor:pointer;color:#2ea2cc;}
216
+ </style>
217
+ <div style="float:right; display:none;" id="rate-box">
218
+ <span style="font-weight:700; font-size:13px; color:#555;"><?php $tcm->Lang->P('Rate us')?></span>
219
+ <div id="tcm-rate" class="starrr" data-connected-input="tcm-rate-rank"></div>
220
+ <input type="hidden" id="tcm-rate-rank" name="tcm-rate-rank" value="5" />
221
+
222
+ </div>
223
+ <script>
224
+ jQuery(function() {
225
+ jQuery(".starrr").starrr();
226
+ jQuery('#tcm-rate').on('starrr:change', function(e, value){
227
+ var url='https://wordpress.org/support/view/plugin-reviews/tracking-code-manager?rate=5#postform';
228
+ window.open(url);
229
+ });
230
+ jQuery('#rate-box').show();
231
+ });
232
+ </script>
233
+ </h2>
234
+ <div style="clear:both;"></div>
235
+ <?php }
236
+ }
237
 
238
  $tcmTabs=new TCM_Tabs();