Changeset 2921182
- Timestamp:
- 06/04/2023 09:10:30 AM (22 months ago)
- Location:
- wp-user-switch
- Files:
-
- 1 added
- 1 deleted
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
wp-user-switch/trunk/inc/enqueue_scripts.php
r2476880 r2921182 23 23 function wpus_scripts() { 24 24 wp_enqueue_style('wpus-main-css', wpus_plugin_url('/assets/css/main.css'), '', ''); 25 wp_enqueue_script('wpus-main-js', wpus_plugin_url('/assets/js/main.js'), ['jquery'], '', true);25 wp_enqueue_script('wpus-main-js', wpus_plugin_url('/assets/js/main.js'), array('jquery'), '', true); 26 26 } -
wp-user-switch/trunk/inc/functions.php
r2237142 r2921182 30 30 $allow = true; 31 31 } else { 32 if ( isset( $_COOKIE['wpus_who_switch'] ) ) { 33 $allowed_user_cookie = sanitize_user($_COOKIE['wpus_who_switch']); 32 $set_option = get_option(WP_USERSWITCH_LOGGED_IN_COOKIE, false); 33 if ( $set_option ) { 34 $allowed_user_cookie = sanitize_user(wpus_decrypt($set_option)); 34 35 } 35 36 $user = get_user_by( 'login', $allowed_user_cookie ); … … 49 50 function wpus_is_switcher_admin () { 50 51 $allowed_user_cookie = ''; 51 if ( isset( $_COOKIE['wpus_who_switch'] ) ) { 52 $allowed_user_cookie = sanitize_user($_COOKIE['wpus_who_switch']); 52 $set_option = get_option(WP_USERSWITCH_LOGGED_IN_COOKIE, false); 53 if ( $set_option ) { 54 $allowed_user_cookie = sanitize_user(wpus_decrypt($set_option)); 53 55 } 54 56 $user = get_user_by( 'login', $allowed_user_cookie ); … … 98 100 <?php 99 101 } 102 103 function wpus_encrypt($string){ 104 $current_date = current_datetime()->format('Y-m-d'); 105 $new_string = $string . '____' . $current_date; 106 $encoded64 = base64_encode($new_string); 107 return $encoded64; 108 } 109 110 function wpus_decrypt($string){ 111 $decoded64 = base64_decode($string); 112 $current_date = current_datetime()->format('Y-m-d'); 113 $replaceable_str = '____' . $current_date; 114 $decoded_string = str_replace($replaceable_str, "", $decoded64); 115 return $decoded_string; 116 } -
wp-user-switch/trunk/readme.txt
r2826294 r2921182 2 2 Plugin Name: WP User Switch 3 3 Contributors: iqbalrony 4 Version: 1.0. 24 Version: 1.0.3 5 5 License: GPLv2 or later 6 6 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
wp-user-switch/trunk/wp-user-switch.php
r2826292 r2921182 5 5 * Author: IqbalRony 6 6 * Author URI: http://www.iqbalrony.com 7 * Version: 1.0. 27 * Version: 1.0.3 8 8 * License: GPLv2 or later 9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 45 45 } 46 46 /** 47 * Define cookiesHASH page slug 48 */ 49 if ( ! defined( 'WP_USERSWITCH_COOKIEHASH' ) ) { 50 $siteurl = get_site_option( 'siteurl' ); 51 if ( $siteurl ) { 52 define( 'WP_USERSWITCH_COOKIEHASH', md5( $siteurl ) ); 53 } else { 54 define( 'WP_USERSWITCH_COOKIEHASH', '' ); 55 } 56 } 57 58 if ( ! defined( 'WP_USERSWITCH_LOGGED_IN_COOKIE' ) ) { 59 define( 'WP_USERSWITCH_LOGGED_IN_COOKIE', 'wpus_switch_' . WP_USERSWITCH_COOKIEHASH ); 60 } 61 62 /** 47 63 * Hooks 48 64 */ … … 50 66 function wpus_element_load() { 51 67 load_plugin_textdomain('wp-user-switch', false, plugin_basename(dirname(__FILE__)) . '/languages/'); 52 require_once wpus_get_plugin_path( 'inc/ wp-user-switch.php' );53 $ WP_User_Switch = 'IqbalRony\WP_User_Switch\WP_User_Switch';54 $ WP_User_Switch::instance();68 require_once wpus_get_plugin_path( 'inc/user-switch.php' ); 69 $User_Switch = 'IqbalRony\WP_User_Switch\User_Switch'; 70 $User_Switch::instance(); 55 71 }
Note: See TracChangeset
for help on using the changeset viewer.