Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
<?php
/**
* Manage notification emails settings page class
* *
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2020
*
* since: 1.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Load module famne_custom_recipients
*
* @return array $args
*/
function load_mod_famne_custom_recipients() {
FAMNE::AddModule(
'custom_admin_recipients',
array(
'name' => 'Choose extra recipients for admin notifications',
'version' => '1.0.0',
'option_id' => array( 'custom_admin_recipients' ),
'card' => 'card_famne_custom_admin_recipients',
)
);
/**
* Card_famne_custom_admin_recipients
*
* @param mixed $famne_options
* @return void
*/
function card_famne_custom_admin_recipients( $famne_options ) {
?>
<div class="card">
<label class="switch"><div class="slider round <?php echo ( ! empty( $famne_options['custom_admin_recipients'] ) ? 'active' : '' ); ?>"><span class="on">ON</span><span class="off">OFF</span></div></label>
<h2 class="title"><?php esc_html_e( 'Extra admin recipients', 'manage-notification-emails' ); ?></h2>
<?php _e( 'Here you can add extra admin recipients who will also receive all admin notifications.', 'manage-notification-emails' ); ?>
<?php print_textbox( $famne_options, 'custom_admin_recipients', __( 'E-mail address(es)', 'manage-notification-emails' ), '', __( 'For multiple addresses separate by comma.', 'manage-notification-emails' ), 'text', 'email1@domain.com,email2@otherdomain.com' ); ?>
</div>
<?php
}
add_filter( 'wp_mail', 'famne_custom_to_admin_mailaddresses' );
/**
* Filter custom admin email emailadresses.
*
* @param mixed $args
* @return array $args
*/
function famne_custom_to_admin_mailaddresses( $args ) {
// If to isn't set (who knows why it wouldn't) return args.
if ( ! isset( $args['to'] ) || empty( $args['to'] ) ) {
return $args;
}
// If TO is an array of emails, means it's probably not an admin email.
if ( is_array( $args['to'] ) ) {
return $args;
}
if ( ! empty( $args['cc'] ) ) {
return $args;
}
$admin_email = get_option( 'admin_email' );
// Check if admin email found in string, as TO could be formatted like 'Administrator <admin@domain.com>',
// and if we specifically check if it's just the email, we may miss some admin emails.
if ( strpos( $args['to'], $admin_email ) !== false ) {
$famne_options = FAMNE::get_option( 'famne_options' );
if ( empty( $famne_options['custom_admin_recipients'] ) ) {
return $args;
}
$emails = array();
if ( strpos( $famne_options['custom_admin_recipients'], ',' ) > 0 ) :
$emails = explode( ',', $famne_options['custom_admin_recipients'] );
else :
$emails = array( $famne_options['custom_admin_recipients'] );
endif;
if ( ! empty( $args['headers'] ) && is_string( $args['headers'] ) ) {
$args['headers'] = array( $args['headers'] );
}
if ( ! empty( $emails ) ) :
if ( empty( $args['headers'] ) ) {
$args['headers'] = array();
}
foreach ( $emails as $e ) :
$e = trim( $e );
if ( is_email( $e ) ) {
$args['headers'][] = 'Cc: ' . $e;
}
endforeach;
endif;
}
return $args;
}
}
add_action( 'fa_mne_modules', 'load_mod_famne_custom_recipients' );

View File

@@ -0,0 +1,165 @@
<?php
/**
* Manage notification emails settings page class
* *
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2020
*
* since: 1.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Load module famne_custom_recipients
*
* @return void
*/
function load_mod_famne_export_settings() {
FAMNE::AddModule(
'export_settings',
array(
'name' => 'Export and import settings',
'version' => '1.1.0',
'option_id' => array( 'export_settings' ),
'card' => 'card_famne_export_settings',
)
);
/**
* Card_famne_export_settings
*
* @return void
*/
function card_famne_export_settings() {
global $pagenow;
if ( ! FAMNESettingsPage::is_famne_settings_page() && ! FAMNESettingsPage::is_famne_network_settings_page() ) {
return;
}
$downloadlink = $pagenow . '?page=' . sanitize_text_field( $_GET['page'] ) . '&export-settings=famne';
?>
<div class="card">
<h2 class="title"><?php esc_html_e( 'Export and import settings', 'manage-notification-emails' ); ?></h2>
<?php esc_html_e( 'Here you can export or import your Manage notification e-mails settings.', 'manage-notification-emails' ); ?>
<br/><br/><strong><?php esc_html_e( 'Export your settings in JSON format', 'manage-notification-emails' ); ?></strong><br/>
<a href="<?php echo esc_url( $downloadlink ); ?>" class="button" target="_blank" rel="noopener"><?php esc_html_e( 'Export settings file', 'manage-notification-emails' ); ?></a>
<br/><br/><strong><?php esc_html_e( 'Import setting in JSON format', 'manage-notification-emails' ); ?></strong><br/>
<input type="file" id="settings-upload-file" name="settings-upload-file" accept="application/JSON" data-message="<?php esc_html_e( 'Do you want to overwrite your current settings?', 'manage-notification-emails' ); ?>"/>
<input type="submit" class="button button-primary" id="settings-upload-submit" disabled="disabled" value="<?php esc_html_e( 'Start import', 'manage-notification-emails' ); ?>" />
<div class="spacer"></div>
</div>
<?php
}
/**
* Added capability check for export
* @since 1.8.6
*/
if( ! current_user_can( 'manage_options' ) ) {
return;
}
$get_export_settings = ! empty( $_GET['export-settings'] ) ? sanitize_text_field( $_GET['export-settings'] ) : '';
if ( 'famne' === $get_export_settings ) :
if ( ! headers_sent() ) {
global $famne_options;
header( 'Content-Disposition: attachment; filename="famne-settings-' . gmdate( 'Y-m-d-Hs' ) . '.json"' );
header( 'Cache-Control: no-cache, must-revalidate' );
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
if ( is_array( $famne_options ) ) {
$famne_options['version'] = FA_MNE_VERSION;
}
echo wp_json_encode( $famne_options );
die;
} else {
wp_die( 'Unexpected headers found.' );
}
endif;
add_filter( 'famne_sanitize_settings_page', 'card_famne_export_settings_sanitize', 99, 3 );
function card_famne_export_settings_sanitize( $input ) {
if ( ! empty( $_FILES['settings-upload-file'] ) && isset( $_FILES['settings-upload-file']['size'] ) ) :
$file = $_FILES['settings-upload-file'];
if ( 4 === $file['error'] || 0 === $file['size'] ) :
return $input;
endif;
// Get file data.
// Check errors.
if ( $file['error'] ) {
wp_die( __( 'Error uploading file. Please try again.', 'manage-notification-emails' ) );
}
// Check file type.
if ( pathinfo( $file['name'], PATHINFO_EXTENSION ) !== 'json' ) {
wp_die( __( 'Incorrect file type.', 'manage-notification-emails' ) );
}
// Check file size.
if ( $file['size'] > 100000 ) {
wp_die( __( 'File size exceeds maximum upload limit.', 'manage-notification-emails' ) );
}
// Read JSON.
try {
$json = null;
if ( function_exists( 'file_get_contents' ) ) :
$json = file_get_contents( $file['tmp_name'] );
$json = json_decode( $json, true );
endif;
// Check if empty.
if ( ! $json || ! is_array( $json ) ) {
wp_die( __( 'Import file empty.', 'manage-notification-emails' ) );
}
} catch ( RuntimeException $e ) {
wp_die( 'Invalid parameters or file is corrupted.' );
}
// Check file size.
if ( empty( $json['version'] ) || FA_MNE_VERSION !== $json['version'] ) {
wp_die( __( 'The import file has a different plugin version.', 'manage-notification-emails' ) );
}
// Get all available options.
$available_options = array();
foreach ( FAMNE::default_options() as $key => $o ) :
$available_options[] = $key;
endforeach;
foreach ( FAMNE::getModules() as $mod ) :
if ( ! empty( $mod->option_id ) && is_array( $mod->option_id ) ) :
foreach ( $mod->option_id as $m ) :
$available_options[] = $m;
endforeach;
endif;
endforeach;
$input = array();
foreach ( $json as $key => $val ) :
if ( in_array( $key, $available_options, true ) ) {
$input[ $key ] = sanitize_text_field( $val );
}
endforeach;
endif;
return $input;
}
}
add_action( 'fa_mne_modules', 'load_mod_famne_export_settings' );

View File

