Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add W3TC, Smush plugins and update akismet anti-spam #166

Open
wants to merge 2 commits into
base: linux-appservice
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 3 additions & 3 deletions wp-content/plugins/akismet/akismet.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
Version: 4.2.1
Version: 4.2.2
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
Expand Down Expand Up @@ -37,10 +37,10 @@
exit;
}

define( 'AKISMET_VERSION', '4.2.1' );
define( 'AKISMET_VERSION', '4.2.2' );
define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
define( 'AKISMET_DELETE_LIMIT', 10000 );

register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
Expand Down
64 changes: 53 additions & 11 deletions wp-content/plugins/akismet/class.akismet.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ private static function init_hooks() {
add_filter( 'wpcf7_form_elements', array( 'Akismet', 'append_custom_form_fields' ) );
add_filter( 'wpcf7_akismet_parameters', array( 'Akismet', 'prepare_custom_form_values' ) );

// Formidable Forms
add_filter( 'frm_filter_final_form', array( 'Akismet', 'inject_custom_form_fields' ) );
add_filter( 'frm_akismet_values', array( 'Akismet', 'prepare_custom_form_values' ) );

add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 );
add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 );

Expand Down Expand Up @@ -410,8 +414,12 @@ public static function delete_old_comments() {

$wpdb->queries = array();

$comments = array();

foreach ( $comment_ids as $comment_id ) {
do_action( 'delete_comment', $comment_id );
$comments[ $comment_id ] = get_comment( $comment_id );

do_action( 'delete_comment', $comment_id, $comments[ $comment_id ] );
do_action( 'akismet_batch_delete_count', __FUNCTION__ );
}

Expand All @@ -421,12 +429,13 @@ public static function delete_old_comments() {
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );

clean_comment_cache( $comment_ids );
do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );

foreach ( $comment_ids as $comment_id ) {
do_action( 'deleted_comment', $comment_id );
do_action( 'deleted_comment', $comment_id, $comments[ $comment_id ] );
unset( $comments[ $comment_id ] );
}

clean_comment_cache( $comment_ids );
do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
}

if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->comments ) ) // lucky number
Expand Down Expand Up @@ -504,11 +513,38 @@ public static function delete_orphaned_commentmeta() {
public static function get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
global $wpdb;

if ( !empty( $user_id ) )
return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1", $user_id ) );
/**
* Which comment types should be ignored when counting a user's approved comments?
*
* Some plugins add entries to the comments table that are not actual
* comments that could have been checked by Akismet. Allow these comments
* to be excluded from the "approved comment count" query in order to
* avoid artificially inflating the approved comment count.
*
* @param array $comment_types An array of comment types that won't be considered
* when counting a user's approved comments.
*
* @since 4.2.2
*/
$excluded_comment_types = apply_filters( 'akismet_excluded_comment_types', array() );

$comment_type_where = '';

if ( is_array( $excluded_comment_types ) && ! empty( $excluded_comment_types ) ) {
$excluded_comment_types = array_unique( $excluded_comment_types );

foreach ( $excluded_comment_types as $excluded_comment_type ) {
$comment_type_where .= $wpdb->prepare( ' AND comment_type <> %s ', $excluded_comment_type );
}
}

if ( ! empty( $user_id ) ) {
return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1" . $comment_type_where, $user_id ) );
}

if ( !empty( $comment_author_email ) )
return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) );
if ( ! empty( $comment_author_email ) ) {
return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1" . $comment_type_where, $comment_author_email, $comment_author, $comment_author_url ) );
}

