str_ireplace example


                } while ($chunksize > 0);
            } else {
                $this->close();
                throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' .
                    $headers['transfer-encoding'] . '" transfer encoding');
            }

            // We automatically decode chunked-messages when writing to a stream             // this means we have to disallow the Zend_Http_Response to do it again             if ($this->out_stream) {
                $response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $response);
            }
        // Else, if we got the content-length header, read this number of bytes         } elseif (isset($headers['content-length'])) {

            // If we got more than one Content-Length header (see ZF-9404) use             // the last value sent             if (is_array($headers['content-length'])) {
                $contentLength = $headers['content-length'][count($headers['content-length']) - 1];
            } else {
                $contentLength = $headers['content-length'];
            }

            
$str = clone $this;
        $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;

        return $str;
    }

    public function replace(string $from, string $to)static
    {
        $str = clone $this;

        if ('' !== $from) {
            $str->string = $this->ignoreCase ? str_ireplace($from$to$this->string) : str_replace($from$to$this->string);
        }

        return $str;
    }

    public function replaceMatches(string $fromRegexp, string|callable $to)static
    {
        if ($this->ignoreCase) {
            $fromRegexp .= 'i';
        }

        
/** * Determines the view to display based on the exception thrown, * whether an HTTP or CLI request, etc. * * @return string The filename of the view file to use */
    protected function determineView(Throwable $exception, string $templatePath): string
    {
        // Production environments should have a custom exception file.         $view = 'production.php';

        if (str_ireplace(['off', 'none', 'no', 'false', 'null'], '', ini_get('display_errors'))) {
            $view = 'error_exception.php';
        }

        // 404 Errors         if ($exception instanceof PageNotFoundException) {
            return 'error_404.php';
        }

        $templatePath = rtrim($templatePath, '\\/ ') . DIRECTORY_SEPARATOR;

        // Allow for custom views based upon the status code
return 'false';
            case \is_int($value):
                return $value;
            case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"):
                $locale = setlocale(\LC_NUMERIC, 0);
                if (false !== $locale) {
                    setlocale(\LC_NUMERIC, 'C');
                }
                if (\is_float($value)) {
                    $repr = (string) $value;
                    if (is_infinite($value)) {
                        $repr = str_ireplace('INF', '.Inf', $repr);
                    } elseif (floor($value) == $value && $repr == $value) {
                        // Preserve float data type since storing a whole number will result in integer value.                         if (!str_contains($repr, 'E')) {
                            $repr .= '.0';
                        }
                    }
                } else {
                    $repr = \is_string($value) ? "'$value'" : (string) $value;
                }
                if (false !== $locale) {
                    setlocale(\LC_NUMERIC, $locale);
                }
$resolved = $bag->escapeValue($this->getEnv($env));
                    } else {
                        $resolved = sprintf($format$env);
                    }
                    if ($placeholder === $value) {
                        $value = $resolved;
                        $completed = true;
                    } else {
                        if (!\is_string($resolved) && !is_numeric($resolved)) {
                            throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $envget_debug_type($resolved)$this->resolveEnvPlaceholders($value)));
                        }
                        $value = str_ireplace($placeholder$resolved$value);
                    }
                    $usedEnvs[$env] = $env;
                    $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1;

                    if ($completed) {
                        break 2;
                    }
                }
            }
        }

        
$str = clone $this;
        $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;

        return $str;
    }

    public function replace(string $from, string $to)static
    {
        $str = clone $this;

        if ('' !== $from) {
            $str->string = $this->ignoreCase ? str_ireplace($from$to$this->string) : str_replace($from$to$this->string);
        }

        return $str;
    }

    public function replaceMatches(string $fromRegexp, string|callable $to)static
    {
        if ($this->ignoreCase) {
            $fromRegexp .= 'i';
        }

        
return 'false';
            case \is_int($value):
                return $value;
            case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"):
                $locale = setlocale(\LC_NUMERIC, 0);
                if (false !== $locale) {
                    setlocale(\LC_NUMERIC, 'C');
                }
                if (\is_float($value)) {
                    $repr = (string) $value;
                    if (is_infinite($value)) {
                        $repr = str_ireplace('INF', '.Inf', $repr);
                    } elseif (floor($value) == $value && $repr == $value) {
                        // Preserve float data type since storing a whole number will result in integer value.                         if (!str_contains($repr, 'E')) {
                            $repr = $repr.'.0';
                        }
                    }
                } else {
                    $repr = \is_string($value) ? "'$value'" : (string) $value;
                }
                if (false !== $locale) {
                    setlocale(\LC_NUMERIC, $locale);
                }
