Ejemplo n.º 1
0
?>
</h1>

<?php 
$codeExample1 = '<?php
echo rex_getUrl(42);
// --> ' . seo42::getUrlStart() . 'questions/the-ultimate-answer.html

echo seo42::getFullUrl(42);
// --> ' . seo42::getServerUrl() . 'questions/the-ultimate-answer.html

echo seo42::getMediaFile("image.png");
// --> ' . seo42::getUrlStart() . $REX['MEDIA_DIR'] . '/image.png

echo seo42::getMediaUrl("image.png");
// --> ' . seo42::getMediaUrl('image.png') . '

echo seo42::getAbsoluteMediaFile("image.png");
// --> ' . seo42::getAbsoluteMediaFile('image.png') . '

echo seo42::getDownloadFile("doc.pdf");
// --> ' . seo42::getUrlStart() . seo42::downloadDir . '/doc.pdf
?>';
$codeExample2 = '
<link rel="stylesheet" href="<?php echo seo42::getCombinedCSSFile("combined.css", array("foo.css", "bar.scss", "batz.less")); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo seo42::getCSSFile("default.css"); ?>" type="text/css" media="screen,print" />
<link rel="stylesheet" href="<?php echo seo42::getCSSFile("theme.scss"); ?>" type="text/css" media="screen,print" />
<link rel="stylesheet" href="<?php echo seo42::getCSSFile("stuff.less", array("color" => "red", "base" => "960px")); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo seo42::getCSSFile("http://fonts.googleapis.com/css?family=Fjalla+One"); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo seo42::getResourceFile("resources/mediaelement/mediaelementplayer.css"); ?>" type="text/css" media="screen" />
Ejemplo n.º 2
0
 public static function getImagesHTML()
 {
     global $REX;
     $return = [];
     /**
      * prepare images from MetaInfo
      */
     if (self::$curArticle->getValue('art_open_graph_images')) {
         $images = explode(',', self::$curArticle->getValue('art_open_graph_images'));
         foreach ($images as $image) {
             $ogImage = new Image();
             $image = \OOMedia::getMediaByFileName($image);
             if (false && \rex_addon::isActivated('seo42')) {
                 $ogImage->setUrl(\seo42::getMediaUrl($image));
             } else {
                 $ogImage->setUrl($REX['SERVER'] . $REX['MEDIA_DIR'] . '/' . $image->getFileName());
             }
             $ogImage->setType($image->getType());
             $ogImage->setWidth($image->getWidth());
             $ogImage->setHeigt($image->getHeight());
             self::addImage($ogImage);
         }
     }
     /** @var Image $image */
     foreach (self::$images as $image) {
         $return[] = '<meta property="og:image" content="' . $image->getUrl() . '">';
         if ($image->getSecureUrl() || $REX['ADDON']['open_graph']['settings']['https']) {
             if (!$image->getSecureUrl()) {
                 if (strpos($image->getUrl(), $REX['SERVER']) == 0) {
                     $image->setSecureUrl(str_replace('http://', 'https://', $image->getUrl()));
                 }
             }
             if ($image->getSecureUrl()) {
                 $return[] = '<meta property="og:image:secure_url" content="' . $image->getSecureUrl() . '">';
             }
         }
         if ($image->getWidth()) {
             $return[] = '<meta property="og:image:width" content="' . $image->getWidth() . '">';
         }
         if ($image->getHeigt()) {
             $return[] = '<meta property="og:image:height" content="' . $image->getHeigt() . '">';
         }
         if ($image->getType()) {
             $return[] = '<meta property="og:image:type" content="' . $image->getType() . '">';
         }
     }
     return implode("\n\t", $return) . "\n\t";
 }