return 0;
}
Expand Down Expand Up @@ -1327,8 +1363,14 @@ public static function get_akismet_form_fields() {
$fields .= '<label>&#916;<textarea name="' . $prefix . 'hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label>';

if ( ! function_exists( 'amp_is_request' ) || ! amp_is_request() ) {
$fields .= '<input type="hidden" id="ak_js" name="' . $prefix . 'js" value="' . mt_rand( 0, 250 ) . '"/>';
$fields .= '<script>document.getElementById( "ak_js" ).setAttribute( "value", ( new Date() ).getTime() );</script>';
// Keep track of how many ak_js fields are in this page so that we don't re-use
// the same ID.
static $field_count = 0;

$field_count++;

$fields .= '<input type="hidden" id="ak_js_' . $field_count . '" name="' . $prefix . 'js" value="' . mt_rand( 0, 250 ) . '"/>';
$fields .= '<script>document.getElementById( "ak_js_' . $field_count . '" ).setAttribute( "value", ( new Date() ).getTime() );</script>';
}

$fields .= '</p>';
Expand Down
12 changes: 10 additions & 2 deletions wp-content/plugins/akismet/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 5.0
Tested up to: 5.8
Stable tag: 4.2.1
Tested up to: 5.9
Stable tag: 4.2.2
License: GPLv2 or later

The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
Expand All @@ -30,6 +30,14 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet

== Changelog ==

= 4.2.2 =
*Release Date - 24 January 2022*

* Improved compatibility with Formidable Forms
* Fixed a bug that could cause issues when multiple contact forms appear on one page.
* Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0.
* Add a filter that allows comment types to be excluded when counting users' approved comments.

= 4.2.1 =
*Release Date - 1 October 2021*

Expand Down
215 changes: 215 additions & 0 deletions wp-content/plugins/w3-total-cache/Base_Page_Settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
<?php
namespace W3TC;



class Base_Page_Settings {
/**
* Config
*
* @var Config
*/
protected $_config = null;

/**
* Notes
*
* @var array
*/
protected $_notes = array();

/**
* Errors
*
* @var array
*/
protected $_errors = array();

/**
* Used in PHPMailer init function
*
* @var string
*/
protected $_phpmailer_sender = '';

/**
* Master configuration
*
* @var Config
*/
protected $_config_master;

protected $_page;

function __construct() {
$this->_config = Dispatcher::config();
$this->_config_master = Dispatcher::config_master();

$this->_page = Util_Admin::get_current_page();
}

function options() {
$this->view();
}

public function render_footer() {
include W3TC_INC_OPTIONS_DIR . '/common/footer.php';
}

/**
* Returns true if config section is sealed
*
* @param string $section
* @return boolean
*/
protected function is_sealed( $section ) {
return true;
}

/**
* Returns true if we edit master config
*
* @return boolean
*/
protected function is_master() {
return $this->_config->is_master();
}

/**
* Prints checkbox with config option value
*
* @param string $option_id
* @param bool $disabled
* @param string $class_prefix
* @param bool $label
*/
protected function checkbox( $option_id, $disabled = false,
$class_prefix = '', $label = true, $force_value = null ) {
$disabled = $disabled || $this->_config->is_sealed( $option_id );
$name = Util_Ui::config_key_to_http_name( $option_id );

if ( !$disabled )
echo '<input type="hidden" name="' . $name . '" value="0" />';

if ( $label )
echo '<label>';
echo '<input class="'.$class_prefix.'enabled" type="checkbox" id="' . $name .
'" name="' . $name . '" value="1" ';
if ( !is_null( $force_value ) )
checked( $force_value, true );
else
checked( $this->_config->get_boolean( $option_id ), true );

if ( $disabled )
echo 'disabled="disabled" ';

echo ' />';
}

/**
* Prints a radio button and if config value matches value
*
* @param string $option_id config id
* @param unknown $value
* @param bool $disabled
* @param string $class_prefix
*/
protected function radio( $option_id, $value, $disabled = false, $class_prefix = '' ) {
if ( is_bool( $value ) )
$rValue = $value?'1':'0';
else
$rValue = $value;
$disabled = $disabled || $this->_config->is_sealed( $option_id );

$name = Util_Ui::config_key_to_http_name( $option_id );

echo '<label>';
echo '<input class="'.$class_prefix.'enabled" type="radio" id="' . $name .
'" name="' . $name . '" value="', $rValue, '" ';
checked( $this->_config->get_boolean( $option_id ), $value );

if ( $disabled )
echo 'disabled="disabled" ';

echo ' />';
}

/**
* Prints checkbox for debug option
*
* @param string $option_id
*/
protected function checkbox_debug( $option_id ) {
if ( is_array( $option_id ) ) {
$section = $option_id[0];
$section_enabled = $this->_config->is_extension_active_frontend( $section );
} else {
$section = substr( $option_id, 0, strrpos( $option_id, '.' ) );
$section_enabled = $this->_config->get_boolean( $section . '.enabled' );
}

$disabled = $this->_config->is_sealed( $option_id ) || !$section_enabled;
$name = Util_Ui::config_key_to_http_name( $option_id );

if ( !$disabled )
echo '<input type="hidden" name="' . $name . '" value="0" />';

echo '<label>';
echo '<input class="enabled" type="checkbox" id="' . $name .
'" name="' . $name . '" value="1" ';
checked( $this->_config->get_boolean( $option_id ) && $section_enabled, true );

if ( $disabled )
echo 'disabled="disabled" ';

echo ' />';
}

protected function checkbox_debug_pro( $option_id, $label, $label_pro ) {
if ( is_array( $option_id ) ) {
$section = $option_id[0];
$section_enabled = $this->_config->is_extension_active_frontend( $section );
} else {
$section = substr( $option_id, 0, strrpos( $option_id, '.' ) );
$section_enabled = $this->_config->get_boolean( $section . '.enabled' );
}

$is_pro = Util_Environment::is_w3tc_pro( $this->_config );
$disabled = $this->_config->is_sealed( $option_id ) || !$section_enabled ||
!$is_pro;
$name = Util_Ui::config_key_to_http_name( $option_id );

if ( !$disabled )
echo '<input type="hidden" name="' . $name . '" value="0" />';

echo '<label>';
echo '<input class="enabled" type="checkbox" id="' . $name .
'" name="' . $name . '" value="1" ';
checked( $this->_config->get_boolean( $option_id ) && $is_pro, true );

if ( $disabled )
echo 'disabled="disabled" ';

echo ' />';
echo esc_html( $label );
if ( $is_pro ) {
echo $label_pro;
}
echo '</label>';
}

protected function value_with_disabled( $option_id, $disabled,
$value_when_disabled ) {
if ( $disabled ) {
echo 'value="' . esc_attr( $value_when_disabled ) . '" ';
echo 'disabled="disabled" ';
} else {
echo 'value="' .
esc_attr( $this->_config->get_string( $option_id ) ) . '" ';
}
}

protected function view() {
include W3TC_INC_DIR . '/options/common/header.php';
}
}
Loading