@@ -0,0 +1,213 @@
<?php
/**
STOP SENDING NOTIFICATION MAILS TO THE USERS
version: 1.2.0
*/
if (!defined('ABSPATH')) die();
$famne_options = get_option( 'famne_options' );
if (!function_exists('dont_send_password_change_email') ) :
/**
* Email password change notification to registered user.
*
*/
//echo "dont_send_password_change_email";
function dont_send_password_change_email( $send=false, $user='', $userdata='')
{
global $famne_options;
if (is_array($user)) $user = (object) $user;
if (!empty($famne_options['wp_password_change_notification']) ) :
// send a copy of password change notification to the admin
// but check to see if it's the admin whose password we're changing, and skip this
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
}
endif;
if (empty($famne_options['send_password_change_email']) ) :
return false;
else :
return true;
endif;
}
add_filter('send_password_change_email', 'dont_send_password_change_email',1,3);
endif;
if (empty($famne_options['send_email_change_email']) && !function_exists('dont_send_email_change_email') ) :
/**
* Email users e-mail change notification to registered user.
*
*/
//echo "dont_send_email_change_email off";
function dont_send_email_change_email( $send=false, $user='', $userdata='')
{
return false;
}
add_filter('send_email_change_email', 'dont_send_email_change_email',1,3);
endif;
if (!function_exists('wp_new_user_notification') ) :
/**
* Email login credentials to a newly-registered user.
*
* A new user registration notification is also sent to admin email.
*/
//echo "wp_new_user_notification off";
function wp_new_user_notification( $user_id, $notify = '' ) {
global $famne_options;
if (!empty($famne_options['wp_new_user_notification_to_admin']))
{
fa_new_user_notification_to_admin($user_id);
}
if (!empty($famne_options['wp_new_user_notification_to_user']))
{
fa_new_user_notification_to_user($user_id);
}
}
endif;
if (empty($famne_options['wp_notify_postauthor']) && !function_exists('wp_notify_postauthor') ) :
/**
* Notify an author (and/or others) of a comment/trackback/pingback on a post.
*/
//echo "wp_notify_postauthor off";
function wp_notify_postauthor( $comment_id, $deprecated = null ) {}
endif;
if (empty($famne_options['wp_notify_moderator']) && !function_exists('wp_notify_moderator') ) :
/**
* Notifies the moderator of the blog about a new comment that is awaiting approval.
*/
//echo "wp_notify_moderator off";
function wp_notify_moderator($comment_id) {}
endif;
if (empty($famne_options['wp_password_change_notification']) && !function_exists('wp_password_change_notification') ) :
/**
* Notify the blog admin of a user changing password, normally via email.
*/
function wp_password_change_notification($user) {}
endif;
if ((empty($famne_options['send_password_forgotten_email']) || empty($famne_options['send_password_admin_forgotten_email'])) && !function_exists('dont_send_password_forgotten_email') ) :
/**
* Email forgotten password notification to registered user.
*
*/
//echo "dont_send_password_forgotten_email off";exit;
function dont_send_password_forgotten_email( $send=true, $user_id=0 )
{
global $famne_options;
$is_administrator = fa_user_is_administrator($user_id);
if ($is_administrator && empty($famne_options['send_password_admin_forgotten_email']))
{
// stop sending admin forgot email
return false;
}
if (!$is_administrator && empty($famne_options['send_password_forgotten_email']))
{
// stop sending user forgot email
return false;
}
// none of the above so give the default status back
return $send;
}
add_filter('allow_password_reset', 'dont_send_password_forgotten_email',1,3);
endif;
function fa_new_user_notification_to_admin ($user_id)
{
//Most parts of this function are copied form pluggable.php
global $wpdb;
$user = get_userdata( $user_id );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
}
function fa_new_user_notification_to_user($user_id)
{
global $wpdb;
$user = get_userdata( $user_id );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );
/** This action is documented in wp-login.php */
do_action( 'retrieve_password_key', $user->user_login, $key );
// Now insert the key, hashed, into the DB.
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
$message .= wp_login_url() . "\r\n";
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
}
function fa_user_is_administrator($user_id=0)
{
$user = new WP_User( intval($user_id) );
$is_administrator = false;
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ( strtolower($role) == 'administrator') $is_administrator = true;
}
return $is_administrator;
}

View File

@@ -0,0 +1,254 @@
<?php
/**
STOP SENDING NOTIFICATION MAILS TO THE USERS
version: 1.3.0
updated: the core pluggable function wp_new_user_notification
added: passing through the $deprecated and $notify
1.2.0 initial
*/
if (!defined('ABSPATH')) die();
$famne_options = get_option( 'famne_options' );
if (!function_exists('dont_send_password_change_email') ) :
/**
* Email password change notification to registered user.
*
*/
//echo "dont_send_password_change_email";
function dont_send_password_change_email( $send=false, $user='', $userdata='')
{
global $famne_options;
if (is_array($user)) $user = (object) $user;
if (!empty($famne_options['wp_password_change_notification']) ) :
// send a copy of password change notification to the admin
// but check to see if it's the admin whose password we're changing, and skip this
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
}
endif;
if (empty($famne_options['send_password_change_email']) ) :
return false;
else :
return true;
endif;
}
add_filter('send_password_change_email', 'dont_send_password_change_email',1,3);
endif;
if (empty($famne_options['send_email_change_email']) && !function_exists('dont_send_email_change_email') ) :
/**
* Email users e-mail change notification to registered user.
*
*/
//echo "dont_send_email_change_email off";
function dont_send_email_change_email( $send=false, $user='', $userdata='')
{
return false;
}
add_filter('send_email_change_email', 'dont_send_email_change_email',1,3);
endif;
if (!function_exists('wp_new_user_notification') ) :
/**
* Email login credentials to a newly-registered user.
*
* A new user registration notification is also sent to admin email.
*/
//echo "wp_new_user_notification off";
function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
global $famne_options;
if (!empty($famne_options['wp_new_user_notification_to_admin']))
{
fa_new_user_notification_to_admin($user_id,$notify);
}
if (!empty($famne_options['wp_new_user_notification_to_user']))
{
fa_new_user_notification_to_user($user_id,$deprecated,$notify);
}
}
endif;
if (empty($famne_options['wp_notify_postauthor']) && !function_exists('wp_notify_postauthor') ) :
/**
* Notify an author (and/or others) of a comment/trackback/pingback on a post.
*/
//echo "wp_notify_postauthor off";
function wp_notify_postauthor( $comment_id, $deprecated = null ) {}
endif;
if (empty($famne_options['wp_notify_moderator']) && !function_exists('wp_notify_moderator') ) :
/**
* Notifies the moderator of the blog about a new comment that is awaiting approval.
*/
//echo "wp_notify_moderator off";
function wp_notify_moderator($comment_id) {}
endif;
if (empty($famne_options['wp_password_change_notification']) && !function_exists('wp_password_change_notification') ) :
/**
* Notify the blog admin of a user changing password, normally via email.
*/
function wp_password_change_notification($user) {}
endif;
if ((empty($famne_options['send_password_forgotten_email']) || empty($famne_options['send_password_admin_forgotten_email'])) && !function_exists('dont_send_password_forgotten_email') ) :
/**
* Email forgotten password notification to registered user.
*
*/
//echo "dont_send_password_forgotten_email off";exit;
function dont_send_password_forgotten_email( $send=true, $user_id=0 )
{
global $famne_options;
$is_administrator = fa_user_is_administrator($user_id);
if ($is_administrator && empty($famne_options['send_password_admin_forgotten_email']))
{
// stop sending admin forgot email
return false;
}
if (!$is_administrator && empty($famne_options['send_password_forgotten_email']))
{
// stop sending user forgot email
return false;
}
// none of the above so give the default status back
return $send;
}
add_filter('allow_password_reset', 'dont_send_password_forgotten_email',1,3);
endif;
if (empty($famne_options['auto_core_update_send_email']) && !function_exists('fa_dont_sent_auto_core_update_emails') ) :
/**
* Send email when WordPress automatic updated.
*
*/
//echo "auto_core_update_send_email off";exit;
function fa_dont_sent_auto_core_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
add_filter( 'auto_core_update_send_email', 'fa_dont_sent_auto_core_update_emails', 10, 4 );
endif;
function fa_new_user_notification_to_admin ($user_id,$notify='')
{
//Most parts of this function are copied form pluggable.php
global $wpdb, $wp_hasher;
$user = get_userdata( $user_id );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
if ( 'user' !== $notify ) {
$switched_locale = switch_to_locale( get_locale() );
$message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
$message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
$message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
if ( $switched_locale ) {
restore_previous_locale();
}
}
}
function fa_new_user_notification_to_user($user_id,$deprecated=null,$notify='')
{
if ( $deprecated !== null ) {
_deprecated_argument( __FUNCTION__, '4.3.1' );
}
global $wpdb;
$user = get_userdata( $user_id );
// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification.
if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
return;
}
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );
/** This action is documented in wp-login.php */
do_action( 'retrieve_password_key', $user->user_login, $key );
// Now insert the key, hashed, into the DB.
if ( empty( $wp_hasher ) ) {
$wp_hasher = new PasswordHash( 8, true );
}
$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
$switched_locale = switch_to_locale( get_user_locale( $user ) );
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
$message .= wp_login_url() . "\r\n";
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
if ( $switched_locale ) {
restore_previous_locale();
}
}
function fa_user_is_administrator($user_id=0)
{
$user = new WP_User( intval($user_id) );
$is_administrator = false;
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ( strtolower($role) == 'administrator') $is_administrator = true;
}
return $is_administrator;
}

View File

