Core example



        $shopId = $this->container->get(ContextServiceInterface::class)->getShopContext()->getShop()->getId();

        $staticPage = Shopware()->Modules()->Cms()->sGetStaticPage($this->Request()->get('sCustom')$shopId);

        if (!\is_array($staticPage)) {
            throw new ResourceNotFoundException('Custom page not found', $this->Request());
        }

        if (!empty($staticPage['link'])) {
            $link = Shopware()->Modules()->Core()->sRewriteLink($staticPage['link']$staticPage['description']);

            $this->redirect($link['code' => Response::HTTP_MOVED_PERMANENTLY]);

            return;
        }

        if (!empty($staticPage['html'])) {
            $this->View()->assign('sContent', $staticPage['html']);
        }

        $this->View()->assign('sCustomPage', $staticPage);

        
return null;
    }

    /** * @deprecated Will be removed with Shopware 5.8. Use Shopware()->Modules()->Core()->method_name() instead * * @param string $name */
    public function __call($name$params = null)
    {
        return Shopware()->Modules()->Core()->$name($params);
    }
}

    public function outputFilter($source)
    {
        $source = preg_replace('#(src|background)="([^:"./][^:"]+)"#Umsi', '$1="../../campaigns/$2"', $source);
        $callback = [Shopware()->Plugins()->Core()->PostFilter(), 'rewriteSrc'];

        return preg_replace_callback('#<(link|img|script|input|a|form|iframe|td)[^<>]*(href|src|action|background)="([^"]*)".*>#Umsi', $callback$source);
    }

    /** * @deprecated in 5.6, will be private in 5.8 * * Removes the unneeded metadata in the alternative view. * * @param string $source * * @return string */

    private function getLinksOfProduct(ListProduct $product$categoryId$addNumber)
    {
        $baseFile = $this->config->get('baseFile');
        $context = $this->contextService->getShopContext();

        $detail = $baseFile . '?sViewport=detail&sArticle=' . $product->getId();
        if ($categoryId) {
            $detail .= '&sCategory=' . $categoryId;
        }

        $rewrite = Shopware()->Modules()->Core()->sRewriteLink($detail$product->getName());

        if ($addNumber) {
            $rewrite .= strpos($rewrite, '?') !== false ? '&' : '?';
            $rewrite .= 'number=' . $product->getNumber();
        }

        $basket = $baseFile . '?sViewport=basket&sAdd=' . $product->getNumber();
        $note = $baseFile . '?sViewport=note&sAdd=' . $product->getNumber();
        $friend = $baseFile . '?sViewport=tellafriend&sDetails=' . $product->getId();
        $pdf = $baseFile . '?sViewport=detail&sDetails=' . $product->getId() . '&sLanguage=' . $context->getShop()->getId() . '&sPDF=1';

        
return $string;
    }

    /** * @param int $articleID * @param string $title * * @return string */
    public function sGetArticleLink($articleID$title = '')
    {
        return Shopware()->Modules()->Core()->sRewriteLink($this->config->get('sBASEFILE') . "?sViewport=detail&sArticle=$articleID", $title) . (empty($this->sSettings['partnerID']) ? '' : '?sPartner=' . urlencode($this->sSettings['partnerID']));
    }

    /** * @param string $hash * @param string|null $imageSize * * @return string|null */
    public function sGetImageLink($hash$imageSize = null)
    {
        if (empty($hash)) {
            
/** @var Shopware_Plugins_Frontend_Statistics_Bootstrap $plugin */
        $plugin = Shopware()->Plugins()->Frontend()->Statistics();
        $plugin->updateLog($request$response);
    }

    /** * Get cms menu */
    public function menuAction(): void
    {
        $this->View()->assign('sGroup', $this->Request()->getParam('group'));
        $plugin = Shopware()->Plugins()->Core()->ControllerBase();
        $this->View()->assign('sMenu', $plugin->getMenu());
    }

    /** * Get shop menu */
    public function shopMenuAction(): void
    {
        $shop = Shopware()->Shop();
        $main = DetachedShop::createFromShop($shop->getMain() ?? $shop);

        
throw new InvalidArgumentException('Argument categoryId missing');
            }

            if (!$this->Request()->has('sSort')) {
                $default = $this->container->get(Shopware_Components_Config::class)->get('defaultListingSorting');
                $this->Request()->setParam('sSort', $default);
            }

            $navigation = $this->container->get('modules')->Articles()->getProductNavigation($orderNumber$categoryId$this->Request());

            $linkRewriter = function D$link) {
                return $this->container->get('modules')->Core()->sRewriteLink($link);
            };

            if (isset($navigation['previousProduct'])) {
                $navigation['previousProduct']['href'] = $linkRewriter($navigation['previousProduct']['link']);
            }

            if (isset($navigation['nextProduct'])) {
                $navigation['nextProduct']['href'] = $linkRewriter($navigation['nextProduct']['link']);
            }

            $navigation['currentListing']['href'] = $linkRewriter($navigation['currentListing']['link']);
            

    protected function addLinksToFilter(array $filterData$requestParameterName$requestParameterValue$addRemoveProperty = true)
    {
        foreach ($filterData as $key => $dateData) {
            $filterData[$key]['link'] = $this->blogBaseUrl . Shopware()->Modules()->Core()->sBuildLink(
                ['sPage' => 1, $requestParameterName => urlencode($dateData[$requestParameterValue])]
            );
        }
        if ($addRemoveProperty) {
            $filterData[] = [
                'removeProperty' => 1,
                'link' => $this->blogBaseUrl . Shopware()->Modules()->Core()->sBuildLink(['sPage' => 1, $requestParameterName => '']),
            ];
        }

        return $filterData;
    }
