function apachesolr_init in Apache Solr Search 6
Same name and namespace in other branches
- 8 apachesolr.module \apachesolr_init()
- 6.3 apachesolr.module \apachesolr_init()
- 6.2 apachesolr.module \apachesolr_init()
Implementation of hook_init().
PHP 5.1 compatability code.
File
- ./
apachesolr.module, line 17 - Integration with the Apache Solr search application.
Code
function apachesolr_init() {
if (!function_exists('json_decode')) {
// Zend files include other files.
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Json/Decoder.php';
require_once 'Zend/Json/Encoder.php';
/**
* Substitute for missing PHP built-in functions.
*/
function json_decode($string, $assoc = FALSE) {
if ($assoc) {
$objectDecodeType = Zend_Json::TYPE_ARRAY;
}
else {
$objectDecodeType = Zend_Json::TYPE_OBJECT;
}
return Zend_Json_Decoder::decode($string, $objectDecodeType);
}
function json_encode($data) {
return Zend_Json_Encoder::encode($data, $objectDecodeType);
}
}
}