All Projects → tbaddade → redaxo_sherlock

tbaddade / redaxo_sherlock

Licence: other
Sherlock

Programming Languages

PHP
23972 projects - #3 most used programming language

Sherlock

<?php

use Sherlock\Result;
use Sherlock\ResultSet;
use Sherlock\Searcher\Structure;
use Sherlock\SearchFilter;
use Sherlock\Sherlock;

$content = $this->getArticle();

$searchFilter = SearchFilter::create()->handleRequest();
if ($searchFilter->getCurrent()) {
    
    $content = '';
    if (strlen(trim($searchFilter->getCurrent())) >= 3) {
        // mind. drei Zeichen
        $content = Sherlock::create()
            ->addSearch(new Structure())
            ->search();
    }

    if ($content == '') {
        // Nichts gefunden
        $resultSet = new ResultSet();
        $resultSet->setHeading('Watson: "Eindrucksvoll. Wirklich eindrucksvoll."');

        $result = new Result();
        $result->setText('
            Sherlock: "Das bekomme ich selten zu hören."
            Watson: "Was bekommen Sie sonst zu hören?"
            Sherlock: "Verpiss dich."
        ');
        $resultSet->addResult($result);
        $content = $resultSet->render();
    }
}

echo $content;
<?php

use Sherlock\SearchFilter;

$searchFilter = SearchFilter::create()->handleRequest();

echo sprintf(
    '<form action="%s" method="get">
        <input name="%s" value="%s" type="text" placeholder="Sherlock: Stagnation macht meinen Geist rebellisch! Geben Sie mir Probleme, geben Sie mir Arbeit!" />
    </form>', 
    rex_getUrl(), 
    $searchFilter->getKey(),
    rex_escape($searchFilter->getCurrent())
);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].