示例#1
0
文件: module.php 项目: ni5am/Textcube
function getEditorInfo($editor)
{
    global $pluginURL, $pluginName, $configVal, $pluginPath;
    $context = Model_Context::getInstance();
    $configMappings = $context->getProperty('plugin.configMappings');
    $editorMappings = $context->getProperty('plugin.editorMappings');
    if (!isset($editorMappings[$editor])) {
        reset($editorMappings);
        $editor = key($editorMappings);
        // gives first declared (thought to be default) editor
    }
    if (isset($editorMappings[$editor]['plugin'])) {
        $pluginURL = $context->getProperty('service.path') . '/plugins/' . $editorMappings[$editor]['plugin'];
        $pluginName = $editorMappings[$editor]['plugin'];
        $pluginPath = ROOT . "/plugins/{$pluginName}";
        $context->setProperty('plugin.url', $context->getProperty('service.path') . '/plugins/' . $editorMappings[$editor]['plugin']);
        $context->setProperty('plugin.name', $editorMappings[$editor]['plugin']);
        $context->setProperty('plugin.path', ROOT . "/plugins/{$pluginName}");
        if (!empty($configMappings[$pluginName]['config'])) {
            $configVal = getCurrentSetting($pluginName);
        } else {
            $configVal = null;
        }
        include_once ROOT . "/plugins/{$editorMappings[$editor]['plugin']}/index.php";
    }
    return $editorMappings[$editor];
}
示例#2
0
function handleConfig($plugin)
{
    global $service, $typeSchema, $pluginURL, $pluginPath, $pluginName, $configMappings, $configVal, $adminSkinSetting;
    $context = Model_Context::getInstance();
    $typeSchema = array('text', 'textarea', 'select', 'checkbox', 'radio');
    $manifest = @file_get_contents(ROOT . "/plugins/{$plugin}/index.xml");
    $xmls = new XMLStruct();
    $CDSPval = '';
    $i = 0;
    $dfVal = Setting::fetchConfigVal(getCurrentSetting($plugin));
    $name = '';
    $clientData = '[';
    $title = $plugin;
    if ($manifest && $xmls->open($manifest)) {
        $title = $xmls->getValue('/plugin/title[lang()]');
        //설정 핸들러가 존재시 바꿈
        $config = $xmls->selectNode('/plugin/binding/config[lang()]');
        unset($xmls);
        if (!empty($config['.attributes']['manifestHandler'])) {
            $handler = $config['.attributes']['manifestHandler'];
            $oldconfig = $config;
            $context->setProperty('plugin.uri', $context->getProperty('service.path') . "/plugins/{$plugin}");
            $context->setProperty('plugin.path', ROOT . "/plugins/{$plugin}");
            $context->setProperty('plugin.name', $plugin);
            $pluginURL = $context->getProperty('plugin.uri');
            // Legacy plugin support.
            $pluginPath = $context->getProperty('plugin.path');
            $pluginName = $context->getProperty('plugin.name');
            include_once ROOT . "/plugins/{$plugin}/index.php";
            if (function_exists($handler)) {
                if (!empty($configMappings[$plugin]['config'])) {
                    $configVal = getCurrentSetting($plugin);
                    $context->setProperty('plugin.config', Setting::fetchConfigVal($configVal));
                } else {
                    $configVal = '';
                    $context->setProperty('plugin.config', array());
                }
                $manifest = call_user_func($handler, $plugin);
                if (!is_null($languageDomain)) {
                    $locale->domain = $languageDomain;
                }
            }
            $newXmls = new XMLStruct();
            if ($newXmls->open($manifest)) {
                unset($config);
                $config = $newXmls->selectNode('/config[lang()]');
            }
            unset($newXmls);
        }
        if (is_null($config['fieldset'])) {
            return array('code' => _t('설정 값이 없습니다.'), 'script' => '[]');
        }
        foreach ($config['fieldset'] as $fieldset) {
            $legend = !empty($fieldset['.attributes']['legend']) ? htmlspecialchars($fieldset['.attributes']['legend']) : '';
            $CDSPval .= CRLF . TAB . "<fieldset>" . CRLF . TAB . TAB . "<legend><span class=\"text\">{$legend}</span></legend>" . CRLF;
            if (!empty($fieldset['field'])) {
                foreach ($fieldset['field'] as $field) {
                    if (empty($field['.attributes']['name'])) {
                        continue;
                    }
                    $name = $field['.attributes']['name'];
                    $clientData .= getFieldName($field, $name);
                    $CDSPval .= TreatType($field, $dfVal, $name);
                }
            }
            $CDSPval .= TAB . "</fieldset>" . CRLF;
        }
    } else {
        $CDSPval = _t('설정 값이 없습니다.');
    }
    $clientData .= ']';
    return array('code' => $CDSPval, 'script' => $clientData, 'title' => $title);
}
示例#3
0
            $sidbarPluginIndex = $plugin . '/' . $handler;
            $invalidPlugin = false;
            if (!array_key_exists($sidbarPluginIndex, $coverpagePluginArray)) {
                // invalid or missed plug-in
                $coverpagePluginArray[$sidbarPluginIndex] = array();
                $coverpagePluginArray[$sidbarPluginIndex]['title'] = $plugin;
                $coverpagePluginArray[$sidbarPluginIndex]['handler'] = $handler;
                $coverpagePluginArray[$sidbarPluginIndex]['display'] = $plugin;
                $coverpagePluginArray[$sidbarPluginIndex]['parameters'] = array();
                $invalidPlugin = true;
            } else {
                include_once ROOT . "/plugins/{$plugin}/index.php";
            }
            if (function_exists($handler)) {
                if (!empty($configMappings[$plugin]['config'])) {
                    $configVal = getCurrentSetting($plugin);
                    $context->setProperty('plugin.config', Setting::fetchConfigVal($configVal));
                } else {
                    $configVal = '';
                    $context->setProperty('plugin.config', array());
                }
                ?>
												<li class="coverpage-module coverpage-plugin-module" id="coverpage-element-<?php 
                echo "{$i}-{$j}";
                ?>
">
													<h4 class="module-title"><?php 
                echo $coverpagePluginArray[$sidbarPluginIndex]['display'], '::', $coverpagePluginArray[$sidbarPluginIndex]['title'];
                ?>
</h4>
													<div class="button-box">
示例#4
0
文件: index.php 项目: ni5am/Textcube
    dress('textcube_name', TEXTCUBE_NAME, $view);
    dress('textcube_version', TEXTCUBE_VERSION, $view);
    $tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU');
    $tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>');
    $view = preg_replace($tagSearches, $tagReplaces, $view);
    return correctSidebarImage($view);
}
$skin = new Skin($skinSetting['skin']);
$sidebarCount = count($skin->sidebarBasicModules);
getBlogContentForSideBar();
if ($_REQUEST['sidebarNumber'] >= 0 && $_REQUEST['sidebarNumber'] < $sidebarCount) {
    $sidebarOrder = getSidebarModuleOrderData($sidebarCount);
    $target = $sidebarOrder[$_REQUEST['sidebarNumber']][$_REQUEST['modulePos']];
    $sidebarPluginArray = array();
    for ($i = 0; $i < count($sidebarMappings); $i++) {
        $sidebarPluginArray[$sidebarMappings[$i]['plugin'] . '/' . $sidebarMappings[$i]['handler']] = array('type' => 3, 'id' => $sidebarMappings[$i]['handler'], 'plugin' => $sidebarMappings[$i]['plugin'], 'title' => $sidebarMappings[$i]['title'], 'display' => $sidebarMappings[$i]['display'], 'identifier' => implode(':', array(3, $sidebarMappings[$i]['plugin'], $sidebarMappings[$i]['handler'])), 'parameters' => $sidebarMappings[$i]['parameters']);
    }
    if ($target['type'] == 3) {
        $sidbarPluginIndex = $target['id']['plugin'] . '/' . $target['id']['handler'];
        if (array_key_exists($sidbarPluginIndex, $sidebarPluginArray)) {
            $pluginURL = $context->getProperty('service.path') . "/plugins/{$target['id']['plugin']}";
            include_once ROOT . "/plugins/{$target['id']['plugin']}/index.php";
            if (!empty($configMappings[$target['id']['plugin']]['config'])) {
                $configVal = getCurrentSetting($target['id']['plugin']);
            } else {
                $configVal = '';
            }
            echo pretty_dress(call_user_func($target['id']['handler'], $target['parameters']));
        }
    }
}