Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2016-02-22 01:19:30

HaraldJ
Member
From: Surrey, United Kingdom
Registered: 2012-10-10
Posts: 77
Website

HTTPS and Facebook

As mentioned in another post, with CE4 came a change in the currentPageURL() function. If the port is not 80, the port number becomes part of the URL:

        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }

This has so many nasty side effects that I'm replacing it with

            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

for all the generated files. Of course that makes only sense for websites using HTPPS.

One side effect is for images to be used in Facebook, the OpenGraph debugger doesn't like it at all, and rejects the image.

It might be better to add extra handling for HTTPS when creating the OpenGraph metatags, Facebook prefers <meta property="og:image:secure_url" instead of <meta property="og:image:".

That's why I am replacing, in all template_index.php files, the og:image line with

    <meta property="og:image:secure_url" content="<?php echo ($album ? $album->getURL() : currentPageLocation().'/'); ?>photos/<?php echo basename($album->getCoverImage()); ?>" /> 

Then Facebook happily accepts the photo.


Harald Joergens ARPS
Harald Joergens Photography
Nutfield, Surrey, UK

Offline

Board footer

Powered by FluxBB