Skip to content

Commit

Permalink
Refactoring. See: #179 and #270
Browse files Browse the repository at this point in the history
  • Loading branch information
JasWSInc committed Aug 13, 2014
1 parent 516d168 commit 1f4d169
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions s2member/includes/classes/menu-pages.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,14 @@ public static function down_ops_page()
{
do_action('ws_plugin__s2member_before_down_ops_page', get_defined_vars());

c_ws_plugin__s2member_menu_pages::update_all_options();

if(!empty($_REQUEST['ws_plugin__s2member_cf_options_reset'])
&& wp_verify_nonce($_REQUEST['ws_plugin__s2member_cf_options_reset'], 'ws-plugin--s2member-cf-options-reset'))
{
c_ws_plugin__s2member_files_in::reset_aws_cf_config_values();
wp_redirect(remove_query_arg('ws_plugin__s2member_cf_options_reset')).exit();
c_ws_plugin__s2member_files_in::reset_aws_cf_config_values(); // A full CloudFront reset.
c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon CloudFront configuration reset successfully.');
}
c_ws_plugin__s2member_menu_pages::update_all_options();

$files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'];

$htaccess = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'].'/.htaccess';
Expand Down
2 changes: 1 addition & 1 deletion s2member/includes/classes/sc-files-in.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static function sc_get_stream($attr = array(), $content = '', $shortcode
$_file_download_config = array_merge($config, array('file_download' => $_file_download_resolution));

if($file_download_urls) // If this is a ANOTHER resolution, don't count it against the user.
$_file_download_config = array_merge($_file_download_config, array('count_against_user' => 'no'));
$_file_download_config = array_merge($_file_download_config, array('check_user' => FALSE, 'count_against_user' => FALSE));

if(!($file_download_urls[str_replace(array('_', '-'), ' ', $_player_resolution)] = c_ws_plugin__s2member_files::create_file_download_url($_file_download_config, TRUE)))
return apply_filters('ws_plugin__s2member_sc_get_stream', NULL, get_defined_vars()); // Failure.
Expand Down
11 changes: 6 additions & 5 deletions s2member/includes/menu-pages/down-ops.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct()
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 '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form" action="'.esc_attr(remove_query_arg('ws_plugin__s2member_cf_options_reset')).'">'."\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";
Expand Down Expand Up @@ -473,28 +473,29 @@ public function __construct()
echo '</tr>'."\n";
echo '</tbody>'."\n";
echo '</table>'."\n";
echo '</div>'."\n";

echo '<div class="ws-menu-page-hr"></div>'."\n";

echo '<table class="form-table" style="margin-top:0;">'."\n";
echo '<tbody>'."\n";
echo '<tr>'."\n";

echo '<td>'."\n";
echo '<h3>Completely Reset CloudFront Configuration?</h3>'."\n";
echo '<p>If you need to start all over again, you can click this button to reset your existing s2Member/CloudFront configuration. <strong>However, please note</strong> that you will still need to log into your AWS CloudFront Console and remove any existing CloudFront Distributions that were previously generated with s2Member; i.e. resetting your configuration here will allow you to start over with s2Member, but it does NOT reset anything on the AWS side of things.</p>'."\n";
echo '<div style="float:right; margin:0 0 0 25px;">'."\n";
echo '<button type="button" onclick="if(confirm(\'Are you sure?\')) location.href = \''.c_ws_plugin__s2member_utils_strings::esc_js_sq(add_query_arg(urlencode_deep(array('ws_plugin__s2member_cf_options_reset' => wp_create_nonce("ws-plugin--s2member-cf-options-reset"))))).'\';">Reset CloudFront Configuration</button>'."\n";
echo ' <button type="button" onclick="if(confirm(\'Are you sure?\')) location.href = \''.c_ws_plugin__s2member_utils_strings::esc_js_sq(add_query_arg(urlencode_deep(array('ws_plugin__s2member_cf_options_reset' => wp_create_nonce('ws-plugin--s2member-cf-options-reset'))))).'\';">Reset CloudFront Configuration</button>'."\n";
echo '</div>'."\n";
echo '<p>If you need to start all over again, you can click this button to reset your existing s2Member/CloudFront configuration. <em><strong>However, please note:</strong> you will still need to log into your AWS CloudFront Console (at some point) and remove any existing CloudFront Distributions that were previously generated with s2Member; i.e. resetting your configuration here will allow you to start over with s2Member using a new set of CF Distros, but it does NOT delete anything on the AWS side.</em></p>'."\n";
echo '</td>'."\n";

echo '</tr>'."\n";
echo '</tbody>'."\n";
echo '</table>'."\n";

echo '</div>'."\n";
echo '</div>'."\n";

echo '</div>'."\n";

do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_cf", get_defined_vars());
}

Expand Down

0 comments on commit 1f4d169

Please sign in to comment.