You are here

public function InstapageCmsPluginWPConnector::legacyArePagesPresent in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/connectors/InstapageCmsPluginWPConnector.php \InstapageCmsPluginWPConnector::legacyArePagesPresent()

Checks if any landing page is present in legacy DB structure.

Return value

bool True if there are pages in legacy DB structure.

1 call to InstapageCmsPluginWPConnector::legacyArePagesPresent()
InstapageCmsPluginWPConnector::checkPage in core/connectors/InstapageCmsPluginWPConnector.php
Checks (and displays) if a landing page should be displayed instead of normal content served by CMS.

File

core/connectors/InstapageCmsPluginWPConnector.php, line 837

Class

InstapageCmsPluginWPConnector
Class that utilizes native WordPress functions to perform actions like remote requests and DB operations.

Code

public function legacyArePagesPresent() {
  global $wpdb;
  $sql = "SELECT COUNT({$wpdb->posts}.ID) AS page_count FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type = %s AND {$wpdb->posts}.post_status = 'publish'";
  $row = $wpdb
    ->get_row($wpdb
    ->prepare($sql, 'instapage_post'));
  if (isset($row->page_count) && $row->page_count > 0) {
    return true;
  }
  return false;
}