You are here

public function InstapageCmsPluginPageModel::fixHtmlHead in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginPageModel.php \InstapageCmsPluginPageModel::fixHtmlHead()

Sets up the proper URL for Instapage proxy, if it is enabled.

Parameters

string $html HTML to be fixed.:

Return value

string HTML with propely set proxy URLs.

1 call to InstapageCmsPluginPageModel::fixHtmlHead()
InstapageCmsPluginPageModel::getLandingPageHTMLFromTheApp in core/models/InstapageCmsPluginPageModel.php
Gets and prepares Landing Page HTML from app (from request to so called enterprise)

File

core/models/InstapageCmsPluginPageModel.php, line 630

Class

InstapageCmsPluginPageModel
Class responsible for managing the landing pages.

Code

public function fixHtmlHead($html) {
  $useProxy = InstapageCmsPluginHelper::getOption('crossOrigin', false);
  if ($useProxy) {
    $html = str_replace('PROXY_SERVICES', str_replace(array(
      'http://',
      'https://',
    ), array(
      '//',
      '//',
    ), InstapageCmsPluginConnector::getHomeURL()) . "/instapage-proxy-services?url=", $html);
  }
  $searchArray = array(
    '<meta name="iy453p9485yheisruhs5" content="" />',
    '<meta name="robots" content="noindex, nofollow" />',
  );
  if (strpos($html, $searchArray[0]) !== false) {
    $html = str_replace($searchArray, '', $html);
  }
  return $html;
}