Plugin Directory

Changeset 3242201


Ignore:
Timestamp:
02/17/2025 10:39:30 PM (14 months ago)
Author:
wiredimpact
Message:
  • Fixed bug where pagination doesn't work when listing volunteer opportunities on a static front page.
  • Fixed Cross Site Scripting (XSS) vulnerability when outputting custom CSS classes.
Location:
wired-impact-volunteer-management/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • wired-impact-volunteer-management/trunk/README.txt

    r3201881 r3242201  
    55Tested up to: 6.7
    66Requires PHP: 5.2.4
    7 Stable tag: 2.5
     7Stable tag: 2.5.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    127127== Changelog ==
    128128
     129= 2.5.1 =
     130* Fixed bug where pagination doesn't work when listing volunteer opportunities on a static front page.
     131* Fixed Cross Site Scripting (XSS) vulnerability when outputting custom CSS classes.
     132
    129133= 2.5 =
    130134* Fixed issues where some strings didn't allow for translation.
  • wired-impact-volunteer-management/trunk/cypress/support/commands.js

    r3201881 r3242201  
    130130 */
    131131Cypress.Commands.add('getBlockEditorIFrameBody', () => {
    132    
    133     cy.log('getBlockEditorIFrameBody');
     132
     133    cy.log('getBlockEditorIFrameBody');
    134134
    135135    return cy
  • wired-impact-volunteer-management/trunk/frontend/class-public.php

    r3011449 r3242201  
    228228     */
    229229    public function display_one_time_volunteer_opps( $attributes ) {
    230         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
     230
     231        $paged = $this->get_current_page_number();
    231232        $args  = array(
    232             'post_type' => 'volunteer_opp',
    233             'meta_key' => '_start_date_time',
    234             'orderby' => 'meta_value_num',
    235             'order'   => 'ASC',
    236             'meta_query' => array(
    237                 array( //Only if one-time opp is true
     233            'paged'      => $paged,
     234            'post_type'  => 'volunteer_opp',
     235            'orderby'    => 'meta_value_num',
     236            'order'      => 'ASC',
     237            'meta_key'   => '_start_date_time',
     238            'meta_query' => array(
     239                array( // Only if one-time opp is true.
    238240                    'key'     => '_one_time_opp',
    239                     'value'   => 1, 
     241                    'value'   => 1,
    240242                    'compare' => '==',
    241243                ),
    242                 array( //Only if event is in the future
     244                array( // Only if event is in the future.
    243245                    'key'     => '_start_date_time',
    244                     'value'   => current_time( 'timestamp' ), 
     246                    'value'   => current_time( 'timestamp' ),
    245247                    'compare' => '>=',
    246248                ),
    247                 'relation' => 'AND'
     249                'relation' => 'AND',
    248250            ),
    249             'paged' => $paged
    250251        );
    251252
     
    259260     */
    260261    public function display_flexible_volunteer_opps( $attributes ) {
    261         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    262         $args = array(
    263             'post_type' => 'volunteer_opp',
    264             'meta_query' => array(
    265                 array( //Only if one-time opp is not true
     262
     263        $paged = $this->get_current_page_number();
     264        $args  = array(
     265            'paged'      => $paged,
     266            'post_type'  => 'volunteer_opp',
     267            'meta_query' => array(
     268                array( // Only if one-time opp is not true.
    266269                    'key'     => '_one_time_opp',
    267                     'value'   => 1, 
     270                    'value'   => 1,
    268271                    'compare' => '!=',
    269272                ),
    270273            ),
    271             'paged' => $paged
    272274        );
    273275
     
    275277    }
    276278
     279    /**
     280     * Get the current page number when listing volunteer opportunities.
     281     *
     282     * The query var is almost always "paged", but for static front pages
     283     * it's "page". If neither of those are set, then default to 1.
     284     *
     285     * @return int The current page number.
     286     */
     287    private function get_current_page_number() {
     288
     289        $paged = absint( get_query_var( 'paged' ) );
     290
     291        if ( $paged > 0 ) {
     292
     293            return $paged;
     294        }
     295
     296        $paged = absint( get_query_var( 'page' ) );
     297
     298        if ( $paged > 0 ) {
     299
     300            return $paged;
     301        }
     302
     303        return 1;
     304    }
    277305
    278306    /**
     
    344372         * as a shortcode parameter, include it in the container class name.
    345373         */
    346         $class_name = ( empty( $attributes['className'] ) ) ? $list_type : $list_type . ' ' . sanitize_text_field( $attributes['className'] );
     374        $class_name = ( empty( $attributes['className'] ) ) ? $list_type : $list_type . ' ' . $attributes['className'];
    347375
    348376        /**
     
    350378         * as a shortcode parameter, use it for the list's container ID.
    351379         */
    352         $anchor = ( empty( $attributes['anchor'] ) ) ? '' : 'id="' . sanitize_html_class( $attributes['anchor'] ) . '"';
     380        $anchor = ( empty( $attributes['anchor'] ) ) ? '' : ' id="' . esc_attr( $attributes['anchor'] ) . '"';
    353381        ?>
    354382
    355         <div class="volunteer-opps <?php echo $class_name; ?>"<?php echo $anchor; ?>>
     383        <div class="volunteer-opps <?php echo esc_attr( $class_name ); ?>"<?php echo $anchor; ?>>
    356384
    357385            <?php
     
    386414    /**
    387415     * Get the page navigation when displaying a list of volunteer opportunities.
    388      *
    389      * We provide a filter so custom navigation can be utilized in place of the
     416     *
     417     * We overwrite the global $paged variable to set the page number since
     418     * previous_posts_link() and next_posts_link() don't work correctly
     419     * on static front pages. See our get_current_page_number() method
     420     * for more information.
     421     *
     422     * We provide a filter so custom navigation can be utilized in place of the
    390423     * default WordPress functionality.
    391424     *
    392425     * @return string The HTML for the page navigation.
    393426     */
    394     public function get_page_navigation(){
    395 
    396         ob_start(); ?>
     427    public function get_page_navigation() {
     428
     429        global $paged;
     430        $original_paged = $paged;
     431        $paged          = $this->get_current_page_number();
     432
     433        ob_start();
     434        ?>
    397435
    398436        <div class="navigation volunteer-opps-navigation">
     
    401439        </div>
    402440
    403         <?php
     441        <?php
     442        $paged = $original_paged;
     443
    404444        return apply_filters( 'wivm_page_navigation', ob_get_clean() );
    405445    }
  • wired-impact-volunteer-management/trunk/includes/class-wi-volunteer-management.php

    r3201881 r3242201  
    6969
    7070        $this->plugin_name = 'wired-impact-volunteer-management';
    71         $this->version     = '2.5';
     71        $this->version     = '2.5.1';
    7272
    7373        $this->load_dependencies();
  • wired-impact-volunteer-management/trunk/languages/wired-impact-volunteer-management.pot

    r3201881 r3242201  
    1 # Copyright (C) 2024 Wired Impact
     1# Copyright (C) 2025 Wired Impact
    22# This file is distributed under the GPL-2.0+.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Wired Impact Volunteer Management 2.5\n"
     5"Project-Id-Version: Wired Impact Volunteer Management 2.5.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wired-impact-volunteer-management\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-12-03T17:32:13+00:00\n"
     12"POT-Creation-Date: 2025-02-17T22:22:27+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.9.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: wired-impact-volunteer-management\n"
    1616
    1717#. Plugin Name of the plugin
     18#: wivm.php
    1819#: admin/class-admin.php:270
    1920msgid "Wired Impact Volunteer Management"
     
    2122
    2223#. Plugin URI of the plugin
     24#: wivm.php
    2325msgid "https://wiredimpact.com/wordpress-plugins-for-nonprofits/volunteer-management/"
    2426msgstr ""
    2527
    2628#. Description of the plugin
     29#: wivm.php
    2730msgid "A simple, free way to keep track of your nonprofit’s volunteers and opportunities."
    2831msgstr ""
    2932
    3033#. Author of the plugin
     34#: wivm.php
    3135msgid "Wired Impact"
    3236msgstr ""
    3337
    3438#. Author URI of the plugin
     39#: wivm.php
    3540msgid "https://wiredimpact.com"
    3641msgstr ""
     
    309314#: admin/class-admin.php:1144
    310315#: admin/class-admin.php:1278
    311 #: frontend/class-public.php:478
    312 #: frontend/class-public.php:485
     316#: frontend/class-public.php:518
     317#: frontend/class-public.php:525
    313318msgid "Security Check."
    314319msgstr ""
     
    751756msgstr ""
    752757
    753 #: frontend/class-public.php:292
     758#: frontend/class-public.php:320
    754759msgid "Find Out More"
    755760msgstr ""
    756761
    757 #: frontend/class-public.php:369
     762#: frontend/class-public.php:397
    758763msgid "Sorry, there are no volunteer opportunities available right now."
    759764msgstr ""
    760765
    761 #: frontend/class-public.php:399
     766#: frontend/class-public.php:437
    762767msgid "&laquo; Previous Opportunities"
    763768msgstr ""
    764769
    765 #: frontend/class-public.php:400
     770#: frontend/class-public.php:438
    766771msgid "More Opportunities &raquo;"
    767772msgstr ""
  • wired-impact-volunteer-management/trunk/wivm.php

    r3201881 r3242201  
    1717 * Plugin URI:        https://wiredimpact.com/wordpress-plugins-for-nonprofits/volunteer-management/
    1818 * Description:       A simple, free way to keep track of your nonprofit’s volunteers and opportunities.
    19  * Version:           2.5
     19 * Version:           2.5.1
    2020 * Author:            Wired Impact
    2121 * Author URI:        https://wiredimpact.com
Note: See TracChangeset for help on using the changeset viewer.