Complex classes like TypoScriptConfiguration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use TypoScriptConfiguration, and based on these observations, apply Extract Interface, too.
| 1 | <?php | ||
| 35 | class TypoScriptConfiguration | ||
| 36 | { | ||
| 37 | /** | ||
| 38 | * @var \ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor|null | ||
| 39 | */ | ||
| 40 | protected $configurationAccess = null; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Holds the pageId in which context the configuration was parsed | ||
| 44 | * (normally $GLOBALS['TSFE']->id) | ||
| 45 | */ | ||
| 46 | protected $contextPageId = 0; | ||
| 47 | |||
| 48 | /** | ||
| 49 | * @param array $configuration | ||
| 50 | * @param int $contextPageId | ||
| 51 | */ | ||
| 52 | 195 | public function __construct(array $configuration, $contextPageId = 0) | |
| 57 | |||
| 58 | /** | ||
| 59 | * Checks if a value is 1, '1', 'true' | ||
| 60 | * @param mixed $value | ||
| 61 | * @return bool | ||
| 62 | */ | ||
| 63 | 177 | protected function getBool($value) | |
| 67 | |||
| 68 | /** | ||
| 69 | * This method can be used to only retrieve array keys where the value is not an array. | ||
| 70 | * | ||
| 71 | * This can be very handy in the configuration when only keys should ne taken into account | ||
| 72 | * where the value is not a subconfiguration (typically an typoscript object path). | ||
| 73 | * | ||
| 74 | * @param $inputArray | ||
| 75 | * @return array | ||
| 76 | */ | ||
| 77 | 7 | protected function getOnlyArrayKeysWhereValueIsNotAnArray($inputArray) | |
| 78 |     { | ||
| 79 | 7 | $keysWithNonArrayValue = array(); | |
| 80 | |||
| 81 | 7 |         foreach ($inputArray as $key => $value) { | |
| 82 | 7 |             if (is_array($value)) { | |
| 83 | // configuration for a content object, skipping | ||
| 84 | 6 | continue; | |
| 85 | } | ||
| 86 | |||
| 87 | 7 | $keysWithNonArrayValue[] = $key; | |
| 88 | } | ||
| 89 | |||
| 90 | 7 | return $keysWithNonArrayValue; | |
| 91 | } | ||
| 92 | |||
| 93 | /** | ||
| 94 | * Gets the value from a given TypoScript path. | ||
| 95 | * | ||
| 96 | * In the context of an frontend content element the path plugin.tx_solr is | ||
| 97 | * merged recursive with overrule with the content element specific typoscript | ||
| 98 | * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings | ||
| 99 | * (depends on the solr plugin). | ||
| 100 | * | ||
| 101 | * Example: plugin.tx_solr.search.targetPage | ||
| 102 | * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] | ||
| 103 | * | ||
| 104 | * @param string $path TypoScript path | ||
| 105 | * @return array The TypoScript object defined by the given path | ||
| 106 | * @throws InvalidArgumentException | ||
| 107 | */ | ||
| 108 | 214 | public function getValueByPath($path) | |
| 117 | |||
| 118 | /** | ||
| 119 | * This method can be used to get a configuration value by path if it exists or return a | ||
| 120 | * default value when it does not exist. | ||
| 121 | * | ||
| 122 | * @param string $path | ||
| 123 | * @param mixed $defaultValue | ||
| 124 | * @return mixed | ||
| 125 | */ | ||
| 126 | 213 | public function getValueByPathOrDefaultValue($path, $defaultValue) | |
| 135 | |||
| 136 | /** | ||
| 137 | * Gets the parent TypoScript Object from a given TypoScript path. | ||
| 138 | * | ||
| 139 | * In the context of an frontend content element the path plugin.tx_solr is | ||
| 140 | * merged recursive with overrule with the content element specific typoscript | ||
| 141 | * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings | ||
| 142 | * (depends on the solr plugin). | ||
| 143 | * | ||
| 144 | * Example: plugin.tx_solr.index.queue.tt_news.fields.content | ||
| 145 | * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['queue.']['tt_news.']['fields.']['content.'] | ||
| 146 | * which is a SOLR_CONTENT cObj. | ||
| 147 | * | ||
| 148 | * @param string $path TypoScript path | ||
| 149 | * @return array The TypoScript object defined by the given path | ||
| 150 | * @throws InvalidArgumentException | ||
| 151 | */ | ||
| 152 | 100 | public function getObjectByPath($path) | |
| 153 |     { | ||
| 154 | 100 |         if (substr($path, -1) !== '.') { | |
| 155 | 4 | $path = rtrim($path, '.'); | |
| 156 | 4 | $path = substr($path, 0, strrpos($path, '.') + 1); | |
| 157 | } | ||
| 158 | |||
| 159 | 100 |         if (!is_string($path)) { | |
| 160 |             throw new InvalidArgumentException('Parameter $path is not a string', 1325627243); | ||
| 161 | } | ||
| 162 | |||
| 163 | 100 | return $this->configurationAccess->get($path); | |
| 164 | } | ||
| 165 | |||
| 166 | /** | ||
| 167 | * Gets the parent TypoScript Object from a given TypoScript path and if not present return | ||
| 168 | * the default value | ||
| 169 | * | ||
| 170 | * @see getObjectByPath | ||
| 171 | * @param string $path | ||
| 172 | * @param array $defaultValue | ||
| 173 | * @return array | ||
| 174 | */ | ||
| 175 | 96 | public function getObjectByPathOrDefault($path, array $defaultValue) | |
| 176 |     { | ||
| 177 |         try { | ||
| 178 | 96 | $object = $this->getObjectByPath($path); | |
| 179 |         } catch (\InvalidArgumentException $e) { | ||
| 180 | return $defaultValue; | ||
| 181 | } | ||
| 182 | |||
| 183 | 96 |         if (!is_array($object)) { | |
| 184 | 41 | return $defaultValue; | |
| 185 | } | ||
| 186 | |||
| 187 | 85 | return $object; | |
| 188 | } | ||
| 189 | |||
| 190 | /** | ||
| 191 | * Checks whether a given TypoScript path is valid. | ||
| 192 | * | ||
| 193 | * @param string $path TypoScript path | ||
| 194 | * @return bool TRUE if the path resolves, FALSE otherwise | ||
| 195 | */ | ||
| 196 | public function isValidPath($path) | ||
| 197 |     { | ||
| 198 | $isValidPath = false; | ||
| 199 | |||
| 200 | $pathValue = $this->getValueByPath($path); | ||
| 201 |         if (!is_null($pathValue)) { | ||
| 202 | $isValidPath = true; | ||
| 203 | } | ||
| 204 | |||
| 205 | return $isValidPath; | ||
| 206 | } | ||
| 207 | |||
| 208 | /** | ||
| 209 | * Merges a configuration with another configuration a | ||
| 210 | * | ||
| 211 | * @param array $configurationToMerge | ||
| 212 | * @param bool $addKeys If set to FALSE, keys that are NOT found in $original will not be set. Thus only existing value can/will be overruled from overrule array. | ||
| 213 | * @param bool $includeEmptyValues If set, values from $overrule will overrule if they are empty or zero. | ||
| 214 | * @param bool $enableUnsetFeature If set, special values "__UNSET" can be used in the overrule array in order to unset array keys in the original array. | ||
| 215 | * @return TypoScriptConfiguration | ||
| 216 | */ | ||
| 217 | 27 | public function mergeSolrConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) | |
| 218 |     { | ||
| 219 | 27 | $data = $this->configurationAccess->getData(); | |
| 220 | 27 | ArrayUtility::mergeRecursiveWithOverrule( | |
| 221 | 27 | $data['plugin.']['tx_solr.'], | |
| 222 | $configurationToMerge, | ||
| 223 | $addKeys, | ||
| 224 | $includeEmptyValues, | ||
| 225 | $enableUnsetFeature | ||
| 226 | ); | ||
| 227 | |||
| 228 | 27 | $this->configurationAccess->setData($data); | |
| 229 | |||
| 230 | 27 | return $this; | |
| 231 | } | ||
| 232 | |||
| 233 | /** | ||
| 234 | * Returns the configured css file for a specific fileKey. | ||
| 235 | * | ||
| 236 | * plugin.tx_solr.cssFiles.<fileKey> | ||
| 237 | * | ||
| 238 | * @param string $fileKey | ||
| 239 | * @param string $defaultIfEmpty | ||
| 240 | * @return string | ||
| 241 | */ | ||
| 242 | 25 | public function getCssFileByFileKey($fileKey, $defaultIfEmpty = '') | |
| 247 | |||
| 248 | /** | ||
| 249 | * Returns the configured additionalFields configured for the indexing. | ||
| 250 | * | ||
| 251 | * plugin.tx_solr.index.additionalFields. | ||
| 252 | * | ||
| 253 | * @param array $defaultIfEmpty | ||
| 254 | * @return array | ||
| 255 | */ | ||
| 256 | 3 | public function getIndexAdditionalFieldsConfiguration($defaultIfEmpty = array()) | |
| 261 | |||
| 262 | /** | ||
| 263 | * Returns all solr fields names where a mapping is configured in index.additionalFields | ||
| 264 | * | ||
| 265 | * Returns all keys from | ||
| 266 | * plugin.tx_solr.index.additionalFields. | ||
| 267 | * | ||
| 268 | * @param array $defaultIfEmpty | ||
| 269 | * @return array | ||
| 270 | */ | ||
| 271 | 2 | public function getIndexMappedAdditionalFieldNames($defaultIfEmpty = array()) | |
| 277 | |||
| 278 | /** | ||
| 279 | * Returns the fieldProcessingInstructions configuration array | ||
| 280 | * | ||
| 281 | * plugin.tx_solr.index.fieldProcessingInstructions. | ||
| 282 | * | ||
| 283 | * @param array $defaultIfEmpty | ||
| 284 | * @return array | ||
| 285 | */ | ||
| 286 | 45 | public function getIndexFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = array()) | |
| 291 | |||
| 292 | /** | ||
| 293 | * Retrieves the indexing configuration array for an indexing queue by configuration name. | ||
| 294 | * | ||
| 295 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 296 | * | ||
| 297 | * @param string $configurationName | ||
| 298 | * @param array $defaultIfEmpty | ||
| 299 | * @return array | ||
| 300 | */ | ||
| 301 | 5 | public function getIndexQueueConfigurationByName($configurationName, array $defaultIfEmpty = array()) | |
| 307 | |||
| 308 | /** | ||
| 309 | * Returns an array of all allowedPageTypes. | ||
| 310 | * | ||
| 311 | * plugin.tx_solr.index.queue.pages.allowedPageTypes | ||
| 312 | * | ||
| 313 | * @param string $configurationName The configuration name of the queue to use. | ||
| 314 | * @param array $defaultIfEmpty | ||
| 315 | * @return array | ||
| 316 | */ | ||
| 317 | 16 | public function getIndexQueueAllowedPageTypesArrayByConfigurationName($configurationName = 'pages', $defaultIfEmpty = []) | |
| 327 | |||
| 328 | /** | ||
| 329 | * Returns an array of all allowedPageTypes. | ||
| 330 | * | ||
| 331 | * plugin.tx_solr.index.queue.pages.allowedPageTypes | ||
| 332 | * | ||
| 333 | * @deprecated since 6.0 will be removed in 7.0 | ||
| 334 | * | ||
| 335 | * @param array $defaultIfEmpty | ||
| 336 | * @return array | ||
| 337 | */ | ||
| 338 | 1 | public function getIndexQueuePagesAllowedPageTypesArray($defaultIfEmpty = array()) | |
| 339 |     { | ||
| 340 | 1 | return $this->getIndexQueueAllowedPageTypesArrayByConfigurationName( | |
| 341 | 1 | 'pages', | |
| 342 | $defaultIfEmpty | ||
| 343 | ); | ||
| 344 | } | ||
| 345 | |||
| 346 | /** | ||
| 347 | * Returns the configured excludeContentByClass patterns as array. | ||
| 348 | * | ||
| 349 | * plugin.tx_solr.index.queue.pages.excludeContentByClass | ||
| 350 | * | ||
| 351 | * @param array $defaultIfEmpty | ||
| 352 | * @return array | ||
| 353 | */ | ||
| 354 | 30 | public function getIndexQueuePagesExcludeContentByClassArray($defaultIfEmpty = array()) | |
| 365 | |||
| 366 | /** | ||
| 367 | * Returns the configured database table for an indexing queue configuration or | ||
| 368 | * the configurationName itself that is used by convention as tableName when no | ||
| 369 | * other tablename is present. | ||
| 370 | * | ||
| 371 | * plugin.tx_solr.index.queue.<configurationName>.table or configurationName | ||
| 372 | * | ||
| 373 | * @param string $configurationName | ||
| 374 | * @return string | ||
| 375 | */ | ||
| 376 | 23 | public function getIndexQueueTableNameOrFallbackToConfigurationName($configurationName = '') | |
| 382 | |||
| 383 | /** | ||
| 384 | * Returns the field configuration for a specific index queue. | ||
| 385 | * | ||
| 386 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 387 | * | ||
| 388 | * @param string $configurationName | ||
| 389 | * @param array $defaultIfEmpty | ||
| 390 | * @return array | ||
| 391 | */ | ||
| 392 | 17 | public function getIndexQueueFieldsConfigurationByConfigurationName($configurationName = '', $defaultIfEmpty = array()) | |
| 398 | |||
| 399 | /** | ||
| 400 | * Gets an array of tables configured for indexing by the Index Queue. Since the | ||
| 401 | * record monitor must watch these tables for manipulation. | ||
| 402 | * | ||
| 403 | * @return array Array of table names to be watched by the record monitor. | ||
| 404 | */ | ||
| 405 | 16 | public function getIndexQueueMonitoredTables() | |
| 406 |     { | ||
| 407 | 16 | $monitoredTables = []; | |
| 408 | |||
| 409 | 16 | $indexingConfigurations = $this->getEnabledIndexQueueConfigurationNames(); | |
| 410 | 16 |         foreach ($indexingConfigurations as $indexingConfigurationName) { | |
| 411 | 16 | $monitoredTable = $this->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName); | |
| 412 | 16 | $monitoredTables[] = $monitoredTable; | |
| 413 | 16 |             if ($monitoredTable == 'pages') { | |
| 414 | // when monitoring pages, also monitor creation of translations | ||
| 415 | 16 | $monitoredTables[] = 'pages_language_overlay'; | |
| 416 | } | ||
| 417 | } | ||
| 418 | |||
| 419 | 16 | return array_values(array_unique($monitoredTables)); | |
| 420 | } | ||
| 421 | |||
| 422 | /** | ||
| 423 | * This method can be used to check if a table is configured to be monitored by the record monitor. | ||
| 424 | * | ||
| 425 | * @param string $tableName | ||
| 426 | * @return bool | ||
| 427 | */ | ||
| 428 | 15 | public function getIndexQueueIsMonitoredTable($tableName) | |
| 432 | |||
| 433 | /** | ||
| 434 | * Returns the configured indexer class that should be used for a certain indexingConfiguration. | ||
| 435 | * By default "ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer" will be returned. | ||
| 436 | * | ||
| 437 | * plugin.tx_solr.index.queue.<configurationName>.indexer | ||
| 438 | * | ||
| 439 | * @param string $configurationName | ||
| 440 | * @param string $defaultIfEmpty | ||
| 441 | * @return string | ||
| 442 | */ | ||
| 443 | 6 | public function getIndexQueueIndexerByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer') | |
| 449 | |||
| 450 | /** | ||
| 451 | * Returns the configuration of an indexer for a special indexingConfiguration. By default an empty | ||
| 452 | * array is returned. | ||
| 453 | * | ||
| 454 | * plugin.tx_solr.index.queue.<configurationName>.indexer. | ||
| 455 | * | ||
| 456 | * @param string $configurationName | ||
| 457 | * @param array $defaultIfEmpty | ||
| 458 | * @return array | ||
| 459 | */ | ||
| 460 | 6 | public function getIndexQueueIndexerConfigurationByConfigurationName($configurationName, $defaultIfEmpty = array()) | |
| 466 | |||
| 467 | /** | ||
| 468 | * Returns all solr fields names where a mapping configuration is set for a certain index configuration | ||
| 469 | * | ||
| 470 | * Returns all keys from | ||
| 471 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 472 | * | ||
| 473 | * @param string $configurationName | ||
| 474 | * @param array $defaultIfEmpty | ||
| 475 | * @return array | ||
| 476 | */ | ||
| 477 | 6 | public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = array()) | |
| 483 | |||
| 484 | /** | ||
| 485 | * This method is used to check if an index queue configuration is enabled or not | ||
| 486 | * | ||
| 487 | * plugin.tx_solr.index.queue.<configurationName> = 1 | ||
| 488 | * | ||
| 489 | * @param string $configurationName | ||
| 490 | * @param bool $defaultIfEmpty | ||
| 491 | * @return bool | ||
| 492 | */ | ||
| 493 | 10 | public function getIndexQueueConfigurationIsEnabled($configurationName, $defaultIfEmpty = false) | |
| 499 | |||
| 500 | /** | ||
| 501 | * Retrieves an array of enabled index queue configurations. | ||
| 502 | * | ||
| 503 | * plugin.tx_solr.index.queue.<configurationName> | ||
| 504 | * | ||
| 505 | * @param array $defaultIfEmpty | ||
| 506 | * @return array | ||
| 507 | */ | ||
| 508 | 18 | public function getEnabledIndexQueueConfigurationNames($defaultIfEmpty = array()) | |
| 521 | |||
| 522 | /** | ||
| 523 | * Retrieves and initialPagesAdditionalWhereClause where clause when configured or an empty string. | ||
| 524 | * | ||
| 525 | * plugin.tx_solr.index.queue.pages.initialPagesAdditionalWhereClause | ||
| 526 | * | ||
| 527 | * @param string $defaultIfEmpty | ||
| 528 | * | ||
| 529 | * @return string | ||
| 530 | * | ||
| 531 | */ | ||
| 532 | 8 | public function getInitialPagesAdditionalWhereClause($defaultIfEmpty = ' AND 1=1') | |
| 533 |     { | ||
| 534 | 8 | $path = 'plugin.tx_solr.index.queue.pages' . '.initialPagesAdditionalWhereClause'; | |
| 535 | 8 | $initialPagesAdditionalWhereClause = $this->getValueByPathOrDefaultValue($path, ''); | |
| 536 | |||
| 537 | 8 |         if (trim($initialPagesAdditionalWhereClause) === '') { | |
| 538 | 8 | return $defaultIfEmpty; | |
| 539 | } | ||
| 540 | |||
| 541 | return ' AND ' . $initialPagesAdditionalWhereClause; | ||
| 542 | } | ||
| 543 | |||
| 544 | /** | ||
| 545 | * Retrieves and additional where clause when configured or an empty string. | ||
| 546 | * | ||
| 547 | * plugin.tx_solr.index.queue.<configurationName>.additionalWhereClause | ||
| 548 | * | ||
| 549 | * @param string $configurationName | ||
| 550 | * @return string | ||
| 551 | */ | ||
| 552 | 29 | public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName) | |
| 553 |     { | ||
| 554 | 29 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalWhereClause'; | |
| 555 | 29 | $additionalWhere = $this->getValueByPathOrDefaultValue($path, ''); | |
| 556 | |||
| 557 | 29 |         if (trim($additionalWhere) == '') { | |
| 558 | 11 | return ''; | |
| 559 | } | ||
| 560 | |||
| 561 | 19 | return ' AND ' . $additionalWhere; | |
| 562 | } | ||
| 563 | |||
| 564 | /** | ||
| 565 | * This method can be used to retrieve all index queue configuration names, where | ||
| 566 | * a certain table is used. It can be configured with the property "table" or is using the configuration | ||
| 567 | * key a fallback for the table name. | ||
| 568 | * | ||
| 569 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 570 | * | ||
| 571 | * @param string $tableName | ||
| 572 | * @param array $defaultIfEmpty | ||
| 573 | * @return array | ||
| 574 | */ | ||
| 575 | 10 | public function getIndexQueueConfigurationNamesByTableName($tableName, $defaultIfEmpty = array()) | |
| 576 |     { | ||
| 577 | 10 | $path = 'plugin.tx_solr.index.queue.'; | |
| 578 | 10 | $configuration = $this->getObjectByPathOrDefault($path, array()); | |
| 579 | 10 | $possibleConfigurations = array(); | |
| 580 | |||
| 581 | 10 |         foreach ($configuration as $configurationName => $indexingEnabled) { | |
| 582 | 10 | $isObject = substr($configurationName, -1) == '.'; | |
| 583 | 10 |             if ($isObject || !$indexingEnabled) { | |
| 584 | 10 | continue; | |
| 585 | } | ||
| 586 | |||
| 587 | // when the configuration name equals the tableName we have a fallback | ||
| 588 | 10 | $hasTableNameAsConfigurationName = $configurationName == $tableName; | |
| 589 | 10 | $hasTableAssignedInQueueConfiguration = isset($configuration[$configurationName . '.']['table']) && | |
| 590 | 10 | $configuration[$configurationName . '.']['table'] == $tableName; | |
| 591 | 10 |             if ($hasTableNameAsConfigurationName || $hasTableAssignedInQueueConfiguration) { | |
| 592 | 10 | $possibleConfigurations[] = $configurationName; | |
| 593 | } | ||
| 594 | } | ||
| 595 | |||
| 596 | 10 | return count($possibleConfigurations) > 0 ? $possibleConfigurations : $defaultIfEmpty; | |
| 597 | } | ||
| 598 | |||
| 599 | /** | ||
| 600 | * This method is used to retrieve the className of a queue initializer for a certain indexing configuration | ||
| 601 | * of returns the default initializer class, when noting is configured. | ||
| 602 | * | ||
| 603 | * plugin.tx_solr.index.queue.<configurationName>.initialization | ||
| 604 | * | ||
| 605 | * @param string $configurationName | ||
| 606 | * @param string $defaultIfEmpty | ||
| 607 | * @return mixed | ||
| 608 | */ | ||
| 609 | 5 | public function getIndexQueueInitializerClassByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Initializer\\Record') | |
| 610 |     { | ||
| 611 | 5 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialization'; | |
| 612 | 5 | $className = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 613 | |||
| 614 | 5 | return $className; | |
| 615 | } | ||
| 616 | |||
| 617 | /** | ||
| 618 | * Returns the configured javascript file for a specific fileKey. | ||
| 619 | * | ||
| 620 | * plugin.tx_solr.javascriptFiles.<fileKey> | ||
| 621 | * | ||
| 622 | * @param string $fileKey | ||
| 623 | * @param string $defaultIfEmpty | ||
| 624 | * @return string | ||
| 625 | */ | ||
| 626 | 26 | public function getJavaScriptFileByFileKey($fileKey, $defaultIfEmpty = '') | |
| 627 |     { | ||
| 628 | 26 |         $javaScriptFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.' . $fileKey, $defaultIfEmpty); | |
| 629 | 26 | return (string)$javaScriptFileName; | |
| 630 | } | ||
| 631 | |||
| 632 | /** | ||
| 633 | * Returns the configuration where to load the javascript | ||
| 634 | * | ||
| 635 | * plugin.tx_solr.javascriptFiles.loadIn | ||
| 636 | * | ||
| 637 | * @param string $defaultIfEmpty | ||
| 638 | * @return string | ||
| 639 | */ | ||
| 640 | 25 | public function getJavaScriptLoadIn($defaultIfEmpty = 'footer') | |
| 641 |     { | ||
| 642 | 25 |         $loadIn = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.loadIn', $defaultIfEmpty); | |
| 643 | 25 | return (string)$loadIn; | |
| 644 | } | ||
| 645 | |||
| 646 | /** | ||
| 647 | * Returns the _LOCAL_LANG configuration from the TypoScript. | ||
| 648 | * | ||
| 649 | * plugin.tx_solr._LOCAL_LANG. | ||
| 650 | * | ||
| 651 | * @param array $defaultIfEmpty | ||
| 652 | * @return array | ||
| 653 | */ | ||
| 654 | 25 | public function getLocalLangConfiguration(array $defaultIfEmpty = array()) | |
| 655 |     { | ||
| 656 | 25 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr._LOCAL_LANG.', $defaultIfEmpty); | |
| 657 | 25 | return $result; | |
| 658 | } | ||
| 659 | |||
| 660 | /** | ||
| 661 | * When this is enabled the output of the devlog, will be printed as debug output. | ||
| 662 | * | ||
| 663 | * @param bool $defaultIfEmpty | ||
| 664 | * @return bool | ||
| 665 | */ | ||
| 666 | public function getLoggingDebugOutputDevlog($defaultIfEmpty = false) | ||
| 667 |     { | ||
| 668 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.debugDevlogOutput', $defaultIfEmpty); | ||
| 669 | return $this->getBool($result); | ||
| 670 | } | ||
| 671 | |||
| 672 | /** | ||
| 673 | * Returns if query filters should be written to the log. | ||
| 674 | * | ||
| 675 | * plugin.tx_solr.logging.query.filters | ||
| 676 | * | ||
| 677 | * @param bool $defaultIfEmpty | ||
| 678 | * @return bool | ||
| 679 | */ | ||
| 680 | 36 | public function getLoggingQueryFilters($defaultIfEmpty = false) | |
| 681 |     { | ||
| 682 | 36 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.filters', $defaultIfEmpty); | |
| 683 | 36 | return $this->getBool($result); | |
| 684 | } | ||
| 685 | |||
| 686 | /** | ||
| 687 | * Returns if the querystring should be logged or not. | ||
| 688 | * | ||
| 689 | * plugin.tx_solr.logging.query.queryString | ||
| 690 | * | ||
| 691 | * @param bool $defaultIfEmpty | ||
| 692 | * @return bool | ||
| 693 | */ | ||
| 694 | 25 | public function getLoggingQueryQueryString($defaultIfEmpty = false) | |
| 695 |     { | ||
| 696 | 25 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.queryString', $defaultIfEmpty); | |
| 697 | 25 | return $this->getBool($result); | |
| 698 | } | ||
| 699 | |||
| 700 | /** | ||
| 701 | * Returns if the searchWords should be logged or not. | ||
| 702 | * | ||
| 703 | * plugin.tx_solr.logging.query.searchWords | ||
| 704 | * | ||
| 705 | * @param bool $defaultIfEmpty | ||
| 706 | * @return bool | ||
| 707 | */ | ||
| 708 | 24 | public function getLoggingQuerySearchWords($defaultIfEmpty = false) | |
| 709 |     { | ||
| 710 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.searchWords', $defaultIfEmpty); | |
| 711 | 24 | return $this->getBool($result); | |
| 712 | } | ||
| 713 | |||
| 714 | /** | ||
| 715 | * Returns if the rawGet requests should be logged or not. | ||
| 716 | * | ||
| 717 | * plugin.tx_solr.logging.query.rawGet | ||
| 718 | * | ||
| 719 | * @param bool $defaultIfEmpty | ||
| 720 | * @return bool | ||
| 721 | */ | ||
| 722 | 34 | public function getLoggingQueryRawGet($defaultIfEmpty = false) | |
| 723 |     { | ||
| 724 | 34 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawGet', $defaultIfEmpty); | |
| 725 | 34 | return $this->getBool($result); | |
| 726 | } | ||
| 727 | |||
| 728 | /** | ||
| 729 | * Returns if the rawPost requests should be logged or not. | ||
| 730 | * | ||
| 731 | * plugin.tx_solr.logging.query.rawPost | ||
| 732 | * | ||
| 733 | * @param bool $defaultIfEmpty | ||
| 734 | * @return bool | ||
| 735 | */ | ||
| 736 | 51 | public function getLoggingQueryRawPost($defaultIfEmpty = false) | |
| 737 |     { | ||
| 738 | 51 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawPost', $defaultIfEmpty); | |
| 739 | 51 | return $this->getBool($result); | |
| 740 | } | ||
| 741 | |||
| 742 | /** | ||
| 743 | * Returns if the rawDelete requests should be logged or not. | ||
| 744 | * | ||
| 745 | * plugin.tx_solr.logging.query.rawDelete | ||
| 746 | * | ||
| 747 | * @param bool $defaultIfEmpty | ||
| 748 | * @return bool | ||
| 749 | */ | ||
| 750 | 2 | public function getLoggingQueryRawDelete($defaultIfEmpty = false) | |
| 751 |     { | ||
| 752 | 2 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawDelete', $defaultIfEmpty); | |
| 753 | 2 | return $this->getBool($result); | |
| 754 | } | ||
| 755 | |||
| 756 | /** | ||
| 757 | * Returns if exceptions should be logged or not. | ||
| 758 | * | ||
| 759 | * plugin.tx_solr.logging.exceptions | ||
| 760 | * | ||
| 761 | * @param bool $defaultIfEmpty | ||
| 762 | * @return bool | ||
| 763 | */ | ||
| 764 | 1 | public function getLoggingExceptions($defaultIfEmpty = true) | |
| 765 |     { | ||
| 766 | 1 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.exceptions', $defaultIfEmpty); | |
| 767 | 1 | return $this->getBool($result); | |
| 768 | } | ||
| 769 | |||
| 770 | /** | ||
| 771 | * Returns if indexing operations should be logged or not. | ||
| 772 | * | ||
| 773 | * plugin.tx_solr.logging.indexing | ||
| 774 | * | ||
| 775 | * @param bool $defaultIfEmpty | ||
| 776 | * @return bool | ||
| 777 | */ | ||
| 778 | 48 | public function getLoggingIndexing($defaultIfEmpty = false) | |
| 779 |     { | ||
| 780 | 48 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing', $defaultIfEmpty); | |
| 781 | 48 | return $this->getBool($result); | |
| 782 | } | ||
| 783 | |||
| 784 | /** | ||
| 785 | * Returns if indexing queue operations should be logged or not. | ||
| 786 | * | ||
| 787 | * plugin.tx_solr.logging.indexing.queue | ||
| 788 | * | ||
| 789 | * @param bool $defaultIfEmpty | ||
| 790 | * @return bool | ||
| 791 | */ | ||
| 792 | 12 | public function getLoggingIndexingQueue($defaultIfEmpty = false) | |
| 793 |     { | ||
| 794 | 12 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.queue', $defaultIfEmpty); | |
| 795 | 12 | return $this->getBool($result); | |
| 796 | } | ||
| 797 | |||
| 798 | /** | ||
| 799 | * This method can be used to check if the logging during indexing should be done. | ||
| 800 | * It takes the specific configuration by indexQueueConfiguration into account or is using the | ||
| 801 | * fallback when the logging is enabled on queue or indexing level. | ||
| 802 | * | ||
| 803 | * plugin.tx_solr.logging.indexing.queue.<indexQueueConfiguration> | ||
| 804 | * | ||
| 805 | * @param string $indexQueueConfiguration | ||
| 806 | * @param bool $defaultIfEmpty | ||
| 807 | * @return bool | ||
| 808 | */ | ||
| 809 | 13 | public function getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($indexQueueConfiguration, $defaultIfEmpty = false) | |
| 810 |     { | ||
| 811 | // when logging is globally enabled we do not need to check the specific configuration | ||
| 812 | 13 |         if ($this->getLoggingIndexing()) { | |
| 813 | 1 | return true; | |
| 814 | } | ||
| 815 | |||
| 816 | // when the logging for indexing is enabled on queue level we also do not need to check the specific configuration | ||
| 817 | 12 |         if ($this->getLoggingIndexingQueue()) { | |
| 818 | return true; | ||
| 819 | } | ||
| 820 | |||
| 821 | 12 | $path = 'plugin.tx_solr.logging.indexing.queue.' . $indexQueueConfiguration; | |
| 822 | 12 | $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 823 | 12 | return $this->getBool($result); | |
| 824 | } | ||
| 825 | |||
| 826 | /** | ||
| 827 | * Returns if a log message should be written when a page was indexed. | ||
| 828 | * | ||
| 829 | * plugin.tx_solr.logging.indexing.pageIndexed | ||
| 830 | |||
| 831 | * @param bool $defaultIfEmpty | ||
| 832 | * @return bool | ||
| 833 | */ | ||
| 834 | 5 | public function getLoggingIndexingPageIndexed($defaultIfEmpty = false) | |
| 835 |     { | ||
| 836 | 5 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.pageIndexed', $defaultIfEmpty); | |
| 837 | 5 | return $this->getBool($result); | |
| 838 | } | ||
| 839 | |||
| 840 | /** | ||
| 841 | * Returns if a log message should be written when the TYPO3 search markers are missing in the page. | ||
| 842 | * | ||
| 843 | * plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers | ||
| 844 | |||
| 845 | * @param bool $defaultIfEmpty | ||
| 846 | * @return bool | ||
| 847 | */ | ||
| 848 | 6 | public function getLoggingIndexingMissingTypo3SearchMarkers($defaultIfEmpty = true) | |
| 849 |     { | ||
| 850 | 6 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers', $defaultIfEmpty); | |
| 851 | 6 | return $this->getBool($result); | |
| 852 | } | ||
| 853 | |||
| 854 | /** | ||
| 855 | * Returns if the initialization of an indexqueue should be logged. | ||
| 856 | * | ||
| 857 | * plugin.tx_solr.logging.indexing.indexQueueInitialization | ||
| 858 | * | ||
| 859 | * @param bool $defaultIfEmpty | ||
| 860 | * @return bool | ||
| 861 | */ | ||
| 862 | 7 | public function getLoggingIndexingIndexQueueInitialization($defaultIfEmpty = false) | |
| 863 |     { | ||
| 864 | 7 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.indexQueueInitialization', $defaultIfEmpty); | |
| 865 | 7 | return $this->getBool($result); | |
| 866 | } | ||
| 867 | |||
| 868 | /** | ||
| 869 | * Indicates if the debug mode is enabled or not. | ||
| 870 | * | ||
| 871 | * plugin.tx_solr.enableDebugMode | ||
| 872 | |||
| 873 | * @param bool $defaultIfEmpty | ||
| 874 | * @return bool | ||
| 875 | */ | ||
| 876 | 24 | public function getEnabledDebugMode($defaultIfEmpty = false) | |
| 877 |     { | ||
| 878 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.enableDebugMode', $defaultIfEmpty); | |
| 879 | 24 | return $this->getBool($result); | |
| 880 | } | ||
| 881 | |||
| 882 | /** | ||
| 883 | * Returns the defaultTimeout used for requests to the Solr server | ||
| 884 | * | ||
| 885 | * plugin.tx_solr.solr.defaultTimeout | ||
| 886 | * | ||
| 887 | * @param float $defaultIfEmpty | ||
| 888 | * @return float | ||
| 889 | */ | ||
| 890 | 67 | public function getSolrTimeout($defaultIfEmpty = 0.0) | |
| 891 |     { | ||
| 892 | 67 |         return (float)$this->getValueByPathOrDefaultValue('plugin.tx_solr.solr.timeout', $defaultIfEmpty); | |
| 893 | } | ||
| 894 | |||
| 895 | /** | ||
| 896 | * Retrieves the complete search configuration | ||
| 897 | * | ||
| 898 | * plugin.tx_solr.search. | ||
| 899 | * | ||
| 900 | * @param array $defaultIfEmpty | ||
| 901 | * @return array | ||
| 902 | */ | ||
| 903 | 24 | public function getSearchConfiguration(array $defaultIfEmpty = array()) | |
| 904 |     { | ||
| 905 | 24 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.', $defaultIfEmpty); | |
| 906 | 24 | return $result; | |
| 907 | } | ||
| 908 | |||
| 909 | /** | ||
| 910 | * Indicates if elevation should be used or not | ||
| 911 | * | ||
| 912 | * plugin.tx_solr.search.elevation | ||
| 913 | * | ||
| 914 | * @param bool $defaultIfEmpty | ||
| 915 | * @return bool | ||
| 916 | */ | ||
| 917 | 24 | public function getSearchElevation($defaultIfEmpty = false) | |
| 918 |     { | ||
| 919 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation', $defaultIfEmpty); | |
| 920 | 24 | return $this->getBool($result); | |
| 921 | } | ||
| 922 | |||
| 923 | /** | ||
| 924 | * Indicates if elevated results should be marked | ||
| 925 | * | ||
| 926 | * plugin.tx_solr.search.elevation.markElevatedResults | ||
| 927 | * | ||
| 928 | * @param bool $defaultIfEmpty | ||
| 929 | * @return bool | ||
| 930 | */ | ||
| 931 | 24 | public function getSearchElevationMarkElevatedResults($defaultIfEmpty = true) | |
| 932 |     { | ||
| 933 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.markElevatedResults', $defaultIfEmpty); | |
| 934 | 24 | return $this->getBool($result); | |
| 935 | } | ||
| 936 | |||
| 937 | /** | ||
| 938 | * Indicates if elevation should be forced | ||
| 939 | * | ||
| 940 | *plugin.tx_solr.search.elevation.forceElevation | ||
| 941 | * | ||
| 942 | * @param bool $defaultIfEmpty | ||
| 943 | * @return bool | ||
| 944 | */ | ||
| 945 | 24 | public function getSearchElevationForceElevation($defaultIfEmpty = true) | |
| 946 |     { | ||
| 947 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.forceElevation', $defaultIfEmpty); | |
| 948 | 24 | return $this->getBool($result); | |
| 949 | } | ||
| 950 | |||
| 951 | /** | ||
| 952 | * Indicates if collapsing on a certain field should be used to build variants or not. | ||
| 953 | * | ||
| 954 | * plugin.tx_solr.search.variants | ||
| 955 | * | ||
| 956 | * @param bool $defaultIfEmpty | ||
| 957 | * @return bool | ||
| 958 | */ | ||
| 959 | 128 | public function getSearchVariants($defaultIfEmpty = false) | |
| 960 |     { | ||
| 961 | 128 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants', $defaultIfEmpty); | |
| 962 | 128 | return $this->getBool($result); | |
| 963 | } | ||
| 964 | |||
| 965 | /** | ||
| 966 | * Indicates if collapsing on a certain field should be used or not | ||
| 967 | * | ||
| 968 | * plugin.tx_solr.search.variants.variantField | ||
| 969 | * | ||
| 970 | * @param string $defaultIfEmpty | ||
| 971 | * @return string | ||
| 972 | */ | ||
| 973 | 3 | public function getSearchVariantsField($defaultIfEmpty = 'variantId') | |
| 974 |     { | ||
| 975 | 3 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.variantField', $defaultIfEmpty); | |
| 976 | } | ||
| 977 | |||
| 978 | /** | ||
| 979 | * Indicates if expanding of collapsed items it activated. | ||
| 980 | * | ||
| 981 | * plugin.tx_solr.search.variants.expand | ||
| 982 | * | ||
| 983 | * @param bool $defaultIfEmpty | ||
| 984 | * @return bool | ||
| 985 | */ | ||
| 986 | 4 | public function getSearchVariantsExpand($defaultIfEmpty = false) | |
| 987 |     { | ||
| 988 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.expand', $defaultIfEmpty); | |
| 989 | 4 | return $this->getBool($result); | |
| 990 | } | ||
| 991 | |||
| 992 | /** | ||
| 993 | * Retrieves the number of elements that should be expanded. | ||
| 994 | * | ||
| 995 | * plugin.tx_solr.search.variants.limit | ||
| 996 | * | ||
| 997 | * @param int $defaultIfEmpty | ||
| 998 | * @return int | ||
| 999 | */ | ||
| 1000 | 2 | public function getSearchVariantsLimit($defaultIfEmpty = 10) | |
| 1001 |     { | ||
| 1002 | 2 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.limit', $defaultIfEmpty); | |
| 1003 | 2 | return (int)$result; | |
| 1004 | } | ||
| 1005 | |||
| 1006 | /** | ||
| 1007 | * Indicates if frequent searches should be show or not. | ||
| 1008 | * | ||
| 1009 | * plugin.tx_solr.search.frequentSearches | ||
| 1010 | * | ||
| 1011 | * @param bool $defaultIfEmpty | ||
| 1012 | * @return bool | ||
| 1013 | */ | ||
| 1014 | 23 | public function getSearchFrequentSearches($defaultIfEmpty = false) | |
| 1015 |     { | ||
| 1016 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches', $defaultIfEmpty); | |
| 1017 | 23 | return $this->getBool($result); | |
| 1018 | } | ||
| 1019 | |||
| 1020 | /** | ||
| 1021 | * Returns the sub configuration of the frequentSearches | ||
| 1022 | * | ||
| 1023 | * plugin.tx_solr.search.frequentSearches. | ||
| 1024 | * | ||
| 1025 | * @param array $defaultIfEmpty | ||
| 1026 | * @return array | ||
| 1027 | */ | ||
| 1028 | 23 | public function getSearchFrequentSearchesConfiguration($defaultIfEmpty = array()) | |
| 1029 |     { | ||
| 1030 | 23 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.frequentSearches.', $defaultIfEmpty); | |
| 1031 | 23 | return $result; | |
| 1032 | } | ||
| 1033 | |||
| 1034 | /** | ||
| 1035 | * Retrieves the minimum font size that should be used for the frequentSearches. | ||
| 1036 | * | ||
| 1037 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1038 | * | ||
| 1039 | * @param int $defaultIfEmpty | ||
| 1040 | * @return int | ||
| 1041 | */ | ||
| 1042 | public function getSearchFrequentSearchesMinSize($defaultIfEmpty = 14) | ||
| 1043 |     { | ||
| 1044 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.minSize', $defaultIfEmpty); | ||
| 1045 | return (int)$result; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | /** | ||
| 1049 | * Retrieves the maximum font size that should be used for the frequentSearches. | ||
| 1050 | * | ||
| 1051 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1052 | * | ||
| 1053 | * @param int $defaultIfEmpty | ||
| 1054 | * @return int | ||
| 1055 | */ | ||
| 1056 | public function getSearchFrequentSearchesMaxSize($defaultIfEmpty = 32) | ||
| 1057 |     { | ||
| 1058 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.maxSize', $defaultIfEmpty); | ||
| 1059 | return (int)$result; | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | /** | ||
| 1063 | * Indicates if frequent searches should be show or not. | ||
| 1064 | * | ||
| 1065 | * plugin.tx_solr.search.frequentSearches.useLowercaseKeywords | ||
| 1066 | * | ||
| 1067 | * @param bool $defaultIfEmpty | ||
| 1068 | * @return bool | ||
| 1069 | */ | ||
| 1070 | 18 | public function getSearchFrequentSearchesUseLowercaseKeywords($defaultIfEmpty = false) | |
| 1071 |     { | ||
| 1072 | 18 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.useLowercaseKeywords', $defaultIfEmpty); | |
| 1073 | 18 | return $this->getBool($result); | |
| 1074 | } | ||
| 1075 | |||
| 1076 | /** | ||
| 1077 | * Returns the configuration if the search should be initialized with an empty query. | ||
| 1078 | * | ||
| 1079 | * plugin.tx_solr.search.initializeWithEmptyQuery | ||
| 1080 | * | ||
| 1081 | * @param bool $defaultIfEmpty | ||
| 1082 | * @return bool | ||
| 1083 | */ | ||
| 1084 | 26 | public function getSearchInitializeWithEmptyQuery($defaultIfEmpty = false) | |
| 1085 |     { | ||
| 1086 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithEmptyQuery', $defaultIfEmpty); | |
| 1087 | 26 | return $this->getBool($result); | |
| 1088 | } | ||
| 1089 | |||
| 1090 | /** | ||
| 1091 | * Returns the configured initial query | ||
| 1092 | * | ||
| 1093 | * plugin.tx_solr.search.initializeWithQuery | ||
| 1094 | * | ||
| 1095 | * @param string $defaultIfEmpty | ||
| 1096 | * @return string | ||
| 1097 | */ | ||
| 1098 | 26 | public function getSearchInitializeWithQuery($defaultIfEmpty = '') | |
| 1099 |     { | ||
| 1100 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithQuery', $defaultIfEmpty); | |
| 1101 | 26 | return (string)$result; | |
| 1102 | } | ||
| 1103 | |||
| 1104 | /** | ||
| 1105 | * Returns if the last searches should be displayed or not. | ||
| 1106 | * | ||
| 1107 | * plugin.tx_solr.search.lastSearches | ||
| 1108 | * | ||
| 1109 | * @param bool $defaultIfEmpty | ||
| 1110 | * @return bool | ||
| 1111 | */ | ||
| 1112 | 23 | public function getSearchLastSearches($defaultIfEmpty = false) | |
| 1113 |     { | ||
| 1114 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches', $defaultIfEmpty); | |
| 1115 | 23 | return $this->getBool($result); | |
| 1116 | } | ||
| 1117 | |||
| 1118 | /** | ||
| 1119 | * Returns the lastSearch mode. "user" for user specific | ||
| 1120 | * | ||
| 1121 | * plugin.tx_solr.search.lastSearches.mode | ||
| 1122 | * | ||
| 1123 | * @param string $defaultIfEmpty | ||
| 1124 | * @return string | ||
| 1125 | */ | ||
| 1126 | 23 | public function getSearchLastSearchesMode($defaultIfEmpty = 'user') | |
| 1127 |     { | ||
| 1128 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.mode', $defaultIfEmpty); | |
| 1129 | 23 | return (string)$result; | |
| 1130 | } | ||
| 1131 | |||
| 1132 | /** | ||
| 1133 | * Returns the lastSearch limit | ||
| 1134 | * | ||
| 1135 | * plugin.tx_solr.search.lastSearches.limit | ||
| 1136 | * | ||
| 1137 | * @param int $defaultIfEmpty | ||
| 1138 | * @return int | ||
| 1139 | */ | ||
| 1140 | 23 | public function getSearchLastSearchesLimit($defaultIfEmpty = 10) | |
| 1141 |     { | ||
| 1142 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.limit', $defaultIfEmpty); | |
| 1143 | 23 | return (int)$result; | |
| 1144 | } | ||
| 1145 | |||
| 1146 | /** | ||
| 1147 | * Returns the search results fieldProcessingInstructions configuration array | ||
| 1148 | * | ||
| 1149 | * plugin.tx_solr.search.results.fieldProcessingInstructions. | ||
| 1150 | * | ||
| 1151 | * @param array $defaultIfEmpty | ||
| 1152 | * @return array | ||
| 1153 | */ | ||
| 1154 | 18 | public function getSearchResultsFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = array()) | |
| 1155 |     { | ||
| 1156 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldProcessingInstructions.', $defaultIfEmpty); | |
| 1157 | 18 | return $result; | |
| 1158 | } | ||
| 1159 | |||
| 1160 | /** | ||
| 1161 | * Returns the search results fieldRenderingInstructions configuration array | ||
| 1162 | * | ||
| 1163 | * plugin.tx_solr.search.results.fieldRenderingInstructions. | ||
| 1164 | * | ||
| 1165 | * @param array $defaultIfEmpty | ||
| 1166 | * @return array | ||
| 1167 | */ | ||
| 1168 | 18 | public function getSearchResultsFieldRenderingInstructionsConfiguration(array $defaultIfEmpty = array()) | |
| 1169 |     { | ||
| 1170 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldRenderingInstructions.', $defaultIfEmpty); | |
| 1171 | 18 | return $result; | |
| 1172 | } | ||
| 1173 | |||
| 1174 | /** | ||
| 1175 | * Indicates if the results of an initial empty query should be shown or not. | ||
| 1176 | * | ||
| 1177 | * plugin.tx_solr.search.showResultsOfInitialEmptyQuery | ||
| 1178 | * | ||
| 1179 | * @param bool $defaultIfEmpty | ||
| 1180 | * @return bool | ||
| 1181 | */ | ||
| 1182 | 4 | public function getSearchShowResultsOfInitialEmptyQuery($defaultIfEmpty = false) | |
| 1183 |     { | ||
| 1184 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialEmptyQuery', $defaultIfEmpty); | |
| 1185 | 4 | return $this->getBool($result); | |
| 1186 | } | ||
| 1187 | |||
| 1188 | /** | ||
| 1189 | * Indicates if the results of an initial search query should be shown. | ||
| 1190 | * | ||
| 1191 | * plugin.tx_solr.search.showResultsOfInitialQuery | ||
| 1192 | * | ||
| 1193 | * @param bool $defaultIfEmpty | ||
| 1194 | * @return bool | ||
| 1195 | */ | ||
| 1196 | 4 | public function getSearchShowResultsOfInitialQuery($defaultIfEmpty = false) | |
| 1197 |     { | ||
| 1198 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialQuery', $defaultIfEmpty); | |
| 1199 | 4 | return $this->getBool($result); | |
| 1200 | } | ||
| 1201 | |||
| 1202 | /** | ||
| 1203 | * Indicates if sorting was enabled or not. | ||
| 1204 | * | ||
| 1205 | * plugin.tx_solr.search.sorting | ||
| 1206 | * | ||
| 1207 | * @param bool $defaultIfEmpty | ||
| 1208 | * @return bool | ||
| 1209 | */ | ||
| 1210 | 17 | public function getSearchSorting($defaultIfEmpty = false) | |
| 1211 |     { | ||
| 1212 | 17 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.sorting', $defaultIfEmpty); | |
| 1213 | 17 | return $this->getBool($result); | |
| 1214 | } | ||
| 1215 | |||
| 1216 | /** | ||
| 1217 | * Returns the sorting options configurations. | ||
| 1218 | * | ||
| 1219 | * plugin.tx_solr.search.sorting.options. | ||
| 1220 | * | ||
| 1221 | * @param array $defaultIfEmpty | ||
| 1222 | * @return array | ||
| 1223 | */ | ||
| 1224 | 17 | public function getSearchSortingOptionsConfiguration($defaultIfEmpty = array()) | |
| 1229 | |||
| 1230 | /** | ||
| 1231 | * Retrieves the sorting default order for a sort option. | ||
| 1232 | * | ||
| 1233 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.defaultOrder | ||
| 1234 | * | ||
| 1235 | * or | ||
| 1236 | * | ||
| 1237 | * plugin.tx_solr.search.sorting.defaultOrder | ||
| 1238 | * | ||
| 1239 | * | ||
| 1240 | * @param string $sortOptionName | ||
| 1241 | * @param string $defaultIfEmpty | ||
| 1242 | * @return string | ||
| 1243 | */ | ||
| 1244 | 17 | public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc') | |
| 1245 |     { | ||
| 1246 | 17 | $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder'; | |
| 1247 | 17 | $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null); | |
| 1248 | |||
| 1249 | // if we have a concrete setting, use it | ||
| 1250 | 17 |         if ($specificSortOrder !== null) { | |
| 1251 | return $specificSortOrder; | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | // no specific setting, check common setting | ||
| 1255 | 17 | $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder'; | |
| 1256 | 17 | $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty); | |
| 1257 | 17 | return $commonATagParamOrDefaultValue; | |
| 1258 | } | ||
| 1259 | |||
| 1260 | /** | ||
| 1261 | * Returns the configured fixedOrder, if nothing configured defaultIfEmpty will be returned. | ||
| 1262 | * | ||
| 1263 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.fixedOrder | ||
| 1264 | * | ||
| 1265 | * @param string $sortOptionName | ||
| 1266 | * @param string $defaultIfEmpty | ||
| 1267 | * @return string | ||
| 1268 | */ | ||
| 1269 | 17 | public function getSearchSortingFixedOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = '') | |
| 1270 |     { | ||
| 1271 | 17 | $fixedOrder = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.fixedOrder'; | |
| 1272 | 17 | return $this->getValueByPathOrDefaultValue($fixedOrder, $defaultIfEmpty); | |
| 1273 | } | ||
| 1274 | |||
| 1275 | /** | ||
| 1276 | * Returns the trusted fields configured for the search that do not need to be escaped. | ||
| 1277 | * | ||
| 1278 | * @param array $defaultIfEmpty | ||
| 1279 | * @return array | ||
| 1280 | */ | ||
| 1281 | 18 |     public function getSearchTrustedFieldsArray($defaultIfEmpty = array('url')) | |
| 1282 |     { | ||
| 1283 | 18 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.trustedFields', ''); | |
| 1284 | |||
| 1285 | 18 |         if (trim($result) === '') { | |
| 1286 | return $defaultIfEmpty; | ||
| 1287 | } | ||
| 1288 | |||
| 1289 | 18 |         return GeneralUtility::trimExplode(',', $result); | |
| 1290 | } | ||
| 1291 | |||
| 1292 | /** | ||
| 1293 | * Indicates if the plugin arguments should be kept in the search form for a second submission. | ||
| 1294 | * | ||
| 1295 | * plugin.tx_solr.search.keepExistingParametersForNewSearches | ||
| 1296 | * | ||
| 1297 | * @param bool $defaultIfEmpty | ||
| 1298 | * @return bool | ||
| 1299 | */ | ||
| 1300 | 23 | public function getSearchKeepExistingParametersForNewSearches($defaultIfEmpty = false) | |
| 1301 |     { | ||
| 1302 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.keepExistingParametersForNewSearches', $defaultIfEmpty); | |
| 1303 | 23 | return $this->getBool($result); | |
| 1304 | } | ||
| 1305 | |||
| 1306 | /** | ||
| 1307 | * Returns if an empty query is allowed on the query level. | ||
| 1308 | * | ||
| 1309 | * plugin.tx_solr.search.query.allowEmptyQuery | ||
| 1310 | * | ||
| 1311 | * @param string $defaultIfEmpty | ||
| 1312 | * @return string | ||
| 1313 | */ | ||
| 1314 | 26 | public function getSearchQueryAllowEmptyQuery($defaultIfEmpty = '') | |
| 1315 |     { | ||
| 1316 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.allowEmptyQuery', $defaultIfEmpty); | |
| 1317 | 26 | return $this->getBool($result); | |
| 1318 | } | ||
| 1319 | |||
| 1320 | /** | ||
| 1321 | * Returns the fieldProcessingInstructions configuration array | ||
| 1322 | * | ||
| 1323 | * plugin.tx_solr.search.query.filter. | ||
| 1324 | * | ||
| 1325 | * @param array $defaultIfEmpty | ||
| 1326 | * @return array | ||
| 1327 | */ | ||
| 1328 | 32 | public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = array()) | |
| 1333 | |||
| 1334 | /** | ||
| 1335 | * Can be used to overwrite the filterConfiguration. | ||
| 1336 | * | ||
| 1337 | * plugin.tx_solr.search.query.filter. | ||
| 1338 | * | ||
| 1339 | * @param array $configuration | ||
| 1340 | */ | ||
| 1341 | 1 | public function setSearchQueryFilterConfiguration(array $configuration) | |
| 1342 |     { | ||
| 1343 | 1 |         $this->configurationAccess->set('plugin.tx_solr.search.query.filter.', $configuration); | |
| 1344 | 1 | } | |
| 1345 | |||
| 1346 | /** | ||
| 1347 | * Removes the pageSections filter setting. | ||
| 1348 | * | ||
| 1349 | * @return void | ||
| 1350 | */ | ||
| 1351 | 2 | public function removeSearchQueryFilterForPageSections() | |
| 1352 |     { | ||
| 1353 | 2 |         $this->configurationAccess->reset('plugin.tx_solr.search.query.filter.__pageSections'); | |
| 1354 | 2 | } | |
| 1355 | |||
| 1356 | /** | ||
| 1357 | * Returns the configured queryFields from TypoScript | ||
| 1358 | * | ||
| 1359 | * plugin.tx_solr.search.query.queryFields | ||
| 1360 | * | ||
| 1361 | * @param string $defaultIfEmpty | ||
| 1362 | * @return string | ||
| 1363 | */ | ||
| 1364 | 129 | public function getSearchQueryQueryFields($defaultIfEmpty = '') | |
| 1365 |     { | ||
| 1366 | 129 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.queryFields', $defaultIfEmpty); | |
| 1367 | } | ||
| 1368 | |||
| 1369 | /** | ||
| 1370 | * Returns the configured returnFields as array. | ||
| 1371 | * | ||
| 1372 | * plugin.tx_solr.search.query.returnFields | ||
| 1373 | * | ||
| 1374 | * @param array $defaultIfEmpty | ||
| 1375 | * @return array | ||
| 1376 | */ | ||
| 1377 | 129 | public function getSearchQueryReturnFieldsAsArray($defaultIfEmpty = array()) | |
| 1378 |     { | ||
| 1379 | 129 |         $returnFields = $this->getValueByPath('plugin.tx_solr.search.query.returnFields'); | |
| 1380 | 129 |         if (is_null($returnFields)) { | |
| 1381 | 103 | return $defaultIfEmpty; | |
| 1382 | } | ||
| 1383 | 26 |         return GeneralUtility::trimExplode(',', $returnFields); | |
|  | |||
| 1384 | } | ||
| 1385 | |||
| 1386 | /** | ||
| 1387 | * Returns the configured target page for the search. | ||
| 1388 | * By default the contextPageId will be used | ||
| 1389 | * | ||
| 1390 | * plugin.tx_solr.search.targetPage | ||
| 1391 | * | ||
| 1392 | * @return int | ||
| 1393 | */ | ||
| 1394 | 134 | public function getSearchTargetPage() | |
| 1395 |     { | ||
| 1396 | 134 |         $targetPage = (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.targetPage', 0); | |
| 1397 | 134 |         if ($targetPage === 0) { | |
| 1398 | // when no specific page was configured we use the contextPageId (which is usual $GLOBALS['TSFE']->id) | ||
| 1399 | 83 | $targetPage = $this->contextPageId; | |
| 1400 | } | ||
| 1401 | |||
| 1402 | 134 | return $targetPage; | |
| 1403 | } | ||
| 1404 | |||
| 1405 | /** | ||
| 1406 | * Retrieves the targetPage configuration. | ||
| 1407 | * | ||
| 1408 | * plugin.tx_solr.search.targetPage. | ||
| 1409 | * | ||
| 1410 | * @param array $defaultIfEmpty | ||
| 1411 | * @return array | ||
| 1412 | */ | ||
| 1413 | 28 | public function getSearchTargetPageConfiguration(array $defaultIfEmpty = array()) | |
| 1414 |     { | ||
| 1415 | 28 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.targetPage.', $defaultIfEmpty); | |
| 1416 | 28 | return $result; | |
| 1417 | } | ||
| 1418 | |||
| 1419 | /** | ||
| 1420 | * Retrieves the pagebrowser configuration. | ||
| 1421 | * | ||
| 1422 | * plugin.tx_solr.search.results.pagebrowser. | ||
| 1423 | * | ||
| 1424 | * @param array $defaultIfEmpty | ||
| 1425 | * @return array | ||
| 1426 | */ | ||
| 1427 | 18 | public function getSearchResultsPageBrowserConfiguration(array $defaultIfEmpty = array()) | |
| 1428 |     { | ||
| 1429 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.pagebrowser.', $defaultIfEmpty); | |
| 1430 | 18 | return $result; | |
| 1431 | } | ||
| 1432 | |||
| 1433 | /** | ||
| 1434 | * Returns the result highlighting fields. | ||
| 1435 | * | ||
| 1436 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1437 | * | ||
| 1438 | * @param string $defaultIfEmpty | ||
| 1439 | * @return string | ||
| 1440 | */ | ||
| 1441 | 31 | public function getSearchResultsHighlightingFields($defaultIfEmpty = '') | |
| 1442 |     { | ||
| 1443 | 31 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.highlightFields', $defaultIfEmpty); | |
| 1444 | } | ||
| 1445 | |||
| 1446 | /** | ||
| 1447 | * Returns the result highlighting fields as array. | ||
| 1448 | * | ||
| 1449 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1450 | * | ||
| 1451 | * @param array $defaultIfEmpty | ||
| 1452 | * @return array | ||
| 1453 | */ | ||
| 1454 | 18 | public function getSearchResultsHighlightingFieldsAsArray($defaultIfEmpty = array()) | |
| 1455 |     { | ||
| 1456 | 18 |         $highlightingFields = $this->getSearchResultsHighlightingFields(''); | |
| 1457 | |||
| 1458 | 18 |         if ($highlightingFields === '') { | |
| 1459 | return $defaultIfEmpty; | ||
| 1460 | } | ||
| 1461 | |||
| 1462 | 18 |         return GeneralUtility::trimExplode(',', $highlightingFields, true); | |
| 1463 | } | ||
| 1464 | |||
| 1465 | /** | ||
| 1466 | * Returns the fragmentSeparator for highlighted segments. | ||
| 1467 | * | ||
| 1468 | * plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator | ||
| 1469 | * | ||
| 1470 | * @param string $defaultIfEmpty | ||
| 1471 | * @return string | ||
| 1472 | */ | ||
| 1473 | 18 | public function getSearchResultsHighlightingFragmentSeparator($defaultIfEmpty = '[...]') | |
| 1474 |     { | ||
| 1475 | 18 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator', $defaultIfEmpty); | |
| 1476 | } | ||
| 1477 | |||
| 1478 | /** | ||
| 1479 | * Returns the number of results that should be shown per page. | ||
| 1480 | * | ||
| 1481 | * plugin.tx_solr.search.results.resultsPerPage | ||
| 1482 | * | ||
| 1483 | * @param int $defaultIfEmpty | ||
| 1484 | * @return int | ||
| 1485 | */ | ||
| 1486 | 24 | public function getSearchResultsPerPage($defaultIfEmpty = 10) | |
| 1487 |     { | ||
| 1488 | 24 |         return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPage', $defaultIfEmpty); | |
| 1489 | } | ||
| 1490 | |||
| 1491 | /** | ||
| 1492 | * Returns the available options for the per page switch. | ||
| 1493 | * | ||
| 1494 | * plugin.tx_solr.search.results.resultsPerPageSwitchOptions | ||
| 1495 | * | ||
| 1496 | * @param array $defaultIfEmpty | ||
| 1497 | * @return array | ||
| 1498 | */ | ||
| 1499 | 24 | public function getSearchResultsPerPageSwitchOptionsAsArray($defaultIfEmpty = array()) | |
| 1500 |     { | ||
| 1501 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPageSwitchOptions', ''); | |
| 1502 | |||
| 1503 | 24 |         if (trim($result) === '') { | |
| 1504 | return $defaultIfEmpty; | ||
| 1505 | } | ||
| 1506 | |||
| 1507 | 24 |         return GeneralUtility::intExplode(',', $result, true); | |
| 1508 | } | ||
| 1509 | |||
| 1510 | /** | ||
| 1511 | * Returns the configured wrap for the resultHighlighting. | ||
| 1512 | * | ||
| 1513 | * plugin.tx_solr.search.results.resultsHighlighting.wrap | ||
| 1514 | * | ||
| 1515 | * @param string $defaultIfEmpty | ||
| 1516 | * @return string | ||
| 1517 | */ | ||
| 1518 | 31 | public function getSearchResultsHighlightingWrap($defaultIfEmpty = '') | |
| 1519 |     { | ||
| 1520 | 31 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.wrap', $defaultIfEmpty); | |
| 1521 | } | ||
| 1522 | |||
| 1523 | /** | ||
| 1524 | * Indicates if spellchecking is enabled or not. | ||
| 1525 | * | ||
| 1526 | * plugin.tx_solr.search.spellchecking | ||
| 1527 | * | ||
| 1528 | * @param bool $defaultIfEmpty | ||
| 1529 | * @return bool | ||
| 1530 | */ | ||
| 1531 | 25 | public function getSearchSpellchecking($defaultIfEmpty = false) | |
| 1532 |     { | ||
| 1533 | 25 |         $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking', $defaultIfEmpty); | |
| 1534 | 25 | return $this->getBool($isFacetingEnabled); | |
| 1535 | } | ||
| 1536 | |||
| 1537 | /** | ||
| 1538 | * Returns the wrap that should be used for spellchecking | ||
| 1539 | * | ||
| 1540 | * plugin.tx_solr.search.spellchecking.wrap | ||
| 1541 | * | ||
| 1542 | * @param string $defaultIfEmpty | ||
| 1543 | * @return string | ||
| 1544 | */ | ||
| 1545 | 5 | public function getSearchSpellcheckingWrap($defaultIfEmpty = '') | |
| 1546 |     { | ||
| 1547 | 5 |         return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.wrap', $defaultIfEmpty); | |
| 1548 | } | ||
| 1549 | |||
| 1550 | /** | ||
| 1551 | * Returns the numberOfSuggestionsToTry that should be used for the spellchecking. | ||
| 1552 | * | ||
| 1553 | * plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry | ||
| 1554 | * | ||
| 1555 | * @param int $defaultIfEmpty | ||
| 1556 | * @return int | ||
| 1557 | */ | ||
| 1558 | 22 | public function getSearchSpellcheckingNumberOfSuggestionsToTry($defaultIfEmpty = 0) | |
| 1559 |     { | ||
| 1560 | 22 |         return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry', $defaultIfEmpty); | |
| 1561 | } | ||
| 1562 | |||
| 1563 | /** | ||
| 1564 | * Indicates if a second search should be fired from the spellchecking suggestion if no results could be found. | ||
| 1565 | * | ||
| 1566 | * plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion | ||
| 1567 | * | ||
| 1568 | * @param bool $defaultIfEmpty | ||
| 1569 | * @return bool | ||
| 1570 | */ | ||
| 1571 | 3 | public function getSearchSpellcheckingSearchUsingSpellCheckerSuggestion($defaultIfEmpty = false) | |
| 1572 |     { | ||
| 1573 | 3 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion', $defaultIfEmpty); | |
| 1574 | 3 | return $this->getBool($result); | |
| 1575 | } | ||
| 1576 | |||
| 1577 | /** | ||
| 1578 | * Indicates if faceting is enabled or not. | ||
| 1579 | * | ||
| 1580 | * plugin.tx_solr.search.faceting | ||
| 1581 | * | ||
| 1582 | * @param bool $defaultIfEmpty | ||
| 1583 | * @return bool | ||
| 1584 | */ | ||
| 1585 | 20 | public function getSearchFaceting($defaultIfEmpty = false) | |
| 1586 |     { | ||
| 1587 | 20 |         $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting', $defaultIfEmpty); | |
| 1588 | 20 | return $this->getBool($isFacetingEnabled); | |
| 1589 | } | ||
| 1590 | |||
| 1591 | /** | ||
| 1592 | * Retrieves the facetLinkATagParams for a facet by facet name. If nothing specific is configured | ||
| 1593 | * the global facetLinkATagParams with be returned. | ||
| 1594 | * | ||
| 1595 | * plugin.tx_solr.search.faceting.facets.<facetName>.facetLinkATagParams | ||
| 1596 | * | ||
| 1597 | * or | ||
| 1598 | * | ||
| 1599 | * plugin.tx_solr.search.faceting.facetLinkATagParams | ||
| 1600 | * | ||
| 1601 | * | ||
| 1602 | * @param string $facetName | ||
| 1603 | * @param string $defaultIfEmpty | ||
| 1604 | * @return string | ||
| 1605 | */ | ||
| 1606 | 19 | public function getSearchFacetingFacetLinkATagParamsByName($facetName = '', $defaultIfEmpty = '') | |
| 1607 |     { | ||
| 1608 | 19 | $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.facetLinkATagParams'; | |
| 1609 | 19 | $specificATagParam = $this->getValueByPathOrDefaultValue($facetSpecificPath, null); | |
| 1610 | |||
| 1611 | // if we have a concrete setting, use it | ||
| 1612 | 19 |         if ($specificATagParam !== null) { | |
| 1613 | 1 | return $specificATagParam; | |
| 1614 | } | ||
| 1615 | |||
| 1616 | // no specific setting, check common setting | ||
| 1617 | 19 | $commonPath = 'plugin.tx_solr.search.faceting.facetLinkATagParams'; | |
| 1618 | 19 | $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty); | |
| 1619 | 19 | return $commonATagParamOrDefaultValue; | |
| 1620 | } | ||
| 1621 | |||
| 1622 | /** | ||
| 1623 | * Returns the test that should be used to remove a faceting link | ||
| 1624 | * | ||
| 1625 | * plugin.tx_solr.search.faceting.removeFacetLinkText | ||
| 1626 | * | ||
| 1627 | * @param string $defaultIfEmpty | ||
| 1628 | * @return string | ||
| 1629 | */ | ||
| 1630 | 1 | public function getSearchFacetingRemoveFacetLinkText($defaultIfEmpty = '@facetLabel: @facetText') | |
| 1634 | |||
| 1635 | /** | ||
| 1636 | * Retrieves the showEvenWhenEmpty for a facet by facet name. If nothing specific is configured | ||
| 1637 | * the global showEmptyFacets with be returned. | ||
| 1638 | * | ||
| 1639 | * plugin.tx_solr.search.faceting.facets.<facetName>.showEvenWhenEmpty | ||
| 1640 | * | ||
| 1641 | * or | ||
| 1642 | * | ||
| 1643 | * plugin.tx_solr.search.faceting.showEmptyFacets | ||
| 1644 | * | ||
| 1645 | * | ||
| 1646 | * @param string $facetName | ||
| 1647 | * @param bool $defaultIfEmpty | ||
| 1648 | * @return bool | ||
| 1649 | */ | ||
| 1650 | 19 | public function getSearchFacetingShowEmptyFacetsByName($facetName = '', $defaultIfEmpty = false) | |
| 1651 |     { | ||
| 1652 | 19 | $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.showEvenWhenEmpty'; | |
| 1653 | 19 | $specificShowWhenEmpty = $this->getValueByPathOrDefaultValue($facetSpecificPath, null); | |
| 1654 | |||
| 1655 | // if we have a concrete setting, use it | ||
| 1656 | 19 |         if ($specificShowWhenEmpty !== null) { | |
| 1657 | 1 | return $specificShowWhenEmpty; | |
| 1658 | } | ||
| 1659 | |||
| 1660 | // no specific setting, check common setting | ||
| 1661 | 19 | $commonPath = 'plugin.tx_solr.search.faceting.showEmptyFacets'; | |
| 1662 | 19 | $commonIfEmptyOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty); | |
| 1663 | 19 | return $commonIfEmptyOrDefaultValue; | |
| 1664 | } | ||
| 1665 | |||
| 1666 | /** | ||
| 1667 | * Returns the wrap for the faceting show all link | ||
| 1668 | * | ||
| 1669 | * plugin.tx_solr.search.faceting.showAllLink.wrap | ||
| 1670 | * | ||
| 1671 | * @param string $defaultIfEmpty | ||
| 1672 | * @return string | ||
| 1673 | */ | ||
| 1674 | public function getSearchFacetingShowAllLinkWrap($defaultIfEmpty = '') | ||
| 1675 |     { | ||
| 1676 |         return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.showAllLink.wrap', $defaultIfEmpty); | ||
| 1677 | } | ||
| 1678 | |||
| 1679 | /** | ||
| 1680 | * Returns the link url parameters that should be added to a facet. | ||
| 1681 | * | ||
| 1682 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1683 | * | ||
| 1684 | * @param string $defaultIfEmpty | ||
| 1685 | * @return string | ||
| 1686 | */ | ||
| 1687 | 18 | public function getSearchFacetingFacetLinkUrlParameters($defaultIfEmpty = '') | |
| 1688 |     { | ||
| 1689 | 18 |         $linkUrlParameters = trim($this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters', $defaultIfEmpty)); | |
| 1690 | |||
| 1691 | 18 | return $linkUrlParameters; | |
| 1692 | } | ||
| 1693 | |||
| 1694 | /** | ||
| 1695 | * Returns if the facetLinkUrlsParameters should be included in the reset link. | ||
| 1696 | * | ||
| 1697 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl | ||
| 1698 | * | ||
| 1699 | * @param bool $defaultIfEmpty | ||
| 1700 | * @return bool | ||
| 1701 | */ | ||
| 1702 | 18 | public function getSearchFacetingFacetLinkUrlParametersUseForFacetResetLinkUrl($defaultIfEmpty = true) | |
| 1703 |     { | ||
| 1704 | 18 |         $useForFacetResetLinkUrl = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl', $defaultIfEmpty); | |
| 1705 | 18 | return $this->getBool($useForFacetResetLinkUrl); | |
| 1706 | } | ||
| 1707 | |||
| 1708 | /** | ||
| 1709 | * Returns the link url parameters that should be added to a facet as array. | ||
| 1710 | * | ||
| 1711 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1712 | * | ||
| 1713 | * @param array $defaultIfEmpty | ||
| 1714 | * @return array | ||
| 1715 | */ | ||
| 1716 | 18 | public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = array()) | |
| 1725 | |||
| 1726 | /** | ||
| 1727 | * Return the configured minimumCount value for facets. | ||
| 1728 | * | ||
| 1729 | * plugin.tx_solr.search.faceting.minimumCount | ||
| 1730 | * | ||
| 1731 | * @param int $defaultIfEmpty | ||
| 1732 | * @return int | ||
| 1733 | */ | ||
| 1734 | 31 | public function getSearchFacetingMinimumCount($defaultIfEmpty = 1) | |
| 1738 | |||
| 1739 | /** | ||
| 1740 | * Return the configured limit value for facets, used for displaying. | ||
| 1741 | * | ||
| 1742 | * plugin.tx_solr.search.faceting.limit | ||
| 1743 | * | ||
| 1744 | * @param int $defaultIfEmpty | ||
| 1745 | * @return int | ||
| 1746 | */ | ||
| 1747 | 18 | public function getSearchFacetingLimit($defaultIfEmpty = 10) | |
| 1751 | |||
| 1752 | /** | ||
| 1753 | * Return the configured limit value for facets, used for the response. | ||
| 1754 | * | ||
| 1755 | * plugin.tx_solr.search.faceting.facetLimit | ||
| 1756 | * | ||
| 1757 | * @param int $defaultIfEmpty | ||
| 1758 | * @return int | ||
| 1759 | */ | ||
| 1760 | 31 | public function getSearchFacetingFacetLimit($defaultIfEmpty = 100) | |
| 1764 | |||
| 1765 | /** | ||
| 1766 | * Returns if the singleFacetMode is active or not. | ||
| 1767 | * | ||
| 1768 | * plugin.tx_solr.search.faceting.singleFacetMode | ||
| 1769 | * | ||
| 1770 | * @param bool $defaultIfEmpty | ||
| 1771 | * @return bool | ||
| 1772 | */ | ||
| 1773 | 1 | public function getSearchFacetingSingleFacetMode($defaultIfEmpty = false) | |
| 1778 | |||
| 1779 | /** | ||
| 1780 | * Return the configured faceting sortBy value. | ||
| 1781 | * | ||
| 1782 | * plugin.tx_solr.search.faceting.sortBy | ||
| 1783 | * | ||
| 1784 | * @param string $defaultIfEmpty | ||
| 1785 | * @return string | ||
| 1786 | */ | ||
| 1787 | 31 | public function getSearchFacetingSortBy($defaultIfEmpty = '') | |
| 1791 | |||
| 1792 | /** | ||
| 1793 | * Returns if a facets should be kept on selection. Global faceting setting | ||
| 1794 | * can also be configured on facet level by using | ||
| 1795 | * (plugin.tx_solr.search.faceting.facets.<fieldName>.keepAllOptionsOnSelection) | ||
| 1796 | * | ||
| 1797 | * plugin.tx_solr.search.faceting.keepAllFacetsOnSelection | ||
| 1798 | * | ||
| 1799 | * @param bool $defaultIfEmpty | ||
| 1800 | * @return bool | ||
| 1801 | */ | ||
| 1802 | 27 | public function getSearchFacetingKeepAllFacetsOnSelection($defaultIfEmpty = false) | |
| 1807 | |||
| 1808 | /** | ||
| 1809 | * Returns the configured faceting configuration. | ||
| 1810 | * | ||
| 1811 | * plugin.tx_solr.search.faceting.facets | ||
| 1812 | * | ||
| 1813 | * @param array $defaultIfEmpty | ||
| 1814 | * @return array | ||
| 1815 | */ | ||
| 1816 | 27 | public function getSearchFacetingFacets(array $defaultIfEmpty = array()) | |
| 1820 | |||
| 1821 | /** | ||
| 1822 | * Returns the configuration of a single facet by facet name. | ||
| 1823 | * | ||
| 1824 | * plugin.tx_solr.search.faceting.facets.<facetName> | ||
| 1825 | * | ||
| 1826 | * @param string $facetName | ||
| 1827 | * @param array $defaultIfEmpty | ||
| 1828 | * @return array | ||
| 1829 | */ | ||
| 1830 | 18 | public function getSearchFacetingFacetByName($facetName, $defaultIfEmpty = array()) | |
| 1834 | |||
| 1835 | /** | ||
| 1836 | * Indicates if statistics is enabled or not. | ||
| 1837 | * | ||
| 1838 | * plugin.tx_solr.statistics | ||
| 1839 | * | ||
| 1840 | * @param bool $defaultIfEmpty | ||
| 1841 | * @return bool | ||
| 1842 | */ | ||
| 1843 | 24 | public function getStatistics($defaultIfEmpty = false) | |
| 1848 | |||
| 1849 | /** | ||
| 1850 | * Indicates to which length an ip should be anonymized in the statistics | ||
| 1851 | * | ||
| 1852 | * plugin.tx_solr.statistics.anonymizeIP | ||
| 1853 | * | ||
| 1854 | * @param int $defaultIfEmpty | ||
| 1855 | * @return int | ||
| 1856 | */ | ||
| 1857 | 18 | public function getStatisticsAnonymizeIP($defaultIfEmpty = 0) | |
| 1862 | |||
| 1863 | /** | ||
| 1864 | * Indicates if additional debug Data should be added to the statistics | ||
| 1865 | * | ||
| 1866 | * plugin.tx_solr.statistics.addDebugData | ||
| 1867 | * | ||
| 1868 | * @param bool $defaultIfEmpty | ||
| 1869 | * @return bool | ||
| 1870 | */ | ||
| 1871 | 20 | public function getStatisticsAddDebugData($defaultIfEmpty = false) | |
| 1872 |     { | ||
| 1873 | 20 |         $statisticsAddDebugDataEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.statistics.addDebugData', $defaultIfEmpty); | |
| 1874 | 20 | return $this->getBool($statisticsAddDebugDataEnabled); | |
| 1875 | } | ||
| 1876 | |||
| 1877 | /** | ||
| 1878 | * Indicates if suggestion is enabled or not. | ||
| 1879 | * | ||
| 1880 | * plugin.tx_solr.suggest | ||
| 1881 | * | ||
| 1882 | * @param bool $defaultIfEmpty | ||
| 1883 | * @return bool | ||
| 1884 | */ | ||
| 1885 | 25 | public function getSuggest($defaultIfEmpty = false) | |
| 1890 | |||
| 1891 | /** | ||
| 1892 | * Indicates if https should be used for the suggest form. | ||
| 1893 | * | ||
| 1894 | * plugin.tx_solr.suggest.forceHttps | ||
| 1895 | * | ||
| 1896 | * @param bool $defaultIfEmpty | ||
| 1897 | * @return bool | ||
| 1898 | */ | ||
| 1899 | 25 | public function getSuggestForceHttps($defaultIfEmpty = false) | |
| 1904 | |||
| 1905 | /** | ||
| 1906 | * Returns the configured template for a specific template fileKey. | ||
| 1907 | * | ||
| 1908 | * plugin.tx_solr.search.templateFiles.<fileKey> | ||
| 1909 | * | ||
| 1910 | * @param string $fileKey | ||
| 1911 | * @param string $defaultIfEmpty | ||
| 1912 | * @return string | ||
| 1913 | */ | ||
| 1914 | 25 | public function getTemplateByFileKey($fileKey, $defaultIfEmpty = '') | |
| 1919 | |||
| 1920 | /** | ||
| 1921 | * Returns the configuration of the crop view helper. | ||
| 1922 | * | ||
| 1923 | * plugin.tx_solr.viewHelpers.crop. | ||
| 1924 | * | ||
| 1925 | * @param array $defaultIfEmpty | ||
| 1926 | * @return array | ||
| 1927 | */ | ||
| 1928 | 1 | public function getViewHelpersCropConfiguration(array $defaultIfEmpty = array()) | |
| 1933 | |||
| 1934 | /** | ||
| 1935 | * Returns the configuration of the sorting view helper. | ||
| 1936 | * | ||
| 1937 | * plugin.tx_solr.viewHelpers.sortIndicator. | ||
| 1938 | * | ||
| 1939 | * @param array $defaultIfEmpty | ||
| 1940 | * @return array | ||
| 1941 | */ | ||
| 1942 | 17 | public function getViewHelpersSortIndicatorConfiguration(array $defaultIfEmpty = array()) | |
| 1947 | } | ||
| 1948 | 
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: