wg->SuppressPageHeader = true; $this->wg->out->setHTMLTitle( wfMessage( 'portable-infobox-builder-tite' )->text() ); $title = $this->getTemplateTitle( $this->getPar() ); $noTemplateSet = empty( $title ) ? true : false; if ( $noTemplateSet ) { $this->response->setVal('noTemplateSet', true ); $this->response->setVal('setTemplateNameCallToAction', wfMessage( 'portable-infobox-builder-no-template-title-set' )->text() ); } else { $url = $this->wg->server . '/' . self::INFOBOX_BUILDER_MERCURY_ROUTE . '/' . $title; $this->response->setVal( 'iframeUrl', $url ); } $this->response->setTemplateEngine( WikiaResponse::TEMPLATE_ENGINE_MUSTACHE ); } /** * renders HTML for create new template page entry point */ public function renderCreateTemplateEntryPoint() { $this->response->setVal( 'createInfobox', wfMessage( 'portable-infobox-builder-create-template-entry-point-create-infobox' )->text() ); $this->response->setVal( 'createTemplate', wfMessage( 'portable-infobox-builder-create-template-entry-point-create-regular-template' )->text() ); $this->response->setVal( 'title', $this->request->getVal('title'), '' ); $this->response->setTemplateEngine( WikiaResponse::TEMPLATE_ENGINE_MUSTACHE ); } /** * @desc return template title base of the URL path * @param string $par - URL path after Special:PortableInfoboxBuilder/ * @return string */ private function getTemplateTitle( $par ) { $slicePos = strpos( $par, '/' ); return urlencode( is_int( $slicePos ) ? substr( $par, 0, $slicePos ) : $par ); } }