Skip to content
Permalink
Browse files

Do not call the "Ajax-template" directly, but go thruu the normal WP …

…flow.
  • Loading branch information
daniloercoli committed Apr 7, 2016
1 parent 898f236 commit 00ccc3a00070f8e9a46ca5f344d33e65a9ac2846
Showing with 17 additions and 24 deletions.
  1. +1 −1 UserAgentInfo.php
  2. +6 −6 commons.php
  3. +1 −1 header.php
  4. 0 validator.log
  5. +1 −7 xml-rpc-validator-ajax.php
  6. +2 −1 xml-rpc-validator.js
  7. +6 −8 xml-rpc-validator.php
@@ -31,7 +31,7 @@ class UserAgentInfo {
);

//The constructor. Initializes default variables.
function UserAgentInfo()
function __construct()
{
if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) )
$this->useragent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
@@ -55,9 +55,8 @@ class xml_rpc_validator_utils {
'405' => 'link to a support page, sticky forum post with steps to fix it',
'412' => 'link to a support page, sticky forum post with steps to fix it'
);

function xml_rpc_validator_utils()
{

function __construct() {
$this->xml_rpc_validator_errors = array(
'NO_RSD_FOUND' => array(
'code' => 1000000,
@@ -335,8 +334,9 @@ class Blog_Validator {

//The user agent to set on requestes
var $user_agent = USER_AGENT;

function Blog_Validator ($URL) {


function __construct($URL) {
$this->site_URL = $URL;
}

@@ -728,7 +728,7 @@ function setHTTPCredential ($user, $pass) {
$this->HTTP_auth_user_pass = $pass;
}

function wp_xmlrpc_client($URL, $timeout = false, $useragent = false) {
function __construct($URL, $timeout = false, $useragent = false) {
$this->URL = $URL;
$this->timeout = $timeout;

@@ -14,7 +14,7 @@
wp_enqueue_script('jquery');
wp_enqueue_script('xml-rpc-validator-script', constant( 'XMLRPC_VALIDATOR__PLUGIN_URL' ).'/xml-rpc-validator.js', array('jquery'));
// pass parameters to JavaScript
wp_localize_script('xml-rpc-validator-script', 'XML_RPC_Setting', array('plugin_url' => constant( 'XMLRPC_VALIDATOR__PLUGIN_URL' ).'/', 'nonce' => $nonce));
wp_localize_script('xml-rpc-validator-script', 'XML_RPC_Setting', array('plugin_url' => constant( 'XMLRPC_VALIDATOR__SITE_URL' ).'/', 'nonce' => $nonce));

if ( $ua_info->is_blackbeberry() ){ ?>
<!-- detected a BB device -->
No changes.
@@ -1,12 +1,6 @@
<?php
//TODO remove these lines in production
ini_set("display_errors", FALSE);
require_once 'commons.php';


if ( ! function_exists( 'add_action' ) ) {
require_once("../../../wp-config.php");
require_once 'commons.php';
}
$xml_rpc_validator_utils->logging_buffer = ''; //reset the logging buffer on each ajax request

// check security
@@ -130,11 +130,12 @@ var xml_rpc_validator = {

xml_rpc_validator.request = jq.ajax({
type: "POST",
url: XML_RPC_Setting.plugin_url + 'xml-rpc-validator-ajax.php',
url: XML_RPC_Setting.plugin_url,
timeout: 30000,
data: {
xmlrpc_url: url,
method_name : call_obj['xmlrpc_call'],
action : 'ajax_calls',
_ajax_nonce: XML_RPC_Setting.nonce,
user_login: jq( '#user_login').val(),
user_pass: jq( '#user_pass').val(),
@@ -9,13 +9,6 @@
Plugin URI:
*/

//TODO remove these lines in production
//ini_set("display_errors", TRUE);
/*enabling logging of errors*/
ini_set("log_errors", TRUE);
ini_set('display_startup_errors',TRUE);
error_reporting(E_ALL);

global $wp_version;
$exit_msg='XML-RPC validator requires WordPress 3.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>';
if (version_compare($wp_version,"3.0","<"))
@@ -28,6 +21,7 @@
*/
define( 'XMLRPC_VALIDATOR_PLUGIN_DIR', dirname( __FILE__ ) );
define( 'XMLRPC_VALIDATOR__PLUGIN_URL', plugins_url() . '/' . wp_basename( dirname( __FILE__ ) ) );
define( 'XMLRPC_VALIDATOR__SITE_URL', get_site_url() );

require_once 'commons.php';

@@ -36,7 +30,11 @@ function get_custom_page_template($single_template) {
// get our pageId
$pageId = $options['pageId'];
if (get_the_ID() === $pageId) {
$single_template = dirname( __FILE__ ) . '/page.php';
if( isset($_REQUEST['action']) && $_REQUEST['action'] == 'ajax_calls' ) {
$single_template = dirname( __FILE__ ) . '/xml-rpc-validator-ajax.php';
} else {
$single_template = dirname( __FILE__ ) . '/page.php';
}
}
return $single_template;
}

0 comments on commit 00ccc3a

Please sign in to comment.
You can’t perform that action at this time.