@@ -36,15 +36,15 @@ function bootstrap() {
3636	 * @param bool $notify_async Whether to notify IndexNow asynchronously. 
3737	 *                           Default is false, meaning synchronous pings. 
3838	 */ 
39- 	$ notify_async  = apply_filters ( 'pwcc/index-now/notify-async ' , false  );
39+ 	$ notify_async  = apply_filters ( 'simple_search_submission_notify_async ' , false  );
4040
4141	if  ( $ notify_async  ) {
4242		// Use the async ping action. 
43- 		add_action ( 'pwcc/index-now/ping ' , __NAMESPACE__  . '\\async_ping_indexnow ' , 10 , 1  );
44- 		add_action ( 'pwcc/index-now/async_ping ' , __NAMESPACE__  . '\\ping_indexnow ' , 10 , 1  );
43+ 		add_action ( 'simple_search_submission_ping ' , __NAMESPACE__  . '\\async_ping_indexnow ' , 10 , 1  );
44+ 		add_action ( 'simple_search_submission_async_ping ' , __NAMESPACE__  . '\\ping_indexnow ' , 10 , 1  );
4545	} else  {
4646		// Use the synchronous ping action. 
47- 		add_action ( 'pwcc/index-now/ping ' , __NAMESPACE__  . '\\ping_indexnow ' , 10 , 1  );
47+ 		add_action ( 'simple_search_submission_ping ' , __NAMESPACE__  . '\\ping_indexnow ' , 10 , 1  );
4848	}
4949}
5050
@@ -55,7 +55,7 @@ function bootstrap() {
5555 * @return array Modified array of query vars. 
5656 */ 
5757function  register_query_vars ( $ vars  ) {
58- 	$ vars [] = 'pwcc_indexnow_key ' ;
58+ 	$ vars [] = 'simple_search_submission_key ' ;
5959	return  $ vars ;
6060}
6161
@@ -67,7 +67,7 @@ function add_key_rewrite_rule() {
6767
6868	add_rewrite_rule (
6969		'pwcc-indexnow- '  . $ key  . '$ ' ,
70- 		'index.php?pwcc_indexnow_key = '  . $ key ,
70+ 		'index.php?simple_search_submission_key = '  . $ key ,
7171		'top ' 
7272	);
7373}
@@ -78,13 +78,13 @@ function add_key_rewrite_rule() {
7878 * @param \WP $wp WordPress instance. 
7979 */ 
8080function  handle_key_file_request ( $ wp  ) {
81- 	if  ( empty ( $ wp ->query_vars ['pwcc_indexnow_key ' ] ) ) {
81+ 	if  ( empty ( $ wp ->query_vars ['simple_search_submission_key ' ] ) ) {
8282		return ;
8383	}
8484
8585	$ key  = get_indexnow_key ();
86- 	if  ( ! $ key  || $ wp ->query_vars ['pwcc_indexnow_key ' ] !== $ key  ) {
87- 		$ error  = 'Invalid key:  '  . get_query_var ( 'pwcc_indexnow_key '  );
86+ 	if  ( ! $ key  || $ wp ->query_vars ['simple_search_submission_key ' ] !== $ key  ) {
87+ 		$ error  = 'Invalid key:  '  . get_query_var ( 'simple_search_submission_key '  );
8888		wp_die ( esc_html ( $ error  ), 'IndexNow Key Error ' , array ( 'response '  => 403  ) );
8989		return ;
9090	}
@@ -106,14 +106,14 @@ function handle_key_file_request( $wp ) {
106106 * @return string Unique site key. 
107107 */ 
108108function  get_indexnow_key (): string  {
109- 	$ key  = get_option ( 'pwcc_indexnow_key '  );
109+ 	$ key  = get_option ( 'simple_search_submission_key '  );
110110
111111	if  ( ! $ key  ) {
112112		// Generate a random key that meets IndexNow requirements. 
113113		// Must be 8-128 hexadecimal characters (a-f, 0-9). 
114114		$ key  = strtolower ( wp_generate_password ( 32 , false , false  ) );
115115
116- 		update_option ( 'pwcc_indexnow_key ' , $ key  );
116+ 		update_option ( 'simple_search_submission_key ' , $ key  );
117117
118118		// Flush the rewrite rules. 
119119		flush_rewrite_rules ();
@@ -145,7 +145,7 @@ function maybe_ping_indexnow( $new_status, $old_status, $post ): void {
145145	 * @param string    $old_status     The old post status. 
146146	 * @param \WP_Post  $post           The post object. 
147147	 */ 
148- 	$ preflight_ping  = apply_filters ( 'pwcc/index-now/pre-maybe-ping-indexnow ' , null , $ new_status , $ old_status , $ post  );
148+ 	$ preflight_ping  = apply_filters ( 'simple_search_submission_pre_maybe_ping_indexnow ' , null , $ new_status , $ old_status , $ post  );
149149
150150	if  ( is_bool ( $ preflight_ping  ) ) {
151151		if  ( true  === $ preflight_ping  ) {
@@ -154,7 +154,7 @@ function maybe_ping_indexnow( $new_status, $old_status, $post ): void {
154154			 * 
155155			 * @param \WP_Post $post The post object. 
156156			 */ 
157- 			do_action ( 'pwcc/index-now/ping ' , $ post  );
157+ 			do_action ( 'simple_search_submission_ping ' , $ post  );
158158		}
159159		return ;
160160	}
@@ -203,7 +203,7 @@ function maybe_ping_indexnow( $new_status, $old_status, $post ): void {
203203	}
204204
205205	/** This action is documented in inc/namespace.php */ 
206- 	do_action ( 'pwcc/index-now/ping ' , $ post  );
206+ 	do_action ( 'simple_search_submission_ping ' , $ post  );
207207}
208208
209209/** 
@@ -223,7 +223,7 @@ function get_post_ping_urls( $post ) {
223223	}
224224
225225	// Get previous pings from the post meta. 
226- 	$ ping_urls  = get_post_meta ( $ post ->ID , '_pwcc_indexnow_urls ' , true  );
226+ 	$ ping_urls  = get_post_meta ( $ post ->ID , '_simple_search_submission_urls ' , true  );
227227	if  ( empty ( $ ping_urls  ) || ! is_array ( $ ping_urls  ) ) {
228228		// Initialize an empty array if no URLs are found. 
229229		$ ping_urls  = array ();
@@ -260,7 +260,7 @@ function add_post_ping_urls( $post, $urls ) {
260260		return ;
261261	}
262262
263- 	update_post_meta ( $ post ->ID , '_pwcc_indexnow_urls ' , $ ping_urls  );
263+ 	update_post_meta ( $ post ->ID , '_simple_search_submission_urls ' , $ ping_urls  );
264264}
265265
266266/** 
@@ -298,15 +298,15 @@ function ping_indexnow( $post ) {
298298	 *                        Default is an array with the single URL of the post. 
299299	 * @param \WP_Post $post The post object. 
300300	 */ 
301- 	$ url_list  = apply_filters ( 'pwcc/index-now/url-list ' , $ url_list , $ post  );
301+ 	$ url_list  = apply_filters ( 'simple_search_submission_url_list ' , $ url_list , $ post  );
302302
303303	if  ( empty ( $ url_list  ) ) {
304304		// If no URLs to ping, do nothing. 
305305		return ;
306306	}
307307
308308	if  ( empty ( get_option ( 'permalink_structure '  ) ) ) {
309- 		$ key_location  = home_url ( '?pwcc_indexnow_key = '  . $ key  );
309+ 		$ key_location  = home_url ( '?simple_search_submission_key = '  . $ key  );
310310	} else  {
311311		$ key_location  = trailingslashit ( home_url ( 'pwcc-indexnow- '  . $ key  ) );
312312	}
@@ -318,7 +318,7 @@ function ping_indexnow( $post ) {
318318	 * @param array   $url_list     The list if URLs to be submitted. 
319319	 * @param WP_Post $post         The post object. 
320320	 */ 
321- 	$ key_location  = apply_filters ( 'pwcc/index-now/key-location ' , $ key_location , $ url_list , $ post  );
321+ 	$ key_location  = apply_filters ( 'simple_search_submission_key_location ' , $ key_location , $ url_list , $ post  );
322322
323323	$ data     = array (
324324		'host '         => wp_parse_url ( $ key_location , PHP_URL_HOST  ),
@@ -350,7 +350,7 @@ function ping_indexnow( $post ) {
350350		 * @param \WP_Post $post     The post object 
351351		 * @param string[] $url_list The list of URLs to be pinged 
352352		 */ 
353- 		&& apply_filters ( 'pwcc/index-now/bypass-non-production-environment ' , true , $ post , $ url_list  )
353+ 		&& apply_filters ( 'simple_search_submission_bypass_non_production_environment ' , true , $ post , $ url_list  )
354354	) {
355355		// In development, log the request for debugging. 
356356		// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r 
@@ -396,7 +396,7 @@ function async_ping_indexnow( $post ) {
396396
397397	$ post_id  = $ post ->ID ;
398398
399- 	if  ( ! wp_next_scheduled ( 'pwcc/index-now/async_ping ' , array ( $ post_id  ) ) ) {
400- 		wp_schedule_single_event ( time () + 5 , 'pwcc/index-now/async_ping ' , array ( $ post_id  ) );
399+ 	if  ( ! wp_next_scheduled ( 'simple_search_submission_async_ping ' , array ( $ post_id  ) ) ) {
400+ 		wp_schedule_single_event ( time () + 5 , 'simple_search_submission_async_ping ' , array ( $ post_id  ) );
401401	}
402402}
0 commit comments