當前位置: 首頁>>代碼示例>>PHP>>正文


PHP c_ws_plugin__s2member_utils_strings::base64_url_safe_decode方法代碼示例

本文整理匯總了PHP中c_ws_plugin__s2member_utils_strings::base64_url_safe_decode方法的典型用法代碼示例。如果您正苦於以下問題:PHP c_ws_plugin__s2member_utils_strings::base64_url_safe_decode方法的具體用法?PHP c_ws_plugin__s2member_utils_strings::base64_url_safe_decode怎麽用?PHP c_ws_plugin__s2member_utils_strings::base64_url_safe_decode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在c_ws_plugin__s2member_utils_strings的用法示例。


在下文中一共展示了c_ws_plugin__s2member_utils_strings::base64_url_safe_decode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: xdecrypt

 /**
  * XOR two-way encryption/decryption, with a base64 wrapper.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param str $base64 A string of data to decrypt. Should still be base64 encoded.
  * @param str $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  * @return str Decrypted string.
  */
 public static function xdecrypt($base64 = FALSE, $key = FALSE)
 {
     $base64 = is_string($base64) ? $base64 : "";
     $e = strlen($base64) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode($base64) : "";
     if (strlen($e) && preg_match("/^~xe(?:\\:([a-zA-Z0-9]+))?\\|(.*?)\$/s", $e, $md5_e)) {
         $key = c_ws_plugin__s2member_utils_encryption::key($key);
         if (strlen($md5_e[2]) && (!$md5_e[1] || $md5_e[1] === md5($md5_e[2]))) {
             for ($i = 1, $d = ""; $i <= strlen($md5_e[2]); $i++) {
                 $char = substr($md5_e[2], $i - 1, 1);
                 $keychar = substr($key, $i % strlen($key) - 1, 1);
                 $d .= chr(ord($char) - ord($keychar));
             }
         }
         if (isset($d) && is_string($d) && strlen($d)) {
             if (strlen($d = preg_replace("/^~xe\\|/", "", $d, 1, $xe)) && $xe) {
                 $d = $d;
             } else {
                 // Else we need to empty this out.
                 $d = "";
             }
         }
         return isset($d) && is_string($d) && strlen($d) ? $string = $d : "";
     } else {
         // Otherwise we must fail here with an empty string value.
         return "";
     }
 }
開發者ID:donwea,項目名稱:nhap.org,代碼行數:37,代碼來源:utils-encryption.inc.php

示例2: xdecrypt

 /**
  * XOR two-way encryption/decryption, with a base64 wrapper.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string $base64 A string of data to decrypt. Should still be base64 encoded.
  * @param string $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
  *
  * @return string Decrypted string.
  */
 public static function xdecrypt($base64 = '', $key = '')
 {
     $base64 = is_string($base64) ? $base64 : '';
     $e = isset($base64[0]) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode($base64) : '';
     if (isset($e[0]) && preg_match('/^~xe(?:\\:([a-zA-Z0-9]+))?\\|(.*)$/s', $e, $md5_e)) {
         $key = c_ws_plugin__s2member_utils_encryption::key($key);
         if (isset($md5_e[2][0]) && (empty($md5_e[1]) || $md5_e[1] === md5($md5_e[2]))) {
             for ($i = 1, $d = ''; $i <= strlen($md5_e[2]); $i++) {
                 $char = substr($md5_e[2], $i - 1, 1);
                 $keychar = substr($key, $i % strlen($key) - 1, 1);
                 $d .= chr(ord($char) - ord($keychar));
             }
         }
         if (isset($d) && is_string($d) && isset($d[0])) {
             if (!strlen($d = preg_replace('/^~xe\\|/', '', $d, 1, $xe)) || !$xe) {
                 $d = '';
             }
         }
         // Force empty string; bad decryption.
         return isset($d) && is_string($d) && isset($d[0]) ? $string = $d : '';
         // Default to empty string.
     }
     return '';
     // Default to empty string.
 }
開發者ID:adnandot,項目名稱:intenseburn,代碼行數:36,代碼來源:utils-encryption.inc.php


注:本文中的c_ws_plugin__s2member_utils_strings::base64_url_safe_decode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。