Changeset 3308806
- Timestamp:
- 06/10/2025 12:47:39 AM (10 months ago)
- Location:
- coaching-staffs/trunk
- Files:
-
- 4 edited
-
includes/mstw-coaching-staffs-admin.php (modified) (1 diff)
-
mstw-coaching-staffs.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
-
theme-templates/single-coach.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coaching-staffs/trunk/includes/mstw-coaching-staffs-admin.php
r3290731 r3308806 114 114 if( $typenow == 'staff_position' ) { 115 115 116 $taxonomy_slugs = array( 'staffs' ); 117 118 foreach ( $taxonomy_slugs as $tax_slug ) { 119 //retrieve the taxonomy object for the tax_slug 120 $tax_obj = get_taxonomy( $tax_slug ); 121 $tax_name = $tax_obj->labels->name; 122 $terms = get_terms( $tax_slug ); 116 $tax_slug = 'staffs'; 117 118 //retrieve the taxonomy object for the tax_slug 119 $tax_obj = get_taxonomy( $tax_slug ); 120 $tax_name = $tax_obj->labels->name; 121 $terms = get_terms( $tax_slug ); 122 123 //output the html for the drop down menu 124 ?><select name='<?php echo esc_html( $tax_slug )?>' id='<?php echo esc_html( $tax_slug )?>' class='postform'> 125 <option value=''><?php esc_html_e( 'Show All Staffs', 'coaching-staffs')?></option> 126 <?php 127 //output each select option line 128 foreach ($terms as $term) { 129 //check against the last $_GET to show the current selection 130 if ( array_key_exists( $tax_slug, $_GET ) ) { 131 $selected = ( $_GET[$tax_slug] == $term->slug ) ? ' selected' : ''; 132 } else { 133 $selected = ''; 134 } 135 136 ?> 137 <option value='<?php echo esc_html( $term->slug )?>' <?php echo esc_html( $selected )?>> <?php echo esc_html( $term->name . '(' . $term->count . ')' ) ?> </option> 138 <?php 139 } //End: foreach ($terms as $term) { 123 140 124 //output the html for the drop down menu125 ?><select name='<?php echo esc_html( $tax_slug )?>' id='<?php echo esc_html( $tax_slug )?>' class='postform'>126 <option value=''><?php esc_html_e( 'Show All Staffs', 'coaching-staffs')?></option>127 <?php128 //output each select option line129 foreach ($terms as $term) {130 //check against the last $_GET to show the current selection131 if ( array_key_exists( $tax_slug, $_GET ) ) {132 $selected = ( $_GET[$tax_slug] == $term->slug ) ? ' selected' : '';133 }134 else {135 $selected = '';136 }137 138 ?>139 <option value='<?php echo esc_html( $term->slug )?>' <?php echo esc_html( $selected )?>> <?php echo esc_html( $term->name . '(' . $term->count . ')' ) ?> </option>140 <?php141 }142 141 ?></select><?php 143 }144 } 145 146 } //End: mstw_cs_restrict_positions_by_staff142 143 } //End: if( $typenow == 'staff_position' ) { 144 145 } //End: mstw_cs_restrict_positions_by_staff 147 146 148 147 //----------------------------------------------------------------- -
coaching-staffs/trunk/mstw-coaching-staffs.php
r3304098 r3308806 4 4 * Plugin URI: http://shoalsummitsolutions.com 5 5 * Description: Manage and display coaching staffs. Front end displays include coaching staff tables, a coaching staff galleries, and single coach profiles. 6 * Version: 1.5. 16 * Version: 1.5.2 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 185 185 if ( '' == $uri_array ) { 186 186 mstw_log_msg( 'mstw_cs_get_posts: error with $_SERVER[REQUEST_URI]' ); 187 mstw_log_msg ( 'query received:' ); mstw_log_msg( $query ); 187 mstw_log_msg ( 'query received:' ); 188 mstw_log_msg( $query ); 188 189 return; 189 190 } … … 364 365 //'exclude_from_search' => false, 365 366 //'show_ui' => true, 366 'show_in_menu' => 'mstw-cs-main-menu', //=> true, 367 'show_in_menu' => 'mstw-cs-main-menu', //=> true, 367 368 //'menu_position' => null, 368 369 //'menu_icon' => null, … … 434 435 $single_template = null; 435 436 436 if ( $post->post_type == 'coach') { 437 if ( $post->post_type == 'coach') { 437 438 $custom_coach_template = get_stylesheet_directory( ) . '/single-coach.php'; 438 439 $plugin_coach_template = dirname( __FILE__ ) . '/theme-templates/single-coach.php'; … … 487 488 488 489 function mstw_cs_shortcode_handler( $atts ){ 490 //mstw_log_msg( 'mstw_cs_shortcode_handler:' ); 491 489 492 // get the options set in the admin screen 490 493 $options = get_option( 'mstw_cs_options' ); 491 //mstw_log_msg( 'in mstw_cs_shortcode_handler ...' ); 492 //mstw_log_msg( '$options:' ); 493 //mstw_log_msg( $options ); 494 494 495 495 // and merge them with the defaults 496 496 $args = wp_parse_args( $options, mstw_cs_get_defaults( ) ); 497 //$output .= '<pre>ARGS:' . print_r( $args, true ) . '</pre>';498 497 499 498 // then merge the parameters passed to the shortcode with the result 500 499 $attribs = shortcode_atts( $args, $atts ); 501 //$output .= '<pre>ATTS:' . print_r( $atts, true ) . '</pre>'; 502 //$output .= '<pre>ATTRIBS:' . print_r( $attribs, true ) . '</pre>'; 503 504 $mstw_cs_staff_table = mstw_cs_build_staff_table( $attribs ); 505 //$mstw_cs_staff_table = mstw_cs_build_staff_table( $atts ); 506 507 //return $output; 500 501 $mstw_cs_staff_table = wp_kses( mstw_cs_build_staff_table( $attribs ), 'post' ); 508 502 509 503 return $mstw_cs_staff_table; … … 515 509 // Loops through the Staff Positions Custom posts in the "staff" category and formats them 516 510 // into a pretty table. 517 // -------------------------------------------------------------------------------------- 518 function mstw_cs_build_staff_table( $attribs ) { 511 // 512 // NOTE: for the most part, output is not escaped in this function because it is 513 // escaped late by wp_kses() in the mstw_cs_shortcode_handler() function above. 514 // 515 // -------------------------------------------------------------------------------------- 516 function mstw_cs_build_staff_table( $attribs ) { 517 //mstw_log_msg( 'mstw_cs_build_staff_table:' ); 519 518 520 519 extract( $attribs ); 521 520 522 521 if ( !isset( $staff ) or $staff == '' ) { 523 $output = '<h3>' . __( 'No Staff Specified', 'coaching-staffs' ) . '</h3>';522 $output = '<h3>' . esc_html__( 'No Staff Specified', 'coaching-staffs' ) . '</h3>'; 524 523 return $output; 525 524 } 526 525 527 526 $output = ""; 528 529 // Settings from the admin page530 //$options = get_option( 'mstw_cs_options' );531 //extract( $options );532 527 533 528 // Show the table title = Name of Staff 534 529 if ( $show_title ) { 535 530 $term_array = get_term_by( 'slug', $staff, 'staffs' ); 536 //mstw_log_msg( $staff ); 537 //mstw_log_msg( $term_array ); 531 538 532 $staff_name = $term_array->name; 539 533 540 $staff_class = 'staff-head-title staff-head-title-' . $staff;541 542 $output .= '<h1 class="' . $staff_class . '">' . $staff_name. '</h1>';534 $staff_class = 'staff-head-title staff-head-title-' . esc_html( $staff ); 535 536 $output .= '<h1 class="' . esc_html( $staff_class ) . '">' . esc_html( $staff_name ) . '</h1>'; 543 537 } 544 538 545 539 // Get the staff roster 546 540 $posts = get_posts(array( 'numberposts' => -1, 547 'post_type'=> 'staff_position',548 'staffs'=> $staff,549 'orderby'=> 'meta_value_num',550 'meta_key'=> 'mstw_cs_display_order',551 'order'=> 'ASC'552 ));541 'post_type' => 'staff_position', 542 'staffs' => $staff, 543 'orderby' => 'meta_value_num', 544 'meta_key' => 'mstw_cs_display_order', 545 'order' => 'ASC' 546 )); 553 547 554 548 if( $posts ) { … … 556 550 // Start with the table header 557 551 558 $staff_class = 'mstw-cs-table-' . $staff;559 $output .= '<table class="mstw-cs-table ' . $staff_class. '">';552 $staff_class = 'mstw-cs-table-' . esc_html( $staff ); 553 $output .= '<table class="mstw-cs-table ' . esc_html( $staff_class ) . '">'; 560 554 561 555 // leave this open and check on styles from the admin settings … … 748 742 else { // No posts were found 749 743 /* translators: %s is the staff name */ 750 $output = $output . '<h3>' . sprintf( __( 'Sorry, No coaches found for staff: %s', 'coaching-staffs' ), $staff) . '</h3>';744 $output = $output . '<h3>' . sprintf( esc_html__( 'Sorry, No coaches found for staff: %s', 'coaching-staffs' ), esc_html( $staff ) ) . '</h3>'; 751 745 752 746 } -
coaching-staffs/trunk/readme.txt
r3304098 r3308806 5 5 Requires at least: 5.2 6 6 Tested up to: 6.8 7 Stable tag: 1.5. 17 Stable tag: 1.5.2 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 76 76 == Changelog == 77 77 78 = 1.5 + 78 = 1.5.2 = 79 * Cleanup to fix issues in PCP check and WP Plugins Team 80 81 = 1.5 = 79 82 * Tested on PHP 8.2.23 80 83 * A little minor code clean up. No function changes. -
coaching-staffs/trunk/theme-templates/single-coach.php
r3290731 r3308806 25 25 ?> 26 26 <?php //Validate the nonce 27 //$nonce = mstw_safe_get( 'mstw-cs-nonce', $_GET, '' );28 27 if ( isset( $_GET['mstw-cs-nonce'] ) ) { 29 //$safeNonce = mstw_safe_get( 'mstw-cs-nonce', $_GET, '' );30 28 if ( false == wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET[ 'mstw-cs-nonce' ] ) ), 'single-coach' ) ) { 31 29 mstw_log_msg( "single-coach: invalid nonce" ); 32 die( __('fatal error encountered in single_coach', 'coaching-staffs' ) );30 die( esc_html__('fatal error encountered in single_coach', 'coaching-staffs' ) ); 33 31 } 34 32 } else { 35 33 mstw_log_msg( "single-coach: nonce not found" ); 36 die( __('fatal error encountered in single_coach', 'coaching-staffs' ) );34 die( esc_html__('fatal error encountered in single_coach', 'coaching-staffs' ) ); 37 35 } 38 39 40 36 ?> 41 37 42 <?php get_header(); 43 //mstw_log_msg( "starting single-coach: current post ID = " . $post->ID ); ?> 44 38 <?php get_header(); ?> 39 45 40 <div id="primary"> 46 41 <div id="content" role="main"> … … 59 54 if ( $position_post ) { 60 55 $position = get_the_title( $position_post ); 61 //$position = mstw_safe_get( 'position', $_GET, '' ); 62 63 if ('' != $position ) { 64 $term_list = wp_get_post_terms( $position, 'staffs' ); 65 } 66 else { 67 $term_list = null; 68 } 56 $term_list = wp_get_post_terms( $position_post, 'staffs' ); 69 57 70 58 } else { … … 106 94 ?> 107 95 108 <div class="coach-header <?php echo esc_ url( $header_class ) ?>">96 <div class="coach-header <?php echo esc_html( $header_class ) ?>"> 109 97 <!-- First, figure out the coach's photo --> 110 98 <div id = "coach-photo">
Note: See TracChangeset
for help on using the changeset viewer.