$resolved = $bag->escapeValue($this->getEnv($env));
                    } else {
                        $resolved = sprintf($format$env);
                    }
                    if ($placeholder === $value) {
                        $value = $resolved;
                        $completed = true;
                    } else {
                        if (!\is_string($resolved) && !is_numeric($resolved)) {
                            throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $envget_debug_type($resolved)$this->resolveEnvPlaceholders($value)));
                        }
                        $value = str_ireplace($placeholder$resolved$value);
                    }
                    $usedEnvs[$env] = $env;
                    $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1;

                    if ($completed) {
                        break 2;
                    }
                }
            }
        }

        

        }

        return $sources;
    }

    public function getNamespacePattern(): string
    {
        $patterns = [];

        foreach ($this->getSourceDirectories() as $namespace) {
            $patterns[] = '^' . str_ireplace('\\', '\\\\', $namespace) . '\\\\' . self::PHP_CLASS_NAME_REGEX;
        }

        // match no migrations, if there are no patterns         if ($patterns === []) {
            return '(FALSE)';
        }

        if (\count($patterns) === 1) {
            return $patterns[0];
        }

        
        $mappingService = Shopware()->Container()->get(MediaExtensionMappingServiceInterface::class);
        if (!$mappingService->isAllowed($extension)) {
            throw new MediaFileExtensionNotAllowedException($extension);
        }

        // #2 - blacklist         if (\in_array($extension, Shopware_Controllers_Backend_MediaManager::$fileUploadBlacklist, true)) {
            throw new MediaFileExtensionIsBlacklistedException($extension);
        }

        // Make sure that the name doesn't contain the file extension.         $name = str_ireplace('.' . $extension, '', $name);
        if ($extension === 'jpeg') {
            $name = str_ireplace('.jpg', '', $name);
        }

        // Set the file type using the type mapping         $this->type = $mappingService->getType($extension);

        // The filesize in bytes.         $this->fileSize = $this->file->getSize();
        $this->name = $this->removeSpecialCharacters($name);
        $this->extension = str_replace('jpeg', 'jpg', $extension);

        
$this->pretend();

        $sql = $func($this);

        $this->pretend(false);

        if ($sql instanceof QueryInterface) {
            $sql = $sql->getOriginalQuery();
        }

        $class = str_ireplace('Connection', 'PreparedQuery', static::class);
        /** @var BasePreparedQuery $class */
        $class = new $class($this);

        return $class->prepare($sql$options);
    }

    /** * Returns the last query's statement object. * * @return Query */
    


    /** * Attaches Honeypot template to response. * * @return void */
    public function attachHoneypot(ResponseInterface $response)
    {
        if ($response->getCSP()->enabled()) {
            // Add id attribute to the container tag.             $this->config->container = str_ireplace(
                '>{template}',
                ' id="' . $this->config->containerId . '">{template}',
                $this->config->container
            );
        }

        $prepField = $this->prepareTemplate($this->config->template);

        $body = $response->getBody();
        $body = str_ireplace('</form>', $prepField . '</form>', $body);

        
$to,
                    1
                );
            }
        }

        $routeKey = $from;

        // Replace our regex pattern placeholders with the actual thing         // so that the Router doesn't need to know about any of this.         foreach ($this->placeholders as $tag => $pattern) {
            $routeKey = str_ireplace(':' . $tag$pattern$routeKey);
        }

        // If is redirect, No processing         if (isset($options['redirect']) && is_string($to)) {
            // If no namespace found, add the default namespace             if (strpos($to, '\\') === false || strpos($to, '\\') > 0) {
                $namespace = $options['namespace'] ?? $this->defaultNamespace;
                $to        = trim($namespace, '\\') . '\\' . $to;
            }
            // Always ensure that we escape our namespace so we're not pointing to             // \CodeIgniter\Routes\Controller::method.

    protected static function _replaceMonth(&$number$monthlist)
    {
        // If $locale was invalid, $monthlist will default to a "root" identity         // mapping for each month number from 1 to 12.         // If no $locale was given, or $locale was invalid, do not use this identity mapping to normalize.         // Otherwise, translate locale aware month names in $number to their numeric equivalents.         $position = false;
        if ($monthlist && $monthlist[1] != 1) {
            foreach($monthlist as $key => $name) {
                if (($position = iconv_strpos($number$name, 0, 'UTF-8')) !== false) {
                    $number   = str_ireplace($name$key$number);
                    return $position;
                }
            }
        }

        return false;
    }

    /** * Returns the default date format for $locale. * * @param string|Zend_Locale $locale OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT') * @return string format * @throws Zend_Locale_Exception throws an exception when locale data is broken */


    /** * @param int $shopId * * @return string */
    public function getSitemapFilename($shopId)
    {
        $number = 1;
        do {
            $path = 'shop-' . $shopId . '/' . str_ireplace(
                ['{number}'],
                [$number],
                $this->pattern
            );
            ++$number;
        } while ($this->filesystem->has($path));

        return $path;
    }
}
Home | Imprint | This part of the site doesn't use cookies.