• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Akismet::pre_check_pingback() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet::pre_check_pingback( $method );

Parameters

$method
( mixed ) required –

Returns

void

Source

File name: akismet/class.akismet.php
Lines:

1 to 46 of 46
  public static function pre_check_pingback( $method ) {
    if ( $method !== 'pingback.ping' )
      return;

    global $wp_xmlrpc_server;
  
    if ( !is_object( $wp_xmlrpc_server ) )
      return false;
  
    // Lame: tightly coupled with the IXR class.
    $args = $wp_xmlrpc_server->message->params;
  
    if ( !empty( $args[1] ) ) {
      $post_id = url_to_postid( $args[1] );

      // If pingbacks aren't open on this post, we'll still check whether this request is part of a potential DDOS,
      // but indicate to the server that pingbacks are indeed closed so we don't include this request in the user's stats,
      // since the user has already done their part by disabling pingbacks.
      $pingbacks_closed = false;
      
      $post = get_post( $post_id );
      
      if ( ! $post || ! pings_open( $post ) ) {
        $pingbacks_closed = true;
      }

      $comment = array(
        'comment_author_url' => $args[0],
        'comment_post_ID' => $post_id,
        'comment_author' => '',
        'comment_author_email' => '',
        'comment_content' => '',
        'comment_type' => 'pingback',
        'akismet_pre_check' => '1',
        'comment_pingback_target' => $args[1],
        'pingbacks_closed' => $pingbacks_closed ? '1' : '0',
      );

      $comment = Akismet::auto_check_comment( $comment );

      if ( isset( $comment['akismet_result'] ) && 'true' == $comment['akismet_result'] ) {
        // Lame: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything.
        $wp_xmlrpc_server->error( new IXR_Error( 0, 'Invalid discovery target' ) );
      }
    }
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: Akismet::pre_check_pingback
Class ref: Akismet
Plugin ref: Akismet
Version: 4.1.7
Sourcefile: class.akismet.php
File ref: class.akismet.php
Deprecated?: No
API Letters: A,C,P

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6. PHP: 7.3.26
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites