GC_Customize_Manager::doing_ajax()

最后更新于:2021-11-27 00:53:25

GC_Customize_Manager::doing_ajax( string|null$action=null)

响应 true if it’s an Ajax request.

参数

$action

(string|null) (Optional) Whether the supplied Ajax action is being run.

Default value: null

响应

(bool) True if it’s an Ajax request, false otherwise.

源文件

文件: gc-includes/class-gc-customize-manager.php

	public function doing_ajax( $action = null ) {
		if ( ! gc_doing_ajax() ) {
			return false;
		}

		if ( ! $action ) {
			return true;
		} else {
			/*
			 * Note: we can't just use doing_action( "gc_ajax_{$action}" ) because we need
			 * to check before admin-ajax.php gets to that point.
			 */
			return isset( $_REQUEST['action'] ) && gc_unslash( $_REQUEST['action'] ) === $action;
		}
	}