@@ -79,10 +79,11 @@ public function __construct( $plugin_name, $version ) {
7979		$ this  ->version      = $ version ;
8080
8181		/** 
82- 		   * Define settings tabs 
83- 		   */ 
82+ 		 * Define settings tabs 
83+ 		 */ 
8484		$ this  ->settings_tabs  = apply_filters (
85- 			'rt_nginx_helper_settings_tabs ' , array (
85+ 			'rt_nginx_helper_settings_tabs ' ,
86+ 			array (
8687				'general '  => array (
8788					'menu_title '  => __ ( 'General ' , 'nginx-helper '  ),
8889					'menu_slug '   => 'general ' ,
@@ -153,7 +154,12 @@ public function enqueue_scripts( $hook ) {
153154			return ;
154155		}
155156
156- 		wp_enqueue_script ( $ this  ->plugin_name , plugin_dir_url ( __FILE__  ) . 'js/nginx-helper-admin.js ' , array ( 'jquery '  ), $ this  ->version , false  );
157+ 		wp_enqueue_script ( $ this  ->plugin_name , plugin_dir_url ( __FILE__  ) . 'js/nginx-helper-admin.js ' , array ( 'jquery '  ), $ this  ->version  );
158+ 
159+ 		$ do_localize  = array (
160+ 			'purge_confirm_string '  => esc_html__ ( 'Purging entire cache is not recommended. Would you like to continue? ' , 'nginx-helper '  ),
161+ 		);
162+ 		wp_localize_script ( $ this  ->plugin_name , 'nginx_helper ' , $ do_localize  );
157163
158164	}
159165
@@ -209,7 +215,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
209215			$ link_title         = __ ( 'Purge Current Page ' , 'nginx-helper '  );
210216		}
211217
212- 		$ purge_url    = add_query_arg (
218+ 		$ purge_url  = add_query_arg (
213219			array (
214220				'nginx_helper_action '  => 'purge ' ,
215221				'nginx_helper_urls '    => $ nginx_helper_urls ,
@@ -237,7 +243,7 @@ public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
237243	 * @since    2.0.0 
238244	 */ 
239245	public  function  nginx_helper_setting_page () {
240- 		include  plugin_dir_path (__FILE__  ) . 'partials/nginx-helper-admin-display.php ' ;
246+ 		include  plugin_dir_path (  __FILE__  ) . 'partials/nginx-helper-admin-display.php ' ;
241247	}
242248
243249	/** 
@@ -282,7 +288,14 @@ public function nginx_helper_default_settings() {
282288	 */ 
283289	public  function  nginx_helper_settings () {
284290
285- 		$ options  = get_site_option ( 'rt_wp_nginx_helper_options ' , array ( 'redis_hostname '  => '127.0.0.1 ' , 'redis_port '  => '6379 ' , 'redis_prefix '  => 'nginx-cache: '  ) );
291+ 		$ options  = get_site_option (
292+ 			'rt_wp_nginx_helper_options ' ,
293+ 			array (
294+ 				'redis_hostname '  => '127.0.0.1 ' ,
295+ 				'redis_port '      => '6379 ' ,
296+ 				'redis_prefix '    => 'nginx-cache: ' ,
297+ 			)
298+ 		);
286299
287300		$ data  = wp_parse_args (
288301			$ options ,
@@ -396,18 +409,16 @@ public function nginx_helper_get_feeds() {
396409					?> 
397410						<li role="listitem">
398411							<?php 
399- 							echo  wp_kses (
400- 								sprintf (
401- 									'<a href="%1$s" title="%2$s">%3$s</a> ' ,
402- 									esc_url ( $ item ->get_permalink () ), esc_attr__ ( 'Posted  ' , 'nginx-helper '  ) . esc_attr ( $ item ->get_date ( 'j F Y | g:i a '  ) ), esc_html ( $ item ->get_title () )
403- 								),
404- 								array ( 'strong '  => array (), 'a '  => array ( 'href '  => array (), 'title '  => array () ) )
405- 							);
412+ 								printf (
413+ 									'<a href="%s" title="%s">%s</a> ' ,
414+ 									esc_url ( $ item ->get_permalink () ),
415+ 									esc_attr__ ( 'Posted  ' , 'nginx-helper '  ) . esc_attr ( $ item ->get_date ( 'j F Y | g:i a '  ) ),
416+ 									esc_html ( $ item ->get_title () )
417+ 								);
406418							?> 
407419						</li>
408420					<?php 
409421				}
410- 
411422			}
412423			?> 
413424		</ul>
@@ -433,7 +444,7 @@ public function add_timestamps() {
433444
434445		foreach  ( headers_list () as  $ header  ) {
435446			list ( $ key , $ value  ) = explode ( ': ' , $ header , 2  );
436- 			$ key  = strtolower ( $ key  );
447+ 			$ key                   = strtolower ( $ key  );
437448			if  ( 'content-type '  === $ key  && strpos ( trim ( $ value  ), 'text/html '  ) !== 0  ) {
438449				return ;
439450			}
@@ -486,7 +497,7 @@ public function get_map() {
486497
487498			$ rt_all_blogs  = $ wpdb ->get_results (
488499				$ wpdb ->prepare (
489- 						 'SELECT blog_id, domain, path FROM  '  . $ wpdb ->blogs  . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' " ,
500+ 					'SELECT blog_id, domain, path FROM  '  . $ wpdb ->blogs  . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' " ,
490501					$ wpdb ->siteid 
491502				)
492503			);
@@ -513,19 +524,15 @@ public function get_map() {
513524						if  ( 1  !== $ blog ->blog_id  ) {
514525							$ rt_nginx_map_array [ $ blog ->path  ] = $ blog ->blog_id ;
515526						}
516- 
517527					}
518- 
519528				}
520- 
521529			}
522530
523531			if  ( $ rt_domain_map_sites  ) {
524532
525533				foreach  ( $ rt_domain_map_sites  as  $ site  ) {
526534					$ rt_nginx_map_array [ $ site ->domain  ] = $ site ->blog_id ;
527535				}
528- 
529536			}
530537
531538			foreach  ( $ rt_nginx_map_array  as  $ domain  => $ domain_id  ) {
@@ -547,11 +554,11 @@ public function update_map() {
547554
548555			$ rt_nginx_map  = $ this  ->get_map ();
549556
550- 			if  ( $ fp  = fopen ( $ this  ->functional_asset_path () . 'map.conf ' , 'w+ '  ) ) {
557+ 			$ fp  = fopen ( $ this  ->functional_asset_path () . 'map.conf ' , 'w+ '  );
558+ 			if  ( $ fp  ) {
551559				fwrite ( $ fp , $ rt_nginx_map  );
552560				fclose ( $ fp  );
553561			}
554- 
555562		}
556563
557564	}
@@ -586,11 +593,11 @@ public function set_future_post_option_on_future_status( $new_status, $old_statu
586593		if  (
587594			'future '  === $ new_status  && $ post  && 'future '  === $ post ->post_status  &&
588595			(
589- 		         ( 'post '  === $ post ->post_type  || 'page '  === $ post ->post_type  ) ||
590- 		         (
591- 		         	isset ( $ this  ->options ['custom_post_types_recognized ' ] ) &&
592- 		             in_array ( $ post ->post_type , $ this  ->options ['custom_post_types_recognized ' ], true  )
593- 		         )
596+ 				 ( 'post '  === $ post ->post_type  || 'page '  === $ post ->post_type  ) ||
597+ 				 (
598+ 				 	isset ( $ this  ->options ['custom_post_types_recognized ' ] ) &&
599+ 					 in_array ( $ post ->post_type , $ this  ->options ['custom_post_types_recognized ' ], true  )
600+ 				 )
594601			)
595602		) {
596603
0 commit comments