Plugin Directory

Changeset 3140738


Ignore:
Timestamp:
08/24/2024 12:40:49 PM (19 months ago)
Author:
zourbuth
Message:

Sanitized data input

Location:
wp-exporter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-exporter/trunk/index.php

    r3140658 r3140738  
    6464 */
    6565function wp_exporter_post_ids( $post_ids, $args ) {
    66     if ( 'advanced' == $args['content'] && isset( $_GET['query'] ) ) {
     66    if ( 'advanced' == esc_attr( $args['content'] ) && isset( $_GET['query'] ) ) {
    6767        $query = esc_attr( $_GET['query'] );
     68
    6869        if ( isset( $_GET['post_ids'] ) ) {
    69             $post_ids = (array) $_GET['post_ids'];
     70            $post_ids = array_map( 'sanitize_text_field', (array) $_GET['post_ids'] );
    7071            $post_ids = apply_filters( 'wp_exporter_post_ids', $post_ids, $query, $args );
    7172        }
     
    8182 */
    8283function export_wp_action( $args ) {
    83     if ( 'advanced' == $args['content'] ) {
     84    if ( 'advanced' == esc_attr( $args['content'] ) ) {
    8485        require_once( plugin_dir_path( __FILE__ ) . 'export.php' );
    8586       
  • wp-exporter/trunk/utility.php

    r3140658 r3140738  
    2828     */
    2929    function __construct() {
    30         add_filter( 'export_args', array( &$this, 'export_args' ), 1, 1 );
    3130        add_action( 'the_post', array( &$this, 'the_post' ), 1, 2 );
    3231    }
    3332
    3433    /**
    35      * Create admin bar export menu, before user profile menu
    36      *
    37      * @param $wp_admin_bar (object) WP_Admin_Bar
    38      * @since 0.0.5
    39      */
    40     public static function export_args( $args ) {
    41        
    42         return $args;
    43     }
    44 
    45     /**
    46      * Create admin bar export menu, before user profile menu
    47      *
    48      * @param $wp_admin_bar (object) WP_Admin_Bar
    49      * @since 0.0.5
    50      */
    51     public static function export_url() {
    52         global $post;
    53 
    54         $params = array(
    55             'download'      => 'true',
    56             'content'       => 'advanced',
    57             'content'       => 'advanced',
    58             'query'         => $post->post_type,
    59             'post_ids[]'    => $post->ID,
    60         );
    61 
    62         return admin_url( "export.php?" ) . http_build_query($params);
    63     }
    64 
    65     /**
    66      * Export action using custom query
     34     * Export action using custom quøery
    6735     * Modify post object while 'get_post' inside 'setup_postdata'
    6836     * Put define('WP_EXPORTER_POST_STATUS', 'draft'); in wp-config.php or theme functions.php
     
    7139     * @param $wp_query The current Query object (passed by reference).
    7240     * @since 0.0.5
    73      */ 
     41     */
    7442    function the_post( $post, $wp_query ) {
    75         if ( isset( $wp_query->wp_exporter ) && $wp_query->wp_exporter && defined('WP_EXPORTER_POST_STATUS') && isset( $GLOBALS['post'] ) ) {
    76             $GLOBALS['post']->post_status = WP_EXPORTER_POST_STATUS;   
    77             return $GLOBALS['post'];
     43        if ( isset( $wp_query->wp_exporter ) && $wp_query->wp_exporter &&
     44            defined( 'WP_EXPORTER_POST_STATUS' ) && isset( $GLOBALS[ 'post' ] ) ) {
     45                $GLOBALS[ 'post' ]->post_status = esc_attr( WP_EXPORTER_POST_STATUS ); 
     46                return $GLOBALS[ 'post' ];
    7847        }
    79     }   
     48    }
    8049
    8150} new WP_Export_Utility();
    82 
    8351
    8452/**
     
    8654 * @params $arr array()
    8755 * @since 0.0.5
    88  */ 
     56 */
    8957function _wp_exporter_debugr( $arr ) {
    9058    echo '<pre style="font-size:10px;line-height:10px;">'. print_r( $arr, true ) . '</pre>';
Note: See TracChangeset for help on using the changeset viewer.