From 4e7efd94c501853dff32d856aef1f239289f927c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 16 Jun 2020 15:14:53 +0200 Subject: [PATCH] Minor - fix php notices --- plugin/add_cas_login_button/plugin.php | 12 +++++++--- plugin/add_cas_logout_button/plugin.php | 14 +++++++++--- plugin/add_facebook_login_button/plugin.php | 5 ++++- plugin/add_shibboleth_login_button/plugin.php | 15 ++++++++++--- .../plugin.php | 22 ++++++++++++++----- plugin/formLogin_hide_unhide/plugin.php | 5 ++++- 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/plugin/add_cas_login_button/plugin.php b/plugin/add_cas_login_button/plugin.php index a9b973bab6..42be643f7c 100755 --- a/plugin/add_cas_login_button/plugin.php +++ b/plugin/add_cas_login_button/plugin.php @@ -32,9 +32,15 @@ $tab_default_add_cas_login_button_cas_button_label = api_get_setting('add_cas_lo $tab_default_add_cas_login_button_cas_button_comment = api_get_setting('add_cas_login_button_cas_button_comment'); $tab_default_add_cas_login_button_cas_image_url = api_get_setting('add_cas_login_button_cas_image_url'); $defaults = []; -$defaults['cas_button_label'] = $tab_default_add_cas_login_button_cas_button_label['add_cas_login_button']; -$defaults['cas_button_comment'] = $tab_default_add_cas_login_button_cas_button_comment['add_cas_login_button']; -$defaults['cas_image_url'] = $tab_default_add_cas_login_button_cas_image_url['add_cas_login_button']; +if ($tab_default_add_cas_login_button_cas_button_label) { + $defaults['cas_button_label'] = $tab_default_add_cas_login_button_cas_button_label['add_cas_login_button']; +} +if ($tab_default_add_cas_login_button_cas_button_comment) { + $defaults['cas_button_comment'] = $tab_default_add_cas_login_button_cas_button_comment['add_cas_login_button']; +} +if ($tab_default_add_cas_login_button_cas_image_url) { + $defaults['cas_image_url'] = $tab_default_add_cas_login_button_cas_image_url['add_cas_login_button']; +} $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form; diff --git a/plugin/add_cas_logout_button/plugin.php b/plugin/add_cas_logout_button/plugin.php index 380faf82bc..4bd986f9c5 100755 --- a/plugin/add_cas_logout_button/plugin.php +++ b/plugin/add_cas_logout_button/plugin.php @@ -30,9 +30,17 @@ $form->addButtonSave(get_lang('Save'), 'submit_button'); $tab_default_add_cas_logout_button_cas_logout_label = api_get_setting('add_cas_logout_button_cas_logout_label'); $tab_default_add_cas_logout_button_cas_logout_comment = api_get_setting('add_cas_logout_button_cas_logout_comment'); $tab_default_add_cas_logout_button_cas_logout_image_url = api_get_setting('add_cas_logout_button_cas_logout_image_url'); -$defaults['cas_logout_label'] = $tab_default_add_cas_logout_button_cas_logout_label['add_cas_logout_button']; -$defaults['cas_logout_comment'] = $tab_default_add_cas_logout_button_cas_logout_comment['add_cas_logout_button']; -$defaults['cas_logout_image_url'] = $tab_default_add_cas_logout_button_cas_logout_image_url['add_cas_logout_button']; +if ($tab_default_add_cas_logout_button_cas_logout_label) { + $defaults['cas_logout_label'] = $tab_default_add_cas_logout_button_cas_logout_label['add_cas_logout_button']; +} +if ($tab_default_add_cas_logout_button_cas_logout_comment) { + $defaults['cas_logout_comment'] = $tab_default_add_cas_logout_button_cas_logout_comment['add_cas_logout_button']; +} + +if ($tab_default_add_cas_logout_button_cas_logout_image_url) { + $defaults['cas_logout_image_url'] = $tab_default_add_cas_logout_button_cas_logout_image_url['add_cas_logout_button']; +} + $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form; diff --git a/plugin/add_facebook_login_button/plugin.php b/plugin/add_facebook_login_button/plugin.php index 479f51dbe3..ef3ee5f52b 100755 --- a/plugin/add_facebook_login_button/plugin.php +++ b/plugin/add_facebook_login_button/plugin.php @@ -33,7 +33,10 @@ $form->addButtonSave(get_lang('Save'), 'submit_button'); $tab_default_add_facebook_login_button_facebook_button_url = api_get_setting( 'add_facebook_login_button_facebook_button_url' ); -$defaults['facebook_button_url'] = $tab_default_add_facebook_login_button_facebook_button_url['add_facebook_login_button']; +if ($tab_default_add_facebook_login_button_facebook_button_url) { + $defaults['facebook_button_url'] = $tab_default_add_facebook_login_button_facebook_button_url['add_facebook_login_button']; +} + $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form; diff --git a/plugin/add_shibboleth_login_button/plugin.php b/plugin/add_shibboleth_login_button/plugin.php index 916aac4060..56fdf2c0f6 100755 --- a/plugin/add_shibboleth_login_button/plugin.php +++ b/plugin/add_shibboleth_login_button/plugin.php @@ -52,9 +52,18 @@ $tab_default_add_shibboleth_login_button_shibboleth_image_url = api_get_setting( 'add_shibboleth_login_button_shibboleth_image_url' ); $defaults = []; -$defaults['shibboleth_button_label'] = $tab_default_add_shibboleth_login_button_shibboleth_button_label['add_shibboleth_login_button']; -$defaults['shibboleth_button_comment'] = $tab_default_add_shibboleth_login_button_shibboleth_button_comment['add_shibboleth_login_button']; -$defaults['shibboleth_image_url'] = $tab_default_add_shibboleth_login_button_shibboleth_image_url['add_shibboleth_login_button']; +if ($tab_default_add_shibboleth_login_button_shibboleth_button_label) { + $defaults['shibboleth_button_label'] = $tab_default_add_shibboleth_login_button_shibboleth_button_label['add_shibboleth_login_button']; +} + +if ($tab_default_add_shibboleth_login_button_shibboleth_button_comment) { + $defaults['shibboleth_button_comment'] = $tab_default_add_shibboleth_login_button_shibboleth_button_comment['add_shibboleth_login_button']; +} + +if ($tab_default_add_shibboleth_login_button_shibboleth_image_url) { + $defaults['shibboleth_image_url'] = $tab_default_add_shibboleth_login_button_shibboleth_image_url['add_shibboleth_login_button']; +} + $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form; diff --git a/plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php b/plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php index 6a8578b20f..0a39ce4458 100755 --- a/plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php +++ b/plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php @@ -36,11 +36,23 @@ $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image'); $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff'); $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'); -$defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url']; -$defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle']; -$defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image']; -$defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff']; -$defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text']; +if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url) { + $defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url']; +} + +if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle) { + $defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle']; +} + +if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image) { + $defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image']; +} +if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff) { + $defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff']; +} +if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text) { + $defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text']; +} $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form; diff --git a/plugin/formLogin_hide_unhide/plugin.php b/plugin/formLogin_hide_unhide/plugin.php index 24ddd5dc85..50dbc383d8 100755 --- a/plugin/formLogin_hide_unhide/plugin.php +++ b/plugin/formLogin_hide_unhide/plugin.php @@ -27,7 +27,10 @@ $form->addElement('text', 'label', 'Text label', ''); //get default value $tab_default_formLogin_hide_unhide_label = api_get_setting('formLogin_hide_unhide_label'); $defaults = []; -$defaults['label'] = $tab_default_formLogin_hide_unhide_label['formLogin_hide_unhide']; +if ($tab_default_formLogin_hide_unhide_label) { + $defaults['label'] = $tab_default_formLogin_hide_unhide_label['formLogin_hide_unhide']; +} + $form->setDefaults($defaults); //display form $plugin_info['settings_form'] = $form;