canonical = $canonical; $this->base = $base; $this->sidebarColor = $sidebarColor; $this->themecolor = $themecolor; $this->classSidebar = $classSidebar; } /** * Fix an url and convert a relative url into an absolute url * * @param $url * * @return string * @test equals 'http://amp.canon.dom/some/url/image.jpg',this('some/url/image.jpg') */ public function fixRelativeUrl($url) { if (strlen($url) < 4) { return $url; } if (substr($url, 0, 4) == 'http') { return $url; } if (substr($url, 0, 1) == '/') { return $this->base . $url; } if (substr($url, 0, 1) != '/') { return $this->base . '/' . $url; } return ""; } /** * It generates the social and seo structure (Twitter card, Facebook OG and Google Schema) * * @param StructureModel $structured * * @return string * @test greaterThan 100, this(new StructuredModel()) */ private function genStructured($structured) { $mark = " "; return $mark; } /** * Start to generate an Amp site. * * @param HeaderModel $param * @param StructureModel $structured * @param string $lang language */ public function startAmp($param, $structured = null, $lang = 'en') { $param->icon = $this->fixRelativeUrl($param->icon); /** @noinspection HtmlRequiredTitleElement */ $template = "
"; if ($structured != null) { $template .= $this->genStructured($structured); } $template .= "{$content->description}
{$content->description} {$htmlLink}
{$content->description}
{$content->description}
{$content->description}
"; if (count($content->buttons)) { $template .= "{$content->description}
"; if (count($content->buttons)) { $template .= "{$h} | ";
}
$template .= "
---|
{$c[$h]} | ";
}
$template .= "
{$content->title}
{$content->title}
{$content->description}
{$content->description}