Plugin Directory

Changeset 3308806


Ignore:
Timestamp:
06/10/2025 12:47:39 AM (10 months ago)
Author:
MarkODonnell
Message:

Committing 1.5.2 for WP Plugin Team Review.

Location:
coaching-staffs/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • coaching-staffs/trunk/includes/mstw-coaching-staffs-admin.php

    r3290731 r3308806  
    114114        if( $typenow == 'staff_position' ) {
    115115           
    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) {
    123140               
    124                 //output the html for the drop down menu
    125                 ?><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                     <?php
    128                     //output each select option line
    129                     foreach ($terms as $term) {
    130                         //check against the last $_GET to show the current selection
    131                         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                         <?php           
    141                     }
    142141                ?></select><?php
    143             }   
    144         }
    145    
    146 } //End: mstw_cs_restrict_positions_by_staff
     142                   
     143        } //End: if( $typenow == 'staff_position' ) {
     144       
     145    } //End: mstw_cs_restrict_positions_by_staff
    147146   
    148147 //-----------------------------------------------------------------
  • coaching-staffs/trunk/mstw-coaching-staffs.php

    r3304098 r3308806  
    44 * Plugin URI:  http://shoalsummitsolutions.com
    55 * 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.1
     6 * Version:     1.5.2
    77 * Requires at least: 5.2
    88 * Requires PHP: 7.2
     
    185185            if ( '' == $uri_array ) {
    186186                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 );
    188189                return;
    189190            }
     
    364365            //'exclude_from_search' => false,
    365366            //'show_ui'             => true,
    366             'show_in_menu'          => 'mstw-cs-main-menu', //=> true, 
     367            'show_in_menu'          => 'mstw-cs-main-menu', //=> true,
    367368            //'menu_position'       => null,
    368369            //'menu_icon'           => null,
     
    434435    $single_template = null;
    435436
    436     if ( $post->post_type == 'coach') { 
     437    if ( $post->post_type == 'coach') {
    437438        $custom_coach_template = get_stylesheet_directory( ) . '/single-coach.php';
    438439        $plugin_coach_template = dirname( __FILE__ ) . '/theme-templates/single-coach.php';
     
    487488
    488489function mstw_cs_shortcode_handler( $atts ){
     490    //mstw_log_msg( 'mstw_cs_shortcode_handler:' );
     491   
    489492    // get the options set in the admin screen
    490493    $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
    495495    // and merge them with the defaults
    496496    $args = wp_parse_args( $options, mstw_cs_get_defaults( ) );
    497     //$output .= '<pre>ARGS:' . print_r( $args, true ) . '</pre>';
    498497   
    499498    // then merge the parameters passed to the shortcode with the result                                   
    500499    $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' );
    508502   
    509503    return $mstw_cs_staff_table;
     
    515509// Loops through the Staff Positions Custom posts in the "staff" category and formats them
    516510// 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// --------------------------------------------------------------------------------------
     516function mstw_cs_build_staff_table( $attribs ) {
     517    //mstw_log_msg( 'mstw_cs_build_staff_table:' );
    519518   
    520519    extract( $attribs );
    521520   
    522521    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>';
    524523        return $output;
    525524    }
    526525   
    527526    $output = "";
    528    
    529     // Settings from the admin page
    530     //$options = get_option( 'mstw_cs_options' );
    531     //extract( $options );
    532527   
    533528    // Show the table title = Name of Staff
    534529    if ( $show_title ) {
    535530        $term_array = get_term_by( 'slug', $staff, 'staffs' );
    536         //mstw_log_msg( $staff );
    537         //mstw_log_msg( $term_array );
     531       
    538532        $staff_name = $term_array->name;
    539533       
    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>';
    543537    }
    544538   
    545539    // Get the staff roster     
    546540    $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                                                    ));                     
    553547   
    554548   if( $posts ) {
     
    556550        // Start with the table header
    557551
    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 ) . '">';
    560554       
    561555        // leave this open and check on styles from the admin settings
     
    748742    else { // No posts were found
    749743    /* 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>';
    751745       
    752746    }
  • coaching-staffs/trunk/readme.txt

    r3304098 r3308806  
    55Requires at least: 5.2
    66Tested up to: 6.8
    7 Stable tag: 1.5.1
     7Stable tag: 1.5.2
    88Requires PHP: 7.2
    99License: GPLv2 or later
     
    7676== Changelog ==
    7777
    78 = 1.5 +
     78= 1.5.2 =
     79* Cleanup to fix issues in PCP check and WP Plugins Team
     80
     81= 1.5 =
    7982* Tested on PHP 8.2.23
    8083* A little minor code clean up. No function changes.
  • coaching-staffs/trunk/theme-templates/single-coach.php

    r3290731 r3308806  
    2525 ?>
    2626    <?php   //Validate the nonce
    27     //$nonce = mstw_safe_get( 'mstw-cs-nonce', $_GET, '' );
    2827    if ( isset( $_GET['mstw-cs-nonce'] ) ) {
    29         //$safeNonce = mstw_safe_get( 'mstw-cs-nonce', $_GET, '' );
    3028        if ( false == wp_verify_nonce(  sanitize_text_field( wp_unslash( $_GET[ 'mstw-cs-nonce' ] ) ), 'single-coach' ) ) {
    3129            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' ) );
    3331        }
    3432    } else {
    3533        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' ) );
    3735    }
    38 
    39        
    4036    ?>
    4137       
    42     <?php get_header();
    43     //mstw_log_msg( "starting single-coach: current post ID = " . $post->ID ); ?>
    44 
     38    <?php get_header(); ?>
     39   
    4540    <div id="primary">
    4641        <div id="content" role="main">
     
    5954                if ( $position_post ) {
    6055                    $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' );
    6957                   
    7058                } else {
     
    10694                ?>
    10795       
    108                 <div class="coach-header <?php echo esc_url( $header_class ) ?>">
     96                <div class="coach-header <?php echo esc_html( $header_class ) ?>">
    10997                    <!-- First, figure out the coach's photo -->
    11098                    <div id = "coach-photo">
Note: See TracChangeset for help on using the changeset viewer.