wp_doing_ajax example

$messenger_channel = sanitize_key( $input_vars['customize_messenger_channel'] );
    }

    /* * Note that settings must be previewed even outside the customizer preview * and also in the customizer pane itself. This is to enable loading an existing * changeset into the customizer. Previewing the settings only has to be prevented * here in the case of a customize_save action because this will cause WP to think * there is nothing changed that needs to be saved. */
    $is_customize_save_action = (
        wp_doing_ajax()
        &&
        isset( $_REQUEST['action'] )
        &&
        'customize_save' === wp_unslash( $_REQUEST['action'] )
    );
    $settings_previewed       = ! $is_customize_save_action;

    require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    $GLOBALS['wp_customize'] = new WP_Customize_Manager(
        compact(
            'changeset_uuid',
            
'total_items' => 0,
                'total_pages' => 0,
                'per_page'    => 0,
            )
        );

        if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
            $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
        }

        // Redirect if page number is invalid and headers are not already sent.         if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
            wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
            exit;
        }

        $this->_pagination_args = $args;
    }

    /** * Access the pagination args. * * @since 3.1.0 * * @param string $key Pagination argument to retrieve. Common values include 'total_items', * 'total_pages', 'per_page', or 'infinite_scroll'. * @return int Number of items that correspond to the given pagination argument. */
/** * Saves and restores user interface settings stored in a cookie. * * Checks if the current user-settings cookie is updated and stores it. When no * cookie exists (different browser used), adds the last saved cookie restoring * the settings. * * @since 2.7.0 */
function wp_user_settings() {

    if ( ! is_admin() || wp_doing_ajax() ) {
        return;
    }

    $user_id = get_current_user_id();
    if ( ! $user_id ) {
        return;
    }

    if ( ! is_user_member_of_blog() ) {
        return;
    }

    

    public function send() {
        header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
        echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
        foreach ( (array) $this->responses as $response ) {
            echo $response;
        }
        echo '</wp_ajax>';
        if ( wp_doing_ajax() ) {
            wp_die();
        } else {
            die();
        }
    }
}
flush_rewrite_rules();
    update_option( 'db_upgraded', false );

    /** * Fires on the next page load after a successful DB upgrade. * * @since 2.8.0 */
    do_action( 'after_db_upgrade' );

} elseif ( ! wp_doing_ajax() && empty( $_POST )
    && (int) get_option( 'db_version' ) !== $wp_db_version
) {

    if ( ! is_multisite() ) {
        wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
        exit;
    }

    /** * Filters whether to attempt to perform the multisite DB upgrade routine. * * In single site, the user would be redirected to wp-admin/upgrade.php. * In multisite, the DB upgrade routine is automatically fired, but only * when this filter returns true. * * If the network is 50 sites or less, it will run every time. Otherwise, * it will throttle itself to reduce load. * * @since MU (3.0.0) * * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true. */


    if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
        /* translators: %s: Maximum allowed file size in kilobytes. */
        $file['error'] = sprintf( __( 'This file is too big. Files must be less than %s KB in size.' )get_site_option( 'fileupload_maxk', 1500 ) );
    }

    if ( upload_is_user_over_quota( false ) ) {
        $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
    }

    if ( $file['error'] > 0 && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) {
        wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
    }

    return $file;
}

/** * Deletes a site. * * @since 3.0.0 * @since 5.1.0 Use wp_delete_site() internally to delete the site row from the database. * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $blog_id Site ID. * @param bool $drop True if site's database tables should be dropped. Default false. */
/** * Schedules the removal of all contents in the temporary backup directory. * * @since 6.3.0 */
function wp_delete_all_temp_backups() {
    /* * Check if there is a lock, or if currently performing an Ajax request, * in which case there is a chance an update is running. * Reschedule for an hour from now and exit early. */
    if ( get_option( 'core_updater.lock' ) || get_option( 'auto_updater.lock' ) || wp_doing_ajax() ) {
        wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_delete_temp_updater_backups' );
        return;
    }

    // This action runs on shutdown to make sure there are no plugin updates currently running.     add_action( 'shutdown', '_wp_delete_all_temp_backups' );
}

/** * Deletes all contents in the temporary backup directory. * * @since 6.3.0 * * @access private * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. * * @return void|WP_Error Void on success, or a WP_Error object on failure. */

