Changeset 3166088
- Timestamp:
- 10/09/2024 06:14:25 PM (18 months ago)
- Location:
- wayfinder/trunk
- Files:
-
- 2 edited
-
index.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wayfinder/trunk/index.php
r2824652 r3166088 4 4 * Plugin URI: https://wordpress.org/plugins/wayfinder 5 5 * Description: Easily select and identify nested blocks in the editor. 6 * Version: 1.1. 66 * Version: 1.1.7 7 7 * Author: THE MOLITOR 8 8 * Author URI: https://themolitor.com 9 9 * Text Domain: wayfinder 10 * License: GPL-2.0+ 11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 10 12 */ 11 13 12 $wayfinder_version = '1.1. 6';14 $wayfinder_version = '1.1.7'; 13 15 14 16 … … 189 191 //TYPE 190 192 '<tr>'. 191 '<th><label for="userblocktype">' .__('Block type','wayfinder').'</label></th>'.193 '<th><label for="userblocktype">' . esc_html__('Block type', 'wayfinder') . '</label></th>'. 192 194 193 195 '<td>'. 194 196 '<select type="text" name="userblocktype" id="userblocktype">';?> 195 <option value="site-default" <?php if($user_block_type == 'site-default' || !$user_block_type){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option>196 <option value="show" <?php if($user_block_type == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option>197 <option value="hide" <?php if($user_block_type == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option>197 <option value="site-default" <?php echo ($user_block_type == 'site-default' || !$user_block_type) ? esc_attr($selected_option) : ''; ?>><?php esc_html_e('Site Default', 'wayfinder'); ?></option> 198 <option value="show" <?php echo ($user_block_type == 'show') ? esc_attr($selected_option) : ''; ?>><?php esc_html_e('Show', 'wayfinder'); ?></option> 199 <option value="hide" <?php echo ($user_block_type == 'hide') ? esc_attr($selected_option) : ''; ?>><?php esc_html_e('Hide', 'wayfinder'); ?></option> 198 200 <?php echo '</select>'. 199 201 '</td>'. … … 202 204 //CLASSES 203 205 '<tr>'. 204 '<th><label for="userblockclasses">'.__('Block classes','wayfinder').'</label></th>'. 205 206 '<th><label for="userblockclasses">' . esc_html__('Block classes', 'wayfinder') . '</label></th>'. 206 207 '<td>'. 207 '<select type="text" name="userblockclasses" id="userblockclasses">';?> 208 <option value="site-default" <?php if($user_block_classes == 'site-default' || !$user_block_classes){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option> 209 <option value="show" <?php if($user_block_classes == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option> 210 <option value="hide" <?php if($user_block_classes == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option> 211 <?php echo '</select>'. 208 '<select type="text" name="userblockclasses" id="userblockclasses">'; 209 ?> 210 <option value="site-default" <?php selected($user_block_classes, 'site-default'); selected($user_block_classes, ''); ?>><?php esc_html_e('Site Default', 'wayfinder'); ?></option> 211 <option value="show" <?php selected($user_block_classes, 'show'); ?>><?php esc_html_e('Show', 'wayfinder'); ?></option> 212 <option value="hide" <?php selected($user_block_classes, 'hide'); ?>><?php esc_html_e('Hide', 'wayfinder'); ?></option> 213 <?php 214 echo '</select>'. 212 215 '</td>'. 213 216 '</tr>'. 214 217 215 218 //OUTLINE 216 '<tr>'. 217 '<th><label for="userblockoutline">'.__('Block outline','wayfinder').'</label></th>'. 218 219 '<tr>'. 220 '<th><label for="userblockoutline">' . esc_html__('Block outline', 'wayfinder') . '</label></th>'. 219 221 '<td>'. 220 '<select type="text" name="userblockoutline" id="userblockoutline">';?> 221 <option value="site-default" <?php if($user_block_outline == 'site-default' || !$user_block_outline){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option> 222 <option value="show" <?php if($user_block_outline == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option> 223 <option value="hide" <?php if($user_block_outline == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option> 224 <?php echo '</select>'. 222 '<select type="text" name="userblockoutline" id="userblockoutline">'; 223 ?> 224 <option value="site-default" <?php selected($user_block_outline, 'site-default'); selected($user_block_outline, ''); ?>><?php esc_html_e('Site Default', 'wayfinder'); ?></option> 225 <option value="show" <?php selected($user_block_outline, 'show'); ?>><?php esc_html_e('Show', 'wayfinder'); ?></option> 226 <option value="hide" <?php selected($user_block_outline, 'hide'); ?>><?php esc_html_e('Hide', 'wayfinder'); ?></option> 227 <?php 228 echo '</select>'. 225 229 '</td>'. 226 230 '</tr>'. … … 228 232 //SPACER OUTLINE 229 233 '<tr>'. 230 '<th><label for="userspaceroutline">'.__('Spacer outline','wayfinder').'</label></th>'. 231 234 '<th><label for="userspaceroutline">' . esc_html__('Spacer outline', 'wayfinder') . '</label></th>'. 232 235 '<td>'. 233 '<select type="text" name="userspaceroutline" id="userspaceroutline">';?> 234 <option value="site-default" <?php if($user_spacer_outline == 'site-default' || !$user_spacer_outline){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option> 235 <option value="show" <?php if($user_spacer_outline == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option> 236 <option value="hide" <?php if($user_spacer_outline == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option> 237 <?php echo '</select>'. 236 '<select type="text" name="userspaceroutline" id="userspaceroutline">'; 237 ?> 238 <option value="site-default" <?php selected($user_spacer_outline, 'site-default'); selected($user_spacer_outline, ''); ?>><?php esc_html_e('Site Default', 'wayfinder'); ?></option> 239 <option value="show" <?php selected($user_spacer_outline, 'show'); ?>><?php esc_html_e('Show', 'wayfinder'); ?></option> 240 <option value="hide" <?php selected($user_spacer_outline, 'hide'); ?>><?php esc_html_e('Hide', 'wayfinder'); ?></option> 241 <?php 242 echo '</select>'. 238 243 '</td>'. 239 244 '</tr>'. … … 246 251 add_action( 'edit_user_profile_update', 'wayfinder_save_profile_fields' ); 247 252 253 248 254 function wayfinder_save_profile_fields( $user_id ) { 249 250 if ( !current_user_can( 'edit_user', $user_id ) ) 251 return false; 252 253 //SANITIZE userblocktype 254 if ( isset( $_POST['userblocktype'])){ 255 256 $userblocktype = sanitize_text_field( $_POST['userblocktype'] ); 257 258 update_user_meta( $user_id, 'userblocktype', $userblocktype ); 259 } 260 //SANITIZE userblockclasses 261 if ( isset( $_POST['userblockclasses'])){ 262 263 $userblockclasses = sanitize_text_field( $_POST['userblockclasses'] ); 264 265 update_user_meta( $user_id, 'userblockclasses', $userblockclasses ); 266 } 267 //SANITIZE userblockoutline 268 if ( isset( $_POST['userblockoutline'])){ 269 270 $userblockoutline = sanitize_text_field( $_POST['userblockoutline'] ); 271 272 update_user_meta( $user_id, 'userblockoutline', $userblockoutline ); 273 } 274 //SANITIZE userspaceroutline 275 if ( isset( $_POST['userspaceroutline'])){ 276 277 $userspaceroutline = sanitize_text_field( $_POST['userspaceroutline'] ); 278 279 update_user_meta( $user_id, 'userspaceroutline', $userspaceroutline ); 280 } 281 } 255 if ( !current_user_can( 'edit_user', $user_id ) ) { 256 return false; 257 } 258 259 // Verify nonce 260 if ( !isset( $_POST['wayfinder_profile_nonce'] ) || !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wayfinder_profile_nonce'] ) ), 'wayfinder_profile_update' ) ) { 261 return false; 262 } 263 264 $fields = ['userblocktype', 'userblockclasses', 'userblockoutline', 'userspaceroutline']; 265 266 foreach ( $fields as $field ) { 267 if ( isset( $_POST[$field] ) ) { 268 $value = sanitize_text_field( wp_unslash( $_POST[$field] ) ); 269 update_user_meta( $user_id, $field, $value ); 270 } 271 } 272 } 273 274 //CREATE NONCE FIELD 275 function wayfinder_add_profile_nonce_field() { 276 wp_nonce_field( 'wayfinder_profile_update', 'wayfinder_profile_nonce' ); 277 } 278 add_action( 'show_user_profile', 'wayfinder_add_profile_nonce_field' ); 279 add_action( 'edit_user_profile', 'wayfinder_add_profile_nonce_field' ); 282 280 283 281 -
wayfinder/trunk/readme.txt
r2824652 r3166088 3 3 Tags: block, finder, helper, identifier, selector 4 4 Requires at least: 4.7 5 Tested up to: 6. 16 Stable tag: 1.1. 65 Tested up to: 6.6 6 Stable tag: 1.1.7 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later
Note: See TracChangeset
for help on using the changeset viewer.