@@ -0,0 +1,381 @@
<?php
/**
STOP SENDING NOTIFICATION MAILS TO THE USERS
version 1.5.3
fixed: Email automatic plugin update notification to admin option
version 1.5.2
added: Email automatic plugin update notification to admin option
added: Email automatic theme update notification to admin option
since 1.5.1
updated: the core pluggable function wp_new_user_notification
added: passing through the $deprecated and $notify
fixed notice of $deprecated
*/
if (!defined('ABSPATH')) die();
$famne_options = FAMNE::get_option( 'famne_options' );
FAMNE::AddModule('pluggable',array(
'name' => 'Pluggable',
'version'=>'1.5.1'
));
if (!function_exists('dont_send_password_change_email') ) :
/**
* Email password change notification to registered user.
*
*/
//echo "dont_send_password_change_email";
function dont_send_password_change_email( $send=false, $user='', $userdata='')
{
global $famne_options;
if (is_array($user)) $user = (object) $user;
if (!empty($famne_options['wp_password_change_notification']) ) :
// send a copy of password change notification to the admin
// but check to see if it's the admin whose password we're changing, and skip this
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
}
endif;
if (empty($famne_options['send_password_change_email']) ) :
return false;
else :
return true;
endif;
}
add_filter('send_password_change_email', 'dont_send_password_change_email',1,3);
endif;
if (empty($famne_options['send_email_change_email']) && !function_exists('dont_send_email_change_email') ) :
/**
* Email users e-mail change notification to registered user.
*
*/
//echo "dont_send_email_change_email off";
function dont_send_email_change_email( $send=false, $user='', $userdata='')
{
return false;
}
add_filter('send_email_change_email', 'dont_send_email_change_email',1,3);
endif;
if (!function_exists('wp_new_user_notification') ) :
/**
* Email login credentials to a newly-registered user.
*
* A new user registration notification is also sent to admin email.
*/
//echo "wp_new_user_notification off";
function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
global $famne_options;
if (!empty($famne_options['wp_new_user_notification_to_admin']))
{
fa_new_user_notification_to_admin($user_id,$deprecated,$notify);
}
if (!empty($famne_options['wp_new_user_notification_to_user']))
{
fa_new_user_notification_to_user($user_id,$deprecated,$notify);
}
}
endif;
if (empty($famne_options['wp_notify_postauthor']) && !function_exists('wp_notify_postauthor') ) :
/**
* Notify an author (and/or others) of a comment/trackback/pingback on a post.
*/
//echo "wp_notify_postauthor off";
function wp_notify_postauthor( $comment_id, $deprecated = null ) {}
endif;
if (empty($famne_options['wp_notify_moderator']) && !function_exists('wp_notify_moderator') ) :
/**
* Notifies the moderator of the blog about a new comment that is awaiting approval.
*/
//echo "wp_notify_moderator off";
function wp_notify_moderator($comment_id) {}
endif;
if (empty($famne_options['wp_password_change_notification']) && !function_exists('wp_password_change_notification') ) :
/**
* Notify the blog admin of a user changing password, normally via email.
*/
function wp_password_change_notification($user) {}
endif;
if ((empty($famne_options['send_password_forgotten_email']) || empty($famne_options['send_password_admin_forgotten_email'])) && !function_exists('dont_send_password_forgotten_email') ) :
/**
* Email forgotten password notification to registered user.
*
*/
//echo "dont_send_password_forgotten_email off";exit;
function dont_send_password_forgotten_email( $send=true, $user_id=0 )
{
global $famne_options;
$is_administrator = fa_user_is_administrator($user_id);
if ($is_administrator && empty($famne_options['send_password_admin_forgotten_email']))
{
// stop sending admin forgot email
return false;
}
if (!$is_administrator && empty($famne_options['send_password_forgotten_email']))
{
// stop sending user forgot email
return false;
}
// none of the above so give the default status back
return $send;
}
add_filter('allow_password_reset', 'dont_send_password_forgotten_email',1,3);
endif;
if (empty($famne_options['auto_core_update_send_email']) && !function_exists('fa_dont_sent_auto_core_update_emails') ) :
/**
* Send email when WordPress automatic updated.
*
*/
//echo "auto_core_update_send_email off";exit;
function fa_dont_sent_auto_core_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
add_filter( 'auto_core_update_send_email', 'fa_dont_sent_auto_core_update_emails', 10, 4 );
endif;
function fa_new_user_notification_to_admin ($user_id,$deprecated,$notify='')
{
//Most parts of this function are copied form pluggable.php
if ( $deprecated !== null ) {
_deprecated_argument( __FUNCTION__, '4.3.1' );
}
global $wpdb, $wp_hasher;
$user = get_userdata( $user_id );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
if ( 'user' !== $notify ) {
$switched_locale = switch_to_locale( get_locale() );
/* translators: %s: site title */
$message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
/* translators: %s: user login */
$message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
/* translators: %s: user email address */
$message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
$wp_new_user_notification_email_admin = array(
'to' => get_option( 'admin_email' ),
/* translators: New user registration notification email subject. %s: Site title */
'subject' => __( '[%s] New User Registration' ),
'message' => $message,
'headers' => '',
);
/**
* Filters the contents of the new user notification email sent to the site admin.
*
* @since 4.9.0
*
* @param array $wp_new_user_notification_email {
* Used to build wp_mail().
*
* @type string $to The intended recipient - site admin email address.
* @type string $subject The subject of the email.
* @type string $message The body of the email.
* @type string $headers The headers of the email.
* }
* @param WP_User $user User object for new user.
* @param string $blogname The site title.
*/
$wp_new_user_notification_email_admin = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blogname );
@wp_mail(
$wp_new_user_notification_email_admin['to'],
wp_specialchars_decode( sprintf( $wp_new_user_notification_email_admin['subject'], $blogname ) ),
$wp_new_user_notification_email_admin['message'],
$wp_new_user_notification_email_admin['headers']
);
if ( $switched_locale ) {
restore_previous_locale();
}
}
}
function fa_new_user_notification_to_user($user_id,$deprecated=null,$notify='')
{
if ( $deprecated !== null ) {
_deprecated_argument( __FUNCTION__, '4.3.1' );
}
// Accepts only 'user', 'admin' , 'both' or default '' as $notify
if ( ! in_array( $notify, array( 'user', 'admin', 'both', '' ), true ) ) {
return;
}
global $wpdb, $wp_hasher;
$user = get_userdata( $user_id );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification.
if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
return;
}
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );
/** This action is documented in wp-login.php */
do_action( 'retrieve_password_key', $user->user_login, $key );
// Now insert the key, hashed, into the DB.
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
$switched_locale = switch_to_locale( get_user_locale( $user ) );
/* translators: %s: user login */
$message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
$message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n";
$message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . ">\r\n\r\n";
$message .= wp_login_url() . "\r\n";
$wp_new_user_notification_email = array(
'to' => $user->user_email,
/* translators: Login details notification email subject. %s: Site title */
'subject' => __( '[%s] Login Details' ),
'message' => $message,
'headers' => '',
);
/**
* Filters the contents of the new user notification email sent to the new user.
*
* @since 4.9.0
*
* @param array $wp_new_user_notification_email {
* Used to build wp_mail().
*
* @type string $to The intended recipient - New user email address.
* @type string $subject The subject of the email.
* @type string $message The body of the email.
* @type string $headers The headers of the email.
* }
* @param WP_User $user User object for new user.
* @param string $blogname The site title.
*/
$wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname );
wp_mail(
$wp_new_user_notification_email['to'],
wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'], $blogname ) ),
$wp_new_user_notification_email['message'],
$wp_new_user_notification_email['headers']
);
if ( $switched_locale ) {
restore_previous_locale();
}
}
function fa_user_is_administrator($user_id=0)
{
$user = new WP_User( intval($user_id) );
$is_administrator = false;
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ( strtolower($role) == 'administrator') $is_administrator = true;
}
return $is_administrator;
}
if (empty($famne_options['auto_plugin_update_send_email']) ) :
/**
* Email automatic plugin update notification to admin.
*
*/
//echo "auto_plugin_update_send_email off";
function fa_auto_plugin_update_send_email($notifications_enabled,$update_results_plugins)
{
$notifications_enabled = false;
foreach ( $update_results_plugins as $update_result ) {
// do we have a failed update?
if ( true !== $update_result->result ) $notifications_enabled = true;
}
return $notifications_enabled;
}
add_filter( 'auto_plugin_update_send_email', 'fa_auto_plugin_update_send_email',10,2 );
endif;
if (empty($famne_options['auto_theme_update_send_email']) ) :
/**
* Email automatic theme update notification to admin.
*
*/
//echo "auto_theme_update_send_email off";
function fa_auto_theme_update_send_email($notifications_enabled,$update_results_theme)
{
$notifications_enabled = false;
foreach ( $update_results_theme as $update_result ) {
// do we have a failed update?
if ( true !== $update_result->result ) $notifications_enabled = true;
}
return $notifications_enabled;
}
add_filter( 'auto_theme_update_send_email', 'fa_auto_theme_update_send_email',10,2 );
endif;

View File

