diff --git a/subscribe-to-comments-reloaded/includes/js/stcr-admin.js b/subscribe-to-comments-reloaded/includes/js/stcr-admin.js index f9ba190..a641a5f 100755 --- a/subscribe-to-comments-reloaded/includes/js/stcr-admin.js +++ b/subscribe-to-comments-reloaded/includes/js/stcr-admin.js @@ -58,5 +58,15 @@ $( info_panel).addClass( "hidden" ); } }); + /** + * Control the execution of the options restore process. + * @author reedyseth + * @since 08-February-2018 + */ + $('input.reset_all_options').on("click", function ( event ) { + var confirmation = confirm("If you proceed this action cannot be undone, all settings will be wipe out"); + + return confirmation; + }); }); } )( jQuery ); diff --git a/subscribe-to-comments-reloaded/options/index.php b/subscribe-to-comments-reloaded/options/index.php index 8313ba4..2a74ef5 100755 --- a/subscribe-to-comments-reloaded/options/index.php +++ b/subscribe-to-comments-reloaded/options/index.php @@ -62,7 +62,7 @@ function subscribe_reloaded_get_option( $_option = '', $_default = '' ) { "stcr_notifications" => __( 'Notifications', 'subscribe-reloaded' ), "stcr_options" => __( 'Options', 'subscribe-reloaded' ), // "stcr_subscribers_emails" => __( 'Subscribers Emails', 'subscribe-reloaded' ), - "stcr_you_can_help" => __( 'You can help', 'subscribe-reloaded' ), +// "stcr_you_can_help" => __( 'You can help', 'subscribe-reloaded' ), "stcr_support" => __( 'Support', 'subscribe-reloaded' ), "stcr_donate" => __( 'Donate', 'subscribe-reloaded' ) ); diff --git a/subscribe-to-comments-reloaded/options/panel5.php b/subscribe-to-comments-reloaded/options/panel5.php index 2869abd..1cfa630 100755 --- a/subscribe-to-comments-reloaded/options/panel5.php +++ b/subscribe-to-comments-reloaded/options/panel5.php @@ -21,6 +21,25 @@ echo ' ' . substr( $faulty_fields, 0, - 2 ) . ''; } echo "

\n"; +} +elseif ( array_key_exists( "reset_all_options", $_POST ) ) { + global $wp_subscribe_reloaded; + $delete_subscriptions_selection = $_POST['options']['delete_options_subscriptions']; + $deletion_result = $wp_subscribe_reloaded->stcr->utils->delete_all_settings( $delete_subscriptions_selection ); + + if( $deletion_result ) + { + // Restore settings + $wp_subscribe_reloaded->stcr->utils->create_options(); + } + // Display an alert in the admin interface if something went wrong + echo '

'; + if ( $deletion_result ) { + _e( 'Your settings have been successfully reset.', 'subscribe-reloaded' ); + } else { + _e( 'There was an error deleting the options:', 'subscribe-reloaded' ); + } + echo "

\n"; } else { // Update options if ( isset( $_POST['options'] ) ) { @@ -63,6 +82,9 @@ } if ( isset( $_POST['options']['enable_font_awesome'] ) && ! subscribe_reloaded_update_option( 'enable_font_awesome', $_POST['options']['enable_font_awesome'], 'yesno' ) ) { $faulty_fields = __( 'Enable Font Awesome', 'subscribe-reloaded' ) . ', '; + } + if ( isset( $_POST['options']['delete_options_subscriptions'] ) && ! subscribe_reloaded_update_option( 'delete_options_subscriptions', $_POST['options']['delete_options_subscriptions'], 'yesno' ) ) { + $faulty_fields = __( 'Reset All Options', 'subscribe-reloaded' ) . ', '; } // Display an alert in the admin interface if something went wrong echo '

'; @@ -227,6 +249,18 @@ ?> + + + + +

+
+ >       + > +

+ + +

diff --git a/subscribe-to-comments-reloaded/options/panel7.php b/subscribe-to-comments-reloaded/options/panel7.php index b3f0587..6dfe321 100755 --- a/subscribe-to-comments-reloaded/options/panel7.php +++ b/subscribe-to-comments-reloaded/options/panel7.php @@ -5,7 +5,10 @@ exit; } ?> -

