'."\n"; /**/ echo '
If your Membership offering allows access to restricted files, you\'ll want to configure these options.
Upload restricted files to this security-enabled directory:'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'
'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'
- Now, you can link to any protected file, using this special format: '.esc_html(site_url("/?s2member_file_download=example-file.zip")).' s2member_file_download = file, relative to the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory. In other words, just the file name.
'.esc_html(site_url("/?s2member_file_download=example-file.zip")).'
- Or, use: [s2File download="example-file.zip" /] ( easier Shortcode if you prefer ) Shortcode equivalent: [s2File /] produces the entire URL for you, easier.
[s2File download="example-file.zip" /]
[s2File /]
s2Member will allow access to these protected files, based on the configuration you specify below. Repeated downloads of the same exact file are NOT tabulated against the totals below. Once a file has been downloaded, future downloads of the same exact file, by the same exact Member will not be counted against them. In other words, if a Member downloads the same file three times, the system only counts that as one unique download. In addition, multiple variations of popular media formats are only counted once. This is because many site owners provide multiple download options to their Users/Members, for compatibility purposes. Files that have the same exact name, with one of these extensions, will only be counted ONE time: '.esc_html(implode(",", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"])).'.
'.esc_html(implode(",", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"])).'
s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain s2member_file_download or s2member-files. Whenever a logged-in Member clicks a link that contains s2member_file_download or s2member-files, the system will politely ask the user to confirm the download using a very intuitive JavaScript confirmation prompt, which contains specific details about your configured download limitations. This way your Members will be aware of how many files they\'ve downloaded in the current period; and they\'ll be able to make a conscious decision about whether to proceed with a specific download or not. If you want to suppress this JavaScript confirmation prompt, you can add this to the end of your links: &s2member_skip_confirmation. Shortcode alternative: [s2File skip_confirmation="yes" /].
s2member_file_download
s2member-files
&s2member_skip_confirmation
[s2File skip_confirmation="yes" /]
* The above only applies to Users who are logged in as Members. For all other visitors in the general public, the ?s2member_file_download links will redirect them your Membership Options Page, so that new visitors can signup, in order to gain access, by becoming a Member. You may also want to have a look down below at s2Member\'s "Advanced Download Restrictions", which provides a greater degree of flexibility.
?s2member_file_download
999999999
This Page will be shown when/if a Member reaches their download limit, based on your configuration of Basic Download Restrictions above. This Page should be created by you, in WordPress®. This Page should provide an informative message to the Member, describing your file access restrictions. Just tell them a little bit about your policy on file downloads, and why they might have reached this Page.
Download Limit Exceeded
By default, s2Member uses your Basic Download Restrictions, as configured above. However, you can force s2Member to allow File Downloads, using an extra query string parameter: &s2member_file_download_key=[Key]. A File Download `Key` is passed through this parameter; it tells s2Member to allow the download of this particular file, regardless of Membership Level; and WITHOUT checking any Basic Restrictions, that you may or may not have configured above. The creation of a File Download `Key`, requires a small PHP code snippet. In order to use PHP scripting inside your Posts/Pages, you\'ll need to install this handy plugin ( PHP Execution ). There is also a Shortcode equivalent, which does NOT require PHP at all, as seen below.
&s2member_file_download_key=[Key]
'.esc_html(site_url("/?s2member_file_download=example-file.zip")).'&s2member_file_download_key=<?php echo s2member_file_download_key("example-file.zip"); ?> s2member_file_download_key = <?php echo s2member_file_download_key("file, relative to the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory"); ?>
&s2member_file_download_key=<?php echo s2member_file_download_key("example-file.zip"); ?>
'.esc_html(site_url("/?s2member_file_download=example-file.zip")).'&s2member_file_download_key=[s2Key file_download="example-file.zip" /] Shortcode equivalent: [s2Key file_download="example-file.zip" /]
&s2member_file_download_key=[s2Key file_download="example-file.zip" /]
[s2Key file_download="example-file.zip" /]
[s2File download="example-file.zip" download_key="true" /] ( Key is auto-generated in this case ) Shortcode equivalent: [s2File /] produces the entire URL, no need to generate a Key yourself.
[s2File download="example-file.zip" download_key="true" /]
The function s2member_file_download_key(), is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces ( at the time it is produced ), will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let\'s take a quick look at what s2member_file_download_key() actually produces.
s2member_file_download_key()
s2member_file_download_key("example-file.zip") = a site-specific hash of: date("Y-m-d").$_SERVER["REMOTE_ADDR"].$_SERVER["HTTP_USER_AGENT"].$file
s2member_file_download_key("example-file.zip")
date("Y-m-d").$_SERVER["REMOTE_ADDR"].$_SERVER["HTTP_USER_AGENT"].$file
When s2member_file_download_key = a valid Key, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member\'s file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.
s2member_file_download_key = a valid Key
There are two ways to serve files. Inline, or as an Attachment. By default, s2Member will serve all of your protected files, as downloadable attachments. Meaning, visitors will be given a file download prompt. Otherwise known as Content-Disposition: attachment. In some cases though, you may wish to serve files inline. For example, PDF files and images should usually be served inline. When you serve a file inline, it is displayed in your browser immediately, rather than your browser prompting you to download the file as an attachment.
Content-Disposition: attachment
Using the field below, you can list all of the extensions that you want s2Member to serve inline ( ex: htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm ). Please understand, some files just cannot be displayed inline. For instance, there is no way to display an exe file inline. So only specify extensions that can, and should be displayed inline by a web browser. Alternatively, if you would rather handle this on a case-by-case basis, you can simply add the following to the end of your download links: &s2member_file_inline=yes. Shortcode alternative: [s2File download="example-file.zip" inline="yes" /].
htm,html,pdf,jpg,jpeg,jpe,gif,png,mp3,mp4,flv,ogg,webm
exe
&s2member_file_inline=yes
[s2File download="example-file.zip" inline="yes" /]
This can be enabled on a case-by-case basis. Just add this to the end of your download links: &s2member_file_remote=yes. Shortcode alternative: [s2File download="example-file.zip" remote="yes" /].
&s2member_file_remote=yes
[s2File download="example-file.zip" remote="yes" /]
Remote Header Authorization allows access to file downloads through an entirely different approach. Instead of asking the Member to log into your site through a browser, a Member will be prompted automatically, to log in through HTTP Header Authorization prompts; which is the same technique used in more traditional security systems via .htaccess files. In other words, Remote Header Authorization makes it possible for your Members to access files through remote applications that may NOT use a browser. This is often the case when a Member needs to access protected files through a software client like iTunes®; typical with podcasts. See tutorial here for details about how to setup a Podcast for iTunes®.
Please note, all of this is optional. s2Member can be configured here to ONLY use Amazon® S3 ( i.e. without Amazon® CloudFront ). Or, s2Member can be configured to use BOTH Amazon® S3 and Amazon® CloudFront together. If you want to use Amazon® S3 Storage, but you don\'t care about Amazon® CloudFront, feel free to leave the entire Amazon® CloudFront section empty. The configuration options in the Amazon® CloudFront section are ONLY required if you are planning to use both Amazon® S3 and Amazon® CloudFront together.
Amazon® Simple Storage Service ( Amazon® S3 ). Amazon® S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon® S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives developers access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon® uses to run its own global network of web sites. s2Member has been integrated with Amazon® S3, so that ( if you wish ), instead of using the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory, you can store all of your protected files inside an Amazon® S3 Bucket.
/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/
If you configure the options below, s2Member will assume all protected files are inside your Amazon® S3 Bucket; and the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Inline Extensions, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon® S3 Bucket as a CDN ( i.e. Content Delivery Network ) instead of the local /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory.
s2Member assumes that you\'re creating a new Amazon® S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser ( i.e. http://your-bucket-name.s3.amazonaws.com/ ), you should get an error that says: Access Denied. That\'s good, that\'s exactly what you want. You can create your Amazon® S3 Bucket using the Amazon® interface. Or, some people prefer to use this popular Firefox® extension ( S3 Fox Organizer ).
http://your-bucket-name.s3.amazonaws.com/
Access Denied
Dev Note w/Technical Details: s2Member uses "Query String Authentication", provided by the Amazon® S3 API. Documented for developers here. To put it simply, s2Member will generate S3 authenticated redirect URLs ( internally ); which allow Customers temporary access to specific files inside your S3 Bucket. s2Member\'s Query String Authentication through Amazon® S3 gives a Customer 30 seconds to connect to the file inside your S3 Bucket ( i.e. the automatic redirection URL ). This connection period of 30 seconds is largely irrelevant when used in combination with s2Member. It just needs to be a low value, to further prevent any possibility of S3 authenticated link sharing. If you need to change this connection timeout of 30 seconds for some reason ( not likely ), you can use this WordPress® Filter: ws_plugin__s2member_amazon_s3_file_expires_time. If you need help, please check the s2Member Forums.
30 seconds
ws_plugin__s2member_amazon_s3_file_expires_time
Linking To Protected Files: Nothing changes. s2Member\'s integration with Amazon® S3 serves protected files through the same links that all s2Member site owners use. For example, you might use: '.esc_html(site_url("/?s2member_file_download=example-file.zip")).', where s2member_file_download = the file, relative to the root of your Amazon® S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon® S3 URL, which allows them access to a particular file via Amazon® S3. For further details, please review this section of your Dashboard: s2Member -> Download Options -> Basic Download Restrictions. Also see: s2Member -> Download Options -> Advanced Mod-Rewrite Linkage.
s2Member -> Download Options -> Basic Download Restrictions
s2Member -> Download Options -> Advanced Mod-Rewrite Linkage
Content Type, Disposition & Inline Files: The query string parameter &s2member_file_inline=yes DOES work for files served directly through Amazon® S3. s2Member DOES have control over the Content-Type and Content-Disposition headers for files being served through Amazon® S3. However, Amazon® CloudFront servers do NOT automatically determine the MIME type for the objects they serve. If you integrate both Amazon® S3 and CloudFront, s2Member will NOT have control over headers. Therefore, when you upload a file to your Amazon® S3 Bucket, you should set its Content-Type header. Again, with the Amazon® S3/CloudFront combination, you MUST configure headers yourself ( such as Content-Type: video/webm, or Content-Disposition: inline|attachment ) that you want Amazon® CloudFront to send for a particular file. It\'s quite easy. You do this by setting Properties -> Metadata ( i.e. headers ) on a per-file basis, from inside your Amazon® S3 Management Console. In short, when you upload a file to your Amazon® S3 Bucket, if you want that file to be served a certain way, be sure to configure its Properties -> Metadata accordingly.
Content-Type
Content-Disposition
Content-Type: video/webm
Content-Disposition: inline|attachment
Properties -> Metadata ( i.e. headers )
Properties -> Metadata
Amazon® Web Services Account -> Security Credentials -> Access Credentials
Please note, all of this is optional. s2Member can be configured to ONLY use Amazon® S3 ( i.e. without Amazon® CloudFront ). Or, s2Member can be configured to use BOTH Amazon® S3 and Amazon® CloudFront together. If you don\'t want to use Amazon® CloudFront, please leave this entire section empty. The configuration options in this section are ONLY required if you are planning to use both Amazon® S3 and Amazon® CloudFront together.
Amazon® Simple Storage Service ( Amazon® S3 ) combined with Amazon® CloudFront. Amazon® CloudFront is a web service for content delivery. It integrates with other Amazon® Web Services ( i.e. Amazon® S3 Storage ) to give developers and businesses an easy way to distribute content to end users with low latency, and with high data transfer speeds. Amazon® CloudFront delivers your static and streaming content using a global network of edge locations. Requests for your Amazon® S3 Bucket Objects ( i.e. your protected files ) are automatically routed to the nearest edge location, so content is delivered with the best possible performance. s2Member has been integrated with both Amazon® S3 and with Amazon® CloudFront. So ( if you wish ), instead of using the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory, you can store all of your protected files inside an Amazon® S3 Bucket and serve them via Amazon® CloudFront. But again, please understand, the configuration options in this section are ONLY required if you\'re going to use both Amazon® S3 & CloudFront together.
One of the great things about Amazon® CloudFront, is its ability to stream/seek media files in the truest sense of the word. For sites delivering protected FLV/MP4/OGG/WEBM and other streaming audio/video file types over the RTMP protocol, Amazon® CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon® S3 and Amazon® CloudFront together, please review the section below regarding JW Player® & RTMP Protocol Examples. s2Member will automatically serve your protected files over the RTMP protocol using an Amazon® CloudFront Streaming Distribution.
JW Player® & RTMP Protocol Examples
If you configure the options below, s2Member will assume all protected files are inside your Amazon® S3 Bucket; and the /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon® S3 Bucket, automatically connecting it to both of the Amazon® CloudFront Distributions, which s2Member auto-configures for you ( see below ). In this way, s2Member uses Amazon® CloudFront as a CDN ( i.e. Content Delivery Network ) for your protected files.
s2Member assumes that you\'re creating a new Amazon® S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser ( i.e. http://your-bucket-name.s3.amazonaws.com/ ), you should get an error that says: Access Denied. That\'s good, that\'s exactly what you want. You can create your Amazon® S3 Bucket using the Amazon® interface. Or, some people prefer to use this popular Firefox® extension ( S3 Fox Organizer ). You will also need to enable CloudFront inside your Web Services account at Amazon®. Don\'t worry about creating or configuring any CloudFront Distributions, s2Member will auto-create and auto-configure those for you, allowing you to serve protected files.
Dev Note w/Technical Details: s2Member\'s auto-configuration routines for Amazon® CloudFront (below), are designed to create & configure various components on your Amazon® Web Services account, which are all requirements for you to serve protected files through the Amazon® S3/CloudFront combination. These components include: an Origin Access Identity, read permissions for the Origin Access Identity, and two private content Distributions. One private content Distribution for file downloads, and another private content Distribution for streaming media files; both connected to and sourced by your Amazon® S3 Bucket. In addition, s2Member will automatically configure an ACL & Policy ( i.e. permissions ) on your Amazon® S3 Bucket to make sure your protected object/files are NOT available to the public.
Linking To Protected Files: Streamed files are special, but nothing else changes. s2Member\'s integration with Amazon® S3/CloudFront serves protected files through the same links that all s2Member site owners use. For example, you might use: '.esc_html(site_url("/?s2member_file_download=example-file.zip")).', where s2member_file_download = the file, relative to the root of your Amazon® S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon® CloudFront URL, which allows them access to a particular file via Amazon® CloudFront. For further details, please review this section of your Dashboard: s2Member -> Download Options -> Basic Download Restrictions. Also see: s2Member -> Download Options -> Advanced Mod-Rewrite Linkage. For streaming audio/video files, please review the section below: JW Player® & RTMP Protocol Examples.
Content Type, Disposition & Inline Files: An IMPORTANT issue. The query string parameter &s2member_file_inline=yes does NOTHING for files served via Amazon® CloudFront. s2Member has NO control over the Content-Type and/or Content-Disposition headers for a file being served through Amazon® CloudFront, and CloudFront servers do NOT automatically determine the MIME type for the objects they serve. Therefore, when you upload a file to your Amazon® S3 Bucket, you should set its Content-Type header. That is, you MUST configure headers yourself ( such as Content-Type: video/webm, or Content-Disposition: inline|attachment ) that you want Amazon® CloudFront to send for a particular file. It\'s quite easy. You do this by setting Properties -> Metadata ( i.e. headers ) on a per-file basis, from inside your Amazon® S3 Management Console. In short, when you upload a file to your Amazon® S3 Bucket, if you want that file to be served a certain way, be sure to configure its Properties -> Metadata accordingly.
Localhost Developers: s2Member\'s Amazon® CloudFront integration requires the openssl_sign() function in PHP so it can digitially sign CloudFront® URLs. This function is sometimes problematic on localhost servers such as WAMP & EasyPHP. We recommend installing this lightweight alternative for Windows® while you\'re developing. s2Member will automatically find it here: C:\OpenSSL-Win[32/64]\bin\openssl.exe.'.((file_exists("c:\openssl-win32\bin\openssl.exe") || file_exists("c:\openssl-win64\bin\openssl.exe")) ? ' ( s2Member has detected that OpenSSL-Win[32/64] IS installed in the correct location, thank you! )' : ' ( s2Member has detected that OpenSSL-Win[32/64] is NOT currently available )').'
C:\OpenSSL-Win[32/64]\bin\openssl.exe
Your Amazon® CloudFront Distributions are: ( ALREADY configured! )'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) ? 'Downloads Distribution CNAME: '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]).' —» '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]).'' : '').(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) ? 'Streaming Distribution CNAME: '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]).' —» '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]).'' : '').'
'.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]).' —» '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]).'
'.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]).' —» '.esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]).'
Your Amazon® CloudFront Distributions are: ( NOT yet auto-configured ).
Amazon® Web Services Account -> Security Credentials -> Key Pairs
pk-[***].pem
s2-file-downloads.'.esc_html(c_ws_plugin__s2member_utils_urls::parse_url(site_url(), PHP_URL_HOST)).'
s2-streaming-files.'.esc_html(c_ws_plugin__s2member_utils_urls::parse_url(site_url(), PHP_URL_HOST)).'
While it is possible to serve audio/video files protected by s2Member, without needing to integrate Amazon® S3 or CloudFront; we DO highly recommend that you integrate both Amazon® S3 and Amazon® CloudFront in order to maximize speed and compatibility across various viewing platforms. That being said, there are code samples below that will serve audio/video files both with and without Amazon® S3/CloudFront. You can also check the s2Member Support Forums for tips/tricks if you like.
One of the great things about Amazon® CloudFront, is its ability to stream/seek media files in the truest sense of the word. For sites delivering protected FLV/MP4/OGG/WEBM and other streaming audio/video file types over the RTMP protocol, Amazon® CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon® S3 and Amazon® CloudFront together, please review the code samples below. s2Member can automatically serve your protected files over the RTMP protocol using an Amazon® CloudFront Streaming Distribution.
JW Player® ( MP4 file, via Rewrite URLs. Amazon® S3/CloudFront NOT required )
Download JW Player® here, and upload /jwplayer/ to your website\'s root directory.This does NOT require s2Member to be integrated with Amazon® S3/CloudFront.Also see: s2Member -> Download Options -> Advanced Mod Rewrite Linkage.'.c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__)."/code-samples/jwplayer-standard-mp4.x-php")).'
/jwplayer/
s2Member -> Download Options -> Advanced Mod Rewrite Linkage
JW Player® ( RTMP streaming MP4, via s2Member\'s Amazon® S3/CloudFront integration )
Download JW Player® here, and upload /jwplayer/ to your website\'s root directory.This requires s2Member to be integrated with Amazon® S3/CloudFront.Also see: s2Member Codex -> API Functions.'.c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__)."/code-samples/jwplayer-streaming-mp4.x-php")).'
JW Player® ( RTMP streaming MP4, via s2Member\'s JSON/Shortcode alternative )
Download JW Player® here, and upload /jwplayer/ to your website\'s root directory.This requires s2Member to be integrated with Amazon® S3/CloudFront.Also see: s2Member Codex -> API Functions.'.c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__)."/code-samples/jwplayer-streaming-mp4-sca.x-php")).'
JW Player® ( RTMP streaming MP4, advanced w/ multiple HTML5 fallbacks )
Download JW Player® here, and upload /jwplayer/ to your website\'s root directory.This requires s2Member to be integrated with Amazon® S3/CloudFront.Also see: s2Member Codex -> API Functions.'.c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__)."/code-samples/jwplayer-streaming-mp4-webm.x-php")).'
s2Member automatically creates mod_rewrite rules inside your /'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/ directory, which provide additional flexibility in the way protected files can be served to your Customers. With s2Member\'s mod_rewrite rules, it is now possible to link directly to a protected file, avoiding the use of query string variables ( it\'s completely optional though, i.e. NOT required ).
mod_rewrite
This new flexibility may come in handy for site owners serving files through media playback devices that have issues with query string variables. For instance, it is now possible to link to an s2Member-protected file directly, like this: ... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/example-file.zip instead of ... /?s2member_file_download=example-file.zip. Either way works, but the direct link might be easier for some.
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/example-file.zip
... /?s2member_file_download=example-file.zip
It is also possible to pass query string parameters through a direct link:... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/example-file.zip?s2member_file_inline=yes&s2member_file_download_key=[key].
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/example-file.zip?s2member_file_inline=yes&s2member_file_download_key=[key]
That being said, s2Member\'s mod_rewrite rules allow for more advanced control over s2Member-specific parameters.
For example, you could just do this for inline files:... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline/example-file.zip
Or, if you really want to get advanced, you could do something like this:... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-[yes|no]/s2member-file-download-key-[key]/example-file.zip... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-yes/s2member-file-download-key-xS54df5ER4d5x/example-file.zip... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-yes/s2member-skip-confirmation/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-[yes|no]/s2member-file-download-key-[key]/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-yes/s2member-file-download-key-xS54df5ER4d5x/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-inline-yes/s2member-skip-confirmation/example-file.zip
Or even this, if you\'re using Remote Header Authorization:... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-remote/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-remote/example-file.zip
Specifying storage location option dynamically:... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-[local|s3|cf]/example-file.zip... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-cf/example-cloudfront-file.zip... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-s3/s2member-file-inline/example-s3-file.html
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-[local|s3|cf]/example-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-cf/example-cloudfront-file.zip
... /wp-content/plugins/'.esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])).'/s2member-file-storage-s3/s2member-file-inline/example-s3-file.html
* Note, the order of your s2Member-specific parameters with Advanced Mod-Rewrite Linkage is irrelevant. Feel free to add/remove, or even change the order. Everything discussed here is also Multisite compatible. Everything discussed here is also compatible when/if combined with Amazon® S3/CDN Storage. However, NONE of this will work on servers that do NOT support mod_rewrite. Almost all web servers do though.
s2Member makes Shortcodes available to you, which allow you to generate File Download URLs and/or File Download Keys. Like most Shortcodes for WordPress®, s2Member reads Attributes in your Shortcode. Many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.
See also: API Function s2member_file_download_url() for PHP integration.
download="file.zip"
download_key="no"
no
download_key="1|on|yes|true|ip-forever|universal"
download_key="ip-forever"
download_key="universal"
stream="no"
stream="1|on|yes|true"
JW Player® and the RTMP Protocol
get_streamer_json="1|on|yes|true"
stream="true"
inline=""
[empty]
inline="1|on|yes|true"
Inline File Extensions
storage=""
storage="local|s3|cf"
storage="local"
remote="no"
remote="1|on|yes|true"
.htaccess
Remote Authorization and Podcasting
ssl=""
ssl="1|on|yes|true"
https://
rtmpe://
rewrite="no"
rewrite="1|on|yes|true"
rewrite_base=""
rewrite_base="'.esc_attr(site_url("/")).'"
rewrite_base
rewrite="yes"
skip_confirmation="no"
skip_confirmation="1|on|yes|true"
url_to_storage_source="no"
url_to_storage_source="1|on|yes|true"
url_to_storage_source="true"
check_user="true"
count_against_user="true"
http://
count_against_user="no"
count_against_user="1|on|yes|true"
check_user="no"
check_user="1|on|yes|true"
get_streamer_json="no"
get_streamer_json="true"
url_to_storage_source
[s2Key /]
See also: API Function s2member_file_download_key() for PHP integration.
file_download="file.zip"
directive=""
directive="ip-forever|universal"
directive="ip-forever"
directive="universal"
Protected files served by s2Member® through PHP scripts, are already compressed. Therefore, GZIP compression is not needed during protected file delivery. Some web servers (i.e. Apache, LiteSpeed, and similar) include GZIP compression rules through server-side extensions, like mod_deflate for example. While s2Member® encourages the use of extensions like mod_deflate, it is best to disable GZIP automatically (i.e. temporarily) during s2Member\'s delivery of a protected file through a PHP script. This avoids conflicts on the server which might otherwise lead to corrupted file downloads. s2Member® makes a valiant effort to accomplish this via PHP, all on its own. However, it never hurts to add this section of code to the root .htaccess file for your WordPress® installation. Optional, but highly recommended.
mod_deflate
s2Member® automatically adds this to your .htaccess file upon activation of the plugin.
The following mod_rewrite rule goes inside this file: '.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path(ABSPATH.".htaccess")).'
'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path(ABSPATH.".htaccess")).'
'.esc_html(trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_no_gzip_htaccess"])))).'
* Tip: this covers all types of integration with s2Member® File Downloads, even if you\'re using s2Member\'s Advanced Mod Rewrite Linkage.