Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tlovett1 committed Oct 10, 2022
2 parents 2e2cf85 + 492c346 commit 0e25f3f
Show file tree
Hide file tree
Showing 101 changed files with 2,906 additions and 1,028 deletions.
31 changes: 16 additions & 15 deletions 10up-experience.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: 10up Experience
* Plugin URI: https://github.com/10up/10up-experience
* Description: The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up’s best practices.
* Version: 1.9.1
* Version: 1.10.0
* Author: 10up
* Author URI: https://10up.com
* License: GPLv2 or later
Expand All @@ -19,7 +19,7 @@

use Puc_v4_Factory;

define( 'TENUP_EXPERIENCE_VERSION', '1.9.1' );
define( 'TENUP_EXPERIENCE_VERSION', '1.10.0' );
define( 'TENUP_EXPERIENCE_DIR', __DIR__ );
define( 'TENUP_EXPERIENCE_FILE', __FILE__ );

Expand Down Expand Up @@ -75,28 +75,29 @@ function( $plugin_info, $http_response = null ) {
define( 'TENUP_EXPERIENCE_IS_NETWORK', (bool) $network_activated );

if ( ! defined( 'TENUP_DISABLE_BRANDING' ) || ! TENUP_DISABLE_BRANDING ) {
AdminCustomizations\Customizations::instance()->setup();
AdminCustomizations\Customizations::instance();
}

API\API::instance()->setup();
Authentication\Usernames::instance()->setup();
Authors\Authors::instance()->setup();
Gutenberg\Gutenberg::instance()->setup();
Headers\Headers::instance()->setup();
Plugins\Plugins::instance()->setup();
PostPasswords\PostPasswords::instance()->setup();
SupportMonitor\Monitor::instance()->setup();
SupportMonitor\Debug::instance()->setup();
Notifications\Welcome::instance()->setup();
API\API::instance();
Authentication\Usernames::instance();
Authors\Authors::instance();
Gutenberg\Gutenberg::instance();
Headers\Headers::instance();
Plugins\Plugins::instance();
PostPasswords\PostPasswords::instance();
SupportMonitor\Monitor::instance();
SupportMonitor\Debug::instance();
SupportMonitor\ActivityLog::instance();
Notifications\Welcome::instance();

/**
* We load this later to make sure there are no conflicts with other plugins.
*/
add_action(
'plugins_loaded',
function() {
Authentication\Passwords::instance()->setup();
SSO\SSO::instance()->setup();
Authentication\Passwords::instance();
SSO\SSO::instance();
}
);

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).

## [1.10.0] - 2022-09-13
### Added
* Added Activity Log
* Support for PHP 8.1

## [1.9.0] - 2022-03-21
### Added
* Bundled 10up SSO plugin into 10up Experience
Expand Down
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Requirements