+ +

', 'subscribe-reloaded' ) ?> Paypal

-

Subscribe to Comments Reloaded and so on. Whatever you do, thanks for using my plugin!", 'subscribe-reloaded' ) ?>

+

+

Subscribe to Comments Reloaded and so on. Whatever you do, thanks for using my plugin!", 'subscribe-reloaded' ) ?>

here", 'subscribe-reloaded' ) ?>

-

Subscribe to Comments Reloaded works for you and how good it is. Rate it on its Plugin Directory page.', 'subscribe-reloaded' ) ?>

\ No newline at end of file +

Subscribe to Comments Reloaded works for you and how good it is. Rate it on its Plugin Directory page.', 'subscribe-reloaded' ) ?>

+ +

+

GitHub Page rather than on the WordPress Support page.', 'subscribe-reloaded' ) ?> +

\ No newline at end of file diff --git a/subscribe-to-comments-reloaded/options/panel8.php b/subscribe-to-comments-reloaded/options/panel8.php index f308e5a..37f0cda 100755 --- a/subscribe-to-comments-reloaded/options/panel8.php +++ b/subscribe-to-comments-reloaded/options/panel8.php @@ -1,22 +1,34 @@ -

+ +

', 'subscribe-reloaded' ) ?> Paypal

- - + - - + +

+


You can donate $5.00, $10.00, $20.00 or more, $Any donation received will be reinvested in the development of Subscribe to Comments Reloaded, and to buy some food for my hungry family.', 'subscribe-reloaded' ) ?>

+ +

+

Subscribe to Comments Reloaded and so on. Whatever you do, thanks for using my plugin!", 'subscribe-reloaded' ) ?>

+ +

+

here", 'subscribe-reloaded' ) ?>

+ +

+

Subscribe to Comments Reloaded works for you and how good it is. Rate it on its Plugin Directory page.', 'subscribe-reloaded' ) ?>

+

GitHub Page rather than on the WordPress Support page.', 'subscribe-reloaded' ) ?> -

- -
\ No newline at end of file +

