Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
noblogs-wp
Commits
bd88aaef
Commit
bd88aaef
authored
Dec 30, 2018
by
lucha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed Solr for Wordpress plugin
parent
a5494b36
Changes
45
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
0 additions
and
12167 deletions
+0
-12167
wp-content/plugins/solr-for-wordpress/Apache/Solr/Document.php
...ntent/plugins/solr-for-wordpress/Apache/Solr/Document.php
+0
-351
wp-content/plugins/solr-for-wordpress/Apache/Solr/Response.php
...ntent/plugins/solr-for-wordpress/Apache/Solr/Response.php
+0
-325
wp-content/plugins/solr-for-wordpress/Apache/Solr/Service.php
...ontent/plugins/solr-for-wordpress/Apache/Solr/Service.php
+0
-936
wp-content/plugins/solr-for-wordpress/Apache/Solr/Service/Balancer.php
...ugins/solr-for-wordpress/Apache/Solr/Service/Balancer.php
+0
-763
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Document.php
...solr-for-wordpress/SolrPhpClient/Apache/Solr/Document.php
+0
-367
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Exception.php
...olr-for-wordpress/SolrPhpClient/Apache/Solr/Exception.php
+0
-50
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/Abstract.php
...ress/SolrPhpClient/Apache/Solr/HttpTransport/Abstract.php
+0
-89
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/Curl.php
...ordpress/SolrPhpClient/Apache/Solr/HttpTransport/Curl.php
+0
-198
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/CurlNoReuse.php
...s/SolrPhpClient/Apache/Solr/HttpTransport/CurlNoReuse.php
+0
-196
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/FileGetContents.php
...lrPhpClient/Apache/Solr/HttpTransport/FileGetContents.php
+0
-216
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/Interface.php
...ess/SolrPhpClient/Apache/Solr/HttpTransport/Interface.php
+0
-94
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransport/Response.php
...ress/SolrPhpClient/Apache/Solr/HttpTransport/Response.php
+0
-255
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/HttpTransportException.php
...ress/SolrPhpClient/Apache/Solr/HttpTransportException.php
+0
-79
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/InvalidArgumentException.php
...ss/SolrPhpClient/Apache/Solr/InvalidArgumentException.php
+0
-50
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/NoServiceAvailableException.php
...SolrPhpClient/Apache/Solr/NoServiceAvailableException.php
+0
-50
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/ParserException.php
...r-wordpress/SolrPhpClient/Apache/Solr/ParserException.php
+0
-50
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Response.php
...solr-for-wordpress/SolrPhpClient/Apache/Solr/Response.php
+0
-247
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Service.php
.../solr-for-wordpress/SolrPhpClient/Apache/Solr/Service.php
+0
-1181
wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Service/Balancer.php
...-wordpress/SolrPhpClient/Apache/Solr/Service/Balancer.php
+0
-914
wp-content/plugins/solr-for-wordpress/SolrPhpClient/COPYING
wp-content/plugins/solr-for-wordpress/SolrPhpClient/COPYING
+0
-26
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/DocumentTest.php
...ordpress/SolrPhpClient/tests/Apache/Solr/DocumentTest.php
+0
-439
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransport/AbstractTest.php
...hpClient/tests/Apache/Solr/HttpTransport/AbstractTest.php
+0
-208
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransport/CurlNoReuseTest.php
...lient/tests/Apache/Solr/HttpTransport/CurlNoReuseTest.php
+0
-53
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransport/CurlTest.php
...olrPhpClient/tests/Apache/Solr/HttpTransport/CurlTest.php
+0
-53
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransport/FileGetContentsTest.php
...t/tests/Apache/Solr/HttpTransport/FileGetContentsTest.php
+0
-53
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransport/ResponseTest.php
...hpClient/tests/Apache/Solr/HttpTransport/ResponseTest.php
+0
-164
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/HttpTransportExceptionTest.php
...hpClient/tests/Apache/Solr/HttpTransportExceptionTest.php
+0
-58
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/ResponseTest.php
...ordpress/SolrPhpClient/tests/Apache/Solr/ResponseTest.php
+0
-194
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/Service/BalancerTest.php
.../SolrPhpClient/tests/Apache/Solr/Service/BalancerTest.php
+0
-47
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/ServiceAbstractTest.php
...s/SolrPhpClient/tests/Apache/Solr/ServiceAbstractTest.php
+0
-139
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/Apache/Solr/ServiceTest.php
...wordpress/SolrPhpClient/tests/Apache/Solr/ServiceTest.php
+0
-1119
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/README
...ent/plugins/solr-for-wordpress/SolrPhpClient/tests/README
+0
-20
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/phpunit.bootstrap.inc
...r-for-wordpress/SolrPhpClient/tests/phpunit.bootstrap.inc
+0
-28
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/phpunit.xml
...lugins/solr-for-wordpress/SolrPhpClient/tests/phpunit.xml
+0
-15
wp-content/plugins/solr-for-wordpress/SolrPhpClient/tests/run.php
...nt/plugins/solr-for-wordpress/SolrPhpClient/tests/run.php
+0
-42
wp-content/plugins/solr-for-wordpress/readme.txt
wp-content/plugins/solr-for-wordpress/readme.txt
+0
-146
wp-content/plugins/solr-for-wordpress/schema.xml
wp-content/plugins/solr-for-wordpress/schema.xml
+0
-146
wp-content/plugins/solr-for-wordpress/screenshot-1.png
wp-content/plugins/solr-for-wordpress/screenshot-1.png
+0
-0
wp-content/plugins/solr-for-wordpress/screenshot-2.png
wp-content/plugins/solr-for-wordpress/screenshot-2.png
+0
-0
wp-content/plugins/solr-for-wordpress/solr-for-wordpress.php
wp-content/plugins/solr-for-wordpress/solr-for-wordpress.php
+0
-1519
wp-content/plugins/solr-for-wordpress/solr-for-wordpress.pot
wp-content/plugins/solr-for-wordpress/solr-for-wordpress.pot
+0
-292
wp-content/plugins/solr-for-wordpress/solr-options-page.php
wp-content/plugins/solr-for-wordpress/solr-options-page.php
+0
-407
wp-content/plugins/solr-for-wordpress/template/autocomplete.css
...tent/plugins/solr-for-wordpress/template/autocomplete.css
+0
-27
wp-content/plugins/solr-for-wordpress/template/s4w_search.php
...ontent/plugins/solr-for-wordpress/template/s4w_search.php
+0
-182
wp-content/plugins/solr-for-wordpress/template/search.css
wp-content/plugins/solr-for-wordpress/template/search.css
+0
-379
No files found.
wp-content/plugins/solr-for-wordpress/Apache/Solr/Document.php
deleted
100644 → 0
View file @
a5494b36
<?php
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of Conduit Internet Technologies, Inc. nor the names of
* its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @copyright Copyright 2007-2009 Conduit Internet Technologies, Inc. (http://conduit-it.com)
* @license New BSD (http://solr-php-client.googlecode.com/svn/trunk/COPYING)
*
* @package Apache
* @subpackage Solr
* @author Donovan Jimenez <djimenez@conduit-it.com>
*/
/**
* Holds Key / Value pairs that represent a Solr Document along with any associated boost
* values. Field values can be accessed by direct dereferencing such as:
* <code>
* ...
* $document->title = 'Something';
* echo $document->title;
* ...
* </code>
*
* Additionally, the field values can be iterated with foreach
*
* <code>
* foreach ($document as $fieldName => $fieldValue)
* {
* ...
* }
* </code>
*/
class
Apache_Solr_Document
implements
IteratorAggregate
{
/**
* Document boost value
*
* @var float
*/
protected
$_documentBoost
=
false
;
/**
* Document field values, indexed by name
*
* @var array
*/
protected
$_fields
=
array
();
/**
* Document field boost values, indexed by name
*
* @var array array of floats
*/
protected
$_fieldBoosts
=
array
();
/**
* Clear all boosts and fields from this document
*/
public
function
clear
()
{
$this
->
_documentBoost
=
false
;
$this
->
_fields
=
array
();
$this
->
_fieldBoosts
=
array
();
}
/**
* Get current document boost
*
* @return mixed will be false for default, or else a float
*/
public
function
getBoost
()
{
return
$this
->
_documentBoost
;
}
/**
* Set document boost factor
*
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
*/
public
function
setBoost
(
$boost
)
{
$boost
=
(
float
)
$boost
;
if
(
$boost
>
0.0
)
{
$this
->
_documentBoost
=
$boost
;
}
else
{
$this
->
_documentBoost
=
false
;
}
}
/**
* Add a value to a multi-valued field
*
* NOTE: the solr XML format allows you to specify boosts
* PER value even though the underlying Lucene implementation
* only allows a boost per field. To remedy this, the final
* field boost value will be the product of all specified boosts
* on field values - this is similar to SolrJ's functionality.
*
* <code>
* $doc = new Apache_Solr_Document();
*
* $doc->addField('foo', 'bar', 2.0);
* $doc->addField('foo', 'baz', 3.0);
*
* // resultant field boost will be 6!
* echo $doc->getFieldBoost('foo');
* </code>
*
* @param string $key
* @param mixed $value
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
*/
public
function
addField
(
$key
,
$value
,
$boost
=
false
)
{
if
(
!
isset
(
$this
->
_fields
[
$key
]))
{
// create holding array if this is the first value
$this
->
_fields
[
$key
]
=
array
();
}
else
if
(
!
is_array
(
$this
->
_fields
[
$key
]))
{
// move existing value into array if it is not already an array
$this
->
_fields
[
$key
]
=
array
(
$this
->
_fields
[
$key
]);
}
if
(
$this
->
getFieldBoost
(
$key
)
===
false
)
{
// boost not already set, set it now
$this
->
setFieldBoost
(
$key
,
$boost
);
}
else
if
((
float
)
$boost
>
0.0
)
{
// multiply passed boost with current field boost - similar to SolrJ implementation
$this
->
_fieldBoosts
[
$key
]
*=
(
float
)
$boost
;
}
// add value to array
$this
->
_fields
[
$key
][]
=
$value
;
}
/**
* Handle the array manipulation for a multi-valued field
*
* @param string $key
* @param string $value
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
*
* @deprecated Use addField(...) instead
*/
public
function
setMultiValue
(
$key
,
$value
,
$boost
=
false
)
{
$this
->
addField
(
$key
,
$value
,
$boost
);
}
/**
* Get field information
*
* @param string $key
* @return mixed associative array of info if field exists, false otherwise
*/
public
function
getField
(
$key
)
{
if
(
isset
(
$this
->
_fields
[
$key
]))
{
return
array
(
'name'
=>
$key
,
'value'
=>
$this
->
_fields
[
$key
],
'boost'
=>
$this
->
getFieldBoost
(
$key
)
);
}
return
false
;
}
/**
* Set a field value. Multi-valued fields should be set as arrays
* or instead use the addField(...) function which will automatically
* make sure the field is an array.
*
* @param string $key
* @param mixed $value
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
*/
public
function
setField
(
$key
,
$value
,
$boost
=
false
)
{
$this
->
_fields
[
$key
]
=
$value
;
$this
->
setFieldBoost
(
$key
,
$boost
);
}
/**
* Get the currently set field boost for a document field
*
* @param string $key
* @return float currently set field boost, false if one is not set
*/
public
function
getFieldBoost
(
$key
)
{
return
isset
(
$this
->
_fieldBoosts
[
$key
])
?
$this
->
_fieldBoosts
[
$key
]
:
false
;
}
/**
* Set the field boost for a document field
*
* @param string $key field name for the boost
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
*/
public
function
setFieldBoost
(
$key
,
$boost
)
{
$boost
=
(
float
)
$boost
;
if
(
$boost
>
0.0
)
{
$this
->
_fieldBoosts
[
$key
]
=
$boost
;
}
else
{
$this
->
_fieldBoosts
[
$key
]
=
false
;
}
}
/**
* Return current field boosts, indexed by field name
*
* @return array
*/
public
function
getFieldBoosts
()
{
return
$this
->
_fieldBoosts
;
}
/**
* Get the names of all fields in this document
*
* @return array
*/
public
function
getFieldNames
()
{
return
array_keys
(
$this
->
_fields
);
}
/**
* Get the values of all fields in this document
*
* @return array
*/
public
function
getFieldValues
()
{
return
array_values
(
$this
->
_fields
);
}
/**
* IteratorAggregate implementation function. Allows usage:
*
* <code>
* foreach ($document as $key => $value)
* {
* ...
* }
* </code>
*/
public
function
getIterator
()
{
$arrayObject
=
new
ArrayObject
(
$this
->
_fields
);
return
$arrayObject
->
getIterator
();
}
/**
* Magic get for field values
*
* @param string $key
* @return mixed
*/
public
function
__get
(
$key
)
{
return
$this
->
_fields
[
$key
];
}
/**
* Magic set for field values. Multi-valued fields should be set as arrays
* or instead use the addField(...) function which will automatically
* make sure the field is an array.
*
* @param string $key
* @param mixed $value
*/
public
function
__set
(
$key
,
$value
)
{
$this
->
setField
(
$key
,
$value
);
}
/**
* Magic isset for fields values. Do not call directly. Allows usage:
*
* <code>
* isset($document->some_field);
* </code>
*
* @param string $key
* @return boolean
*/
public
function
__isset
(
$key
)
{
return
isset
(
$this
->
_fields
[
$key
]);
}
/**
* Magic unset for field values. Do not call directly. Allows usage:
*
* <code>
* unset($document->some_field);
* </code>
*
* @param string $key
*/
public
function
__unset
(
$key
)
{
unset
(
$this
->
_fields
[
$key
]);
unset
(
$this
->
_fieldBoosts
[
$key
]);
}
}
\ No newline at end of file
wp-content/plugins/solr-for-wordpress/Apache/Solr/Response.php
deleted
100644 → 0
View file @
a5494b36
<?php
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of Conduit Internet Technologies, Inc. nor the names of
* its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @copyright Copyright 2007-2009 Conduit Internet Technologies, Inc. (http://conduit-it.com)
* @license New BSD (http://solr-php-client.googlecode.com/svn/trunk/COPYING)
*
* @package Apache
* @subpackage Solr
* @author Donovan Jimenez <djimenez@conduit-it.com>
*/
/**
* Represents a Solr response. Parses the raw response into a set of stdClass objects
* and associative arrays for easy access.
*
* Currently requires json_decode which is bundled with PHP >= 5.2.0, Alternatively can be
* installed with PECL. Zend Framework also includes a purely PHP solution.
*
* @todo When Solr 1.3 is released, possibly convert to use PHP or Serialized PHP output writer
*/
class
Apache_Solr_Response
{
/**
* Holds the raw response used in construction
*
* @var string
*/
protected
$_rawResponse
;
/**
* Parsed values from the passed in http headers
*
* @var string
*/
protected
$_httpStatus
,
$_httpStatusMessage
,
$_type
,
$_encoding
;
/**
* Whether the raw response has been parsed
*
* @var boolean
*/
protected
$_isParsed
=
false
;
/**
* Parsed representation of the data
*
* @var mixed
*/
protected
$_parsedData
;
/**
* Data parsing flags. Determines what extra processing should be done
* after the data is initially converted to a data structure.
*
* @var boolean
*/
protected
$_createDocuments
=
true
,
$_collapseSingleValueArrays
=
true
;
/**
* Constructor. Takes the raw HTTP response body and the exploded HTTP headers
*
* @param string $rawResponse
* @param array $httpHeaders
* @param boolean $createDocuments Whether to convert the documents json_decoded as stdClass instances to Apache_Solr_Document instances
* @param boolean $collapseSingleValueArrays Whether to make multivalued fields appear as single values
*/
public
function
__construct
(
$rawResponse
,
$httpHeaders
=
array
(),
$createDocuments
=
true
,
$collapseSingleValueArrays
=
true
)
{
//Assume 0, 'Communication Error', utf-8, and text/plain
$status
=
0
;
$statusMessage
=
'Communication Error'
;
$type
=
'text/plain'
;
$encoding
=
'UTF-8'
;
//iterate through headers for real status, type, and encoding
if
(
is_array
(
$httpHeaders
)
&&
count
(
$httpHeaders
)
>
0
)
{
//look at the first headers for the HTTP status code
//and message (errors are usually returned this way)
//
//HTTP 100 Continue response can also be returned before
//the REAL status header, so we need look until we find
//the last header starting with HTTP
//
//the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1
//
//Thanks to Daniel Andersson for pointing out this oversight
while
(
isset
(
$httpHeaders
[
0
])
&&
substr
(
$httpHeaders
[
0
],
0
,
4
)
==
'HTTP'
)
{
$parts
=
split
(
' '
,
substr
(
$httpHeaders
[
0
],
9
),
2
);
$status
=
$parts
[
0
];
$statusMessage
=
trim
(
$parts
[
1
]);
array_shift
(
$httpHeaders
);
}
//Look for the Content-Type response header and determine type
//and encoding from it (if possible - such as 'Content-Type: text/plain; charset=UTF-8')
//Check for a chunked response and de-chunk it if necessary
foreach
(
$httpHeaders
as
$header
)
{
if
(
strncasecmp
(
$header
,
'Transfer-Encoding: chunked'
,
26
)
==
0
)
{
$rawResponse
=
$this
->
http_chunked_decode
(
$rawResponse
);
}
if
(
strncasecmp
(
$header
,
'Content-Type:'
,
13
)
==
0
)
{
//split content type value into two parts if possible
$parts
=
split
(
';'
,
substr
(
$header
,
13
),
2
);
$type
=
trim
(
$parts
[
0
]);
if
(
$parts
[
1
])
{
//split the encoding section again to get the value
$parts
=
split
(
'='
,
$parts
[
1
],
2
);
if
(
$parts
[
1
])
{
$encoding
=
trim
(
$parts
[
1
]);
}
}
break
;
}
}
}
$this
->
_rawResponse
=
$rawResponse
;
$this
->
_type
=
$type
;
$this
->
_encoding
=
$encoding
;
$this
->
_httpStatus
=
$status
;
$this
->
_httpStatusMessage
=
$statusMessage
;
$this
->
_createDocuments
=
(
bool
)
$createDocuments
;
$this
->
_collapseSingleValueArrays
=
(
bool
)
$collapseSingleValueArrays
;
}
/**
* dechunk an http 'transfer-encoding: chunked' message
*
* @param string $chunk the encoded message
* @return string the decoded message. If $chunk wasn't encoded properly it will be returned unmodified.
*/
protected
function
http_chunked_decode
(
$chunk
)
{
$pos
=
0
;
$len
=
strlen
(
$chunk
);
$dechunk
=
null
;
while
((
$pos
<
$len
)
&&
(
$chunkLenHex
=
substr
(
$chunk
,
$pos
,
(
$newlineAt
=
strpos
(
$chunk
,
"
\n
"
,
$pos
+
1
))
-
$pos
)))
{
if
(
!
$this
->
is_hex
(
$chunkLenHex
))
{
trigger_error
(
'Value is not properly chunk encoded'
,
E_USER_WARNING
);
return
$chunk
;
}
$pos
=
$newlineAt
+
1
;
$chunkLen
=
hexdec
(
rtrim
(
$chunkLenHex
,
"
\r\n
"
));
$dechunk
.
=
substr
(
$chunk
,
$pos
,
$chunkLen
);
$pos
=
strpos
(
$chunk
,
"
\n
"
,
$pos
+
$chunkLen
)
+
1
;
}
return
$dechunk
;
}
/**
* determine if a string can represent a number in hexadecimal
*
* @param string $hex
* @return boolean true if the string is a hex, otherwise false
*/
protected
function
is_hex
(
$hex
)
{
// regex is for weenies
$hex
=
strtolower
(
trim
(
ltrim
(
$hex
,
"0"
)));
if
(
empty
(
$hex
))
{
$hex
=
0
;
};
$dec
=
hexdec
(
$hex
);
return
(
$hex
==
dechex
(
$dec
));
}
/**
* Get the HTTP status code
*
* @return integer
*/
public
function
getHttpStatus
()
{
return
$this
->
_httpStatus
;
}
/**
* Get the HTTP status message of the response
*
* @return string
*/
public
function
getHttpStatusMessage
()
{
return
$this
->
_httpStatusMessage
;
}
/**
* Get content type of this Solr response
*
* @return string
*/
public
function
getType
()
{
return
$this
->
_type
;
}
/**
* Get character encoding of this response. Should usually be utf-8, but just in case