You are here

public function InstapageCmsPluginDrupal7Connector::getDBPrefix in Instapage plugin 8.3

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

Gets the DB prefix from CMS configuration.

Return value

string DB prefix.

2 calls to InstapageCmsPluginDrupal7Connector::getDBPrefix()
InstapageCmsPluginDrupal7Connector::getPostSlugs in core/connectors/InstapageCmsPluginDrupal7Connector.php
Gets the list of slugs used by Drupal 7 posts.
InstapageCmsPluginDrupal7Connector::isProhibitedPostSlug in core/connectors/InstapageCmsPluginDrupal7Connector.php
Checks if given slug is prohibited in terms of publishing a landing page. If it's free - will return false. Otherwise an array with slug details will be returned

File

core/connectors/InstapageCmsPluginDrupal7Connector.php, line 337

Class

InstapageCmsPluginDrupal7Connector
Class that utilizes native Drupal 7 functions to perform actions like remote requests and DB operations.

Code

public function getDBPrefix() {
  global $databases;
  $connectionKey = Database::getConnection()
    ->getKey();
  $settings = isset($databases[$connectionKey]) ? $databases[$connectionKey] : null;
  if (!$settings) {
    return null;
  }
  if (!isset($settings['prefix']) && is_array($settings)) {
    $settings = array_pop($settings);
  }
  if (isset($settings['prefix']) && is_array($settings['prefix'])) {
    $settings['prefix'] = array_pop($settings['prefix']);
  }
  return isset($settings['prefix']) ? $settings['prefix'] : '';
}