public static function getInstance() { if (!isset(self::$uniqueInstance)) { self::$uniqueInstance = new LCConfig(); } return self::$uniqueInstance; }
<?php global $gBitSystem; $registerHash = array('package_name' => 'lcconfig', 'package_path' => dirname(__FILE__) . '/', 'required_package' => TRUE); $gBitSystem->registerPackage($registerHash); if ($gBitSystem->isPackageActive('lcconfig')) { // service funcs define('LIBERTY_SERVICE_LCCONFIG', 'content_config'); $gLibertySystem->registerService(LIBERTY_SERVICE_LCCONFIG, LCCONFIG_PKG_NAME, array('content_preview_function' => 'lcconfig_content_edit', 'content_edit_function' => 'lcconfig_content_edit', 'content_verify_function' => 'lcconfig_content_verify'), array('description' => 'Enables lcconfig format preferences', 'required' => TRUE)); require_once 'LCConfig.php'; $LCConfig = LCConfig::getInstance(); $gBitSmarty->assign_by_ref('LCConfig', $LCConfig); }
/** * check if a service is required for this content type * requires package LCConfig * provisional method until LCConfig package is integrated into the core */ function isServiceRequired($pServiceGuid) { global $gBitSystem; $ret = TRUE; // we return true by default to preserve legacy service opperation which has no content type preferences if ($gBitSystem->isPackageActive('lcconfig')) { // LCConfig is a singleton class $LCConfig = LCConfig::getInstance(); return $LCConfig->getConfig('service_' . $pServiceGuid, $this->mContentTypeGuid) == 'required'; } return $ret; }