Creates a UrlWildcard object from given parameters.

@param string $sourceUrl
@param string $destinationUrl
@param bool $forward

@return \eZ\Publish\SPI\Persistence\Content\UrlWildcard
7293
public function createUrlWildcard($sourceUrl, $destinationUrl, $forward)
    {
        $urlWildcard = new UrlWildcard();

        $urlWildcard->destinationUrl = $this->cleanUrl($destinationUrl);
        $urlWildcard->sourceUrl = $this->cleanUrl($sourceUrl);
        $urlWildcard->forward = $forward;

        return $urlWildcard;
    }
986667
protected function generateBaseUrl($sourceUrl)
    {
        if ($this->isSshUrl($sourceUrl)) {
            return $this->transformSshUrlIntoHttp($sourceUrl);
        }

        $sourceUrl = parse_url($sourceUrl);
        $pos = strrpos($sourceUrl['path'], '.git');

        return sprintf(
            '%s://%s%s',
            $sourceUrl['scheme'],
            $sourceUrl['host'],
            $pos === false ? $sourceUrl['path'] : substr($sourceUrl['path'], 0, strrpos($sourceUrl['path'], '.git'))
        );
    }
157253
public function routeBetweenGeom($sourceGeom, $targetGeom)
    {
        $driver     = $this->getDriver();
        $srid       = $this->getSrid();
        $sourceNode = $driver->getNodeFromGeom($this->waysVerticesTableName, $this->waysGeomFieldName, $sourceGeom, $srid, 'id');
        $targetNode = $driver->getNodeFromGeom($this->waysVerticesTableName, $this->waysGeomFieldName, $targetGeom, $srid, 'id');
        return $driver->routeBetweenNodes($this->waysVerticesTableName, $this->waysGeomFieldName, $sourceNode, $targetNode, $srid);
    }
359728
public function dragTo($sourceXpath, $destinationXpath) {
    $sourceElement = $this->findElement($sourceXpath, 1);
    $destinationElement = $this->findElement($destinationXpath, 1);
    $this->browser->drag($sourceElement["page_id"], $sourceElement["ids"][0], $destinationElement["ids"][0]);
  }