class Shopware_Controllers_Backend_Cron extends Enlight_Controller_Action implements CSRFWhitelistAware
{
    public function init()
    {
        Shopware()->Plugins()->Backend()->Auth()->setNoAuth();
        Shopware()->Front()->Plugins()->ViewRenderer()->setNoRender();
    }

    public function indexAction()
    {
        if (!Shopware()->Plugins()->Core()->Cron()->authorizeCronAction($this->Request())) {
            $this->Response()
                ->clearHeaders()
                ->setStatusCode(Response::HTTP_FORBIDDEN)
                ->appendBody('Forbidden');

            return;
        }

        /** @var Enlight_Components_Cron_Manager $cronManager */
        $cronManager = Shopware()->Container()->get('cron');

        


    /** * Helper function to get access on the http cache plugin. * Notice if the Http Cache plugin isn't installed, this function * returns null. * * @return Shopware_Plugins_Core_HttpCache_Bootstrap|null */
    protected function HttpCache()
    {
        $httpCache = Shopware()->Plugins()->Core()->HttpCache();

        if (!$httpCache instanceof self) {
            return null;
        }

        $plugin = Shopware()->Models()->find(Plugin::class$httpCache->getId());

        if (!$plugin instanceof Plugin || !$plugin->getActive() || !$plugin->getInstalled()) {
            return null;
        }

        

    public function getPagerStructure($destinationPage$numberOfPages$additionalParams = [])
    {
        $destinationPage = !empty($destinationPage) ? $destinationPage : 1;
        $pagesStructure = [];
        $baseFile = $this->config->get('sBASEFILE');
        if ($numberOfPages > 1) {
            for ($i = 1; $i <= $numberOfPages; ++$i) {
                $pagesStructure['numbers'][$i]['markup'] = $i == $destinationPage;
                $pagesStructure['numbers'][$i]['value'] = $i;
                $pagesStructure['numbers'][$i]['link'] = $baseFile . $this->moduleManager->Core()
                        ->sBuildLink($additionalParams + ['sPage' => $i]);
            }
            // Previous page             if ($destinationPage != 1) {
                $pagesStructure['previous'] = $baseFile . $this->moduleManager->Core()
                        ->sBuildLink($additionalParams + ['sPage' => $destinationPage - 1]);
            } else {
                $pagesStructure['previous'] = null;
            }
            // Next page             if ($destinationPage != $numberOfPages) {
                

    if (isset($params['params'])) {
        $userParams = (array) $params['params'];
        unset($params['params']);
    } else {
        $userParams = [];
    }

    $params = array_merge($userParams$params);

    /** @var \Shopware_Plugins_Core_HttpCache_Bootstrap $httpCache */
    $httpCache = Shopware()->Plugins()->Core()->HttpCache();
    if ($esiTag = $httpCache->renderEsiTag($request$params)) {
        return $esiTag;
    }

    $request = clone $request;
    $response = clone $response;

    $request->clearParams();
    $response->clearHeaders()
             ->clearBody();

    
Home | Imprint | This part of the site doesn't use cookies.