\ No newline at end of file diff --git a/subscribe-to-comments-reloaded/utils/stcr_manage.php b/subscribe-to-comments-reloaded/utils/stcr_manage.php index 32bb050..6dbd613 100755 --- a/subscribe-to-comments-reloaded/utils/stcr_manage.php +++ b/subscribe-to-comments-reloaded/utils/stcr_manage.php @@ -194,73 +194,9 @@ public function _activate() { // Upgrade rountine $this->upgrade(); - // Messages related to the management page - global $wp_rewrite; - - if ( empty( $wp_rewrite->permalink_structure ) ) { - add_option( 'subscribe_reloaded_manager_page', '/?page_id=99999', '', 'yes' ); - } else { - add_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/', '', 'yes' ); - } - - // Let us make sure that the Unique Key is created - delete_option('subscribe_reloaded_unique_key'); - add_option( 'subscribe_reloaded_unique_key', $this->utils->generate_key(), '', 'yes' ); - add_option( 'subscribe_reloaded_fresh_install', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_safely_uninstall', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_stcr_position', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_reply_to', '', '', 'yes' ); - add_option( 'subscribe_reloaded_oneclick_text', "

Your are not longer subscribe to the post:

\r\n\r\n

[post_title]

\r\n
", '', 'yes' ); - add_option( 'subscribe_reloaded_subscriber_table', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_data_sanitized', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_show_subscription_box', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_checked_by_default', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_advanced_subscriptions', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_default_subscription_type', '2', '', 'yes' ); - add_option( 'subscribe_reloaded_checked_by_default_value', '0', '', 'yes' ); - add_option( 'subscribe_reloaded_checkbox_inline_style', 'width:30px', '', 'yes' ); - add_option( 'subscribe_reloaded_checkbox_html', "

", '', 'yes' ); - add_option( 'subscribe_reloaded_checkbox_label', __( "Notify me of followup comments via e-mail. You can also subscribe without commenting.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_subscribed_label', __( "You are subscribed to this post. Manage your subscriptions.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_subscribed_waiting_label', __( "Your subscription to this post needs to be confirmed. Manage your subscriptions.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_author_label', __( "You can manage the subscriptions of this post.", 'subscribe-reloaded' ), '', 'yes' ); - - add_option( 'subscribe_reloaded_manager_page_enabled', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_virtual_manager_page_enabled', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_manager_page_title', __( 'Manage subscriptions', 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_custom_header_meta', "", '', 'yes' ); - add_option( 'subscribe_reloaded_request_mgmt_link', __( 'To manage your subscriptions, please enter your email address here below. We will send you a message containing the link to access your personal management page.', 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_request_mgmt_link_thankyou', __( 'Thank you for using our subscription service. Your request has been completed, and you should receive an email with the management link in a few minutes.', 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_subscribe_without_commenting', __( "You can follow the discussion on [post_title] without having to leave a comment. Cool, huh? Just enter your email address in the form here below and you're all set.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_subscription_confirmed', __( "Thank you for using our subscription service. Your request has been completed. You will receive a notification email every time a new comment to this article is approved and posted by the administrator.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_subscription_confirmed_dci', __( "Thank you for using our subscription service. In order to confirm your request, please check your email for the verification message and follow the instructions.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_author_text', __( "In order to cancel or suspend one or more notifications, select the corresponding checkbox(es) and click on the button at the end of the list.", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_user_text', __( "In order to cancel or suspend one or more notifications, select the corresponding checkbox(es) and click on the button at the end of the list. You are currently subscribed to:", 'subscribe-reloaded' ), '', 'yes' ); - - add_option( 'subscribe_reloaded_from_name', get_bloginfo( 'name' ), '', 'yes' ); - add_option( 'subscribe_reloaded_from_email', get_bloginfo( 'admin_email' ), '', 'yes' ); - add_option( 'subscribe_reloaded_notification_subject', __( 'There is a new comment to [post_title]', 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_notification_content', __( "

There is a new comment on [post_title].

\n\n
\nComment link: [comment_permalink]\nAuthor: [comment_author]\n\nComment:\n[comment_content]\n
Permalink: [post_permalink]\nManage your subscriptions | One click unsubscribe
", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_double_check_subject', __( 'Please confirm your subscription to [post_title]', 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_double_check_content', __( "You have requested to be notified every time a new comment is added to:\n[post_permalink]\n\nPlease confirm your request by clicking on this link:\n[confirm_link]", 'subscribe-reloaded' ), '', 'yes' ); - add_option( 'subscribe_reloaded_management_subject', __( 'Manage your subscriptions on [blog_name]', 'subscribe-reloaded' ) ); - add_option( 'subscribe_reloaded_management_content', __( "You have requested to manage your subscriptions to the articles on [blog_name]. Please check the Subscriptions management link in your email", 'subscribe-reloaded' ) ); - add_option( 'subscribe_reloaded_management_email_content', __( "You have requested to manage your subscriptions to the articles on [blog_name]. Follow this link to access your personal page:\n[manager_link]", 'subscribe-reloaded' ) ); - - add_option( 'subscribe_reloaded_purge_days', '30', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_double_check', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_notify_authors', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_html_emails', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_htmlify_message_links', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_process_trackbacks', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_admin_messages', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_admin_subscribe', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_admin_bcc', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_log_data', 'no', '', 'yes' ); - add_option( 'subscribe_reloaded_auto_clean_log_data', 'yes', '', 'yes' ); - add_option( 'subscribe_reloaded_auto_clean_log_frecuency', 'daily', '', 'yes' ); - add_option( 'subscribe_reloaded_enable_font_awesome', 'yes', '', 'yes' ); + delete_option('subscribe_reloaded_unique_key'); + $this->utils->create_options(); } /** * Performs some clean-up maintenance (disable cron job). @@ -452,12 +388,12 @@ public function add_config_menu( $_s ) { // $capability, // "stcr_subscribers_emails", // array( $this, "stcr_option_subscribers_emails" ) ); - add_submenu_page( $parent_slug , - __( 'You can help', 'subscribe-reloaded' ), - __( 'You can help', 'subscribe-reloaded' ), - $capability, - "stcr_you_can_help", - array( $this, "stcr_option_you_can_help" ) ); +// add_submenu_page( $parent_slug , +// __( 'You can help', 'subscribe-reloaded' ), +// __( 'You can help', 'subscribe-reloaded' ), +// $capability, +// "stcr_you_can_help", +// array( $this, "stcr_option_you_can_help" ) ); add_submenu_page( $parent_slug , __( 'Support', 'subscribe-reloaded' ), __( 'Support', 'subscribe-reloaded' ), diff --git a/subscribe-to-comments-reloaded/utils/stcr_utils.php b/subscribe-to-comments-reloaded/utils/stcr_utils.php index ade4f22..b41218c 100755 --- a/subscribe-to-comments-reloaded/utils/stcr_utils.php +++ b/subscribe-to-comments-reloaded/utils/stcr_utils.php @@ -167,7 +167,112 @@ public function clean_email( $_email ) { } // end clean_email + public function create_options() + { + // Messages related to the management page + global $wp_rewrite; + if ( empty( $wp_rewrite->permalink_structure ) ) { + add_option( 'subscribe_reloaded_manager_page', '/?page_id=99999', '', 'yes' ); + } else { + add_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/', '', 'yes' ); + } + + add_option( 'subscribe_reloaded_unique_key', $this->generate_key(), '', 'yes' ); + add_option( 'subscribe_reloaded_fresh_install', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_safely_uninstall', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_stcr_position', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_reply_to', '', '', 'yes' ); + add_option( 'subscribe_reloaded_oneclick_text', "

Your are not longer subscribe to the post:

\r\n\r\n

[post_title]

\r\n
", '', 'yes' ); + add_option( 'subscribe_reloaded_subscriber_table', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_data_sanitized', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_show_subscription_box', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_checked_by_default', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_advanced_subscriptions', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_default_subscription_type', '2', '', 'yes' ); + add_option( 'subscribe_reloaded_checked_by_default_value', '0', '', 'yes' ); + add_option( 'subscribe_reloaded_checkbox_inline_style', 'width:30px', '', 'yes' ); + add_option( 'subscribe_reloaded_checkbox_html', "

", '', 'yes' ); + add_option( 'subscribe_reloaded_checkbox_label', __( "Notify me of followup comments via e-mail. You can also subscribe without commenting.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_subscribed_label', __( "You are subscribed to this post. Manage your subscriptions.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_subscribed_waiting_label', __( "Your subscription to this post needs to be confirmed. Manage your subscriptions.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_author_label', __( "You can manage the subscriptions of this post.", 'subscribe-reloaded' ), '', 'yes' ); + + add_option( 'subscribe_reloaded_manager_page_enabled', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_virtual_manager_page_enabled', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_manager_page_title', __( 'Manage subscriptions', 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_custom_header_meta', "", '', 'yes' ); + add_option( 'subscribe_reloaded_request_mgmt_link', __( 'To manage your subscriptions, please enter your email address here below. We will send you a message containing the link to access your personal management page.', 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_request_mgmt_link_thankyou', __( 'Thank you for using our subscription service. Your request has been completed, and you should receive an email with the management link in a few minutes.', 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_subscribe_without_commenting', __( "You can follow the discussion on [post_title] without having to leave a comment. Cool, huh? Just enter your email address in the form here below and you're all set.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_subscription_confirmed', __( "Thank you for using our subscription service. Your request has been completed. You will receive a notification email every time a new comment to this article is approved and posted by the administrator.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_subscription_confirmed_dci', __( "Thank you for using our subscription service. In order to confirm your request, please check your email for the verification message and follow the instructions.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_author_text', __( "In order to cancel or suspend one or more notifications, select the corresponding checkbox(es) and click on the button at the end of the list.", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_user_text', __( "In order to cancel or suspend one or more notifications, select the corresponding checkbox(es) and click on the button at the end of the list. You are currently subscribed to:", 'subscribe-reloaded' ), '', 'yes' ); + + add_option( 'subscribe_reloaded_from_name', get_bloginfo( 'name' ), '', 'yes' ); + add_option( 'subscribe_reloaded_from_email', get_bloginfo( 'admin_email' ), '', 'yes' ); + add_option( 'subscribe_reloaded_notification_subject', __( 'There is a new comment to [post_title]', 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_notification_content', __( "

There is a new comment on [post_title].

\n\n
\nComment link: [comment_permalink]\nAuthor: [comment_author]\n\nComment:\n[comment_content]\n
Permalink: [post_permalink]\nManage your subscriptions | One click unsubscribe
", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_double_check_subject', __( 'Please confirm your subscription to [post_title]', 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_double_check_content', __( "You have requested to be notified every time a new comment is added to:\n[post_permalink]\n\nPlease confirm your request by clicking on this link:\n[confirm_link]", 'subscribe-reloaded' ), '', 'yes' ); + add_option( 'subscribe_reloaded_management_subject', __( 'Manage your subscriptions on [blog_name]', 'subscribe-reloaded' ) ); + add_option( 'subscribe_reloaded_management_content', __( "You have requested to manage your subscriptions to the articles on [blog_name]. Please check the Subscriptions management link in your email", 'subscribe-reloaded' ) ); + add_option( 'subscribe_reloaded_management_email_content', __( "You have requested to manage your subscriptions to the articles on [blog_name]. Follow this link to access your personal page:\n[manager_link]", 'subscribe-reloaded' ) ); + + add_option( 'subscribe_reloaded_purge_days', '30', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_double_check', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_notify_authors', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_html_emails', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_htmlify_message_links', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_process_trackbacks', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_admin_messages', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_admin_subscribe', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_admin_bcc', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_log_data', 'no', '', 'yes' ); + add_option( 'subscribe_reloaded_auto_clean_log_data', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_auto_clean_log_frecuency', 'daily', '', 'yes' ); + add_option( 'subscribe_reloaded_enable_font_awesome', 'yes', '', 'yes' ); + add_option( 'subscribe_reloaded_delete_options_subscriptions', 'no', '', 'no' ); + } + /** + * @since 08-February-2018 + * @author reedyseth + * @param $delete_subscriptions String Decide either to delete the subscriptions or not. + * @return true|false Boolean on success or failure. + */ + public function delete_all_settings( $delete_subscriptions = no ) + { + global $wpdb; + $sql = "SELECT * FROM $wpdb->options WHERE option_name like 'subscribe_reloaded\_%' + ORDER BY option_name"; + $stcr_options = $wpdb->get_results( $sql , OBJECT ); + if( $stcr_options !== false && is_array( $stcr_options ) ) + { + // Drop Only the Settings and not the subscriptions. + // Goodbye options... + foreach($stcr_options as $option) + { + delete_option( $option->option_name ); + } + if ( $delete_subscriptions == "yes" ) + { + // Delete the subscriptions in both tables. + $wpdb->query( "DELETE FROM {$wpdb->prefix}subscribe_reloaded_subscribers" ); + $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '\_stcr@\_%'" ); + } + } + + + if ( $stcr_options === false ) + { + return false; + } + else + { + return true; + } + } /** * Will send an email by adding the correct headers. *