Version Description
-
Deutsch
- (Testweise) Umstellung auf die offizielle Google Translation API
- Weitere Informationen zum Hintergrund der Umstellung auf Google+
- Release-Zeitaufwand (Development & QA): 2,5 Stunden
-
English
- Switch to the official Google Translation API
- Release time investment (Development & QA): 2,5 h
Download this release
Release Info
Developer | sergej.mueller |
Plugin | Antispam Bee |
Version | 2.6.6 |
Comparing to | |
See all releases |
Code changes from version 2.6.5 to 2.6.6
- antispam_bee.php +68 -58
- css/styles.css +1 -2
- css/styles.min.css +1 -1
- inc/gui.class.php +2 -2
- js/dashboard.js +2 -2
- js/dashboard.min.js +5 -5
- readme.txt +11 -0
antispam_bee.php
CHANGED
@@ -8,7 +8,7 @@ Author: Sergej Müller
|
|
8 |
Author URI: http://wpcoder.de
|
9 |
Plugin URI: http://antispambee.com
|
10 |
License: GPLv2 or later
|
11 |
-
Version: 2.6.
|
12 |
*/
|
13 |
|
14 |
/*
|
@@ -672,8 +672,8 @@ class Antispam_Bee {
|
|
672 |
* @since 0.1
|
673 |
* @change 2.6.5
|
674 |
*
|
675 |
-
* @param array $items
|
676 |
-
|
677 |
*/
|
678 |
|
679 |
public static function add_dashboard_count( $items = array() )
|
@@ -1277,7 +1277,7 @@ class Antispam_Bee {
|
|
1277 |
* Prüfung der Trackbacks
|
1278 |
*
|
1279 |
* @since 2.4
|
1280 |
-
* @change 2.6.
|
1281 |
*
|
1282 |
* @param array $comment Daten des Trackbacks
|
1283 |
* @return array Array mit dem Verdachtsgrund [optional]
|
@@ -1341,6 +1341,13 @@ class Antispam_Bee {
|
|
1341 |
'reason' => 'country'
|
1342 |
);
|
1343 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1344 |
}
|
1345 |
|
1346 |
|
@@ -1646,18 +1653,18 @@ class Antispam_Bee {
|
|
1646 |
|
1647 |
/* Default */
|
1648 |
$filter = array('`comment_author_IP` = %s');
|
1649 |
-
$params = array($ip);
|
1650 |
|
1651 |
/* URL abgleichen */
|
1652 |
if ( ! empty($url) ) {
|
1653 |
$filter[] = '`comment_author_url` = %s';
|
1654 |
-
$params[] = $url;
|
1655 |
}
|
1656 |
|
1657 |
/* E-Mail abgleichen */
|
1658 |
if ( ! empty($email) ) {
|
1659 |
$filter[] = '`comment_author_email` = %s';
|
1660 |
-
$params[] = $email;
|
1661 |
}
|
1662 |
|
1663 |
/* Query ausführen */
|
@@ -1823,7 +1830,7 @@ class Antispam_Bee {
|
|
1823 |
$result = $wpdb->get_var(
|
1824 |
$wpdb->prepare(
|
1825 |
"SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = '1' AND `comment_author_email` = %s LIMIT 1",
|
1826 |
-
(
|
1827 |
)
|
1828 |
);
|
1829 |
|
@@ -1883,63 +1890,66 @@ class Antispam_Bee {
|
|
1883 |
|
1884 |
|
1885 |
/**
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
|
|
|
|
|
|
|
|
|
|
1902 |
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1912 |
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
'https://translate.google.com/translate_a/t?client=x&text=%s',
|
1918 |
-
$content
|
1919 |
-
),
|
1920 |
-
'http'
|
1921 |
-
)
|
1922 |
-
);
|
1923 |
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
$matches
|
1934 |
-
);
|
1935 |
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
|
1941 |
-
|
1942 |
-
|
1943 |
|
1944 |
|
1945 |
/**
|
8 |
Author URI: http://wpcoder.de
|
9 |
Plugin URI: http://antispambee.com
|
10 |
License: GPLv2 or later
|
11 |
+
Version: 2.6.6
|
12 |
*/
|
13 |
|
14 |
/*
|
672 |
* @since 0.1
|
673 |
* @change 2.6.5
|
674 |
*
|
675 |
+
* @param array $items Initial array with dashboard items
|
676 |
+
* @return array $items Merged array with dashboard items
|
677 |
*/
|
678 |
|
679 |
public static function add_dashboard_count( $items = array() )
|
1277 |
* Prüfung der Trackbacks
|
1278 |
*
|
1279 |
* @since 2.4
|
1280 |
+
* @change 2.6.6
|
1281 |
*
|
1282 |
* @param array $comment Daten des Trackbacks
|
1283 |
* @return array Array mit dem Verdachtsgrund [optional]
|
1341 |
'reason' => 'country'
|
1342 |
);
|
1343 |
}
|
1344 |
+
|
1345 |
+
/* Translate API */
|
1346 |
+
if ( $options['translate_api'] && self::_is_lang_spam($body) ) {
|
1347 |
+
return array(
|
1348 |
+
'reason' => 'lang'
|
1349 |
+
);
|
1350 |
+
}
|
1351 |
}
|
1352 |
|
1353 |
|
1653 |
|
1654 |
/* Default */
|
1655 |
$filter = array('`comment_author_IP` = %s');
|
1656 |
+
$params = array( wp_unslash($ip) );
|
1657 |
|
1658 |
/* URL abgleichen */
|
1659 |
if ( ! empty($url) ) {
|
1660 |
$filter[] = '`comment_author_url` = %s';
|
1661 |
+
$params[] = wp_unslash($url);
|
1662 |
}
|
1663 |
|
1664 |
/* E-Mail abgleichen */
|
1665 |
if ( ! empty($email) ) {
|
1666 |
$filter[] = '`comment_author_email` = %s';
|
1667 |
+
$params[] = wp_unslash($email);
|
1668 |
}
|
1669 |
|
1670 |
/* Query ausführen */
|
1830 |
$result = $wpdb->get_var(
|
1831 |
$wpdb->prepare(
|
1832 |
"SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = '1' AND `comment_author_email` = %s LIMIT 1",
|
1833 |
+
wp_unslash($email)
|
1834 |
)
|
1835 |
);
|
1836 |
|
1890 |
|
1891 |
|
1892 |
/**
|
1893 |
+
* Prüfung auf unerwünschte Sprachen
|
1894 |
+
*
|
1895 |
+
* @since 2.0
|
1896 |
+
* @change 2.6.6
|
1897 |
+
*
|
1898 |
+
* @param string $content Inhalt des Kommentars
|
1899 |
+
* @return boolean TRUE bei Spam
|
1900 |
+
*/
|
1901 |
+
|
1902 |
+
private static function _is_lang_spam($comment_content)
|
1903 |
+
{
|
1904 |
+
/* User defined language */
|
1905 |
+
$allowed_lang = self::get_option('translate_lang');
|
1906 |
+
|
1907 |
+
/* Make comment text plain */
|
1908 |
+
$comment_text = wp_strip_all_tags($comment_content);
|
1909 |
+
|
1910 |
+
/* Skip if empty values */
|
1911 |
+
if ( empty($allowed_lang) OR empty($comment_text) ) {
|
1912 |
+
return false;
|
1913 |
+
}
|
1914 |
|
1915 |
+
/* Trim comment text */
|
1916 |
+
if ( ! $query_text = wp_trim_words($comment_text, 10, '') ) {
|
1917 |
+
return false;
|
1918 |
+
}
|
1919 |
|
1920 |
+
/* Start request */
|
1921 |
+
$response = wp_safe_remote_request(
|
1922 |
+
add_query_arg(
|
1923 |
+
array(
|
1924 |
+
'q' => rawurlencode($query_text),
|
1925 |
+
'key' => base64_decode( strrev('rl1NTlGNDFnNrZlQI5WLnhUcDJ0SZBlTZlWb6NUVu9FR5NVY6lUQ') )
|
1926 |
+
),
|
1927 |
+
'https://www.googleapis.com' . '/language/translate/v2/detect'
|
1928 |
+
)
|
1929 |
+
);
|
1930 |
|
1931 |
+
/* Skip on error */
|
1932 |
+
if ( is_wp_error($response) OR wp_remote_retrieve_response_code($response) !== 200 ) {
|
1933 |
+
return false;
|
1934 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1935 |
|
1936 |
+
/* Get JSON from content */
|
1937 |
+
if ( ! $json = wp_remote_retrieve_body($response) ) {
|
1938 |
+
return false;
|
1939 |
+
}
|
1940 |
|
1941 |
+
/* Decode JSON */
|
1942 |
+
if ( ! $obj = json_decode($json, true) ) {
|
1943 |
+
return false;
|
1944 |
+
}
|
|
|
|
|
1945 |
|
1946 |
+
/* Get detected language */
|
1947 |
+
if ( ! $detected_lang = @$obj['data']['detections'][0][0]['language'] ) {
|
1948 |
+
return false;
|
1949 |
+
}
|
1950 |
|
1951 |
+
return ( $detected_lang != $allowed_lang );
|
1952 |
+
}
|
1953 |
|
1954 |
|
1955 |
/**
|
css/styles.css
CHANGED
@@ -43,9 +43,7 @@
|
|
43 |
|
44 |
.ab-wrap {
|
45 |
color: #2f353e;
|
46 |
-
height: 1%;
|
47 |
margin: 0 0 0 -10px;
|
48 |
-
overflow: hidden;
|
49 |
padding: 20px 0 0 0;
|
50 |
text-rendering: optimizeLegibility;
|
51 |
}
|
@@ -227,6 +225,7 @@
|
|
227 |
text-align: center;
|
228 |
border-top: 1px solid #e0e5e9;
|
229 |
border-bottom: 1px solid #e0e5e9;
|
|
|
230 |
}
|
231 |
.ab-column--service p {
|
232 |
margin: 8px 0;
|
43 |
|
44 |
.ab-wrap {
|
45 |
color: #2f353e;
|
|
|
46 |
margin: 0 0 0 -10px;
|
|
|
47 |
padding: 20px 0 0 0;
|
48 |
text-rendering: optimizeLegibility;
|
49 |
}
|
225 |
text-align: center;
|
226 |
border-top: 1px solid #e0e5e9;
|
227 |
border-bottom: 1px solid #e0e5e9;
|
228 |
+
margin-right: 20px;
|
229 |
}
|
230 |
.ab-column--service p {
|
231 |
margin: 8px 0;
|
css/styles.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@font-face{font-family:icons;src:url(../font/icons.woff2) format('woff2'),url(../font/icons.woff) format('woff')}.ab-main *,.ab-main :after,.ab-main :before{border:0;margin:0;padding:0;outline:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.browsehappy{margin:0 0 20px;padding:10px;border:1px solid #e66f00;text-align:center}.ab-wrap{color:#2f353e;
|
1 |
+
@font-face{font-family:icons;src:url(../font/icons.woff2) format('woff2'),url(../font/icons.woff) format('woff')}.ab-main *,.ab-main :after,.ab-main :before{border:0;margin:0;padding:0;outline:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.browsehappy{margin:0 0 20px;padding:10px;border:1px solid #e66f00;text-align:center}.ab-wrap{color:#2f353e;margin:0 0 0 -10px;padding:20px 0 0;text-rendering:optimizeLegibility}.ab-column{float:left;margin:0 0 0 10px;position:relative}.ab-column h3{margin:0;font-size:14px;font-weight:400;line-height:20px;text-transform:uppercase}.ab-column h3.icon:before{font:400 30px/30px icons;top:4px;right:20px;speak:none;width:1em;color:#8e959c;position:absolute;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ab-column.ab-arrow h3.icon:before{content:'\2387'}.ab-column.ab-join h3.icon:before{content:'\e795'}.ab-column.ab-diff h3.icon:before{content:'\e73c'}.ab-column h6{clear:both;color:#8e959c;margin:0 0 20px;font-size:10px;font-weight:400;text-transform:uppercase}.ab-column input[type=text],.ab-column select{height:20px;font-size:11px;text-align:center;background:#f8f8f9}.ab-column select[multiple]{width:150px;height:56px}.ab-column input.ab-mini-field{width:30px}.ab-column input.ab-medium-field{width:120px}.ab-column input[type=text]+label,.ab-column select+label{color:#8e959c;margin:0 0 0 7px;display:inline-block;text-transform:uppercase}.ab-column>ul{padding:0 20px 0 0}.ab-column:last-of-type>ul{border:0}.ab-column>ul>li{width:330px;margin:0 0 36px;padding:10px 0 12px 12px;position:relative;background:#fff;list-style:none;border-radius:3px;white-space:nowrap}.ab-column>ul>li a{text-decoration:none;border-bottom:1px dotted #e0e5e9}.ab-column>ul>li a:hover{border-color:inherit}.ab-column>ul>li input[type=checkbox]{display:inline-block;margin:0 8px 0 0}.ab-column>ul>li label{cursor:default;display:inline-block;overflow:hidden;line-height:24px}.ab-column>ul>li label span{color:#8e959c;display:block;font-size:12px;line-height:16px}.ab-column>ul>li:after,.ab-column>ul>li:before{width:0;content:'';position:absolute}.ab-column.ab-arrow>ul>li:after,.ab-column.ab-arrow>ul>li:before{left:157px;border-width:10px 10px 0;border-style:solid}.ab-column.ab-arrow>ul>li:before{bottom:-24px;border-color:#fff transparent}.ab-column.ab-arrow>ul>li:after{bottom:-22px;border-color:#f1f1f1 transparent}.ab-column.ab-join>ul>li:before{left:171px;bottom:-27px;height:18px;border-right:2px solid #fff}.ab-column.ab-diff>ul>li:before{left:162px;bottom:-19px;width:18px;height:0;border-bottom:2px solid #fff}.ab-column--service{width:342px;text-align:center;border-top:1px solid #e0e5e9;border-bottom:1px solid #e0e5e9;margin-right: 20px;}.ab-column--service p{margin:8px 0}.ab-column--service a{padding:0 2px}.ab-column--submit{width:342px;margin-top:35px}.ab-column--submit .button{width:100%}.ab-column>ul>li:last-of-type:after,.ab-column>ul>li:last-of-type:before{display:none}.ab-column>ul>li>ul{margin:10px 10px 0 26px;display:none;list-style:none}.ab-column>ul>li>ul li{padding:2px 0}.ab-column>ul>li>ul label{margin:0 0 0 7px}.ab-column>ul>li>input[type=checkbox]:checked~ul{display:block}
|
inc/gui.class.php
CHANGED
@@ -36,7 +36,7 @@ class Antispam_Bee_GUI extends Antispam_Bee {
|
|
36 |
}
|
37 |
|
38 |
/* Referer prüfen */
|
39 |
-
check_admin_referer('
|
40 |
|
41 |
/* Optionen ermitteln */
|
42 |
$options = array(
|
@@ -189,7 +189,7 @@ class Antispam_Bee_GUI extends Antispam_Bee {
|
|
189 |
<form action="<?php echo admin_url('admin-post.php') ?>" method="post">
|
190 |
<input type="hidden" name="action" value="ab_save_changes" />
|
191 |
|
192 |
-
<?php wp_nonce_field('
|
193 |
|
194 |
<?php $options = self::get_options() ?>
|
195 |
|
36 |
}
|
37 |
|
38 |
/* Referer prüfen */
|
39 |
+
check_admin_referer('_antispam_bee__settings_nonce');
|
40 |
|
41 |
/* Optionen ermitteln */
|
42 |
$options = array(
|
189 |
<form action="<?php echo admin_url('admin-post.php') ?>" method="post">
|
190 |
<input type="hidden" name="action" value="ab_save_changes" />
|
191 |
|
192 |
+
<?php wp_nonce_field('_antispam_bee__settings_nonce') ?>
|
193 |
|
194 |
<?php $options = self::get_options() ?>
|
195 |
|
js/dashboard.js
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
var labels = [],
|
5 |
data = [];
|
6 |
jQuery("#ab_chart_data tfoot th").each(function () {
|
7 |
-
labels.push(jQuery(this).
|
8 |
});
|
9 |
jQuery("#ab_chart_data tbody td").each(function () {
|
10 |
-
data.push(jQuery(this).
|
11 |
});
|
12 |
|
13 |
// Draw
|
4 |
var labels = [],
|
5 |
data = [];
|
6 |
jQuery("#ab_chart_data tfoot th").each(function () {
|
7 |
+
labels.push(jQuery(this).text());
|
8 |
});
|
9 |
jQuery("#ab_chart_data tbody td").each(function () {
|
10 |
+
data.push(jQuery(this).text());
|
11 |
});
|
12 |
|
13 |
// Draw
|
js/dashboard.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(function(){var r=[],h=[];jQuery("#ab_chart_data tfoot th").each(function(){r.push(jQuery(this).
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
f[
|
1 |
+
(function(){var r=[],h=[];jQuery("#ab_chart_data tfoot th").each(function(){r.push(jQuery(this).text())});jQuery("#ab_chart_data tbody td").each(function(){h.push(jQuery(this).text())});var v=jQuery("#ab_chart").parent().width()+8,g=Raphael("ab_chart",v,140),a={font:'bold 12px "Open Sans", sans-serif',fill:"#333"},e=(v-0)/r.length,t=Math.max.apply(Math,h),w=96/t;g.text(16,16,t).attr({font:'normal 10px "Open Sans", sans-serif',fill:"#bbb"});var t=g.path().attr({stroke:"#0074a2","stroke-width":2,"stroke-linejoin":"round"}),
|
2 |
+
B=g.path().attr({stroke:"none",opacity:.3,fill:"#0074a2"}),f=g.set(),x=0,y=0,q=!1,z,u=g.set();f.push(g.text(60,12,"24\u00d7 Spam").attr(a));f.push(g.text(60,27,"23.12.2013").attr(a).attr({fill:"#0074a2"}));f.hide();for(var n=g.popup(100,100,f,"right").attr({fill:"#fff",stroke:"#444","stroke-width":1}).hide(),k,p,a=0,A=r.length;a<A;a++){var c=Math.round(118-w*h[a]),b=Math.round(0+e*(a+.5));a||(k=["M",b,c,"C",b,c],p=["M",0+.5*e,118,"L",b,c,"C",b,c]);if(a&&a<A-1){var d=Math.round(118-w*h[a-1]),C=Math.round(0+
|
3 |
+
e*(a-.5)),D=Math.round(118-w*h[a+1]),E=Math.round(0+e*(a+1.5)),d=getAnchors(C,d,b,c,E,D);k=k.concat([d.x1,d.y1,b,c,d.x2,d.y2]);p=p.concat([d.x1,d.y1,b,c,d.x2,d.y2])}d=g.circle(b,c,4).attr({fill:"#fff",stroke:"#0074a2","stroke-width":1});u.push(g.rect(0+e*a,0,e,118).attr({stroke:"none",fill:"#fff",opacity:.2}));var F=u[u.length-1];(function(a,b,c,d,h){F.hover(function(){clearTimeout(z);var e="right";a+n.getBBox().width>v&&(e="left");var l=g.popup(a,b,f,e,1),e=Raphael.animation({path:l.path,transform:["t",
|
4 |
+
l.dx,l.dy]},200*q);x=f[0].transform()[0][1]+l.dx;y=f[0].transform()[0][2]+l.dy;n.show().stop().animate(e);var m=new Date(1E3*d),l=(10>m.getDate()?"0":"")+m.getDate(),k=(10>m.getMonth()+1?"0":"")+(m.getMonth()+1),m=m.getFullYear();f[0].attr({text:c+"\u00d7 Spam"}).show().stop().animateWith(n,e,{transform:["t",x,y]},200*q);f[1].attr({text:l+"."+k+"."+m}).show().stop().animateWith(n,e,{transform:["t",x,y]},200*q);h.attr("r",6);q=!0},function(){h.attr("r",4);z=setTimeout(function(){n.hide();f[0].hide();
|
5 |
+
f[1].hide();q=!1},1)})})(b,c,h[a],r[a],d)}k=k.concat([b,c,b,c]);p=p.concat([b,c,b,c,"L",b,118,"z"]);t.attr({path:k});B.attr({path:p});n.toFront();f[0].toFront();f[1].toFront();u.toFront()})();
|
readme.txt
CHANGED
@@ -104,6 +104,17 @@ Fragen rund ums Plugin werden gern per E-Mail beantwortet. Beachtet auch die [Gu
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= 2.6.5 =
|
108 |
|
109 |
* **English**
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 2.6.6 =
|
108 |
+
|
109 |
+
* **Deutsch**
|
110 |
+
* (Testweise) Umstellung auf die offizielle Google Translation API
|
111 |
+
* [Weitere Informationen zum Hintergrund der Umstellung auf Google+](https://plus.google.com/u/0/+SergejMüller/posts/ZyquhoYjUyF)
|
112 |
+
* *Release-Zeitaufwand (Development & QA): 2,5 Stunden*
|
113 |
+
|
114 |
+
* **English**
|
115 |
+
* Switch to the official Google Translation API
|
116 |
+
* *Release time investment (Development & QA): 2,5 h*
|
117 |
+
|
118 |
= 2.6.5 =
|
119 |
|
120 |
* **English**
|