Changeset 3140738
- Timestamp:
- 08/24/2024 12:40:49 PM (19 months ago)
- Location:
- wp-exporter/trunk
- Files:
-
- 2 edited
-
index.php (modified) (2 diffs)
-
utility.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-exporter/trunk/index.php
r3140658 r3140738 64 64 */ 65 65 function 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'] ) ) { 67 67 $query = esc_attr( $_GET['query'] ); 68 68 69 if ( isset( $_GET['post_ids'] ) ) { 69 $post_ids = (array) $_GET['post_ids'];70 $post_ids = array_map( 'sanitize_text_field', (array) $_GET['post_ids'] ); 70 71 $post_ids = apply_filters( 'wp_exporter_post_ids', $post_ids, $query, $args ); 71 72 } … … 81 82 */ 82 83 function export_wp_action( $args ) { 83 if ( 'advanced' == $args['content']) {84 if ( 'advanced' == esc_attr( $args['content'] ) ) { 84 85 require_once( plugin_dir_path( __FILE__ ) . 'export.php' ); 85 86 -
wp-exporter/trunk/utility.php
r3140658 r3140738 28 28 */ 29 29 function __construct() { 30 add_filter( 'export_args', array( &$this, 'export_args' ), 1, 1 );31 30 add_action( 'the_post', array( &$this, 'the_post' ), 1, 2 ); 32 31 } 33 32 34 33 /** 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 67 35 * Modify post object while 'get_post' inside 'setup_postdata' 68 36 * Put define('WP_EXPORTER_POST_STATUS', 'draft'); in wp-config.php or theme functions.php … … 71 39 * @param $wp_query The current Query object (passed by reference). 72 40 * @since 0.0.5 73 */ 41 */ 74 42 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' ]; 78 47 } 79 } 48 } 80 49 81 50 } new WP_Export_Utility(); 82 83 51 84 52 /** … … 86 54 * @params $arr array() 87 55 * @since 0.0.5 88 */ 56 */ 89 57 function _wp_exporter_debugr( $arr ) { 90 58 echo '<pre style="font-size:10px;line-height:10px;">'. print_r( $arr, true ) . '</pre>';
Note: See TracChangeset
for help on using the changeset viewer.