| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace BulkWP\BulkDelete\Core\Terms; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | use BulkWP\BulkDelete\Core\Base\BaseModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | defined( 'ABSPATH' ) || exit; // Exit if accessed directly. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * Module for deleting terms. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * @since 6.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | abstract class TermsModule extends BaseModule { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	 * Build query params for WP_Query by using delete options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	 * Return an empty query array to short-circuit deletion. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	 * @param array $options Delete options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * @return array Query. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	abstract protected function build_query( $options ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	protected $item_type = 'terms'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	 * Handle common filters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	 * @param array $request Request array. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	 * @return array User options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	protected function parse_common_filters( $request ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		$options = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 		$options['restrict']     = bd_array_get_bool( $request, 'smbd_' . $this->field_slug . '_restrict', false ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 		$options['limit_to']     = absint( bd_array_get( $request, 'smbd_' . $this->field_slug . '_limit_to', 0 ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		$options['force_delete'] = bd_array_get_bool( $request, 'smbd_' . $this->field_slug . '_force_delete', false ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		$options['date_op'] = bd_array_get( $request, 'smbd_' . $this->field_slug . '_op' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		$options['days']    = absint( bd_array_get( $request, 'smbd_' . $this->field_slug . '_days' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 		return $options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	public function filter_js_array( $js_array ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		$js_array['msg']['deletePostsWarning'] = __( 'Are you sure you want to delete all the posts based on the selected option?', 'bulk-delete' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		$js_array['msg']['selectPostOption']   = __( 'Please select posts from at least one option', 'bulk-delete' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		return $js_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	protected function do_delete( $options ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$query = $this->build_query( $options ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		if ( empty( $query ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 			// Short circuit deletion, if nothing needs to be deleted. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 			return 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		return $this->delete_posts_from_query( $query, $options ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	 * Build the query using query params and then Delete posts. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	 * @param array $query   Params for WP Query. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 * @param array $options Delete Options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	 * @return int Number of posts deleted. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  | 	protected function delete_posts_from_query( $query, $options ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  | 		$query    = bd_build_query_options( $options, $query ); | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  | 		$post_ids = bd_query( $query ); | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  | 		return $this->delete_posts_by_id( $post_ids, $options['force_delete'] ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	 * Render the "private post" setting fields. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	protected function render_private_post_settings() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 		bd_render_private_post_settings( $this->field_slug ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	 | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 88 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 89 |  |  |  | 
            
                        
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.