@@ -0,0 +1,214 @@
<?php
/**
STOP SENDING NOTIFICATION MAILS TO THE USERS
version 1.6.1
added: Lowered the priority to 99 in the filters for new user notifications fixing some issues where plugins overwrite the disabling of sending the e-mails.
*/
if (!defined('ABSPATH')) die();
$famne_options = FAMNE::get_option( 'famne_options' );
FAMNE::AddModule('pluggable',array(
'name' => 'Pluggable',
'version'=>'1.6.1'
));
if (!function_exists('dont_send_password_change_email') ) :
/**
* Email password change notification to registered user.
*
*/
//echo "dont_send_password_change_email";
function dont_send_password_change_email( $send=false, $user='', $userdata='')
{
global $famne_options;
if (is_array($user)) $user = (object) $user;
if (!empty($famne_options['wp_password_change_notification']) ) :
/*
* Send a copy of password change notification to the admin,
* but check to see if it's the admin whose password we're changing, and skip this.
*/
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
/*
* The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
* We want to reverse this for the plain text arena of emails.
*/
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
}
endif;
if (empty($famne_options['send_password_change_email']) ) :
return false;
else :
return true;
endif;
}
add_filter('send_password_change_email', 'dont_send_password_change_email',99,3);
endif;
if (empty($famne_options['send_email_change_email']) ) :
/**
* Email users e-mail change notification to registered user.
*
*/
add_filter('send_email_change_email', '__return_false',99,3);
endif;
if (empty($famne_options['wp_new_user_notification_to_admin']))
{
/**
* Notify admin of new user registration.
*
*/
add_filter('wp_send_new_user_notification_to_admin', '__return_false', 99 ,1);
}
if (empty($famne_options['wp_new_user_notification_to_user']))
{
/**
* Notify user of new user registration.
*
*/
add_filter('wp_send_new_user_notification_to_user', '__return_false', 99, 1);
add_filter('wpmu_welcome_user_notification', '__return_false', 99, 2);
}
if (empty($famne_options['wp_notify_postauthor']) && !function_exists('wp_notify_postauthor') ) :
/**
* Notify an author (and/or others) of a comment/trackback/pingback on a post.
*/
function wp_notify_postauthor( $comment_id, $deprecated = null ) {}
endif;
if (empty($famne_options['wp_notify_moderator']) && !function_exists('wp_notify_moderator') ) :
/**
* Notifies the moderator of the blog about a new comment that is awaiting approval.
*/
function wp_notify_moderator($comment_id) {}
endif;
if (empty($famne_options['wp_password_change_notification']) && !function_exists('wp_password_change_notification') ) :
/**
* Notify the blog admin of a user changing password, normally via email.
*/
function wp_password_change_notification($user) {}
endif;
if ((empty($famne_options['send_password_forgotten_email']) || empty($famne_options['send_password_admin_forgotten_email'])) && !function_exists('dont_send_password_forgotten_email') ) :
/**
* Email forgotten password notification to registered user.
*
*/
function dont_send_password_forgotten_email( $send=true, $user_id=0 )
{
global $famne_options;
$is_administrator = fa_user_is_administrator($user_id);
if ($is_administrator && empty($famne_options['send_password_admin_forgotten_email']))
{
// stop sending admin forgot email
return false;
}
if (!$is_administrator && empty($famne_options['send_password_forgotten_email']))
{
// stop sending user forgot email
return false;
}
// none of the above so give the default status back
return $send;
}
add_filter('allow_password_reset', 'dont_send_password_forgotten_email',99,3);
endif;
if (empty($famne_options['auto_core_update_send_email']) && !function_exists('fa_dont_sent_auto_core_update_emails') ) :
/**
* Send email when WordPress automatic updated.
*
*/
function fa_dont_sent_auto_core_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
add_filter( 'auto_core_update_send_email', 'fa_dont_sent_auto_core_update_emails', 99, 4 );
endif;
function fa_user_is_administrator($user_id=0)
{
$user = new WP_User( intval($user_id) );
$is_administrator = false;
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ( strtolower($role) == 'administrator') $is_administrator = true;
}
return $is_administrator;
}
if (empty($famne_options['auto_plugin_update_send_email']) ) :
/**
* Email automatic plugin update notification to admin.
*
*/
//echo "auto_plugin_update_send_email off";
function fa_auto_plugin_update_send_email($notifications_enabled,$update_results_plugins)
{
$notifications_enabled = false;
foreach ( $update_results_plugins as $update_result ) {
// do we have a failed update?
if ( true !== $update_result->result ) $notifications_enabled = true;
}
return $notifications_enabled;
}
add_filter( 'auto_plugin_update_send_email', 'fa_auto_plugin_update_send_email',99,2 );
endif;
if (empty($famne_options['auto_theme_update_send_email']) ) :
/**
* Email automatic theme update notification to admin.
*
*/
//echo "auto_theme_update_send_email off";
function fa_auto_theme_update_send_email($notifications_enabled,$update_results_theme)
{
$notifications_enabled = false;
foreach ( $update_results_theme as $update_result ) {
// do we have a failed update?
if ( true !== $update_result->result ) $notifications_enabled = true;
}
return $notifications_enabled;
}
add_filter( 'auto_theme_update_send_email', 'fa_auto_theme_update_send_email',99,2 );
endif;

View File

