Skip to content

Commit

Permalink
2.4.90
Browse files Browse the repository at this point in the history
Added ability to enable/disable the collection and storage of statistical data
  • Loading branch information
minimus committed Sep 26, 2014
1 parent 2f1fed5 commit e2283e8
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 288 deletions.
8 changes: 5 additions & 3 deletions admin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ public function initSettings() {

add_settings_field('detectBots', __("Allow Bots and Crawlers detection", SAM_DOMAIN), array(&$this, 'drawCheckboxOption'), 'sam-settings', 'sam_statistic_section', array('label_for' => 'detectBots', 'checkbox' => true));
add_settings_field('detectingMode', __("Accuracy of Bots and Crawlers Detection", SAM_DOMAIN), array(&$this, 'drawRadioOption'), 'sam-settings', 'sam_statistic_section', array('description' => __("If bot is detected hits of ads won't be counted. Use with caution! More exact detection requires more server resources.", SAM_DOMAIN), 'options' => array( 'inexact' => __('Inexact detection', SAM_DOMAIN), 'exact' => __('Exact detection', SAM_DOMAIN), 'more' => __('More exact detection', SAM_DOMAIN))));
add_settings_field('keepStats', __('Keep Statistical Data', SAM_DOMAIN), array(&$this, 'drawSelectOption'), 'sam-settings', 'sam_statistic_section', array('description' => __('Period of keeping statistical data (excluding current month).', SAM_DOMAIN), 'options' => array(0 => __('All Time', SAM_DOMAIN), 1 => __('One Month', SAM_DOMAIN), 3 => __('Three Months', SAM_DOMAIN), 6 => __('Six Months', SAM_DOMAIN), 12 => __('One Year'))));
add_settings_field('stats', __('Allow to collect and to store statistical data', SAM_DOMAIN), array(&$this, 'drawCheckboxOption'), 'sam-settings', 'sam_statistic_section', array('label_for' => 'stats', 'checkbox' => true));
add_settings_field('keepStats', __('Keep Statistical Data', SAM_DOMAIN), array(&$this, 'drawSelectOption'), 'sam-settings', 'sam_statistic_section', array('description' => __('Period of keeping statistical data (excluding current month).', SAM_DOMAIN), 'options' => array(0 => __('All Time', SAM_DOMAIN), 1 => __('One Month', SAM_DOMAIN), 3 => __('Three Months', SAM_DOMAIN), 6 => __('Six Months', SAM_DOMAIN), 12 => __('One Year'))));
add_settings_field('currency', __("Display of Currency", SAM_DOMAIN), array(&$this, 'drawRadioOption'), 'sam-settings', 'sam_statistic_section', array('description' => __("Define display of currency. Auto - auto detection of currency from blog settings. USD, EUR - Forcing the display of currency to U.S. dollars or Euro.", SAM_DOMAIN), 'options' => array( 'auto' => __('Auto', SAM_DOMAIN), 'usd' => __('USD', SAM_DOMAIN), 'euro' => __('EUR', SAM_DOMAIN))));

add_settings_field('editorButtonMode', __("TinyMCE Editor Button Mode", SAM_DOMAIN), array(&$this, 'drawRadioOption'), 'sam-settings', 'sam_layout_section', array('description' => __('If you do not want to use the modern dropdown button in your TinyMCE editor, or use of this button causes a problem, you can use classic TinyMCE buttons. In this case select "Classic TinyMCE Buttons".', SAM_DOMAIN), 'options' => array('modern' => __('Modern TinyMCE Button', SAM_DOMAIN), 'classic' => __('Classic TinyMCE Buttons', SAM_DOMAIN))));
Expand Down Expand Up @@ -1213,7 +1214,8 @@ public function sanitizeSettings($input) {
'mail_cpm',
'mail_cpc',
'mail_ctr',
'mail_preview'
'mail_preview',
'stats'
);
foreach($boolNames as $name) {
$output[$name] = ((isset($input[$name])) ? $input[$name] : 0);
Expand Down Expand Up @@ -1522,7 +1524,7 @@ function affiliateLink(str){ str = unescape(str); var r = ''; for(var i = 0; i <
<li><a target='_blank' href='http://wordpress.org/extend/plugins/wp-special-textboxes/'><strong>Special Text Boxes</strong></a> - <?php _e("Highlights any portion of text as text in the colored boxes.", SAM_DOMAIN); ?></li>
<li><a target='_blank' href='http://wordpress.org/extend/plugins/simple-counters/'><strong>Simple Counters</strong></a> - <?php _e("Adds simple counters badge (FeedBurner subscribers and Twitter followers) to your blog.", SAM_DOMAIN); ?></li>
<li><a target='_blank' href='http://wordpress.org/extend/plugins/simple-view/'><strong>Simple View</strong></a> - <?php _e("This plugin is WordPress shell for FloatBox library by Byron McGregor.", SAM_DOMAIN); ?></li>
<li><a target='_blank' href='http://wordpress.org/extend/plugins/wp-copyrighted-post/'><strong>Copyrighted Post</strong></a> - <?php _e("Adds copyright notice in the end of each post of your blog. ", SAM_DOMAIN); ?></li>
<li><a target='_blank' href='http://wordpress.org/extend/plugins/wp-copyrighted-post/'><strong>Copyrighted Post</strong></a> - <?php _e("Adds copyright notice to the end of each post of your blog. ", SAM_DOMAIN); ?></li>
</ul>
</div>
</div>
Expand Down
102 changes: 54 additions & 48 deletions js/sam-layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function($) {
$(document).ready(function() {
var hits = [];
var hits = [], doStats = ('string' == typeof samAjax.doStats) ? Number(samAjax.doStats) : samAjax.doStats;
if(samAjax.load) {
if(samAjax.mailer) $.post(samAjax.ajaxurl, {action: 'sam_maintenance'});

Expand Down Expand Up @@ -28,17 +28,19 @@
var hits = [];
$.each(data.ads, function (i, ad) {
$('#' + ad.eid).replaceWith(ad.ad);
$('#' + ad.cid).find('a').bind('click', function (e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: ad.id,
pid: ad.pid,
level: samAjax.level
if(doStats) {
$('#' + ad.cid).find('a').bind('click', function (e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: ad.id,
pid: ad.pid,
level: samAjax.level
});
});
});
hits.push([ad.pid, ad.id]);
hits.push([ad.pid, ad.id]);
}
});
if (hits.length > 0) {
if (hits.length > 0 && doStats) {
$.post(samAjax.ajaxurl, {
action: 'sam_hits',
hits: hits,
Expand All @@ -50,57 +52,61 @@
}

// Ads loaded by PHP
$('div.sam-ad').each(function(i, el) {
var
ids = this.id.split('_'),
id = ids[1],
pid = ids[2];
if(doStats) {
$('div.sam-ad').each(function (i, el) {
var
ids = this.id.split('_'),
id = ids[1],
pid = ids[2];

hits.push([pid, id]);
hits.push([pid, id]);

$(el).find('a').bind('click', function(e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: id,
pid: pid,
level: samAjax.level
$(el).find('a').bind('click', function (e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: id,
pid: pid,
level: samAjax.level
});
});
});
});

if(hits.length > 0) {
$.post(samAjax.ajaxurl, {
action: 'sam_hits',
hits: hits,
level: samAjax.level
});
if (hits.length > 0) {
$.post(samAjax.ajaxurl, {
action: 'sam_hits',
hits: hits,
level: samAjax.level
});
}
}
}
else {
$('div.sam-container').each(function(i, el) {
var
ids = this.id.split('_'),
id = ids[1],
pid = ids[2];
if(doStats) {
$('div.sam-container').each(function (i, el) {
var
ids = this.id.split('_'),
id = ids[1],
pid = ids[2];

hits.push([pid, id]);
hits.push([pid, id]);

$(el).find('a').bind('click', function(e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: id,
pid: pid,
level: samAjax.level
$(el).find('a').bind('click', function (e) {
$.post(samAjax.ajaxurl, {
action: 'sam_click',
id: id,
pid: pid,
level: samAjax.level
});
});
});
});

if(hits.length > 0) {
$.post(samAjax.ajaxurl, {
action: 'sam_hits',
hits: hits,
level: samAjax.level
});
if (hits.length > 0) {
$.post(samAjax.ajaxurl, {
action: 'sam_hits',
hits: hits,
level: samAjax.level
});
}
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion js/sam-layout.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions js/sam-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,11 @@

apAdsType.ejDropDownList('setSelectedValue', apTypeVal);
apAdsId.ejDropDownList('setSelectedValue', apObjVal);

var stats = $('#stats'), keepStats = $('#keepStats');
keepStats.prop('disabled', (!stats.is(':checked')));
stats.on('click', function(e) {
keepStats.prop('disabled', (!stats.is(':checked')));
})
});
})(jQuery);
2 changes: 1 addition & 1 deletion js/sam-settings.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified langs/simple-ads-manager-ru_RU.mo
Binary file not shown.
Loading

0 comments on commit e2283e8

Please sign in to comment.