diff options
-rw-r--r-- | mod/developers/actions/developers/settings.php | 8 | ||||
-rw-r--r-- | mod/developers/languages/en.php | 2 | ||||
-rw-r--r-- | mod/developers/start.php | 17 | ||||
-rw-r--r-- | mod/developers/views/default/admin/developers/settings.php | 14 |
4 files changed, 30 insertions, 11 deletions
diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php index 9fa96fa91..5a7f97cd3 100644 --- a/mod/developers/actions/developers/settings.php +++ b/mod/developers/actions/developers/settings.php @@ -17,9 +17,6 @@ if (get_input('view_path_cache')) { elgg_disable_filepath_cache(); } -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) { set_config('debug', $debug, $site->getGUID()); @@ -27,6 +24,11 @@ if ($debug) { unset_config('debug', $site->getGUID()); } +$simple_settings = array('display_errors', 'screen_log', 'show_strings'); +foreach ($simple_settings as $setting) { + elgg_set_plugin_setting($setting, get_input($setting), 'developers'); +} + system_message(elgg_echo('developers:settings:success')); forward(REFERER); diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 053eed04f..827eb6ba3 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -23,6 +23,8 @@ $english = array( '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:label:show_strings' => "Show raw translation strings", + 'developers:help:show_strings' => "This displays the translation strings used by elgg_echo().", 'developers:debug:off' => 'Off', 'developers:debug:error' => 'Error', diff --git a/mod/developers/start.php b/mod/developers/start.php index 23b82d9db..b864bca1e 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -40,6 +40,12 @@ function developers_process_settings() { elgg_register_plugin_hook_handler('debug', 'log', array($cache, 'insertDump')); elgg_extend_view('page/elements/foot', 'developers/log'); } + + if (elgg_get_plugin_setting('show_strings', 'developers') == 1) { + // first and last in case a plugin registers a translation in an init method + register_elgg_event_handler('init', 'system', 'developers_clear_strings', 1000); + register_elgg_event_handler('init', 'system', 'developers_clear_strings', 1); + } } function developers_setup_menu() { @@ -51,6 +57,17 @@ function developers_setup_menu() { } /** +* Clear all the strings so the raw descriptor strings are displayed +*/ +function developers_clear_strings() { + global $CONFIG; + + $language = get_language(); + $CONFIG->translations[$language] = array(); + $CONFIG->translations['en'] = array(); +} + +/** * Serve the theme preview pages * * @param array $page diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index 3843c2c30..a1ae6c186 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -3,14 +3,6 @@ * Developer settings */ -$sections = array( - 'simple_cache' => 'checkbox', - 'view_path_cache' => 'checkbox', - 'display_errors' => 'checkbox', - 'debug_level' => 'pulldown', - 'screen_log' => 'checkbox', -); - $data = array( 'simple_cache' => array( 'type' => 'checkbox', @@ -46,6 +38,12 @@ $data = array( 'value' => 1, 'checked' => elgg_get_plugin_setting('screen_log', 'developers') == 1, ), + + 'show_strings' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('show_strings', 'developers') == 1, + ), ); $form_vars = array('id' => 'developer-settings-form'); |