function wp_die( $message = '', $title = '', $args = array() ) {
    global $wp_query;

    if ( is_int( $args ) ) {
        $args = array( 'response' => $args );
    } elseif ( is_int( $title ) ) {
        $args  = array( 'response' => $title );
        $title = '';
    }

    if ( wp_doing_ajax() ) {
        /** * Filters the callback for killing WordPress execution for Ajax requests. * * @since 3.4.0 * * @param callable $callback Callback function name. */
        $callback = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
    } elseif ( wp_is_json_request() ) {
        /** * Filters the callback for killing WordPress execution for JSON requests. * * @since 5.1.0 * * @param callable $callback Callback function name. */
$search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';

        $post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : '';

        $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : '';

        $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : '';
        $order   = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : '';

        $comments_per_page = $this->get_per_page( $comment_status );

        $doing_ajax = wp_doing_ajax();

        if ( isset( $_REQUEST['number'] ) ) {
            $number = (int) $_REQUEST['number'];
        } else {
            $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra.         }

        $page = $this->get_pagenum();

        if ( isset( $_REQUEST['start'] ) ) {
            $start = $_REQUEST['start'];
        }
return false;
        }

        $scheme     = $cookie_elements['scheme'];
        $username   = $cookie_elements['username'];
        $hmac       = $cookie_elements['hmac'];
        $token      = $cookie_elements['token'];
        $expired    = $cookie_elements['expiration'];
        $expiration = $cookie_elements['expiration'];

        // Allow a grace period for POST and Ajax requests.         if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) {
            $expired += HOUR_IN_SECONDS;
        }

        // Quick check to see if an honest cookie has expired.         if ( $expired < time() ) {
            /** * Fires once an authentication cookie has expired. * * @since 2.7.0 * * @param string[] $cookie_elements { * Authentication cookie components. None of the components should be assumed * to be valid as they come directly from a client-provided cookie value. * * @type string $username User's username. * @type string $expiration The time the cookie expires as a UNIX timestamp. * @type string $token User's session token used. * @type string $hmac The security hash for the cookie. * @type string $scheme The cookie scheme to use. * } */

function wp_dashboard_cached_rss_widget( $widget_id$callback$check_urls = array(), ...$args ) {
    $loading    = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
    $doing_ajax = wp_doing_ajax();

    if ( empty( $check_urls ) ) {
        $widgets = get_option( 'dashboard_widget_options' );

        if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) {
            echo $loading;
            return false;
        }

        $check_urls = array( $widgets[ $widget_id ]['url'] );
    }

    
if ( $ssl ) {
            $url = set_url_scheme( $url, 'https' );
        }

        $http_args = array(
            'timeout'    => 15,
            'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
        );
        $request   = wp_remote_get( $url$http_args );

        if ( $ssl && is_wp_error( $request ) ) {
            if ( ! wp_doing_ajax() ) {
                trigger_error(
                    sprintf(
                        /* translators: %s: Support forums URL. */
                        __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
                        __( 'https://wordpress.org/support/forums/' )
                    ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
                    headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
                );
            }
            $request = wp_remote_get( $http_url$http_args );
        }

        

        $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );

        $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );

        $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];

        $edit_link = get_edit_term_link( $tag$taxonomy$this->screen->post_type );

        if ( $edit_link ) {
            $edit_link = add_query_arg(
                'wp_http_referer',
                urlencode( wp_unslash( $uri ) ),
                $edit_link
            );
            $name      = sprintf(
                '<a class="row-title" href="%s" aria-label="%s">%s</a>',
                
if ( $log_path ) {
            ini_set( 'log_errors', 1 );
            ini_set( 'error_log', $log_path );
        }
    } else {
        error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
    }

    if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' )
        || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
        || wp_doing_ajax() || wp_is_json_request()
    ) {
        ini_set( 'display_errors', 0 );
    }
}

/** * Sets the location of the language directory. * * To set directory manually, define the `WP_LANG_DIR` constant * in wp-config.php. * * If the language directory exists within `WP_CONTENT_DIR`, it * is used. Otherwise the language directory is assumed to live * in `WPINC`. * * @since 3.0.0 * @access private */
/** * Returns true if it's an Ajax request. * * @since 3.4.0 * @since 4.2.0 Added `$action` param. * * @param string|null $action Whether the supplied Ajax action is being run. * @return bool True if it's an Ajax request, false otherwise. */
    public function doing_ajax( $action = null ) {
        if ( ! wp_doing_ajax() ) {
            return false;
        }

        if ( ! $action ) {
            return true;
        } else {
            /* * Note: we can't just use doing_action( "wp_ajax_{$action}" ) because we need * to check before admin-ajax.php gets to that point. */
            return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action;
        }
Home | Imprint | This part of the site doesn't use cookies.