Skip to content
Snippets Groups Projects
Select Git revision
  • 0f3c2593cc302ed44ebd39423a5e591b86916d17
  • noblogs default
  • noblogs-5.7.1
  • upstream
  • noblogs-5.7
  • noblogs-5.6new
  • upstream5.5.1
  • noblogs28dic
  • upstream28dic
  • noblogs-5.5.1
  • noblogs-5.4.2
  • noblogs-5.4_seconda
  • noblogs-5.4
  • noblogs-7c
  • wp5.2.3p3
  • mergedbconf
  • noblogs-5.7.1
  • noblogs.5.7.0p1
  • noblogs-5.7.0
  • noblogs-5.6p3
  • noblogs5.6p2
  • noblogs-5.6p1
  • noblogs-5.6
  • noblogs-5.4.2p1
  • noblogs-5.4.2
  • noblogs-5.4.1
  • noblogs-5.4
  • noblogs-p5.4
  • noblogs-5.3.2p2
  • noblogs-5.3.2p1
  • noblogs-5.3.2
  • noblogs-5.3
  • noblogs-5.2.3p4
  • noblogs-5.2.3p3
  • noblogs-5.2.3p2
  • noblogs-5.2.3p1
36 results

jquery.socialshareprivacy.min.autoload.js

Blame
  • class-wp-http-requests-hooks.php 1.91 KiB
    <?php
    /**
     * HTTP API: Requests hook bridge class
     *
     * @package WordPress
     * @subpackage HTTP
     * @since 4.7.0
     */
    
    /**
     * Bridge to connect Requests internal hooks to WordPress actions.
     *
     * @since 4.7.0
     *
     * @see Requests_Hooks
     */
    class WP_HTTP_Requests_Hooks extends Requests_Hooks {
    	/**
    	 * Requested URL.
    	 *
    	 * @var string Requested URL.
    	 */
    	protected $url;
    
    	/**
    	 * WordPress WP_HTTP request data.
    	 *
    	 * @var array Request data in WP_Http format.
    	 */
    	protected $request = array();
    
    	/**
    	 * Constructor.
    	 *
    	 * @param string $url     URL to request.
    	 * @param array  $request Request data in WP_Http format.
    	 */
    	public function __construct( $url, $request ) {
    		$this->url     = $url;
    		$this->request = $request;
    	}
    
    	/**
    	 * Dispatch a Requests hook to a native WordPress action.
    	 *
    	 * @param string $hook       Hook name.
    	 * @param array  $parameters Parameters to pass to callbacks.
    	 * @return bool True if hooks were run, false if nothing was hooked.
    	 */
    	public function dispatch( $hook, $parameters = array() ) {
    		$result = parent::dispatch( $hook, $parameters );
    
    		// Handle back-compat actions.
    		switch ( $hook ) {
    			case 'curl.before_send':
    				/** This action is documented in wp-includes/class-wp-http-curl.php */
    				do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) );
    				break;
    		}
    
    		/**
    		 * Transforms a native Request hook to a WordPress actions.
    		 *
    		 * This action maps Requests internal hook to a native WordPress action.
    		 *
    		 * @see https://github.com/rmccue/Requests/blob/master/docs/hooks.md
    		 *
    		 * @param array $parameters Parameters from Requests internal hook.
    		 * @param array $request Request data in WP_Http format.
    		 * @param string $url URL to request.
    		 */
    		do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    
    		return $result;
    	}
    }