framework/RedKiteCms/Content/Page/PageManager.php
public function approve($pageName, $languageName)
    {
        $this->contributorDefined();

        $baseDir = $this->pagesDir . '/' . $pageName . '/' . $languageName;
        $sourceFile = $baseDir . '/' . $this->username . '.json';
        $targetFile = $baseDir . '/seo.json';
        if (!file_exists($targetFile)) {
            throw new PageNotPublishedException('exception_page_not_published');
        }

        $values = json_decode(FilesystemTools::readFile($sourceFile), true);
        if (!empty($values["current_permalink"])) {
            $values["changed_permalinks"][] = $values["current_permalink"];
            $values["current_permalink"] = "";
        }

        $encodedSeo = json_encode($values);
        $event = Dispatcher::dispatch(PageEvents::PAGE_APPROVING, new PageApprovingEvent($sourceFile, $encodedSeo));
        $encodedSeo = $event->getFileContent();

        FilesystemTools::writeFile($sourceFile, $encodedSeo);
        FilesystemTools::writeFile($targetFile, $encodedSeo);

        Dispatcher::dispatch(PageEvents::PAGE_APPROVED, new PageApprovedEvent($sourceFile, $encodedSeo));
        DataLogger::log(sprintf('Page SEO attributes "%s" for language "%s" were approved', $pageName, $languageName));

        return $encodedSeo;
    }
public function approve($pageName, $languageName)
    {
        $this->contributorDefined();

        $baseDir = $this->pagesDir . '/' . $pageName . '/' . $languageName;
        $sourceFile = $baseDir . '/' . $this->username . '.json';
        $targetFile = $baseDir . '/seo.json';
        if (!file_exists($targetFile)) {
            throw new PageNotPublishedException('exception_page_not_published');
        }

        $values = json_decode(FilesystemTools::readFile($sourceFile), true);
        if (!empty($values["current_permalink"])) {
            $values["changed_permalinks"][] = $values["current_permalink"];
            $values["current_permalink"] = "";
        }

        $encodedSeo = json_encode($values);
        $event = Dispatcher::dispatch(PageEvents::PAGE_APPROVING, new PageApprovingEvent($sourceFile, $encodedSeo));
        $encodedSeo = $event->getFileContent();

        FilesystemTools::writeFile($sourceFile, $encodedSeo);
        FilesystemTools::writeFile($targetFile, $encodedSeo);

        Dispatcher::dispatch(PageEvents::PAGE_APPROVED, new PageApprovedEvent($sourceFile, $encodedSeo));
        DataLogger::log(sprintf('Page SEO attributes "%s" for language "%s" were approved', $pageName, $languageName));

        return $encodedSeo;
    }
public function approve ( $ pageName , $ languageName ) { $ this -> contributorDefined ( ) ; $ baseDir = $ this -> pagesDir . '/' . $ pageName . '/' . $ languageName ; $ sourceFile = $ baseDir . '/' . $ this -> username . '.json' ; $ targetFile = $ baseDir . '/seo.json' ; if ( ! file_exists ( $ targetFile ) ) { throw new PageNotPublishedException ( 'exception_page_not_published' ) ; } $ values = json_decode ( FilesystemTools :: readFile ( $ sourceFile ) , true ) ; if ( ! empty ( $ values [ "current_permalink" ] ) ) { $ values [ "changed_permalinks" ] [ ] = $ values [ "current_permalink" ] ; $ values [ "current_permalink" ] = "" ; } $ encodedSeo = json_encode ( $ values ) ; $ event = Dispatcher :: dispatch ( PageEvents :: PAGE_APPROVING , new PageApprovingEvent ( $ sourceFile , $ encodedSeo ) ) ; $ encodedSeo = $ event -> getFileContent ( ) ; FilesystemTools :: writeFile ( $ sourceFile , $ encodedSeo ) ; FilesystemTools :: writeFile ( $ targetFile , $ encodedSeo ) ; Dispatcher :: dispatch ( PageEvents :: PAGE_APPROVED , new PageApprovedEvent ( $ sourceFile , $ encodedSeo ) ) ; DataLogger :: log ( sprintf ( 'Page SEO attributes "%s" for language "%s" were approved' , $ pageName , $ languageName ) ) ; return $ encodedSeo ; }
Approves the page in production
@param $pageName
@param $languageName

@return string The json seo content
Approves the page in production @param $pageName @param $languageName