@@ -0,0 +1,29 @@
<?php
/**
* Manage notification emails version switch
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
if ( ! defined( 'FA_MNE_PLUGIN_DIR' ) ) {
die();
}
global $wp_version;
if ( version_compare( $wp_version, '6.1.0' ) >= 0 ) {
include_once FA_MNE_PLUGIN_DIR . '/modules/pluggable/pluggable-functions-1.6.php';
} elseif ( version_compare( $wp_version, '5.2.0' ) >= 0 ) {
include_once FA_MNE_PLUGIN_DIR . '/modules/pluggable/pluggable-functions-1.5.php';
} elseif ( version_compare( $wp_version, '4.7.0' ) >= 0 ) {
include_once FA_MNE_PLUGIN_DIR . '/modules/pluggable/pluggable-functions-1.3.php';
} else {
include_once FA_MNE_PLUGIN_DIR . '/modules/pluggable/pluggable-functions-1.2.php';
}

View File

@@ -0,0 +1,3 @@
.display-inline-block{display:inline-block}.spacer{height:20px}.section-part{position:relative;margin-bottom:20px;padding:10px 20px;border:1px solid #ccc;background-color:#fff}.section-part.border-warning{background-color:rgba(255,255,255,.5)}.section-part.border-warning .option-container{opacity:1 !important;color:red}.section-part.border-warning .option-container.active{color:inherit}.section-part.extra .dashicons-before:before{font-size:14px}.wrap.page-width{max-width:760px}.modules{position:relative;margin:0;display:flex;flex-wrap:wrap}.modules .card{display:block;max-width:440px;min-height:240px;margin:0 15px 15px 0}@media only screen and (max-width: 500px){.modules .card{margin:15px 0}}.sections-container .option-container{opacity:.5;display:block;padding-top:5px;padding-bottom:5px;position:relative;padding-left:30px}.sections-container .option-container:hover,.sections-container .option-container.active{opacity:1}.sections-container .option-container input[type=checkbox]{position:absolute;top:20px;left:0px}@media only screen and (max-width: 782px){.sections-container .option-container input[type=checkbox]{left:-7px}}.sections-container .text-container{display:block}.sections-container .text-container input[type=text],.sections-container .text-container input[type=email]{display:block;width:100%;margin:5px 0}.nav-tab{cursor:pointer}.nav-tab .dashicons-before:before{position:relative;top:2px}.nav-tab .dashicons-admin-plugins.active{opacity:1;color:#46b450}.nav-tab .dashicons-admin-plugins.inactive{opacity:1;color:#bd003f}.switch{position:relative;display:block;float:right;right:-17px;width:40px;height:17px;cursor:default}.switch input{display:none}.slider{position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.2);-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:"";height:13px;width:13px;left:2px;bottom:2px;background-color:#fff;-webkit-transition:.2s;transition:.2s}.slider.active{background-color:#76d450}.slider.changing{background-color:#0073aa}.slider.active:before{-webkit-transform:translateX(23px);-ms-transform:translateX(23px);transform:translateX(23px)}.on,.off{color:#fff;position:absolute;top:0;left:5px;width:30px;font-size:8px;font-family:Verdana,sans-serif;text-align:right;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none}.on{text-align:left;display:none}.active .off{display:none}.active .on{display:block}.slider.round{border-radius:17px;width:40px;height:17px}.slider.round:before{border-radius:50%}.donation-box{background-color:rgba(255,255,255,.5);margin-right:10px;padding:40px;text-align:center;color:rgba(0,0,0,.7)}
/*# sourceMappingURL=main.min.css.map?1621860351981*/

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack://local.freeamigos.nl/./src/manage-notifications-emails/main.scss"],"names":[],"mappings":"AAAA,sBAEE,qBAEF,QAEI,YAKJ,cAEI,kBACA,mBACA,kBACA,sBACA,sBAEA,6BAUI,sCARA,+CAEI,qBACA,UACA,sDACI,cAKZ,6CAEI,eAIR,iBAEI,gBAGJ,SACI,kBACA,SACA,aACA,eACA,eACI,cACA,gBACA,iBACA,qBACA,0CALJ,eAMQ,eAOZ,sCAEI,WAQA,cACA,gBACA,mBACA,kBACA,kBAXA,yFAEI,UAUJ,2DACI,kBACA,SACA,SACA,0CAJJ,2DAKQ,WAMZ,oCAEI,cAEA,2GAGI,cACA,WACA,aAIR,SAEI,eAEA,kCAEI,kBACA,QAGJ,yCAEI,UACA,cAGJ,2CAEI,UACA,cAOR,QACI,kBACA,cACA,YACA,YACA,WACA,YACA,eAGF,2BAEA,QACE,kBACA,MACA,OACA,QACA,SACA,gCACA,uBACA,eAGF,eACE,kBACA,WACA,YACA,WACA,SACA,WACA,sBACA,uBACA,eAEF,eACE,yBAEF,iBACE,yBAGF,sBACE,mCACA,+BACA,2BAIF,SAEE,WACA,kBACA,MACA,SACA,WACA,cACA,+BACA,iBACA,iBACA,2BACA,yBAEF,IAEE,gBACA,aAGF,0BACA,0BAKA,cACE,mBACA,WACA,YAGF,qBACE,kBAGJ,cACI,sCACA,kBACA,aACA,kBACA,qB","file":"main.min.css?1621860351981","sourcesContent":[".display-inline-block\n{\n display:inline-block;\n}\n.spacer\n{\n height:20px;\n}\n\n\n\n.section-part\n{\n position:relative;\n margin-bottom:20px;\n padding:10px 20px;\n border:1px solid #CCC;\n background-color:#FFF;\n\n &.border-warning\n {\n .option-container\n {\n opacity:1 !important;\n color:#F00;\n &.active{\n color:inherit;\n }\n }\n background-color:rgba(255,2555,255,.5);\n }\n &.extra .dashicons-before:before\n {\n font-size:14px;\n }\n}\n\n.wrap.page-width\n{\n max-width:760px;\n}\n\n.modules{\n position: relative;\n margin:0;\n display:flex;\n flex-wrap: wrap;\n .card{\n display:block;\n max-width:440px;\n min-height:240px;\n margin:0 15px 15px 0;\n @media only screen and (max-width: 500px) {\n margin:15px 0;\n }\n }\n}\n\n\n\n.sections-container .option-container\n {\n opacity:.5;\n &:hover,\n &.active{\n opacity:1;\n }\n\n\n\n display:block;\n padding-top:5px;\n padding-bottom:5px;\n position: relative;\n padding-left:30px;\n input[type=checkbox]{\n position: absolute;\n top:20px;\n left:0px;\n @media only screen and (max-width: 782px) {\n left:-7px;\n }\n \n }\n}\n\n.sections-container .text-container\n{\n display: block;\n\n input[type=text],\n input[type=email]\n {\n display: block;\n width:100%;\n margin:5px 0;\n }\n}\n\n.nav-tab \n{\n cursor:pointer;\n\n .dashicons-before:before\n {\n position: relative;\n top:2px;\n }\n\n .dashicons-admin-plugins.active\n {\n opacity:1;\n color:#46b450;\n }\n\n .dashicons-admin-plugins.inactive\n {\n opacity:1;\n color: rgb(189, 0, 63);;\n }\n}\n\n\n\n/*SWITCH */\n.switch {\n position: relative;\n display: block;\n float:right;\n right:-17px;\n width: 40px;\n height: 17px;\n cursor: default;\n }\n \n .switch input {display:none;}\n \n .slider {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0,0,0,.2);\n -webkit-transition: .4s;\n transition: .4s;\n }\n \n .slider:before {\n position: absolute;\n content: \"\";\n height: 13px;\n width: 13px;\n left: 2px;\n bottom: 2px;\n background-color: white;\n -webkit-transition: .2s;\n transition: .2s;\n }\n .slider.active {\n background-color: #76d450;\n }\n .slider.changing {\n background-color: #0073aa;\n }\n\n .slider.active:before {\n -webkit-transform: translateX(23px);\n -ms-transform: translateX(23px);\n transform: translateX(23px);\n }\n \n /*------ ADDED CSS ---------*/\n .on, .off\n {\n color: white;\n position: absolute;\n top:0;\n left: 5px;\n width:30px;\n font-size: 8px;\n font-family: Verdana, sans-serif;\n text-align:right;\n user-select: none;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none;\n }\n .on\n {\n text-align:left;\n display: none;\n }\n\n .active .off{ display:none;}\n .active .on{ display:block;}\n\n /*--------- END --------*/\n \n /* Rounded sliders */\n .slider.round {\n border-radius: 17px;\n width:40px;\n height:17px;\n }\n \n .slider.round:before {\n border-radius: 50%;}\n\n\n.donation-box{\n background-color:rgba(255,255,255,.5);\n margin-right:10px;\n padding:40px;\n text-align:center;\n color:rgba(0,0,0,0.7);\n}"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
!function(e){var t,a,n="settings",s=document.location.hash.replace("#","");function i(t){e(".sections-container").addClass("hidden"),e("#sections-"+t).removeClass("hidden"),e(".nav-tab-wrapper>a").removeClass("nav-tab-active"),e(".nav-tab-wrapper>a#tab-"+t).addClass("nav-tab-active"),document.location="#"+t}e(window).on("hashchange",(function(){i(s=document.location.hash.replace("#",""))})),document.cookie.length>0&&-1!==(t=document.cookie.indexOf("famnetab="))&&(t+=9,-1===(a=document.cookie.indexOf(";",t))&&(a=document.cookie.length),n=unescape(document.cookie.substring(t,a))),""!==s&&(n=s),e(".sections-container").each((function(){var t=e(this).attr("id").replace("sections-",""),a=e(this).attr("title"),n=e(this).attr("data-icon"),s=e('<a id="tab-'+t+'" class="nav-tab">'+(""!==n?'<span class="dashicons-before '+n+'"></span>':"")+a+"</a>");s.on("click",(function(){document.cookie="famnetab="+t,i(t)})),e(".nav-tab-wrapper").append(s)})),i(n),e('input[name="famne_options[custom_admin_recipients]"]').on("change",(function(){var t=e(this).closest(".card"),a=e(this).val();if(e(this).closest(".text-container").removeClass("error"),""!==e(this).val()){e(".switch .slider",t).addClass("active");var n,s=a.split(",");for(var i in s)n=s[i].replace(" ",""),/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(n)||e(this).closest(".text-container").addClass("error")}else e(".switch .slider",t).removeClass("active")})),e(".checkbox-change").on("change",(function(){var t=e(this).closest(".option-container"),a=e(this).closest(".card");e(this).is(":checked")?t.addClass("active"):t.removeClass("active"),0===e(".option-container.active",a).length?e(".switch .slider",a).removeClass("active"):e(".switch .slider",a).addClass("active")})),e("input[type='file']#settings-upload-file").on("change",(function(){var t=e(this).attr("data-message");e("#settings-upload-submit").removeAttr("disabled").on("click",(function(){return confirm(t)}))}))}(jQuery);
//# sourceMappingURL=main.min.js.map?1621860351981

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,403 @@
<?php
/**
* Manage notification emails settings page class
*
* Displays the settings page.
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* version: 1.3.1
*/
if ( ! class_exists( 'FAMNESettingsPage' ) ) :
/**
* FAMNESettingsPage
*/
class FAMNESettingsPage {
private $options;
const MENU_SLUG = 'famne-admin';
const MENU_NETWORK_SLUG = 'famne-network-admin';
private $tabs = array();
private static $sections = array();
/**
* Start up
*/
public function __construct() {
add_action( 'admin_init', array( $this, 'page_init' ) );
if ( current_user_can( 'manage_network_options' ) ) :
add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) );
add_action( 'network_admin_edit_famnesavenetwork', array( $this, 'save_networksettings' ) );
add_action( 'network_admin_notices', array( $this, 'custom_notices' ) );
endif;
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_filter( 'plugin_action_links_' . FA_MNE_PLUGIN_BASENAME, array( $this, 'add_action_links' ) );
add_action( 'init', array( $this, 'famne_load_textdomain' ) );
}
/**
* Add options page
*/
public function network_admin_menu() {
// This page will be under "Settings".
add_submenu_page(
'settings.php', // Parent element.
'Notification e-mails', // Text in browser title bar.
'Notification e-mails', // Text to be displayed in the menu.
'manage_options', // Capability.
self::MENU_NETWORK_SLUG, // Page slug, will be displayed in URL.
array( $this, 'print_admin_page' )
);
$this->addTabs();
add_action( 'admin_init', array( $this, 'load_scripts' ) );
}
/**
* Add options page
*/
public function admin_menu() {
// This page will be under "Settings".
add_options_page(
'Settings Admin',
'Notification e-mails',
'manage_options',
self::MENU_SLUG,
array( $this, 'print_admin_page' )
);
$this->addTabs();
add_action( 'admin_init', array( $this, 'load_scripts' ) );
}
public function custom_notices() {
if ( self::is_famne_network_settings_page() && isset( $_GET['updated'] ) ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . esc_html__( 'Settings updated.', 'manage-notification-emails' ) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' . esc_html__( 'Dismiss this notice.', 'manage-notification-emails' ) . '</span></button></div>';
}
}
/**
* Add Tabs
*
* @return void
*/
private function addTabs() {
if ( self::is_famne_network_settings_page() ) :
$this->tabs[5] = array(
'title' => __( 'Network options', 'manage-notification-emails' ),
'slug' => 'network',
'view_file' => 'network.php',
'icon' => 'dashicons-admin-multisite',
);
endif;
if ( ! self::is_famne_network_settings_page() || FAMNE::get_option( 'famne_network_managed' ) ) :
$this->tabs[10] = array(
'title' => __( 'Core options', 'manage-notification-emails' ),
'slug' => 'settings',
'view_file' => 'settings.php',
'icon' => 'dashicons-admin-settings',
);
$this->tabs[30] = array(
'title' => __( 'Modules', 'manage-notification-emails' ),
'slug' => 'modules',
'view_file' => 'modules.php',
'icon' => 'dashicons-admin-plugins',
);
$this->tabs[90] = array(
'title' => __( 'Information', 'manage-notification-emails' ),
'slug' => 'extra',
'view_file' => 'extra.php',
'icon' => 'dashicons-editor-help',
);
endif;
}
/**
* Register and add settings
*/
public function page_init() {
register_setting(
'famne_option_group', // Option group.
'famne_options', // Option name.
array( $this, 'sanitize' ) // Sanitize.
);
add_settings_section(
'setting_section_id', // ID.
'', // Title.
array( $this, 'print_section_info' ), // Callback.
self::MENU_SLUG // Page.
);
if ( isset( $_GET['famne_reset'] ) && is_string( $_GET['famne_reset'] ) && '1' === $_GET['famne_reset'] ) {
$this->reset_settings();
}
}
/**
* Check if is_famne_settings_page
*
* @return boolean
*/
public static function is_famne_settings_page() {
global $pagenow;
$getpage = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
$is_admin_page = 'options-general.php' === $pagenow && self::MENU_SLUG === $getpage;
return $is_admin_page;
}
/**
* Check if is_famne_network_settings_page
*
* @return boolean
*/
public static function is_famne_network_settings_page() {
global $pagenow;
$getpage = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
$is_network_admin_page = 'settings.php' === $pagenow && self::MENU_NETWORK_SLUG === $getpage;
return $is_network_admin_page;
}
/**
* Load_scripts
*
* @return void
*/
public function load_scripts() {
if ( ! self::is_famne_settings_page() && ! self::is_famne_network_settings_page() ) {
return;
}
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}
/**
* Sanitize each setting field as needed
*
* @param array $input Contains all settings fields as array keys.
*/
public function sanitize( $input ) {
if ( empty( $input ) ) {
$input = array();
}
$new_input = array();
foreach ( $input as $key => $val ) {
$new_input[ $key ] = '1' === strval( $val ) ? '1' : '';
}
foreach ( FAMNE::getModules() as $mod ) :
if ( ! empty( $mod->option_id ) && is_array( $mod->option_id ) ) :
foreach ( $mod->option_id as $m ) :
if ( isset( $input[ $m ] ) ) {
$new_input[ $m ] = $input[ $m ];
}
endforeach;
endif;
endforeach;
$new_input = apply_filters( 'famne_sanitize_settings_page', $new_input );
return $new_input;
}
public function save_networksettings() {
if ( ! current_user_can( 'manage_network_options' ) ) {
check_admin_referer( 'fake_info_action', 'fake_info' );
exit;
}
if ( ! empty( $_POST ) && check_admin_referer( 'famnenetwork_save', 'famnenetwork' ) ) {
$network_activated = FAMNE::get_option( 'famne_network_managed' );
$network_managed = ! empty( $_POST['famne_options'] ) && '1' === $_POST['famne_options']['network_managed'] ? '1' : null;
FAMNE::update_option( 'famne_network_managed', $network_managed );
if ( $network_managed ) :
$options = $_POST['famne_options'];
if ( empty( $network_activated ) ) :
$options = FAMNE::default_options();
endif;
$options = $this->sanitize( $options );
/* Since 1.8.1 */
if ( ! empty( $options['wp_new_user_notification_to_admin'] ) ) {
update_site_option( 'registrationnotification', 'yes' );
} else {
update_site_option( 'registrationnotification', 'no' );
}
FAMNE::update_option( 'famne_options', $options );
endif;
wp_safe_redirect(
add_query_arg(
array(
'page' => self::MENU_NETWORK_SLUG,
'updated' => true,
),
network_admin_url( 'settings.php' )
)
);
exit;
}
}
private function reset_settings() {
if ( ! isset( $_GET['famne_reset'] ) || ! is_string( $_GET['famne_reset'] ) || '1' !== $_GET['famne_reset'] || ! isset( $_GET['nonce'] ) ) :
return;
endif;
if ( ! wp_verify_nonce( $_GET['nonce'], 'famne_reset' ) ) :
wp_nonce_ays( '' );
die();
endif;
if ( self::is_famne_settings_page() ) :
delete_option( 'fa_mne_version' );
delete_option( 'famne_options' );
FAMNE::install();
echo "<script>document.location='" . admin_url( 'options-general.php?page=famne-admin&updated=1' ) . "'</script>";
elseif ( self::is_famne_network_settings_page() ) :
delete_site_option( 'fa_mne_version' );
delete_site_option( 'famne_options' );
FAMNE::install();
echo "<script>document.location='" . admin_url( 'network/settings.php?page=famne-network-admin&updated=1' ) . "'</script>";
endif;
exit;
}
/**
* Print admin_page
*
* @return void
*/
public function print_admin_page() {
global $famne_options;
global $pagenow;
$famne_options = FAMNE::get_option( 'famne_options' );
foreach ( $this->tabs as $key => $tab ) :
self::register_section( $tab, $key );
endforeach;
do_action( 'famne_register_settings_section' );
if ( self::is_famne_network_settings_page() ) :
include_once dirname( __FILE__ ) . '/views/container-network.php';
else :
include_once dirname( __FILE__ ) . '/views/container.php';
endif;
}
/**
* Register section
*
* @param mixed $section
* @param mixed $ord
* @return void
*/
public static function register_section( $section, $ord = 99 ) {
self::$sections[ $ord ] = $section;
}
/**
* Print registered sections
*
* @param mixed $output
* @return void
*/
public static function print_sections( $output = true ) {
require_once dirname( __FILE__ ) . '/formfields.php';
ksort( self::$sections );
foreach ( self::$sections as &$section ) {
$icon = ! empty( $section['icon'] ) ? 'data-icon="' . esc_attr( $section['icon'] ) . '"' : '';
echo PHP_EOL;
echo '<div class="sections-container" id="' . esc_attr( 'sections-' . $section['slug'] ) . '" title="' . esc_attr( ucfirst( __( $section['title'] ) ) ) . '" ' . $icon . '>';
if ( ! empty( $section['view_file'] ) ) :
$view_file = FA_MNE_PLUGIN_DIR . '/modules/settings-page/views/' . basename( $section['view_file'] );
if ( file_exists( $view_file ) ) {
include_once $view_file;
}
endif;
if ( ! empty( $section['html'] ) ) {
echo esc_html( $section['html'] );
}
echo '</div>';
echo PHP_EOL;
}
}
/**
* Enqueue scripts
*
* @param mixed $hook
* @return void
*/
public function enqueue_scripts( $hook ) {
wp_enqueue_style(
'famne-settings-page',
plugins_url( '/modules/settings-page/assets/main.min.css', FA_MNE_PLUGIN_BASENAME ),
null,
time()
);
wp_enqueue_script(
'famne-settings-page',
plugins_url( '/modules/settings-page/assets/main.min.js', FA_MNE_PLUGIN_BASENAME ),
array( 'jquery' ),
time(),
true
);
}
/**
* Add_ plugin settings link
*
* @param mixed $links
* @return string
*/
public function add_action_links( $links ) {
$mylinks = array(
'<a href="' . admin_url( 'options-general.php?page=famne-admin' ) . '">' . __( 'Settings' ) . '</a>',
);
return array_merge( $links, $mylinks );
}
/**
* Translations.
*
* @since 1.4.2
*/
public function famne_load_textdomain() {
load_plugin_textdomain( FA_MNE_SLUG, false, basename( FA_MNE_PLUGIN_DIR ) . '/languages' );
}
}
endif;

