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
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-archive_author-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Archive_Author_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'archive_author', __( 'Archive Author', 'wdc' ), array
parent::__construct( 'archive_author', __( 'Archive Author', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'archive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Archive_Post_Type_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'archive_post_type', __( 'Archive Post Type', 'wdc' ), array
parent::__construct( 'archive_post_type', __( 'Archive Post Type', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'archive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Archive_Taxonomy_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'archive_taxonomy', __( 'Archive Taxonomy', 'wdc' ), array
parent::__construct( 'archive_taxonomy', __( 'Archive Taxonomy', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'archive',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-attachment-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Attachment_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'attachment', __( 'Attachment', 'wdc' ), array
parent::__construct( 'attachment', __( 'Attachment', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'attachment',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-page-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Page_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'page', __( 'Page', 'wdc' ), array
parent::__construct( 'page', __( 'Page', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'page',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-page_parent-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Page_Parent_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'page_parent', __( 'Page Parent', 'wdc' ), array
parent::__construct( 'page_parent', __( 'Page Parent', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'page',
Expand Down
4 changes: 2 additions & 2 deletions includes/conditions/class-wdc-page_template-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Page_Template_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'page_template', __( 'Page Template', 'wdc' ), array
parent::__construct( 'page_template', __( 'Page Template', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'page',
Expand All @@ -29,7 +29,7 @@ public function values( $choices )
{
$post_templates = wdc_get_post_templates();

$values = array( '' => __( 'Default', 'wdc' ) );
$values = array( '' => __( 'Default', 'widget-display-conditions' ) );
$values += $post_templates['page'];

return $values;
Expand Down
20 changes: 10 additions & 10 deletions includes/conditions/class-wdc-page_type-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Page_Type_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'page_type', __( 'Page Type', 'wdc' ), array
parent::__construct( 'page_type', __( 'Page Type', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'page',
Expand All @@ -29,15 +29,15 @@ public function values( $choices )
{
return array
(
'front_page' => __( 'Front Page', 'wdc' ),
'posts_page' => __( 'Posts Page', 'wdc' ),
'search_page' => __( 'Search Page', 'wdc' ),
'404_page' => __( '404 Page (not found)', 'wdc' ),
'date_page' => __( 'Date Page', 'wdc' ),
'author_page' => __( 'Author Page', 'wdc' ),
'top_level' => __( 'Top Level Page (no parent)', 'wdc' ),
'parent' => __( 'Parent Page (has children)', 'wdc' ),
'child' => __( 'Child Page (has parent)', 'wdc' ),
'front_page' => __( 'Front Page', 'widget-display-conditions' ),
'posts_page' => __( 'Posts Page', 'widget-display-conditions' ),
'search_page' => __( 'Search Page', 'widget-display-conditions' ),
'404_page' => __( '404 Page (not found)', 'widget-display-conditions' ),
'date_page' => __( 'Date Page', 'widget-display-conditions' ),
'author_page' => __( 'Author Page', 'widget-display-conditions' ),
'top_level' => __( 'Top Level Page (no parent)', 'widget-display-conditions' ),
'parent' => __( 'Parent Page (has children)', 'widget-display-conditions' ),
'child' => __( 'Child Page (has parent)', 'widget-display-conditions' ),
);
}

Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post', __( 'Post', 'wdc' ), array
parent::__construct( 'post', __( 'Post', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_category-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Category_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_category', __( 'Post Category', 'wdc' ), array
parent::__construct( 'post_category', __( 'Post Category', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_format-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Format_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_format', __( 'Post Format', 'wdc' ), array
parent::__construct( 'post_format', __( 'Post Format', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_status-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Status_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_status', __( 'Post Status', 'wdc' ), array
parent::__construct( 'post_status', __( 'Post Status', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_tag-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Tag_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_tag', __( 'Post Tag', 'wdc' ), array
parent::__construct( 'post_tag', __( 'Post Tag', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_taxonomy-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Taxonomy_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_taxonomy', __( 'Post Taxonomy', 'wdc' ), array
parent::__construct( 'post_taxonomy', __( 'Post Taxonomy', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
4 changes: 2 additions & 2 deletions includes/conditions/class-wdc-post_template-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Template_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_template', __( 'Post Template', 'wdc' ), array
parent::__construct( 'post_template', __( 'Post Template', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand All @@ -31,7 +31,7 @@ public function values( $choices )

$values = array
(
'' => __( 'Default', 'wdc' ),
'' => __( 'Default', 'widget-display-conditions' ),
);

foreach ( $post_templates as $post_type => $templates )
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-post_type-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Post_Type_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'post_type', __( 'Post Type', 'wdc' ), array
parent::__construct( 'post_type', __( 'Post Type', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'post',
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-user-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_User_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'user', __( 'User', 'wdc' ), array
parent::__construct( 'user', __( 'User', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'user',
Expand Down
4 changes: 2 additions & 2 deletions includes/conditions/class-wdc-user_logged_in-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_User_Logged_In_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'user_logged_in', __( 'User Logged In', 'wdc' ), array
parent::__construct( 'user_logged_in', __( 'User Logged In', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'user',
Expand All @@ -29,7 +29,7 @@ public function values( $choices )
{
$choices = array
(
'1' => __( 'Yes', 'wdc' ),
'1' => __( 'Yes', 'widget-display-conditions' ),
);

return $choices;
Expand Down
2 changes: 1 addition & 1 deletion includes/conditions/class-wdc-user_role-condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_User_Role_Condition extends WDC_Condition
*/
public function __construct()
{
parent::__construct( 'user_role', __( 'User Role', 'wdc' ), array
parent::__construct( 'user_role', __( 'User Role', 'widget-display-conditions' ), array
(
'operators' => array( '==', '!=' ),
'category' => 'user',
Expand Down
2 changes: 1 addition & 1 deletion includes/operators/class-wdc-is_equal_to-operator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Is_Equal_To_Operator extends WDC_Operator
*/
public function __construct()
{
parent::__construct( '==', __( 'Is equal to', 'wdc' ), array
parent::__construct( '==', __( 'Is equal to', 'widget-display-conditions' ), array
(
'order' => 10,
));
Expand Down
2 changes: 1 addition & 1 deletion includes/operators/class-wdc-is_not_equal_to-operator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WDC_Is_Not_Equal_To_Operator extends WDC_Operator
*/
public function __construct()
{
parent::__construct( '!=', __( 'Is not equal to', 'wdc' ), array
parent::__construct( '!=', __( 'Is not equal to', 'widget-display-conditions' ), array
(
'order' => 20,
));
Expand Down
20 changes: 10 additions & 10 deletions includes/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function in_widget_form( $widget )
{
// Output button to open UI
$button = sprintf( '<button class="button wdc-open-ui" type="button" data-widget="%s" data-noncename="%s" data-nonce="%s">%s</button>',
esc_attr( $widget->id ), esc_attr( WDC_NONCE_NAME ), esc_attr( wp_create_nonce( 'ui' ) ), esc_html__( 'Display conditions', 'wdc' ) );
esc_attr( $widget->id ), esc_attr( WDC_NONCE_NAME ), esc_attr( wp_create_nonce( 'ui' ) ), esc_html__( 'Display conditions', 'widget-display-conditions' ) );

printf( '<p class="wdc-open-ui-wrap">%s<span class="spinner"></span></p>', $button );
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public static function scripts()
(
'messages' => array
(
'notSaved' => __( 'Confirm unsaved changes.', 'wdc' ),
'notSaved' => __( 'Confirm unsaved changes.', 'widget-display-conditions' ),
),
));
}
Expand All @@ -148,7 +148,7 @@ public static function template_scripts()

<div class="wdc-ui">

<h1><?php _e( 'Widget Display Conditions', 'wdc' ); ?></h1>
<h1><?php echo esc_html_x( 'Widget Display Conditions', 'Window Title', 'widget-display-conditions' ); ?></h1>

<form method="post">

Expand All @@ -158,20 +158,20 @@ public static function template_scripts()
<input type="hidden" name="widget" value="{{ data.widget }}">

<div class="notice notice-info wdc-hide-if-conditions">
<p><?php esc_html_e( __( 'No conditions set.', 'wdc' ) ); ?></p>
<p><?php esc_html_e( 'No conditions set.', 'widget-display-conditions' ); ?></p>
</div>

<h4 class="wdc-show-if-conditions"><?php _e( 'Show widget if', 'wdc' ); ?></h4>
<h4 class="wdc-show-if-conditions"><?php esc_html_e( 'Show widget if', 'widget-display-conditions' ); ?></h4>

<div class="wdc-condition-groups"></div>

<p>
<button class="button wdc-add-condition-group" type="button"><?php esc_html_e( 'Add group', 'wdc' ); ?></button>
<button class="button wdc-add-condition-group" type="button"><?php esc_html_e( 'Add group', 'widget-display-conditions' ); ?></button>
</p>

<p class="submit alignright">
<span class="spinner"></span>
<button class="button button-primary" type="submit" data-saved="<?php esc_attr_e( 'Saved', 'wdc' ); ?>"><?php esc_html_e( 'Save', 'wdc' ); ?></button>
<button class="button button-primary" type="submit" data-saved="<?php esc_attr_e( 'Saved', 'widget-display-conditions' ); ?>"><?php esc_html_e( 'Save', 'widget-display-conditions' ); ?></button>
</p>

</form>
Expand All @@ -186,7 +186,7 @@ public static function template_scripts()

<table class="wdc-conditions"></table>

<h4><?php _e( 'or', 'wdc' ); ?></h4>
<h4><?php esc_html_e( 'or', 'widget-display-conditions' ); ?></h4>

</div>

Expand All @@ -211,12 +211,12 @@ public static function template_scripts()
</td>

<td>
<button class="button wdc-add-condition" type="button"><?php esc_html_e( 'and', 'wdc' ); ?></button>
<button class="button wdc-add-condition" type="button"><?php esc_html_e( 'and', 'widget-display-conditions' ); ?></button>
</td>

<td>
<button class="button-link dashicons-before dashicons-trash wdc-remove-condition" type="button">
<span class="screen-reader-text"><?php esc_html_e( 'remove', 'wdc' ); ?></span>
<span class="screen-reader-text"><?php esc_html_e( 'remove', 'widget-display-conditions' ); ?></span>
</button>
</td>

Expand Down
16 changes: 8 additions & 8 deletions includes/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function update()

public function add_page()
{
$this->page = add_submenu_page( null, __( 'Widget Display Conditions Updater', 'wdc' ), __( 'Updater', 'wdc' ), 'update_plugins', 'wdc-updater', array( &$this, 'render_page' ) );
$this->page = add_submenu_page( null, __( 'Widget Display Conditions Updater', 'widget-display-conditions' ), __( 'Updater', 'widget-display-conditions' ), 'update_plugins', 'wdc-updater', array( &$this, 'render_page' ) );
}

public function render_page()
Expand All @@ -130,23 +130,23 @@ public function render_page()

<div class="wrap">

<h1><?php esc_html_e( 'Widget Display Conditions Updater', 'wdc' ); ?></h1>
<h1><?php esc_html_e( 'Widget Display Conditions Updater', 'widget-display-conditions' ); ?></h1>

<?php if ( $tasks ) : ?>

<form method="post">

<?php wp_nonce_field( 'update', WDC_NONCE_NAME ); ?>

<p><strong><?php esc_html_e( 'Database update is required.', 'wdc' ); ?></strong></p>
<p><?php esc_html_e( 'Make sure to create a backup before updating.', 'wdc' ); ?></p>
<p><strong><?php esc_html_e( 'Database update is required.', 'widget-display-conditions' ); ?></strong></p>
<p><?php esc_html_e( 'Make sure to create a backup before updating.', 'widget-display-conditions' ); ?></p>

<?php submit_button( __( 'Update', 'wdc' ) ); ?>
<?php submit_button( __( 'Update', 'widget-display-conditions' ) ); ?>

</form>

<?php else : ?>
<p><?php esc_html_e( 'Nothing to update.', 'wdc' ); ?></p>
<p><?php esc_html_e( 'Nothing to update.', 'widget-display-conditions' ); ?></p>
<?php endif; ?>

</div>
Expand Down Expand Up @@ -174,9 +174,9 @@ public function admin_notices()

$message = sprintf( '<strong>%s</strong> %s <a href="%s">%s</a>',
esc_html__( $plugin['Name'] ),
esc_html__( 'Database update is required.', 'wdc' ),
esc_html__( 'Database update is required.', 'widget-display-conditions' ),
admin_url( '?page=wdc-updater' ),
esc_html__( 'Go to update page', 'wdc' ) );
esc_html__( 'Go to update page', 'widget-display-conditions' ) );

printf( '<div class="notice notice-warning"><p>%s</p></div>', $message );
}
Expand Down
12 changes: 10 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: MaartenM
Tags: widget, display, conditions, rules, sidebar, custom, admin, interface, visibility
Requires at least: 4.0.0
Tested up to: 5.2
Stable tag: 0.2.6
Tested up to: 5.7.1
Stable tag: 0.2.8
Requires PHP: 5.6.27
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -50,6 +50,14 @@ You can use built-in conditions or create some of your own.

== Changelog ==

= 0.2.8 =
Release date: April 22nd, 2021
* Tested in WordPress 5.7.1

= 0.2.7 =
Release date: June 28th, 2020
* Tested in WordPress 5.4

= 0.2.6 =
Release date: May 30th, 2019
* Fix: - UI: Button 'Display conditions' disappears on widget save.
Expand Down
Loading