@@ -618,6 +618,10 @@ public function save_settings( $options, $option_name = '' ) {
618
618
foreach ( $ options as $ value ) {
619
619
if ( ! isset ( $ value ['type ' ] ) ) continue ;
620
620
if ( in_array ( $ value ['type ' ], array ( 'row ' , 'column ' , 'heading ' , 'ajax_submit ' , 'ajax_multi_submit ' ) ) ) continue ;
621
+ if ( stristr ( $ value ['type ' ], 'custom_ ' ) !== false ) {
622
+ do_action ( $ this ->plugin_name . '_save_setting_ ' . $ value ['type ' ], $ value );
623
+ continue ;
624
+ }
621
625
622
626
// Save for global settings of plugin framework
623
627
switch ( $ value ['type ' ] ) {
@@ -1030,6 +1034,14 @@ public function save_settings( $options, $option_name = '' ) {
1030
1034
/*-----------------------------------------------------------------------------------*/
1031
1035
1032
1036
public function reset_settings ( $ options , $ option_name = '' , $ reset = false , $ free_version = false ) {
1037
+
1038
+ if ( $ reset ) {
1039
+ check_admin_referer ( 'save_settings_ ' . $ this ->plugin_name );
1040
+
1041
+ if ( ! current_user_can ( 'manage_options ' ) ) {
1042
+ return false ;
1043
+ }
1044
+ }
1033
1045
1034
1046
if ( !is_array ( $ options ) || count ( $ options ) < 1 ) return ;
1035
1047
@@ -1089,6 +1101,11 @@ public function reset_settings( $options, $option_name = '', $reset = false, $fr
1089
1101
if ( ! isset ( $ value ['id ' ] ) || trim ( $ value ['id ' ] ) == '' ) continue ;
1090
1102
if ( ! isset ( $ value ['default ' ] ) ) $ value ['default ' ] = '' ;
1091
1103
if ( ! isset ( $ value ['free_version ' ] ) ) $ value ['free_version ' ] = false ;
1104
+
1105
+ if ( stristr ( $ value ['type ' ], 'custom_ ' ) !== false ) {
1106
+ do_action ( $ this ->plugin_name . '_reset_setting_ ' . $ value ['type ' ], $ value );
1107
+ continue ;
1108
+ }
1092
1109
1093
1110
// For way it has an option name
1094
1111
if ( ! isset ( $ value ['separate_option ' ] ) ) $ value ['separate_option ' ] = false ;
0 commit comments