View File

@@ -0,0 +1,87 @@
<?php
/**
* Form fields.
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
/**
* Print start_table_form.
*
* @return void
*/
function print_start_table_form() {
?>
<table class="form-table"><tbody>
<?php
}
/**
* Print end_table_form.
*
* @return void
*/
function print_end_table_form() {
?>
</tbody></table>
<?php
}
/**
* Print checkbox.
*
* @param mixed $options
* @param mixed $id
* @param mixed $title
* @param mixed $label
* @param mixed $message
* @return void
*/
function print_checkbox( $options, $id, $title, $label = '', $message = '' ) {
$checked = isset( $options[ $id ] ) && '1' === strval( $options[ $id ] ) ? true : false;
print '<div class="option-container ' . ( $checked ? 'active' : '' ) . '">';
print '<label><input type="checkbox" name="famne_options[' . $id . ']" value="1" ' . ( $checked ? 'checked="checked"' : '' ) . ' class="checkbox-change"/>';
print '<strong>' . $title . '</strong><br/>' . $label;
print '</label>';
print '<p class="description">' . $message . '</p>';
print '</div>';
}
/**
* Print textbox.
*
* @param mixed $options
* @param mixed $id
* @param mixed $title
* @param mixed $label
* @param mixed $message
* @param mixed $type
* @param mixed $placeholder
* @return void
*/
function print_textbox( $options, $id, $title, $label = '', $message = '', $type = 'text', $placeholder = '' ) {
$value = isset( $options[ $id ] ) && ! empty( $options[ $id ] ) ? $options[ $id ] : '';
print '<div class="text-container ' . ( ! empty( $value ) ? 'active' : '' ) . '">';
print '<br/><strong>' . $title . '</strong><br/>';
print '<label><input type="' . $type . '" name="famne_options[' . $id . ']" placeholder="' . $placeholder . '" value="' . esc_attr( $value ) . '" />';
print $label;
print '</label>';
print '<p class="description">' . $message . '</p>';
print '</div>';
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Manage notification emails settings page class
* *
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2020
*
* since: 1.6.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Load module famne_settings_page
*
* @return void
*/
function load_mod_famne_settings_page() {
if ( is_admin() ) :
FAMNE::AddModule(
'settings_page',
array(
'name' => 'Settings page',
'version' => '1.0.0',
)
);
include_once FA_MNE_PLUGIN_DIR . '/modules/settings-page/class.FAMNESettingsPage.php';
new FAMNESettingsPage();
endif;
}
add_action( 'fa_mne_modules', 'load_mod_famne_settings_page' );

View File

@@ -0,0 +1,44 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.8.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php _e( 'Manage the notification e-mails', 'manage-notification-emails' ); ?> <small><small><?php _e( 'version', 'manage-notification-emails' ); ?> <?php echo FA_MNE_VERSION; ?></small></small></h2>
<form method="post" action="edit.php?action=famnesavenetwork" enctype="multipart/form-data">
<?php
wp_nonce_field( 'famnenetwork_save', 'famnenetwork' );
_e( 'Manage your notification e-mail preferences below.', 'manage-notification-emails' );
?>
<br/>
<br/>
<div class="nav-tab-wrapper"></div>
<div class="spacer"></div>
<div class="sections-wrapper">
<?php
// This prints out all hidden setting fields.
settings_fields( 'famne_option_group' );
FAMNESettingsPage::print_sections();
?>
<?php submit_button(); ?>
</div>
<div class="clear"></div>
</form>
</div>
<?php
require_once dirname( __FILE__ ) . '/donatebox.php';

View File

@@ -0,0 +1,62 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
$managed_by_network = ! empty( FAMNE::get_option( 'famne_network_managed' ) );
?>
<div class="wrap">
<h2><?php _e( 'Manage the notification e-mails', 'manage-notification-emails' ); ?> <small><small><?php _e( 'version', 'manage-notification-emails' ); ?> <?php echo FA_MNE_VERSION; ?></small></small></h2>
<?php
if ( $managed_by_network ) :
?>
<div class="spacer"></div>
<div class="section-part network" style="text-align:center">
<div style="text-align:center;height:60px;padding-top:20px;padding-right:50px"><span class="dashicons dashicons-admin-multisite" style="font-size:50px"></span></div>
<h3 class="title" style="color:#76d450"><?php _e( 'Site managed by network manager', 'manage-notification-emails' ); ?></h3>
<?php _e( 'Manage notification e-mails settings for this site are globally managed in the multisite network settings menu.', 'manage-notification-emails' ); ?>
<div class="spacer"></div>
</div>
<div class="spacer"></div>
<?php
else :
_e( 'Manage your notification e-mail preferences below.', 'manage-notification-emails' );
?>
<form method="post" action="options.php?" enctype="multipart/form-data">
<br/>
<br/>
<div class="nav-tab-wrapper"></div>
<div class="spacer"></div>
<div class="sections-wrapper">
<?php
// This prints out all hidden setting fields.
settings_fields( 'famne_option_group' );
FAMNESettingsPage::print_sections();
?>
<?php submit_button(); ?>
</div>
<div class="clear"></div>
</form>
<?php
endif;
?>
</div>
<?php
if ( ! $managed_by_network ) :
require_once dirname( __FILE__ ) . '/donatebox.php';
endif;

View File

@@ -0,0 +1,26 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
?>
<div class="donation-box">
<p class="description"><?php _e( 'If you find this plugin useful, you can show your appreciation here :-)', 'manage-notification-emails' ); ?></p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="hosted_button_id" value="LTZWTLEDPULFE"/>
<input type="image" src="https://www.paypalobjects.com/nl_NL/NL/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal"/>
<img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1"/>
</form>
</div>
<div class="clear"></div>

View File

@@ -0,0 +1,36 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNE', false ) ) {
exit;
}
global $famne_options;
?>
<div class="wrap page-width">
<h3><?php _e( 'Information', 'manage-notification-emails' ); ?></h3>
<div class="section-part extra">
<h3><?php _e( 'Available Manage Notification E-mail Modules', 'manage-notification-emails' ); ?></h3>
<ul>
<?php
$modules = FAMNE::getModules();
foreach ( $modules as $module ) :
$icon = $module->licensed ? 'dashicons-products"' : 'dashicons-admin-plugins';
?>
<li><span class="dashicons-before <?php echo $icon; ?>"></span><?php echo esc_html( $module->name ); ?> (<?php echo esc_html( $module->version ); ?>)</li>
<?php endforeach; ?>
</ul>
</div>
</div>

