/** * Renders the data file error. * * @return string (X)HTML. * * @global array The localization of the plugins. */ protected function renderDatafileError() { global $plugin_tx; return '<h1>Realblog</h1>' . XH_message('fail', $plugin_tx['realblog']['message_datafile']); }
/* * Register the plugin type. */ if (function_exists('XH_registerPluginType')) { XH_registerPluginType('editor', $plugin); } /* * Register the plugin menu items. */ if (function_exists('XH_registerStandardPluginMenuItems')) { XH_registerStandardPluginMenuItems(false); } initvar('tinymce4'); if ($tinymce4) { if (!class_exists('XH_CSRFProtection')) { $o .= XH_message('fail', 'needs CMSimple_XH Version 1.6 or higher!'); return; } //Helper-functions /** * Returns all available init option. * * @return array options */ function tinymce_getInits() { global $pth; $inits = glob($pth['folder']['plugins'] . 'tinymce4/inits/*.js'); $options = array(); foreach ($inits as $init) { $temp = explode('_', basename($init, '.js'));
function hi_adm_PluginManager() { global $cf, $plugin_cf, $plugin_tx, $sn, $su, $tx, $pth; global $_XH_csrfProtection; $o = '<div id="hi_adm_pluginmanager">' . PHP_EOL; $o .= '<h1>Pluginmanager</h1>' . PHP_EOL; if (isset($_REQUEST['pm_error'])) { $error = $_REQUEST['pm_error']; switch ($error) { case '1': $o .= XH_message('fail', $plugin_tx['hi_admin']['message_not_saved']); break; case '0': $o .= XH_message('success', $plugin_tx['hi_admin']['message_saved']); break; default: break; } } $o .= XH_message('warning', $plugin_tx['hi_admin']['message_pluginmanager_deactivate']); $ignore = explode(',', $plugin_cf['hi_admin']['pluginmanager_ignore']); $ignore = array_map('trim', $ignore); $plugins = hi_adm_InstalledPlugins(); $plugins = array_map('strtolower', $plugins); $plugins = array_diff($plugins, $ignore); $inactivePlugins = array(); $inactivePlugins = explode(',', $cf['plugins']['disabled']); $inactivePlugins = array_map('trim', $inactivePlugins); $hiddenPlugins = array(); $hiddenPlugins = explode(',', $cf['plugins']['hidden']); $hiddenPlugins = array_map('trim', $hiddenPlugins); if (isset($_POST['action']) && $_POST['action'] == 'pm_save') { $_XH_csrfProtection->check(); $toHide = array(); $toDeactivate = array(); foreach ($_POST as $key => $value) { switch ($value) { case 'pm_hidden': $toHide[] = substr($key, 3); break; case 'pm_inactive': $toDeactivate[] = substr($key, 3); break; default: break; } } $error = FALSE; $config = XH_includeVar($pth['file']['config'], 'cf'); if (!$config) { $error = TRUE; } if (!$error) { $config['plugins']['disabled'] = implode(',', $toDeactivate); $config['plugins']['hidden'] = implode(',', $toHide); if (!XH_writeFile($pth['file']['config'], hi_adm_asString($config))) { $error = TRUE; } } $errormsg = $error ? '&pm_error=1' : '&pm_error=0'; return header("Location: " . $sn . "?" . $su . '&admin=pluginmanager' . $errormsg); } $o .= '<form method="post" action="' . $sn . '?' . $su . '">' . PHP_EOL; $o .= $_XH_csrfProtection->tokenInput() . PHP_EOL; $o .= tag('input type="hidden" value="pluginmanager" name="admin"') . PHP_EOL . tag('input type="hidden" value="pm_save" name="action"') . PHP_EOL . tag('input type="submit" value="' . ucfirst($tx['action']['save']) . '" style="margin: 0 0 10px 0;"') . PHP_EOL; $o .= tag('br'); $o .= '<table>' . PHP_EOL; $o .= '<tr>' . PHP_EOL; $o .= '<th>' . $plugin_tx['hi_admin']['heading_plugintable_plugins'] . '</th>' . '<th colspan="2">' . $plugin_tx['hi_admin']['heading_plugintable_active'] . '</th>' . '<th>' . $plugin_tx['hi_admin']['heading_plugintable_deactivated'] . '</th>' . PHP_EOL; foreach ($plugins as $plugin) { if (in_array($plugin, $inactivePlugins)) { $mode = 'disabled'; } elseif (in_array($plugin, $hiddenPlugins)) { $mode = 'hidden'; } else { $mode = 'active'; } $o .= '<tr>' . PHP_EOL; $o .= '<td>'; $o .= $mode == 'disabled' ? '<span class="hi_adm_' . $mode . '">' . $plugin . '</span>' : '<a href="' . $sn . '?' . $plugin . '&normal"><span class="hi_adm_' . $mode . '">' . $plugin . '</span></a>'; $o .= '</td>' . PHP_EOL; $selected = $mode == 'active' ? ' checked="checked"' : ''; $o .= '<td>' . tag('input type="radio" id="active_' . $plugin . '" name="pm_' . $plugin . '" value="pm_active"' . $selected) . PHP_EOL; $o .= '<label for="active_' . $plugin . '">' . $plugin_tx['hi_admin']['plugintable_visible'] . '</label></td>' . PHP_EOL; $selected = $mode == 'hidden' ? ' checked="checked"' : ''; $o .= '<td>' . tag('input type="radio" id="hidden_' . $plugin . '" name="pm_' . $plugin . '" value="pm_hidden"' . $selected) . PHP_EOL; $o .= '<label for="hidden_' . $plugin . '">' . $plugin_tx['hi_admin']['plugintable_hidden'] . '</label></td>' . PHP_EOL; $selected = $mode == 'disabled' ? ' checked="checked"' : ''; $o .= '<td>' . tag('input type="radio" id="inactive_' . $plugin . '" name="pm_' . $plugin . '" value="pm_inactive"' . $selected) . PHP_EOL; $o .= '<label for="inactive_' . $plugin . '">' . $plugin_tx['hi_admin']['plugintable_deactivated'] . '</label></td>' . PHP_EOL; $o .= '</tr>' . PHP_EOL; } $o .= '</table>'; $o .= tag('input type="submit" value="' . ucfirst($tx['action']['save']) . '" style="margin: 10px 0 0 0;"') . PHP_EOL; $o .= '</form>' . PHP_EOL; $o .= '</div>' . PHP_EOL; return $o; }