PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 3.9.0
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v3.9.0
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / option-tabs / state.php
widget-options / includes / widgets / option-tabs Last commit date
alignment.php 4 years ago days-dates.php 4 years ago devices.php 9 years ago settings.php 4 years ago state.php 4 years ago styling.php 4 years ago upsell.php 4 years ago visibility.php 3 years ago
state.php
109 lines
1 <?php
2 /**
3 * Roles Widget Options
4 *
5 * @copyright Copyright (c) 2015, Jeffrey Carandang
6 * @since 1.0
7 */
8
9 // Exit if accessed directly
10 if ( ! defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Add Roles Widget Options Tab
14 *
15 * @since 1.0
16 * @return void
17 */
18
19 /**
20 * Called on 'extended_widget_opts_tabs'
21 * create new tab navigation for alignment options
22 */
23 function widgetopts_tab_state( $args ){ ?>
24 <li class="extended-widget-opts-tab-roles">
25 <a href="#extended-widget-opts-tab-<?php echo $args['id'];?>-roles" title="<?php _e( 'Roles', 'widget-options' );?>" ><span class="dashicons dashicons-admin-users"></span> <span class="tabtitle"><?php _e( 'Roles', 'widget-options' );?></span></a>
26 </li>
27 <?php
28 }
29 add_action( 'extended_widget_opts_tabs', 'widgetopts_tab_state' );
30
31 /**
32 * Called on 'extended_widget_opts_tabcontent'
33 * create new tab content options for alignment options
34 */
35 function widgetopts_tabcontent_state( $args ){
36 $roles = get_editable_roles();
37 $state = '';
38 if( isset( $args['params']['roles'][ 'state' ] ) ){
39 $state = $args['params']['roles'][ 'state' ];
40 }
41 ?>
42 <div id="extended-widget-opts-tab-<?php echo $args['id'];?>-roles" class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-roles">
43 <p class="widgetopts-subtitle"><?php _e( 'User Login State', 'widget-options' );?></p>
44 <p>
45 <select class="widefat" name="<?php echo $args['namespace'];?>[extended_widget_opts][roles][state]">
46 <option value=""><?php _e( 'Select Visibility Option', 'widget-options' );?></option>
47 <option value="in" <?php if( $state == 'in' ){ echo 'selected="selected"'; }?> ><?php _e( 'Show only for Logged-in Users', 'widget-options' );?></option>
48 <option value="out" <?php if( $state == 'out' ){ echo 'selected="selected"'; }?>><?php _e( 'Show only for Logged-out Users', 'widget-options' );?></option>
49 </select>
50 </p>
51 <p><small><?php _e( 'Restrict widget visibility for logged-in and logged-out users. ', 'widget-options' );?></small></p>
52
53 <div class="extended-widget-opts-demo-feature">
54 <div class="extended-widget-opts-demo-warning">
55 <p class="widgetopts-unlock-features">
56 <span class="dashicons dashicons-lock"></span><br>
57 Unlock all Features<br>
58 <a href="https://widget-options.com/?utm_source=wordpressadmin&amp;utm_medium=widgettabs&amp;utm_campaign=widgetoptsprotab" class="button-primary" target="_blank">Learn More</a>
59 </p>
60 </div>
61 <p class="widgetopts-subtitle"><?php _e( 'User Roles', 'widget-options' );?></p>
62 <p>
63 <strong><?php _e( 'Hide/Show', 'widget-options' );?></strong>
64 <select class="widefat" readonly>
65 <option value="hide"><?php _e( 'Hide on checked roles', 'widget-options' );?></option>
66 <option value="show"><?php _e( 'Show on checked roles', 'widget-options' );?></option>
67 </select>
68 </p>
69 <div class="extended-widget-opts-inner-roles" style="max-height: 230px;padding: 5px;overflow:auto;">
70 <table class="form-table">
71 <tbody>
72 <tr valign="top">
73 <td scope="row"><strong><?php _e( 'Roles', 'widget-options' );?></strong></td>
74 <td>&nbsp;</td>
75 </tr>
76 <?php foreach ( $roles as $role_name => $role_info ) {
77 if( isset( $args['params'] ) && isset( $args['params']['roles'] ) ){
78 if( isset( $args['params']['roles'][ $role_name ] ) ){
79 $checked = 'checked="checked"';
80 }else{
81 $checked = '';
82 }
83 }else{
84 $checked = '';
85 }
86 ?>
87 <tr valign="top">
88 <td scope="row"><label for="extended_widget_opts-<?php echo $args['id'];?>-role-<?php echo $role_name;?>"><?php echo $role_info['name'];?></label></td>
89 <td>
90 <input type="checkbox" value="1" readonly />
91 </td>
92 </tr>
93 <?php } ?>
94 <tr valign="top">
95 <td scope="row"><?php _e( 'Guests', 'widget-options' );?></td>
96 <td>
97 <input type="checkbox" value="1" readonly />
98 </td>
99 </tr>
100 </tbody>
101 </table>
102 </div>
103 <p><small><?php _e( 'Restrict widget visibility per user roles.', 'widget-options' );?></small></p>
104 </div>
105 </div>
106 <?php
107 }
108 add_action( 'extended_widget_opts_tabcontent', 'widgetopts_tabcontent_state'); ?>
109