//** * HTTP response parser * * @param string $headers Full response text including headers and body * @param string $url Original request URL * @param array $req_headers Original $headers array passed to {@link request()}, in case we need to follow redirects * @param array $req_data Original $data array passed to {@link request()}, in case we need to follow redirects * @param array $options Original $options array passed to {@link request()}, in case we need to follow redirects * @return \WpOrg\Requests\Response * * @throws \WpOrg\Requests\Exception On missing head/body separator (`requests.no_crlf_separator`) * @throws \WpOrg\Requests\Exception On missing head/body separator (`noversion`) * @throws \WpOrg\Requests\Exception On missing head/body separator (`toomanyredirects`) */return true; /* * > A start tag whose ta"=4#rUP @rUp q-rUPP urUp <!rU`p nrU`)rU +irUDTrUPtTrU`trUd\rUrUprU< rUlrU`mrUDrU<޳rU>rU>sUBBXAiB8iBHBBlBPO $token_type ? ( $this->is_tag_closer() ? '-' : '+' ) : ''; $op = "{$op_sigil}"=4ȣrUPC?rU`C?"rU`EQrUpE"rU`PFQrUF"rU` GQrUG"rU` HQrU HrUIq-rUPPIu-rUp`Iu-rUpIu-rUIu-rUIurU@I<!rUP@IrU`I*rUJkrUPKrUM>8A`A-AA B BiB8iBPOtoken */ case 'html': // Pars"=4#rUPb?rU cE-rUPPcBrU`c<)rU`c+rUdE-rUPPdBrUpd<&rUpdȰrUd>rUpgE-rUPPgBrUg<)rU`g+4rUP hȰrUh>rUk>rUl>(BhB^ABB0A AhBB@`A}A(5A0Nor: ignore the token. return $this->step(); } /** * Parses next element in the 'a"=4/** * Verifies the received SSL certificate against its Common Names and subjectAltName fields. * * PHP's SSL verifications only verify that it's a valid Certificate, it doesn't verify if * the certificate is valid for the hostname which was requested. * This function verifies the requested hostname against certificate's subjectAltName field, * if that is empty, or contains no DNS entries, a fallback to the Common Name field is used. * * IP Address support is included */ protected function add_terms( $data, $key, $taxonomy ) { $terms = \get_the_terms( $this->context->id, $taxonomy ); if ( ! \is_array( $terms ) ) { return $data; } $callback = static function( $term ) { // We are using the WordPress internal translation. return $term->name !== \__( 'Uncategorized', 'default' ); }; $terms = \array_filter( $terms, $callback ); if ( empty( $terms ) ) { return $data; } $data[ $key ] = \wp_list_pluck( $terms, 'name' ); return $data; } /** * Adds an image node if the post has a featured image. * * @param array $data The Article data. * * @return array The Article data. */ private function add_image( $data ) { if ( $this->context->main_image_url !== null ) { $data['image'] = [ '@id' => $this->context->canonical . Schema_IDs::PRIMARY_IMAGE_HASH, ]; $data['thumbnailUrl'] = $this->context->main_image_url; } return $data; } /** * Adds the potential action property to the Article Schema piece. * * @param array $data The Article data. * * @return array The Article data with the potential action added. */ private function add_potential_action( $data ) { /** * Filter: 'wpseo_schema_article_potential_action_target' - Allows filtering of the schema Article potentialAction target. * * @api array $targets The URLs for the Article potentialAction target. */ $targets = \apply_filters( 'wpseo_schema_article_potential_action_target', [ $this->context->canonical . '#respond' ] ); $data['potentialAction'][] = [ '@type' => 'CommentAction', 'name' => 'Comment', 'target' => $targets, ]; return $data; } /** * Does a simple word count but tries to be relatively smart about it. * * @param string $post_content The post content. * @param string $post_title The post title. * * @return int The number of words in the content. */ private function word_count( $post_content, $post_title = '' ) { // Add the title to our word count. $post_content = $post_title . ' ' . $post_content; // Strip pre/code blocks and their content. $post_content = \preg_replace( '@<(pre|code)[^>]*?>.*?@si', '', $post_content ); // Add space between tags that don't have it. $post_content = \preg_replace( '@><@', '> <', $post_content ); // Strips all other tags. $post_content = \wp_strip_all_tags( $post_content ); $characters = ''; if ( \preg_match( '@[а-я]@ui', $post_content ) ) { // Correct counting of the number of words in the Russian and Ukrainian languages. $alphabet = [ 'ru' => 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя', 'ua' => 'абвгґдеєжзиіїйклмнопрстуфхцчшщьюя', ]; $characters = \implode( '', $alphabet ); $characters = \preg_split( '//u', $characters, -1, \PREG_SPLIT_NO_EMPTY ); $characters = \array_unique( $characters ); $characters = \implode( '', $characters ); $characters .= \mb_strtoupper( $characters ); } // Remove characters from HTML entities. $post_content = \preg_replace( '@&[a-z0-9]+;@i', ' ', \htmlentities( $post_content ) ); return \str_word_count( $post_content, 0, $characters ); } }