@@ -73,7 +73,8 @@ function an_change_files_css_selectors( $flush, $tempFolderPath, $tempFolderURL,
73
73
}
74
74
// Create new dir and files
75
75
if ( $ wp_filesystem ->is_dir ( $ tempFolderPath ) ) {
76
- array_map ( 'unlink ' , glob ( $ tempFolderPath . '*. ' . $ fileExt ) );
76
+ $ glob_files = glob ( $ tempFolderPath . '*. ' . $ fileExt );
77
+ array_map ( 'unlink ' , is_array ( $ glob_files ) ? $ glob_files : false );
77
78
} else {
78
79
$ wp_filesystem ->mkdir ( $ tempFolderPath );
79
80
}
@@ -101,7 +102,11 @@ function an_save_setting_random_selectors( $force = false ) {
101
102
}
102
103
$ an_option = unserialize ( an_get_option ( 'adblocker_notify_options ' ) );
103
104
$ anScripts = unserialize ( an_get_option ( 'adblocker_notify_selectors ' ) );
104
- if ( true == $ an_option ['an_option_selectors ' ] || $ force ) {
105
+ $ selectors_option = isset ( $ an_option ['an_option_selectors ' ] ) ? $ an_option ['an_option_selectors ' ] : true ;
106
+ if ( true == $ selectors_option || $ force ) {
107
+ if ( ! isset ( $ an_option ['an_option_flush ' ] ) ) {
108
+ $ an_option ['an_option_flush ' ] = false ;
109
+ }
105
110
// Define new temp path
106
111
$ uploadDir = wp_upload_dir ();
107
112
$ tempDirName = an_random_slug ();
@@ -122,7 +127,7 @@ function an_save_setting_random_selectors( $force = false ) {
122
127
}
123
128
// Define new selectors
124
129
$ newSelectors = array ( an_random_slug (), an_random_slug (), an_random_slug () );
125
- $ flush = false ;
130
+ $ flush = false ;
126
131
if ( true == $ an_option ['an_option_flush ' ] || ! file_exists ( $ anScripts ['temp-path ' ] ) || false == $ anScripts ['temp-path ' ] ) {
127
132
$ flush = true ;
128
133
}
@@ -178,14 +183,17 @@ function an_save_setting_random_selectors( $force = false ) {
178
183
);
179
184
an_update_option ( 'adblocker_notify_selectors ' , serialize ( $ newFiles ) );
180
185
// remove option flush
186
+ if ( ! isset ( $ an_option ['an_option_flush ' ] ) ) {
187
+ $ an_option ['an_option_flush ' ] = false ;
188
+ }
181
189
$ an_option ['an_option_flush ' ] = false ;
182
190
an_update_option ( 'adblocker_notify_options ' , serialize ( $ an_option ) );
183
191
} else {
184
192
// Remove temp files
185
193
if ( isset ( $ anScripts ['temp-path ' ] ) ) {
186
194
an_delete_temp_folder ( $ anScripts ['temp-path ' ] );
187
195
}
188
- }
196
+ }// End if().
189
197
}
190
198
191
199
add_action ( 'tf_admin_options_saved_adblocker_notify ' , 'an_save_setting_random_selectors ' , 99 );
@@ -244,19 +252,19 @@ function an_update_titan_css_selectors( $an_option ) {
244
252
***************************************************************/
245
253
function an_print_change_files_css_selectors ( $ an_option , $ anScripts ) {
246
254
// Get AN style and script
247
- $ anCSS = AN_URL . 'css/an-style.css ' ;
248
- $ anJS = AN_URL . 'js/an-scripts.js ' ;
255
+ $ anCSS = AN_URL . 'css/an-style.css ' ;
256
+ $ anJS = AN_URL . 'js/an-scripts.js ' ;
249
257
$ newSelectors = $ anScripts ['selectors ' ];
250
258
$ defaultSelectors = array ( 'an-Modal ' , 'reveal-modal ' , 'an-alternative ' );
251
- $ tfStyle = '' ;
259
+ $ tfStyle = '' ;
252
260
$ tfStyle .= $ an_option ->getOption ( 'an_alternative_custom_css ' );
253
261
$ tfStyle .= $ an_option ->getOption ( 'an_option_modal_custom_css ' );
254
262
$ anCSSFileContent = wp_remote_get ( $ anCSS );
255
263
$ anCSSFileContent = wp_remote_retrieve_body ( $ anCSSFileContent );
256
264
$ anCSSFileContent = str_replace ( $ defaultSelectors , $ newSelectors , $ anCSSFileContent . $ tfStyle );
257
- $ anJSFileContent = wp_remote_get ( $ anJS );
258
- $ anJSFileContent = wp_remote_retrieve_body ( $ anJSFileContent );
259
- $ anJSFileContent = str_replace ( $ defaultSelectors , $ newSelectors , $ anJSFileContent );
265
+ $ anJSFileContent = wp_remote_get ( $ anJS );
266
+ $ anJSFileContent = wp_remote_retrieve_body ( $ anJSFileContent );
267
+ $ anJSFileContent = str_replace ( $ defaultSelectors , $ newSelectors , $ anJSFileContent );
260
268
261
269
return '
262
270
<style type="text/css">
0 commit comments