/** * Plugin Name: Ajax Content Renderer * Plugin URI: http://wordpress.org/plugins/ajax-content-renderer/ * Description: Detects Ajax requests and returns just the formatted body of the post or page. * Version: 1.3.4 * Author: Claude Betancourt * Author URI: http://claude.betancourt.us/ * * * LICENSE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Block direct requests if (!defined('ABSPATH')) die('-1'); if (!class_exists('BetancourtAjaxContent')) { class BetancourtAjaxContent { /** * Constructor * @return void */ function BetancourtAjaxContent() { } function detect($a) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !preg_match('|/wp-admin/|', $_SERVER['REQUEST_URI'])) { // parse post content foreach ($a as $post) { $content = apply_filters('the_content', $post->post_content); echo '