897528
private BrowserSession createBrowserSession(
                                                SIDestinationAddress destinationAddress,
                                                DestinationType destinationType,
                                                SelectionCriteria criteria,
                                                boolean system,
                                                String alternateUser,
                                                boolean gatherMessages)
                    throws SIConnectionUnavailableException, SIConnectionDroppedException,
                    SIErrorException,
                    SITemporaryDestinationNotFoundException,
                    SIResourceException,
                    SINotPossibleInCurrentConfigurationException, SISelectorSyntaxException, SIDiscriminatorSyntaxException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "createBrowserSession",
                        new Object[] { destinationAddress, destinationType, criteria, Boolean.valueOf(gatherMessages) });

        // Finding a destination could take some time so we don't have the
        // connection locked (on closed) when we do this.
        DestinationHandler destination = _destinationManager.getDestination(
                                                                            (JsDestinationAddress) destinationAddress, false);

        // Check that this is the correct destination type
        checkDestinationType(destinationType, destinationAddress, destination, system);

        if (destination.getDestinationType() == DestinationType.SERVICE)
        {
            //Cant browse a service destination
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "createBrowserSession", "cannot browse a service destination");

            throw new SINotPossibleInCurrentConfigurationException(
                            nls.getFormattedMessage(
                                                    "INVALID_DESTINATION_USAGE_ERROR_CWSIP0022",
                                                    new Object[] { destination.getName(),
                                                                  _messageProcessor.getMessagingEngineName() },
                                                    null));
        }

        // Check that this temporary destination was created by this connection.
        checkTemporary(destination, false);

        // Check authority to browse this destination
        // If security is disabled then we'll bypass the check
        checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_BROWSE, null);

        //if the destination turns out to be pub-sub then that doesn't make sense
        //so we'll just set it back to null
        if (destination.isPubSub())
        {
            destination = null;
        }

        BrowserSession browser = null;

        // Synchronize on the close object, we don't want the connection closing
        // while we try to add the browser.
        synchronized (this)
        {
            // See if this connection has been closed
            checkNotClosed();

            //create a browser session with the given destination
            //if the destination was null - it was pub sub - this will create a browser
            //session which never returns any messages
            browser = new BrowserSessionImpl(destination,
                            criteria,
                            this,
                            destinationAddress,
                            gatherMessages);
            synchronized (_browsers)
            {
                //store a reference
                _browsers.add(browser);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createBrowserSession", browser);

        return browser;
    }
1275410
public function createURLWildcard(Request $request)
    {
        $urlWildcardCreate = $this->inputDispatcher->parse(
            new Message(
                array('Content-Type' => $request->headers->get('Content-Type')),
                $request->getContent()
            )
        );

        try {
            $createdURLWildcard = $this->urlWildcardService->create(
                $urlWildcardCreate['sourceUrl'],
                $urlWildcardCreate['destinationUrl'],
                $urlWildcardCreate['forward']
            );
        } catch (InvalidArgumentException $e) {
            throw new ForbiddenException($e->getMessage());
        }

        return new Values\CreatedURLWildcard(
            array(
                'urlWildcard' => $createdURLWildcard,
            )
        );
    }
1184116
public static function createFromNotFound(NotFound $notFound, $destination, $permanent = true)
    {
        return new static($notFound->getPath(), $destination, $permanent);
    }
69038
private function substitute($destinationUrl, array $values)
    {
        preg_match_all('(\{(\d+)\})', $destinationUrl, $matches);

        foreach ($matches[1] as $match) {
            $destinationUrl = str_replace("{{$match}}", $values[$match], $destinationUrl);
        }

        return $destinationUrl;
    }
1362741
public function addMapping($destinationPattern, $controllerClass, $actionName)
    {
        $mapping = new Route\Mapping($destinationPattern, $controllerClass, $actionName);

        $this->reverseMapping[$controllerClass][$actionName] = $mapping;

        $destinationPieces = explode('/', $destinationPattern);

        $mappingNode = &$this->routeMapping;
        foreach($destinationPieces as $destinationPiece) {
            if ($this->isWildcard($destinationPiece)) {
                if (!isset($mappingNode['_wildcard'])) {
                    $mappingNode['_wildcard'] = null;
                }
                $mappingNode = &$mappingNode['_wildcard'];
            } else {
                if (!isset($mappingNode[$destinationPiece])) {
                    $mappingNode[$destinationPiece] = null;
                }
                $mappingNode = &$mappingNode[$destinationPiece];
            }
        }
        $mappingNode['_mapping'] = $mapping;

        return $mapping;
    }
49652
public function moveSubtree(array $sourceTagData, array $destinationParentTagData = null)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select(
                $this->handler->quoteColumn('id'),
                $this->handler->quoteColumn('parent_id'),
                $this->handler->quoteColumn('main_tag_id'),
                $this->handler->quoteColumn('path_string')
            )
            ->from($this->handler->quoteTable('eztags'))
            ->where(
                $query->expr->lOr(
                    $query->expr->like(
                        $this->handler->quoteColumn('path_string'),
                        $query->bindValue($sourceTagData['path_string'] . '%', null, PDO::PARAM_STR)
                    ),
                    $query->expr->eq(
                        $this->handler->quoteColumn('main_tag_id'),
                        $query->bindValue($sourceTagData['id'], null, PDO::PARAM_INT)
                    )
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        $rows = $statement->fetchAll(PDO::FETCH_ASSOC);

        $oldParentPathString = implode('/', array_slice(explode('/', $sourceTagData['path_string']), 0, -2)) . '/';
        foreach ($rows as $row) {
            // Prefixing ensures correct replacement when there is no parent
            $newPathString = str_replace(
                'prefix' . $oldParentPathString,
                $destinationParentTagData ?
                    $destinationParentTagData['path_string'] :
                    '/',
                'prefix' . $row['path_string']
            );

            $newParentId = $row['parent_id'];
            if ($row['path_string'] === $sourceTagData['path_string'] || (int) $row['main_tag_id'] === (int) $sourceTagData['id']) {
                $newParentId = (int) implode('', array_slice(explode('/', $newPathString), -3, 1));
            }

            $newDepth = mb_substr_count($newPathString, '/') - 1;

            $query = $this->handler->createUpdateQuery();
            $query
                ->update($this->handler->quoteTable('eztags'))
                ->set(
                    $this->handler->quoteColumn('path_string'),
                    $query->bindValue($newPathString, null, PDO::PARAM_STR)
                )->set(
                    $this->handler->quoteColumn('depth'),
                    $query->bindValue($newDepth, null, PDO::PARAM_INT)
                )->set(
                    $this->handler->quoteColumn('modified'),
                    $query->bindValue(time(), null, PDO::PARAM_INT)
                )->set(
                    $this->handler->quoteColumn('parent_id'),
                    $query->bindValue($newParentId, null, PDO::PARAM_INT)
                )->where(
                    $query->expr->eq(
                        $this->handler->quoteColumn('id'),
                        $query->bindValue($row['id'], null, PDO::PARAM_INT)
                    )
                );

            $query->prepare()->execute();
        }
    }
747963
private function mergeArray($destinationArray, $sourceArray)
    {
        $result = array();
        foreach ($destinationArray as $key => $destinationArrayItem) {
            if (is_int($key)) {
                $result[] = $destinationArrayItem;
            } else {
                $result[$key] = $destinationArrayItem;
            }
        }

        foreach ($sourceArray as $key => $sourceArrayItem) {
            if (is_int($key)) {
                $result[] = $sourceArrayItem;
            } else {
                $result[$key] = $this->run($result[$key], $sourceArrayItem);
            }
        }

        return $result;
    }
852637
private static function safelyParseRedirectUrl(string $mightBeUrl): string
    {
        $url = '';

        $parsed = parse_url($mightBeUrl);
        if ($parsed !== false) {
            $url =
                (array_key_exists('path', $parsed) === true ? $parsed['path'] : '/') .
                (array_key_exists('query', $parsed) === true ? '?' . $parsed['query'] : '') .
                (array_key_exists('fragment', $parsed) === true ? '#' . $parsed['fragment'] : '');
        }

        if (empty($url) === true || $url[0] !== '/') {
            $url = '/' . $url;
        }

        return $url;
    }
986596
public function upload($sourceFile, $destinationFile)
    {
        Service::$log->msg('Upload to S3 started: ' . $sourceFile);
        $destinationFile = rtrim($this->s3Config->RemotePath, '/') . '/' . $destinationFile;
        $this->s3Instance->multipartUpload($this->s3Config->Bucket, $destinationFile, $sourceFile, 3);
        Service::$log->msg('Upload ended');

        return $destinationFile;
    }
223298
public function copy($sourcePath, $destinationPath)
    {
        $sourceNode = $this->getNodeForPath($sourcePath);

        // grab the dirname and basename components
        list($destinationDir, $destinationName) = Uri\split($destinationPath);

        $destinationParent = $this->getNodeForPath($destinationDir);
        // Check if the target can handle the copy itself. If not, we do it ourselves.
        if (!$destinationParent instanceof ICopyTarget || !$destinationParent->copyInto($destinationName, $sourcePath, $sourceNode)) {
            $this->copyNode($sourceNode, $destinationParent, $destinationName);
        }

        $this->markDirty($destinationDir);
    }
70235
private function getUrlGenerator($sourceUrl)
    {
        foreach ($this->urlGenerators as $urlGenerator) {
            if ($urlGenerator->supports($sourceUrl)) {
                return $urlGenerator;
            }
        }

        return null;
    }
1222150
public static function relativePath(string $sourceFile, string $destinationFile): string
    {
        $source = static::simplifyPath($sourceFile);
        $destination = static::simplifyPath($destinationFile);
        if ($source[0] !== '' && $destination[0] === '') {
            return implode('/', $destination);
        }
        // remove the common path
        foreach ($source as $depth => $dir) {
            if (isset($destination[$depth])) {
                if ($dir === $destination[$depth]) {
                    unset($destination[$depth]);
                    unset($source[$depth]);
                } else {
                    break;
                }
            }
        }
        // add '..' to the beginning of the source as required by the count of from
        $fromCount = count($source);
        for ($i = 0; $i < $fromCount - 1; $i++) {
            array_unshift($destination, '..');
        }
        return implode('/', $destination);
    }
159761
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        if (!array_key_exists('sourceUrl', $data)) {
            throw new Exceptions\Parser("Missing 'sourceUrl' value for URLWildcardCreate.");
        }

        if (!array_key_exists('destinationUrl', $data)) {
            throw new Exceptions\Parser("Missing 'destinationUrl' value for URLWildcardCreate.");
        }

        if (!array_key_exists('forward', $data)) {
            throw new Exceptions\Parser("Missing 'forward' value for URLWildcardCreate.");
        }

        $data['forward'] = $this->parserTools->parseBooleanValue($data['forward']);

        return $data;
    }