Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions assets/css/ur-notice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,8 @@
width: 100%;
box-sizing: border-box;

.notice-dismiss {
.ur-notice-dismiss {
margin-left: 2px;

&:before {
display: none;
}
}

&.is-dismissible {
.notice-dismiss {
&::before {
display: block;
}
}
}

.user-registration-notice-thumbnail {
Expand Down Expand Up @@ -130,16 +118,15 @@
justify-content: space-between;
margin-top: 12px;

.notice-dismiss {
.ur-notice-dismiss {
min-height: 32px;
margin-left: 0;
align-content: center;
position: unset;
text-decoration: none;
font-weight: 400;
color: #9ca3af;

&.notice-nsa {
&.ur-notice-nsa {
padding: 0;
}
}
Expand Down Expand Up @@ -219,6 +206,8 @@
border: 1px solid;
width: 17px;
height: 17px;
line-height: 17px;
vertical-align: middle;
}
}

Expand Down
4 changes: 2 additions & 2 deletions assets/js/admin/ur-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jQuery(function ($) {
// Review notice.
$(".user-registration-notice").each(function () {
$(this)
.find(".notice-dismiss")
.find(".ur-notice-dismiss")
.on("click", function (e) {
e.preventDefault();

Expand All @@ -14,7 +14,7 @@ jQuery(function ($) {
.data("notice-id"),
notice_type_nonce = notice_type + "_nonce",
dismiss_forever = $(this).hasClass(
"notice-dismiss-permanently"
"ur-notice-dismiss-permanently"
);

$(this)
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/functions-ur-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
return false;
}

/**

Check failure on line 602 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$is_permanent_dismiss" missing
* Links for Promotional Notices.
*
* @param array $notice_target_links Notice target links.
Expand All @@ -615,7 +615,7 @@
$link['link'] = $url . ( isset( $link['link']['link_params'] ) ? $link['link']['link_params'] : '#' );
}
?>
<li><a class="button <?php esc_attr_e( $link['class'], 'user-registration' ); ?>" href="<?php echo esc_url( $link['link'] ); ?>" target="<?php echo esc_attr( $link['target'] ); ?>" rel="noreferrer noopener"><span class="dashicons <?php echo esc_attr( $link['icon'] ); ?>"></span><?php esc_html_e( $link['title'], 'user-registration' ); ?></a></li>

Check failure on line 618 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

The $text arg must be a single string literal, not "$link['title']".

Check failure on line 618 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

The $text arg must be a single string literal, not "$link['class']".
<?php
}
?>
Expand All @@ -624,14 +624,14 @@
if ( $is_permanent_dismiss ) {

?>
<a href="#" class="notice-dismiss notice-nsa notice-dismiss-permanently"><?php esc_html_e( 'Never show again', 'user-registration' ); ?></a>
<a href="#" class="ur-notice-dismiss ur-notice-nsa ur-notice-dismiss-permanently"><?php esc_html_e( 'Never show again', 'user-registration' ); ?></a>
<?php
}
}

if ( ! function_exists( 'ur_check_all_functions' ) ) {

/**

Check failure on line 634 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$conditions" missing
* Check common functions.
*
* @return bool
Expand Down Expand Up @@ -686,7 +686,7 @@

if ( ! function_exists( 'ur_check_products_version' ) ) {

/**

Check failure on line 689 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$conditions" missing
* Check products version.
*
* @return bool
Expand All @@ -713,17 +713,17 @@
$sub_operator = $version_to_compare;
} else {
$plugin_version = get_plugin_version( $plugin_slug );
// Extract the operator and the number

Check failure on line 716 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Inline comments must end in full-stops, exclamation marks, or question marks
preg_match( '/([<>!=]=?)(\d+(\.\d+)+)/', $version_to_compare, $matches );
$numeric_operator = $matches[1];
$version_to_compare = $matches[2];

if ( ! empty( $plugin_version ) ) {
$valid = version_compare( $plugin_version, $version_to_compare, $numeric_operator );
if ( $valid && $sub_operator == 'OR' ) {

Check failure on line 723 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Use Yoda Condition checks, you must.
array_push( $valid_plugins, $valid );
break;
} elseif ( $valid && $sub_operator == 'AND' ) {

Check failure on line 726 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Use Yoda Condition checks, you must.
array_push( $valid_plugins, $valid );
continue;
}
Expand All @@ -739,7 +739,7 @@
if ( 'themes' === $key ) {
foreach ( $value as $theme_slug => $version_to_compare ) {
$theme_version = get_theme_version( $theme_slug );
// Extract the operator and the number

Check failure on line 742 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Inline comments must end in full-stops, exclamation marks, or question marks
preg_match( '/([<>!=]=?)(\d+(\.\d+)+)/', $version_to_compare, $matches );
$numeric_operator = $matches[1];
$version_to_compare = $matches[2];
Expand Down Expand Up @@ -768,7 +768,7 @@

if ( ! function_exists( 'ur_check_condition_operator' ) ) {

/**

Check failure on line 771 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$condition_to_validate" missing
* Check condition operator.
*
* @return bool
Expand Down Expand Up @@ -951,7 +951,7 @@
'label' => esc_html__( 'Memberships', 'user-registration' ),
),
) : array(),
// ( ur_check_module_activation( 'membership-groups' ) || ! empty( $membership_groups ) ) ?

Check warning on line 954 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

This comment is 51% valid code; is this commented out code?
// array(
// 'groups' => array(
// 'page_slug' => 'user-registration-membership&action=list_groups',
Expand All @@ -975,7 +975,7 @@
'page_slug' => 'user-registration',
'label' => sprintf( esc_html__( 'Registration %s', 'user-registration' ), $postfix ),
),
'login-form' => array(

Check warning on line 978 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Array double arrow not aligned correctly; expected 12 space(s) between "'login-form'" and double arrow, but found 8.
'page_slug' => 'user-registration-login-forms',
'label' => esc_html__( 'Login Form', 'user-registration' ),
),
Expand All @@ -986,7 +986,7 @@
'page_slug' => 'user-registration',
'label' => sprintf( esc_html__( 'Registration %s', 'user-registration' ), $postfix ),
),
'login-form' => array(

Check warning on line 989 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Array double arrow not aligned correctly; expected 8 space(s) between "'login-form'" and double arrow, but found 3.
'page_slug' => 'user-registration-login-forms',
'label' => esc_html__( 'Login Form', 'user-registration' ),
),
Expand All @@ -1008,7 +1008,7 @@

ob_start();
?>
<div class="ur-admin-page-topnav <?php echo isset( $_GET['page'] ) && ( 'user-registration-dashboard' === $_GET['page'] ) ? 'ur-dashboard-page-topnav' : ''; ?>" id="ur-lists-page-topnav">

Check warning on line 1011 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check warning on line 1011 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.
<div class="ur-page-title__wrapper">
<div class="ur-page-title__wrapper--left">
<div class="ur-page-title__wrapper--left-logo">
Expand Down Expand Up @@ -1087,7 +1087,7 @@
}
?>
<?php
if ( isset( $_GET['page'] ) && 'user-registration-dashboard' === $_GET['page'] ) {

Check warning on line 1090 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check warning on line 1090 in includes/admin/functions-ur-admin.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.
?>
<div class="ur-version-tag-separator" bis_skin_checked="1"><hr></div>
<button type="button" class="ur-announcement-button"><img alt="announcement" src="<?php echo esc_url_raw( UR()->plugin_url() . '/assets/images/announcement.gif' ); ?>" /></button>
Expand Down
27 changes: 18 additions & 9 deletions includes/admin/notifications/class-ur-admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,22 @@
$valid_notice = array();

foreach ($notices as $key => $notice) {
$notice_id = $notice['type'] . '_' . $notice['id'];
$reopen_days = isset( $notice['reopen_days'] ) ? $notice['reopen_days'] : 0;
$reopen_times = isset( $notice['reopen_times'] ) ? $notice['reopen_times'] : 0;

if ( true === $notice['conditions_to_display'] ) {
if ( current_user_can( 'manage_options' ) ) {
$valid_notice = $notice;
break;
}
continue;
}

$conditions = $notice['conditions_to_display'][0];
$operator = 'AND';
$valid_condition = array();

$notice_id = $notice['type'] . '_' . $notice['id'];
$reopen_days = $notice['reopen_days'];
$reopen_times = $notice['reopen_times'];
foreach ($conditions as $key => $value) {

if ('operator' == $key) {
Expand Down Expand Up @@ -343,14 +352,14 @@
'title' => __('I already did!', 'user-registration'),
'icon' => 'dashicons-smiley',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-permanently',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-permanently',
'target' => '',
),
array(
'title' => __('Maybe later', 'user-registration'),
'icon' => 'dashicons-dismiss',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-temporarily',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-temporarily',
'target' => '',
),
array(
Expand Down Expand Up @@ -403,14 +412,14 @@
'title' => __('I already did!', 'user-registration'),
'icon' => 'dashicons-smiley',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-permanently',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-permanently',
'target' => '',
),
array(
'title' => __('Maybe later', 'user-registration'),
'icon' => 'dashicons-dismiss',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-temporarily',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-temporarily',
'target' => '',
),
array(
Expand Down Expand Up @@ -466,14 +475,14 @@
'title' => __('I already did!', 'user-registration'),
'icon' => 'dashicons-smiley',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-permanently',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-permanently',
'target' => '',
),
array(
'title' => __('Maybe later', 'user-registration'),
'icon' => 'dashicons-dismiss',
'link' => '#',
'class' => 'button-secondary notice-dismiss notice-dismiss-temporarily',
'class' => 'button-secondary ur-notice-dismiss ur-notice-dismiss-temporarily',
'target' => '',
),
array(
Expand All @@ -496,7 +505,7 @@
),
),
),
// array(

Check warning on line 508 in includes/admin/notifications/class-ur-admin-notices.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

This comment is 49% valid code; is this commented out code?
// 'id' => 'ur_allow_usage',
// 'type' => 'allow-usage',
// 'status' => 'active',
Expand Down Expand Up @@ -861,7 +870,7 @@
public static function continue_setup_wizard_notice()
{

$first_time_activation = get_option('user_registration_first_time_activation_flag', false);

Check warning on line 873 in includes/admin/notifications/class-ur-admin-notices.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
$onboarding_completed = true;
$onboarding_complete_text = '';

Expand Down Expand Up @@ -944,7 +953,7 @@

self::remove_notice('membership_group_conflict');

for ($i = 0; $i < count($group_ids); $i++) {

Check warning on line 956 in includes/admin/notifications/class-ur-admin-notices.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Avoid function calls in a FOR loop test part
for ($j = $i + 1; $j < count($group_ids); $j++) {

if (array_intersect(
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/notifications/views/html-notice-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<?php
if ( 'allow_usage' !== $notice_type ) {
?>
<a href="#" class="close-btn notice-dismiss notice-dismiss-temporarily">&times;</a>
<a href="#" class="close-btn ur-notice-dismiss ur-notice-dismiss-temporarily">&times;</a>
<?php
}
?>
Expand Down
Loading