function elggadmin_page_config() { // restore! if (optional_param('action') == 'elggadmin:config:restore') { if (require_confirm(__gettext(__gettext('Are you sure to restore default configuration?')))) { if (elggadmin_config_restore()) { elgg_messages_add(__gettext('Your configuration has been restored to default values')); } header_redirect(get_url(null, 'elggadmin::config')); } } $show_all = optional_param('view'); $_config = elggadmin_get_defconfig(); $page = new StdClass(); $page->title = __gettext('Configuration manager'); $page->body = null; if (empty($show_all)) { $view_all = '» ' . pages_html_a(get_url_query(1, 'elggadmin::', 'view=all'), __gettext('View all options')); $page->body .= pages_html_wrap('div', pages_html_wrap('label', $view_all), array('class' => '')); } else { $restore = '» ' . pages_html_a(get_url_query(1, 'elggadmin::', 'action=elggadmin:config:restore'), __gettext('Restore default values')); $page->body .= pages_html_wrap('div', pages_html_wrap('label', $restore), array('class' => '')); } $note = __gettext('Note: some fields are disabled because the value is forced by your <code>config.php</code>.'); $note .= __gettext('To change you must hand edit your <code>config.php</code>.'); $page->body .= pages_html_wrap('p', $note); foreach ($_config as $c => $obj) { if ((isset($obj->noteditable) || isset($obj->hidden)) && !$show_all) { continue; } $name = htmlspecialchars($obj->name, ENT_COMPAT, 'utf-8'); if (isset($obj->important)) { $name .= ': *'; } else { $name .= ': '; } $class = 'form-item ' . (isset($obj->important) ? ' important' : ''); $desc = isset($obj->description) ? $obj->description : ' '; $input = pages_html_wrap('label', $name, array('class' => 'input-label')); $input .= elggadmin_config_input($c, $obj); $input .= pages_html_wrap('span', $desc); $page->body .= pages_html_wrap('div', $input, array('class' => $class)); } $page->body .= pages_html_input('hidden', array('name' => 'action', 'value' => 'elggadmin:config')); $page->body = pages_html_form('elggconfig', $page->body); return $page; }
function pages_submenu_add($name, $title, $url, $weight = 10) { global $PAGE; $clean_name = 'submenu_' . clean_filename($name); $link = pages_html_a($url, $title, array('class' => $clean_name)); $menu_sub = array('name' => $name, 'html' => $link); array_insert($PAGE->menu_sub, $weight, array($menu_sub)); }
require dirname(__FILE__) . '/lib/pages.inc.php'; if (page_owner() > 0) { define('context', 'pages'); } // pages init pages_actions(); templates_page_setup(); if (page_owner() < 1) { // remove all but pages block sidebar_remove(array('pages_sidebar'), true); } $page_id = optional_param('page'); $do_action = optional_param('do'); if (!pages_enabled()) { $page = new StdClass(); $page->title = __gettext('Plugin disabled for users'); $page->content = __gettext('This plugin is currently disabled by site administrator'); } else { if ($do_action == 'edit') { $page = pages_edit_page($page_id, page_owner()); } else { $page = pages_get_page($page_id, page_owner()); } } if (!empty($page->ident)) { // link title $title = pages_html_a(get_url($page_id, 'pages::page', page_owner()), $page->title); } else { $title = $page->title; } templates_page_output($title, $page->content);