Plugin Directory

Changeset 2527305


Ignore:
Timestamp:
05/06/2021 02:04:32 PM (5 years ago)
Author:
subodhghulaxe
Message:

Updated tested up to 5.7.1
Improved security by sanitizing inputs

Location:
wp-change-default-from-email
Files:
28 added
5 edited

Legend:

Unmodified
Added
Removed
  • wp-change-default-from-email/trunk/WCDFE.php

    r2504339 r2527305  
    22/**
    33 * Plugin Name: WP Change Default From Email
    4  * Plugin URI:
     4 * Plugin URI: https://wordpress.org/plugins/wp-change-default-from-email/
    55 * Text Domain: WCDFE_translation
    66 * Domain Path: /languages
    77 * Description: A simple and easy way to change the from email address and from email name that appear on emails sent from WordPress.
    8  * Version: 1.1.3
     8 * Version: 1.1.4
    99 * Author: Subodh Ghulaxe
    1010 * Author URI: http://www.subodhghulaxe.com
  • wp-change-default-from-email/trunk/admin/WCDFE_Admin.php

    r1118443 r2527305  
    11<?php
    22
    3 //avoid direct calls to this file where wp core files not present
     3// Avoid direct calls to this file where wp core files not present
    44if (!function_exists ('add_action')) {
    55    header('Status: 403 Forbidden');
     
    8181            check_ajax_referer( 'wcdfe-save-settings', 'security' );
    8282
    83             $wcdfe_settings = isset($_POST['wcdfe_settings']) ? $_POST['wcdfe_settings'] : array();
     83            // Sanitize inputs
     84            $wcdfe_settings = isset($_POST['wcdfe_settings']) ? (array) array_map('sanitize_text_field', $_POST['wcdfe_settings']) : array();
    8485
    8586            if( isset($wcdfe_settings['from_name']) && empty($wcdfe_settings['from_name']) ) {
     
    9495            if(empty($error)) {
    9596                // Save setting in WordPress options
    96                 $result = update_option('wcdfe_settings',$wcdfe_settings);
    97                 if($result){
    98                     $response['status'] = 'success';
    99                     $response['message'] = __( 'Settings updated successfully.', WCDFE_TEXTDOMAIN );
    100                 } else {
    101                     $response['status'] = 'error';
    102                     $response['message'] = __( 'No settings were updated.', WCDFE_TEXTDOMAIN );
    103                 }
     97                update_option('wcdfe_settings', $wcdfe_settings);
     98                $response['status'] = 'success';
     99                $response['message'] = __( 'Settings updated successfully.', WCDFE_TEXTDOMAIN );
    104100            } else {
    105101                $response['status'] = 'error';
  • wp-change-default-from-email/trunk/admin/pages/settings.php

    r2504339 r2527305  
    5050       
    5151        <div class="wcdfe-save-settings-container">
    52             <input type="submit" value="<?php echo __( 'Save Settings', WCDFE_TEXTDOMAIN ); ?>" class="button button-large button-primary" id="wcdfe-save-settings" name="save_settings">
     52            <input type="submit" value="<?php echo __( 'Save Settings', WCDFE_TEXTDOMAIN ); ?>" class="button button-large button-primary wcdfe-button" id="wcdfe-save-settings" name="save_settings">
    5353            <div id="wcdfe-error-message"></div>
    5454        </div>
     
    104104    jQuery("#wcdfe-save-settings").on('click', function(e) {
    105105        e.preventDefault();
     106        jQuery("#wcdfe-error-message").html('');
     107        jQuery("#wcdfe-save-settings").val("Saving Settings ...");
     108        jQuery("#wcdfe-save-settings").addClass("is-busy");
     109
    106110        var data = jQuery("#wcdfe-settings-form").serialize();
    107111        jQuery.ajax({
     
    118122                    jQuery("#wcdfe-error-message").html('<div class="error"><p><?php echo __( "No settings were saved.", WCDFE_TEXTDOMAIN ); ?></p></div>');
    119123                }
     124                jQuery("#wcdfe-save-settings").val("Save Settings");
     125        jQuery("#wcdfe-save-settings").removeClass("is-busy");
     126            },
     127            error: function (jqXHR, exception) {
     128                var msg = '';
     129                if (jqXHR.status === 0) {
     130                        msg = 'Not connect.\n Verify Network.';
     131                } else if (jqXHR.status == 404) {
     132                        msg = 'Requested page not found. [404]';
     133                } else if (jqXHR.status == 500) {
     134                        msg = 'Internal Server Error [500].';
     135                } else if (exception === 'parsererror') {
     136                        msg = 'Requested JSON parse failed.';
     137                } else if (exception === 'timeout') {
     138                        msg = 'Time out error.';
     139                } else if (exception === 'abort') {
     140                        msg = 'Request aborted.';
     141                } else {
     142                        msg = 'Uncaught Error.\n' + jqXHR.responseText;
     143                }
     144                jQuery("#wcdfe-error-message").html('<div class="error"><p>' + msg + '</p></div>');
     145                jQuery("#wcdfe-save-settings").val("Saving Settings");
     146                jQuery("#wcdfe-save-settings").removeClass("is-busy");
    120147            }
    121148        });
  • wp-change-default-from-email/trunk/assets/css/admin.css

    r1118443 r2527305  
     1@keyframes wcdfe-button__busy-animation {
     2    0% {
     3      background-position: 200px 0;
     4    }
     5  }
     6  .wcdfe-button.is-busy,
     7  .wcdfe-button.is-busy:hover,
     8  .wcdfe-button.is-busy:active,
     9  .wcdfe-button.is-busy:focus {
     10    animation: wcdfe-button__busy-animation 2.5s linear infinite;
     11    background-image: linear-gradient(
     12      -45deg,
     13      #007cba 33%,
     14      #005a87 0,
     15      #005a87 70%,
     16      #007cba 0
     17    );
     18}
    119.wcdfe-row{
    220    clear: both;
     
    2644.wcdfe-onoffswitch {
    2745    position: relative; width: 90px;
    28     -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
     46    user-select: none;
     47    -webkit-user-select: none;
     48    -moz-user-select: none;
     49    -ms-user-select: none;
    2950}
    3051.wcdfe-onoffswitch-checkbox {
     
    81102    position: relative;
    82103    display: inline-block;
     104    margin-left: 10px;
    83105}
    84106#wcdfe-error-message .updated, #wcdfe-error-message .error {
  • wp-change-default-from-email/trunk/readme.txt

    r2504339 r2527305  
    44Donate link: https://www.patreon.com/subodhghulaxe
    55Requires at least: 2.7
    6 Tested up to: 5.7
    7 Stable tag: trunk
     6Tested up to: 5.7.1
     7Requires PHP: 5.2.4
     8Stable tag: 1.1.4
    89License: GPLv2 or later
    910License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2425* **Easy Settings.** Easy to enable/disable and change settings
    2526* **Clean & Well Commented Code.** Easy to enable/disable and change settings
     27
     28**Please support my other plugins:**
     29<ol>
     30  <li>
     31    <a href="https://wordpress.org/plugins/change-login-page-logo/">Change Login Page Logo</a>
     32  </li>
     33  <li>
     34    <a href="https://wordpress.org/plugins/hide-admin-bar-for-user-roles/">Hide Admin Bar For User Roles</a>
     35  </li>
     36</ol>
    2637
    2738**Translations/Languages:**
     
    8091Updated contact information
    8192
     93= 1.1.4 =
     94Updated tested up to 5.7.1
     95Improved security by sanitizing inputs
     96
    8297== Upgrade Notice ==
    8398= 1.0.0 =
     
    97112Updated screenshots
    98113Updated contact information
     114
     115= 1.1.4 =
     116Updated tested up to 5.7.1
     117Improved security by sanitizing inputs
Note: See TracChangeset for help on using the changeset viewer.