当前位置: 首页>>代码示例>>PHP>>正文


PHP c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage方法的具体用法?PHP c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage怎么用?PHP c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_utils_conds的用法示例。


在下文中一共展示了c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_file_download_access

 /**
  * Handles Download Access permissions.
  *
  * @package s2Member\Files
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  * @also-called-by API Function {@link s2Member\API_Functions\s2member_file_download_url()}, w/ ``$create_file_download_url`` param.
  *
  * @param array $create_file_download_url Optional. If this function is called directly, we can pass arguments through this array.
  * 	Possible array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
  * @return null|str If called directly with ``$create_file_download_url``, returns a string with the URL, based on configuration.
  * 	Else, this function may exit script execution after serving a File Download.
  */
 public static function check_file_download_access($create_file_download_url = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_file_download_access", get_defined_vars());
     unset($__refs, $__v);
     $_g = !empty($_GET) ? $_GET : array();
     $_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_g));
     $creating = is_array($create = $create_file_download_url) ? true : false;
     $serving = !$creating ? true : false;
     $serving_range = $range = false;
     if ($serving) {
         $range = (string) @$_SERVER["HTTP_RANGE"];
         if (!$range && function_exists("apache_request_headers")) {
             // Note: ``apache_request_headers()`` works in FastCGI too, starting w/ PHP v5.4.
             foreach ((array) apache_request_headers() as $_header => $_value) {
                 if (is_string($_header) && strcasecmp($_header, "range") === 0) {
                     $range = $_value;
                 }
             }
         }
         if ($range) {
             $serving_range = true;
         }
         unset($_header, $_value);
     }
     $req["file_download"] = $creating ? @$create["file_download"] : @$_g["s2member_file_download"];
     $req["file_download_key"] = $creating ? @$create["file_download_key"] : @$_g["s2member_file_download_key"];
     $req["file_stream"] = $creating ? @$create["file_stream"] : @$_g["s2member_file_stream"];
     $req["file_inline"] = $creating ? @$create["file_inline"] : @$_g["s2member_file_inline"];
     $req["file_storage"] = $creating ? @$create["file_storage"] : @$_g["s2member_file_storage"];
     $req["file_remote"] = $creating ? @$create["file_remote"] : @$_g["s2member_file_remote"];
     $req["file_ssl"] = $creating ? @$create["file_ssl"] : @$_g["s2member_file_ssl"];
     $req["file_rewrite"] = $creating ? @$create["file_rewrite"] : null;
     $req["file_rewrite_base"] = $creating ? @$create["file_rewrite_base"] : null;
     $req["skip_confirmation"] = $creating ? @$create["skip_confirmation"] : null;
     $req["url_to_storage_source"] = $creating ? @$create["url_to_storage_source"] : null;
     $req["count_against_user"] = $creating ? @$create["count_against_user"] : null;
     $req["check_user"] = $creating ? @$create["check_user"] : null;
     if ($req["file_download"] && is_string($req["file_download"]) && ($req["file_download"] = trim($req["file_download"], "/"))) {
         if (strpos($req["file_download"], "..") === false && strpos(basename($req["file_download"]), ".") !== 0) {
             $using_amazon_cf_storage = (!$req["file_storage"] || strcasecmp((string) $req["file_storage"], "cf") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage() ? true : false;
             $using_amazon_s3_storage = (!$req["file_storage"] || strcasecmp((string) $req["file_storage"], "s3") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage() ? true : false;
             $using_amazon_storage = $using_amazon_cf_storage || $using_amazon_s3_storage ? true : false;
             $excluded = apply_filters("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars());
             $valid_file_download_key = $req["file_download_key"] && is_string($req["file_download_key"]) && $creating && (!isset($req["check_user"]) || !filter_var($req["check_user"], FILTER_VALIDATE_BOOLEAN)) && (!isset($req["count_against_user"]) || !filter_var($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)) ? true : false;
             $valid_file_download_key = !$valid_file_download_key && $req["file_download_key"] && is_string($req["file_download_key"]) ? c_ws_plugin__s2member_files_in::check_file_download_key($req["file_download"], $req["file_download_key"]) : false;
             $checking_user = $excluded || $valid_file_download_key || $creating && (!isset($req["check_user"]) || !filter_var($req["check_user"], FILTER_VALIDATE_BOOLEAN)) && (!isset($req["count_against_user"]) || !filter_var($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)) ? false : true;
             $updating_user_counter = $serving_range || !$checking_user || $creating && (!isset($req["count_against_user"]) || !filter_var($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)) ? false : true;
             if (($serving || $creating) && $checking_user) {
                 if (!$using_amazon_storage && !file_exists($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"])) {
                     if ($serving) {
                         status_header(404);
                         header("Content-Type: text/html; charset=UTF-8");
                         while (@ob_end_clean()) {
                         }
                         // Clean any existing output buffers.
                         exit(_x('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', "s2member-front", "s2member"));
                     } else {
                         // Else return false.
                         return false;
                     }
                 } else {
                     if ($req["file_download_key"] && is_string($req["file_download_key"]) && !$valid_file_download_key) {
                         if ($serving) {
                             status_header(503);
                             header("Content-Type: text/html; charset=UTF-8");
                             while (@ob_end_clean()) {
                             }
                             // Clean any existing output buffers.
                             exit(_x('<strong>503 (Invalid Key):</strong> Sorry, your access to this file has expired. Please contact Support for assistance.', "s2member-front", "s2member"));
                         } else {
                             // Else return false.
                             return false;
                         }
                     } else {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_downloads_enabled_by_site_owner = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads()) === false) {
                             if ($serving) {
                                 if (!has_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization")) {
                                     add_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
                                 }
                             }
                             if ($creating) {
                                 if (has_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization")) {
                                     remove_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:files-in.inc.php

示例2: check_file_download_access

 /**
  * Handles Download Access permissions.
  *
  * @package s2Member\Files
  * @since 3.5
  *
  * @attaches-to ``add_action('init');``
  * @also-called-by API Function {@link s2Member\API_Functions\s2member_file_download_url()}, w/ ``$create_file_download_url`` param.
  *
  * @param null|array $create_file_download_url Optional. If this function is called directly, we can pass arguments through this array.
  *   Possible array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
  *
  * @return null|string If called directly with ``$create_file_download_url``, returns a string with the URL, based on configuration.
  *   Else, this function may exit script execution after serving a File Download.
  */
 public static function check_file_download_access($create_file_download_url = NULL)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_file_download_access', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $_g = !empty($_GET) ? $_GET : array();
     $_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_g));
     $creating = is_array($create = $create_file_download_url) ? TRUE : FALSE;
     // Creating URL?
     $serving = !$creating ? TRUE : FALSE;
     // If NOT creating a File Download URL, we're serving one.
     $serving_range = $range = FALSE;
     // Default values (so these variables DO get defined at all times).
     if ($serving) {
         $range = (string) @$_SERVER['HTTP_RANGE'];
         if (!$range && function_exists('apache_request_headers')) {
             foreach ((array) apache_request_headers() as $_header => $_value) {
                 // Note: ``apache_request_headers()`` works in FastCGI too, starting w/ PHP v5.4.
                 if (is_string($_header) && strcasecmp($_header, 'range') === 0) {
                     $range = $_value;
                 }
             }
         }
         unset($_header, $_value);
         // Housekeeping.
         if ($range) {
             $serving_range = TRUE;
         }
     }
     $req['file_download'] = $creating ? @$create['file_download'] : @$_g['s2member_file_download'];
     $req['file_download_key'] = $creating ? @$create['file_download_key'] : @$_g['s2member_file_download_key'];
     $req['file_stream'] = $creating ? @$create['file_stream'] : @$_g['s2member_file_stream'];
     $req['file_inline'] = $creating ? @$create['file_inline'] : @$_g['s2member_file_inline'];
     $req['file_storage'] = $creating ? @$create['file_storage'] : @$_g['s2member_file_storage'];
     $req['file_remote'] = $creating ? @$create['file_remote'] : @$_g['s2member_file_remote'];
     $req['file_ssl'] = $creating ? @$create['file_ssl'] : @$_g['s2member_file_ssl'];
     $req['file_rewrite'] = $creating ? @$create['file_rewrite'] : NULL;
     $req['file_rewrite_base'] = $creating ? @$create['file_rewrite_base'] : NULL;
     $req['skip_confirmation'] = $creating ? @$create['skip_confirmation'] : NULL;
     $req['url_to_storage_source'] = $creating ? @$create['url_to_storage_source'] : NULL;
     $req['count_against_user'] = $creating ? @$create['count_against_user'] : NULL;
     $req['check_user'] = $creating ? @$create['check_user'] : NULL;
     if ($req['file_download'] && is_string($req['file_download']) && ($req['file_download'] = trim($req['file_download'], '/'))) {
         if (strpos($req['file_download'], '..') === FALSE && strpos(basename($req['file_download']), '.') !== 0) {
             $using_amazon_cf_storage = (!$req['file_storage'] || strcasecmp((string) $req['file_storage'], 'cf') === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage() ? TRUE : FALSE;
             $using_amazon_s3_storage = (!$req['file_storage'] || strcasecmp((string) $req['file_storage'], 's3') === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage() ? TRUE : FALSE;
             $using_amazon_storage = $using_amazon_cf_storage || $using_amazon_s3_storage ? TRUE : FALSE;
             $excluded = apply_filters('ws_plugin__s2member_check_file_download_access_excluded', FALSE, get_defined_vars());
             $valid_file_download_key = $req['file_download_key'] && is_string($req['file_download_key']) && $creating && (!isset($req['check_user']) || !filter_var($req['check_user'], FILTER_VALIDATE_BOOLEAN)) && (!isset($req['count_against_user']) || !filter_var($req['count_against_user'], FILTER_VALIDATE_BOOLEAN)) ? TRUE : FALSE;
             $valid_file_download_key = !$valid_file_download_key && $req['file_download_key'] && is_string($req['file_download_key']) ? c_ws_plugin__s2member_files_in::check_file_download_key($req['file_download'], $req['file_download_key']) : FALSE;
             $checking_user = $excluded || $valid_file_download_key || $creating && (!isset($req['check_user']) || !filter_var($req['check_user'], FILTER_VALIDATE_BOOLEAN)) && (!isset($req['count_against_user']) || !filter_var($req['count_against_user'], FILTER_VALIDATE_BOOLEAN)) ? FALSE : TRUE;
             $updating_user_counter = $serving_range || !$checking_user || $creating && (!isset($req['count_against_user']) || !filter_var($req['count_against_user'], FILTER_VALIDATE_BOOLEAN)) ? FALSE : TRUE;
             if (($serving || $creating) && $checking_user) {
                 if (!$using_amazon_storage && !file_exists($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'] . '/' . $req['file_download'])) {
                     if ($serving) {
                         status_header(404);
                         header('Content-Type: text/html; charset=UTF-8');
                         while (@ob_end_clean()) {
                         }
                         // Clean any existing output buffers.
                         exit(_x('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', 's2member-front', 's2member'));
                     }
                     return FALSE;
                     // Else return false.
                 } else {
                     if ($req['file_download_key'] && is_string($req['file_download_key']) && !$valid_file_download_key) {
                         if ($serving) {
                             status_header(503);
                             header('Content-Type: text/html; charset=UTF-8');
                             while (@ob_end_clean()) {
                             }
                             // Clean any existing output buffers.
                             exit(_x('<strong>503 (Invalid Key):</strong> Sorry, your access to this file has expired. Please contact Support for assistance.', 's2member-front', 's2member'));
                         }
                         return FALSE;
                         // Else return false.
                     } else {
                         if ($serving) {
                             // We only need remote functionality when/if we're actually serving.
                             if (!has_filter('ws_plugin__s2member_check_file_download_access_user', 'c_ws_plugin__s2member_files_in::check_file_remote_authorization')) {
                                 add_filter('ws_plugin__s2member_check_file_download_access_user', 'c_ws_plugin__s2member_files_in::check_file_remote_authorization', 10, 2);
                             }
//.........这里部分代码省略.........
开发者ID:adnandot,项目名称:intenseburn,代码行数:101,代码来源:files-in.inc.php

示例3: check_file_download_access

 /**
  * Handles Download Access permissions.
  *
  * @package s2Member\Files
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  * @also-called-by API Function {@link s2Member\API_Functions\s2member_file_download_url()}, w/ ``$create_file_download_url`` param.
  *
  * @param array $create_file_download_url Optional. If this function is called directly, we can pass arguments through this array.
  * 	Possible array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
  * @return null|str If called directly with ``$create_file_download_url``, returns a string with the URL, based on configuration.
  * 	Else, this function may exit script execution after serving a File Download.
  */
 public static function check_file_download_access($create_file_download_url = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_file_download_access", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $_g = !empty($_GET) ? $_GET : array();
     $_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_g));
     /**/
     $creating = is_array($create = $create_file_download_url) ? true : false;
     $serving = !$creating ? true : false;
     /**/
     $req["file_download"] = $creating ? @$create["file_download"] : @$_g["s2member_file_download"];
     $req["file_download_key"] = $creating ? @$create["file_download_key"] : @$_g["s2member_file_download_key"];
     /**/
     $req["file_stream"] = $creating ? @$create["file_stream"] : @$_g["s2member_file_stream"];
     $req["file_inline"] = $creating ? @$create["file_inline"] : @$_g["s2member_file_inline"];
     $req["file_storage"] = $creating ? @$create["file_storage"] : @$_g["s2member_file_storage"];
     $req["file_remote"] = $creating ? @$create["file_remote"] : @$_g["s2member_file_remote"];
     $req["file_ssl"] = $creating ? @$create["file_ssl"] : @$_g["s2member_file_ssl"];
     /**/
     $req["file_rewrite"] = $creating ? @$create["file_rewrite"] : null;
     $req["file_rewrite_base"] = $creating ? @$create["file_rewrite_base"] : null;
     /**/
     $req["skip_confirmation"] = $creating ? @$create["skip_confirmation"] : null;
     $req["url_to_storage_source"] = $creating ? @$create["url_to_storage_source"] : null;
     $req["count_against_user"] = $creating ? @$create["count_against_user"] : null;
     $req["check_user"] = $creating ? @$create["check_user"] : null;
     /**/
     if ($req["file_download"] && is_string($req["file_download"]) && ($req["file_download"] = trim($req["file_download"], "/"))) {
         if (strpos($req["file_download"], "..") === false && strpos(basename($req["file_download"]), ".") !== 0) {
             $using_amazon_s3_storage = (!$req["file_storage"] || strcasecmp((string) $req["file_storage"], "s3") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage() ? true : false;
             $using_amazon_cf_storage = (!$req["file_storage"] || strcasecmp((string) $req["file_storage"], "cf") === 0) && c_ws_plugin__s2member_utils_conds::using_amazon_cf_storage() ? true : false;
             $using_amazon_storage = $using_amazon_s3_storage || $using_amazon_cf_storage ? true : false;
             /**/
             $excluded = apply_filters("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars());
             $valid_file_download_key = $req["file_download_key"] && is_string($req["file_download_key"]) ? c_ws_plugin__s2member_files_in::check_file_download_key($req["file_download"], $req["file_download_key"]) : false;
             $checking_user = $excluded || $valid_file_download_key || $creating && (!isset($req["check_user"]) || !filter_var($req["check_user"], FILTER_VALIDATE_BOOLEAN)) && (!isset($req["count_against_user"]) || !filter_var($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)) ? false : true;
             $updating_user_counter = !$checking_user || $creating && (!isset($req["count_against_user"]) || !filter_var($req["count_against_user"], FILTER_VALIDATE_BOOLEAN)) ? false : true;
             /**/
             if (($serving || $creating) && $checking_user) {
                 if (!$using_amazon_storage && !file_exists($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"])) {
                     if ($serving) {
                         status_header(404) . header("Content-Type: text/html; charset=utf-8") . eval('while (@ob_end_clean ());') . exit(_x('<strong>404: Sorry, file not found.</strong> Please contact Support for assistance.', "s2member-front", "s2member"));
                     } else {
                         /* Else return false. */
                         return false;
                     }
                 } else {
                     if ($req["file_download_key"] && is_string($req["file_download_key"]) && !$valid_file_download_key) {
                         if ($serving) {
                             status_header(503) . header("Content-Type: text/html; charset=utf-8") . eval('while (@ob_end_clean ());') . exit(_x('<strong>503 ( Invalid Key ):</strong> Sorry, your access to this file has expired. Please contact Support for assistance.', "s2member-front", "s2member"));
                         } else {
                             /* Else return false. */
                             return false;
                         }
                     } else {
                         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] || ($file_downloads_enabled_by_site_owner = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads()) === false) {
                             if ($serving) {
                                 if (!has_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization")) {
                                     add_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
                                 }
                             }
                             /**/
                             if ($creating) {
                                 if (has_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization")) {
                                     remove_filter("ws_plugin__s2member_check_file_download_access_user", "c_ws_plugin__s2member_files_in::check_file_remote_authorization", 10, 2);
                                 }
                             }
                             /**/
                             if (isset($file_downloads_enabled_by_site_owner, $min_level_4_downloads) && $file_downloads_enabled_by_site_owner === false || ($file_downloads_enabled_by_site_owner = $min_level_4_downloads = c_ws_plugin__s2member_files::min_level_4_downloads()) === false) {
                                 if ($serving) {
                                     status_header(503) . header("Content-Type: text/html; charset=utf-8") . eval('while (@ob_end_clean ());') . exit(_x('<strong>503: Basic File Downloads are NOT enabled yet.</strong> Please contact Support for assistance. If you are the site owner, please configure: <code>s2Member -> Download Options -> Basic Download Restrictions</code>.', "s2member-front", "s2member"));
                                 } else {
                                     /* Else return false. */
                                     return false;
                                 }
                             } else {
                                 if (!is_object($user = apply_filters("ws_plugin__s2member_check_file_download_access_user", is_user_logged_in() ? wp_get_current_user() : false, get_defined_vars())) || empty($user->ID) || !($user_id = $user->ID) || !is_array($user_file_downloads = c_ws_plugin__s2member_files::user_downloads($user)) || !$user->has_cap("administrator") && (!$user_file_downloads["allowed"] || !$user_file_downloads["allowed_days"])) {
                                     if (preg_match("/^access[_\\-]s2member[_\\-]level([0-9]+)\\//", $req["file_download"], $m) && strlen($req_level = $m[1]) && (!is_object($user) || empty($user->ID) || !$user->has_cap("access_s2member_level" . $req_level))) {
                                         if ($serving) {
                                             c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("file", $req["file_download"], "level", $req_level, $_SERVER["REQUEST_URI"]) . exit;
                                         } else {
                                             /* Else return false. */
                                             return false;
//.........这里部分代码省略.........
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:101,代码来源:files-in.inc.php


注:本文中的c_ws_plugin__s2member_utils_conds::using_amazon_s3_storage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。