�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135
0x0x
PHP 8.2.31
Preview: FreemiusWordPress.php Size: 21.83 KB
/home/m/c/i/mciraet/www/wp-content/plugins/shortcodes-ultimate/freemius/includes/sdk/FreemiusWordPress.php
<?php
	/**
	 * Copyright 2016 Freemius, Inc.
	 *
	 * Licensed under the GPL v2 (the "License"); you may
	 * not use this file except in compliance with the License. You may obtain
	 * a copy of the License at
	 *
	 *     http://choosealicense.com/licenses/gpl-v2/
	 *
	 * Unless required by applicable law or agreed to in writing, software
	 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
	 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
	 * License for the specific language governing permissions and limitations
	 * under the License.
	 */
    if ( ! defined( 'ABSPATH' ) ) {
        exit;
    }

	require_once dirname( __FILE__ ) . '/FreemiusBase.php';

	if ( ! defined( 'FS_SDK__USER_AGENT' ) ) {
		define( 'FS_SDK__USER_AGENT', 'fs-php-' . Freemius_Api_Base::VERSION );
	}

	if ( ! defined( 'FS_SDK__SIMULATE_NO_CURL' ) ) {
		define( 'FS_SDK__SIMULATE_NO_CURL', false );
	}

	if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
		define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
	}

	if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
		define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
	}

	if ( ! defined( 'FS_SDK__HAS_CURL' ) ) {
		if ( FS_SDK__SIMULATE_NO_CURL ) {
			define( 'FS_SDK__HAS_CURL', false );
		} else {
			$curl_required_methods = array(
				'curl_version',
				'curl_exec',
				'curl_init',
				'curl_close',
				'curl_setopt',
				'curl_setopt_array',
				'curl_error',
			);

			$has_curl = true;
			foreach ( $curl_required_methods as $m ) {
				if ( ! function_exists( $m ) ) {
					$has_curl = false;
					break;
				}
			}

			define( 'FS_SDK__HAS_CURL', $has_curl );
		}
	}

    if ( ! defined( 'FS_SDK__SSLVERIFY' ) ) {
        define( 'FS_SDK__SSLVERIFY', false );
    }

	$curl_version = FS_SDK__HAS_CURL ?
		curl_version() :
		array( 'version' => '7.37' );

	if ( ! defined( 'FS_API__PROTOCOL' ) ) {
		define( 'FS_API__PROTOCOL', version_compare( $curl_version['version'], '7.37', '>=' ) ? 'https' : 'http' );
	}

	if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
		define( 'FS_API__LOGGER_ON', false );
	}

	if ( ! defined( 'FS_API__ADDRESS' ) ) {
		define( 'FS_API__ADDRESS', '://api.freemius.com' );
	}
	if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
		define( 'FS_API__SANDBOX_ADDRESS', '://sandbox-api.freemius.com' );
	}

	if ( ! class_exists( 'Freemius_Api_WordPress' ) ) {
	class Freemius_Api_WordPress extends Freemius_Api_Base {
		private static $_logger = array();

		/**
		 * @param string      $pScope   'app', 'developer', 'user' or 'install'.
		 * @param number      $pID      Element's id.
		 * @param string      $pPublic  Public key.
		 * @param string|bool $pSecret  Element's secret key.
		 * @param bool        $pSandbox Whether or not to run API in sandbox mode.
		 */
		public function __construct( $pScope, $pID, $pPublic, $pSecret = false, $pSandbox = false ) {
			// If secret key not provided, use public key encryption.
			if ( is_bool( $pSecret ) ) {
				$pSecret = $pPublic;
			}

			parent::Init( $pScope, $pID, $pPublic, $pSecret, $pSandbox );
		}

		public static function GetUrl( $pCanonizedPath = '', $pIsSandbox = false ) {
			$address = ( $pIsSandbox ? FS_API__SANDBOX_ADDRESS : FS_API__ADDRESS );

			if ( ':' === $address[0] ) {
				$address = self::$_protocol . $address;
			}

			return $address . $pCanonizedPath;
		}

		#----------------------------------------------------------------------------------
		#region Servers Clock Diff
		#----------------------------------------------------------------------------------

		/**
		 * @var int Clock diff in seconds between current server to API server.
		 */
		private static $_clock_diff = 0;

		/**
		 * Set clock diff for all API calls.
		 *
		 * @since 1.0.3
		 *
		 * @param $pSeconds
		 */
		public static function SetClockDiff( $pSeconds ) {
			self::$_clock_diff = $pSeconds;
		}

		/**
		 * Find clock diff between current server to API server.
		 *
		 * @since 1.0.2
		 * @return int Clock diff in seconds.
		 */
		public static function FindClockDiff() {
			$time = time();
			$pong = self::Ping();

			return ( $time - strtotime( $pong->timestamp ) );
		}

		#endregion

		/**
		 * @var string http or https
		 */
		private static $_protocol = FS_API__PROTOCOL;

		/**
		 * Set API connection protocol.
		 *
		 * @since 1.0.4
		 */
		public static function SetHttp() {
			self::$_protocol = 'http';
		}

        /**
         * Sets API connection protocol to HTTPS.
         *
         * @since 2.5.4
         */
        public static function SetHttps() {
            self::$_protocol = 'https';
        }

		/**
		 * @since 1.0.4
		 *
		 * @return bool
		 */
		public static function IsHttps() {
			return ( 'https' === self::$_protocol );
		}

		/**
		 * Sign request with the following HTTP headers:
		 *      Content-MD5: MD5(HTTP Request body)
		 *      Date: Current date (i.e Sat, 14 Feb 2016 20:24:46 +0000)
		 *      Authorization: FS {scope_entity_id}:{scope_entity_public_key}:base64encode(sha256(string_to_sign,
		 *      {scope_entity_secret_key}))
		 *
		 * @param string $pResourceUrl
		 * @param array  $pWPRemoteArgs
		 *
		 * @return array
		 */
		function SignRequest( $pResourceUrl, $pWPRemoteArgs ) {
			$auth = $this->GenerateAuthorizationParams(
				$pResourceUrl,
				$pWPRemoteArgs['method'],
				! empty( $pWPRemoteArgs['body'] ) ? $pWPRemoteArgs['body'] : ''
			);

			$pWPRemoteArgs['headers']['Date']          = $auth['date'];
			$pWPRemoteArgs['headers']['Authorization'] = $auth['authorization'];

			if ( ! empty( $auth['content_md5'] ) ) {
				$pWPRemoteArgs['headers']['Content-MD5'] = $auth['content_md5'];
			}

			return $pWPRemoteArgs;
		}

		/**
		 * Generate Authorization request headers:
		 *
		 *      Content-MD5: MD5(HTTP Request body)
		 *      Date: Current date (i.e Sat, 14 Feb 2016 20:24:46 +0000)
		 *      Authorization: FS {scope_entity_id}:{scope_entity_public_key}:base64encode(sha256(string_to_sign,
		 *      {scope_entity_secret_key}))
		 *
		 * @author Vova Feldman
		 *
		 * @param string $pResourceUrl
		 * @param string $pMethod
		 * @param string $pPostParams
		 *
		 * @return array
		 * @throws Freemius_Exception
		 */
		function GenerateAuthorizationParams(
			$pResourceUrl,
			$pMethod = 'GET',
			$pPostParams = ''
		) {
			$pMethod = strtoupper( $pMethod );

			$eol          = "\n";
			$content_md5  = '';
			$content_type = '';
			$now          = ( time() - self::$_clock_diff );
			$date         = date( 'r', $now );

			if ( in_array( $pMethod, array( 'POST', 'PUT' ) ) ) {
                $content_type = 'application/json';

                if ( ! empty( $pPostParams ) ) {
                    $content_md5 = md5( $pPostParams );
                }
            }

			$string_to_sign = implode( $eol, array(
				$pMethod,
				$content_md5,
				$content_type,
				$date,
				$pResourceUrl
			) );

			// If secret and public keys are identical, it means that
			// the signature uses public key hash encoding.
			$auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP';

			$auth = array(
				'date'          => $date,
				'authorization' => $auth_type . ' ' . $this->_id . ':' .
				                   $this->_public . ':' .
				                   self::Base64UrlEncode( hash_hmac(
					                   'sha256', $string_to_sign, $this->_secret
				                   ) )
			);

			if ( ! empty( $content_md5 ) ) {
				$auth['content_md5'] = $content_md5;
			}

			return $auth;
		}

		/**
		 * Get API request URL signed via query string.
         *
         * @since 1.2.3 Stopped using http_build_query(). Instead, use urlencode(). In some environments the encoding of http_build_query() can generate a URL that once used with a redirect, the `&` querystring separator is escaped to `&amp;` which breaks the URL (Added by @svovaf).
		 *
		 * @param string $pPath
		 *
		 * @throws Freemius_Exception
		 *
		 * @return string
		 */
        function GetSignedUrl( $pPath ) {
            $resource     = explode( '?', $this->CanonizePath( $pPath ) );
            $pResourceUrl = $resource[0];

            $auth = $this->GenerateAuthorizationParams( $pResourceUrl );

            return Freemius_Api_WordPress::GetUrl(
                $pResourceUrl . '?' .
                ( 1 < count( $resource ) && ! empty( $resource[1] ) ? $resource[1] . '&' : '' ) .
                'authorization=' . urlencode( $auth['authorization'] ) .
                '&auth_date=' . urlencode( $auth['date'] )
                , $this->_isSandbox );
        }

		/**
		 * @author Vova Feldman
		 *
		 * @param string $pUrl
		 * @param array  $pWPRemoteArgs
		 *
		 * @return mixed
		 */
		private static function ExecuteRequest( $pUrl, &$pWPRemoteArgs ) {
            $bt = debug_backtrace();

			$start = microtime( true );

            $response = self::RemoteRequest( $pUrl, $pWPRemoteArgs );

			if ( FS_API__LOGGER_ON ) {
				$end = microtime( true );

				$has_body      = ( isset( $pWPRemoteArgs['body'] ) && ! empty( $pWPRemoteArgs['body'] ) );
				$is_http_error = is_wp_error( $response );

				self::$_logger[] = array(
					'id'        => count( self::$_logger ),
					'start'     => $start,
					'end'       => $end,
					'total'     => ( $end - $start ),
					'method'    => $pWPRemoteArgs['method'],
					'path'      => $pUrl,
					'body'      => $has_body ? $pWPRemoteArgs['body'] : null,
					'result'    => ! $is_http_error ?
						$response['body'] :
						json_encode( $response->get_error_messages() ),
					'code'      => ! $is_http_error ? $response['response']['code'] : null,
					'backtrace' => $bt,
				);
			}

			return $response;
		}

        /**
         * @author Leo Fajardo (@leorw)
         *
         * @param string $pUrl
         * @param array  $pWPRemoteArgs
         *
         * @return array|WP_Error The response array or a WP_Error on failure.
         */
        static function RemoteRequest( $pUrl, $pWPRemoteArgs ) {
            $response = wp_remote_request( $pUrl, $pWPRemoteArgs );

            if (
                is_array( $response ) &&
                (
                    empty( $response['headers'] ) ||
                    empty( $response['headers']['x-api-server'] )
                )
            ) {
                // API is considered blocked if the response doesn't include the `x-api-server` header. When there's no error but this header doesn't exist, the response is usually not in the expected form (e.g., cannot be JSON-decoded).
                $response = new WP_Error( 'api_blocked', htmlentities( $response['body'] ) );
            }

            return $response;
        }

		/**
		 * @return array
		 */
		static function GetLogger() {
			return self::$_logger;
		}

		/**
		 * @param string        $pCanonizedPath
		 * @param string        $pMethod
		 * @param array         $pParams
		 * @param null|array    $pWPRemoteArgs
		 * @param bool          $pIsSandbox
		 * @param null|callable $pBeforeExecutionFunction
		 *
		 * @return object[]|object|null
		 *
		 * @throws \Freemius_Exception
		 */
		private static function MakeStaticRequest(
			$pCanonizedPath,
			$pMethod = 'GET',
			$pParams = array(),
			$pWPRemoteArgs = null,
			$pIsSandbox = false,
			$pBeforeExecutionFunction = null
		) {
			// Connectivity errors simulation.
			if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
				self::ThrowCloudFlareDDoSException();
			} else if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
				self::ThrowSquidAclException();
			}

			if ( empty( $pWPRemoteArgs ) ) {
				$user_agent = 'Freemius/WordPress-SDK/' . Freemius_Api_Base::VERSION . '; ' .
				              home_url();

				$pWPRemoteArgs = array(
					'method'           => strtoupper( $pMethod ),
					'connect_timeout'  => 10,
					'timeout'          => 60,
					'follow_redirects' => true,
					'redirection'      => 5,
					'user-agent'       => $user_agent,
					'blocking'         => true,
				);
			}

			if ( ! isset( $pWPRemoteArgs['headers'] ) ||
			     ! is_array( $pWPRemoteArgs['headers'] )
			) {
				$pWPRemoteArgs['headers'] = array();
			}

			if ( in_array( $pMethod, array( 'POST', 'PUT' ) ) ) {
                $pWPRemoteArgs['headers']['Content-type'] = 'application/json';

                if ( is_array( $pParams ) && 0 < count( $pParams ) ) {
                    $pWPRemoteArgs['body'] = json_encode( $pParams );
                }
			}

			$request_url = self::GetUrl( $pCanonizedPath, $pIsSandbox );

			$resource = explode( '?', $pCanonizedPath );

            if ( FS_SDK__HAS_CURL ) {
                // Disable the 'Expect: 100-continue' behaviour. This causes cURL to wait
                // for 2 seconds if the server does not support this header.
                $pWPRemoteArgs['headers']['Expect'] = '';
            }

			if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) {
				$pWPRemoteArgs['sslverify'] = FS_SDK__SSLVERIFY;
			}

			if ( false !== $pBeforeExecutionFunction &&
			     is_callable( $pBeforeExecutionFunction )
			) {
				$pWPRemoteArgs = call_user_func( $pBeforeExecutionFunction, $resource[0], $pWPRemoteArgs );
			}

			$result = self::ExecuteRequest( $request_url, $pWPRemoteArgs );

			if ( is_wp_error( $result ) ) {
				/**
				 * @var WP_Error $result
				 */
				if ( self::IsCurlError( $result ) ) {
					/**
					 * With dual stacked DNS responses, it's possible for a server to
					 * have IPv6 enabled but not have IPv6 connectivity.  If this is
					 * the case, cURL will try IPv4 first and if that fails, then it will
					 * fall back to IPv6 and the error EHOSTUNREACH is returned by the
					 * operating system.
					 */
					$matches = array();
					$regex   = '/Failed to connect to ([^:].*): Network is unreachable/';
					if ( preg_match( $regex, $result->get_error_message( 'http_request_failed' ), $matches ) ) {
						/**
						 * Validate IP before calling `inet_pton()` to avoid PHP un-catchable warning.
						 * @author Vova Feldman (@svovaf)
						 */
						if ( filter_var( $matches[1], FILTER_VALIDATE_IP ) ) {
							if ( strlen( inet_pton( $matches[1] ) ) === 16 ) {
								/**
								 * error_log('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.');
								 * Hook to an action triggered just before cURL is executed to resolve the IP version to v4.
								 * 
								 * @phpstan-ignore-next-line
								 */
								add_action( 'http_api_curl', 'Freemius_Api_WordPress::CurlResolveToIPv4', 10, 1 );

								// Re-run request.
								$result = self::ExecuteRequest( $request_url, $pWPRemoteArgs );
							}
						}
					}
				}

				if ( is_wp_error( $result ) ) {
					self::ThrowWPRemoteException( $result );
				}
			}

			$response_body = $result['body'];

			if ( empty( $response_body ) ) {
				return null;
			}

			$decoded = json_decode( $response_body );

			if ( is_null( $decoded ) ) {
				if ( preg_match( '/Please turn JavaScript on/i', $response_body ) &&
				     preg_match( '/text\/javascript/', $response_body )
				) {
					self::ThrowCloudFlareDDoSException( $response_body );
				} else if ( preg_match( '/Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect./', $response_body ) &&
				            preg_match( '/squid/', $response_body )
				) {
					self::ThrowSquidAclException( $response_body );
				} else {
					$decoded = (object) array(
						'error' => (object) array(
							'type'    => 'Unknown',
							'message' => $response_body,
							'code'    => 'unknown',
							'http'    => 402
						)
					);
				}
			}

			return $decoded;
		}


		/**
		 * Makes an HTTP request. This method can be overridden by subclasses if
		 * developers want to do fancier things or use something other than wp_remote_request()
		 * to make the request.
		 *
		 * @param string     $pCanonizedPath The URL to make the request to
		 * @param string     $pMethod        HTTP method
		 * @param array      $pParams        The parameters to use for the POST body
		 * @param null|array $pWPRemoteArgs  wp_remote_request options.
		 *
		 * @return object[]|object|null
		 *
		 * @throws Freemius_Exception
		 */
		public function MakeRequest(
			$pCanonizedPath,
			$pMethod = 'GET',
			$pParams = array(),
			$pWPRemoteArgs = null
		) {
			$resource = explode( '?', $pCanonizedPath );

			// Only sign request if not ping.json connectivity test.
			$sign_request = ( '/v1/ping.json' !== strtolower( substr( $resource[0], - strlen( '/v1/ping.json' ) ) ) );

			return self::MakeStaticRequest(
				$pCanonizedPath,
				$pMethod,
				$pParams,
				$pWPRemoteArgs,
				$this->_isSandbox,
				$sign_request ? array( &$this, 'SignRequest' ) : null
			);
		}

		/**
		 * Sets CURLOPT_IPRESOLVE to CURL_IPRESOLVE_V4 for cURL-Handle provided as parameter
		 *
		 * @param resource $handle A cURL handle returned by curl_init()
		 *
		 * @return resource $handle A cURL handle returned by curl_init() with CURLOPT_IPRESOLVE set to
		 *                  CURL_IPRESOLVE_V4
		 *
		 * @link https://gist.github.com/golderweb/3a2aaec2d56125cc004e
		 */
		static function CurlResolveToIPv4( $handle ) {
			curl_setopt( $handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );

			return $handle;
		}

		#----------------------------------------------------------------------------------
		#region Connectivity Test
		#----------------------------------------------------------------------------------

        /**
         * This method exists only for backward compatibility to prevent a fatal error from happening when called from an outdated piece of code.
         *
         * @param mixed $pPong
         *
         * @return bool
         */
        public static function Test( $pPong = null ) {
            return (
                is_object( $pPong ) &&
                isset( $pPong->api ) &&
                'pong' === $pPong->api
            );
        }

		/**
		 * Ping API to test connectivity.
		 *
		 * @return object
		 */
		public static function Ping() {
			try {
				$result = self::MakeStaticRequest( '/v' . FS_API__VERSION . '/ping.json' );
			} catch ( Freemius_Exception $e ) {
				// Map to error object.
				$result = (object) $e->getResult();
			} catch ( Exception $e ) {
				// Map to error object.
				$result = (object) array(
					'error' => (object) array(
						'type'    => 'Unknown',
						'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
						'code'    => 'unknown',
						'http'    => 402
					)
				);
			}

			return $result;
		}

		#endregion

		#----------------------------------------------------------------------------------
		#region Connectivity Exceptions
		#----------------------------------------------------------------------------------

		/**
		 * @param \WP_Error $pError
		 *
		 * @return bool
		 */
		private static function IsCurlError( WP_Error $pError ) {
			$message = $pError->get_error_message( 'http_request_failed' );

			return ( 0 === strpos( $message, 'cURL' ) );
		}

		/**
		 * @param WP_Error $pError
		 *
		 * @throws Freemius_Exception
		 */
		private static function ThrowWPRemoteException( WP_Error $pError ) {
			if ( self::IsCurlError( $pError ) ) {
				$message = $pError->get_error_message( 'http_request_failed' );

				#region Check if there are any missing cURL methods.

				$curl_required_methods = array(
					'curl_version',
					'curl_exec',
					'curl_init',
					'curl_close',
					'curl_setopt',
					'curl_setopt_array',
					'curl_error',
				);

				// Find all missing methods.
				$missing_methods = array();
				foreach ( $curl_required_methods as $m ) {
					if ( ! function_exists( $m ) ) {
						$missing_methods[] = $m;
					}
				}

				if ( ! empty( $missing_methods ) ) {
					throw new Freemius_Exception( array(
						'error'           => (object) array(
							'type'    => 'cUrlMissing',
							'message' => $message,
							'code'    => 'curl_missing',
							'http'    => 402
						),
						'missing_methods' => $missing_methods,
					) );
				}

				#endregion

				// cURL error - "cURL error {{errno}}: {{error}}".
				$parts = explode( ':', substr( $message, strlen( 'cURL error ' ) ), 2 );

				$code    = ( 0 < count( $parts ) ) ? $parts[0] : 'http_request_failed';
				$message = ( 1 < count( $parts ) ) ? $parts[1] : $message;

				$e = new Freemius_Exception( array(
					'error' => (object) array(
						'code'    => $code,
						'message' => $message,
						'type'    => 'CurlException',
					),
				) );
			} else {
				$e = new Freemius_Exception( array(
					'error' => (object) array(
						'code'    => $pError->get_error_code(),
						'message' => $pError->get_error_message(),
						'type'    => 'WPRemoteException',
					),
				) );
			}

			throw $e;
		}

		/**
		 * @param string $pResult
		 *
		 * @throws Freemius_Exception
		 */
		private static function ThrowCloudFlareDDoSException( $pResult = '' ) {
			throw new Freemius_Exception( array(
				'error' => (object) array(
					'type'    => 'CloudFlareDDoSProtection',
					'message' => $pResult,
					'code'    => 'cloudflare_ddos_protection',
					'http'    => 402
				)
			) );
		}

		/**
		 * @param string $pResult
		 *
		 * @throws Freemius_Exception
		 */
		private static function ThrowSquidAclException( $pResult = '' ) {
			throw new Freemius_Exception( array(
				'error' => (object) array(
					'type'    => 'SquidCacheBlock',
					'message' => $pResult,
					'code'    => 'squid_cache_block',
					'http'    => 402
				)
			) );
		}

		#endregion
	}
    }

Directory Contents

Dirs: 1 × Files: 4
Name Size Perms Modified Actions
- drwxr-xr-x 2026-06-24 08:09:49
Edit Download
8.07 KB lrw-r--r-- 2026-06-24 08:09:49
Edit Download
21.83 KB lrw-r--r-- 2026-06-24 08:09:49
Edit Download
87 B lrw-r--r-- 2026-06-24 08:09:49
Edit Download
17.60 KB lrw-r--r-- 2026-06-24 08:09:49
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 0xNothings — Secure File Manager. All rights reserved. Built with ❤️ & Tailwind x Dark UI