View File

@@ -0,0 +1,45 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
global $famne_options;
?>
<div class="wrap">
<h3><?php _e( 'Extra modules', 'manage-notification-emails' ); ?></h3>
<p><?php _e( 'The modules below are options which are not available in WordPress by default.', 'manage-notification-emails' ); ?></p>
<div class="spacer"></div>
<div class="modules">
<?php
foreach ( FAMNE::getModules() as $mod ) :
if ( ! in_array( $mod->slug, array( 'pluggable', 'settings_page' ), true ) && ! empty( $mod->card ) ) {
call_user_func( $mod->card, $famne_options );
}
endforeach;
if ( current_user_can( 'manage_network_options' ) ) :
?>
<div class="card" style="text-align:center">
<div style="text-align:center;height:60px;padding-top:20px;padding-right:50px"><span class="dashicons dashicons-admin-multisite" style="font-size:50px"></span></div>
<h3 class="title" style="color:#76d450"><?php _e( 'Multisite managed settings available', 'manage-notification-emails' ); ?></h3>
<?php _e( 'For this environment, it is possible for you to manage all settings globally in the network settings menu.', 'manage-notification-emails' ); ?>
<div class="spacer"></div>
</div>
<?php endif; ?>
</div>
</div>

View File

@@ -0,0 +1,36 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.8.0
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
$famne_options = FAMNE::get_option( 'famne_options' );
if ( is_array( $famne_options ) ) :
$famne_options = array();
endif;
$famne_options['network_managed'] = FAMNE::get_option( 'famne_network_managed' );
?>
<div class="wrap page-width">
<h3><?php _e( 'Manage multisite options', 'manage-notification-emails' ); ?></h3>
<p><?php _e( 'Here you can choose to manage all options for this plugin in one location. No hassle with toggling options on and off for each subsite individually.', 'manage-notification-emails' ); ?></p>
<div class="section-part">
<?php
print_checkbox( $famne_options, 'network_managed', __( 'Use the network settings.', 'manage-notification-emails' ), __( 'Checking this option will disable per site management. All sites will use these global network settings.', 'manage-notification-emails' ) );
?>
</div>
</div>

View File

