Example #1
0
<?php

@set_time_limit(0);
// identify synonyms
if ($_GET['action'] == 'identifysyn') {
    //spintax
    require_once 'inc/class.spintax.php';
    //spin it now
    require_once 'inc/class.spin.php';
    $spin = new wp_auto_spin_spin($_POST['post_id'], $_POST['title'], $_POST['post']);
    $return = $spin->spin_wrap();
    $return['status'] = 'success';
    print_r(json_encode($return));
    //REWRITE
} elseif ($_GET['action'] == 'rewrite') {
    //spintax
    require_once 'inc/class.spintax.php';
    //generate new spintax
    $content = stripslashes($_POST['title'] . '**9999**' . $_POST['post']);
    $spintax = new wp_auto_spinner_Spintax();
    $spintaxed = $spintax->spin($content);
    $spintaxed_arr = explode('**9999**', $spintaxed);
    $spintaxed_ttl = $spintaxed_arr[0];
    $spintaxed_cnt = $spintaxed_arr[1];
    $post_id = $_POST['post_id'];
    $spintaxed2 = $spintax->editor_form;
    $spintaxed2_arr = explode('**9999**', $spintaxed2);
    $spintaxed2_cnt = $spintaxed2_arr[1];
    update_post_meta($post_id, 'spintaxed_cnt2', $spintaxed2_cnt);
    //update post meta
    $post_id = $_POST['post_id'];
Example #2
0
function wp_auto_spinner_post_spin($post_id)
{
    //let's spin this post
    //get the post
    $post_arr = get_post($post_id);
    //spin options
    $autospin = get_option('wp_auto_spin', array());
    $content = $post_arr->post_content;
    $ttl = $post_arr->post_title;
    $originalcontent = $content;
    //spin libs
    require_once dirname(__FILE__) . '/inc/class.spin.php';
    require_once dirname(__FILE__) . '/inc/class.spintax.php';
    //spin start
    $spin = new wp_auto_spin_spin($post_id, $ttl, $content);
    $spinned = $spin->spin_wrap();
    //spinned cnt
    $spinned_ttl = $spinned['spinned_ttl'];
    $spinned_cnt = $spinned['spinned_cnt'];
    $spintaxed_ttl = $spinned['spintaxed_ttl'];
    $spintaxed_cnt = $spinned['spintaxed_cnt'];
    $content = $spintaxed_cnt;
    //update the post
    $my_post = array();
    $my_post['ID'] = $post_id;
    if (!in_array('OPT_AUTO_SPIN_DEACTIVE_CNT', $autospin)) {
        $my_post['post_content'] = $content;
    }
    //update spinned title if allowed
    if (in_array('OPT_AUTO_SPIN_ACTIVE_TTL', $autospin)) {
        $my_post['post_title'] = $spintaxed_ttl;
    }
    //check if we should updat the slug .
    if (in_array('OPT_AUTO_SPIN_SLUG', $autospin)) {
        $my_post['post_name'] = '';
    }
    wp_auto_spinner_log_new('New Post >> Do Spin', 'Post with id {' . $post_id . '} spinned successfully .');
    // Update the post into the database
    wp_update_post($my_post);
}