// return false;
// }
+ // include classes
+ if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) {
+ $this->registerClasses();
+ }
+
// include start file
if ($flags & ELGG_PLUGIN_INCLUDE_START) {
$this->includeFile('start.php');
$this->registerLanguages();
}
- // include classes
- if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) {
- $this->registerClasses();
- }
-
return true;
}
}
elgg_set_plugin_setting('display_errors', get_input('display_errors'), 'developers');
+elgg_set_plugin_setting('screen_log', get_input('screen_log'), 'developers');
$debug = get_input('debug_level');
if ($debug) {
unset_config('debug', $site->getGUID());
}
+system_message(elgg_echo('developers:settings:success'));
+
forward(REFERER);
--- /dev/null
+<?php
+/**
+ * Cache logging information for later display
+ *
+ */
+
+class ElggLogCache {
+ protected $cache;
+
+ public function __construct() {
+ $this->cache = array();
+ }
+
+ /**
+ * Insert into cache
+ *
+ * @param mixed $data The log data to cache
+ */
+ public function insert($data) {
+ $this->cache[] = $data;
+ }
+
+ /**
+ * Insert into cache from plugin hook
+ *
+ * @param string $hook
+ * @param string $type
+ * @param bool $result
+ * @param array $params Must have the data at $params['msg']
+ */
+ public function insertDump($hook, $type, $result, $params) {
+ $this->insert($params['msg']);
+ }
+
+ /**
+ * Get the cache
+ *
+ * @return array
+ */
+ public function get() {
+ return $this->cache;
+ }
+}
'developers:help:debug_level' => "This controls the amount of information logged. See elgg_log() for more information.",
'developers:label:display_errors' => 'Display fatal PHP errors',
'developers:help:display_errors' => "By default, Elgg's .htaccess file supresses the display of fatal errors.",
+ 'developers:label:screen_log' => "Log to the screen",
+ 'developers:help:screen_log' => "This displays elgg_log() and elgg_dump() output on the web page.",
'developers:debug:off' => 'Off',
'developers:debug:error' => 'Error',
'theme_preview:modules' => 'Modules',
'theme_preview:navigation' => 'Navigation',
'theme_preview:typography' => 'Typography',
+
+ // status messages
+ 'developers:settings:success' => 'Settings saved',
);
add_translation('en', $english);
elgg_register_event_handler('pagesetup', 'system', 'developers_setup_menu');
elgg_extend_view('css/admin', 'developers/css');
+ elgg_extend_view('css/elgg', 'developers/css');
elgg_register_page_handler('theme_preview', 'developers_theme_preview_controller');
} else {
ini_set('display_errors', 0);
}
+
+ if (elgg_get_plugin_setting('screen_log', 'developers') == 1) {
+ $cache = new ElggLogCache();
+ elgg_set_config('log_cache', $cache);
+ elgg_register_plugin_hook_handler('debug', 'log', array($cache, 'insertDump'));
+ elgg_extend_view('page/elements/foot', 'developers/log');
+ }
}
function developers_setup_menu() {
'view_path_cache' => 'checkbox',
'display_errors' => 'checkbox',
'debug_level' => 'pulldown',
+ 'screen_log' => 'checkbox',
);
$data = array(
'NOTICE' => elgg_echo('developers:debug:notice'),
),
),
+
+ 'screen_log' => array(
+ 'type' => 'checkbox',
+ 'value' => 1,
+ 'checked' => elgg_get_plugin_setting('screen_log', 'developers') == 1,
+ ),
);
$form_vars = array('id' => 'developer-settings-form');
.elgg-page .jstree-default.jstree-focused {
background-color: transparent;
}
+.developers-log {
+ background-color: #EBF5FF;
+ border: 1px solid #999;
+ color: #666;
+ padding: 20px;
+}
--- /dev/null
+<?php
+/**
+ * Logging information
+ */
+
+$cache = elgg_get_config('log_cache');
+$items = $cache->get();
+
+echo '<div class="developers-log">';
+foreach ($items as $item) {
+ echo '<pre>';
+ print_r($item);
+ echo '</pre>';
+}
+
+echo '</div>';
\ No newline at end of file