function apachesolr_init in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 apachesolr.module \apachesolr_init()
- 6 apachesolr.module \apachesolr_init()
- 6.2 apachesolr.module \apachesolr_init()
Implements hook_init().
File
- ./
apachesolr.module, line 16 - Integration with the Apache Solr search application.
Code
function apachesolr_init() {
if (arg(0) == 'admin') {
// Add the CSS for this module
drupal_add_css(drupal_get_path('module', 'apachesolr') . '/apachesolr.css');
}
// PHP 5.1 compatability code.
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);
}
}
}