Skip to content

Commit

Permalink
v 0.19.2
Browse files Browse the repository at this point in the history
Add a « check all » button to settings.
  • Loading branch information
Darklg committed May 28, 2024
1 parent b68c70e commit 28b21a8
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 55 deletions.
43 changes: 35 additions & 8 deletions inc/WPUBaseSettings/WPUBaseSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
Class Name: WPU Base Settings
Description: A class to handle native settings in WordPress admin
Version: 0.19.0
Version: 0.20.0
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
Expand Down Expand Up @@ -193,14 +193,28 @@ public function add_settings() {
'show_in_rest' => $this->settings_details,
'default' => array()
));
$has_check_all = false;
foreach ($this->settings_details['sections'] as $id => $section) {
if (current_user_can($section['user_cap'])) {
add_settings_section($id,
$section['name'],
isset($section['description']) ? $section['description'] : '',
$this->settings_details['plugin_id']
);
if (!current_user_can($section['user_cap'])) {
continue;
}
if (!isset($section['after_section'])) {
$section['after_section'] = '';
}
if (isset($section['wpubasesettings_checkall']) && $section['wpubasesettings_checkall']) {
$section['after_section'] .= '<button class="wpubasesettings-check-all">' . __('Check all', __NAMESPACE__) . '</button>';
if (!$has_check_all) {
$has_check_all = true;
add_action('admin_footer', array(&$this, 'admin_footer_checkall'));
}
}
add_settings_section(
$id,
$section['name'],
isset($section['description']) ? $section['description'] : '',
$this->settings_details['plugin_id'],
$section
);
}

foreach ($this->settings as $id => $input) {
Expand Down Expand Up @@ -333,7 +347,7 @@ public function render__field($args = array()) {
}
$id .= $attr;
$value = isset($options[$args['id']]) ? $options[$args['id']] : $args['default_value'];
if(!isset($options[$args['id']]) && isset($args['translated_from']) && $args['translated_from'] && isset($options[$args['translated_from']]) && $options[$args['translated_from']]){
if (!isset($options[$args['id']]) && isset($args['translated_from']) && $args['translated_from'] && isset($options[$args['translated_from']]) && $options[$args['translated_from']]) {
$value = $options[$args['translated_from']];
}

Expand Down Expand Up @@ -564,6 +578,19 @@ function show_lang(_lang_id){
EOT;
}

function admin_footer_checkall() {
echo <<<EOT
<script>
jQuery(document).ready(function() {
jQuery(".wpubasesettings-check-all").on("click", function(e) {
e.preventDefault();
jQuery(this).prev(".form-table").find(":checkbox").prop("checked", true);
});
});
</script>
EOT;
}

/* Base settings */

public function admin_menu() {
Expand Down
2 changes: 1 addition & 1 deletion lang/wpuactionlogs-fr_FR.l10n.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
return ['domain'=>NULL,'plural-forms'=>NULL,'messages'=>['New Post'=>'Nouvel article','Back'=>'Retour','No'=>'Non','Yes'=>'Oui','Submit'=>'Envoyer','Items %s - %s'=>'Articles %s - %s','<strong>Filter :</strong> %s • <strong>Value :</strong> %s'=>'<strong>Filtre:</strong> %s • <strong>Valeur :</strong> %s','Reset'=>'Réinitialiser','Search'=>'Rechercher','Clear'=>'Vider','Show more details'=>'Afficher plus de détails','Edit'=>'Modifier','View'=>'Voir','Delete'=>'Supprimer','Export all'=>'Tout exporter','Export filtered view'=>'Exporter la vue filtrée','Currently online'=>'Actuellement en ligne','Useful logs about what’s happening on your website admin.'=>'Des logs utiles sur ce qui se passe dans l’administration de votre site Web.','Settings'=>'Réglages','User ID'=>'ID de l’utilisateur','Action type'=>'Type d’action','Action detail'=>'Détails de l’action','Action source'=>'Source de l’action','Action interface'=>'Interface','Actions'=>'Actions','Interfaces'=>'Interfaces','Extras'=>'Extras','Enable logs for “%s”'=>'Activer les journaux pour les « %s »','Disable logs on %s'=>'Désactiver les journaux pour %s','Posts'=>'Publications','Menus'=>'Menus','Terms'=>'Termes','Options'=>'Options','Emails'=>'Emails','Users'=>'Utilisateurs','Plugins'=>'Extensions','Disable on web'=>'Désactiver sur web','web interface'=>'l’interface web','Disable on cron'=>'Désactiver sur cron','cron interface'=>'l’interface cron','Disable on CLI'=>'Désactiver sur CLI','CLI interface'=>'l’interface CLI','Display active users'=>'Afficher les utilisateurs actifs','Purge after N days'=>'Purger après N jours','Logs will be automatically deleted after this number of days. Set to 0 to disable'=>'Les logs seront automatiquement supprimés après ce nombre de jours. Définir à 0 pour désactiver','Select an user: '=>'Sélectionnez un utilisateur : ','All'=>'Tous','ID'=>'ID','Date'=>'Date','Account'=>'Compte','Save Changes'=>'Sauvegarder','No active users'=>'Aucun utilisateur actif','Online here:'=>'En ligne ici :','(you)'=>'(vous)'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4'];
return ['domain'=>NULL,'plural-forms'=>NULL,'messages'=>['New Post'=>'Nouvel article','Back'=>'Retour','No'=>'Non','Yes'=>'Oui','Submit'=>'Envoyer','Items %s - %s'=>'Articles %s - %s','<strong>Filter :</strong> %s • <strong>Value :</strong> %s'=>'<strong>Filtre:</strong> %s • <strong>Valeur :</strong> %s','Reset'=>'Réinitialiser','Search'=>'Rechercher','Clear'=>'Vider','Show more details'=>'Afficher plus de détails','Edit'=>'Modifier','View'=>'Voir','Delete'=>'Supprimer','Export all'=>'Tout exporter','Export filtered view'=>'Exporter la vue filtrée','Settings'=>'Réglages','Check all'=>'Tout cocher','Settings saved.'=>'Paramètres sauvegardés.','Upload New Media'=>'','Language'=>'','Save'=>'','Currently online'=>'Actuellement en ligne','Useful logs about what’s happening on your website admin.'=>'Des logs utiles sur ce qui se passe dans l’administration de votre site Web.','User ID'=>'ID de l’utilisateur','Action type'=>'Type d’action','Action detail'=>'Détails de l’action','Action source'=>'Source de l’action','Action interface'=>'Interface','Actions'=>'Actions','Interfaces'=>'Interfaces','Extras'=>'Extras','Enable logs for “%s”'=>'Activer les journaux pour les « %s »','Disable logs on %s'=>'Désactiver les journaux pour %s','Posts'=>'Publications','Menus'=>'Menus','Terms'=>'Termes','Options'=>'Options','Emails'=>'Emails','Users'=>'Utilisateurs','Plugins'=>'Extensions','Disable on web'=>'Désactiver sur web','web interface'=>'l’interface web','Disable on cron'=>'Désactiver sur cron','cron interface'=>'l’interface cron','Disable on CLI'=>'Désactiver sur CLI','CLI interface'=>'l’interface CLI','Display active users'=>'Afficher les utilisateurs actifs','Purge after N days'=>'Purger après N jours','Logs will be automatically deleted after this number of days. Set to 0 to disable'=>'Les logs seront automatiquement supprimés après ce nombre de jours. Définir à 0 pour désactiver','Select an user: '=>'Sélectionnez un utilisateur : ','All'=>'Tous','ID'=>'ID','Date'=>'Date','Account'=>'Compte','Save Changes'=>'Sauvegarder','No active users'=>'Aucun utilisateur actif','Online here:'=>'En ligne ici :','(you)'=>'(vous)'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4'];
Binary file modified lang/wpuactionlogs-fr_FR.mo
Binary file not shown.
108 changes: 66 additions & 42 deletions lang/wpuactionlogs-fr_FR.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: WPU Action Logs\n"
"POT-Creation-Date: 2024-05-25 17:39+0200\n"
"POT-Creation-Date: 2024-05-28 18:36+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand All @@ -15,8 +15,7 @@ msgstr ""
"X-Generator: Poedit 3.4.4\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: inc/WPUBaseAdminPage\n"
"X-Poedit-SearchPathExcluded-1: inc/WPUBaseSettings\n"
"X-Poedit-SearchPathExcluded-2: inc/WPUBaseUpdate\n"
"X-Poedit-SearchPathExcluded-1: inc/WPUBaseUpdate\n"

#: inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php:557
#: inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php:803
Expand All @@ -28,10 +27,12 @@ msgid "Back"
msgstr "Retour"

#: inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php:578
#: inc/WPUBaseSettings/WPUBaseSettings.php:162
msgid "No"
msgstr "Non"

#: inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php:579
#: inc/WPUBaseSettings/WPUBaseSettings.php:162
msgid "Yes"
msgstr "Oui"

Expand Down Expand Up @@ -85,6 +86,33 @@ msgstr "Tout exporter"
msgid "Export filtered view"
msgstr "Exporter la vue filtrée"

#: inc/WPUBaseSettings/WPUBaseSettings.php:132
#: inc/WPUBaseSettings/WPUBaseSettings.php:593
#: inc/WPUBaseSettings/WPUBaseSettings.php:600 wpuactionlogs.php:113
#: wpuactionlogs.php:115
msgid "Settings"
msgstr "Réglages"

#: inc/WPUBaseSettings/WPUBaseSettings.php:205
msgid "Check all"
msgstr "Tout cocher"

#: inc/WPUBaseSettings/WPUBaseSettings.php:326
msgid "Settings saved."
msgstr "Paramètres sauvegardés."

#: inc/WPUBaseSettings/WPUBaseSettings.php:386
msgid "Upload New Media"
msgstr ""

#: inc/WPUBaseSettings/WPUBaseSettings.php:539
msgid "Language"
msgstr ""

#: inc/WPUBaseSettings/WPUBaseSettings.php:615
msgid "Save"
msgstr ""

#: wpuactionlogs.php:70
msgid "Currently online"
msgstr "Actuellement en ligne"
Expand All @@ -94,152 +122,148 @@ msgid "Useful logs about what’s happening on your website admin."
msgstr ""
"Des logs utiles sur ce qui se passe dans l’administration de votre site Web."

#: wpuactionlogs.php:110 wpuactionlogs.php:112
msgid "Settings"
msgstr "Réglages"

#: wpuactionlogs.php:149
#: wpuactionlogs.php:152
msgid "User ID"
msgstr "ID de l’utilisateur"

#: wpuactionlogs.php:153 wpuactionlogs.php:328
#: wpuactionlogs.php:156 wpuactionlogs.php:333
msgid "Action type"
msgstr "Type d’action"

#: wpuactionlogs.php:157 wpuactionlogs.php:330
#: wpuactionlogs.php:160 wpuactionlogs.php:335
msgid "Action detail"
msgstr "Détails de l’action"

#: wpuactionlogs.php:162 wpuactionlogs.php:329
#: wpuactionlogs.php:165 wpuactionlogs.php:334
msgid "Action source"
msgstr "Source de l’action"

#: wpuactionlogs.php:166 wpuactionlogs.php:331
#: wpuactionlogs.php:169 wpuactionlogs.php:336
msgid "Action interface"
msgstr "Interface"

#: wpuactionlogs.php:185
#: wpuactionlogs.php:188
msgid "Actions"
msgstr "Actions"

#: wpuactionlogs.php:188
#: wpuactionlogs.php:192
msgid "Interfaces"
msgstr "Interfaces"

#: wpuactionlogs.php:191
#: wpuactionlogs.php:196
msgid "Extras"
msgstr "Extras"

#: wpuactionlogs.php:196
#: wpuactionlogs.php:201
#, php-format
msgid "Enable logs for “%s”"
msgstr "Activer les journaux pour les « %s »"

#: wpuactionlogs.php:197
#: wpuactionlogs.php:202
#, php-format
msgid "Disable logs on %s"
msgstr "Désactiver les journaux pour %s"

#: wpuactionlogs.php:200 wpuactionlogs.php:201
#: wpuactionlogs.php:205 wpuactionlogs.php:206
msgid "Posts"
msgstr "Publications"

#: wpuactionlogs.php:206 wpuactionlogs.php:207
#: wpuactionlogs.php:211 wpuactionlogs.php:212
msgid "Menus"
msgstr "Menus"

#: wpuactionlogs.php:212 wpuactionlogs.php:213
#: wpuactionlogs.php:217 wpuactionlogs.php:218
msgid "Terms"
msgstr "Termes"

#: wpuactionlogs.php:218 wpuactionlogs.php:219
#: wpuactionlogs.php:223 wpuactionlogs.php:224
msgid "Options"
msgstr "Options"

#: wpuactionlogs.php:224 wpuactionlogs.php:225
#: wpuactionlogs.php:229 wpuactionlogs.php:230
msgid "Emails"
msgstr "Emails"

#: wpuactionlogs.php:230 wpuactionlogs.php:231
#: wpuactionlogs.php:235 wpuactionlogs.php:236
msgid "Users"
msgstr "Utilisateurs"

#: wpuactionlogs.php:236 wpuactionlogs.php:237
#: wpuactionlogs.php:241 wpuactionlogs.php:242
msgid "Plugins"
msgstr "Extensions"

#: wpuactionlogs.php:242
#: wpuactionlogs.php:247
msgid "Disable on web"
msgstr "Désactiver sur web"

#: wpuactionlogs.php:243
#: wpuactionlogs.php:248
msgid "web interface"
msgstr "l’interface web"

#: wpuactionlogs.php:248
#: wpuactionlogs.php:253
msgid "Disable on cron"
msgstr "Désactiver sur cron"

#: wpuactionlogs.php:249
#: wpuactionlogs.php:254
msgid "cron interface"
msgstr "l’interface cron"

#: wpuactionlogs.php:254
#: wpuactionlogs.php:259
msgid "Disable on CLI"
msgstr "Désactiver sur CLI"

#: wpuactionlogs.php:255
#: wpuactionlogs.php:260
msgid "CLI interface"
msgstr "l’interface CLI"

#: wpuactionlogs.php:260
#: wpuactionlogs.php:265
msgid "Display active users"
msgstr "Afficher les utilisateurs actifs"

#: wpuactionlogs.php:265
#: wpuactionlogs.php:270
msgid "Purge after N days"
msgstr "Purger après N jours"

#: wpuactionlogs.php:266
#: wpuactionlogs.php:271
msgid ""
"Logs will be automatically deleted after this number of days. Set to 0 to "
"disable"
msgstr ""
"Les logs seront automatiquement supprimés après ce nombre de jours. Définir "
"à 0 pour désactiver"

#: wpuactionlogs.php:311
#: wpuactionlogs.php:316
msgid "Select an user: "
msgstr "Sélectionnez un utilisateur : "

#: wpuactionlogs.php:312
#: wpuactionlogs.php:317
msgid "All"
msgstr "Tous"

#: wpuactionlogs.php:325
#: wpuactionlogs.php:330
msgid "ID"
msgstr "ID"

#: wpuactionlogs.php:326
#: wpuactionlogs.php:331
msgid "Date"
msgstr "Date"

#: wpuactionlogs.php:327
#: wpuactionlogs.php:332
msgid "Account"
msgstr "Compte"

#: wpuactionlogs.php:415
#: wpuactionlogs.php:420
msgid "Save Changes"
msgstr "Sauvegarder"

#: wpuactionlogs.php:426
#: wpuactionlogs.php:431
msgid "No active users"
msgstr "Aucun utilisateur actif"

#: wpuactionlogs.php:837
#: wpuactionlogs.php:842
msgid "Online here:"
msgstr "En ligne ici :"

#: wpuactionlogs.php:842
#: wpuactionlogs.php:847
msgid "(you)"
msgstr "(vous)"
10 changes: 6 additions & 4 deletions wpuactionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpuactionlogs
Update URI: https://github.com/WordPressUtilities/wpuactionlogs
Description: Useful logs about what’s happening on your website admin.
Version: 0.19.1
Version: 0.19.2
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpuactionlogs
Expand All @@ -25,7 +25,7 @@ class WPUActionLogs {
public $baseadmindatas;
public $settings_details;
public $settings;
private $plugin_version = '0.19.1';
private $plugin_version = '0.19.2';
private $plugin_settings = array(
'id' => 'wpuactionlogs',
'name' => 'WPU Action Logs',
Expand Down Expand Up @@ -185,10 +185,12 @@ public function load_settings() {
'option_id' => $this->plugin_settings['id'] . '_options',
'sections' => array(
'actions' => array(
'name' => __('Actions', 'wpuactionlogs')
'name' => __('Actions', 'wpuactionlogs'),
'wpubasesettings_checkall' => true
),
'interfaces' => array(
'name' => __('Interfaces', 'wpuactionlogs')
'name' => __('Interfaces', 'wpuactionlogs'),
'wpubasesettings_checkall' => true
),
'extras' => array(
'name' => __('Extras', 'wpuactionlogs')
Expand Down

0 comments on commit 28b21a8

Please sign in to comment.