Skip to content

Commit

Permalink
Sync from 2022-07-06
Browse files Browse the repository at this point in the history
  • Loading branch information
sndobreff committed Jul 6, 2022
1 parent 8c3577f commit d09ba7c
Show file tree
Hide file tree
Showing 33 changed files with 264 additions and 358 deletions.
2 changes: 1 addition & 1 deletion classes/AbstractSensor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class WSAL_AbstractSensor {
*
* @var integer
*
* @since 4.4.2
* @since 4.4.2.1
*/
protected static $seconds_to_check_back = 5;

Expand Down
4 changes: 2 additions & 2 deletions classes/Adapters/MySQL/MetaAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function get_table_options() {
*
* @return void
*
* @since 4.4.2
* @since 4.4.2.1
*/
public function delete_by_occurrence_ids( $occurrence_ids ) {
if ( ! empty( $occurrence_ids ) ) {
Expand All @@ -120,7 +120,7 @@ public function delete_by_occurrence_ids( $occurrence_ids ) {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public function load_by_name_and_occurrence_id( $meta_name, $occurrence_id ) {
// Make sure to grab the migrated meta fields from the occurrence table.
Expand Down
4 changes: 2 additions & 2 deletions classes/AlertFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function format_meta_expression( $expression, $value, $occurrence_id = nu
*
* @return string|mixed
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function data_truncate( $value, $expression, $length = 50, $ellipses_sequence = '...' ) {

Expand All @@ -286,7 +286,7 @@ public static function data_truncate( $value, $expression, $length = 50, $ellips
case '%MetaValue%':
case '%MetaValueOld%':
case '%MetaValueNew%':
$value = mb_strlen( $value ) > $length ? ( mb_substr( $value, 0, $length ) . $ellipses_sequence() ) : $value;
$value = mb_strlen( $value ) > $length ? ( mb_substr( $value, 0, $length ) . $ellipses_sequence ) : $value;
break;
default:
break;
Expand Down
4 changes: 2 additions & 2 deletions classes/AlertManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ final class WSAL_AlertManager {
*
* @var array
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static $disabled_post_types = array();

Expand Down Expand Up @@ -154,7 +154,7 @@ public function __construct( WpSecurityAuditLog $plugin ) {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_ignored_post_types(): array {
if ( empty( self::$ignored_cpts ) ) {
Expand Down
4 changes: 2 additions & 2 deletions classes/Connector/ConnectorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class WSAL_Connector_ConnectorFactory {
*
* @var boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static $connection = false;

Expand Down Expand Up @@ -172,7 +172,7 @@ public static function get_config() {
*
* @return void
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function destroy_connection() {
self::$connection = false;
Expand Down
22 changes: 11 additions & 11 deletions classes/Entities/class-abstract-entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class Abstract_Entity {
*
* @var [type]
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static $connection = null;

Expand All @@ -42,18 +42,18 @@ abstract class Abstract_Entity {
*
* @return string
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_table_name(): string {
return self::get_connection()->prefix . static::$table;
return self::get_connection()->base_prefix . static::$table;
}

/**
* Returns the current connection (used by the plugin)
*
* @return \WPDB @see \WSAL_Connector_MySQLDB
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_connection() {
if ( null === self::$connection ) {
Expand All @@ -78,7 +78,7 @@ public static function get_connection() {
*
* @return void
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function set_connection( $connection ) {
self::$connection = $connection;
Expand All @@ -89,7 +89,7 @@ public static function set_connection( $connection ) {
*
* @return void
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function destroy_connection() {
self::$connection = null;
Expand All @@ -105,7 +105,7 @@ public static function destroy_connection() {
*
* @return bool
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function maybe_create_table( string $table_name, string $create_ddl ): bool {
foreach ( self::get_connection()->get_col( 'SHOW TABLES', 0 ) as $table ) {
Expand All @@ -130,7 +130,7 @@ public static function maybe_create_table( string $table_name, string $create_dd
*
* @return boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function is_external_db(): bool {
$db_config = \WSAL_Connector_ConnectorFactory::get_config();
Expand All @@ -151,7 +151,7 @@ public static function is_external_db(): bool {
*
* @return boolean - True if the column exists and all given parameters are the same, false otherwise.
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function check_column(
string $table_name,
Expand Down Expand Up @@ -204,7 +204,7 @@ public static function check_column(
*
* @return integer
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_last_sql_error( $_wpdb ): int {
$code = 0;
Expand Down Expand Up @@ -235,7 +235,7 @@ public static function drop_table() {
*
* @return boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function check_table_exists( string $table_name ): bool {
foreach ( self::get_connection()->get_col( 'SHOW TABLES', 0 ) as $table ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/Entities/class-metadata-entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Metadata_Entity extends Abstract_Entity {
*
* @return bool
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function create_table(): bool {
$table_name = self::get_table_name();
Expand Down
2 changes: 1 addition & 1 deletion classes/Entities/class-occurrences-entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function get_upgrade_query() {
*
* @return bool
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function create_table(): bool {
$table_name = self::get_table_name();
Expand Down
4 changes: 2 additions & 2 deletions classes/Entities/class-options-entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Options_Entity extends Abstract_Entity {
*
* @return void
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function transfer_options() {
global $wpdb;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static function drop_table() {
*
* @return string
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_table_name(): string {
global $wpdb;
Expand Down
12 changes: 6 additions & 6 deletions classes/Helpers/class-classes-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Classes_Helper {
*
* @var array
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static $class_map = array();

Expand All @@ -36,7 +36,7 @@ class Classes_Helper {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_class_map(): array {
if ( empty( self::$class_map ) ) {
Expand All @@ -53,7 +53,7 @@ public static function get_class_map(): array {
*
* @return string|false
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_class_by_filename( string $file ) {
if ( in_array( $file, self::get_class_map(), true ) ) {
Expand All @@ -76,7 +76,7 @@ public static function get_class_by_filename( string $file ) {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_subclasses_of_class( string $current_class, string $base_class, bool $exclude_abstracts = true ): array {

Expand All @@ -100,7 +100,7 @@ public static function get_subclasses_of_class( string $current_class, string $b
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_classes_by_namespace( string $namespace ) {
if ( 0 === strpos( $namespace, '\\' ) ) {
Expand Down Expand Up @@ -148,7 +148,7 @@ function( $class ) use ( $term_upper ) {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function get_classes_with_term( $term ) {
$term_upper = strtoupper( $term );
Expand Down
2 changes: 1 addition & 1 deletion classes/Helpers/class-php-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PHP_Helper {
*
* @return array
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function string_to_array( string $string ): array {
if ( empty( $string ) ) {
Expand Down
8 changes: 4 additions & 4 deletions classes/Helpers/class-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Validator {
*
* @return boolean - true - tag is valid, false - tag is not valid.
*
* @since 4.4.2
* @since 4.4.2.1
*/
public static function validate_mirror_tag( string $string ): bool {

Expand Down Expand Up @@ -59,7 +59,7 @@ public static function validate_mirror_tag( string $string ): bool {
*
* @return boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static function starts_alpha_numeric( string $string ): bool {
if ( preg_match( '/^[a-zA-Z0-9]/', $string ) ) {
Expand All @@ -77,7 +77,7 @@ private static function starts_alpha_numeric( string $string ): bool {
*
* @return boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static function is_string_less_or_equal( string $string, int $size ): bool {
if ( strlen( $string ) <= $size ) {
Expand All @@ -94,7 +94,7 @@ private static function is_string_less_or_equal( string $string, int $size ): bo
*
* @return boolean
*
* @since 4.4.2
* @since 4.4.2.1
*/
private static function is_string_contains_only( string $string ): bool {
if ( preg_match( '/[a-z\d_-]*/i', $string ) ) {
Expand Down
Loading

0 comments on commit d09ba7c

Please sign in to comment.