本文整理汇总了PHP中c_ws_plugin__s2member_utils_dirs::basename_dir_app_data方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_dirs::basename_dir_app_data方法的具体用法?PHP c_ws_plugin__s2member_utils_dirs::basename_dir_app_data怎么用?PHP c_ws_plugin__s2member_utils_dirs::basename_dir_app_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_dirs
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_dirs::basename_dir_app_data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
echo '<div class="wrap ws-menu-page">' . "\n";
echo '<div class="ws-menu-page-toolbox">' . "\n";
c_ws_plugin__s2member_menu_pages_tb::display();
echo '</div>' . "\n";
echo '<h2>Download Options</h2>' . "\n";
echo '<table class="ws-menu-page-table">' . "\n";
echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
echo '<tr class="ws-menu-page-table-tr">' . "\n";
echo '<td class="ws-menu-page-table-l">' . "\n";
echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form">' . "\n";
echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-options-save")) . '" />' . "\n";
echo '<input type="hidden" name="ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" id="ws-plugin--s2member-amazon-cf-files-distros-auto-config-status" value="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"]) . '" />' . "\n";
echo '<input type="hidden" name="ws_plugin__s2member_configured" id="ws-plugin--s2member-configured" value="1" />' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_before_left_sections", get_defined_vars());
if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_restrictions", true, get_defined_vars())) {
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_restrictions", get_defined_vars());
echo '<div class="ws-menu-page-group" title="Basic Download Restrictions">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
echo '<h3>File Download Restrictions (required, if providing access to protected files)</h3>' . "\n";
echo '<p>If your Membership offering allows access to restricted files, you\'ll want to configure these options.</p>' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_restrictions", get_defined_vars());
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p><strong>Upload restricted files to this security-enabled directory:</strong><br /><code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code></p>' . "\n";
echo '<p>- Now, you can link to any protected file, using this special format:<br /> <code>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '</code><br /> <small><em><strong>s2member_file_download</strong> = 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.</em></small></p>' . "\n";
echo '<p>- Or, use: <code>[s2File download="example-file.zip" /]</code> <em>(easier Shortcode if you prefer)</em><br /> <small><em><strong>Shortcode equivalent:</strong> <code>[s2File /]</code> produces the entire URL for you, easier.</em></small></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p>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: <code>' . esc_html(implode(",", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["streaming_file_extns"])) . '</code>.</p>' . "\n";
echo '<p>s2Member will automatically detect links, anywhere in your content, and/or anywhere in your theme files, that contain <code>s2member_file_download</code> or <code>s2member-files</code>. Whenever a logged-in Member clicks a link that contains <code>s2member_file_download</code> or <code>s2member-files</code>, 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: <code>&s2member_skip_confirmation</code>. Shortcode alternative: <code>[s2File skip_confirmation="yes" /]</code>.</p>' . "\n";
echo '<p><em>* The above only applies to Users who are logged in as Members. For all other visitors in the general public, the <code>?s2member_file_download</code> 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.</em></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<table class="form-table" style="margin-top:0;">' . "\n";
echo '<tbody>' . "\n";
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
echo '<tr>' . "\n";
echo '<th style="padding-top:0;">' . "\n";
echo '<label for="ws-plugin--s2member-level' . $n . '-file-downloads-allowed">' . "\n";
echo $n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? 'File Downloads ( Highest Level #' . $n . ' ):' . "\n" : 'File Downloads (Level #' . $n . ' Or Higher):' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<input type="text" maxlength="9" autocomplete="off" name="ws_plugin__s2member_level' . $n . '_file_downloads_allowed" id="ws-plugin--s2member-level' . $n . '-file-downloads-allowed" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"]) . '" style="width:200px;" /> every <input type="text" maxlength="3" autocomplete="off" name="ws_plugin__s2member_level' . $n . '_file_downloads_allowed_days" id="ws-plugin--s2member-level' . $n . '-file-downloads-allowed-days" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"]) . '" style="width:200px;" onkeyup="if(this.value > 365){ alert(\'(365 days is the maximum).\\nThis keeps the logs optimized.\'); this.value = 365; }" /> day(s).<br />' . "\n";
echo 'Only this many unique downloads will be permitted every X day(s), at ' . ($n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? 'highest Level #' . $n : 'Level #' . $n . ' or higher') . '.<br />' . "\n";
echo '<em>* To allow UNLIMITED downloads, use: <code>999999999</code> (i.e. <code>999999999</code> = unlimited).</em>' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo $n < $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] ? '<tr><td><div class="ws-menu-page-hr" style="margin:10px 0 10px 0;"></div></td></tr>' : '';
}
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_restrictions", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_limit_exceeded_page", true, get_defined_vars())) {
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_limit_exceeded_page", get_defined_vars());
echo '<div class="ws-menu-page-group" title="Download Limit Exceeded Page">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-limit-exceeded-page-section">' . "\n";
echo '<h3>Download Limit Exceeded Page (required, if providing access to protected files)</h3>' . "\n";
echo '<p>This Page will be shown when/if a Member reaches their download limit, based on your configuration of <strong>Basic Download Restrictions</strong> 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.</p>' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_limit_exceeded_page", get_defined_vars());
echo '<table class="form-table">' . "\n";
echo '<tbody>' . "\n";
echo '<tr>' . "\n";
echo '<th>' . "\n";
echo '<label for="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
echo 'Download Limit Exceeded Page:' . "\n";
echo '</label>' . "\n";
echo '</th>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<select name="ws_plugin__s2member_file_download_limit_exceeded_page" id="ws-plugin--s2member-file-download-limit-exceeded-page">' . "\n";
echo '<option value="">— Select —</option>' . "\n";
foreach ($ws_plugin__s2member_temp_a = array_merge((array) get_pages()) as $ws_plugin__s2member_temp_o) {
echo '<option value="' . esc_attr($ws_plugin__s2member_temp_o->ID) . '"' . ($ws_plugin__s2member_temp_o->ID == $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] ? ' selected="selected"' : '') . '>' . esc_html($ws_plugin__s2member_temp_o->post_title) . '</option>' . "\n";
}
echo '</select><br />' . "\n";
echo 'We recommend the following title: <code>Download Limit Exceeded</code>.' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</tbody>' . "\n";
echo '</table>' . "\n";
echo '</div>' . "\n";
echo '</div>' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_limit_exceeded_page", get_defined_vars());
}
if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_advanced_restrictions", true, get_defined_vars())) {
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_advanced_restrictions", get_defined_vars());
echo '<div class="ws-menu-page-group" title="Advanced Download Restrictions">' . "\n";
echo '<div class="ws-menu-page-section ws-plugin--s2member-restrictions-section">' . "\n";
echo '<h3>Advanced Download Restrictions (optional, for greater flexibility)</h3>' . "\n";
echo '<p>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: <code>&s2member_file_download_key=[Key]</code>. 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 (<a href="http://wordpress.org/extend/plugins/ezphp/" target="_blank" rel="external">ezPHP</a>). There is also a Shortcode equivalent, which does NOT require PHP at all, as seen below.</p>' . "\n";
do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_advanced_restrictions", get_defined_vars());
echo '<div class="ws-menu-page-hr"></div>' . "\n";
echo '<p>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '<code>&s2member_file_download_key=<?php echo s2member_file_download_key("example-file.zip"); ?></code><br /> <small><em><strong>s2member_file_download_key</strong> = <?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"); ?></em></small></p>' . "\n";
echo '<div class="ws-menu-page-hr"></div>' . "\n";
//.........这里部分代码省略.........
示例2: __construct
//.........这里部分代码省略.........
echo '<p><strong>*New*</strong> Starting with s2Member v3.2+, you can now tell s2Member to require certain Custom Capabilities on a per Post/Page basis. So now, s2Member <em>( if you prefer )</em> CAN handle Custom Capabilities for you automatically! Whenever you edit a Post/Page, you can tell s2Member <em>( i.e. there is a Meta Box for s2Member in your Post/Page editing station )</em>... you can tell s2Member to require certain Custom Capabilities that you type in, using comma-delimited format. In other words, you will need to type in some of the trigger words that you used whenever you created your Payment Buttons/Forms. This way paying Members will have the Custom Capabilities to view different kinds of content that you offer.</p>' . "\n";
echo '<p><strong>*New*</strong> By default, a Checkout Button or Form generated by s2Member is designed to (Add) Custom Capabilities to any that may or may not already exist for a particular User/Member. However, starting with s2Member v110815+, you can tell s2Member to (Remove All) Custom Capabilities, and then (Add) only the new ones that you specify. This is accomplished on a per Form/Button basis by preceding your comma-delimited list of Custom Capabilities with `-all`. For further details on this topic, click the <a href="#" onclick="alert(\'*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> icon next to the Custom Capabilities field in any Button/Form Generator supplied by s2Member.</p>' . "\n";
echo '<p><strong>*New*</strong> Independent Custom Capabilities. You can now sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>( i.e. you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like )</em>. So this is quite flexible. For further details, please check your Dashboard, under: <code>s2Member -> PayPal® Buttons -> Capability (Buy Now) Buttons</code>.</p>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_during_custom_capabilities", get_defined_vars());
/**/
echo '<div class="ws-menu-page-hr"></div>' . "\n";
/**/
echo '<p><strong>TIP:</strong> In addition to this documentation, you may also want to have a look at the <a href="http://www.primothemes.com/forums/viewforum.php?f=40" target="_blank" rel="external">s2Member Codex</a>.<br />' . "\n";
echo '<strong>See Also:</strong> <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12450" target="_blank" rel="external">s2Member Codex -> API Constants</a>, and <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12455" target="_blank" rel="external">s2Member Codex -> API Functions</a>.<br />' . "\n";
echo '<strong>See Also:</strong> <a href="http://wordpress.org/extend/plugins/user-role-editor/" target="_blank" rel="external">Plugins -> User Role Editor</a> <em>( may come in handy for some )</em>.</p>' . "\n";
/**/
echo '<div class="ws-menu-page-hr"></div>' . "\n";
/**/
echo '<p><strong>Custom Capabilities:</strong> ( music,videos ):</p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/current-user-can-ccaps-1.x-php")) . '</p>' . "\n";
/**/
echo '<p><strong>Custom Capabilities:</strong> ( ebooks,reports,tips ):</p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/current-user-can-ccaps-2.x-php")) . '</p>' . "\n";
echo '</div>' . "\n";
/**/
echo '</div>' . "\n";
/**/
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_after_custom_capabilities", get_defined_vars());
}
/**/
if (apply_filters("ws_plugin__s2member_during_scripting_page_during_left_sections_display_custom_capability_files", !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site(), get_defined_vars())) {
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_before_custom_capability_files", get_defined_vars());
/**/
echo '<div class="ws-menu-page-group" title="Custom Capability & Member Level Files">' . "\n";
/**/
echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-capability-files-section">' . "\n";
echo '<h3>Restricting Files, Based On Custom Capabilities</h3>' . "\n";
echo '<p>If you\'re NOT familiar with Custom Capabilities yet, please read the section above, titled: `Custom Capability Packages`, and also see: `s2Member -> Download Options`, both as primers; BEFORE you read this section. Once you understand the basic concept of Custom Capabilities & Protected File Downloads, you\'ll see that ( by default ) s2Member does NOT handle File Download Protection with respect to Custom Capabilities. That\'s where Custom Capability Sub-directories come in.</p>' . "\n";
echo '<p>You can create Custom Capability Sub-directories under: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '</code>. For instance, if you have a Custom Capability <code>music</code>, you can place protected files that should ONLY be accessible to Members with <code>access_s2member_ccap_music</code>, inside: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/</code>. Some examples are provided below.</p>' . "\n";
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_during_custom_capability_files", get_defined_vars());
/**/
echo '<div class="ws-menu-page-hr"></div>' . "\n";
/**/
echo '<p><strong>TIP:</strong> In addition to this documentation, you may also want to have a look at the <a href="http://www.primothemes.com/forums/viewforum.php?f=40" target="_blank" rel="external">s2Member Codex</a>.<br />' . "\n";
echo '<strong>See Also:</strong> <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12450" target="_blank" rel="external">s2Member Codex -> API Constants</a>, and <a href="http://www.primothemes.com/forums/viewtopic.php?f=40&t=12455" target="_blank" rel="external">s2Member Codex -> API Functions</a>.</p>' . "\n";
/**/
echo '<div class="ws-menu-page-hr"></div>' . "\n";
/**/
echo '<p><strong>Custom Capabilities:</strong> ( music,videos )</p>' . "\n";
echo '<p>Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos</code></p>' . "\n";
echo '<p>Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-music/file.mp3</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-ccap-videos/file.avi</code></p>' . "\n";
echo '<p>Now, here are some link examples, using Custom Capability Sub-directories:</p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/ccap-file-downloads.x-php")) . '</p>' . "\n";
echo '<p><em>These links will ONLY work for Members who are logged-in, with the proper Capabilities.</em></p>' . "\n";
/**/
echo '<div class="ws-menu-page-hr"></div>' . "\n";
/**/
echo '<p><strong>Membership Levels:</strong> ( this also works fine )</p>' . "\n";
echo '<p>Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3</code><br />Sub-Directory: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4</code></p>' . "\n";
echo '<p>Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level0/tiger.doc</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level1/zebra.pdf</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level2/elephant.doc</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level3/rhino.pdf</code><br />Protected File: <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/access-s2member-level4/lion.doc</code></p>' . "\n";
echo '<p>Now, here are some link examples, using Member Level Sub-directories:</p>' . "\n";
echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(file_get_contents(dirname(__FILE__) . "/code-samples/level-file-downloads.x-php")) . '</p>' . "\n";
echo '<p><em>These links will ONLY work for Members who are logged-in, with an adequate Membership Level.</em></p>' . "\n";
echo '</div>' . "\n";
/**/
echo '</div>' . "\n";
/**/
do_action("ws_plugin__s2member_during_scripting_page_during_left_sections_after_custom_capability_files", get_defined_vars());
}
/**/
if (apply_filters("ws_plugin__s2member_during_scripting_page_during_left_sections_display_api_advanced_dripping", !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site(), get_defined_vars())) {
示例3: check_file_download_access
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
} else {
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;
}
}
}
if ($serving || $creating) {
$basename = basename($req["file_download"]);
$mimetypes = parse_ini_file(dirname(dirname(dirname(__FILE__))) . "/includes/mime-types.ini");
$extension = strtolower(substr($req["file_download"], strrpos($req["file_download"], ".") + 1));
$key = $req["file_download_key"] && is_string($req["file_download_key"]) ? $req["file_download_key"] : false;
$stream = isset($req["file_stream"]) ? filter_var($req["file_stream"], FILTER_VALIDATE_BOOLEAN) : (in_array($extension, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"])) ? true : false);
$inline = !$stream && isset($req["file_inline"]) ? filter_var($req["file_inline"], FILTER_VALIDATE_BOOLEAN) : ($stream || in_array($extension, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"])) ? true : false);
$ssl = isset($req["file_ssl"]) ? filter_var($req["file_ssl"], FILTER_VALIDATE_BOOLEAN) : (is_ssl() ? true : false);
$storage = $req["file_storage"] && is_string($req["file_storage"]) ? strtolower($req["file_storage"]) : false;
$remote = isset($req["file_remote"]) ? filter_var($req["file_remote"], FILTER_VALIDATE_BOOLEAN) : false;
$_basename_dir_app_data = c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]);
$rewrite_base_guess = is_dir(dirname($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir"]) . "/" . $_basename_dir_app_data) ? dirname($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . "/" . $_basename_dir_app_data : content_url("/" . $_basename_dir_app_data);
$rewrite_base = $req["file_rewrite_base"] && is_string($req["file_rewrite_base"]) ? $req["file_rewrite_base"] : false;
$rewrite = $rewriting = !$rewrite_base && isset($req["file_rewrite"]) ? filter_var($req["file_rewrite"], FILTER_VALIDATE_BOOLEAN) : ($rewrite_base ? true : false);
unset($_basename_dir_app_data);
$skip_confirmation = isset($req["skip_confirmation"]) ? filter_var($req["skip_confirmation"], FILTER_VALIDATE_BOOLEAN) : false;
$url_to_storage_source = isset($req["url_to_storage_source"]) ? filter_var($req["url_to_storage_source"], FILTER_VALIDATE_BOOLEAN) : false;
$pathinfo = !$using_amazon_storage ? pathinfo($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]) : array();
$mimetype = $mimetypes[$extension] ? $mimetypes[$extension] : "application/octet-stream";
$disposition = ($inline ? "inline" : "attachment") . "; filename=\"" . c_ws_plugin__s2member_utils_strings::esc_dq($basename) . "\"; filename*=UTF-8''" . rawurlencode($basename);
$length = !$using_amazon_storage && $file ? filesize($file) : -1;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_file_download_access", get_defined_vars());
unset($__refs, $__v);
if ($using_amazon_storage && $using_amazon_cf_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
wp_redirect(c_ws_plugin__s2member_files_in::amazon_cf_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
} else {
// Else return File Download URL.
return apply_filters("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_cf_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
}
} else {
if ($using_amazon_storage && $using_amazon_s3_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
wp_redirect(c_ws_plugin__s2member_files_in::amazon_s3_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
} else {
// Else return File Download URL.
return apply_filters("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_s3_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
}
} else {
if ($creating && $rewriting) {
示例4: check_file_download_access
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
} else {
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.
}
}
if ($serving || $creating) {
$basename = basename($req['file_download']);
$mimetypes = parse_ini_file(dirname(dirname(dirname(__FILE__))) . '/includes/mime-types.ini');
$extension = strtolower(substr($req['file_download'], strrpos($req['file_download'], '.') + 1));
$key = $req['file_download_key'] && is_string($req['file_download_key']) ? $req['file_download_key'] : FALSE;
$stream = isset($req['file_stream']) ? filter_var($req['file_stream'], FILTER_VALIDATE_BOOLEAN) : (in_array($extension, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_stream_extensions'])) ? TRUE : FALSE);
$inline = !$stream && isset($req['file_inline']) ? filter_var($req['file_inline'], FILTER_VALIDATE_BOOLEAN) : ($stream || in_array($extension, preg_split('/[' . "\r\n\t" . '\\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_inline_extensions'])) ? TRUE : FALSE);
$ssl = isset($req['file_ssl']) ? filter_var($req['file_ssl'], FILTER_VALIDATE_BOOLEAN) : (is_ssl() ? TRUE : FALSE);
$storage = $req['file_storage'] && is_string($req['file_storage']) ? strtolower($req['file_storage']) : FALSE;
$remote = isset($req['file_remote']) ? filter_var($req['file_remote'], FILTER_VALIDATE_BOOLEAN) : FALSE;
$_basename_dir_app_data = c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir']);
$rewrite_base_guess = is_dir(dirname($GLOBALS['WS_PLUGIN__']['s2member']['c']['dir']) . '/' . $_basename_dir_app_data) ? dirname($GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_url']) . '/' . $_basename_dir_app_data : content_url('/' . $_basename_dir_app_data);
$rewrite_base = $req['file_rewrite_base'] && is_string($req['file_rewrite_base']) ? $req['file_rewrite_base'] : FALSE;
$rewrite = $rewriting = !$rewrite_base && isset($req['file_rewrite']) ? filter_var($req['file_rewrite'], FILTER_VALIDATE_BOOLEAN) : ($rewrite_base ? TRUE : FALSE);
unset($_basename_dir_app_data);
// A little housekeeping here.
$skip_confirmation = isset($req['skip_confirmation']) ? filter_var($req['skip_confirmation'], FILTER_VALIDATE_BOOLEAN) : FALSE;
$url_to_storage_source = isset($req['url_to_storage_source']) ? filter_var($req['url_to_storage_source'], FILTER_VALIDATE_BOOLEAN) : FALSE;
$file = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'] . '/' . $req['file_download'];
$pathinfo = !$using_amazon_storage && $file ? pathinfo($file) : array();
$mimetype = $mimetypes[$extension] ? $mimetypes[$extension] : 'application/octet-stream';
$disposition = ($inline ? 'inline' : 'attachment') . '; filename="' . c_ws_plugin__s2member_utils_strings::esc_dq($basename) . '"; filename*=UTF-8\'\'' . rawurlencode($basename);
$length = !$using_amazon_storage && $file ? filesize($file) : -1;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_file_download_access', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
if ($using_amazon_storage && $using_amazon_cf_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
// We only need this section when/if we're actually serving.
wp_redirect(c_ws_plugin__s2member_files_in::amazon_cf_url($req['file_download'], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
}
return apply_filters('ws_plugin__s2member_file_download_access_url', c_ws_plugin__s2member_files_in::amazon_cf_url($req['file_download'], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
} else {
if ($using_amazon_storage && $using_amazon_s3_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
// We only need this section when/if we're actually serving.
wp_redirect(c_ws_plugin__s2member_files_in::amazon_s34_url($req['file_download'], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
}
return apply_filters('ws_plugin__s2member_file_download_access_url', c_ws_plugin__s2member_files_in::amazon_s34_url($req['file_download'], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
} else {
示例5: check_file_download_access
//.........这里部分代码省略.........
}
}
}
}
}
}
}
}
}
} else {
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;
}
}
}
/**/
if ($serving || $creating) {
$basename = basename($req["file_download"]);
$mimetypes = parse_ini_file(dirname(dirname(dirname(__FILE__))) . "/includes/mime-types.ini");
$extension = strtolower(substr($req["file_download"], strrpos($req["file_download"], ".") + 1));
/**/
$key = $req["file_download_key"] && is_string($req["file_download_key"]) ? $req["file_download_key"] : false;
/**/
$stream = isset($req["file_stream"]) ? filter_var($req["file_stream"], FILTER_VALIDATE_BOOLEAN) : (in_array($extension, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"])) ? true : false);
$inline = !$stream && isset($req["file_inline"]) ? filter_var($req["file_inline"], FILTER_VALIDATE_BOOLEAN) : ($stream || in_array($extension, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"])) ? true : false);
$ssl = isset($req["file_ssl"]) ? filter_var($req["file_ssl"], FILTER_VALIDATE_BOOLEAN) : (is_ssl() ? true : false);
$storage = $req["file_storage"] && is_string($req["file_storage"]) ? strtolower($req["file_storage"]) : false;
$remote = isset($req["file_remote"]) ? filter_var($req["file_remote"], FILTER_VALIDATE_BOOLEAN) : false;
/**/
$rewrite_base_guess = dirname($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . "/" . c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]);
$rewrite_base = $req["file_rewrite_base"] && is_string($req["file_rewrite_base"]) ? $req["file_rewrite_base"] : false;
$rewrite = $rewriting = !$rewrite_base && isset($req["file_rewrite"]) ? filter_var($req["file_rewrite"], FILTER_VALIDATE_BOOLEAN) : ($rewrite_base ? true : false);
/**/
$skip_confirmation = isset($req["skip_confirmation"]) ? filter_var($req["skip_confirmation"], FILTER_VALIDATE_BOOLEAN) : false;
$url_to_storage_source = isset($req["url_to_storage_source"]) ? filter_var($req["url_to_storage_source"], FILTER_VALIDATE_BOOLEAN) : false;
/**/
$pathinfo = !$using_amazon_storage ? pathinfo($file = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $req["file_download"]) : array();
$mimetype = $mimetypes[$extension] ? $mimetypes[$extension] : "application/octet-stream";
$length = !$using_amazon_storage && $file ? filesize($file) : -1;
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_file_download_access", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if ($using_amazon_s3_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
wp_redirect(c_ws_plugin__s2member_files_in::amazon_s3_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
} else {
/* Else return File Download URL. */
return apply_filters("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_s3_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
}
} else {
if ($using_amazon_cf_storage && ($serving || $creating && $url_to_storage_source)) {
if ($serving) {
wp_redirect(c_ws_plugin__s2member_files_in::amazon_cf_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype)) . exit;
} else {
/* Else return File Download URL. */
return apply_filters("ws_plugin__s2member_file_download_access_url", c_ws_plugin__s2member_files_in::amazon_cf_url($req["file_download"], $stream, $inline, $ssl, $basename, $mimetype), get_defined_vars());
}
} else {
if ($creating && $rewriting) {