WordPress.org

Ready to get started?Download WordPress

Forums

xmlrpc.php striping html (2 posts)

  1. systemex
    Member
    Posted 5 years ago #

    Hello
    I have 2 programs
    (Blog Post Builder) & (Qumana Blog Manager)
    and its uses the xmlrpc.php
    everything seems to go well but when it submits to my blog
    it seems to strip out the Angle brackets Ex: (<)(</)(>)
    I have disabled the Visual Editor
    and am running WP 2.7

    I have looked at the code
    and found this does it have anything to do with it
    and if so how can I stop it from doing this?

    // Work around bug in strip_tags():
    		$linea = str_replace('<!DOC', '<DOC', $linea);
    		$linea = preg_replace( '/[\s\r\n\t]+/', ' ', $linea ); // normalize spaces
    		$linea = preg_replace( "/ <(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea );
    
    		preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
    		$title = $matchtitle[1];
    		if ( empty( $title ) )
    			return new IXR_Error(32, __('We cannot find a title on that page.'));
    
    		$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
    
    		$p = explode( "\n\n", $linea );
    
    		$preg_target = preg_quote($pagelinkedto);
    
    		foreach ( $p as $para ) {
    			if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
    				preg_match("|[^>]+?".$preg_target."[^>]*>([^>]+?)|", $para, $context);
    
    				// If the URL isn't in a link context, keep looking
    				if ( empty($context) )
    					continue;
    
    				// We're going to use this fake tag to mark the context in a bit
    				// the marker is needed in case the link text appears more than once in the paragraph
    				$excerpt = preg_replace('|\</?wpcontext\>|', '', $para);
    
    				// prevent really long link text
    				if ( strlen($context[1]) > 100 )
    					$context[1] = substr($context[1], 0, 100) . '...';
    
    				$marker = '<wpcontext>'.$context[1].'</wpcontext>';    // set up our marker
    				$excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
    				$excerpt = strip_tags($excerpt, '<wpcontext>');        // strip all tags but our context marker
    				$excerpt = trim($excerpt);
    				$preg_marker = preg_quote($marker);
    				$excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
    				$excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
    				break;
    			}
    		}
    
    		if ( empty($context) ) // Link to target not found
    			return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
    
    		$pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
    
    		$context = '[...] ' . wp_specialchars( $excerpt ) . ' [...]';
    		$pagelinkedfrom = $wpdb->escape( $pagelinkedfrom );

    Thanks In Advanced
    systemex

  2. Joseph Scott
    Member
    Posted 5 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic