View Single Post
Old 06-30-2011, 03:59 AM  
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,392

Quote:
Originally Posted by Jesus H Christ View Post
That is pure fucking ART! - Just 3 quick question. I understand it will pull synonymized feed text into a WP post format, but will comments be saved to draft for editing? If so- will the comments be synonymized? in draft?

Finally we need an option like CC to upload a text file of nicks/names to replace the yahoo ones or is that also available?
In the example above, the comments will be saved as approved ones. However, you can make them to be saved as drafts by changing this line:

'comment_approved' => 1,
to
'comment_approved' => 0,

That's all you need to do And yes, the post comments will be synonymized.

Quote:
Originally Posted by Jesus H Christ View Post
Finally we need an option like CC to upload a text file of nicks/names to replace the yahoo ones or is that also available?
Actually it's very easy to do. Let's consider, you have the fake nicks stored in the text file "nicks.txt" (one nick per line), so here is the modified code which will do the trick:

Code:
// comments' dates will be randomly generated as the date of syndication plus number 
// of seconds between $start_offset and $end_offset values, assigned below.
// E.g. from one hour to one week
$start_offset = 3600;
$end_offset = 604800;
// get Yahoo Answers page for the given keyword
$content = cseo_file_get_contents ( $post ['link'] );
// remove 'Resolved Question: ' from the title
$post ['post_title'] = str_replace('Resolved Question: ', '', $post ['post_title']);
// extract the original question
$post ['post_content'] = $post ['post_excerpt'] = preg_replace ( '/^(.*?<div class="content">)(.*?)(<\/div>.*?)$/s', "$2", $content );
// get answers
preg_match_all ( '/<span class="by">.*?<\/span>.*?<span.*?>(.*?)<\/span>.*?<div class="content">(.*?)<\/div>/s', $content, $answers );
// get fake nicks from a text file
$nicks = file ( 'nicks.txt' );
// generate post comments from the answers
for ($i = 0; $i < count ( $answers [1] ); $i ++) {
    $post['comments'][] = array(
    'comment_author' => trim ( $nicks [rand ( 0, count ( $nicks ) - 1 )] ),
    'comment_author_email' => '',
    'comment_author_url' => 'http://',
    'comment_content' => $answers [2][$i],
    'comment_type' => '',
    'comment_parent' => 0,
    'user_id' => 1,
    'comment_author_IP' => '127.0.0.1',
    'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
    'comment_date' => gmdate ( 'Y-m-d H:i:s', time() + rand ( $start_offset, $end_offset ) + 3600 * ( int ) get_option ( 'gmt_offset' ) ),
    'comment_approved' => 1,
    );
}
__________________
Obey the Cowgod

Last edited by just a punk; 06-30-2011 at 04:01 AM..
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote