| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Modules\ActivityLogs\Hooks; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Modules\ActivityLogs\Inc\Hooks_Base; |
| 6 |
|
| 7 |
// no direct access allowed |
| 8 |
if (!defined('ABSPATH')) exit; |
| 9 |
|
| 10 |
class WP_Adminify_Logs_Options extends Hooks_Base |
| 11 |
{ |
| 12 |
public function __construct() |
| 13 |
{ |
| 14 |
parent::__construct(); |
| 15 |
add_action('updated_option', [$this, 'hooks_updated_option'], 10, 3); |
| 16 |
} |
| 17 |
|
| 18 |
public function hooks_updated_option($option, $oldvalue, $_newvalue) |
| 19 |
{ |
| 20 |
$whitelist_options = apply_filters('wp_adminify_whitelist_options', array( |
| 21 |
// General |
| 22 |
'blogname', |
| 23 |
'blogdescription', |
| 24 |
'siteurl', |
| 25 |
'home', |
| 26 |
'admin_email', |
| 27 |
'users_can_register', |
| 28 |
'default_role', |
| 29 |
'timezone_string', |
| 30 |
'date_format', |
| 31 |
'time_format', |
| 32 |
'start_of_week', |
| 33 |
|
| 34 |
// Writing |
| 35 |
'use_smilies', |
| 36 |
'use_balanceTags', |
| 37 |
'default_category', |
| 38 |
'default_post_format', |
| 39 |
'mailserver_url', |
| 40 |
'mailserver_login', |
| 41 |
'mailserver_pass', |
| 42 |
'default_email_category', |
| 43 |
'ping_sites', |
| 44 |
|
| 45 |
// Reading |
| 46 |
'show_on_front', |
| 47 |
'page_on_front', |
| 48 |
'page_for_posts', |
| 49 |
'posts_per_page', |
| 50 |
'posts_per_rss', |
| 51 |
'rss_use_excerpt', |
| 52 |
'blog_public', |
| 53 |
|
| 54 |
// Discussion |
| 55 |
'default_pingback_flag', |
| 56 |
'default_ping_status', |
| 57 |
'default_comment_status', |
| 58 |
'require_name_email', |
| 59 |
'comment_registration', |
| 60 |
'close_comments_for_old_posts', |
| 61 |
'close_comments_days_old', |
| 62 |
'thread_comments', |
| 63 |
'thread_comments_depth', |
| 64 |
'page_comments', |
| 65 |
'comments_per_page', |
| 66 |
'default_comments_page', |
| 67 |
'comment_order', |
| 68 |
'comments_notify', |
| 69 |
'moderation_notify', |
| 70 |
'comment_moderation', |
| 71 |
'comment_whitelist', |
| 72 |
'comment_max_links', |
| 73 |
'moderation_keys', |
| 74 |
'blacklist_keys', |
| 75 |
'show_avatars', |
| 76 |
'avatar_rating', |
| 77 |
'avatar_default', |
| 78 |
|
| 79 |
// Media |
| 80 |
'thumbnail_size_w', |
| 81 |
'thumbnail_size_h', |
| 82 |
'thumbnail_crop', |
| 83 |
'medium_size_w', |
| 84 |
'medium_size_h', |
| 85 |
'large_size_w', |
| 86 |
'large_size_h', |
| 87 |
'uploads_use_yearmonth_folders', |
| 88 |
|
| 89 |
// Permalinks |
| 90 |
'permalink_structure', |
| 91 |
'category_base', |
| 92 |
'tag_base', |
| 93 |
|
| 94 |
// Widgets |
| 95 |
'sidebars_widgets', |
| 96 |
)); |
| 97 |
|
| 98 |
if (!in_array($option, $whitelist_options)) |
| 99 |
return; |
| 100 |
|
| 101 |
// TODO: need to think about save old & new values. |
| 102 |
adminify_activity_logs(array( |
| 103 |
'action' => 'updated', |
| 104 |
'object_type' => 'Options', |
| 105 |
'object_name' => $option, |
| 106 |
)); |
| 107 |
} |
| 108 |
} |
| 109 |
|