示例#1
0
function lcconfig_content_edit(&$pObject, &$pParamHash)
{
    global $gBitSystem, $gLibertySystem;
    $LCConfig = LCConfig::getInstance();
    $guids = $LCConfig->getAllConfig($pObject->getContentType());
    if (!empty($guids)) {
        foreach ($guids as $key => $value) {
            // look for format plugin values
            if (substr($key, 0, 7) == 'format_') {
                $guid = substr($key, 7);
                if (!empty($gLibertySystem->mPlugins[$guid])) {
                    // unset any matching formats from liberty system
                    // a little invasive but instantly effective on existing templates
                    // this would be a problem if one where editing multiple content on
                    // the same page and needed the full list of plugins
                    unset($gLibertySystem->mPlugins[$guid]);
                }
            }
            // look for default format override
            if ($key == 'default_format' && $value != $gBitSystem->getConfig('default_format')) {
                $gBitSystem->setConfig('default_format', $value);
            }
        }
    }
}
示例#2
0
<?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);
}
示例#3
0
 /**
  * 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;
 }