@@ -0,0 +1,79 @@
<?php
/**
* Custom view
*
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2015
*
* since: 1.3.0
* version: 1.3.1
*/
if ( ! defined( 'ABSPATH' ) || ! class_exists( 'FAMNESettingsPage', false ) ) {
exit;
}
global $famne_options;
?>
<div class="wrap page-width">
<h3><?php _e( 'Options for e-mails to users', 'manage-notification-emails' ); ?></h3>
<div class="section-part">
<?php
print_checkbox( $famne_options, 'wp_new_user_notification_to_user', __( 'New user notification to user', 'manage-notification-emails' ), __( 'Send e-mail with login credentials to a newly-registered user.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'wp_notify_postauthor', __( 'Notify post author', 'manage-notification-emails' ), __( 'Send e-mail to an author (and/or others) of a comment/trackback/pingback on a post.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'wp_notify_moderator', __( 'Notify moderator', 'manage-notification-emails' ), __( 'Send e-mail to the moderator of the blog about a new comment that is awaiting approval.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'send_password_change_email', __( 'Password change notification to user', 'manage-notification-emails' ), __( 'Send e-mail to registered user about changing his or her password. Be careful with this option, because when unchecked, the forgotten password request e-mails will be blocked too.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'send_email_change_email', __( 'E-mail address change notification to user', 'manage-notification-emails' ), __( 'Send e-mail to registered user about changing his or her E-mail address.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'send_password_forgotten_email', __( 'Password forgotten e-mail to user', 'manage-notification-emails' ), __( 'Send the forgotten password e-mail to registered user.<br/>(To prevent locking yourself out, sending of the forgotten password e-mail for administrators will still work)', 'manage-notification-emails' ) );
?>
</div>
<br/>
<h2><?php _e( 'Options for e-mails to administrators', 'manage-notification-emails' ); ?></h2>
<div class="section-part">
<?php
print_start_table_form();
$user_noti_title = __( 'New user notification to site admin', 'manage-notification-emails' );
$user_noti_label = __( 'Sends an e-mail to the site admin after a new user is registered.', 'manage-notification-emails' );
if ( is_multisite() && ! FAMNE::network_managed() ) {
$user_noti = get_site_option( 'registrationnotification' ) === 'yes' ? true : false;
print '<div class="option-container">';
print '<label><input type="checkbox" disabled ' . ( $user_noti ? 'checked="checked"' : '' ) . ' />';
// translators: Adding network settings link.
print '<strong>' . $user_noti_title . '</strong><br/><em>' . sprintf( __( 'Globally managed in the multisite %1$snetwork settings menu%2$s.', 'manage-notification-emails' ), '<a href="' . network_admin_url( 'settings.php' ) . '">', '</a>' ) . '</em><br/>' . $user_noti_label;
print '</label>';
print '</div>';
} else {
print_checkbox( $famne_options, 'wp_new_user_notification_to_admin', $user_noti_title, $user_noti_label );
}
print_checkbox( $famne_options, 'wp_password_change_notification', __( 'Password change notification to admin', 'manage-notification-emails' ), __( 'Send e-mail to the blog admin of a user changing his or her password.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'auto_core_update_send_email', __( 'Automatic WordPress core update e-mail', 'manage-notification-emails' ), __( 'Sends an e-mail after a successful automatic WordPress core update to administrators. E-mails about failed updates will always be sent to the administrators and cannot be disabled.', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'auto_plugin_update_send_email', __( 'Automatic WordPress plugin update e-mail', 'manage-notification-emails' ), __( 'Sends an e-mail after a successful automatic plugin update to administrators. E-mails about failed plugin updates will always be sent to the administrators', 'manage-notification-emails' ) );
print_checkbox( $famne_options, 'auto_theme_update_send_email', __( 'Automatic WordPress theme update e-mail', 'manage-notification-emails' ), __( 'Sends an e-mail after a successful automatic theme update to administrators. E-mails about failed theme updates will always be sent to the administrators', 'manage-notification-emails' ) );
print_end_table_form();
?>
</div>
<div class="section-part border-warning">
<?php
print_start_table_form();
print_checkbox( $famne_options, 'send_password_admin_forgotten_email', __( 'Password forgotten e-mail to administrator', 'manage-notification-emails' ), __( 'Send the forgotten password e-mail to administrators.', 'manage-notification-emails' ), __( 'Okay, this is a <strong style="color:#900">DANGEROUS OPTION !</strong><br/> So be warned, because unchecking this option prevents sending out the forgotten password e-mail to all administrators. So hold on to your own password and uncheck this one at your own risk ;-)', 'manage-notification-emails' ) );
print_end_table_form();
?>
</div>
<p style="float:right"><a href="#" onclick="resetToDefaults();return false" class="button"><?php _e( 'Reset settings', 'manage-notification-emails' ); ?></a></p>
</div>
<?php
$admin_page = FAMNESettingsPage::is_famne_network_settings_page() ? 'network/settings.php?page=famne-network-admin&famne_reset=1' : 'options-general.php?page=famne-admin&famne_reset=1';
$reset_url = str_replace( '&amp;', '&', wp_nonce_url( admin_url( $admin_page ), 'famne_reset', 'nonce' ) ) . '#settings';
?>
<script>
function resetToDefaults(){
var r = confirm('reset to default settings?');
if (r == true) document.location='<?php echo $reset_url; ?>';
}
</script>

View File

@@ -0,0 +1,140 @@
<?php
/**
* Manage notification emails settings page class
* *
* This file is part of the Manage Notification Emails plugin
* You can find out more about this plugin at https://www.freeamigos.nl
* Copyright (c) 2006-2015 Virgial Berveling
*
* @package WordPress
* @author Virgial Berveling
* @copyright 2006-2020
*
* since: 1.7.0
*/
// phpcs:disable WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Load module famne_user_email_changed
*
* @return void
*/
function load_mod_famne_user_email_changed() {
$famne_options = FAMNE::get_option( 'famne_options' );
FAMNE::AddModule(
'email_changed_email',
array(
'name' => 'Add user e-mailaddress change notifier',
'version' => '1.0.0',
'option_id' => array( 'send_email_change_request_email_to_admin', 'send_email_changed_email_to_admin' ),
'card' => 'card_famne_user_email_changed',
)
);
/**
* Card_famne_user_email_changed
*
* @param mixed $famne_options
* @return void
*/
function card_famne_user_email_changed( $famne_options ) {
$active = ! empty( $famne_options['send_email_change_request_email_to_admin'] ) || ! empty( $famne_options['send_email_changed_email_to_admin'] );
?>
<div class="card">
<label class="switch"><div class="slider round <?php echo ( $active ? 'active' : '' ); ?>"><span class="on">ON</span><span class="off">OFF</span></div></label>
<h2 class="title"><?php _e( 'E-mail address changed by user', 'manage-notification-emails' ); ?></h2>
<?php print_checkbox( $famne_options, 'send_email_change_request_email_to_admin', __( 'Request to change e-mailadress notification to admin', 'manage-notification-emails' ), __( 'Sends an e-mail to administrators after a user requested to update his or her e-mailaddress.', 'manage-notification-emails' ) ); ?>
<?php print_checkbox( $famne_options, 'send_email_changed_email_to_admin', __( 'User changed (confirmed) e-mail notification to admin', 'manage-notification-emails' ), __( 'Sends an e-mail to administrators after a user successfully updated his or her e-mailaddress.', 'manage-notification-emails' ) ); ?>
</div>
<?php
}
if ( ! empty( $famne_options['send_email_change_request_email_to_admin'] ) ) :
/**
* Famne_user_email_change_request_to_admin
*
* @return void
*/
function famne_user_email_change_request_to_admin() {
// stop if email is not right.
$email = sanitize_email( $_POST['email'] );
if ( ! is_email( $email ) || email_exists( $email ) ) {
return;
}
$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$admin_email = get_option( 'admin_email' );
/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy admin,
Recently a user requested to have his email address on his account changed.
An email change request has been sent to ###EMAIL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
$email_text = str_replace( '###EMAIL###', $email, $email_text );
$email_text = str_replace( '###SITENAME###', $blog_name, $email_text );
$email_text = str_replace( '###SITEURL###', home_url(), $email_text );
wp_mail( $admin_email, sprintf( __( '[%s] User requested Email Change' ), $blog_name ), $email_text );
}
add_action( 'personal_options_update', 'famne_user_email_change_request_to_admin' );
endif;
if ( ! empty( $famne_options['send_email_changed_email_to_admin'] ) ) :
/**
* Famne_user_email_changed_email_to_admin
*
* @param array $email_change_email
* @param mixed $user
* @param mixed $userdata
* @return array $email_change_email
*/
function famne_user_email_changed_email_to_admin( $email_change_email, $user, $userdata ) {
$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$admin_email = get_option( 'admin_email' );
/* translators: Do not translate USERNAME, ADMIN_EMAIL, NEW_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Hi admin,
This notice confirms that the user ###USERNAME### changed his email address on ###SITENAME### from ###EMAIL### to ###NEW_EMAIL###.
Regards,
All at ###SITENAME###
###SITEURL###'
);
$email_text = str_replace( '###USERNAME###', $user['user_login'], $email_text );
$email_text = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_text );
$email_text = str_replace( '###EMAIL###', $user['user_email'], $email_text );
$email_text = str_replace( '###SITENAME###', $blog_name, $email_text );
$email_text = str_replace( '###SITEURL###', home_url(), $email_text );
wp_mail( $admin_email, sprintf( __( '[%s] User Email Changed' ), $blog_name ), $email_text, $email_change_email['headers'] );
return $email_change_email;
}
add_filter( 'email_change_email', 'famne_user_email_changed_email_to_admin', 10, 3 );
endif;
}
add_action( 'fa_mne_modules', 'load_mod_famne_user_email_changed' );