* PHP 5.3+
* PHP 5.4+
* [WordPress](http://wordpress.org) 4.7+

## Installation
Expand Down Expand Up @@ -100,6 +100,58 @@ There are 2 filters available here:
- `TENUPSSO_DISABLE` - Define this as `true` to disable SSO.
- `TENUPSSO_DISALLOW_ALL_DIRECT_LOGIN` - Define this as `true` to disable username/password log ins completely.

* __Activity Log__

The Activity Log tracks key actions taken by logged in users and stores them in Support Monitor. Note that no PII is stored. This feature can be disabled by defining `TENUP_DISABLE_ACTIVITYLOG` as `true`.

## Logged Actions
- `profile_update` Runs when a user profile is updated. Example log message: "User 1 profile updated."
- `set_user_role` Runs when a user's role has changed. Example log message: "User 1 role changed from editor to administator."
- `updated_user_meta` Runs when certain user metadata has changed. Example log message: "User 1 meta updated. Key: nickname."
- `user_register` Runs when a new user is registered. Example log message: "User 1 registered."
- `deleted_user` Runs when a user is deleted. Example log message: "User 1 deleted."
- `wp_login` Runs when a user logs in. Example log message: "User 1 logged in."
- `activated_plugin` Runs when a plugin is activated. Example log message: "Plugin wordpress-seo is activated."
- `delete_plugin` Runs when a plugin is deleted. Example log message: "Plugin wordpress-seo" is deleted.
- `switch_theme` Runs the theme changes. Example log message: "Theme switch to twentytwentytwo from twentytwentyone."
- `deleted_theme` Runs when a theme is deleted from the site. Example log message: "Theme twentytwentyone is deleted."
- `updated_option` Runs when one of a specified set of core options changes. Example log message: "Option `users_can_register` is updated."
- `added_option` Runs when one of a specified set of core options is added. Example log message: "Option `users_can_register` is added."
## Filters
### tenup_experience_logged_user_meta_changes
Filters the user meta keys whose changes should be logged.
@param array $meta_keys The user meta keys to log.
### tenup_support_monitor_logged_option_changes
Filters the option keys whose changes should be logged.
@param array $option_keys The option keys to log.
### tenup_support_monitor_log_item
Filters whether to log a message.
@param array $data Associative array of data related to the action.
@param string $subgroup String representing a group of logged actions, e.g. 'users' or 'plugins'.
### tenup_support_monitor_max_activity_log_count
Filters how many log items to store. Items are stored in array saved to the options table. Default is 500.
@param int The number of log items to keep. Default 500.

## Constants

### TENUP_DISABLE_ACTIVITYLOG

Define `TENUP_DISABLE_ACTIVITYLOG` as `true` to disable Activity Log.

## Support Level

**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"source": "https://github.com/10up/10up-experience"
},
"require": {
"yahnis-elsts/plugin-update-checker": "4.8.1",
"yahnis-elsts/plugin-update-checker": "4.13",
"bjeavons/zxcvbn-php": "^1.0"
},
"require-dev": {
Expand Down
21 changes: 13 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion includes/classes/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
/**
* REST API customizations class
*/
class API extends Singleton {
class API {

use Singleton;

/**
* Default value for API restriction
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/AdminCustomizations/Customizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Admin Customizations class
*/
class Customizations extends Singleton {
class Customizations {

use Singleton;

/**
* Setup module
*
Expand Down
4 changes: 3 additions & 1 deletion includes/classes/Authentication/Passwords.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
/**
* Password extension functionality
*/
class Passwords extends Singleton {
class Passwords {

use Singleton;
/**
* Setup hooks
*
Expand Down
4 changes: 3 additions & 1 deletion includes/classes/Authentication/Usernames.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
/**
* Username extension functionality
*/
class Usernames extends Singleton {
class Usernames {

use Singleton;

/**
* Setup hooks
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/Authors/Authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Authors class
*/
class Authors extends Singleton {
class Authors {

use Singleton;

/**
* Setup module
*
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/Gutenberg/Gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Gutenberg class
*/
class Gutenberg extends Singleton {
class Gutenberg {

use Singleton;

/**
* Setup module
*
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/Headers/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Headers class
*/
class Headers extends Singleton {
class Headers {

use Singleton;

/**
* Setup module
*/
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/Notifications/Welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Welcome notification class
*/
class Welcome extends Singleton {
class Welcome {

use Singleton;

/**
* Setup module
*
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/Plugins/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Plugin class
*/
class Plugins extends Singleton {
class Plugins {

use Singleton;

/**
* Setup module
*
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/PostPasswords/PostPasswords.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
/**
* Post passwords class
*/
class PostPasswords extends Singleton {
class PostPasswords {

use Singleton;

/**
* Setup module
*
Expand Down
5 changes: 4 additions & 1 deletion includes/classes/SSO/SSO.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
/**
* SSO class
*/
class SSO extends Singleton {
class SSO {

use Singleton;

/**
* Setup SSO
*/
public function setup() {

// If using the old SSO plugin, do nothing.
if ( function_exists( 'tenup_sso_add_login_errors' ) ) {
return;
Expand Down
23 changes: 14 additions & 9 deletions includes/classes/Singleton.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Singleton class
* Singleton trait
*
* @since 1.7
* @package 10up-experience
Expand All @@ -15,25 +15,30 @@
/**
* Abstract class
*/
abstract class Singleton {
trait Singleton {
/**
* Instance.
*
* @var object
*/
protected static $instance;

/**
* Return instance of class
*
* @return self
*/
public static function instance() {
static $instance;

if ( empty( $instance ) ) {
if ( empty( static::$instance ) ) {
$class = get_called_class();

$instance = new $class();
static::$instance = new $class();

if ( method_exists( $instance, 'setup' ) ) {
$instance->setup();
if ( method_exists( static::$instance, 'setup' ) ) {
static::$instance->setup();
}
}

return $instance;
return static::$instance;
}
}
Loading

0 comments on commit 0e25f3f

Please sign in to comment.