本文整理汇总了PHP中c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep方法的具体用法?PHP c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep怎么用?PHP c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_strings
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urldecode_ur_chars_deep
/**
* Decodes unreserved chars encoded by PHP's ``urlencode()``, deeply.
*
* For further details regarding unreserved chars, see: {@link http://www.faqs.org/rfcs/rfc3986.html}.
*
* @package s2Member\Utilities
* @since 111017
*
* @see http://www.faqs.org/rfcs/rfc3986.html
*
* @param str|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
* @return str|array Either the input string, or the input array; after all unreserved chars are decoded properly.
*/
public static function urldecode_ur_chars_deep($value = array())
{
if (is_array($value)) {
foreach ($value as &$r) {
/* Reference. */
$r = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep($r);
}
return $value;
/* Return modified array. */
}
return str_replace(array("%2D", "%2E", "%5F", "%7E"), array("-", ".", "_", "~"), (string) $value);
}
示例2: amazon_cf_url
/**
* Creates an Amazon CloudFront RSA-SHA1 signature URL.
*
* @package s2Member\Files
* @since 110926
*
* @param string $file Input file path, to be signed by this routine.
* @param bool $stream Is this resource file to be served as streaming media?
* @param bool $inline Is this resource file to be served inline, or no?
* @param bool $ssl Is this resource file to be served via SSL, or no?
* @param string $basename The absolute basename of the resource file.
* @param string $mimetype The MIME content-type of the resource file.
*
* @return string An RSA-SHA1 signature URL for Amazon CloudFront.
*/
public static function amazon_cf_url($file = '', $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = '', $mimetype = '')
{
$file = trim((string) $file, '/');
// Trim & force string.
$url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
$url_e_file = str_ireplace('%2F', '/', $url_e_file);
foreach ($GLOBALS['WS_PLUGIN__']['s2member']['o'] as $option => $option_value) {
if (preg_match('/^amazon_cf_files_/', $option) && ($option = preg_replace('/^amazon_cf_files_/', '', $option))) {
$cfc[$option] = $option_value;
}
}
$cfc['expires'] = strtotime('+' . apply_filters('ws_plugin__s2member_amazon_cf_file_expires_time', '24 hours', get_defined_vars()));
$cf_extn = strtolower(substr($file, strrpos($file, '.') + 1));
// Parses the file extension out so we can scan it in some special scenarios.
$cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? FALSE : TRUE;
// Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon CloudFront sees.
$cf_stream_extn_resource_exclusions = array_unique((array) apply_filters('ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions', array('mp3'), get_defined_vars()));
// MP3 files should NOT include an extension in their resource reference.
$cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, '.')) : $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
$cf_url = $stream ? 'rtmp' . ($ssl ? 'e' : '') . '://' . ($cfc['distro_streaming_cname'] ? $cfc['distro_streaming_cname'] : $cfc['distro_streaming_dname']) . '/cfx/st/' . $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
$cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER['REMOTE_ADDR']) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc['expires'] . '}}}]}';
$cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
$cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array('+', '=', '/'), array('-', '_', '~'), FALSE);
$cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array('+', '=', '/'), array('-', '_', '~'), FALSE);
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array('Policy' => $cf_base64_url_safe_policy, 'Signature' => $cf_base64_url_safe_signature, 'Key-Pair-Id' => $cfc['private_key_id']))), $cf_url);
}
示例3: urldecode_ur_chars_deep
/**
* Decodes unreserved chars encoded by PHP's ``urlencode()``, deeply.
*
* For further details regarding unreserved chars, see: {@link http://www.faqs.org/rfcs/rfc3986.html}.
*
* @package s2Member\Utilities
* @since 111017
*
* @see http://www.faqs.org/rfcs/rfc3986.html
*
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
*
* @return string|array Either the input string, or the input array; after all unreserved chars are decoded properly.
*/
public static function urldecode_ur_chars_deep($value = array())
{
if (is_array($value)) {
foreach ($value as &$r) {
// Reference.
$r = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep($r);
}
return $value;
// Return modified array.
}
return str_replace(array('%2D', '%2E', '%5F', '%7E'), array('-', '.', '_', '~'), (string) $value);
}
示例4: amazon_cf_url
/**
* Creates an Amazon CloudFront RSA-SHA1 signature URL.
*
* @package s2Member\Files
* @since 110926
*
* @param str $file Input file path, to be signed by this routine.
* @param bool $stream Is this resource file to be served as streaming media?
* @param bool $inline Is this resource file to be served inline, or no?
* @param bool $ssl Is this resource file to be served via SSL, or no?
* @param str $basename The absolute basename of the resource file.
* @param str $mimetype The MIME content-type of the resource file.
* @return str An RSA-SHA1 signature URL for Amazon CloudFront.
*/
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
{
$file = trim((string) $file, "/");
$url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
$url_e_file = str_ireplace("%2F", "/", $url_e_file);
foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value) {
if (preg_match("/^amazon_cf_files_/", $option) && ($option = preg_replace("/^amazon_cf_files_/", "", $option))) {
$cfc[$option] = $option_value;
}
}
$cfc["expires"] = strtotime("+" . apply_filters("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars()));
$cf_extn = strtolower(substr($file, strrpos($file, ".") + 1));
$cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? false : true;
$cf_stream_extn_resource_exclusions = array_unique((array) apply_filters("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array("mp3"), get_defined_vars()));
$cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, ".")) : $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
$cf_url = $stream ? "rtmp" . ($ssl ? "e" : "") . "://" . ($cfc["distro_streaming_cname"] ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"]) . "/cfx/st/" . $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
$cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER["REMOTE_ADDR"]) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc["expires"] . '}}}]}';
$cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
$cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array("+", "=", "/"), array("-", "_", "~"), false);
$cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array("+", "=", "/"), array("-", "_", "~"), false);
return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"]))), $cf_url);
}