You are here

public static function InstapageCmsPluginHelper::getMetadata in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/InstapageCmsPluginHelper.php \InstapageCmsPluginHelper::getMetadata()

Gest an option value from plugin's metadata.

Parameters

string $key Name of the param to get.:

string $default Default value.:

Return value

mixed Option value.

6 calls to InstapageCmsPluginHelper::getMetadata()
InstapageCmsPluginAjaxController::loadListPages in core/InstapageCmsPluginAjaxController.php
Loads listing page.
InstapageCmsPluginDBModel::updateDB in core/models/InstapageCmsPluginDBModel.php
Check current DB structure version and updates it if necessary.
InstapageCmsPluginHelper::updateMetadata in core/InstapageCmsPluginHelper.php
Updates plugin's options, stored an JSON.
InstapageCmsPluginLPAjaxLoaderController::shouldBeUsed in core/modules/lpAjaxLoader/InstapageCmsPluginLPAjaxLoaderController.php
Check if it is pantheon hosting platform and check if utm_ variables are replaced Also Check if it is WP Engine hosting and if it is not already request from Ajax Loader JS Also Check if client manually enabled LP Ajax Loader
InstapageCmsPluginLPAjaxLoaderController::shouldDecodeQuery in core/modules/lpAjaxLoader/InstapageCmsPluginLPAjaxLoaderController.php
Check if query should be decoded Query can contains b64 param and it needs to be decode to be used

... See full list

File

core/InstapageCmsPluginHelper.php, line 171

Class

InstapageCmsPluginHelper
Helper containing commonly used static functions.

Code

public static function getMetadata($key = '', $default = null) {
  $db = InstapageCmsPluginDBModel::getInstance();
  $sql = 'SELECT metadata FROM ' . $db->optionsTable;
  $row = $db
    ->getRow($sql);
  $metadata = array();
  if (isset($row->metadata) && $row->metadata) {
    $metadata = (array) json_decode($row->metadata);
  }
  if (!empty($key)) {
    return isset($metadata[$key]) ? $metadata[$key] : $default;
  }
  return $metadata;
}