WPSEO_Shortcode_Filter

Class WPSEO_Shortcode_Filter.

Defined (1)

The class is defined in the following location(s).

/admin/ajax/class-shortcode-filter.php  
  1. class WPSEO_Shortcode_Filter { 
  2.  
  3. /** 
  4. * Initialize the AJAX hooks 
  5. */ 
  6. public function __construct() { 
  7. add_action( 'wp_ajax_wpseo_filter_shortcodes', array( $this, 'do_filter' ) ); 
  8.  
  9. /** 
  10. * Parse the shortcodes 
  11. */ 
  12. public function do_filter() { 
  13. check_ajax_referer( 'wpseo-filter-shortcodes', 'nonce' ); 
  14.  
  15. $shortcodes = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); 
  16.  
  17. $parsed_shortcodes = array(); 
  18.  
  19. foreach ( $shortcodes as $shortcode ) { 
  20. $parsed_shortcodes[] = array( 
  21. 'shortcode' => $shortcode,  
  22. 'output' => do_shortcode( $shortcode ),  
  23. ); 
  24.  
  25. wp_die( wp_json_encode( $parsed_shortcodes ) );