Plugin Directory

Changeset 3209430


Ignore:
Timestamp:
12/17/2024 06:43:48 PM (13 months ago)
Author:
arothman
Message:

Additional output escaping added to RSS download function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pcrecruiter-extensions/trunk/PCRecruiter-Extensions.php

    r3209389 r3209430  
    1919}
    2020add_action( 'wp_enqueue_scripts', 'pcr_assets' );
     21function sanitize_loadurl($urlparam)
     22        {
     23            // Allow only letters, numbers, periods, equals, colons, question marks, forward slashes, percent signs, and spaces
     24            return preg_replace('/[^a-zA-Z0-9\.\=\:\?\/%\s]/', '', $urlparam);
     25           
     26        }
    2127function pcr_frame($atts)
    2228{
     
    3036    $sid = intval($a['form']);
    3137    $loadurl = $a['link'];
    32     function sanitize_loadurl($urlparam)
    33         {
    34             // Allow only letters, numbers, periods, equals, colons, question marks, forward slashes, percent signs, and spaces
    35             return preg_replace('/[^a-zA-Z0-9\.\=\:\?\/%\s]/', '', $urlparam);
    36            
    37         }
    3838    $loadurl = sanitize_loadurl($loadurl);
    3939    $initialheight = intval($a['initialheight']);
     
    8484    $doc->appendChild($iframe);
    8585
    86     return "<!-- Start PCRecruiter WP 1.4.2-->"
     86    return "<!-- Start PCRecruiter WP 1.4.21-->"
    8787        . $pcrframecss
    8888        . $doc->saveHTML()
     
    462462    public function print_section_info()
    463463    {
    464         echo '<p>When enabled, this feature will duplicate PCRecruiter\'s dynamic RSS feed as a static file at <a target="_blank" href="'. site_url() .'/wp-content/uploads/pcrjobfeed.xml">'. site_url() .'/wp-content/uploads/pcrjobfeed.xml</a>. You may use this data as a source for plugins and other third-party feed utilities.</p><p><strong>The settings in this panel are NOT required for standard PCRecruiter Job Board embedding functions.</strong> Checking the "Job Feed Enabled" box below without proper values in the rest of this form may introduce errors into your website. Please <a target="_blank" href="https://help.pcrecruiter.com">contact PCRecruiter Support</a> for guidance if you wish to enable this feature.</p>';
    465 
     464        echo '<p>When enabled, this feature will duplicate PCRecruiter\'s dynamic RSS feed as a static file at <a target="_blank" href="'. esc_url( site_url() ) .'/wp-content/uploads/pcrjobfeed.xml">'. esc_url( site_url() ) .'/wp-content/uploads/pcrjobfeed.xml</a>. You may use this data as a source for plugins and other third-party feed utilities.</p>';
    466465         // Check to see if "Store Local Feed" is active. If it is, show the manual save button
    467466                if($this->options['activation'] ?? false){
     
    470469                    if (file_exists($fname)) {
    471470                        $d = date ("F d Y H:i:s", filectime($fname));
    472                         echo "<em style=\"font-weight:bold\">" . $filename . " last updated: " . $d . " (UTC).</em>";
     471                        echo "<em style=\"font-weight:bold\">" . esc_html( $filename ) . " last updated: " . esc_html( $d ) . " (UTC).</em>";
    473472                    } else {
    474                         echo "<i>File " .$fname . " doesn't exist...</i>";
     473                        echo "<i>File " . esc_html( $fname ) . " doesn't exist...</i>";
    475474                    }
    476475                }
     
    496495        echo "<select id='frequency' name='pcr_feed_options[frequency]'>";
    497496        foreach($items as $item) {
    498             $selected = ($this->options['frequency']==$item) ? 'selected="selected"' : '';
    499             echo "<option value='$item' $selected>$item</option>";
     497            $selected = ($this->options['frequency'] == $item) ? 'selected="selected"' : '';
     498            echo "<option value='" . esc_attr( $item ) . "' " . esc_attr( $selected ) . ">" . esc_html( $item ) . "</option>";
    500499        }
    501500        echo "</select>";
     
    522521
    523522        printf(
    524             '<input type="text" id="custom_fields" name="pcr_feed_options[custom_fields]" value="%s" size="60" /><br /><span style="font-size:.8em;">Comma separated.</span>',
     523            '<input type="text" id="custom_fields" name="pcr_feed_options[custom_fields]" value="%s" size="60" /><br /><span style="font-size:.8em;">Comma separated. Be sure to replace any %%20 characters with spaces.</span>',
    525524            isset( $this->options['custom_fields'] ) ? esc_attr( $this->options['custom_fields']) : ''
    526525        );
     
    547546            $check2 = "";
    548547        }
    549         printf('<input type="radio" id="job" name="pcr_feed_options[mode]" value="job" %s /> Job Link<br />', $check1);
    550         printf('<input type="radio" id="apply" name="pcr_feed_options[mode]" value="apply" %s /> Apply Link<br />', $check2);
     548    printf('<input type="radio" id="%s" name="pcr_feed_options[mode]" value="job" %s /> %s<br />',
     549        esc_attr('job'),
     550        esc_attr($check1),
     551        esc_html('Job Link')
     552    );
     553    printf('<input type="radio" id="%s" name="pcr_feed_options[mode]" value="apply" %s /> %s<br />',
     554        esc_attr('apply'),
     555        esc_attr($check2),
     556        esc_html('Apply Link')
     557    );
    551558    }
    552559}
Note: See TracChangeset for help on using the changeset viewer.