-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update dependencies. - Actions buttons for logs.
- Loading branch information
Showing
9 changed files
with
266 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
WPU Base Messages | ||
--- | ||
|
||
Add notices in your plugin. | ||
|
||
## Insert in the INIT hook | ||
|
||
```php | ||
if (is_admin()) { | ||
require_once __DIR__ . '/inc/WPUBaseMessages/WPUBaseMessages.php'; | ||
$this->messages = new \wpubaseplugin\WPUBaseMessages($this->options['plugin_id']); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
namespace wpuactionlogs; | ||
|
||
/* | ||
Class Name: WPU Base Messages | ||
Description: A class to handle messages in WordPress | ||
Version: 1.3.4 | ||
Class URI: https://github.com/WordPressUtilities/wpubaseplugin | ||
Author: Darklg | ||
Author URI: https://darklg.me/ | ||
License: MIT License | ||
License URI: https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
defined('ABSPATH') || die; | ||
|
||
class WPUBaseMessages { | ||
|
||
private $transient_msg; | ||
private $transient_prefix; | ||
private $notices_categories = array( | ||
'notice', | ||
'updated', | ||
'update-nag', | ||
'error' | ||
); | ||
|
||
public function __construct($prefix = '') { | ||
if (wp_doing_cron()) { | ||
return; | ||
} | ||
if (!is_user_logged_in()) { | ||
return; | ||
} | ||
$current_user = wp_get_current_user(); | ||
if (is_object($current_user)) { | ||
$prefix .= $current_user->ID; | ||
} | ||
|
||
// Set Messages | ||
$this->transient_prefix = sanitize_title(basename(__FILE__)) . $prefix; | ||
$this->transient_msg = $this->transient_prefix . '__messages'; | ||
|
||
// Add hook | ||
add_action('admin_notices', array(&$this, | ||
'admin_notices' | ||
)); | ||
} | ||
|
||
/* Set notices messages */ | ||
public function set_message($id, $message, $group = '') { | ||
if (wp_doing_cron()) { | ||
return; | ||
} | ||
$messages = (array) get_transient($this->transient_msg); | ||
if (!in_array($group, $this->notices_categories)) { | ||
$group = $this->notices_categories[0]; | ||
} | ||
$messages[$group][$id] = $message; | ||
set_transient($this->transient_msg, $messages); | ||
} | ||
|
||
/* Display notices */ | ||
public function admin_notices() { | ||
if (wp_doing_cron()) { | ||
return; | ||
} | ||
$messages = (array) get_transient($this->transient_msg); | ||
if (!empty($messages)) { | ||
foreach ($messages as $group_id => $group) { | ||
if (is_array($group)) { | ||
foreach ($group as $message) { | ||
echo '<div class="' . $group_id . ' notice is-dismissible"><p>' . $message . '</p></div>'; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Empty messages | ||
delete_transient($this->transient_msg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php /* Silence */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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','Settings'=>'Réglages','Check all'=>'Tout cocher','Uncheck all'=>'Tout dé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']; | ||
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','Delete filtered lines'=>'Supprimer les lignes filtrées','Export all'=>'Tout exporter','Export filtered view'=>'Exporter la vue filtrée','Settings'=>'Réglages','Check all'=>'Tout cocher','Uncheck all'=>'Tout décocher','Settings saved.'=>'Paramètres sauvegardés.','Upload New Media'=>'Envoi d\'un nouveau média','Language'=>'Langue','Save'=>'Sauvegarder','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.','Actions'=>'Actions','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','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','Purge old logs'=>'Purger les vieux journaux','Delete all logs'=>'Supprimer tous les journaux','All logs have been deleted'=>'Tous les journaux ont été supprimés','Old logs have been purged'=>'Les vieux journaux ont été purgés','No active users'=>'Aucun utilisateur actif','Online here:'=>'En ligne ici :','(you)'=>'(vous)'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4']; |
Binary file not shown.
Oops, something went wrong.