| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die; |
| 10 |
} // Cannot access directly. |
| 11 |
|
| 12 |
if ( ! class_exists( 'Module_Activity_Logs' ) ) { |
| 13 |
class Module_Activity_Logs extends AdminSettingsModel { |
| 14 |
|
| 15 |
public function __construct() { |
| 16 |
$this->jltwp_activity_logs_settings(); |
| 17 |
} |
| 18 |
|
| 19 |
public function get_defaults() { |
| 20 |
return [ |
| 21 |
'activity_logs_user_roles' => [], |
| 22 |
'activity_logs_history_data' => 30, |
| 23 |
]; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* User Roles |
| 28 |
*/ |
| 29 |
public function activity_logs_fields( &$fields ) { |
| 30 |
$fields[] = [ |
| 31 |
'type' => 'subheading', |
| 32 |
'content' => Utils::adminfiy_help_urls( |
| 33 |
__( 'Activity Logs Settings', 'adminify' ), |
| 34 |
'https://wpadminify.com/kb/organize-media-library-pages-posts-post-type-using-folder/', |
| 35 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 36 |
'https://www.facebook.com/groups/jeweltheme', |
| 37 |
'https://wpadminify.com/support/' |
| 38 |
), |
| 39 |
]; |
| 40 |
$fields[] = [ |
| 41 |
'id' => 'activity_logs_user_roles', |
| 42 |
'type' => 'select', |
| 43 |
'title' => __( 'Disable for', 'adminify' ), |
| 44 |
'placeholder' => __( 'Select User roles you want to show', 'adminify' ), |
| 45 |
'options' => 'roles', |
| 46 |
'multiple' => true, |
| 47 |
'chosen' => true, |
| 48 |
'default' => $this->get_default_field( 'activity_logs_user_roles' ), |
| 49 |
]; |
| 50 |
$fields[] = [ |
| 51 |
'id' => 'activity_logs_history_data', |
| 52 |
'type' => 'number', |
| 53 |
'title' => __( 'Keep Activity Logs Data', 'adminify' ), |
| 54 |
'subtitle' => __( 'How many days Activity Logs data will store', 'adminify' ), |
| 55 |
'after' => '<span style="padding-left:10px">days</span>', |
| 56 |
'default' => $this->get_default_field( 'activity_logs_history_data' ), |
| 57 |
]; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
/** |
| 64 |
* Module: Activity Logs |
| 65 |
* |
| 66 |
* @return void |
| 67 |
*/ |
| 68 |
public function jltwp_activity_logs_settings() { |
| 69 |
if ( ! class_exists( 'ADMINIFY' ) ) { |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
$fields = []; |
| 74 |
$this->activity_logs_fields( $fields ); |
| 75 |
|
| 76 |
// Activity Logs Order Section |
| 77 |
\ADMINIFY::createSection( |
| 78 |
$this->prefix, |
| 79 |
[ |
| 80 |
'title' => __( 'Activity Logs', 'adminify' ), |
| 81 |
'id' => 'module_activity_logs_section', |
| 82 |
'parent' => 'module_settings', |
| 83 |
'icon' => 'fas fa-history', |
| 84 |
'fields' => $fields, |
| 85 |
] |
| 86 |
); |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
|