Plugin Directory

Changeset 2974859

Timestamp:
10/04/2023 04:46:41 PM (10 months ago)
Author:
rafiq91
Message:

Update to version 7.7.3 from GitHub

Location:
directorist
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • directorist/tags/7.7.3/config.php

    r2965600 r2974859  
    11<?php
    22// Plugin version.
    3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.2' );}
     3if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.' );}
    44// Plugin Folder Path.
    55if ( ! defined( 'ATBDP_DIR' ) ) { define( 'ATBDP_DIR', plugin_dir_path( __FILE__ ) ); }
  • directorist/tags/7.7.3/directorist-base.php

    r2965600 r2974859  
    44 * Plugin URI: https://wpwax.com
    55 * Description: A comprehensive solution to create professional looking directory site of any kind. Like Yelp, Foursquare, etc.
    6  * Version: 7.7.2
     6 * Version: 7.7.
    77 * Author: wpWax
    88 * Author URI: https://wpwax.com
  • directorist/tags/7.7.3/includes/classes/class-email.php

    r2957174 r2974859  
    7878            }
    7979            if ( empty( $user ) ) {
    80                 $post_author_id = get_post_field( 'post_author', $listing_id );
     80                $post_author_id = get_post_field( 'post_author', $listing_id );
    8181                $user = get_userdata( $post_author_id );
    8282            } else {
     
    954954
    955955            if ( 'bank_transfer' !== $gateway ) {
    956                 return false;   
     956                return false;
    957957            }
    958958
     
    10871087         * @return bool Whether the email was sent successfully or not.
    10881088         */
    1089         public function send_password_reset_pin_email( $listing_email ) {
    1090             $s = __( '[==SITE_NAME==] Password Reset PIN', 'directorist' );
    1091             $sub = str_replace( '==SITE_NAME==', get_option( 'blogname' ), $s );
    1092             $pin = random_int( 1000, 9999 );
    1093 
    1094             $min = 15;
    1095             $expiration = 60 * $min; // In seconds
    1096 
    1097             set_transient( "directorist_reset_pin_${listing_email}", $pin, $expiration );
    1098 
    1099             $body    = $this->get_password_reset_pin_email_template();
    1100             $message = $this->replace_in_content( $body, $order_id = 0, $listing_id = 0, $user = null, $renewal = null, $pin );
    1101             $body    = atbdp_email_html( $sub, $message );
    1102 
    1103             return $this->send_mail( $listing_email, $sub, $body, $this->get_email_headers() );
    1104 
     1089        public function send_password_reset_pin_email( $user ) {
     1090            $subject    = esc_html( sprintf( __( '[%s] Password Reset PIN', 'directorist' ), get_option( 'blogname' ) ) );
     1091            $user_email = $user->user_email;
     1092            $pin_code   = directorist_generate_password_reset_pin_code( $user );
     1093            $body       = $this->get_password_reset_pin_email_template();
     1094            $message    = $this->replace_in_content( $body, 0, 0, $user, null, $pin_code );
     1095            $body       = atbdp_email_html( $subject, $message );
     1096
     1097            return $this->send_mail( $user_email, $subject, $body, $this->get_email_headers() );
    11051098        }
    11061099
  • directorist/tags/7.7.3/includes/helper-functions.php

    r2957174 r2974859  
    41204120    return ( float ) $item;
    41214121}
     4122
     4123
     4124
     4125
     4126
     4127
     4128
     4129
     4130
     4131
     4132
     4133
     4134
     4135
     4136
     4137
     4138
     4139
     4140
     4141
     4142
     4143
     4144
     4145
     4146
     4147
     4148
     4149
     4150
     4151
     4152
     4153
     4154
     4155
     4156
     4157
     4158
     4159
     4160
     4161
     4162
     4163
     4164
     4165
     4166
     4167
     4168
     4169
     4170
     4171
     4172
     4173
     4174
     4175
     4176
     4177
  • directorist/tags/7.7.3/includes/rest-api/Version1/class-users-account-controller.php

    r2628042 r2974859  
    3131    public function register_routes() {
    3232        // Send Password Reset PIN
    33         register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array(
     33register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array(
    3434            'methods'             => WP_REST_Server::CREATABLE,
    3535            'callback'            => array( $this, 'send_password_reset_pin' ),
     
    4646
    4747        // Verify Password Reset PIN
    48         register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array(
     48register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array(
    4949            'methods'             => WP_REST_Server::CREATABLE,
    5050            'callback'            => array( $this, 'verify_password_reset_pin' ),
     
    6666
    6767        // Rest user password.
    68         register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array(
     68register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array(
    6969            'methods'             => WP_REST_Server::CREATABLE,
    7070            'callback'            => array( $this, 'reset_user_password' ),
     
    9292
    9393        // Change password.
    94         register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array(
     94register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array(
    9595            'methods'             => WP_REST_Server::CREATABLE,
    9696            'callback'            => array( $this, 'change_password' ),
     
    168168
    169169    public function send_password_reset_pin( $request ) {
    170         ATBDP()->email->send_password_reset_pin_email( $request['email'] );
    171 
    172         $data = [
    173             'success' => true,
    174             'message' => __( 'Password reset code has been sent to given email.', 'directorist' ),
     170        $user = $this->get_user_by_email( $request['email'] );
     171
     172        ATBDP()->email->send_password_reset_pin_email( $user );
     173
     174        $data = [
     175            'success' => true,
     176            'message' => __( 'Password reset code has been sent to your email.', 'directorist' ),
    175177            'email'   => $request['email'],
    176178        ];
     
    182184
    183185    public function verify_password_reset_pin( $request ) {
    184         $email        = $request['email'];
    185         $password_pin = get_transient( "directorist_reset_pin_$email" );
    186 
    187         if ( empty( $password_pin ) ) {
    188             return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Given password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) );
    189         }
    190 
    191         if ( $password_pin != $request['pin'] ) {
    192             return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) );
    193         }
     186        $is_valid = $this->validate_reset_pin_code( $request );
     187
     188        if ( is_wp_error( $is_valid ) ) {
     189            return $is_valid;
     190        }
    194191
    195192        $data = [
     
    204201
    205202    public function reset_user_password( $request ) {
    206         $email        = $request['email'];
    207         $user         = get_user_by( 'email', $email );
    208         $password_pin = get_transient( "directorist_reset_pin_$email" );
    209 
    210         if ( empty( $password_pin ) ) {
    211             return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Your password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) );
    212         }
    213 
    214         if ( $password_pin != $request['pin'] ) {
    215             return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) );
    216         }
    217 
    218         // Change Password
    219         wp_set_password( $request['password'], $user->ID );
    220 
    221         // Delete The PIN
    222         delete_transient( "directorist_reset_pin_$email" );
     203        $is_valid = $this->validate_reset_pin_code( $request );
     204
     205        if ( is_wp_error( $is_valid ) ) {
     206            return $is_valid;
     207        }
     208
     209        $user = $this->get_user_by_email( $request['email'] );
     210
     211        wp_set_password( $request['password'], $user->ID );
     212
     213        directorist_delete_password_reset_code_transient( $user );
     214        delete_user_meta( $user->ID, 'directorist_pasword_reset_key' );
    223215
    224216        $data = [
     
    241233
    242234        // Change Password
    243         wp_set_password( $request['new_password'], $user->ID );
     235wp_set_password( $request['new_password'], $user->ID );
    244236
    245237        $data = [
     
    252244        return $response;
    253245    }
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
    254260}
  • directorist/tags/7.7.3/readme.txt

    r2965600 r2974859  
    66Tested up to: 6.3
    77Requires PHP: 7.0
    8 Stable tag: 7.7.2
     8Stable tag: 7.7.
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    410410
    411411== Changelog ==
     412
     413
     414
     415
    412416
    4134177.7.2 - Sep 12, 2023
  • directorist/trunk/config.php

    r2965600 r2974859  
    11<?php
    22// Plugin version.
    3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.2' );}
     3if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.' );}
    44// Plugin Folder Path.
    55if ( ! defined( 'ATBDP_DIR' ) ) { define( 'ATBDP_DIR', plugin_dir_path( __FILE__ ) ); }
  • directorist/trunk/directorist-base.php

    r2965600 r2974859  
    44 * Plugin URI: https://wpwax.com
    55 * Description: A comprehensive solution to create professional looking directory site of any kind. Like Yelp, Foursquare, etc.
    6  * Version: 7.7.2
     6 * Version: 7.7.
    77 * Author: wpWax
    88 * Author URI: https://wpwax.com
  • directorist/trunk/includes/classes/class-email.php

    r2957174 r2974859  
    7878            }
    7979            if ( empty( $user ) ) {
    80                 $post_author_id = get_post_field( 'post_author', $listing_id );
     80                $post_author_id = get_post_field( 'post_author', $listing_id );
    8181                $user = get_userdata( $post_author_id );
    8282            } else {
     
    954954
    955955            if ( 'bank_transfer' !== $gateway ) {
    956                 return false;   
     956                return false;
    957957            }
    958958
     
    10871087         * @return bool Whether the email was sent successfully or not.
    10881088         */
    1089         public function send_password_reset_pin_email( $listing_email ) {
    1090             $s = __( '[==SITE_NAME==] Password Reset PIN', 'directorist' );
    1091             $sub = str_replace( '==SITE_NAME==', get_option( 'blogname' ), $s );
    1092             $pin = random_int( 1000, 9999 );
    1093 
    1094             $min = 15;
    1095             $expiration = 60 * $min; // In seconds
    1096 
    1097             set_transient( "directorist_reset_pin_${listing_email}", $pin, $expiration );
    1098 
    1099             $body    = $this->get_password_reset_pin_email_template();
    1100             $message = $this->replace_in_content( $body, $order_id = 0, $listing_id = 0, $user = null, $renewal = null, $pin );
    1101             $body    = atbdp_email_html( $sub, $message );
    1102 
    1103             return $this->send_mail( $listing_email, $sub, $body, $this->get_email_headers() );
    1104 
     1089        public function send_password_reset_pin_email( $user ) {
     1090            $subject    = esc_html( sprintf( __( '[%s] Password Reset PIN', 'directorist' ), get_option( 'blogname' ) ) );
     1091            $user_email = $user->user_email;
     1092            $pin_code   = directorist_generate_password_reset_pin_code( $user );
     1093            $body       = $this->get_password_reset_pin_email_template();
     1094            $message    = $this->replace_in_content( $body, 0, 0, $user, null, $pin_code );
     1095            $body       = atbdp_email_html( $subject, $message );
     1096
     1097            return $this->send_mail( $user_email, $subject, $body, $this->get_email_headers() );
    11051098        }
    11061099
  • directorist/trunk/includes/helper-functions.php

    r2957174 r2974859  
    41204120    return ( float ) $item;
    41214121}
     4122
     4123
     4124
     4125
     4126
     4127
     4128
     4129
     4130
     4131
     4132
     4133
     4134
     4135
     4136
     4137
     4138
     4139
     4140
     4141
     4142
     4143
     4144
     4145
     4146
     4147
     4148
     4149
     4150
     4151
     4152
     4153
     4154
     4155
     4156
     4157
     4158
     4159
     4160
     4161
     4162
     4163
     4164
     4165
     4166
     4167
     4168
     4169
     4170
     4171
     4172
     4173
     4174
     4175
     4176
     4177
  • directorist/trunk/includes/rest-api/Version1/class-users-account-controller.php

    r2628042 r2974859  
    3131    public function register_routes() {
    3232        // Send Password Reset PIN
    33         register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array(
     33register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array(
    3434            'methods'             => WP_REST_Server::CREATABLE,
    3535            'callback'            => array( $this, 'send_password_reset_pin' ),
     
    4646
    4747        // Verify Password Reset PIN
    48         register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array(
     48register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array(
    4949            'methods'             => WP_REST_Server::CREATABLE,
    5050            'callback'            => array( $this, 'verify_password_reset_pin' ),
     
    6666
    6767        // Rest user password.
    68         register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array(
     68register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array(
    6969            'methods'             => WP_REST_Server::CREATABLE,
    7070            'callback'            => array( $this, 'reset_user_password' ),
     
    9292
    9393        // Change password.
    94         register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array(
     94register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array(
    9595            'methods'             => WP_REST_Server::CREATABLE,
    9696            'callback'            => array( $this, 'change_password' ),
     
    168168
    169169    public function send_password_reset_pin( $request ) {
    170         ATBDP()->email->send_password_reset_pin_email( $request['email'] );
    171 
    172         $data = [
    173             'success' => true,
    174             'message' => __( 'Password reset code has been sent to given email.', 'directorist' ),
     170        $user = $this->get_user_by_email( $request['email'] );
     171
     172        ATBDP()->email->send_password_reset_pin_email( $user );
     173
     174        $data = [
     175            'success' => true,
     176            'message' => __( 'Password reset code has been sent to your email.', 'directorist' ),
    175177            'email'   => $request['email'],
    176178        ];
     
    182184
    183185    public function verify_password_reset_pin( $request ) {
    184         $email        = $request['email'];
    185         $password_pin = get_transient( "directorist_reset_pin_$email" );
    186 
    187         if ( empty( $password_pin ) ) {
    188             return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Given password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) );
    189         }
    190 
    191         if ( $password_pin != $request['pin'] ) {
    192             return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) );
    193         }
     186        $is_valid = $this->validate_reset_pin_code( $request );
     187
     188        if ( is_wp_error( $is_valid ) ) {
     189            return $is_valid;
     190        }
    194191
    195192        $data = [
     
    204201
    205202    public function reset_user_password( $request ) {
    206         $email        = $request['email'];
    207         $user         = get_user_by( 'email', $email );
    208         $password_pin = get_transient( "directorist_reset_pin_$email" );
    209 
    210         if ( empty( $password_pin ) ) {
    211             return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Your password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) );
    212         }
    213 
    214         if ( $password_pin != $request['pin'] ) {
    215             return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) );
    216         }
    217 
    218         // Change Password
    219         wp_set_password( $request['password'], $user->ID );
    220 
    221         // Delete The PIN
    222         delete_transient( "directorist_reset_pin_$email" );
     203        $is_valid = $this->validate_reset_pin_code( $request );
     204
     205        if ( is_wp_error( $is_valid ) ) {
     206            return $is_valid;
     207        }
     208
     209        $user = $this->get_user_by_email( $request['email'] );
     210
     211        wp_set_password( $request['password'], $user->ID );
     212
     213        directorist_delete_password_reset_code_transient( $user );
     214        delete_user_meta( $user->ID, 'directorist_pasword_reset_key' );
    223215
    224216        $data = [
     
    241233
    242234        // Change Password
    243         wp_set_password( $request['new_password'], $user->ID );
     235wp_set_password( $request['new_password'], $user->ID );
    244236
    245237        $data = [
     
    252244        return $response;
    253245    }
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
    254260}
  • directorist/trunk/readme.txt

    r2965600 r2974859  
    66Tested up to: 6.3
    77Requires PHP: 7.0
    8 Stable tag: 7.7.2
     8Stable tag: 7.7.
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    410410
    411411== Changelog ==
     412
     413
     414
     415
    412416
    4134177.7.2 - Sep 12, 2023
Note: See TracChangeset for help on using the changeset viewer.